Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
191 changes: 162 additions & 29 deletions control/preimage/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use crate::bridge_hub_runtime::RuntimeCall as BridgeHubRuntimeCall;

#[cfg(feature = "polkadot")]
pub mod asset_hub_polkadot_types {
pub use crate::asset_hub_runtime::runtime_types::staging_xcm::v4::{
pub use crate::asset_hub_runtime::runtime_types::staging_xcm::v5::{
junction::Junction::AccountKey20,
junction::Junction::GlobalConsensus,
junction::NetworkId,
Expand All @@ -57,7 +57,7 @@ pub mod asset_hub_polkadot_types {

#[cfg(feature = "paseo")]
pub mod asset_hub_paseo_types {
pub use crate::asset_hub_runtime::runtime_types::staging_xcm::v4::{
pub use crate::asset_hub_runtime::runtime_types::staging_xcm::v5::{
junction::Junction::AccountKey20,
junction::Junction::GlobalConsensus,
junction::NetworkId,
Expand Down Expand Up @@ -559,7 +559,7 @@ pub fn register_erc20_token_metadata() -> Vec<AssetHubRuntimeCall> {
#[cfg(feature = "polkadot")]
pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
use crate::bridge_hub_runtime::runtime_types::{
staging_xcm::v4::{
staging_xcm::v5::{
junction::Junction::*, junction::NetworkId::*, junctions::Junctions::*,
location::Location,
},
Expand All @@ -568,7 +568,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
use hex_literal::hex;
return vec![
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: Here,
}),
Expand All @@ -577,7 +577,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
10u8,
),
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 2,
interior: X1([GlobalConsensus(Kusama)]),
}),
Expand All @@ -589,7 +589,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
* Parachains
*/
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: X2([Parachain(2004), PalletInstance(10)]),
}),
Expand All @@ -598,7 +598,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
18u8,
),
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: X2([
Parachain(2030),
Expand All @@ -615,7 +615,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
12u8,
),
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: X2([
Parachain(2030),
Expand All @@ -632,7 +632,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
10u8,
),
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: X2([Parachain(2034), GeneralIndex(0)]),
}),
Expand All @@ -641,7 +641,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
12u8,
),
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: X1([Parachain(2039)]),
}),
Expand All @@ -650,7 +650,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
12u8,
),
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: X1([Parachain(2051)]),
}),
Expand All @@ -659,7 +659,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
12u8,
),
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: X1([Parachain(3344)]),
}),
Expand All @@ -668,7 +668,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
10u8,
),
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: X1([Parachain(3370)]),
}),
Expand All @@ -677,7 +677,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
18u8,
),
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: X1([Parachain(2086)]),
}),
Expand All @@ -686,7 +686,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
15u8,
),
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: X1([Parachain(2006)]),
}),
Expand All @@ -695,7 +695,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
18u8,
),
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: X2([
Parachain(2031),
Expand All @@ -712,7 +712,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
18u8,
),
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: X1([Parachain(2101)]),
}),
Expand All @@ -721,7 +721,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
10u8,
),
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: X1([Parachain(2035)]),
}),
Expand All @@ -730,7 +730,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
12u8,
),
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: X2([
Parachain(2012),
Expand All @@ -747,7 +747,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
12u8,
),
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: X1([Parachain(2008)]),
}),
Expand All @@ -756,7 +756,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
12u8,
),
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: X1([Parachain(2104)]),
}),
Expand All @@ -765,7 +765,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
18u8,
),
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: X2([
Parachain(2000),
Expand All @@ -782,7 +782,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
12u8,
),
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: X2([
Parachain(2000),
Expand All @@ -802,7 +802,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
* Meme coins
*/
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: X3([Parachain(1000), PalletInstance(50), GeneralIndex(30)]),
}),
Expand All @@ -811,7 +811,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
10u8,
),
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: X3([Parachain(1000), PalletInstance(50), GeneralIndex(23)]),
}),
Expand All @@ -820,7 +820,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
10u8,
),
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: X3([Parachain(1000), PalletInstance(50), GeneralIndex(86)]),
}),
Expand All @@ -829,7 +829,7 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
12u8,
),
register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: X3([Parachain(1000), PalletInstance(50), GeneralIndex(31337)]),
}),
Expand All @@ -840,14 +840,147 @@ pub fn token_registrations() -> Vec<BridgeHubRuntimeCall> {
];
}

