Skip to content

Commit

Permalink
Fix: explicit EVM call stack (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
birchmd authored and vimpunk committed May 22, 2023
1 parent e959505 commit f50ce04
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 3 additions & 5 deletions runtime/src/eval/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,7 @@ pub fn create<H: Handler>(runtime: &mut Runtime, is_create2: bool, handler: &mut
Err(e) => Control::Exit(e),
}
}
Capture::Trap(interrupt) => {
push_h256!(runtime, H256::default());
Control::CreateInterrupt(interrupt)
}
Capture::Trap(interrupt) => Control::CreateInterrupt(interrupt),
}
}

Expand Down Expand Up @@ -405,7 +402,8 @@ pub fn call<H: Handler>(runtime: &mut Runtime, scheme: CallScheme, handler: &mut
}
}
Capture::Trap(interrupt) => {
push_h256!(runtime, H256::default());
runtime.return_data_len = out_len;
runtime.return_data_offset = out_offset;
Control::CallInterrupt(interrupt)
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/executor/stack/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -920,8 +920,7 @@ impl<'config, 'precompiles, S: StackState<'config>, P: PrecompileSet>
return_data: Vec<u8>,
) -> (ExitReason, Option<H160>, Vec<u8>) {
fn check_first_byte(config: &Config, code: &[u8]) -> Result<(), ExitError> {
if config.disallow_executable_format && Some(&Opcode::EOFMAGIC.as_u8()) == code.first()
{
if config.disallow_executable_format && Some(&Opcode::EOFMAGIC.as_u8()) == code.get(0) {
return Err(ExitError::InvalidCode(Opcode::EOFMAGIC));
}
Ok(())
Expand Down

0 comments on commit f50ce04

Please sign in to comment.