diff --git a/crates/e2e/tests/e2e/quote_verification.rs b/crates/e2e/tests/e2e/quote_verification.rs index 8013e903a5..1ffb976a61 100644 --- a/crates/e2e/tests/e2e/quote_verification.rs +++ b/crates/e2e/tests/e2e/quote_verification.rs @@ -153,6 +153,7 @@ async fn test_bypass_verification_for_rfq_quotes(web3: Web3) { *onchain.contracts().weth.address(), BigDecimal::zero(), Default::default(), + 12_000_000, ) .await .unwrap(); diff --git a/crates/price-estimation/src/factory.rs b/crates/price-estimation/src/factory.rs index e8f8eb9567..d548d88d15 100644 --- a/crates/price-estimation/src/factory.rs +++ b/crates/price-estimation/src/factory.rs @@ -115,6 +115,7 @@ impl<'a> PriceEstimatorFactory<'a> { network.native_token, args.quote_inaccuracy_limit.clone(), args.tokens_without_verification.iter().cloned().collect(), + args.max_gas_per_tx, ) .await?; Ok(Some(Arc::new(verifier))) diff --git a/crates/price-estimation/src/lib.rs b/crates/price-estimation/src/lib.rs index b5bd54ae1a..d87ee49a62 100644 --- a/crates/price-estimation/src/lib.rs +++ b/crates/price-estimation/src/lib.rs @@ -107,6 +107,13 @@ pub struct Arguments { /// (e.g. private liquidity that exists but can't be verified). #[clap(long, env, value_delimiter = ',')] pub tokens_without_verification: Vec
, + + /// How much gas a single tx may consume at most. Any quote using more than + /// this will fail during the verification. + /// Defaults to the maximum transaction gas limit of ethereum introduced + /// in the Fusaka hardfork. + #[clap(long, env, default_value_t = 16777215)] + pub max_gas_per_tx: u64, } #[derive(clap::Parser)] @@ -178,6 +185,7 @@ impl Display for Arguments { quote_timeout, balance_overrides, tokens_without_verification, + max_gas_per_tx, } = self; write!(f, "{tenderly}")?; @@ -227,6 +235,7 @@ impl Display for Arguments { f, "tokens_without_verification: {tokens_without_verification:?}" )?; + writeln!(f, "max_gas_per_tx: {max_gas_per_tx}")?; Ok(()) } diff --git a/crates/price-estimation/src/trade_verifier/mod.rs b/crates/price-estimation/src/trade_verifier/mod.rs index 9337666272..dadbb086cc 100644 --- a/crates/price-estimation/src/trade_verifier/mod.rs +++ b/crates/price-estimation/src/trade_verifier/mod.rs @@ -76,10 +76,10 @@ pub struct TradeVerifier { quote_inaccuracy_limit: BigRational, domain_separator: DomainSeparator, tokens_without_verification: HashSet, + gas_limit: u64, } impl TradeVerifier { - const DEFAULT_GAS: u64 = 12_000_000; const SPARDOSE: Address = address!("0000000000000000000000000000000000020000"); const TRADER_IMPL: Address = address!("0000000000000000000000000000000000010000"); @@ -94,6 +94,7 @@ impl TradeVerifier { native_token: Address, quote_inaccuracy_limit: BigDecimal, tokens_without_verification: HashSet, + gas_limit: u64, ) -> Result