Skip to content

Commit

Permalink
fix(eof): EOFCREATE spend gas and apply 63/64 rule
Browse files Browse the repository at this point in the history
  • Loading branch information
rakita committed May 31, 2024
1 parent 1d7347d commit 2b27d5b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/interpreter/src/instructions/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,18 @@ pub fn eofcreate<H: Host + ?Sized>(interpreter: &mut Interpreter, _host: &mut H)
.caller
.create2(salt.to_be_bytes(), keccak256(sub_container));

let gas_reduce = max(interpreter.gas.remaining() / 64, 5000);
let gas_limit = interpreter.gas().remaining().saturating_sub(gas_reduce);
gas!(interpreter, gas_limit);

// Send container for execution container is preverified.
interpreter.next_action = InterpreterAction::EOFCreate {
inputs: Box::new(EOFCreateInput::new(
interpreter.contract.target_address,
created_address,
value,
eof,
interpreter.gas().remaining(),
gas_limit,
input,
)),
};
Expand Down

0 comments on commit 2b27d5b

Please sign in to comment.