diff --git a/crates/sim/src/gas/gas.rs b/crates/sim/src/gas/gas.rs index edbc257c5..a1ed0f923 100644 --- a/crates/sim/src/gas/gas.rs +++ b/crates/sim/src/gas/gas.rs @@ -13,7 +13,7 @@ use rundler_types::{ use rundler_utils::math; use tokio::try_join; -use super::polygon::Polygon; +use super::polygon::{Polygon, MAINNET_MAX_PRIORITY_FEE_DEFAULT, MUMBAI_MAX_PRIORITY_FEE_DEFAULT}; // Gas overheads for user operations // used in calculating the pre-verification gas @@ -275,6 +275,16 @@ impl FeeEstimator

{ let gas_oracle = Polygon::new(Arc::clone(&self.provider)).category(GasCategory::Fast); let fees = gas_oracle.estimate_eip1559_fees().await?; + + if fees.1.is_zero() { + let fallback = match self.chain_id { + x if x == Chain::Polygon as u64 => MAINNET_MAX_PRIORITY_FEE_DEFAULT, + x if x == Chain::PolygonMumbai as u64 => MUMBAI_MAX_PRIORITY_FEE_DEFAULT, + _ => 0, + }; + return Ok(fallback.into()); + } + Ok(fees.1) } else if self.use_bundle_priority_fee { self.provider.get_max_priority_fee().await diff --git a/crates/sim/src/gas/polygon.rs b/crates/sim/src/gas/polygon.rs index 1d6757bf2..7f59aad0e 100644 --- a/crates/sim/src/gas/polygon.rs +++ b/crates/sim/src/gas/polygon.rs @@ -8,6 +8,9 @@ use ethers::{ use rundler_provider::Provider; use serde::Deserialize; +pub(crate) const MUMBAI_MAX_PRIORITY_FEE_DEFAULT: u64 = 1_500_000_000; +pub(crate) const MAINNET_MAX_PRIORITY_FEE_DEFAULT: u64 = 30_000_000_000; + #[derive(Debug)] pub(crate) struct Polygon

{ provider: Arc

,