diff --git a/crates/inspector/src/inspector_context.rs b/crates/inspector/src/inspector_context.rs index a7391220d1..f5d696eb4d 100644 --- a/crates/inspector/src/inspector_context.rs +++ b/crates/inspector/src/inspector_context.rs @@ -14,37 +14,28 @@ use crate::{journal::JournalExtGetter, GetInspector, Inspector, InspectorCtx}; /// EVM context contains data that EVM needs for execution. #[derive(Clone, Debug)] -pub struct InspectorContext -where - CTX: DatabaseGetter, -{ +pub struct InspectorContext { pub inspector: INSP, pub inner: CTX, pub frame_input_stack: Vec, } -impl< - INSP: Inspector, - DB: Database, - CTX: EthContext + DatabaseGetter, - > EthContext for InspectorContext +impl, CTX: EthContext + DatabaseGetter> EthContext + for InspectorContext { } -impl< - INSP: Inspector, - DB: Database, - CTX: EthContext + DatabaseGetter, - > EthContext for &mut InspectorContext +impl, CTX: EthContext + DatabaseGetter> EthContext + for &mut InspectorContext { } -impl InspectorContext +impl InspectorContext where CTX: BlockGetter + TransactionGetter + CfgGetter - + DatabaseGetter + + DatabaseGetter + JournalGetter + ErrorGetter + Host, @@ -58,10 +49,10 @@ where } } -impl InspectorCtx for InspectorContext +impl InspectorCtx for InspectorContext where INSP: GetInspector, - CTX: DatabaseGetter, + CTX: DatabaseGetter, { type IT = EthInterpreter; @@ -146,9 +137,9 @@ where } } -impl CfgGetter for InspectorContext +impl CfgGetter for InspectorContext where - CTX: CfgGetter + DatabaseGetter, + CTX: CfgGetter + DatabaseGetter, { type Cfg = ::Cfg; @@ -157,10 +148,9 @@ where } } -impl JournalGetter for InspectorContext +impl JournalGetter for InspectorContext where - CTX: JournalGetter + DatabaseGetter, - DB: Database, + CTX: JournalGetter + DatabaseGetter, { type Journal = ::Journal; @@ -173,20 +163,18 @@ where } } -impl, DB: Database, CTX> Host - for InspectorContext +impl, CTX> Host for InspectorContext where - CTX: Host + DatabaseGetter, + CTX: Host + DatabaseGetter, { - fn set_error(&mut self, error: ::Error) { + fn set_error(&mut self, error: ::Error) { self.inner.set_error(error); } } -impl DatabaseGetter for InspectorContext +impl DatabaseGetter for InspectorContext where - CTX: DatabaseGetter, - DB: Database, + CTX: DatabaseGetter, { type Database = ::Database; @@ -199,9 +187,9 @@ where } } -impl ErrorGetter for InspectorContext +impl ErrorGetter for InspectorContext where - CTX: ErrorGetter + JournalGetter, + CTX: ErrorGetter + JournalGetter, { type Error = ::Error; @@ -210,9 +198,9 @@ where } } -impl TransactionGetter for InspectorContext +impl TransactionGetter for InspectorContext where - CTX: TransactionGetter + DatabaseGetter, + CTX: TransactionGetter + DatabaseGetter, { type Transaction = ::Transaction; @@ -221,18 +209,18 @@ where } } -impl TransactionSetter for InspectorContext +impl TransactionSetter for InspectorContext where - CTX: TransactionSetter + DatabaseGetter, + CTX: TransactionSetter + DatabaseGetter, { fn set_tx(&mut self, tx: ::Transaction) { self.inner.set_tx(tx); } } -impl BlockGetter for InspectorContext +impl BlockGetter for InspectorContext where - CTX: BlockGetter + DatabaseGetter, + CTX: BlockGetter + DatabaseGetter, { type Block = ::Block; @@ -241,18 +229,18 @@ where } } -impl BlockSetter for InspectorContext +impl BlockSetter for InspectorContext where - CTX: BlockSetter + DatabaseGetter, + CTX: BlockSetter + DatabaseGetter, { fn set_block(&mut self, block: ::Block) { self.inner.set_block(block); } } -impl JournalExtGetter for InspectorContext +impl JournalExtGetter for InspectorContext where - CTX: JournalExtGetter + DatabaseGetter, + CTX: JournalExtGetter + DatabaseGetter, { type JournalExt = ::JournalExt; @@ -261,9 +249,9 @@ where } } -impl PerformantContextAccess for InspectorContext +impl PerformantContextAccess for InspectorContext where - CTX: PerformantContextAccess + DatabaseGetter, + CTX: PerformantContextAccess + DatabaseGetter, { type Error = ::Error; diff --git a/crates/optimism/src/l1block.rs b/crates/optimism/src/l1block.rs index a56f71d6f4..af7220f9ff 100644 --- a/crates/optimism/src/l1block.rs +++ b/crates/optimism/src/l1block.rs @@ -264,8 +264,8 @@ impl> L1BlockInfo } } -impl + L1BlockInfoGetter> L1BlockInfoGetter - for InspectorContext +impl L1BlockInfoGetter + for InspectorContext { fn l1_block_info(&self) -> &L1BlockInfo { self.inner.l1_block_info() diff --git a/crates/optimism/src/transaction/abstraction.rs b/crates/optimism/src/transaction/abstraction.rs index 6ae184677e..167b8c515d 100644 --- a/crates/optimism/src/transaction/abstraction.rs +++ b/crates/optimism/src/transaction/abstraction.rs @@ -34,8 +34,8 @@ impl, } } -impl + OpTxGetter + TransactionGetter> OpTxGetter - for InspectorContext +impl OpTxGetter + for InspectorContext { type OpTransaction = ::OpTransaction; diff --git a/examples/cheatcode_inspector/src/main.rs b/examples/cheatcode_inspector/src/main.rs index 5de8cc180f..6af133a6f1 100644 --- a/examples/cheatcode_inspector/src/main.rs +++ b/examples/cheatcode_inspector/src/main.rs @@ -287,11 +287,7 @@ trait DatabaseExt: Journal { TxT: Transaction, CfgT: Cfg, PrecompileT: PrecompileProvider< - Context = InspectorContext< - InspectorT, - InMemoryDB, - Context, - >, + Context = InspectorContext>, Output = InterpreterResult, Error = EVMError, >; @@ -387,7 +383,7 @@ where context .journal() .method_that_takes_inspector_as_argument::<&mut Self, BlockT, TxT, CfgT, EthPrecompileProvider< - InspectorContext<&mut Self, InMemoryDB, Context>, + InspectorContext<&mut Self, Context>, EVMError, >>( Env { @@ -486,7 +482,6 @@ where let mut inspector_context = InspectorContext::< InspectorT, - InMemoryDB, Context, >::new(context, inspector);