mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix: set fees to zero if not provided (#1997)
This commit is contained in:
@ -30,6 +30,7 @@ use revm::{
|
||||
},
|
||||
Database,
|
||||
};
|
||||
use tracing::trace;
|
||||
|
||||
// Gas per transaction not creating a contract.
|
||||
const MIN_TRANSACTION_GAS: u64 = 21_000u64;
|
||||
@ -86,11 +87,18 @@ where
|
||||
apply_state_overrides(state_overrides, &mut db)?;
|
||||
}
|
||||
|
||||
// The basefee should be ignored for eth_call
|
||||
// See:
|
||||
// <https://github.com/ethereum/go-ethereum/blob/ee8e83fa5f6cb261dad2ed0a7bbcde4930c41e6c/internal/ethapi/api.go#L985>
|
||||
env.block.basefee = U256::ZERO;
|
||||
|
||||
if request_gas.is_none() && env.tx.gas_price > U256::ZERO {
|
||||
trace!(target: "rpc::eth::call", ?env, "Applying gas limit cap");
|
||||
// no gas limit was provided in the request, so we need to cap the request's gas limit
|
||||
cap_tx_gas_limit_with_caller_allowance(&mut db, &mut env.tx)?;
|
||||
}
|
||||
|
||||
trace!(target: "rpc::eth::call", ?env, "Executing call");
|
||||
transact(&mut db, env)
|
||||
}
|
||||
|
||||
|
||||
@ -168,6 +168,10 @@ impl CallFees {
|
||||
base_fee: U256,
|
||||
) -> EthResult<CallFees> {
|
||||
match (call_gas_price, call_max_fee, call_priority_fee) {
|
||||
(None, None, None) => {
|
||||
// when none are specified, they are all set to zero
|
||||
Ok(CallFees { gas_price: U256::ZERO, max_priority_fee_per_gas: None })
|
||||
}
|
||||
(gas_price, None, None) => {
|
||||
// request for a legacy transaction
|
||||
// set everything to zero
|
||||
|
||||
Reference in New Issue
Block a user