From c65544e9f07f8aab054ff8d0ccce101b537ac780 Mon Sep 17 00:00:00 2001 From: Soham Zemse <22412996+zemse@users.noreply.github.com> Date: Thu, 4 Apr 2024 12:01:03 +0530 Subject: [PATCH] clear transient storage at end tx --- bus-mapping/src/circuit_input_builder.rs | 1 + bus-mapping/src/state_db.rs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/bus-mapping/src/circuit_input_builder.rs b/bus-mapping/src/circuit_input_builder.rs index 8f6e1d6a0c..b92ef9cb34 100644 --- a/bus-mapping/src/circuit_input_builder.rs +++ b/bus-mapping/src/circuit_input_builder.rs @@ -460,6 +460,7 @@ impl<'a, C: CircuitsParams> CircuitInputBuilder { // Generate EndTx step let end_tx_step = gen_associated_steps(&mut self.state_ref(&mut tx, &mut tx_ctx), ExecState::EndTx)?; + self.sdb.clear_transient_storage(); tx.steps_mut().push(end_tx_step.clone()); (end_tx_step, last_call) } else if self.feature_config.invalid_tx { diff --git a/bus-mapping/src/state_db.rs b/bus-mapping/src/state_db.rs index 39c044f0d6..6b92df6439 100644 --- a/bus-mapping/src/state_db.rs +++ b/bus-mapping/src/state_db.rs @@ -332,6 +332,11 @@ impl StateDB { } self.refund = 0; } + + /// Clear transient storage. + pub fn clear_transient_storage(&mut self) { + self.transient_storage = HashMap::new(); + } } #[cfg(test)]