Skip to content

Commit b2a9720

Browse files
authored
added execute_block (#50)
* added execute * changes
1 parent a661583 commit b2a9720

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Diff for: crates/evm/src/block/mod.rs

+17
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,23 @@ pub trait BlockExecutor {
112112

113113
/// Exposes mutable reference to EVM.
114114
fn evm_mut(&mut self) -> &mut Self::Evm;
115+
116+
/// Executes all transactions in a block, applying pre and post execution changes.
117+
fn execute_block(
118+
mut self,
119+
transactions: impl IntoIterator<Item = impl ExecutableTx<Self>>,
120+
) -> Result<BlockExecutionResult<Self::Receipt>, BlockExecutionError>
121+
where
122+
Self: Sized,
123+
{
124+
self.apply_pre_execution_changes()?;
125+
126+
for tx in transactions {
127+
self.execute_transaction(tx)?;
128+
}
129+
130+
self.apply_post_execution_changes()
131+
}
115132
}
116133

117134
/// A helper trait encapsulating the constraints on [`BlockExecutor`] produced by the

0 commit comments

Comments
 (0)