diff --git a/crates/sequencer/src/commit.rs b/crates/sequencer/src/commit.rs index 0b221fc3..92493087 100644 --- a/crates/sequencer/src/commit.rs +++ b/crates/sequencer/src/commit.rs @@ -3,11 +3,11 @@ use blockifier::state::{ state_api::{State as BlockifierState, StateReader as BlockifierStateReader}, }; -pub trait Committer: BlockifierState + BlockifierStateReader { - fn commit(cached_state: &mut CachedState<&mut S>) - where - for<'a> &'a mut S: BlockifierState + BlockifierStateReader, - { +pub trait Committer +where + for<'a> &'a mut S: BlockifierState + BlockifierStateReader, +{ + fn commit(cached_state: &mut CachedState<&mut S>) { let diff = cached_state.to_state_diff(); for (address, class_hash) in diff.address_to_class_hash { let _ = cached_state.state.set_class_hash_at(address, class_hash); diff --git a/crates/sequencer/src/sequencer.rs b/crates/sequencer/src/sequencer.rs index a86796ff..d33a15f2 100644 --- a/crates/sequencer/src/sequencer.rs +++ b/crates/sequencer/src/sequencer.rs @@ -21,7 +21,7 @@ use tracing::{trace, warn}; /// For more details, check out https://doc.rust-lang.org/nomicon/hrtb.html pub struct Sequencer where - for<'a> &'a mut S: State + StateReader + Committer, + for<'a> &'a mut S: State + StateReader, { pub context: BlockContext, pub state: S, @@ -29,7 +29,7 @@ where impl Sequencer where - for<'a> &'a mut S: State + StateReader + Committer, + for<'a> &'a mut S: State + StateReader, { /// Creates a new Sequencer instance. pub fn new(context: BlockContext, state: S) -> Self { @@ -39,7 +39,7 @@ where impl Execution for Sequencer where - for<'a> &'a mut S: State + StateReader + Committer, + for<'a> &'a mut S: State + StateReader + Committer, { fn execute(&mut self, transaction: Transaction) -> Result<(), TransactionExecutionError> { let mut cached_state = CachedState::new(&mut self.state); diff --git a/crates/sequencer/src/state.rs b/crates/sequencer/src/state.rs index 081aec39..feddfcb1 100644 --- a/crates/sequencer/src/state.rs +++ b/crates/sequencer/src/state.rs @@ -31,7 +31,7 @@ pub struct State { nonces: FxHashMap, } -impl Committer for &mut State {} +impl Committer for &mut State {} /// State implementation for the sequencer. We use a mutable reference to the state /// because this is what will be available during the implementation of the execution.