Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
08e0f81
Setup permissionless lanes for AssetHubRococo
bkontur Nov 15, 2024
489b94a
Update from bkontur running command 'fmt'
github-actions[bot] Jan 30, 2025
122a33b
zepter+taplo
bkontur Jan 30, 2025
2a626af
Merge branch 'bko-bridges-congestion' into bko-permlanes-on-ahs
bkontur Feb 17, 2025
37e1f25
Fix deps
bkontur Mar 11, 2025
ae437d9
Update cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/test…
bkontur Mar 12, 2025
ded10ac
Add bridging to AssetHubWestend (#7831)
rosarp Mar 13, 2025
b3e3971
Merge branch 'bko-bridges-congestion' into bko-permlanes-on-ahs
bkontur Apr 7, 2025
0e67470
Merge branch 'bko-bridges-congestion' into bko-permlanes-on-ahs
bkontur Apr 8, 2025
db0ff4b
Merge branch 'bko-bridges-congestion' into bko-permlanes-on-ahs
bkontur Apr 8, 2025
e07894a
Merge branch 'bko-bridges-congestion' into bko-permlanes-on-ahs
bkontur Apr 10, 2025
b52b5c7
Added `PalletInstance` to the blob dispatcher
bkontur Apr 14, 2025
15bf1a4
Add `expect_descend_origin_with_messaging_pallet_instance` (prepare f…
bkontur Apr 14, 2025
2693542
Keep track of two parachains on BH (for permlanes and D-Day)
bkontur Apr 20, 2025
1319254
Move `AssetHubLocation` to the common for BHW
bkontur Apr 23, 2025
668e497
Merge branch 'bko-bridges-congestion' into bko-permlanes-on-ahs
bkontur Apr 24, 2025
678da3a
Merge branch 'bko-bridges-congestion' into bko-permlanes-on-ahs
bkontur Apr 24, 2025
8a3ed87
Update from github-actions[bot] running command 'fmt'
github-actions[bot] Apr 24, 2025
214224e
Bridge Permissionless Lanes - Emulated Tests (#8292)
rosarp Apr 25, 2025
c3fd0c4
Setup `UniversalAliases` for local direct bridge
bkontur Apr 29, 2025
af3bfc9
Merge branch 'bko-bridges-congestion' into bko-permlanes-on-ahs
bkontur Apr 29, 2025
ba19caa
Merge branch 'bko-bridges-congestion' into bko-permlanes-on-ahs
bkontur Apr 29, 2025
9627d7a
Bridge Permissionless Lanes - Emulated Tests Para to Para (#8519)
rosarp May 21, 2025
b8f281c
Merge branch 'bko-bridges-congestion' into bko-permlanes-on-ahs
bkontur May 26, 2025
13358b2
Merge remote-tracking branch 'origin/bko-bridges-congestion' into bko…
bkontur May 28, 2025
2be0b7c
Merge branch 'bko-bridges-congestion' into bko-permlanes-on-ahs
bkontur May 28, 2025
cbd6d47
Set `MessageExportPrice` TODOs
bkontur May 28, 2025
3e87012
nits
bkontur May 28, 2025
8ada805
Implement `PriceForMessageDelivery` for `pallet-xcm-bridge` allowing …
bkontur Jul 10, 2025
f47422f
added fee calculation estimate tests for AHR & AHW (#9183)
rosarp Jul 16, 2025
41e2100
Merge remote-tracking branch 'origin/bko-bridges-congestion' into bko…
bkontur Jul 18, 2025
8fde05c
Merge branch 'bko-bridges-congestion' into bko-permlanes-on-ahs
bkontur Jul 21, 2025
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
23 changes: 23 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions bridges/chains/chain-asset-hub-rococo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@ scale-info = { features = ["derive"], workspace = true }

# Substrate Dependencies
frame-support = { workspace = true }
sp-api = { workspace = true }
sp-core = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }

# Bridge Dependencies
bp-bridge-hub-cumulus = { workspace = true }
bp-messages = { workspace = true }
bp-runtime = { workspace = true }
bp-xcm-bridge = { workspace = true }
bp-xcm-bridge-router = { workspace = true }

# Polkadot dependencies
Expand All @@ -30,10 +37,19 @@ xcm = { workspace = true }
[features]
default = ["std"]
std = [
"bp-bridge-hub-cumulus/std",
"bp-messages/std",
"bp-runtime/std",
"bp-xcm-bridge-router/std",
"bp-xcm-bridge/std",
"codec/std",
"codec/std",
"frame-support/std",
"frame-support/std",
"scale-info/std",
"sp-api/std",
"sp-core/std",
"sp-runtime/std",
"sp-std/std",
"xcm/std",
]
102 changes: 101 additions & 1 deletion bridges/chains/chain-asset-hub-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.

//! Module with configuration which reflects AssetHubRococo runtime setup.
//! Module with configuration which reflects AssetHubRococo runtime setup (AccountId, Headers,
//! Hashes...)

#![cfg_attr(not(feature = "std"), no_std)]

Expand All @@ -23,7 +24,16 @@ extern crate alloc;
use codec::{Decode, Encode};
use scale_info::TypeInfo;

pub use bp_bridge_hub_cumulus::*;
use bp_messages::*;
use bp_runtime::{
decl_bridge_finality_runtime_apis, decl_bridge_messages_runtime_apis, Chain, ChainId, Parachain,
};
pub use bp_xcm_bridge_router::XcmBridgeHubCall;
use frame_support::{
dispatch::DispatchClass,
sp_runtime::{MultiAddress, MultiSigner, RuntimeDebug, StateVersion},
};
use xcm::latest::prelude::*;

/// `AssetHubRococo` Runtime `Call` enum.
Expand Down Expand Up @@ -71,3 +81,93 @@ pub fn build_congestion_message<RuntimeCall>(

/// Identifier of AssetHubRococo in the Rococo relay chain.
pub const ASSET_HUB_ROCOCO_PARACHAIN_ID: u32 = 1000;

/// AssetHubRococo parachain.
#[derive(RuntimeDebug)]
pub struct AssetHubRococo;

impl Chain for AssetHubRococo {
const ID: ChainId = *b"ahro";

type BlockNumber = BlockNumber;
type Hash = Hash;
type Hasher = Hasher;
type Header = Header;

type AccountId = AccountId;
type Balance = Balance;
type Nonce = Nonce;
type Signature = Signature;

const STATE_VERSION: StateVersion = StateVersion::V1;

fn max_extrinsic_size() -> u32 {
*BlockLength::get().max.get(DispatchClass::Normal)
}

fn max_extrinsic_weight() -> Weight {
BlockWeightsForAsyncBacking::get()
.get(DispatchClass::Normal)
.max_extrinsic
.unwrap_or(Weight::MAX)
}
}

impl Parachain for AssetHubRococo {
const PARACHAIN_ID: u32 = ASSET_HUB_ROCOCO_PARACHAIN_ID;
const MAX_HEADER_SIZE: u32 = MAX_BRIDGE_HUB_HEADER_SIZE;
}

/// Describing permissionless lanes instance
impl ChainWithMessages for AssetHubRococo {
const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str =
WITH_ASSET_HUB_ROCOCO_MESSAGES_PALLET_NAME;

const MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX: MessageNonce =
MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce =
MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
}

/// Public key of the chain account that may be used to verify signatures.
pub type AccountSigner = MultiSigner;

/// The address format for describing accounts.
pub type Address = MultiAddress<AccountId, ()>;

/// Name of the With-AssetHubRococo messages pallet instance that is deployed at bridged chains.
pub const WITH_ASSET_HUB_ROCOCO_MESSAGES_PALLET_NAME: &str = "BridgeRococoMessages";

/// Name of the With-AssetHubRococo bridge-relayers pallet instance that is deployed at bridged
/// chains.
pub const WITH_ASSET_HUB_ROCOCO_RELAYERS_PALLET_NAME: &str = "BridgeRelayers";

/// Pallet index of `BridgeWestendMessages: pallet_bridge_messages::<Instance1>`.
pub const WITH_BRIDGE_ROCOCO_TO_WESTEND_MESSAGES_PALLET_INDEX: u8 = 62;

decl_bridge_finality_runtime_apis!(asset_hub_rococo);
decl_bridge_messages_runtime_apis!(asset_hub_rococo, HashedLaneId);

frame_support::parameter_types! {
/// TODO: FAIL-CI - probably not needed or ise for MessageExporterPrice
/// The XCM fee that is paid for executing XCM program (with `ExportMessage` instruction) at the Rococo
/// BridgeHub.
/// (initially was calculated by test `AssetHubRococo::can_calculate_weight_for_paid_export_message_with_reserve_transfer` + `33%`)
pub const AssetHubRococoBaseXcmFeeInRocs: u128 = 57_325_000;

/// Transaction fee that is paid at the Rococo BridgeHub for delivering single inbound message.
/// (initially was calculated by test `AssetHubRococo::can_calculate_fee_for_standalone_message_delivery_transaction` + `33%`)
pub const AssetHubRococoBaseDeliveryFeeInRocs: u128 = 297_685_840;

/// Transaction fee that is paid at the Rococo BridgeHub for delivering single outbound message confirmation.
/// (initially was calculated by test `AssetHubRococo::can_calculate_fee_for_standalone_message_confirmation_transaction` + `33%`)
pub const AssetHubRococoBaseConfirmationFeeInRocs: u128 = 56_782_099;
}

/// Wrapper over `AssetHubRococo`'s `RuntimeCall` that can be used without a runtime.
#[derive(Decode, Encode)]
pub enum RuntimeCall {
/// Points to the `pallet_xcm_bridge` pallet instance for `AssetHubWestend`.
#[codec(index = 61)]
XcmOverAssetHubWestend(bp_xcm_bridge::XcmBridgeCall),
}
16 changes: 16 additions & 0 deletions bridges/chains/chain-asset-hub-westend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@ scale-info = { features = ["derive"], workspace = true }

# Substrate Dependencies
frame-support = { workspace = true }
sp-api = { workspace = true }
sp-core = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }

# Bridge Dependencies
bp-bridge-hub-cumulus = { workspace = true }
bp-messages = { workspace = true }
bp-runtime = { workspace = true }
bp-xcm-bridge = { workspace = true }
bp-xcm-bridge-router = { workspace = true }

# Polkadot dependencies
Expand All @@ -30,10 +37,19 @@ xcm = { workspace = true }
[features]
default = ["std"]
std = [
"bp-bridge-hub-cumulus/std",
"bp-messages/std",
"bp-runtime/std",
"bp-xcm-bridge-router/std",
"bp-xcm-bridge/std",
"codec/std",
"codec/std",
"frame-support/std",
"frame-support/std",
"scale-info/std",
"sp-api/std",
"sp-core/std",
"sp-runtime/std",
"sp-std/std",
"xcm/std",
]
103 changes: 102 additions & 1 deletion bridges/chains/chain-asset-hub-westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,23 @@
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.

//! Module with configuration which reflects AssetHubWestend runtime setup.
//! Module with configuration which reflects AssetHubWestend runtime setup (AccountId, Headers,
//! Hashes...)

#![cfg_attr(not(feature = "std"), no_std)]

extern crate alloc;

pub use bp_bridge_hub_cumulus::*;
use bp_messages::*;
use bp_runtime::{
decl_bridge_finality_runtime_apis, decl_bridge_messages_runtime_apis, Chain, ChainId, Parachain,
};
use frame_support::{
dispatch::DispatchClass,
sp_runtime::{MultiAddress, MultiSigner, RuntimeDebug, StateVersion},
};

use codec::{Decode, Encode};
use scale_info::TypeInfo;

Expand Down Expand Up @@ -71,3 +82,93 @@ pub fn build_congestion_message<RuntimeCall>(

/// Identifier of AssetHubWestend in the Westend relay chain.
pub const ASSET_HUB_WESTEND_PARACHAIN_ID: u32 = 1000;

/// Westend parachain.
#[derive(RuntimeDebug)]
pub struct AssetHubWestend;

impl Chain for AssetHubWestend {
const ID: ChainId = *b"ahwd";

type BlockNumber = BlockNumber;
type Hash = Hash;
type Hasher = Hasher;
type Header = Header;

type AccountId = AccountId;
type Balance = Balance;
type Nonce = Nonce;
type Signature = Signature;

const STATE_VERSION: StateVersion = StateVersion::V1;

fn max_extrinsic_size() -> u32 {
*BlockLength::get().max.get(DispatchClass::Normal)
}

fn max_extrinsic_weight() -> Weight {
BlockWeightsForAsyncBacking::get()
.get(DispatchClass::Normal)
.max_extrinsic
.unwrap_or(Weight::MAX)
}
}

impl Parachain for AssetHubWestend {
const PARACHAIN_ID: u32 = ASSET_HUB_WESTEND_PARACHAIN_ID;
const MAX_HEADER_SIZE: u32 = MAX_BRIDGE_HUB_HEADER_SIZE; // TODO: FAIL-CI - MAX_ASSET_HUB_HEADER_SIZE
}

/// Describing permissionless lanes instance
impl ChainWithMessages for AssetHubWestend {
const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str =
WITH_ASSET_HUB_WESTEND_MESSAGES_PALLET_NAME;

const MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX: MessageNonce =
MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce =
MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
}

/// Public key of the chain account that may be used to verify signatures.
pub type AccountSigner = MultiSigner;

/// The address format for describing accounts.
pub type Address = MultiAddress<AccountId, ()>;

/// Name of the With-AssetHubWestend messages pallet instance that is deployed at bridged chains.
pub const WITH_ASSET_HUB_WESTEND_MESSAGES_PALLET_NAME: &str = "BridgeWestendMessages";

/// Name of the With-AssetHubWestend bridge-relayers pallet instance that is deployed at bridged
/// chains.
pub const WITH_ASSET_HUB_WESTEND_RELAYERS_PALLET_NAME: &str = "BridgeRelayers";

/// Pallet index of `BridgeRococoMessages: pallet_bridge_messages::<Instance1>`.
pub const WITH_BRIDGE_WESTEND_TO_ROCOCO_MESSAGES_PALLET_INDEX: u8 = 60; // TODO: FAIL-CI - correct index when AssetHubWestend

decl_bridge_finality_runtime_apis!(asset_hub_westend);
decl_bridge_messages_runtime_apis!(asset_hub_westend, HashedLaneId);

frame_support::parameter_types! {
/// TODO: FAIL-CI - probably not needed
/// The XCM fee that is paid for executing XCM program (with `ExportMessage` instruction) at the Westend
/// AssetHub.
/// (initially was calculated by test `AssetHubWestend::can_calculate_weight_for_paid_export_message_with_reserve_transfer` + `33%`)
pub const AssetHubWestendBaseXcmFeeInWnds: u128 = 57_325_000;

/// Transaction fee that is paid at the Westend AssetHub for delivering single inbound message.
/// (initially was calculated by test `AssetHubWestend::can_calculate_fee_for_standalone_message_delivery_transaction` + `33%`)
pub const AssetHubWestendBaseDeliveryFeeInWnds: u128 = 297_685_840;

/// Transaction fee that is paid at the Westend AssetHub for delivering single outbound message confirmation.
/// (initially was calculated by test `AssetHubWestend::can_calculate_fee_for_standalone_message_confirmation_transaction` + `33%`)
pub const AssetHubWestendBaseConfirmationFeeInWnds: u128 = 56_782_099;
}

/// Wrapper over `AssetHubWestend`'s `RuntimeCall` that can be used without a runtime.
#[derive(Decode, Encode)]
pub enum RuntimeCall {
/// Points to the `pallet_xcm_bridge_hub` pallet instance for `AssetHubRococo`.
#[codec(index = 62)] // TODO: FAIL-CI - corect index when AssetHubWestend
XcmOverAssetHubRococo(bp_xcm_bridge::XcmBridgeCall),
}
Loading
Loading