From d20a1fc8462902aa682fc88f35fd47e27926ce64 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Fri, 21 Oct 2022 10:03:02 +0800 Subject: [PATCH 1/5] Update toolchain --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 95cc0bdb..fe0f225b 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2022-05-12" +channel = "nightly-2022-07-24" components = ["cargo", "clippy", "rustc", "rustfmt", "rust-src"] profile = "minimal" targets = ["wasm32-unknown-unknown"] From f1ad68a841283d1e8839fffc682ea52e395cea15 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Fri, 21 Oct 2022 10:17:39 +0800 Subject: [PATCH 2/5] Add remote governance --- Cargo.lock | 54 ++++++++++++------- runtime/crab-parachain/src/lib.rs | 9 ++-- runtime/crab-parachain/src/pallets/mod.rs | 6 +-- runtime/darwinia-parachain/Cargo.toml | 9 ++-- runtime/darwinia-parachain/src/lib.rs | 8 ++- runtime/darwinia-parachain/src/pallets/mod.rs | 3 ++ .../src/pallets/remote_governance.rs | 47 ++++++++++++++++ runtime/pangolin-parachain/src/lib.rs | 11 ++-- runtime/pangolin-parachain/src/pallets/mod.rs | 6 +-- 9 files changed, 106 insertions(+), 47 deletions(-) create mode 100644 runtime/darwinia-parachain/src/pallets/remote_governance.rs diff --git a/Cargo.lock b/Cargo.lock index 49c51546..69847423 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -689,7 +689,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#584bc52933ce28d4a16a442fd66227410594c178" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" dependencies = [ "bp-darwinia-core", "bp-messages", @@ -704,7 +704,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#584bc52933ce28d4a16a442fd66227410594c178" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" +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#fda68630945112553da5fafae8c21609bc86f36c" dependencies = [ "bp-darwinia-core", "bp-messages", @@ -719,7 +734,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#584bc52933ce28d4a16a442fd66227410594c178" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" dependencies = [ "bp-messages", "bp-runtime", @@ -735,7 +750,7 @@ dependencies = [ [[package]] name = "bp-header-chain" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#584bc52933ce28d4a16a442fd66227410594c178" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" dependencies = [ "bp-runtime", "finality-grandpa", @@ -752,7 +767,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#584bc52933ce28d4a16a442fd66227410594c178" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" dependencies = [ "bp-runtime", "frame-support", @@ -765,7 +780,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#584bc52933ce28d4a16a442fd66227410594c178" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" dependencies = [ "bitvec 1.0.1", "bp-runtime", @@ -782,7 +797,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#584bc52933ce28d4a16a442fd66227410594c178" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" dependencies = [ "bp-darwinia-core", "bp-messages", @@ -797,7 +812,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#584bc52933ce28d4a16a442fd66227410594c178" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" dependencies = [ "bp-darwinia-core", "bp-messages", @@ -812,7 +827,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#584bc52933ce28d4a16a442fd66227410594c178" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" dependencies = [ "bp-polkadot-core", "bp-runtime", @@ -826,7 +841,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#584bc52933ce28d4a16a442fd66227410594c178" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" dependencies = [ "bp-messages", "bp-runtime", @@ -846,7 +861,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#584bc52933ce28d4a16a442fd66227410594c178" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" dependencies = [ "frame-support", "hash-db", @@ -864,7 +879,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#584bc52933ce28d4a16a442fd66227410594c178" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" dependencies = [ "bp-header-chain", "ed25519-dalek", @@ -879,7 +894,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#584bc52933ce28d4a16a442fd66227410594c178" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" dependencies = [ "bp-message-dispatch", "bp-messages", @@ -2208,6 +2223,7 @@ name = "darwinia-parachain-runtime" version = "5.3.3" dependencies = [ "array-bytes", + "bp-darwinia", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", @@ -5643,7 +5659,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#584bc52933ce28d4a16a442fd66227410594c178" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" dependencies = [ "bp-message-dispatch", "bp-runtime", @@ -5660,7 +5676,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#584bc52933ce28d4a16a442fd66227410594c178" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" dependencies = [ "bp-header-chain", "bp-runtime", @@ -5683,7 +5699,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#584bc52933ce28d4a16a442fd66227410594c178" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" dependencies = [ "bitvec 1.0.1", "bp-message-dispatch", @@ -5705,7 +5721,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#584bc52933ce28d4a16a442fd66227410594c178" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" dependencies = [ "bp-parachains", "bp-polkadot-core", @@ -5852,7 +5868,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#584bc52933ce28d4a16a442fd66227410594c178" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.27#fda68630945112553da5fafae8c21609bc86f36c" dependencies = [ "bp-messages", "bp-runtime", @@ -11664,7 +11680,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/crab-parachain/src/lib.rs b/runtime/crab-parachain/src/lib.rs index a4c85389..d0221c39 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/mod.rs b/runtime/crab-parachain/src/pallets/mod.rs index a175975c..6384c9d1 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 a3d45d28..4aa42780 100644 --- a/runtime/darwinia-parachain/Cargo.toml +++ b/runtime/darwinia-parachain/Cargo.toml @@ -12,7 +12,7 @@ version = "5.3.3" [dependencies] # crates.io -array-bytes = { version = "3.0", optional = true } +array-bytes = { version = "3.0" } 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,8 @@ 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" } # 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 +89,9 @@ 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", "pallet-xcm/std", "polkadot-parachain/std", "polkadot-runtime-common/std", @@ -124,8 +127,6 @@ std = [ ] runtime-benchmarks = [ - # crates.io - "array-bytes", # cumulus "cumulus-pallet-xcmp-queue/runtime-benchmarks", # polkadot diff --git a/runtime/darwinia-parachain/src/lib.rs b/runtime/darwinia-parachain/src/lib.rs index 0cc1eb82..b9cbd09d 100644 --- a/runtime/darwinia-parachain/src/lib.rs +++ b/runtime/darwinia-parachain/src/lib.rs @@ -133,30 +133,28 @@ 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} = 20, - // 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, diff --git a/runtime/darwinia-parachain/src/pallets/mod.rs b/runtime/darwinia-parachain/src/pallets/mod.rs index 31108982..1f98b361 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::*; 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..a7120420 --- /dev/null +++ b/runtime/darwinia-parachain/src/pallets/remote_governance.rs @@ -0,0 +1,47 @@ +// --- 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() + todo!() + } +} + +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 0ec51038..57efe682 100644 --- a/runtime/pangolin-parachain/src/lib.rs +++ b/runtime/pangolin-parachain/src/lib.rs @@ -151,37 +151,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 bd358b83..83e7a003 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::*; From d188a326973b35ca883abf73ab459e27404f1b05 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 2 Nov 2022 11:58:22 +0800 Subject: [PATCH 3/5] Darwinia <> Darwinia Parachain --- Cargo.lock | 64 +++++--- runtime/darwinia-parachain/Cargo.toml | 20 ++- .../src/bridges_message/darwinia.rs | 155 ++++++++++++++++++ .../src/bridges_message/mod.rs | 2 + runtime/darwinia-parachain/src/lib.rs | 18 +- .../src/pallets/bridge_dispatch.rs | 27 +++ .../src/pallets/bridge_grandpa.rs | 21 +++ .../src/pallets/bridge_messages.rs | 56 +++++++ .../src/pallets/fee_market.rs | 55 +++++++ .../src/pallets/helixbridge.rs | 62 +++++++ runtime/darwinia-parachain/src/pallets/mod.rs | 15 ++ .../src/pallets/remote_governance.rs | 3 +- 12 files changed, 472 insertions(+), 26 deletions(-) create mode 100644 runtime/darwinia-parachain/src/bridges_message/darwinia.rs create mode 100644 runtime/darwinia-parachain/src/bridges_message/mod.rs create mode 100644 runtime/darwinia-parachain/src/pallets/bridge_dispatch.rs create mode 100644 runtime/darwinia-parachain/src/pallets/bridge_grandpa.rs create mode 100644 runtime/darwinia-parachain/src/pallets/bridge_messages.rs create mode 100644 runtime/darwinia-parachain/src/pallets/fee_market.rs create mode 100644 runtime/darwinia-parachain/src/pallets/helixbridge.rs diff --git a/Cargo.lock b/Cargo.lock index 69847423..e2417bcb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -689,7 +689,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", @@ -704,7 +704,7 @@ 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", @@ -719,7 +719,7 @@ dependencies = [ [[package]] name = "bp-darwinia" 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", @@ -734,7 +734,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", @@ -747,10 +747,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", @@ -767,7 +782,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", @@ -780,7 +795,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 1.0.1", "bp-runtime", @@ -797,7 +812,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", @@ -812,7 +827,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", @@ -827,7 +842,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", @@ -841,7 +856,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", @@ -861,7 +876,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", @@ -879,7 +894,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", @@ -894,7 +909,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", @@ -2224,6 +2239,11 @@ version = "5.3.3" 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", @@ -2243,7 +2263,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", @@ -5659,7 +5683,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", @@ -5676,7 +5700,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", @@ -5699,7 +5723,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 1.0.1", "bp-message-dispatch", @@ -5721,7 +5745,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", @@ -5868,7 +5892,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", @@ -11680,7 +11704,7 @@ version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "digest 0.10.5", "rand 0.8.5", "static_assertions", diff --git a/runtime/darwinia-parachain/Cargo.toml b/runtime/darwinia-parachain/Cargo.toml index 4aa42780..7e410d90 100644 --- a/runtime/darwinia-parachain/Cargo.toml +++ b/runtime/darwinia-parachain/Cargo.toml @@ -31,7 +31,16 @@ parachain-info = { default-features = false, git = "https://git 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 = { 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" } @@ -92,6 +101,15 @@ 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", 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..fe2d765a --- /dev/null +++ b/runtime/darwinia-parachain/src/bridges_message/darwinia.rs @@ -0,0 +1,155 @@ +// --- 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::*, *}, +}; +use dp_common_runtime::FromThisChainMessageVerifier; + +/// 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 b9cbd09d..e3e11e26 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. @@ -147,7 +151,7 @@ frame_support::construct_runtime! { 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} = 20, + RemoteGovernance: dp_common_runtime::remote_governance::{Pallet, Call, Storage, Event} = 25, // XCM things. XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event} = 12, @@ -159,6 +163,14 @@ frame_support::construct_runtime! { 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, } } 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..bbb662b0 --- /dev/null +++ b/runtime/darwinia-parachain/src/pallets/bridge_messages.rs @@ -0,0 +1,56 @@ +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 = + (FromDarwiniaIssuing, 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..a7a62768 --- /dev/null +++ b/runtime/darwinia-parachain/src/pallets/helixbridge.rs @@ -0,0 +1,62 @@ +// --- 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::{CallParams, Config, CreatePayload, LatestMessageNoncer}; +use pallet_bridge_messages::{outbound_lane, Instance1 as WithDarwiniaMessages}; + +/// The s2s backing pallet index in the darwinia chain runtime. +const DARWINIA_S2S_BACKING_PALLET_INDEX: u8 = 57; + +pub struct ToDarwiniaMessageSender; +impl LatestMessageNoncer for ToDarwiniaMessageSender { + fn outbound_latest_generated_nonce(lane_id: LaneId) -> MessageNonce { + outbound_lane::(lane_id).data().latest_generated_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_S2S_BACKING_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 DecimalMultiplier: u128 = 1_000_000_000u128; + pub const ParachainIssuingPalletId: PalletId = PalletId(*b"da/paais"); + pub const DarwiniaChainId: ChainId = DARWINIA_CHAIN_ID; +} + +impl Config for Runtime { + type BridgedAccountIdConverter = bp_darwinia::AccountIdConverter; + type BridgedChainId = DarwiniaChainId; + type DecimalMultiplier = DecimalMultiplier; + type Event = Event; + 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 1f98b361..6384c9d1 100644 --- a/runtime/darwinia-parachain/src/pallets/mod.rs +++ b/runtime/darwinia-parachain/src/pallets/mod.rs @@ -57,3 +57,18 @@ 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::*; diff --git a/runtime/darwinia-parachain/src/pallets/remote_governance.rs b/runtime/darwinia-parachain/src/pallets/remote_governance.rs index a7120420..5d5eaaaf 100644 --- a/runtime/darwinia-parachain/src/pallets/remote_governance.rs +++ b/runtime/darwinia-parachain/src/pallets/remote_governance.rs @@ -27,8 +27,7 @@ impl, O>> + From>> Ensu pub struct DarwiniaBestFinalized; impl Get for DarwiniaBestFinalized { fn get() -> Hash { - // >::get() - todo!() + >::get() } } From d6a1f340e069650e400e655af02298b7631b79e6 Mon Sep 17 00:00:00 2001 From: xiaoch05 Date: Wed, 2 Nov 2022 15:17:15 +0800 Subject: [PATCH 4/5] helixbridge config for darwinia --- .../crab-parachain/src/pallets/helixbridge.rs | 2 +- .../src/pallets/bridge_messages.rs | 3 +- .../src/pallets/helixbridge.rs | 31 +++++++++++++------ 3 files changed, 23 insertions(+), 13 deletions(-) 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/darwinia-parachain/src/pallets/bridge_messages.rs b/runtime/darwinia-parachain/src/pallets/bridge_messages.rs index bbb662b0..25d5080f 100644 --- a/runtime/darwinia-parachain/src/pallets/bridge_messages.rs +++ b/runtime/darwinia-parachain/src/pallets/bridge_messages.rs @@ -44,8 +44,7 @@ impl Config for Runtime { type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane; type MessageDeliveryAndDispatchPayment = FeeMarketPayment; type MessageDispatch = bm_darwinia::FromDarwiniaMessageDispatch; - type OnDeliveryConfirmed = - (FromDarwiniaIssuing, FeeMarketMessageConfirmedHandler); + type OnDeliveryConfirmed = FeeMarketMessageConfirmedHandler; type OnMessageAccepted = FeeMarketMessageAcceptedHandler; type OutboundMessageFee = bp_darwinia_parachain::Balance; type OutboundPayload = bm_darwinia::ToDarwiniaMessagePayload; diff --git a/runtime/darwinia-parachain/src/pallets/helixbridge.rs b/runtime/darwinia-parachain/src/pallets/helixbridge.rs index a7a62768..654fa327 100644 --- a/runtime/darwinia-parachain/src/pallets/helixbridge.rs +++ b/runtime/darwinia-parachain/src/pallets/helixbridge.rs @@ -10,48 +10,59 @@ 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::{CallParams, Config, CreatePayload, LatestMessageNoncer}; -use pallet_bridge_messages::{outbound_lane, Instance1 as WithDarwiniaMessages}; +use dp_common_runtime::helixbridge::{ + evm::ConcatConverter, CallParams, Config, CreatePayload, LatestMessageNoncer, +}; +use pallet_bridge_messages::Instance1 as WithDarwiniaMessages; -/// The s2s backing pallet index in the darwinia chain runtime. -const DARWINIA_S2S_BACKING_PALLET_INDEX: u8 = 57; +/// 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 { - outbound_lane::(lane_id).data().latest_generated_nonce + 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 { +impl CreatePayload for ToDarwiniaOutboundPayLoad { type Payload = ToDarwiniaMessagePayload; fn create( origin: CallOrigin, spec_version: u32, weight: u64, - call_params: CallParams, + call_params: CallParams, dispatch_fee_payment: DispatchFeePayment, ) -> Result { - let call = Self::encode_call(DARWINIA_S2S_BACKING_PALLET_INDEX, call_params)?; + 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 DecimalMultiplier: u128 = 1_000_000_000u128; 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 DecimalMultiplier = DecimalMultiplier; + type BridgedSmartChainId = DarwiniaSmartChainId; type Event = Event; + type IntoEthereumAccount = ConcatConverter; + type MaxReserves = MaxNonceReserves; type MessageLaneId = BridgeDarwiniaLaneId; type MessageNoncer = ToDarwiniaMessageSender; type MessagesBridge = BridgeDarwiniaMessages; From 7e662729a51e827d7880b03f68552811b14ee83e Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 2 Nov 2022 17:40:05 +0800 Subject: [PATCH 5/5] Fix compile & eliminate warnings --- runtime/common/src/helixbridge/mod.rs | 5 +++-- runtime/common/src/message_router/mod.rs | 9 +++++---- runtime/darwinia-parachain/Cargo.toml | 2 +- .../darwinia-parachain/src/bridges_message/darwinia.rs | 1 - src/chain_spec/mod.rs | 4 ++-- 5 files changed, 11 insertions(+), 10 deletions(-) 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/darwinia-parachain/Cargo.toml b/runtime/darwinia-parachain/Cargo.toml index a1c08cdc..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" } diff --git a/runtime/darwinia-parachain/src/bridges_message/darwinia.rs b/runtime/darwinia-parachain/src/bridges_message/darwinia.rs index fe2d765a..6cae4e5e 100644 --- a/runtime/darwinia-parachain/src/bridges_message/darwinia.rs +++ b/runtime/darwinia-parachain/src/bridges_message/darwinia.rs @@ -13,7 +13,6 @@ use bridge_runtime_common::{ lanes::*, messages::{source::*, target::*, *}, }; -use dp_common_runtime::FromThisChainMessageVerifier; /// Message delivery proof for DarwiniaParachain -> Darwinia messages. pub type ToDarwiniaMessagesDeliveryProof = FromBridgedChainMessagesDeliveryProof; 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.