From 27691efcd759280d07bc5bc817b2f08236dfd2b5 Mon Sep 17 00:00:00 2001 From: rakita Date: Tue, 11 Jun 2024 18:46:26 +0200 Subject: [PATCH] fix(EOF): add DATACOPY copy gas --- crates/interpreter/src/instructions/data.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/interpreter/src/instructions/data.rs b/crates/interpreter/src/instructions/data.rs index 5d18a89899..65df8a702e 100644 --- a/crates/interpreter/src/instructions/data.rs +++ b/crates/interpreter/src/instructions/data.rs @@ -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, @@ -70,6 +70,8 @@ pub fn data_copy(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();