Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
92a336c
copying chain-asset-hub-rococo/westend and related changes only
rosarp Mar 27, 2025
f53df15
added Cargo.lock changes
rosarp Mar 27, 2025
afc16a4
Apply suggestions from code review
rosarp Mar 27, 2025
3c0d894
using new const MAX_ASSET_HUB_HEADER_SIZE
rosarp Mar 27, 2025
2deed5d
removing unused dep. from Cargo.lock
rosarp Mar 27, 2025
bd7dedd
Merge remote-tracking branch 'refs/remotes/origin/rs-bko-permlanes-on…
rosarp Mar 27, 2025
ec8fe93
Update from github-actions[bot] running command 'prdoc --audience run…
github-actions[bot] Mar 27, 2025
dccdf1a
reverting grandpa pallet change
rosarp Mar 27, 2025
9330cd6
Merge remote-tracking branch 'refs/remotes/origin/rs-bko-permlanes-on…
rosarp Mar 27, 2025
e804797
Update prdoc/pr_8063.prdoc
bkontur Mar 27, 2025
b8e65d9
Update prdoc/pr_8063.prdoc
bkontur Mar 27, 2025
b091826
Update bridges/chains/chain-asset-hub-rococo/Cargo.toml
bkontur Mar 27, 2025
ea31045
Update bridges/chains/chain-asset-hub-westend/Cargo.toml
bkontur Mar 27, 2025
4200cb4
Merge branch 'master' into rs-bko-permlanes-on-ahs-only-bridges-chain…
bkontur Mar 27, 2025
ad6ecc5
Update bridges/chains/chain-asset-hub-rococo/Cargo.toml
bkontur Mar 27, 2025
8aab170
Update bridges/chains/chain-asset-hub-westend/Cargo.toml
bkontur Mar 27, 2025
427a370
Apply suggestions from code review
bkontur Mar 28, 2025
96a4133
Merge branch 'master' into rs-bko-permlanes-on-ahs-only-bridges-chain…
bkontur Mar 28, 2025
c4ce154
Merge branch 'master' into rs-bko-permlanes-on-ahs-only-bridges-chain…
bkontur Mar 28, 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
6 changes: 6 additions & 0 deletions Cargo.lock

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

8 changes: 8 additions & 0 deletions bridges/chains/chain-asset-hub-rococo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ sp-core = { workspace = true }

# Bridge Dependencies
bp-xcm-bridge-hub-router = { workspace = true }
bp-bridge-hub-cumulus = { workspace = true }
bp-messages = { workspace = true }
bp-runtime = { workspace = true }
testnet-parachains-constants = { features = ["rococo"], workspace = true }

# Polkadot dependencies
Expand All @@ -32,7 +35,12 @@ xcm = { workspace = true }
default = ["std"]
std = [
"bp-xcm-bridge-hub-router/std",
"bp-bridge-hub-cumulus/std",
"bp-messages/std",
"bp-runtime/std",
"codec/std",
"codec/std",
"frame-support/std",
"frame-support/std",
"scale-info/std",
"sp-core/std",
Expand Down
44 changes: 44 additions & 0 deletions bridges/chains/chain-asset-hub-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ extern crate alloc;
use codec::{Decode, Encode};
use scale_info::TypeInfo;

pub use bp_bridge_hub_cumulus::*;
use bp_messages::*;
use bp_runtime::{Chain, ChainId, Parachain};
pub use bp_xcm_bridge_hub_router::XcmBridgeHubRouterCall;
use frame_support::{
dispatch::DispatchClass,
sp_runtime::{RuntimeDebug, StateVersion},
};
use testnet_parachains_constants::rococo::currency::UNITS;
use xcm::latest::prelude::*;

Expand Down Expand Up @@ -74,3 +81,40 @@ 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_ASSET_HUB_HEADER_SIZE;
}
8 changes: 8 additions & 0 deletions bridges/chains/chain-asset-hub-westend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ sp-core = { workspace = true }

# Bridge Dependencies
bp-xcm-bridge-hub-router = { workspace = true }
bp-bridge-hub-cumulus = { workspace = true }
bp-messages = { workspace = true }
bp-runtime = { workspace = true }
testnet-parachains-constants = { features = ["westend"], workspace = true }

# Polkadot dependencies
Expand All @@ -32,7 +35,12 @@ xcm = { workspace = true }
default = ["std"]
std = [
"bp-xcm-bridge-hub-router/std",
"bp-bridge-hub-cumulus/std",
"bp-messages/std",
"bp-runtime/std",
"codec/std",
"codec/std",
"frame-support/std",
"frame-support/std",
"scale-info/std",
"sp-core/std",
Expand Down
46 changes: 44 additions & 2 deletions bridges/chains/chain-asset-hub-westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@

extern crate alloc;

pub use bp_bridge_hub_cumulus::*;
use bp_messages::*;
use bp_runtime::{Chain, ChainId, Parachain};
pub use bp_xcm_bridge_hub_router::XcmBridgeHubRouterCall;
use codec::{Decode, Encode};
use frame_support::{
dispatch::DispatchClass,
sp_runtime::{RuntimeDebug, StateVersion},
};
use scale_info::TypeInfo;

pub use bp_xcm_bridge_hub_router::XcmBridgeHubRouterCall;
use testnet_parachains_constants::westend::currency::UNITS;
use xcm::latest::prelude::*;

Expand Down Expand Up @@ -75,3 +81,39 @@ pub fn build_congestion_message<RuntimeCall>(

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

/// AssetHubWestend 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_ASSET_HUB_HEADER_SIZE;
}
3 changes: 3 additions & 0 deletions bridges/chains/chain-bridge-hub-cumulus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ use frame_support::{
use frame_system::limits;
use sp_std::time::Duration;

/// Maximal asset hub header size.
pub const MAX_ASSET_HUB_HEADER_SIZE: u32 = 4_096;

/// Maximal bridge hub header size.
pub const MAX_BRIDGE_HUB_HEADER_SIZE: u32 = 4_096;

Expand Down
31 changes: 31 additions & 0 deletions prdoc/pr_8063.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
title: 'Bridges: Add initial primitives for AssetHub bridging'
doc:
- audience: Runtime Dev
description: |-
This resolves TODO no. 1: https://github.com/paritytech/parity-bridges-common/issues/3136#issue-2913441160

To add cli support to substrate-relay as described in above issue,
necessary changes from [this](https://github.com/paritytech/polkadot-sdk/pull/6675) PR are added by this PR.

Specifically below changes and any other supportive changes.

```
// bridges/chains/chain-asset-hub-rococo/src/lib.rs
impl Chain for AssetHubRococo {..}
impl Parachain for AssetHubRococo {..}
```

```
// bridges/chains/chain-asset-hub-westend/src/lib.rs
impl Chain for AssetHubWestend {..}
impl Parachain for AssetHubWestend {..}
```
crates:
- name: bp-asset-hub-rococo
bump: patch
- name: bp-asset-hub-westend
bump: patch
- name: pallet-bridge-grandpa
bump: patch
- name: bp-bridge-hub-cumulus
bump: patch
Loading