1use crate::{
2 inspect::{InspectCommitEvm, InspectEvm},
3 Inspector, InspectorEvmTr, InspectorHandler, JournalExt,
4};
5use context::{ContextSetters, ContextTr, Evm, JournalTr};
6use database_interface::DatabaseCommit;
7use handler::{
8 instructions::InstructionProvider, EthFrame, EvmTr, EvmTrError, Handler, MainnetHandler,
9 PrecompileProvider,
10};
11use interpreter::{interpreter::EthInterpreter, InterpreterResult};
12use state::EvmState;
13
14impl<EVM, ERROR> InspectorHandler for MainnetHandler<EVM, ERROR, EthFrame<EthInterpreter>>
16where
17 EVM: InspectorEvmTr<
18 Context: ContextTr<Journal: JournalTr<State = EvmState>>,
19 Frame = EthFrame<EthInterpreter>,
20 Inspector: Inspector<<<Self as Handler>::Evm as EvmTr>::Context, EthInterpreter>,
21 >,
22 ERROR: EvmTrError<EVM>,
23{
24 type IT = EthInterpreter;
25}
26
27impl<CTX, INSP, INST, PRECOMPILES> InspectEvm
29 for Evm<CTX, INSP, INST, PRECOMPILES, EthFrame<EthInterpreter>>
30where
31 CTX: ContextSetters + ContextTr<Journal: JournalTr<State = EvmState> + JournalExt>,
32 INSP: Inspector<CTX, EthInterpreter>,
33 INST: InstructionProvider<Context = CTX, InterpreterTypes = EthInterpreter>,
34 PRECOMPILES: PrecompileProvider<CTX, Output = InterpreterResult>,
35{
36 type Inspector = INSP;
37
38 fn set_inspector(&mut self, inspector: Self::Inspector) {
39 self.inspector = inspector;
40 }
41
42 fn inspect_one_tx(&mut self, tx: Self::Tx) -> Result<Self::ExecutionResult, Self::Error> {
43 self.set_tx(tx);
44 MainnetHandler::default().inspect_run(self)
45 }
46}
47
48impl<CTX, INSP, INST, PRECOMPILES> InspectCommitEvm
50 for Evm<CTX, INSP, INST, PRECOMPILES, EthFrame<EthInterpreter>>
51where
52 CTX: ContextSetters
53 + ContextTr<Journal: JournalTr<State = EvmState> + JournalExt, Db: DatabaseCommit>,
54 INSP: Inspector<CTX, EthInterpreter>,
55 INST: InstructionProvider<Context = CTX, InterpreterTypes = EthInterpreter>,
56 PRECOMPILES: PrecompileProvider<CTX, Output = InterpreterResult>,
57{
58}
59
60impl<CTX, INSP, I, P> InspectorEvmTr for Evm<CTX, INSP, I, P, EthFrame<EthInterpreter>>
62where
63 CTX: ContextTr<Journal: JournalExt> + ContextSetters,
64 I: InstructionProvider<Context = CTX, InterpreterTypes = EthInterpreter>,
65 P: PrecompileProvider<CTX, Output = InterpreterResult>,
66 INSP: Inspector<CTX, I::InterpreterTypes>,
67{
68 type Inspector = INSP;
69
70 fn inspector(&mut self) -> &mut Self::Inspector {
71 &mut self.inspector
72 }
73
74 fn ctx_inspector(&mut self) -> (&mut Self::Context, &mut Self::Inspector) {
75 (&mut self.ctx, &mut self.inspector)
76 }
77
78 fn ctx_inspector_frame(
79 &mut self,
80 ) -> (&mut Self::Context, &mut Self::Inspector, &mut Self::Frame) {
81 (&mut self.ctx, &mut self.inspector, self.frame_stack.get())
82 }
83
84 fn ctx_inspector_frame_instructions(
85 &mut self,
86 ) -> (
87 &mut Self::Context,
88 &mut Self::Inspector,
89 &mut Self::Frame,
90 &mut Self::Instructions,
91 ) {
92 (
93 &mut self.ctx,
94 &mut self.inspector,
95 self.frame_stack.get(),
96 &mut self.instruction,
97 )
98 }
99}