Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(levm): resize memory in generic_call before any validation #1556

Merged
merged 6 commits into from
Dec 23, 2024
5 changes: 3 additions & 2 deletions crates/vm/levm/src/opcode_handlers/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,9 @@ impl VM {
// Clear callframe subreturn data
current_call_frame.sub_return_data = Bytes::new();

let calldata =
memory::load_range(&mut current_call_frame.memory, args_offset, args_size)?.to_vec();

// 1. Validate sender has enough value
let sender_account_info = self.access_account(msg_sender).0;
if should_transfer_value && sender_account_info.balance < value {
Expand All @@ -662,8 +665,6 @@ impl VM {
}

let recipient_bytecode = self.access_account(code_address).0.bytecode;
let calldata =
memory::load_range(&mut current_call_frame.memory, args_offset, args_size)?.to_vec();
// Gas Limit for the child context is capped.
let gas_cap = max_message_call_gas(current_call_frame)?;
let gas_limit = std::cmp::min(gas_limit, gas_cap.into());
Expand Down
Loading