From 5da86e39bf18a399df8501ee0138a6ec0a1dd7b1 Mon Sep 17 00:00:00 2001 From: invocamanman Date: Fri, 11 Oct 2024 00:09:45 +0200 Subject: [PATCH] static call gas price 0 --- crates/client-executor/src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/client-executor/src/lib.rs b/crates/client-executor/src/lib.rs index 6ac410b..99eb930 100644 --- a/crates/client-executor/src/lib.rs +++ b/crates/client-executor/src/lib.rs @@ -103,6 +103,9 @@ where header, total_difficulty, ); + // Set the base fee to 0 to enable 0 gas price transactions. + block_env.basefee = U256::from(0); + let mut evm = EvmBuilder::default() .with_db(db) .with_cfg_env_with_handler_cfg(cfg_env) @@ -113,8 +116,8 @@ where tx_env.caller = call.caller_address; tx_env.data = call.calldata.abi_encode().into(); tx_env.gas_limit = header.gas_limit; - // TODO Make the gas price configurable. Right now, it's always set to the base fee. - tx_env.gas_price = U256::from(header.base_fee_per_gas.unwrap()); + // Set the gas price to 0 to avoid lack of funds (0) error. + tx_env.gas_price = U256::from(0); tx_env.transact_to = TxKind::Call(call.contract_address); evm