pub fn replay_sep_2025_xcm() -> crate::asset_hub_runtime::RuntimeCall {
use crate::asset_hub_runtime::runtime_types::{
pallet_xcm,
staging_xcm::v5::{
asset::{Asset, AssetId, Assets, Fungibility, WildAsset},
junction::Junction,
junctions::Junctions,
location::Location,
Instruction::*,
Xcm,
},
xcm::{VersionedLocation, VersionedXcm, v3::WeightLimit},
};
use hex_literal::hex;

enum AssetType {
Erc20([u8; 20]),
Eth,
}

// Failed XCM messages to replay - each contains asset, amount, beneficiary, and topic
let failed_messages: Vec<(AssetType, u128, [u8; 20], [u8; 32])> = vec![
// SKY token transfer
(
AssetType::Erc20(hex!("56072c95faa701256059aa122697b133aded9279")),
90413710543975890000000,
hex!("601d579ecd0464a1a090ceef81a703465a1679cd"),
hex!("f701fb349a04e4c923e26aab4e0288975d904507cdc32a3d3bdab8105507c736"),
),
// sUSDe token transfer
(
AssetType::Erc20(hex!("9d39a5de30e57443bff2a8307a4256c8797a3497")),
16716000000000000000000,
hex!("9117900a3794ad6d167dd97853f82a1aa07f9bbc"),
hex!("e4cff6bf2217eb4cf9332d2daee1ada70b405402414a2249a6e9b42ab759f93f"),
),
// tBTC v2 token transfer
(
AssetType::Erc20(hex!("18084fba666a33d37592fa2633fd49a74dd93a88")),
Comment on lines +864 to +881
Copy link
Contributor

@yrong yrong Oct 1, 2025

Choose a reason for hiding this comment

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

Double-checked — everything looks as expected. Just a nitpick: better to list the failing transfers in strict order:

select message_id, token_address, destination_address, amount from transfer_status_to_ethereum where status = 0 order by timestamp ASC;

250830765728855800,
hex!("601d579ecd0464a1a090ceef81a703465a1679cd"),
hex!("d289d29c0ccbca0fe47be2a0bf8d09af3a90d719ce62129d75714a342750b6e4"),
),
// AAVE token transfer 1
(
AssetType::Erc20(hex!("7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9")),
33044703802651993696,
hex!("2265a7503597ab32bab72eaa186e6329fb7b68f3"),
hex!("c8864869cd4ed5921d5cc251290357ffb24f905e1a475a2ba6c9ecd96c55df71"),
),
// AAVE token transfer 2
(
AssetType::Erc20(hex!("7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9")),
212116067921877821839,
hex!("a9c415d6881e1a992861a7fa6bef3ed4736152c2"),
hex!("e259e4fb1c24f7cf4e6d2a9d50e13794de5fd6863083addc3d55ddff3b3d58cd"),
),
// ETH transfer
(
AssetType::Eth,
350000000000000000,
hex!("ad8d4c544a6ce24b89841354b2738e026a12bca4"),
hex!("1ae83a0cba8f448c466fb0863fc25827b6978b7c3b3f93785184412cb2632e31"),
),
];

let mut all_instructions = vec![
UnpaidExecution {
weight_limit: WeightLimit::Unlimited,
check_origin: None,
},
];

// Add all failed messages as separate ExportMessage instructions
for (asset_type, amount, beneficiary_address, topic) in failed_messages.iter() {
let asset_location = match asset_type {
AssetType::Erc20(token_address) => Location {
parents: 0,
interior: Junctions::X1([Junction::AccountKey20 {
network: None,
key: *token_address,
}]),
},
AssetType::Eth => Location {
parents: 0,
interior: Junctions::Here,
},
};

all_instructions.push(ExportMessage {
network: crate::asset_hub_runtime::runtime_types::staging_xcm::v5::junction::NetworkId::Ethereum {
chain_id: crate::bridge_hub_runtime::CHAIN_ID,
},
destination: Junctions::Here,
xcm: Xcm(vec![
WithdrawAsset(Assets(vec![Asset {
id: AssetId(asset_location.clone()),
fun: Fungibility::Fungible(*amount),
}])),
ClearOrigin,
BuyExecution {
fees: Asset {
id: AssetId(asset_location.clone()),
fun: Fungibility::Fungible(1),
},
weight_limit: WeightLimit::Unlimited,
},
DepositAsset {
assets: asset_hub_polkadot_runtime::runtime_types::staging_xcm::v5::asset::AssetFilter::Wild(WildAsset::AllCounted(1)),
beneficiary: Location {
parents: 0,
interior: Junctions::X1([Junction::AccountKey20 {
network: None,
key: *beneficiary_address,
}]),
},
},
SetTopic(*topic),
]),
});
all_instructions.push(SetTopic(*topic));
}

let asset_hub_xcm = crate::asset_hub_runtime::RuntimeCall::PolkadotXcm(pallet_xcm::pallet::Call::send {
dest: Box::new(VersionedLocation::V5(Location {
parents: 1,
interior: Junctions::X1([Junction::Parachain(crate::constants::BRIDGE_HUB_ID)]),
})),
message: Box::new(VersionedXcm::V5(Xcm(all_instructions))),
});
asset_hub_xcm
}

#[cfg(feature = "polkadot")]
pub fn frequency_token_registrations() -> Vec<BridgeHubRuntimeCall> {
use crate::bridge_hub_runtime::runtime_types::{
staging_xcm::v4::{junction::Junction::*, junctions::Junctions::*, location::Location},
staging_xcm::v5::{junction::Junction::*, junctions::Junctions::*, location::Location},
xcm::VersionedLocation,
};
return vec![register_polkadot_native_asset(
VersionedLocation::V4(Location {
VersionedLocation::V5(Location {
parents: 1,
interior: X1([Parachain(2091)]),
}),
Expand Down
Loading
Loading