From b779396970f593e64bd39c87ba9b8b961fa6b393 Mon Sep 17 00:00:00 2001 From: fborello-lambda Date: Wed, 11 Dec 2024 16:30:58 -0300 Subject: [PATCH] fix: avoid storing old proofs --- crates/l2/proposer/prover_server.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/l2/proposer/prover_server.rs b/crates/l2/proposer/prover_server.rs index 029e09813..5dda1ce2f 100644 --- a/crates/l2/proposer/prover_server.rs +++ b/crates/l2/proposer/prover_server.rs @@ -414,10 +414,16 @@ impl ProverServer { // Avoid storing a proof of a future block_number // CHECK: maybe we would like to store all the proofs given the case in which // the provers generate them fast enough. In this way, we will avoid unneeded reexecution. - if block_number != (block_to_verify) { + if block_number != block_to_verify { return Err(ProverServerError::Custom(format!("Prover Client submitted an invalid block_number: {block_number}. The last_proved_block is: {last_verified_block}"))); } + // If the transaction was submitted for the block_to_verify + // avoid storing already used proofs. + if tx_submitted { + return Ok(()); + } + // The proof is stored, // then if we have all the proofs, we send it in the loop's next iteration. // Check if we have an entry for the block_number