Skip to content

Commit

Permalink
feat(error): checlk that gas price is not equal to zero
Browse files Browse the repository at this point in the history
  • Loading branch information
0xfourzerofour committed Aug 7, 2024
1 parent c782f40 commit 1543057
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 5 additions & 1 deletion crates/sim/src/gas/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use std::{cmp, fmt::Debug, sync::Arc};

use anyhow::Context;
use anyhow::{bail, Context};
use ethers::types::U256;
use rundler_provider::{EntryPoint, L1GasProvider, Provider};
use rundler_types::{
Expand Down Expand Up @@ -84,6 +84,10 @@ pub async fn calc_required_pre_verification_gas<
op.max_fee_per_gas(),
);

if gas_price.is_zero() {
bail!("Gas price cannot be zero")
}

let dynamic_gas = entry_point
.calc_l1_gas(entry_point.address(), op.clone(), gas_price)
.await?;
Expand Down
1 change: 0 additions & 1 deletion crates/sim/src/precheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,6 @@ where
) -> anyhow::Result<U256> {
gas::calc_required_pre_verification_gas(&self.chain_spec, &self.entry_point, &op, base_fee)
.await
.context("should calculate pre-verification gas")
}
}

Expand Down

0 comments on commit 1543057

Please sign in to comment.