Skip to content

Commit

Permalink
fix(da): fix gas price for da gas estimation to be UO gas price
Browse files Browse the repository at this point in the history
  • Loading branch information
dancoombs committed Oct 29, 2024
1 parent d0500a1 commit b0d629d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
4 changes: 2 additions & 2 deletions crates/builder/src/bundle_proposer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion crates/pool/src/mempool/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 4 additions & 0 deletions crates/provider/src/alloy/da/optimism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 3 additions & 12 deletions crates/sim/src/gas/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -68,17 +68,8 @@ pub async fn calc_required_pre_verification_gas<UO: UserOperation, E: DAGasProvi
base_fee: u128,
) -> 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 {
Expand Down

0 comments on commit b0d629d

Please sign in to comment.