Skip to content

Commit

Permalink
fix(EOF): add DATACOPY copy gas (#1510)
Browse files Browse the repository at this point in the history
  • Loading branch information
rakita authored Jun 11, 2024
1 parent 4902ffa commit d008720
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/interpreter/src/instructions/data.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{
gas::{BASE, DATA_LOAD_GAS, VERYLOW},
gas::{cost_per_word, BASE, DATA_LOAD_GAS, VERYLOW},
instructions::utility::read_u16,
interpreter::Interpreter,
primitives::U256,
Expand Down Expand Up @@ -70,6 +70,8 @@ pub fn data_copy<H: Host + ?Sized>(interpreter: &mut Interpreter, _host: &mut H)
let mem_offset = as_usize_or_fail!(interpreter, mem_offset);
resize_memory!(interpreter, mem_offset, size);

gas_or_fail!(interpreter, cost_per_word(size as u64, VERYLOW));

let offset = as_usize_saturated!(offset);
let data = interpreter.contract.bytecode.eof().expect("EOF").data();

Expand Down

0 comments on commit d008720

Please sign in to comment.