diff --git a/crates/builder/src/bundle_proposer.rs b/crates/builder/src/bundle_proposer.rs index 6fd04ee78..b43d33f96 100644 --- a/crates/builder/src/bundle_proposer.rs +++ b/crates/builder/src/bundle_proposer.rs @@ -394,7 +394,7 @@ where da_gas_oracle.calc_da_gas_sync( &op.da_gas_data, da_block_data, - required_op_fees.max_fee_per_gas, + op.uo.gas_price(base_fee), ) } else { match self @@ -403,7 +403,7 @@ where .calc_da_gas( op.uo.clone().into(), block_hash.into(), - required_op_fees.max_fee_per_gas, + op.uo.gas_price(base_fee), ) .await { @@ -2512,9 +2512,8 @@ mod tests { .returning(move |_| Ok(bd_cloned.clone())); da_oracle .expect_calc_da_gas_sync() - .returning(move |_, bd, gp| { + .returning(move |_, bd, _| { assert_eq!(*bd, block_data); - assert_eq!(gp, base_fee + max_priority_fee_per_gas); 100_000 }); diff --git a/crates/pool/src/mempool/pool.rs b/crates/pool/src/mempool/pool.rs index 919e2b681..84d9a09bb 100644 --- a/crates/pool/src/mempool/pool.rs +++ b/crates/pool/src/mempool/pool.rs @@ -266,7 +266,7 @@ where let required_da_gas = da_gas_oracle.calc_da_gas_sync( &op.po.da_gas_data, block_da_data, - candidate_gas_price, + op.uo().gas_price(base_fee), ); let required_pvg = op.uo().required_pre_verification_gas( @@ -1356,17 +1356,20 @@ mod tests { conf.chain_spec.da_pre_verification_gas = true; conf.chain_spec.include_da_gas_in_gas_limit = true; conf.da_gas_tracking_enabled = true; + let base_fee = 0; let po1 = create_op(Address::random(), 0, 10); + let po1_gas_price = po1.uo.gas_price(base_fee); let pvg = po1.uo.pre_verification_gas(); let da_pvg = po1 .uo .pre_verification_da_gas_limit(&conf.chain_spec, Some(1)); let mut oracle = MockDAGasOracleSync::default(); - oracle - .expect_calc_da_gas_sync() - .returning(move |_, _, _| da_pvg + 1); + oracle.expect_calc_da_gas_sync().returning(move |_, _, gp| { + assert_eq!(gp, po1_gas_price); + da_pvg + 1 + }); let mut pool = pool_with_conf_oracle(conf.clone(), oracle); @@ -1380,7 +1383,7 @@ mod tests { 0.into(), Some(&DAGasBlockData::default()), GasFees::default(), - 0, + base_fee, ); assert_eq!(pool.best_operations().collect::>().len(), 0); diff --git a/crates/provider/src/alloy/da/optimism.rs b/crates/provider/src/alloy/da/optimism.rs index 2c409e760..22d9dc2d0 100644 --- a/crates/provider/src/alloy/da/optimism.rs +++ b/crates/provider/src/alloy/da/optimism.rs @@ -65,6 +65,10 @@ where block: BlockHashOrNumber, gas_price: u128, ) -> ProviderResult<(u128, DAGasUOData, DAGasBlockData)> { + if gas_price == 0 { + Err(anyhow::anyhow!("gas price cannot be zero"))?; + } + let l1_fee: u128 = self .oracle .getL1Fee(data) diff --git a/crates/sim/src/gas/gas.rs b/crates/sim/src/gas/gas.rs index ccc5678d9..2cf6de75c 100644 --- a/crates/sim/src/gas/gas.rs +++ b/crates/sim/src/gas/gas.rs @@ -11,9 +11,9 @@ // You should have received a copy of the GNU General Public License along with Rundler. // If not, see https://www.gnu.org/licenses/. -use std::{cmp, fmt::Debug}; +use std::fmt::Debug; -use anyhow::{bail, Context}; +use anyhow::Context; #[cfg(feature = "test-utils")] use mockall::automock; use rundler_provider::{BlockHashOrNumber, DAGasProvider, EvmProvider}; @@ -68,17 +68,8 @@ pub async fn calc_required_pre_verification_gas anyhow::Result<(u128, DAGasUOData)> { let (da_gas, uo_data) = if chain_spec.da_pre_verification_gas { - let gas_price = cmp::min( - base_fee + op.max_priority_fee_per_gas(), - op.max_fee_per_gas(), - ); - - if gas_price == 0 { - bail!("Gas price cannot be zero") - } - let (da_gas, uo_data, _) = entry_point - .calc_da_gas(op.clone(), block, gas_price) + .calc_da_gas(op.clone(), block, op.gas_price(base_fee)) .await?; (da_gas, uo_data) } else {