mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 14:31:02 +00:00
Rococo/Wococo bridge hub relay integration (#1565)
* [BridgeHub] Added bridge-hub-rococo/wococo clients with bridge-hub-rococo-runtime * [BridgeHub] Add init-bridge stuff for bridge-hub-rococo/wococo * [BridgeHub] Add init-bridge stuff for bridge-hub-rococo/wococo * [BridgeHub] Fixed Call-encoding for init-bridge rococo runtime wrapper * Final index update to runtime calls * [BridgeHub] Add init-bridge stuff for bridge-hub-rococo/wococo (otherside) * Added runtime best_finalized functions + relay-headers init * Renaming and change BridgeHubRococo/Wococo to Rococo/Wococo config * [BridgeHub] Add relay-parachains (Rococo/Wococo) * Missing stuff for adding xcm messaging to BridgeHub * extracted parachain IDs to the primitives * fix compilation * Fixes * Init setup for Rococo->Wococo messaging support * Removed unused AccountId from `trait MessagesBridge` * Removed unused trait SenderOrigin * Small fixes * Cleaning after master-merge * Fixes * Fixes * Fixes * Fixes * Fixes: - align WeightToFee with BridgeHubRococo runtime - MAX_HEADER_SIZE - updated TODOs * Added relay_messages cfg for BridgeHubWococo -> BridgeHubRococo Co-authored-by: Svyatoslav Nikolsky <svyatonik@gmail.com>
This commit is contained in:
committed by
Bastian Köcher
parent
3c76889948
commit
6c4728f1cc
@@ -0,0 +1,37 @@
|
||||
[package]
|
||||
name = "bp-bridge-hub-rococo"
|
||||
description = "Primitives of BridgeHubRococo 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]
|
||||
smallvec = "1.10.0"
|
||||
|
||||
# Bridge Dependencies
|
||||
|
||||
bp-polkadot-core = { path = "../../primitives/polkadot-core", default-features = false }
|
||||
bp-runtime = { path = "../../primitives/runtime", default-features = false }
|
||||
bp-messages = { path = "../../primitives/messages", default-features = false }
|
||||
|
||||
# Substrate Based Dependencies
|
||||
|
||||
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
|
||||
# Polkadot Dependencies
|
||||
polkadot-runtime-constants = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"bp-polkadot-core/std",
|
||||
"bp-messages/std",
|
||||
"bp-runtime/std",
|
||||
"frame-support/std",
|
||||
"sp-api/std",
|
||||
"sp-std/std",
|
||||
"polkadot-runtime-constants/std",
|
||||
]
|
||||
@@ -0,0 +1,75 @@
|
||||
// Copyright 2019-2021 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 BridgeHubRococo runtime setup (AccountId, Headers,
|
||||
//! Hashes...)
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use bp_messages::*;
|
||||
pub use bp_polkadot_core::*;
|
||||
use bp_runtime::{decl_bridge_finality_runtime_apis, decl_bridge_messages_runtime_apis};
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
sp_runtime::{FixedU128, MultiAddress, MultiSigner},
|
||||
weights::{
|
||||
constants::ExtrinsicBaseWeight, WeightToFeeCoefficient, WeightToFeeCoefficients,
|
||||
WeightToFeePolynomial,
|
||||
},
|
||||
Parameter,
|
||||
};
|
||||
use sp_std::prelude::*;
|
||||
|
||||
pub type BridgeHubRococo = PolkadotLike;
|
||||
|
||||
/// [`WeightToFee`] should reflect cumulus/bridge-hub-rococo-runtime [`WeightToFee`]
|
||||
pub struct WeightToFee;
|
||||
impl WeightToFeePolynomial for WeightToFee {
|
||||
type Balance = Balance;
|
||||
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
|
||||
pub const CENTS: Balance = polkadot_runtime_constants::currency::CENTS;
|
||||
|
||||
// in Rococo, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT:
|
||||
// in BridgeHub, we map to 1/10 of that, or 1/100 CENT
|
||||
let p = CENTS;
|
||||
let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time());
|
||||
smallvec::smallvec![WeightToFeeCoefficient {
|
||||
degree: 1,
|
||||
negative: false,
|
||||
coeff_frac: Perbill::from_rational(p % q, q),
|
||||
coeff_integer: p / q,
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
/// 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, ()>;
|
||||
|
||||
/// Identifier of BridgeHubRococo in the Rococo relay chain.
|
||||
pub const BRIDGE_HUB_ROCOCO_PARACHAIN_ID: u32 = 1013;
|
||||
|
||||
/// Name of the With-BridgeHubRococo messages pallet instance that is deployed at bridged chains.
|
||||
pub const WITH_BRIDGE_HUB_ROCOCO_MESSAGES_PALLET_NAME: &str = "BridgeRococoMessages";
|
||||
|
||||
parameter_types! {
|
||||
pub const SS58Prefix: u16 = 42;
|
||||
}
|
||||
|
||||
decl_bridge_finality_runtime_apis!(bridge_hub_rococo);
|
||||
decl_bridge_messages_runtime_apis!(bridge_hub_rococo);
|
||||
Reference in New Issue
Block a user