Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
Signed-off-by: deniallugo <[email protected]>
  • Loading branch information
Deniallugo committed Jan 25, 2022
1 parent 5114868 commit 7b5a6d7
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 25 deletions.
15 changes: 15 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ members = [
"core/bin/parse_pub_data",
"core/bin/block_revert",
"core/bin/remove_proofs",

"core/bin/remove_outstanding_tx_filters",
# Server micro-services
"core/bin/zksync_api",
"core/bin/zksync_core",
Expand Down
40 changes: 20 additions & 20 deletions core/lib/storage/sqlx-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -7052,26 +7052,6 @@
]
}
},
"e8c69e16fe0e447d578dee61807b418ee4e8d5aebb60034cbc640eafceb593e2": {
"query": "SELECT tx_hash FROM executed_transactions WHERE success = false AND created_at < $1 LIMIT 1000",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "tx_hash",
"type_info": "Bytea"
}
],
"parameters": {
"Left": [
"Timestamptz"
]
},
"nullable": [
false
]
}
},
"e99d990d2d9b1c6068efb623634d6d6cf49a3c7ec33a5a916b7ddaa745e24c9b": {
"query": "\n SELECT * FROM prover_job_queue\n WHERE job_status = $1\n ORDER BY (job_priority, id, first_block)\n LIMIT 1\n ",
"describe": {
Expand Down Expand Up @@ -7723,6 +7703,26 @@
]
}
},
"f57d1b54785c52a96afa9a95c4f1a08808732c9aaa850c32ed7d1158fdf541c4": {
"query": "\n SELECT tx_hash FROM executed_transactions \n WHERE success = false AND created_at < $1 LIMIT 1000",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "tx_hash",
"type_info": "Bytea"
}
],
"parameters": {
"Left": [
"Timestamptz"
]
},
"nullable": [
false
]
}
},
"f5a24f01f525ede5d8e61b97e452a82d372c2bececacf693ab654eef0e453d94": {
"query": "SELECT max(to_block) from aggregate_operations where action_type = $1",
"describe": {
Expand Down
14 changes: 10 additions & 4 deletions core/lib/storage/src/chain/operations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,16 @@ impl<'a, 'c> OperationsSchema<'a, 'c> {

let mut transaction = self.0.start_transaction().await?;
let offset = Utc::now() - max_age;
let tx_hashes: Vec<Vec<u8>> = sqlx::query!("SELECT tx_hash FROM executed_transactions WHERE success = false AND created_at < $1 LIMIT 1000", offset).fetch_all(transaction.conn()).await?
let tx_hashes: Vec<Vec<u8>> = sqlx::query!(
r#"
SELECT tx_hash FROM executed_transactions
WHERE success = false AND created_at < $1 LIMIT 1000"#,
offset
)
.fetch_all(transaction.conn())
.await?
.into_iter()
.map(|value| {
value.tx_hash
})
.map(|value| value.tx_hash)
.collect();

sqlx::query!(
Expand All @@ -300,6 +305,7 @@ impl<'a, 'c> OperationsSchema<'a, 'c> {
);
Ok(())
}

// TODO remove it ZKS-931
pub async fn remove_outstanding_tx_filters(&mut self) -> QueryResult<()> {
// We can do something like this, but this query will block tx_filter table for a long long time.
Expand Down

0 comments on commit 7b5a6d7

Please sign in to comment.