Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
1b02d7b
update to latest polkadot-sdk
pkhry Dec 9, 2025
4ca706f
Merge branch 'master' into pkhry/polkadot-sdk-upd
pkhry Dec 9, 2025
5a81df5
upd
pkhry Dec 9, 2025
347992a
update 2
pkhry Dec 9, 2025
7c93b37
upd
pkhry Dec 9, 2025
f553378
upd jemmaloc
pkhry Dec 9, 2025
f2c923d
upd
pkhry Dec 9, 2025
6b70c82
Merge branch 'master' into pkhry/polkadot-sdk-upd
pkhry Dec 9, 2025
122a179
up
pkhry Dec 9, 2025
f3dce4a
upd the sequel
pkhry Dec 9, 2025
033305a
add example
pkhry Dec 9, 2025
d239682
upd
pkhry Dec 10, 2025
7e6abe0
up
pkhry Dec 10, 2025
87d3dff
make morpho pass at least
pkhry Dec 10, 2025
877de25
example
pkhry Dec 12, 2025
756756b
fixup defs
pkhry Dec 12, 2025
8edbc81
Merge branch 'master' into pkhry/polkadot-sdk-upd
pkhry Dec 12, 2025
9f2232d
upd
pkhry Dec 12, 2025
1f9514a
upd
pkhry Dec 12, 2025
7d9fc7b
upd
pkhry Dec 15, 2025
d904938
upd
pkhry Jan 6, 2026
6e3e3be
up
pkhry Jan 6, 2026
e0b96d6
upd forge test
pkhry Jan 6, 2026
15836fb
fixup wormhole CI
pkhry Jan 6, 2026
c2f6a14
upd
pkhry Jan 6, 2026
c933fc1
Merge remote-tracking branch 'origin/master' into pkhry/polkadot-sdk-upd
pkhry Jan 9, 2026
347fd53
fixups
pkhry Jan 9, 2026
16e0337
fixup
pkhry Jan 9, 2026
e95e800
chore(tests): bump forge-std version (#12986)
github-actions[bot] Jan 5, 2026
99f2bc6
chore(tests): bump forge-std version (#12992)
github-actions[bot] Jan 5, 2026
e285b2c
anvil-polkadot
pkhry Jan 9, 2026
ecc52b6
rm rest that is too far in the future
pkhry Jan 9, 2026
6dda28e
upd
pkhry Jan 9, 2026
198455d
revert accidents
pkhry Jan 13, 2026
e7e190b
revert 2507.4.0
pkhry Jan 13, 2026
044ccf8
Merge branch 'master' into pkhry/polkadot-sdk-upd
pkhry Jan 13, 2026
80a6b6d
fixup test
pkhry Jan 13, 2026
60ed8bf
fixup more
pkhry Jan 13, 2026
93ce6f2
clippy
pkhry Jan 14, 2026
3afdca5
review comments
pkhry Jan 15, 2026
36bde18
Merge branch 'master' into pkhry/polkadot-sdk-upd
pkhry Jan 15, 2026
31b126b
revert revert forge-std update
pkhry Jan 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/scripts/matrices.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ def main():

if profile == "isolate":
flags += " --features=isolate-by-default"
if target == t_windows:
flags += " --no-default-features"
name += os_str

obj = Expanded(
Expand Down
693 changes: 337 additions & 356 deletions Cargo.lock

Large diffs are not rendered by default.

14 changes: 6 additions & 8 deletions crates/anvil-polkadot/src/substrate_node/service/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use polkadot_sdk::{
sc_consensus::BlockImportParams,
sc_consensus_aura::CompatibleDigestItem,
sc_consensus_manual_seal::{ConsensusDataProvider, Error},
sp_api::StorageProof,
sp_consensus_aura::ed25519::AuthoritySignature,
sp_consensus_babe::Slot,
sp_inherents::InherentData,
Expand All @@ -16,23 +17,20 @@ use std::marker::PhantomData;
/// forking from an assethub chain, we expect an assethub runtime based on AURA,
/// which will pick the author based on the slot given through the digest, which will
/// also result in picking the AURA authority from index 0.
pub struct SameSlotConsensusDataProvider<B, P> {
_phantom: PhantomData<(B, P)>,
pub struct SameSlotConsensusDataProvider<B> {
_phantom: PhantomData<B>,
}

impl<B, P> SameSlotConsensusDataProvider<B, P> {
impl<B> SameSlotConsensusDataProvider<B> {
pub fn new() -> Self {
Self { _phantom: PhantomData }
}
}

impl<B, P> ConsensusDataProvider<B> for SameSlotConsensusDataProvider<B, P>
impl<B> ConsensusDataProvider<B> for SameSlotConsensusDataProvider<B>
where
B: BlockT,
P: Send + Sync,
{
type Proof = P;

fn create_digest(
&self,
_parent: &B::Header,
Expand All @@ -50,7 +48,7 @@ where
_parent: &B::Header,
_params: &mut BlockImportParams<B>,
_inherents: &InherentData,
_proof: Self::Proof,
_proof: StorageProof,
) -> Result<(), Error> {
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion crates/anvil-polkadot/tests/it/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async fn test_set_next_fee_multiplier(#[case] rpc_driven: bool) {
#[tokio::test(flavor = "multi_thread")]
async fn test_next_fee_multiplier_minimum() {
// 1e18 denomination.
let new_base_fee = U256::from(50_123);
let new_base_fee = U256::from(50_1230);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not fix the actual issue. You will have to set the GasScale to 1.
Like this: f522500#diff-bf8d1cad61c801a9cfd0ba5917125913b960af9bdbeba4fbfe846bb86e3c3d0dR310-R311

@AlexandruCihodaru AlexandruCihodaru Dec 10, 2025

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value in test config I think is 10, hence the off by 10

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'll revert the anvil change in this PR then and cherry-pick your changes then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can directly add GasScale I think there is no need to cherry-pick

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default pallet-revive config for GasScale is 10 based on this PR: https://github.com/paritytech/polkadot-sdk/pull/10393/changes (which also multiplies the next_fee_multiplier by gas scale, not just NATIVE_TO_ETH_RATIO). That's why, given our substrate-runtime not setting it up specifically with this PR, or before it, we get in practice 10 times bigger base fee. For these tests to pass it is enough to configure the GasScale under the pallet-revive config in the anvil-polkadot's substrate-runtime to 1, but that might not do it for certain users tests (outside anvil-polkadot) that rely on a bigger value (e.g. dev-node sets it to 50_000).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the extra zero at the end fixes this test too. The GasScale set to 1 works fine with the test - at least locally for me with this branch.

let anvil_node_config =
AnvilNodeConfig::test_config().with_base_fee(Some(new_base_fee.to::<u64>()));
let substrate_node_config = SubstrateNodeConfig::new(&anvil_node_config);
Expand Down
2 changes: 1 addition & 1 deletion crates/anvil-polkadot/tests/it/standard_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ async fn test_gas_price() {

let gas_price =
unwrap_response::<U256>(node.eth_rpc(EthRequest::EthGasPrice(())).await.unwrap()).unwrap();
assert_eq!(gas_price, U256::from(1000000));
assert_eq!(gas_price, U256::from(10000000));
Comment thread
iulianbarbu marked this conversation as resolved.
Outdated
}

#[tokio::test(flavor = "multi_thread")]
Expand Down
2 changes: 1 addition & 1 deletion crates/revive-env/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use polkadot_sdk::{
sp_tracing,
};

pub use crate::runtime::{AccountId, Balance, BlockAuthor, Runtime, System, Timestamp};
pub use crate::runtime::{AccountId, Balance, BlockAuthor, GasScale, Runtime, System, Timestamp};

mod runtime;

Expand Down
4 changes: 3 additions & 1 deletion crates/revive-env/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ impl pallet_timestamp::Config for Runtime {}
parameter_types! {
pub const UnstableInterface: bool = true;
pub const DepositPerByte: Balance = 1;
pub const DepositPerItem: Balance = 2;
pub const DepositPerItem: Balance = 1;
pub const CodeHashLockupDepositPercent: Perbill = Perbill::from_percent(0);
pub const NativeToEthRatio: u32 = 1_000_000;
pub const GasScale : u32 = u32::MAX;
Comment thread
iulianbarbu marked this conversation as resolved.
Outdated
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(
Weight::from_parts(2u64 * WEIGHT_REF_TIME_PER_SECOND, u64::MAX),
Expand All @@ -88,6 +89,7 @@ impl pallet_revive::Config for Runtime {
type NativeToEthRatio = NativeToEthRatio;
type FindAuthor = Self;
type DebugEnabled = ConstBool<true>;
type GasScale = GasScale;
Comment thread
iulianbarbu marked this conversation as resolved.
}

parameter_types! {
Expand Down
68 changes: 43 additions & 25 deletions crates/revive-strategy/src/cheatcodes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ use tracing::warn;
use alloy_eips::eip7702::SignedAuthorization;
use polkadot_sdk::{
pallet_revive::{
AccountInfo, AddressMapper, BalanceOf, BytecodeType, Code, ContractInfo, DebugSettings,
ExecConfig, Pallet, evm::CallTrace,
self, AccountInfo, AddressMapper, BalanceOf, BytecodeType, Code, ContractInfo,
DebugSettings, ExecConfig, Executable, Pallet, ResourceMeter, evm::CallTrace,
},
polkadot_sdk_frame::prelude::OriginFor,
sp_core::{self, H160, H256},
sp_io,
sp_core::{self, H160},
sp_weights::Weight,
};

Expand Down Expand Up @@ -704,12 +703,16 @@ fn select_revive(ctx: &mut PvmCheatcodeInspectorStrategyContext, data: Ecx<'_, '
Pallet::<Runtime>::account_id(),
code_bytes.clone(),
code_type,
u64::MAX.into(),
&mut ResourceMeter::new(pallet_revive::TransactionLimits::WeightAndDeposit {
weight_limit: Weight::MAX,
deposit_limit: BalanceOf::<Runtime>::MAX,
})
.unwrap(),
&ExecConfig::new_substrate_tx(),
);
match upload_result {
Ok(_) => {
let code_hash = H256(sp_io::hashing::keccak_256(&code_bytes));
Ok(upload_res) => {
let code_hash = upload_res.code_hash().to_owned();
let contract_info = ContractInfo::<Runtime>::new(&account_h160, nonce as u32, code_hash)
.expect("Failed to create contract info");
AccountInfo::<Runtime>::insert_contract(&account_h160, contract_info);
Expand Down Expand Up @@ -742,13 +745,17 @@ fn select_revive(ctx: &mut PvmCheatcodeInspectorStrategyContext, data: Ecx<'_, '
Pallet::<Runtime>::account_id(),
code_bytes.clone(),
BytecodeType::Evm,
u64::MAX.into(),
&mut ResourceMeter::new(pallet_revive::TransactionLimits::WeightAndDeposit {
weight_limit: Weight::MAX,
deposit_limit: BalanceOf::<Runtime>::MAX,
})
.unwrap(),
&ExecConfig::new_substrate_tx_without_bump(),
);
match upload_result {
Ok(_) => {
let code_hash = H256(sp_io::hashing::keccak_256(&code_bytes));
let contract_info = ContractInfo::<Runtime>::new(&account_h160, nonce as u32, code_hash)
Ok(upload_res) => {
let code_hash = upload_res.code_hash();
let contract_info = ContractInfo::<Runtime>::new(&account_h160, nonce as u32, code_hash.to_owned())
.expect("Failed to create contract info");
AccountInfo::<Runtime>::insert_contract(&account_h160, contract_info);
}
Expand Down Expand Up @@ -949,6 +956,7 @@ impl foundry_cheatcodes::CheatcodeInspectorStrategyExt for PvmCheatcodeInspector
let origin = OriginFor::<Runtime>::signed(origin_account_id.clone());
let evm_value = sp_core::U256::from_little_endian(&input.value().as_le_bytes());
mock_handler.fund_pranked_accounts(input.caller());

System::inc_account_nonce(&origin_account_id);
let code = Code::Upload(code_bytes.clone());
let data = constructor_args;
Expand Down Expand Up @@ -982,9 +990,10 @@ impl foundry_cheatcodes::CheatcodeInspectorStrategyExt for PvmCheatcodeInspector
Pallet::<Runtime>::bare_instantiate(
origin,
evm_value,
Weight::MAX,
// TODO: fixing.
BalanceOf::<Runtime>::MAX,
pallet_revive::TransactionLimits::WeightAndDeposit {
weight_limit: Weight::MAX,
deposit_limit: BalanceOf::<Runtime>::MAX,
},
code,
data,
salt,
Expand All @@ -993,18 +1002,22 @@ impl foundry_cheatcodes::CheatcodeInspectorStrategyExt for PvmCheatcodeInspector
})
});
let mut gas = Gas::new(input.gas_limit());
if res.result.as_ref().is_ok_and(|r| !r.result.did_revert()) {
self.append_recorded_accesses(state, ecx, tracer.get_recorded_accesses());
}
post_exec(state, ecx, executor, &mut tracer, false);
self.append_recorded_accesses(state, ecx, tracer.get_recorded_accesses());
mock_handler.update_state_mocks(state);

match &res.result {
Ok(result) => {
// Only record gas cost if gas metering is not paused.
// When paused, the gas counter should remain frozen.
if !state.gas_metering.paused {
let _ = gas.record_cost(res.gas_required.ref_time());
let _ = gas.record_cost(
res.gas_consumed
.div_euclid(<Runtime as pallet_revive::Config>::GasScale::get().into())
.min(u64::MAX.into())
.try_into()
.unwrap(),
);
}

let outcome = if result.result.did_revert() {
Expand Down Expand Up @@ -1131,27 +1144,32 @@ impl foundry_cheatcodes::CheatcodeInspectorStrategyExt for PvmCheatcodeInspector
origin,
target,
evm_value,
Weight::MAX,
// TODO: fixing.
BalanceOf::<Runtime>::MAX,
pallet_revive::TransactionLimits::WeightAndDeposit {
weight_limit: Weight::MAX,
deposit_limit: if call.is_static { 0 } else { BalanceOf::<Runtime>::MAX },
},
call.input.bytes(ecx).to_vec(),
exec_config,
)
})
});
mock_handler.update_state_mocks(state);
let mut gas = Gas::new(call.gas_limit);
if res.result.as_ref().is_ok_and(|r| !r.did_revert()) {
self.append_recorded_accesses(state, ecx, tracer.get_recorded_accesses());
}
post_exec(state, ecx, executor, &mut tracer, call.is_static);
self.append_recorded_accesses(state, ecx, tracer.get_recorded_accesses());

match res.result {
Ok(result) => {
// Only record gas cost if gas metering is not paused.
// When paused, the gas counter should remain frozen.
if !state.gas_metering.paused {
let _ = gas.record_cost(res.gas_required.ref_time());
let _ = gas.record_cost(
res.gas_consumed
.div_euclid(<Runtime as pallet_revive::Config>::GasScale::get().into())
.min(u64::MAX.into())
.try_into()
.unwrap(),
);
}

let outcome = if result.did_revert() {
Expand Down
16 changes: 11 additions & 5 deletions crates/revive-strategy/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use foundry_cheatcodes::{Ecx, Error, Result};
use polkadot_sdk::{
pallet_revive::{
self, AccountInfo, AddressMapper, BalanceOf, BytecodeType, ContractInfo, ExecConfig,
Executable, Pallet,
Executable, Pallet, ResourceMeter,
},
sp_core::{self, H160},
sp_externalities::Externalities,
Expand All @@ -27,7 +27,10 @@ impl Default for Inner {
fn default() -> Self {
Self {
externalities: ExtBuilder::default()
.balance_genesis_config(vec![(H160::from_low_u64_be(1), 1000)])
.balance_genesis_config(vec![(
H160::from_low_u64_be(1),
1_000_000_000_000_000_000_000_000_000_u128,
)])
.build(),
depth: 0,
}
Expand Down Expand Up @@ -142,11 +145,14 @@ impl TestEnv {
origin_account,
code,
code_type,
BalanceOf::<Runtime>::MAX,
&mut ResourceMeter::new(pallet_revive::TransactionLimits::WeightAndDeposit {
weight_limit: Default::default(),
deposit_limit: BalanceOf::<Runtime>::MAX,
})
.unwrap(),
&ExecConfig::new_substrate_tx(),
)
.map_err(|_| <&str as Into<Error>>::into("Could not upload PVM code"))?
.0;
.map_err(|_| <&str as Into<Error>>::into("Could not upload PVM code"))?;

let mut contract_info = if let Some(contract_info) =
AccountInfo::<Runtime>::load_contract(&target_address)
Expand Down
12 changes: 7 additions & 5 deletions crates/revive-strategy/src/tracing/call_tracer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use polkadot_sdk::{
pallet_revive,
pallet_revive::tracing::Tracing,
sp_core::{H160, U256},
sp_weights::Weight,
};

#[derive(Debug)]
Expand All @@ -24,14 +23,16 @@ impl Tracing for ExpectedCallTracer {
&mut self,
_from: H160,
to: H160,
_is_delegate_call: bool,
is_delegate_call: Option<H160>,
_is_read_only: bool,
value: U256,
input: &[u8],
_gas: Weight,
_gas: U256,
) {
let addr =
is_delegate_call.map(|x| Address::from(x.0)).unwrap_or_else(|| Address::from(to.0));
if !self.is_create
&& let Some(expected_calls_for_target) = self.data.get_mut(&Address::from(to.0))
&& let Some(expected_calls_for_target) = self.data.get_mut(&addr)
{
// Match every partial/full calldata
for (calldata, (expected, actual_count)) in expected_calls_for_target {
Expand All @@ -53,9 +54,10 @@ impl Tracing for ExpectedCallTracer {
}
}
}
fn exit_child_span(&mut self, _output: &pallet_revive::ExecReturnValue, _gas_left: Weight) {
fn exit_child_span(&mut self, _output: &pallet_revive::ExecReturnValue, _gas_left: U256) {
self.is_create = false;
}

fn instantiate_code(
&mut self,
_code: &polkadot_sdk::pallet_revive::Code,
Expand Down
Loading
Loading