Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b26c547
Allowing Teleport on Moonbase
arturgontijo May 20, 2026
e286a1e
coderabbit: feature=runtime-benchmarks builds
arturgontijo May 21, 2026
30daa74
Merge branch 'master' into artur/teleport
arturgontijo May 21, 2026
8e8bc16
review: Add TeleportTrustedLocation and TeleportableErc20Status
arturgontijo May 22, 2026
22ba1c0
Add Registered, Active and Deregistered logic.
arturgontijo May 22, 2026
43dd752
coderabbit: LockedSupply clean up.
arturgontijo May 22, 2026
e8d732f
Permissionless remove only Deregistered + LockedSupply(0)
arturgontijo May 23, 2026
d7fcd38
review: more tests + doc
arturgontijo May 25, 2026
60228f8
Merge branch 'master' into artur/teleport
arturgontijo May 28, 2026
e1a4229
Merge branch 'master' into artur/teleport
arturgontijo Jun 1, 2026
31b7da6
Add legacy_transactor_rejects_teleportable() and better match_outbound()
arturgontijo Jun 1, 2026
c6be6dd
Better tests
arturgontijo Jun 1, 2026
2498eab
Bump runtimes to 4500
arturgontijo Jun 1, 2026
01b0c7a
ci: trigger
arturgontijo Jun 2, 2026
a52991e
Merge branch 'master' into artur/teleport
arturgontijo Jun 2, 2026
ac94083
Merge branch 'master' into artur/teleport
arturgontijo Jun 3, 2026
680f2ec
Fix links
arturgontijo Jun 3, 2026
1731827
Merge branch 'master' into artur/teleport
arturgontijo Jun 3, 2026
dbbbd41
Merge branch 'master' into artur/teleport
arturgontijo Jun 8, 2026
d7de46e
Merge branch 'master' into artur/teleport
arturgontijo Jun 18, 2026
50fbefa
Code review
arturgontijo Jun 19, 2026
3709592
Merge branch 'master' into artur/teleport
arturgontijo Jun 22, 2026
bbaf370
Charge ERC20 EVM transfer weight for teleports and wildcard deposits
arturgontijo Jun 22, 2026
b0813d1
Merge branch 'master' into artur/teleport
arturgontijo Jun 23, 2026
ff22abb
Merge branch 'master' into artur/teleport
arturgontijo Jun 24, 2026
f507b80
temp: fix xcm flaky dev tests
arturgontijo Jun 24, 2026
36de436
Fix xcm tests
arturgontijo Jun 24, 2026
aba1fba
temp: deterministically include pending tx in nonce test
arturgontijo Jun 25, 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
660 changes: 658 additions & 2 deletions pallets/erc20-xcm-bridge/src/lib.rs

Large diffs are not rendered by default.

49 changes: 43 additions & 6 deletions pallets/erc20-xcm-bridge/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use crate as erc20_xcm_bridge;

use frame_support::traits::Everything;
use frame_support::{construct_runtime, pallet_prelude::*, parameter_types};
use frame_system::EnsureRoot;
use pallet_evm::{
AddressMapping, EnsureAddressTruncated, FrameSystemAccountProvider, SubstrateBlockHashMapping,
};
Expand All @@ -37,7 +38,7 @@ construct_runtime!(
Balances: pallet_balances,
Timestamp: pallet_timestamp,
EVM: pallet_evm,
Erc20XcmBridge: erc20_xcm_bridge,
Erc20XcmBridge: erc20_xcm_bridge::{Pallet, Call, Storage, Event<T>},
}
);

Expand Down Expand Up @@ -115,7 +116,10 @@ const BLOCK_STORAGE_LIMIT: u64 = 40 * 1024;

parameter_types! {
pub BlockGasLimit: U256 = U256::from(u64::MAX);
pub const WeightPerGas: Weight = Weight::from_parts(1, 0);
// Non-zero proof_size component so `pallet_evm`'s runner has a budget large enough
// to record `ACCOUNT_CODES_METADATA_PROOF_SIZE` (~76 bytes) at the start of a call.
// Without this the runner returns `GasLimitTooLow` for any contract call.
pub const WeightPerGas: Weight = Weight::from_parts(1, 1);
pub GasLimitPovSizeRatio: u64 = {
let block_gas_limit = BlockGasLimit::get().min(u64::MAX.into()).low_u64();
block_gas_limit.saturating_div(MAX_POV_SIZE)
Expand Down Expand Up @@ -154,8 +158,12 @@ impl pallet_evm::Config for Test {
type FindAuthor = ();
type BlockHashMapping = SubstrateBlockHashMapping<Self>;
type OnCreate = ();
type GasLimitPovSizeRatio = GasLimitPovSizeRatio;
type GasLimitStorageGrowthRatio = GasLimitStorageGrowthRatio;
// `()` resolves to `0` for these `Get<u64>` ratios — that disables the PoV / storage
// growth checks in the EVM runner, which would otherwise reject our small-gas
// `erc20_transfer` test calls because the mock's `BlockGasLimit = u64::MAX`
// makes the computed ratios astronomical.
type GasLimitPovSizeRatio = ();
type GasLimitStorageGrowthRatio = ();
type Timestamp = Timestamp;
type WeightInfo = pallet_evm::weights::SubstrateWeight<Test>;
type AccountProvider = FrameSystemAccountProvider<Test>;
Expand All @@ -165,10 +173,39 @@ impl pallet_evm::Config for Test {

parameter_types! {
pub Erc20XcmBridgeTransferGasLimit: u64 = 200_000;
pub Erc20MultilocationPrefix: xcm::latest::Location = xcm::latest::Location {
parents: 0,
interior: [xcm::latest::Junction::PalletInstance(42u8)].into(),
};
pub TeleportCheckingAccount: H160 = H160(*b"erc20-teleport-check");
/// Mock counterparty: stand-in for AssetHub at para 1001. Tests use this to verify
/// `IsTeleportableErc20` admits this exact location and rejects everything else.
pub TeleportTrustedLocation: xcm::latest::Location = xcm::latest::Location::new(
1,
[xcm::latest::Junction::Parachain(1001)],
);
}
/// Minimal `Location → H160` converter for the unit-test ext: matches the leaf
/// `AccountKey20 { key, .. }` and returns `H160(key)`. Pattern matches any number of
/// preceding junctions so both `(0, [AccountKey20])` and richer locations work.
pub struct H160FromAccountKey20Junction;

impl xcm_executor::traits::ConvertLocation<H160> for H160FromAccountKey20Junction {
fn convert_location(loc: &xcm::latest::Location) -> Option<H160> {
use xcm::latest::Junction;
match loc.interior().last() {
Some(Junction::AccountKey20 { key, .. }) => Some(H160::from(*key)),
_ => None,
}
}
}

impl crate::Config for Test {
type AccountIdConverter = ();
type Erc20MultilocationPrefix = ();
type AccountIdConverter = H160FromAccountKey20Junction;
type Erc20MultilocationPrefix = Erc20MultilocationPrefix;
type Erc20TransferGasLimit = Erc20XcmBridgeTransferGasLimit;
type EvmRunner = pallet_evm::runner::stack::Runner<Self>;
type TeleportAdminOrigin = EnsureRoot<AccountId32>;
type TeleportCheckingAccount = TeleportCheckingAccount;
type TeleportTrustedLocation = TeleportTrustedLocation;
}
Loading
Loading