diff --git a/frame/evm/src/lib.rs b/frame/evm/src/lib.rs index 211946bed0e95..7719f5fb7efa0 100644 --- a/frame/evm/src/lib.rs +++ b/frame/evm/src/lib.rs @@ -333,7 +333,7 @@ decl_module! { input, value, gas_limit, - Some(gas_price), + gas_price, nonce, true, )? { @@ -367,7 +367,7 @@ decl_module! { init, value, gas_limit, - Some(gas_price), + gas_price, nonce, true, )? { @@ -402,7 +402,7 @@ decl_module! { salt, value, gas_limit, - Some(gas_price), + gas_price, nonce, true, )? { @@ -482,7 +482,7 @@ impl Module { init: Vec, value: U256, gas_limit: u32, - gas_price: Option, + gas_price: U256, nonce: Option, apply_state: bool, ) -> Result<(ExitReason, H160, U256), Error> { @@ -514,7 +514,7 @@ impl Module { salt: H256, value: U256, gas_limit: u32, - gas_price: Option, + gas_price: U256, nonce: Option, apply_state: bool, ) -> Result<(ExitReason, H160, U256), Error> { @@ -548,7 +548,7 @@ impl Module { input: Vec, value: U256, gas_limit: u32, - gas_price: Option, + gas_price: U256, nonce: Option, apply_state: bool, ) -> Result<(ExitReason, Vec, U256), Error> { @@ -574,20 +574,18 @@ impl Module { source: H160, value: U256, gas_limit: u32, - gas_price: Option, + gas_price: U256, nonce: Option, apply_state: bool, f: F, ) -> Result<(ExitReason, R, U256), Error> where F: FnOnce(&mut StackExecutor>) -> (ExitReason, R), { - let gas_price = match gas_price { - Some(gas_price) => { - ensure!(gas_price >= T::FeeCalculator::min_gas_price(), Error::::GasPriceTooLow); - gas_price - }, - None => U256::zero(), - }; + + // Gas price check is skipped when performing a gas estimation. + if apply_state { + ensure!(gas_price >= T::FeeCalculator::min_gas_price(), Error::::GasPriceTooLow); + } let vicinity = Vicinity { gas_price,