Skip to content

Commit 3e8b545

Browse files
committed
fix: use normal table for inspectors
1 parent dfd43aa commit 3e8b545

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

crates/handler/src/instructions.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use auto_impl::auto_impl;
22
use interpreter::{
3+
instruction_table,
34
instructions::{instruction_table_tail, InstructionTable},
45
Host, Instruction, InterpreterTypes,
56
};
@@ -40,19 +41,30 @@ where
4041
WIRE: InterpreterTypes,
4142
HOST: Host,
4243
{
43-
/// Returns `EthInstructions` with mainnet spec.
44+
/// Returns an instance with the default mainnet instructions.
45+
#[inline]
4446
pub fn new_mainnet() -> Self {
4547
Self::new(instruction_table_tail::<WIRE, HOST>())
4648
}
4749

48-
/// Rerurns new `EthInstructions` with custom instruction table.
50+
/// Returns an instance with the default mainnet inspectable instructions.
51+
///
52+
/// Use this for inspectors and for stepping through the instructions.
53+
#[inline]
54+
pub fn new_mainnet_no_tail() -> Self {
55+
Self::new(instruction_table::<WIRE, HOST>())
56+
}
57+
58+
/// Returns an instance new `EthInstructions` with custom instruction table.
59+
#[inline]
4960
pub fn new(base_table: InstructionTable<WIRE, HOST>) -> Self {
5061
Self {
5162
instruction_table: Box::new(base_table),
5263
}
5364
}
5465

55-
/// Inserts a new instruction into the instruction table.s
66+
/// Inserts a new instruction into the instruction table.
67+
#[inline]
5668
pub fn insert_instruction(&mut self, opcode: u8, instruction: Instruction<WIRE, HOST>) {
5769
self.instruction_table[opcode as usize] = instruction;
5870
}

crates/handler/src/mainnet_builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ where
3939
Evm {
4040
ctx: self,
4141
inspector: (),
42-
instruction: EthInstructions::default(),
42+
instruction: EthInstructions::new_mainnet(),
4343
precompiles: EthPrecompiles::default(),
4444
frame_stack: FrameStack::new(),
4545
}
@@ -52,7 +52,7 @@ where
5252
Evm {
5353
ctx: self,
5454
inspector,
55-
instruction: EthInstructions::default(),
55+
instruction: EthInstructions::new_mainnet_no_tail(),
5656
precompiles: EthPrecompiles::default(),
5757
frame_stack: FrameStack::new(),
5858
}

crates/interpreter/src/instructions.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ impl InstructionReturn {
6767
}
6868
}
6969

70+
// TODO: flip naming? default to tail?
71+
7072
/// Returns the default instruction table for the given interpreter types and host.
7173
#[inline]
7274
pub const fn instruction_table<W: InterpreterTypes, H: Host + ?Sized>() -> InstructionTable<W, H> {

0 commit comments

Comments
 (0)