From 90698377e5a3160df0450f72e9dbf0e5c78358cb Mon Sep 17 00:00:00 2001 From: Omar Abdulla Date: Tue, 27 Jan 2026 00:11:43 +0300 Subject: [PATCH 1/3] Add the ability to override the gas limit and other gas params in test steps --- crates/core/src/differential_tests/driver.rs | 18 +++--- crates/format/src/steps.rs | 63 ++++++++++++++++++++ resolc-compiler-tests | 2 +- 3 files changed, 73 insertions(+), 10 deletions(-) diff --git a/crates/core/src/differential_tests/driver.rs b/crates/core/src/differential_tests/driver.rs index 20493e9..852b64b 100644 --- a/crates/core/src/differential_tests/driver.rs +++ b/crates/core/src/differential_tests/driver.rs @@ -482,15 +482,16 @@ where .context("Failed to find deployment receipt for constructor call"), Method::Fallback | Method::FunctionName(_) => { let resolver = self.platform_information.node.resolver().await?; - let tx = match step + let mut tx = step .as_transaction(resolver.as_ref(), self.default_resolution_context()) - .await - { - Ok(tx) => tx, - Err(err) => { - return Err(err); - } - }; + .await?; + + let gas_overrides = step + .gas_overrides + .get(&self.platform_information.platform.platform_identifier()) + .copied() + .unwrap_or_default(); + gas_overrides.apply_to::(&mut tx); self.platform_information.node.execute_transaction(tx).await } @@ -911,7 +912,6 @@ where .get(contract_instance) { info!( - %address, "Contract instance already deployed." ); diff --git a/crates/format/src/steps.rs b/crates/format/src/steps.rs index 8ed1f21..f82e0ba 100644 --- a/crates/format/src/steps.rs +++ b/crates/format/src/steps.rs @@ -1,6 +1,7 @@ use std::{collections::HashMap, fmt::Display, str::FromStr}; use alloy::hex::ToHexExt; +use alloy::network::Network; use alloy::primitives::{FixedBytes, utils::parse_units}; use alloy::{ eips::BlockNumberOrTag, @@ -11,6 +12,7 @@ use alloy::{ }; use anyhow::Context as _; use futures::{FutureExt, StreamExt, TryFutureExt, TryStreamExt, stream}; +use revive_dt_common::types::PlatformIdentifier; use schemars::JsonSchema; use semver::VersionReq; use serde::{Deserialize, Serialize}; @@ -152,6 +154,11 @@ pub struct FunctionCallStep { /// during the execution. #[serde(skip_serializing_if = "Option::is_none")] pub variable_assignments: Option, + + /// Allows for the test to set a specific value for the various gas parameter for each one of + /// the platforms we support. This is ignored for steps that perform contract deployments. + #[serde(default, skip_serializing_if = "HashMap::is_empty")] + pub gas_overrides: HashMap, } /// This represents a balance assertion step where the framework needs to query the balance of some @@ -965,6 +972,62 @@ impl<'de> Deserialize<'de> for EtherValue { } } +#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize, Eq, PartialEq, JsonSchema)] +pub struct GasOverrides { + #[serde(skip_serializing_if = "Option::is_none")] + pub gas_limit: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub gas_price: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub max_fee_per_gas: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub max_priority_fee_per_gas: Option, +} + +impl GasOverrides { + pub fn new() -> Self { + Default::default() + } + + pub fn with_gas_limit(mut self, value: impl Into>) -> Self { + self.gas_limit = value.into(); + self + } + + pub fn with_gas_price(mut self, value: impl Into>) -> Self { + self.gas_price = value.into(); + self + } + + pub fn with_max_fee_per_gas(mut self, value: impl Into>) -> Self { + self.max_fee_per_gas = value.into(); + self + } + + pub fn with_max_priority_fee_per_gas(mut self, value: impl Into>) -> Self { + self.max_priority_fee_per_gas = value.into(); + self + } + + pub fn apply_to(&self, transaction_request: &mut N::TransactionRequest) { + if let Some(gas_limit) = self.gas_limit { + transaction_request.set_gas_limit(gas_limit); + } + if let Some(gas_price) = self.gas_price { + transaction_request.set_gas_price(gas_price); + } + if let Some(max_fee_per_gas) = self.max_fee_per_gas { + transaction_request.set_max_fee_per_gas(max_fee_per_gas); + } + if let Some(max_priority_fee_per_gas) = self.max_priority_fee_per_gas { + transaction_request.set_max_priority_fee_per_gas(max_priority_fee_per_gas) + } + } +} + #[cfg(test)] mod tests { diff --git a/resolc-compiler-tests b/resolc-compiler-tests index d518592..9522e30 160000 --- a/resolc-compiler-tests +++ b/resolc-compiler-tests @@ -1 +1 @@ -Subproject commit d5185923e0b58f3806d74131d05d8b2b5c6df114 +Subproject commit 9522e3055243c6a474659e11bec4d815261992c3 From 30d32804f1497ddb35c0099368c13c64888ea4cc Mon Sep 17 00:00:00 2001 From: Omar Abdulla Date: Tue, 27 Jan 2026 00:13:27 +0300 Subject: [PATCH 2/3] Update the CI to accept resolc URL --- .github/actions/run-differential-tests/action.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/actions/run-differential-tests/action.yml b/.github/actions/run-differential-tests/action.yml index 587f40b..666cc0e 100644 --- a/.github/actions/run-differential-tests/action.yml +++ b/.github/actions/run-differential-tests/action.yml @@ -18,10 +18,9 @@ inputs: required: false default: "main" type: string - resolc-version: - description: "The version of resolc to install and use in tests." - required: false - default: "0.5.0" + resolc-download-url: + description: "The URL to use to download the resolc compiler." + required: true type: string use-compilation-caches: description: "Controls if the compilation caches will be used for the test run or not." @@ -62,11 +61,8 @@ runs: submodules: recursive - name: Installing the Latest Resolc shell: bash - if: ${{ runner.os == 'Linux' && runner.arch == 'X64' }} run: | - VERSION="${{ inputs['resolc-version'] }}" - ASSET_URL="https://github.com/paritytech/revive/releases/download/v$VERSION/resolc-x86_64-unknown-linux-musl" - echo "Downloading resolc v$VERSION from $ASSET_URL" + ASSET_URL="${{ inputs['resolc-download-url'] }}" curl -Lsf --show-error -o resolc "$ASSET_URL" chmod +x resolc ./resolc --version From dcee09b938f1ba6153bb8840066689d3940bfc35 Mon Sep 17 00:00:00 2001 From: Omar Abdulla Date: Tue, 27 Jan 2026 00:16:20 +0300 Subject: [PATCH 3/3] Update heapsize of resolc --- .github/actions/run-differential-tests/action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/run-differential-tests/action.yml b/.github/actions/run-differential-tests/action.yml index 666cc0e..61991f5 100644 --- a/.github/actions/run-differential-tests/action.yml +++ b/.github/actions/run-differential-tests/action.yml @@ -121,8 +121,7 @@ runs: --eth-rpc.path ${{ inputs['polkadot-sdk-path'] }}/target/release/eth-rpc \ --polkadot-omni-node.path ${{ inputs['polkadot-sdk-path'] }}/target/release/polkadot-omni-node \ --resolc.path ./resolc \ - --resolc.heap-size 128000 \ - --resolc.stack-size 128000 \ + --resolc.heap-size 500000 \ "${OMNI_ARGS[@]}" || true - name: Generate the expectation file shell: bash