Skip to content

Commit

Permalink
Breaking: rename "EVM interpreter" -> "EVM emulator"
Browse files Browse the repository at this point in the history
  • Loading branch information
slowli committed Jan 24, 2025
1 parent 34ec535 commit efcbece
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions crates/vm2/benches/nested_near_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn nested_near_call(bencher: Bencher) {
10_000_000,
Settings {
default_aa_code_hash: [0; 32],
evm_interpreter_code_hash: [0; 32],
evm_emulator_code_hash: [0; 32],
hook_address: 0,
},
);
Expand Down Expand Up @@ -83,7 +83,7 @@ fn nested_near_call_with_storage_write(bencher: Bencher) {
80_000_000,
Settings {
default_aa_code_hash: [0; 32],
evm_interpreter_code_hash: [0; 32],
evm_emulator_code_hash: [0; 32],
hook_address: 0,
},
);
Expand Down
4 changes: 2 additions & 2 deletions crates/vm2/src/callframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ impl<T, W> Callframe<T, W> {
exception_handler: u16,
context_u128: u128,
is_static: bool,
is_evm_interpreter: bool,
is_evm_emulator: bool,
world_before_this_frame: Snapshot,
) -> Self {
let is_kernel = is_kernel(address);
let heap_size = if is_kernel {
NEW_KERNEL_FRAME_MEMORY_STIPEND
} else if is_evm_interpreter {
} else if is_evm_emulator {
NEW_EVM_FRAME_MEMORY_STIPEND
} else {
NEW_FRAME_MEMORY_STIPEND
Expand Down
4 changes: 2 additions & 2 deletions crates/vm2/src/decommit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ impl WorldDiff {
tracer: &mut T,
address: U256,
default_aa_code_hash: [u8; 32],
evm_interpreter_code_hash: [u8; 32],
evm_emulator_code_hash: [u8; 32],
is_constructor_call: bool,
) -> Option<(UnpaidDecommit, bool)> {
let deployer_system_contract_address =
Expand Down Expand Up @@ -63,7 +63,7 @@ impl WorldDiff {
try_default_aa?
} else {
is_evm = true;
evm_interpreter_code_hash
evm_emulator_code_hash
}
}
_ if code_info == U256::zero() => try_default_aa?,
Expand Down
12 changes: 6 additions & 6 deletions crates/vm2/src/instruction_handlers/far_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ where
tracer,
destination_address,
vm.settings.default_aa_code_hash,
vm.settings.evm_interpreter_code_hash,
vm.settings.evm_emulator_code_hash,
abi.is_constructor_call,
);

Expand Down Expand Up @@ -104,7 +104,7 @@ where
let new_frame_gas = normally_passed_gas + mandated_gas;

// A far call pushes a new frame and returns from it in the next instruction if it panics.
let (calldata, program, is_evm_interpreter) =
let (calldata, program, is_evm_emulator) =
fallible_part.unwrap_or_else(|| (U256::zero().into(), Program::new_panicking(), false));

let new_frame_is_static = IS_STATIC || vm.state.current_frame.is_static;
Expand All @@ -113,8 +113,8 @@ where
program,
new_frame_gas,
exception_handler,
new_frame_is_static && !is_evm_interpreter,
is_evm_interpreter,
new_frame_is_static && !is_evm_emulator,
is_evm_emulator,
calldata.memory_page,
vm.world_diff.snapshot(),
);
Expand All @@ -134,8 +134,8 @@ where
vm.state.register_pointer_flags = 2;
vm.state.registers[1] = calldata.into_u256();

let is_static_call_to_evm_interpreter = new_frame_is_static && is_evm_interpreter;
let call_type = (u8::from(is_static_call_to_evm_interpreter) << 2)
let is_static_call_to_evm_emulator = new_frame_is_static && is_evm_emulator;
let call_type = (u8::from(is_static_call_to_evm_emulator) << 2)
| (u8::from(abi.is_system_call) << 1)
| u8::from(abi.is_constructor_call);

