Skip to content

Commit

Permalink
Remove HaltReason from Halt (just to check performance)
Browse files Browse the repository at this point in the history
  • Loading branch information
lima-limon-inc committed Jan 29, 2025
1 parent fd02cf3 commit 85134bf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion crates/vm/levm/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ pub enum PrecompileError {
/// "Stop" is an Opcode
pub enum OpcodeResult {
Continue { pc_increment: usize },
Halt(HaltReason),
Halt,
}

#[derive(Debug, Clone, PartialEq, Eq)]
Expand Down
4 changes: 2 additions & 2 deletions crates/vm/levm/src/execution_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl VM {
current_call_frame: &mut CallFrame,
) -> Result<OpcodeResult, VMError> {
match opcode {
Opcode::STOP => Ok(OpcodeResult::Halt(HaltReason::Stop)),
Opcode::STOP => Ok(OpcodeResult::Halt),
Opcode::ADD => self.op_add(current_call_frame),
Opcode::MUL => self.op_mul(current_call_frame),
Opcode::SUB => self.op_sub(current_call_frame),
Expand Down Expand Up @@ -168,7 +168,7 @@ impl VM {

pub fn handle_opcode_result(
&mut self,
_reason: HaltReason,
// _reason: HaltReason,
current_call_frame: &mut CallFrame,
backup: StateBackup,
) -> Result<TransactionReport, VMError> {
Expand Down
6 changes: 3 additions & 3 deletions crates/vm/levm/src/opcode_handlers/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ impl VM {
.map_err(|_err| VMError::VeryLargeNumber)?;

if size == 0 {
return Ok(OpcodeResult::Halt(HaltReason::Return));
return Ok(OpcodeResult::Halt);
}

let new_memory_size = calculate_memory_size(offset, size)?;
Expand All @@ -210,7 +210,7 @@ impl VM {
.to_vec()
.into();

Ok(OpcodeResult::Halt(HaltReason::Return))
Ok(OpcodeResult::Halt)
}

// DELEGATECALL operation
Expand Down Expand Up @@ -561,7 +561,7 @@ impl VM {
.insert(current_call_frame.to);
}

Ok(OpcodeResult::Halt(HaltReason::SelfDestruct))
Ok(OpcodeResult::Halt)
}

/// Common behavior for CREATE and CREATE2 opcodes
Expand Down
4 changes: 2 additions & 2 deletions crates/vm/levm/src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ impl VM {
Ok(OpcodeResult::Continue { pc_increment }) => {
current_call_frame.increment_pc_by(pc_increment)?
}
Ok(OpcodeResult::Halt(reason)) => {
return self.handle_opcode_result(reason, current_call_frame, backup)
Ok(OpcodeResult::Halt) => {
return self.handle_opcode_result(current_call_frame, backup)
}
Err(error) => return self.handle_opcode_error(error, current_call_frame, backup),
}
Expand Down

0 comments on commit 85134bf

Please sign in to comment.