Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added XcmBridgeHubRouterCall::report_bridge_status encodings for AHK/P #2350

Merged
merged 9 commits into from
Aug 16, 2023
Merged
19 changes: 19 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ members = [
"modules/shift-session-manager",
"modules/xcm-bridge-hub-router",
"primitives/beefy",
"primitives/chain-asset-hub-kusama",
"primitives/chain-asset-hub-polkadot",
"primitives/chain-bridge-hub-cumulus",
"primitives/chain-bridge-hub-kusama",
"primitives/chain-bridge-hub-polkadot",
Expand Down
22 changes: 22 additions & 0 deletions primitives/chain-asset-hub-kusama/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "bp-asset-hub-kusama"
description = "Primitives of AssetHubKusama parachain runtime."
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"

[dependencies]
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false }
scale-info = { version = "2.9.0", default-features = false, features = ["derive"] }

# Bridge Dependencies
bp-xcm-bridge-hub-router = { path = "../xcm-bridge-hub-router", default-features = false }

[features]
default = ["std"]
std = [
"bp-xcm-bridge-hub-router/std",
"codec/std",
"scale-info/std",
]
40 changes: 40 additions & 0 deletions primitives/chain-asset-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright 2022 Parity Technologies (UK) Ltd.
// This file is part of Parity Bridges Common.

// Parity Bridges Common is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Parity Bridges Common is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// 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 AssetHubKusama runtime setup.

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

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

pub use bp_xcm_bridge_hub_router::XcmBridgeHubRouterCall;

/// `AssetHubKusama` Runtime `Call` enum.
///
/// The enum represents a subset of possible `Call`s we can send to `AssetHubKusama` chain.
/// Ideally this code would be auto-generated from metadata, because we want to
/// avoid depending directly on the ENTIRE runtime just to get the encoding of `Dispatchable`s.
///
/// All entries here (like pretty much in the entire file) must be kept in sync with
/// `AssetHubKusama` `construct_runtime`, so that we maintain SCALE-compatibility.
#[allow(clippy::large_enum_variant)]
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
pub enum Call {
/// `ToPolkadotXcmRouter` bridge pallet.
#[codec(index = 43)]
ToPolkadotXcmRouter(XcmBridgeHubRouterCall),
}
22 changes: 22 additions & 0 deletions primitives/chain-asset-hub-polkadot/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "bp-asset-hub-polkadot"
description = "Primitives of AssetHubPolkadot parachain runtime."
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"

[dependencies]
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false }
scale-info = { version = "2.9.0", default-features = false, features = ["derive"] }

# Bridge Dependencies
bp-xcm-bridge-hub-router = { path = "../xcm-bridge-hub-router", default-features = false }

[features]
default = ["std"]
std = [
"bp-xcm-bridge-hub-router/std",
"codec/std",
"scale-info/std",
]
40 changes: 40 additions & 0 deletions primitives/chain-asset-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright 2022 Parity Technologies (UK) Ltd.
// This file is part of Parity Bridges Common.

// Parity Bridges Common is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Parity Bridges Common is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// 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 AssetHubPolkadot runtime setup.

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

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

pub use bp_xcm_bridge_hub_router::XcmBridgeHubRouterCall;

/// `AssetHubPolkadot` Runtime `Call` enum.
///
/// The enum represents a subset of possible `Call`s we can send to `AssetHubPolkadot` chain.
/// Ideally this code would be auto-generated from metadata, because we want to
/// avoid depending directly on the ENTIRE runtime just to get the encoding of `Dispatchable`s.
///
/// All entries here (like pretty much in the entire file) must be kept in sync with
/// `AssetHubPolkadot` `construct_runtime`, so that we maintain SCALE-compatibility.
#[allow(clippy::large_enum_variant)]
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
pub enum Call {
/// `ToKusamaXcmRouter` bridge pallet.
#[codec(index = 43)]
ToKusamaXcmRouter(XcmBridgeHubRouterCall),
}
3 changes: 2 additions & 1 deletion primitives/xcm-bridge-hub-router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ codec = { package = "parity-scale-codec", version = "3.1.5", default-features =
scale-info = { version = "2.9.0", default-features = false, features = ["bit-vec", "derive"] }

# Substrate Dependencies

sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }

[features]
default = ["std"]
std = [
"codec/std",
"scale-info/std",
"sp-runtime/std",
"sp-core/std",
]
10 changes: 10 additions & 0 deletions primitives/xcm-bridge-hub-router/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

use codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_core::H256;
use sp_runtime::{FixedU128, RuntimeDebug};

/// Minimal delivery fee factor.
Expand Down Expand Up @@ -54,3 +55,12 @@ impl Default for BridgeState {
BridgeState { delivery_fee_factor: MINIMAL_DELIVERY_FEE_FACTOR, is_congested: false }
}
}

/// A minimized version of `pallet-xcm-bridge-hub-router::Call` that can be used without a runtime.
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
#[allow(non_camel_case_types)]
pub enum XcmBridgeHubRouterCall {
/// `pallet-xcm-bridge-hub-router::Call::report_bridge_status`
#[codec(index = 0)]
report_bridge_status { bridge_id: H256, is_congested: bool },
}