Skip to content

Commit

Permalink
Merge #1759
Browse files Browse the repository at this point in the history
1759: Do not check ongoing list if the block has not changed r=Deniallugo a=Deniallugo

Signed-off-by: deniallugo <[email protected]>

Co-authored-by: deniallugo <[email protected]>
  • Loading branch information
bors-matterlabs-dev[bot] and Deniallugo authored Jul 16, 2021
2 parents 24c42fb + 8d265db commit d67fa7a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions core/bin/zksync_eth_sender/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,6 @@ impl<DB: DatabaseInterface> ETHSender<DB> {
}
};

// Queue for storing all the operations that were not finished at this iteration.
let mut new_ongoing_ops = VecDeque::new();

while let Some(tx) = self.tx_queue.pop_front() {
if let Err(e) = self.initialize_operation(tx.clone(), current_block).await {
Self::process_error(e).await;
Expand All @@ -279,7 +276,11 @@ impl<DB: DatabaseInterface> ETHSender<DB> {
// states for the block with number `last_used_block` on the previous call of
// `proceed_next_operations`, so if the block number hasn't changed we shouldn't request
// states because it would be spare requests.
// The ongoing operations list would be the same for the next step
if last_used_block != current_block {
// Queue for storing all the operations that were not finished at this iteration.
let mut new_ongoing_ops = VecDeque::new();

// Commit the next operations (if any).
while let Some(mut current_op) = self.ongoing_ops.pop_front() {
// We perform a commitment step here. In case of error, we suppose that this is some
Expand Down Expand Up @@ -308,15 +309,14 @@ impl<DB: DatabaseInterface> ETHSender<DB> {
}
}
}
assert!(
self.ongoing_ops.is_empty(),
"Ongoing ops queue should be empty after draining"
);
// Store the ongoing operations for the next round.
self.ongoing_ops = new_ongoing_ops;
}

assert!(
self.ongoing_ops.is_empty(),
"Ongoing ops queue should be empty after draining"
);

// Store the ongoing operations for the next round.
self.ongoing_ops = new_ongoing_ops;
metrics::histogram!("eth_sender.proceed_next_operations", start.elapsed());
current_block
}
Expand Down

0 comments on commit d67fa7a

Please sign in to comment.