Expand Down
2 changes: 1 addition & 1 deletion crates/vm2/src/single_instruction_test/into_zk_evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub fn vm2_to_zk_evm<T: Tracer, W: World<T>>(
local_state: vm2_state_to_zk_evm_state(&vm.state),
block_properties: BlockProperties {
default_aa_code_hash: U256::from_big_endian(&vm.settings.default_aa_code_hash),
evm_simulator_code_hash: U256::from_big_endian(&vm.settings.evm_interpreter_code_hash),
evm_simulator_code_hash: U256::from_big_endian(&vm.settings.evm_emulator_code_hash),
zkporter_is_available: false,
},
storage: MockWorldWrapper(world),
Expand Down
8 changes: 4 additions & 4 deletions crates/vm2/src/single_instruction_test/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ impl<'a> Arbitrary<'a> for Settings {
default_aa_code_hash[0] = 1;
u.fill_buffer(&mut default_aa_code_hash[2..])?;

let mut evm_interpreter_code_hash = [0u8; 32];
evm_interpreter_code_hash[0] = 1;
u.fill_buffer(&mut evm_interpreter_code_hash[2..])?;
let mut evm_emulator_code_hash = [0u8; 32];
evm_emulator_code_hash[0] = 1;
u.fill_buffer(&mut evm_emulator_code_hash[2..])?;

Ok(Self {
default_aa_code_hash,
evm_interpreter_code_hash,
evm_emulator_code_hash,
hook_address: 0, // Doesn't matter; we don't decode in bootloader mode
})
}
Expand Down
2 changes: 1 addition & 1 deletion crates/vm2/src/tests/bytecode_behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn call_to_invalid_address() {
10000,
Settings {
default_aa_code_hash: [0; 32],
evm_interpreter_code_hash: [0; 32],
evm_emulator_code_hash: [0; 32],
hook_address: 0,
},
);
Expand Down
4 changes: 2 additions & 2 deletions crates/vm2/src/tests/far_call_decommitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ fn test() {
initial_gas,
Settings {
default_aa_code_hash: [0; 32],
evm_interpreter_code_hash: [0; 32],
evm_emulator_code_hash: [0; 32],
hook_address: 0,
},
);
Expand Down Expand Up @@ -160,7 +160,7 @@ fn test_with_initial_out_of_gas_error() {
10_000,
Settings {
default_aa_code_hash: [0; 32],
evm_interpreter_code_hash: [0; 32],
evm_emulator_code_hash: [0; 32],
hook_address: 0,
},
);
Expand Down
2 changes: 1 addition & 1 deletion crates/vm2/src/tests/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ proptest! {
1000,
Settings {
default_aa_code_hash: [0; 32],
evm_interpreter_code_hash: [0; 32],
evm_emulator_code_hash: [0; 32],
hook_address: 0,
},
);
Expand Down
2 changes: 1 addition & 1 deletion crates/vm2/src/tests/trace_failing_far_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ fn trace_failing_far_call() {
1000,
Settings {
default_aa_code_hash: [0; 32],
evm_interpreter_code_hash: [0; 32],
evm_emulator_code_hash: [0; 32],
hook_address: 0,
},
);
Expand Down
2 changes: 1 addition & 1 deletion crates/vm2/src/tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ mod test {
1000,
crate::Settings {
default_aa_code_hash: [0; 32],
evm_interpreter_code_hash: [0; 32],
evm_emulator_code_hash: [0; 32],
hook_address: 0,
},
);
Expand Down
8 changes: 4 additions & 4 deletions crates/vm2/src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ use crate::{
pub struct Settings {
/// Bytecode hash of the default account abstraction contract.
pub default_aa_code_hash: [u8; 32],
/// Bytecode hash of the EVM interpreter.
pub evm_interpreter_code_hash: [u8; 32],
/// Bytecode hash of the EVM emulator.
pub evm_emulator_code_hash: [u8; 32],
/// Writing to this address in the bootloader's heap suspends execution
pub hook_address: u32,
}
Expand Down Expand Up @@ -199,7 +199,7 @@ impl<T: Tracer, W> VirtualMachine<T, W> {
gas: u32,
exception_handler: u16,
is_static: bool,
is_evm_interpreter: bool,
is_evm_emulator: bool,
calldata_heap: HeapId,
world_before_this_frame: Snapshot,
) {
Expand Down Expand Up @@ -228,7 +228,7 @@ impl<T: Tracer, W> VirtualMachine<T, W> {
self.state.context_u128
},
is_static,
is_evm_interpreter,
is_evm_emulator,
world_before_this_frame,
);
self.state.context_u128 = 0;
Expand Down

0 comments on commit efcbece

Please sign in to comment.