diff --git a/Cargo.lock b/Cargo.lock index 5da581e1..cb1572db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -671,7 +671,7 @@ dependencies = [ [[package]] name = "bp-crab" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#66f6c304b8d7a0425b4ef1df9b5d7e4e242be93d" dependencies = [ "bp-darwinia-core", "bp-messages", @@ -686,7 +686,22 @@ dependencies = [ [[package]] name = "bp-crab-parachain" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#66f6c304b8d7a0425b4ef1df9b5d7e4e242be93d" +dependencies = [ + "bp-darwinia-core", + "bp-messages", + "bp-runtime", + "frame-support", + "sp-api", + "sp-runtime", + "sp-std", + "sp-version", +] + +[[package]] +name = "bp-darwinia" +version = "0.1.0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#66f6c304b8d7a0425b4ef1df9b5d7e4e242be93d" dependencies = [ "bp-darwinia-core", "bp-messages", @@ -701,7 +716,7 @@ dependencies = [ [[package]] name = "bp-darwinia-core" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#66f6c304b8d7a0425b4ef1df9b5d7e4e242be93d" dependencies = [ "bp-messages", "bp-runtime", @@ -714,10 +729,25 @@ dependencies = [ "sp-std", ] +[[package]] +name = "bp-darwinia-parachain" +version = "0.1.0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#66f6c304b8d7a0425b4ef1df9b5d7e4e242be93d" +dependencies = [ + "bp-darwinia-core", + "bp-messages", + "bp-runtime", + "frame-support", + "sp-api", + "sp-runtime", + "sp-std", + "sp-version", +] + [[package]] name = "bp-header-chain" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#66f6c304b8d7a0425b4ef1df9b5d7e4e242be93d" dependencies = [ "bp-runtime", "finality-grandpa", @@ -734,7 +764,7 @@ dependencies = [ [[package]] name = "bp-message-dispatch" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#66f6c304b8d7a0425b4ef1df9b5d7e4e242be93d" dependencies = [ "bp-runtime", "frame-support", @@ -747,7 +777,7 @@ dependencies = [ [[package]] name = "bp-messages" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#66f6c304b8d7a0425b4ef1df9b5d7e4e242be93d" dependencies = [ "bitvec", "bp-runtime", @@ -764,7 +794,7 @@ dependencies = [ [[package]] name = "bp-pangolin" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#66f6c304b8d7a0425b4ef1df9b5d7e4e242be93d" dependencies = [ "bp-darwinia-core", "bp-messages", @@ -779,7 +809,7 @@ dependencies = [ [[package]] name = "bp-pangolin-parachain" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#66f6c304b8d7a0425b4ef1df9b5d7e4e242be93d" dependencies = [ "bp-darwinia-core", "bp-messages", @@ -794,7 +824,7 @@ dependencies = [ [[package]] name = "bp-pangolin-parachain-alpha" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#66f6c304b8d7a0425b4ef1df9b5d7e4e242be93d" dependencies = [ "bp-darwinia-core", "bp-messages", @@ -809,7 +839,7 @@ dependencies = [ [[package]] name = "bp-parachains" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#66f6c304b8d7a0425b4ef1df9b5d7e4e242be93d" dependencies = [ "bp-polkadot-core", "bp-runtime", @@ -823,7 +853,7 @@ dependencies = [ [[package]] name = "bp-polkadot-core" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#66f6c304b8d7a0425b4ef1df9b5d7e4e242be93d" dependencies = [ "bp-messages", "bp-runtime", @@ -843,7 +873,7 @@ dependencies = [ [[package]] name = "bp-runtime" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#66f6c304b8d7a0425b4ef1df9b5d7e4e242be93d" dependencies = [ "frame-support", "hash-db", @@ -861,7 +891,7 @@ dependencies = [ [[package]] name = "bp-test-utils" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#66f6c304b8d7a0425b4ef1df9b5d7e4e242be93d" dependencies = [ "bp-header-chain", "ed25519-dalek", @@ -876,7 +906,7 @@ dependencies = [ [[package]] name = "bridge-runtime-common" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#66f6c304b8d7a0425b4ef1df9b5d7e4e242be93d" dependencies = [ "bp-message-dispatch", "bp-messages", @@ -2215,6 +2245,12 @@ name = "darwinia-parachain-runtime" version = "5.3.4" dependencies = [ "array-bytes", + "bp-darwinia", + "bp-darwinia-parachain", + "bp-message-dispatch", + "bp-messages", + "bp-runtime", + "bridge-runtime-common", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", @@ -2234,7 +2270,11 @@ dependencies = [ "pallet-aura", "pallet-authorship", "pallet-balances", + "pallet-bridge-dispatch", + "pallet-bridge-grandpa", + "pallet-bridge-messages", "pallet-collator-selection", + "pallet-fee-market", "pallet-multisig", "pallet-proxy", "pallet-session", @@ -5661,7 +5701,7 @@ dependencies = [ [[package]] name = "pallet-bridge-dispatch" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#66f6c304b8d7a0425b4ef1df9b5d7e4e242be93d" dependencies = [ "bp-message-dispatch", "bp-runtime", @@ -5678,7 +5718,7 @@ dependencies = [ [[package]] name = "pallet-bridge-grandpa" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#66f6c304b8d7a0425b4ef1df9b5d7e4e242be93d" dependencies = [ "bp-header-chain", "bp-runtime", @@ -5701,7 +5741,7 @@ dependencies = [ [[package]] name = "pallet-bridge-messages" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#66f6c304b8d7a0425b4ef1df9b5d7e4e242be93d" dependencies = [ "bitvec", "bp-message-dispatch", @@ -5723,7 +5763,7 @@ dependencies = [ [[package]] name = "pallet-bridge-parachains" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#66f6c304b8d7a0425b4ef1df9b5d7e4e242be93d" dependencies = [ "bp-parachains", "bp-polkadot-core", @@ -5870,7 +5910,7 @@ dependencies = [ [[package]] name = "pallet-fee-market" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#66f6c304b8d7a0425b4ef1df9b5d7e4e242be93d" dependencies = [ "bp-messages", "bp-runtime", @@ -11649,7 +11689,7 @@ version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ - "cfg-if 1.0.0", + "cfg-if 0.1.10", "digest 0.10.5", "rand 0.8.5", "static_assertions", diff --git a/runtime/common/src/helixbridge/mod.rs b/runtime/common/src/helixbridge/mod.rs index c45e25b2..a0ff444b 100644 --- a/runtime/common/src/helixbridge/mod.rs +++ b/runtime/common/src/helixbridge/mod.rs @@ -605,9 +605,10 @@ pub mod pallet { let message_nonce = T::MessageNoncer::outbound_latest_generated_nonce(T::MessageLaneId::get()); - return Ok(message_nonce); + + Ok(message_nonce) } else { - return Err(Error::::BackingAccountNone.into()); + Err(Error::::BackingAccountNone.into()) } } } diff --git a/runtime/common/src/message_router/mod.rs b/runtime/common/src/message_router/mod.rs index 463457e3..32459045 100644 --- a/runtime/common/src/message_router/mod.rs +++ b/runtime/common/src/message_router/mod.rs @@ -174,7 +174,7 @@ pub mod pallet { TargetXcmExecConfig::::get(T::MoonbeamLocation::get()) .ok_or(Error::::TargetXcmExecNotConfig)?; remote_weight = T::MoonbeamWeigher::weight(&mut Self::extend_remote_xcm( - raw_account.clone(), + raw_account, remote_xcm.clone(), MultiAsset { id: AssetId::from(T::LocalAssetId::get()), fun: Fungible(0) }, )) @@ -185,7 +185,7 @@ pub mod pallet { TargetXcmExecConfig::::get(T::AstarLocation::get()) .ok_or(Error::::TargetXcmExecNotConfig)?; remote_weight = T::AstarWeigher::weight(&mut Self::extend_remote_xcm( - raw_account.clone(), + raw_account, remote_xcm.clone(), MultiAsset { id: AssetId::from(T::LocalAssetId::get()), fun: Fungible(0) }, )) @@ -229,7 +229,7 @@ pub mod pallet { // Toggle the xcm_fee relative to a target context let ancestry = T::LocationInverter::ancestry(); - let mut remote_xcm_fee_anchor_dest = remote_xcm_fee.clone(); + let mut remote_xcm_fee_anchor_dest = remote_xcm_fee; match target { Target::Moonbeam => { remote_xcm_fee_anchor_dest @@ -292,7 +292,8 @@ pub mod pallet { DescendOrigin(X1(AccountId32 { network: NetworkId::Any, id: raw_account })), ]); extend_xcm.0.extend(xcm.0.into_iter()); - return extend_xcm; + + extend_xcm } } } diff --git a/runtime/crab-parachain/src/lib.rs b/runtime/crab-parachain/src/lib.rs index ad4c1d56..da00b3e6 100644 --- a/runtime/crab-parachain/src/lib.rs +++ b/runtime/crab-parachain/src/lib.rs @@ -140,35 +140,32 @@ frame_support::construct_runtime! { NodeBlock = OpaqueBlock, UncheckedExtrinsic = UncheckedExtrinsic, { - // System support stuff. System: frame_system::{Pallet, Call, Storage, Config, Event} = 0, ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Inherent, Storage, Config, Event, ValidateUnsigned} = 1, Timestamp: pallet_timestamp::{Pallet, Call, Inherent, Storage} = 3, ParachainInfo: parachain_info::{Pallet, Storage, Config} = 4, - // Monetary stuff. Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 5, TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event} = 6, - // Collator support. the order of these 4 are important and shall not change. + // Collator things. the order of these 4 are important and shall not change. Authorship: pallet_authorship::{Pallet, Call, Storage} = 7, CollatorSelection: pallet_collator_selection::{Pallet, Call, Storage, Event, Config} = 8, Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 9, Aura: pallet_aura::{Pallet, Storage, Config} = 10, AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 11, + RemoteGovernance: dp_common_runtime::remote_governance::{Pallet, Call, Storage, Event} = 25, - // XCM helpers. + // XCM things. XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event} = 12, PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 13, CumulusXcm: cumulus_pallet_xcm::{Pallet, Event, Origin} = 14, DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event} = 15, - // Handy utilities. Utility: pallet_utility::{Pallet, Call, Event} = 16, Multisig: pallet_multisig::{Pallet, Call, Storage, Event} = 17, Proxy: pallet_proxy::{Pallet, Call, Storage, Event} = 18, Sudo: pallet_sudo::{Pallet, Call, Storage, Config, Event} = 19, - RemoteGovernance: dp_common_runtime::remote_governance::{Pallet, Call, Storage, Event} = 25, // Crab Parachain <> Crab. BridgeCrabGrandpa: pallet_bridge_grandpa::::{Pallet, Call, Storage} = 20, diff --git a/runtime/crab-parachain/src/pallets/helixbridge.rs b/runtime/crab-parachain/src/pallets/helixbridge.rs index be4cec14..0b61abda 100644 --- a/runtime/crab-parachain/src/pallets/helixbridge.rs +++ b/runtime/crab-parachain/src/pallets/helixbridge.rs @@ -53,7 +53,7 @@ frame_support::parameter_types! { pub const ParachainIssuingPalletId: PalletId = PalletId(*b"da/paais"); pub const CrabChainId: ChainId = CRAB_CHAIN_ID; pub const CrabSmartChainId: u64 = 44; - pub const MaxNonceReserves: u32 = 1024; + pub const MaxNonceReserves: u32 = 4096; } impl Config for Runtime { diff --git a/runtime/crab-parachain/src/pallets/mod.rs b/runtime/crab-parachain/src/pallets/mod.rs index eac8f4c7..d2227407 100644 --- a/runtime/crab-parachain/src/pallets/mod.rs +++ b/runtime/crab-parachain/src/pallets/mod.rs @@ -31,6 +31,9 @@ pub use aura::*; pub mod aura_ext; pub use aura_ext::*; +pub mod remote_governance; +pub use remote_governance::*; + pub mod xcmp_queue; pub use xcmp_queue::*; @@ -55,9 +58,6 @@ pub use proxy::*; pub mod sudo; pub use sudo::*; -pub mod remote_governance; -pub use remote_governance::*; - pub mod bridge_dispatch; pub use bridge_dispatch::*; diff --git a/runtime/darwinia-parachain/Cargo.toml b/runtime/darwinia-parachain/Cargo.toml index 565dca58..1669b023 100644 --- a/runtime/darwinia-parachain/Cargo.toml +++ b/runtime/darwinia-parachain/Cargo.toml @@ -12,7 +12,7 @@ version = "5.3.4" [dependencies] # crates.io -array-bytes = { version = "4.1", optional = true } +array-bytes = { version = "4.1" } codec = { package = "parity-scale-codec", version = "3.1", default-features = false, features = ["derive"] } scale-info = { version = "2.1", default-features = false, features = ["derive"] } smallvec = { version = "1.9" } @@ -30,6 +30,17 @@ parachain-info = { default-features = false, git = "https://git # darwinia dc-primitives = { default-features = false, path = "../../primitives" } dp-common-runtime = { default-features = false, path = "../common" } +# darwinia-messages-substrate +bp-darwinia = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.27" } +bp-darwinia-parachain = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.27" } +bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.27" } +bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.27" } +bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.27" } +bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.27" } +pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.27" } +pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.27" } +pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.27" } +pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.27" } # polkadot pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.27" } pallet-xcm-benchmarks = { optional = true, default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.27" } @@ -87,8 +98,18 @@ std = [ "cumulus-primitives-utility/std", "pallet-collator-selection/std", "parachain-info/std", - "dp-common-runtime/std", "dc-primitives/std", + "dp-common-runtime/std", + "bp-darwinia/std", + "bp-darwinia-parachain/std", + "bp-message-dispatch/std", + "bp-messages/std", + "bp-runtime/std", + "bridge-runtime-common/std", + "pallet-bridge-dispatch/std", + "pallet-bridge-grandpa/std", + "pallet-bridge-messages/std", + "pallet-fee-market/std", "pallet-xcm/std", "polkadot-parachain/std", "polkadot-runtime-common/std", @@ -124,8 +145,6 @@ std = [ ] runtime-benchmarks = [ - # crates.io - "array-bytes", # cumulus "cumulus-pallet-xcmp-queue/runtime-benchmarks", # polkadot diff --git a/runtime/darwinia-parachain/src/bridges_message/darwinia.rs b/runtime/darwinia-parachain/src/bridges_message/darwinia.rs new file mode 100644 index 00000000..6cae4e5e --- /dev/null +++ b/runtime/darwinia-parachain/src/bridges_message/darwinia.rs @@ -0,0 +1,154 @@ +// --- crates.io --- +use codec::{Decode, Encode}; +use scale_info::TypeInfo; +// --- paritytech --- +use frame_support::{weights::Weight, RuntimeDebug}; +use sp_runtime::{FixedPointNumber, FixedU128}; +use sp_std::ops::RangeInclusive; +// --- darwinia-network --- +use crate::*; +use bp_messages::{source_chain::*, target_chain::*, *}; +use bp_runtime::*; +use bridge_runtime_common::{ + lanes::*, + messages::{source::*, target::*, *}, +}; + +/// Message delivery proof for DarwiniaParachain -> Darwinia messages. +pub type ToDarwiniaMessagesDeliveryProof = FromBridgedChainMessagesDeliveryProof; +/// Message proof for Darwinia -> DarwiniaParachain messages. +pub type FromDarwiniaMessagesProof = FromBridgedChainMessagesProof; + +/// Message payload for DarwiniaParachain -> Darwinia messages. +pub type ToDarwiniaMessagePayload = FromThisChainMessagePayload; +/// Message payload for Darwinia -> DarwiniaParachain messages. +pub type FromDarwiniaMessagePayload = FromBridgedChainMessagePayload; + +/// Message verifier for DarwiniaParachain -> Darwinia messages. +pub type ToDarwiniaMessageVerifier = + FromThisChainMessageVerifier; + +/// Encoded Darwinia Call as it comes from Darwinia. +pub type FromDarwiniaEncodedCall = FromBridgedChainEncodedMessageCall; + +/// Call-dispatch based message dispatch for Darwinia -> DarwiniaParachain messages. +pub type FromDarwiniaMessageDispatch = + FromBridgedChainMessageDispatch; + +pub const INITIAL_DARWINIA_TO_DARWINIA_PARACHAIN_CONVERSION_RATE: FixedU128 = + FixedU128::from_inner(FixedU128::DIV); + +frame_support::parameter_types! { + /// DarwiniaParachain to Darwinia conversion rate. Initially we trate both tokens as equal. + pub storage DarwiniaToDarwiniaParachainConversionRate: FixedU128 = INITIAL_DARWINIA_TO_DARWINIA_PARACHAIN_CONVERSION_RATE; +} + +#[derive(Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo)] +pub enum DarwiniaParachainToDarwiniaParameter { + /// The conversion formula we use is: `DarwiniaTokens = DarwiniaParachainTokens * + /// conversion_rate`. + DarwiniaToDarwiniaParachainConversionRate(FixedU128), +} +impl Parameter for DarwiniaParachainToDarwiniaParameter { + fn save(&self) { + match *self { + DarwiniaParachainToDarwiniaParameter::DarwiniaToDarwiniaParachainConversionRate( + ref conversion_rate, + ) => DarwiniaToDarwiniaParachainConversionRate::set(conversion_rate), + } + } +} + +/// Darwinia <-> DarwiniaParachain message bridge. +#[derive(Clone, Copy, RuntimeDebug)] +pub struct WithDarwiniaMessageBridge; +impl MessageBridge for WithDarwiniaMessageBridge { + type BridgedChain = Darwinia; + type ThisChain = DarwiniaParachain; + + const BRIDGED_CHAIN_ID: ChainId = DARWINIA_CHAIN_ID; + const BRIDGED_MESSAGES_PALLET_NAME: &'static str = + bp_darwinia_parachain::WITH_DARWINIA_PARACHAIN_MESSAGES_PALLET_NAME; + const RELAYER_FEE_PERCENT: u32 = 10; + const THIS_CHAIN_ID: ChainId = DARWINIA_PARACHAIN_CHAIN_ID; +} + +#[derive(Clone, Copy, RuntimeDebug)] +pub struct DarwiniaParachain; +impl ChainWithMessages for DarwiniaParachain { + type AccountId = bp_darwinia_parachain::AccountId; + type Balance = bp_darwinia_parachain::Balance; + type Hash = bp_darwinia_parachain::Hash; + type Signature = bp_darwinia_parachain::Signature; + type Signer = bp_darwinia_parachain::AccountPublic; + type Weight = Weight; +} +impl ThisChainWithMessages for DarwiniaParachain { + type Call = Call; + type Origin = Origin; + + fn is_message_accepted(_send_origin: &Self::Origin, lane: &LaneId) -> bool { + *lane == DARWINIA_DARWINIA_PARACHAIN_LANE + } + + fn maximal_pending_messages_at_outbound_lane() -> MessageNonce { + MessageNonce::MAX + } +} + +#[derive(Clone, Copy, RuntimeDebug)] +pub struct Darwinia; +impl ChainWithMessages for Darwinia { + type AccountId = bp_darwinia::AccountId; + type Balance = bp_darwinia::Balance; + type Hash = bp_darwinia::Hash; + type Signature = bp_darwinia::Signature; + type Signer = bp_darwinia::AccountPublic; + type Weight = Weight; +} +impl BridgedChainWithMessages for Darwinia { + fn maximal_extrinsic_size() -> u32 { + bp_darwinia::Darwinia::max_extrinsic_size() + } + + fn message_weight_limits(_message_payload: &[u8]) -> RangeInclusive { + let upper_limit = target::maximal_incoming_message_dispatch_weight( + bp_darwinia::Darwinia::max_extrinsic_weight(), + ); + 0..=upper_limit + } +} +impl TargetHeaderChain::AccountId> + for Darwinia +{ + type Error = &'static str; + type MessagesDeliveryProof = ToDarwiniaMessagesDeliveryProof; + + fn verify_message(payload: &ToDarwiniaMessagePayload) -> Result<(), Self::Error> { + source::verify_chain_message::(payload) + } + + fn verify_messages_delivery_proof( + proof: Self::MessagesDeliveryProof, + ) -> Result<(LaneId, InboundLaneData), Self::Error> { + source::verify_messages_delivery_proof::< + WithDarwiniaMessageBridge, + Runtime, + WithDarwiniaGrandpa, + >(proof) + } +} +impl SourceHeaderChain<::Balance> for Darwinia { + type Error = &'static str; + type MessagesProof = FromDarwiniaMessagesProof; + + fn verify_messages_proof( + proof: Self::MessagesProof, + messages_count: u32, + ) -> Result::Balance>>, Self::Error> { + target::verify_messages_proof::( + proof, + messages_count, + ) + } +} diff --git a/runtime/darwinia-parachain/src/bridges_message/mod.rs b/runtime/darwinia-parachain/src/bridges_message/mod.rs new file mode 100644 index 00000000..4d240477 --- /dev/null +++ b/runtime/darwinia-parachain/src/bridges_message/mod.rs @@ -0,0 +1,2 @@ +pub mod darwinia; +pub use darwinia as bm_darwinia; diff --git a/runtime/darwinia-parachain/src/lib.rs b/runtime/darwinia-parachain/src/lib.rs index ae4e08c0..0c880f90 100644 --- a/runtime/darwinia-parachain/src/lib.rs +++ b/runtime/darwinia-parachain/src/lib.rs @@ -20,11 +20,15 @@ #![recursion_limit = "256"] pub mod pallets; +pub use pallets::*; + pub mod weights; -pub use pallets::*; +// pub mod migrations; +// pub use migrations::*; -// pub mod weights; +pub mod bridges_message; +pub use bridges_message::*; pub mod wasm { //! Make the WASM binary available. @@ -133,35 +137,40 @@ frame_support::construct_runtime! { NodeBlock = OpaqueBlock, UncheckedExtrinsic = UncheckedExtrinsic, { - // System support stuff. System: frame_system::{Pallet, Call, Storage, Config, Event} = 0, ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Inherent, Storage, Config, Event, ValidateUnsigned} = 1, Timestamp: pallet_timestamp::{Pallet, Call, Inherent, Storage} = 3, ParachainInfo: parachain_info::{Pallet, Storage, Config} = 4, - // Monetary stuff. Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 5, TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event} = 6, - // Collator support. the order of these 4 are important and shall not change. + // Collator things. the order of these 4 are important and shall not change. Authorship: pallet_authorship::{Pallet, Call, Storage} = 7, CollatorSelection: pallet_collator_selection::{Pallet, Call, Storage, Event, Config} = 8, Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 9, Aura: pallet_aura::{Pallet, Storage, Config} = 10, AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 11, + RemoteGovernance: dp_common_runtime::remote_governance::{Pallet, Call, Storage, Event} = 25, - // XCM helpers. + // XCM things. XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event} = 12, PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 13, CumulusXcm: cumulus_pallet_xcm::{Pallet, Event, Origin} = 14, DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event} = 15, - // Handy utilities. Utility: pallet_utility::{Pallet, Call, Event} = 16, Multisig: pallet_multisig::{Pallet, Call, Storage, Event} = 17, Proxy: pallet_proxy::{Pallet, Call, Storage, Event} = 18, Sudo: pallet_sudo::{Pallet, Call, Storage, Config, Event} = 19, + // Darwinia Parachain <> Darwinia. + BridgeDarwiniaGrandpa: pallet_bridge_grandpa::::{Pallet, Call, Storage} = 20, + BridgeDarwiniaMessages: pallet_bridge_messages::::{Pallet, Call, Storage, Event} = 21, + BridgeDarwiniaDispatch: pallet_bridge_dispatch::::{Pallet, Event} = 22, + + DarwiniaFeeMarket: pallet_fee_market::::{Pallet, Call, Storage, Event} = 23, + FromDarwiniaIssuing: dp_common_runtime::helixbridge::{Pallet, Call, Storage, Event} = 24, MessageRouter: dp_common_runtime::message_router::{Pallet, Call, Storage, Event} = 26, } } diff --git a/runtime/darwinia-parachain/src/pallets/bridge_dispatch.rs b/runtime/darwinia-parachain/src/pallets/bridge_dispatch.rs new file mode 100644 index 00000000..40bae9c9 --- /dev/null +++ b/runtime/darwinia-parachain/src/pallets/bridge_dispatch.rs @@ -0,0 +1,27 @@ +pub use pallet_bridge_dispatch::Instance1 as WithDarwiniaDispatch; + +// --- darwinia-network --- +use crate::*; +use bp_message_dispatch::{Everything, IntoDispatchOrigin as IntoDispatchOriginT}; +use bp_messages::{LaneId, MessageNonce}; +use pallet_bridge_dispatch::Config; + +pub struct IntoDispatchOrigin; +impl IntoDispatchOriginT for IntoDispatchOrigin { + fn into_dispatch_origin(id: &bp_darwinia_parachain::AccountId, _: &Call) -> Origin { + frame_system::RawOrigin::Signed(id.clone()).into() + } +} + +impl Config for Runtime { + type AccountIdConverter = bp_darwinia_parachain::AccountIdConverter; + type BridgeMessageId = (LaneId, MessageNonce); + type Call = Call; + type CallValidator = Everything; + type EncodedCall = bm_darwinia::FromDarwiniaEncodedCall; + type Event = Event; + type IntoDispatchOrigin = IntoDispatchOrigin; + type SourceChainAccountId = bp_darwinia::AccountId; + type TargetChainAccountPublic = bp_darwinia_parachain::AccountPublic; + type TargetChainSignature = bp_darwinia_parachain::Signature; +} diff --git a/runtime/darwinia-parachain/src/pallets/bridge_grandpa.rs b/runtime/darwinia-parachain/src/pallets/bridge_grandpa.rs new file mode 100644 index 00000000..d4058c79 --- /dev/null +++ b/runtime/darwinia-parachain/src/pallets/bridge_grandpa.rs @@ -0,0 +1,21 @@ +pub use pallet_bridge_grandpa::Instance1 as WithDarwiniaGrandpa; + +// --- darwinia-network --- +use crate::*; +use pallet_bridge_grandpa::Config; + +frame_support::parameter_types! { + // This is a pretty unscientific cap. + // + // Note that once this is hit the pallet will essentially throttle incoming requests down to one + // call per block. + pub const MaxRequests: u32 = 50; + pub const DarwiniaHeadersToKeep: u32 = 500; +} + +impl Config for Runtime { + type BridgedChain = bp_darwinia::Darwinia; + type HeadersToKeep = DarwiniaHeadersToKeep; + type MaxRequests = MaxRequests; + type WeightInfo = (); +} diff --git a/runtime/darwinia-parachain/src/pallets/bridge_messages.rs b/runtime/darwinia-parachain/src/pallets/bridge_messages.rs new file mode 100644 index 00000000..25d5080f --- /dev/null +++ b/runtime/darwinia-parachain/src/pallets/bridge_messages.rs @@ -0,0 +1,55 @@ +pub use pallet_bridge_messages::Instance1 as WithDarwiniaMessages; + +// --- darwinia-network --- +use crate::*; +use bp_messages::{source_chain::SenderOrigin, MessageNonce}; +use bp_runtime::{ChainId, DARWINIA_CHAIN_ID}; +use pallet_bridge_messages::Config; +use pallet_fee_market::s2s::{ + FeeMarketMessageAcceptedHandler, FeeMarketMessageConfirmedHandler, FeeMarketPayment, +}; + +impl SenderOrigin for Origin { + fn linked_account(&self) -> Option { + match self.caller { + OriginCaller::system(frame_system::RawOrigin::Signed(ref submitter)) => + Some(submitter.clone()), + _ => None, + } + } +} + +frame_support::parameter_types! { + pub const MaxMessagesToPruneAtOnce: MessageNonce = 8; + pub const BridgedChainId: ChainId = DARWINIA_CHAIN_ID; + pub const MaxUnconfirmedMessagesAtInboundLane: MessageNonce = + bp_darwinia::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX; + pub const MaxUnrewardedRelayerEntriesAtInboundLane: MessageNonce = + bp_darwinia::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX; + pub const GetDeliveryConfirmationTransactionFee: Balance = + bp_darwinia::MAX_SINGLE_MESSAGE_DELIVERY_CONFIRMATION_TX_WEIGHT as _; + pub RootAccountForPayments: Option = None; +} + +impl Config for Runtime { + type AccountIdConverter = bp_darwinia_parachain::AccountIdConverter; + type BridgedChainId = BridgedChainId; + type Event = Event; + type InboundMessageFee = bp_darwinia::Balance; + type InboundPayload = bm_darwinia::FromDarwiniaMessagePayload; + type InboundRelayer = bp_darwinia::AccountId; + type LaneMessageVerifier = bm_darwinia::ToDarwiniaMessageVerifier; + type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce; + type MaxUnconfirmedMessagesAtInboundLane = MaxUnconfirmedMessagesAtInboundLane; + type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane; + type MessageDeliveryAndDispatchPayment = FeeMarketPayment; + type MessageDispatch = bm_darwinia::FromDarwiniaMessageDispatch; + type OnDeliveryConfirmed = FeeMarketMessageConfirmedHandler; + type OnMessageAccepted = FeeMarketMessageAcceptedHandler; + type OutboundMessageFee = bp_darwinia_parachain::Balance; + type OutboundPayload = bm_darwinia::ToDarwiniaMessagePayload; + type Parameter = bm_darwinia::DarwiniaParachainToDarwiniaParameter; + type SourceHeaderChain = bm_darwinia::Darwinia; + type TargetHeaderChain = bm_darwinia::Darwinia; + type WeightInfo = (); +} diff --git a/runtime/darwinia-parachain/src/pallets/fee_market.rs b/runtime/darwinia-parachain/src/pallets/fee_market.rs new file mode 100644 index 00000000..e7bddbe6 --- /dev/null +++ b/runtime/darwinia-parachain/src/pallets/fee_market.rs @@ -0,0 +1,55 @@ +pub use pallet_fee_market::Instance1 as WithDarwiniaFeeMarket; + +// --- core --- +use core::cmp; +// --- substrate --- +use frame_support::{traits::LockIdentifier, PalletId}; +use sp_runtime::{traits::UniqueSaturatedInto, Permill}; +// --- darwinia --- +use crate::*; +use pallet_fee_market::{BalanceOf, Config, Slasher}; + +pub struct FeeMarketSlasher; +impl, I: 'static> Slasher for FeeMarketSlasher { + fn cal_slash_amount( + locked_collateral: BalanceOf, + timeout: T::BlockNumber, + ) -> BalanceOf { + let slash_each_block = 2 * COIN; + let slash_value = UniqueSaturatedInto::::unique_saturated_into(timeout) + .saturating_mul(UniqueSaturatedInto::::unique_saturated_into(slash_each_block)) + .unique_saturated_into(); + + cmp::min(locked_collateral, slash_value) + } +} + +frame_support::parameter_types! { + pub const TreasuryPalletId: PalletId = PalletId(*b"da/trsry"); + pub const FeeMarketLockId: LockIdentifier = *b"da/feeda"; + + pub const MinimumRelayFee: Balance = 15 * COIN; + pub const CollateralPerOrder: Balance = 50 * COIN; + pub const Slot: BlockNumber = 600; + + pub const DutyRelayersRewardRatio: Permill = Permill::from_percent(60); + pub const MessageRelayersRewardRatio: Permill = Permill::from_percent(80); + pub const ConfirmRelayersRewardRatio: Permill = Permill::from_percent(20); + pub const AssignedRelayerSlashRatio: Permill = Permill::from_percent(20); +} + +impl Config for Runtime { + type AssignedRelayerSlashRatio = AssignedRelayerSlashRatio; + type CollateralPerOrder = CollateralPerOrder; + type ConfirmRelayersRewardRatio = ConfirmRelayersRewardRatio; + type Currency = Ring; + type DutyRelayersRewardRatio = DutyRelayersRewardRatio; + type Event = Event; + type LockId = FeeMarketLockId; + type MessageRelayersRewardRatio = MessageRelayersRewardRatio; + type MinimumRelayFee = MinimumRelayFee; + type Slasher = FeeMarketSlasher; + type Slot = Slot; + type TreasuryPalletId = TreasuryPalletId; + type WeightInfo = (); +} diff --git a/runtime/darwinia-parachain/src/pallets/helixbridge.rs b/runtime/darwinia-parachain/src/pallets/helixbridge.rs new file mode 100644 index 00000000..654fa327 --- /dev/null +++ b/runtime/darwinia-parachain/src/pallets/helixbridge.rs @@ -0,0 +1,73 @@ +// --- crates.io --- +use codec::{Decode, Encode}; +use scale_info::TypeInfo; +// --- paritytech -- +use frame_support::{PalletId, RuntimeDebug}; +// --- darwinia-network --- +use crate::*; +use bp_message_dispatch::CallOrigin; +use bp_messages::{LaneId, MessageNonce}; +use bp_runtime::{messages::DispatchFeePayment, ChainId, DARWINIA_CHAIN_ID}; +use bridge_runtime_common::lanes::DARWINIA_DARWINIA_PARACHAIN_LANE; +use bridges_message::darwinia::ToDarwiniaMessagePayload; +use dp_common_runtime::helixbridge::{ + evm::ConcatConverter, CallParams, Config, CreatePayload, LatestMessageNoncer, +}; +use pallet_bridge_messages::Instance1 as WithDarwiniaMessages; + +/// The ethereum pallet index in the darwinia chain runtime. +const DARWINIA_ETHEREUM_PALLET_INDEX: u8 = 48; + +pub struct ToDarwiniaMessageSender; +impl LatestMessageNoncer for ToDarwiniaMessageSender { + fn outbound_latest_generated_nonce(lane_id: LaneId) -> MessageNonce { + pallet_bridge_messages::OutboundLanes::::get(&lane_id) + .latest_generated_nonce + } + + fn inbound_latest_received_nonce(lane_id: LaneId) -> MessageNonce { + pallet_bridge_messages::InboundLanes::::get(&lane_id) + .last_delivered_nonce() + } +} + +#[derive(Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo)] +pub struct ToDarwiniaOutboundPayLoad; +impl CreatePayload for ToDarwiniaOutboundPayLoad { + type Payload = ToDarwiniaMessagePayload; + + fn create( + origin: CallOrigin, + spec_version: u32, + weight: u64, + call_params: CallParams, + dispatch_fee_payment: DispatchFeePayment, + ) -> Result { + let call = Self::encode_call(DARWINIA_ETHEREUM_PALLET_INDEX, call_params)?; + Ok(ToDarwiniaMessagePayload { spec_version, weight, origin, call, dispatch_fee_payment }) + } +} + +frame_support::parameter_types! { + pub const BridgeDarwiniaLaneId: LaneId = DARWINIA_DARWINIA_PARACHAIN_LANE; + pub const ParachainIssuingPalletId: PalletId = PalletId(*b"da/paais"); + pub const DarwiniaChainId: ChainId = DARWINIA_CHAIN_ID; + pub const DarwiniaSmartChainId: u64 = 46; + pub const MaxNonceReserves: u32 = 4096; +} + +impl Config for Runtime { + type BridgedAccountIdConverter = bp_darwinia::AccountIdConverter; + type BridgedChainId = DarwiniaChainId; + type BridgedSmartChainId = DarwiniaSmartChainId; + type Event = Event; + type IntoEthereumAccount = ConcatConverter; + type MaxReserves = MaxNonceReserves; + type MessageLaneId = BridgeDarwiniaLaneId; + type MessageNoncer = ToDarwiniaMessageSender; + type MessagesBridge = BridgeDarwiniaMessages; + type OutboundPayloadCreator = ToDarwiniaOutboundPayLoad; + type PalletId = ParachainIssuingPalletId; + type RingCurrency = Ring; + type WeightInfo = (); +} diff --git a/runtime/darwinia-parachain/src/pallets/mod.rs b/runtime/darwinia-parachain/src/pallets/mod.rs index db01c8aa..d2227407 100644 --- a/runtime/darwinia-parachain/src/pallets/mod.rs +++ b/runtime/darwinia-parachain/src/pallets/mod.rs @@ -31,6 +31,9 @@ pub use aura::*; pub mod aura_ext; pub use aura_ext::*; +pub mod remote_governance; +pub use remote_governance::*; + pub mod xcmp_queue; pub use xcmp_queue::*; @@ -55,5 +58,20 @@ pub use proxy::*; pub mod sudo; pub use sudo::*; +pub mod bridge_dispatch; +pub use bridge_dispatch::*; + +pub mod bridge_grandpa; +pub use bridge_grandpa::*; + +pub mod bridge_messages; +pub use bridge_messages::*; + +pub mod fee_market; +pub use fee_market::*; + +pub mod helixbridge; +pub use helixbridge::*; + pub mod message_router; pub use message_router::*; diff --git a/runtime/darwinia-parachain/src/pallets/remote_governance.rs b/runtime/darwinia-parachain/src/pallets/remote_governance.rs new file mode 100644 index 00000000..5d5eaaaf --- /dev/null +++ b/runtime/darwinia-parachain/src/pallets/remote_governance.rs @@ -0,0 +1,46 @@ +// --- paritytech --- +use frame_support::traits::{EnsureOrigin, Get}; +use frame_system::RawOrigin; +// --- darwinia-network --- +use crate::*; +use dp_common_runtime::remote_governance::Config; + +pub struct EnsureSpecific; +impl, O>> + From>> EnsureOrigin + for EnsureSpecific +{ + type Success = AccountId; + + fn try_origin(o: O) -> Result { + o.into().and_then(|o| match o { + RawOrigin::Signed(who) + if who + == array_bytes::hex_n_into_unchecked( + "0xc778fc2665f3f6ee9623594e5d1fab9dbd557149542c5edacbcc543a82c9d780", + ) => + Ok(who), + r => Err(O::from(r)), + }) + } +} + +pub struct DarwiniaBestFinalized; +impl Get for DarwiniaBestFinalized { + fn get() -> Hash { + >::get() + } +} + +frame_support::parameter_types! { + pub const CheckInterval: BlockNumber = DAYS; +} + +impl Config for Runtime { + type BridgeAccountIdConverter = bp_darwinia::AccountIdConverter; + type BridgeFinalized = DarwiniaBestFinalized; + type BridgedChainId = DarwiniaChainId; + type Call = Call; + type CheckInterval = CheckInterval; + type EmergencySafeguardOrigin = EnsureSpecific; + type Event = Event; +} diff --git a/runtime/pangolin-parachain/src/lib.rs b/runtime/pangolin-parachain/src/lib.rs index a92f746b..5971f247 100644 --- a/runtime/pangolin-parachain/src/lib.rs +++ b/runtime/pangolin-parachain/src/lib.rs @@ -152,37 +152,34 @@ frame_support::construct_runtime! { NodeBlock = OpaqueBlock, UncheckedExtrinsic = UncheckedExtrinsic, { - // System support stuff. System: frame_system::{Pallet, Call, Storage, Config, Event} = 0, ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Inherent, Storage, Config, Event, ValidateUnsigned} = 1, Timestamp: pallet_timestamp::{Pallet, Call, Inherent, Storage} = 3, ParachainInfo: parachain_info::{Pallet, Storage, Config} = 4, - // Monetary stuff. Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 5, TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event} = 6, - // Collator support. the order of these 4 are important and shall not change. + // Collator things. the order of these 4 are important and shall not change. Authorship: pallet_authorship::{Pallet, Call, Storage} = 7, CollatorSelection: pallet_collator_selection::{Pallet, Call, Storage, Event, Config} = 8, Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 9, Aura: pallet_aura::{Pallet, Storage, Config} = 10, AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 11, + RemoteGovernance: dp_common_runtime::remote_governance::{Pallet, Call, Storage, Event} = 25, - // XCM helpers. + // XCM things. XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event} = 12, PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 13, CumulusXcm: cumulus_pallet_xcm::{Pallet, Event, Origin} = 14, DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event} = 15, - // Handy utilities. Utility: pallet_utility::{Pallet, Call, Event} = 16, Multisig: pallet_multisig::{Pallet, Call, Storage, Event} = 17, Proxy: pallet_proxy::{Pallet, Call, Storage, Event} = 18, Sudo: pallet_sudo::{Pallet, Call, Storage, Config, Event} = 19, - RemoteGovernance: dp_common_runtime::remote_governance::{Pallet, Call, Storage, Event} = 25, - // S2S bridges. + // Bridge things. BridgePangolinGrandpa: pallet_bridge_grandpa::::{Pallet, Call, Storage} = 20, BridgePangolinMessages: pallet_bridge_messages::::{Pallet, Call, Storage, Event} = 21, BridgePangolinDispatch: pallet_bridge_dispatch::::{Pallet, Event} = 22, diff --git a/runtime/pangolin-parachain/src/pallets/mod.rs b/runtime/pangolin-parachain/src/pallets/mod.rs index 69d5aeba..20d10f35 100644 --- a/runtime/pangolin-parachain/src/pallets/mod.rs +++ b/runtime/pangolin-parachain/src/pallets/mod.rs @@ -31,6 +31,9 @@ pub use aura::*; pub mod aura_ext; pub use aura_ext::*; +pub mod remote_governance; +pub use remote_governance::*; + pub mod xcmp_queue; pub use xcmp_queue::*; @@ -55,9 +58,6 @@ pub use proxy::*; pub mod sudo; pub use sudo::*; -pub mod remote_governance; -pub use remote_governance::*; - pub mod bridge_grandpa; pub use bridge_grandpa::*; diff --git a/src/chain_spec/mod.rs b/src/chain_spec/mod.rs index 5e648ae8..13b60f41 100644 --- a/src/chain_spec/mod.rs +++ b/src/chain_spec/mod.rs @@ -32,7 +32,7 @@ pub use pangolin_parachain::{ // --- crates.io --- use serde::{Deserialize, Serialize}; // --- paritytech --- -use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup}; +use sc_chain_spec::ChainSpecExtension; use sp_consensus_aura::sr25519::AuthorityId as AuraId; use sp_core::{Pair, Public}; use sp_runtime::traits::IdentifyAccount; @@ -43,7 +43,7 @@ use dc_primitives::{AccountId, AccountPublic}; pub const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; /// The extensions for the [`ChainSpec`]. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecExtension)] #[serde(deny_unknown_fields)] pub struct Extensions { /// The relay chain of the Parachain.