From ecc6c4ebc9f7eecfd97af12e2af0dccaf217cc9e Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Thu, 20 Jul 2023 14:23:36 +0300 Subject: [PATCH] More backports from Cumulus subtree to polkadot-staging (#2283) * more backports from Cumulus subtree * spelling * fmt * trigger CI * Revert "trigger CI" This reverts commit b009d732aa26d006a7f2b48878ee864c338c49d5. * Revert "Revert "trigger CI"" This reverts commit 715606a75948124962b14dbb260cf3aed01bc665. * Revert "Revert "Revert "trigger CI""" This reverts commit dc0d2233da86fd12a77216008e59bd38fcbb2fac. --- bin/millau/node/src/chain_spec.rs | 4 ++-- bin/millau/runtime/src/lib.rs | 7 ++++--- modules/grandpa/Cargo.toml | 4 ++-- primitives/chain-westend/src/lib.rs | 20 +++++++++---------- primitives/header-chain/Cargo.toml | 6 +++--- primitives/parachains/Cargo.toml | 2 +- primitives/runtime/Cargo.toml | 2 +- primitives/runtime/src/lib.rs | 4 ++-- .../westend_parachains_to_millau.rs | 12 +++++------ relays/bin-substrate/src/chains/westend.rs | 4 ++-- .../bin-substrate/src/cli/relay_parachains.rs | 6 +++--- relays/client-westend/src/lib.rs | 14 ++++++------- 12 files changed, 43 insertions(+), 42 deletions(-) diff --git a/bin/millau/node/src/chain_spec.rs b/bin/millau/node/src/chain_spec.rs index 425f5685ae26..f985d4d9783e 100644 --- a/bin/millau/node/src/chain_spec.rs +++ b/bin/millau/node/src/chain_spec.rs @@ -164,8 +164,8 @@ fn endowed_accounts() -> Vec { get_account_id_from_seed::(WESTEND_GRANDPA_PALLET_OWNER), get_account_id_from_seed::("Westend.HeadersRelay1"), get_account_id_from_seed::("Westend.HeadersRelay2"), - get_account_id_from_seed::("Westend.WestmintHeaders1"), - get_account_id_from_seed::("Westend.WestmintHeaders2"), + get_account_id_from_seed::("Westend.AssetHubWestendHeaders1"), + get_account_id_from_seed::("Westend.AssetHubWestendHeaders2"), // Accounts, used by Rialto<>Millau bridge get_account_id_from_seed::(RIALTO_MESSAGES_PALLET_OWNER), get_account_id_from_seed::("Rialto.HeadersAndMessagesRelay"), diff --git a/bin/millau/runtime/src/lib.rs b/bin/millau/runtime/src/lib.rs index daaa9815a8af..dfd6fc322e50 100644 --- a/bin/millau/runtime/src/lib.rs +++ b/bin/millau/runtime/src/lib.rs @@ -531,7 +531,8 @@ impl pallet_bridge_parachains::Config for Runtime type WeightInfo = pallet_bridge_parachains::weights::BridgeWeight; type BridgesGrandpaPalletInstance = WestendGrandpaInstance; type ParasPalletName = WestendParasPalletName; - type ParaStoredHeaderDataBuilder = SingleParaStoredHeaderDataBuilder; + type ParaStoredHeaderDataBuilder = + SingleParaStoredHeaderDataBuilder; type HeadsToKeep = ConstU32<1024>; type MaxParaHeadDataSize = MaxWestendParaHeadDataSize; } @@ -889,12 +890,12 @@ impl_runtime_apis! { } } - impl bp_westend::WestmintFinalityApi for Runtime { + impl bp_westend::AssetHubWestendFinalityApi for Runtime { fn best_finalized() -> Option> { pallet_bridge_parachains::Pallet::< Runtime, WithWestendParachainsInstance, - >::best_parachain_head_id::().unwrap_or(None) + >::best_parachain_head_id::().unwrap_or(None) } } diff --git a/modules/grandpa/Cargo.toml b/modules/grandpa/Cargo.toml index c9a79eb8682d..d04c60729790 100644 --- a/modules/grandpa/Cargo.toml +++ b/modules/grandpa/Cargo.toml @@ -22,8 +22,8 @@ bp-header-chain = { path = "../../primitives/header-chain", default-features = f frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -sp-consensus-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sp-consensus-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = ["serde"] } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = ["serde"] } sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } diff --git a/primitives/chain-westend/src/lib.rs b/primitives/chain-westend/src/lib.rs index 071f3a15a42c..cdda46ba7b2b 100644 --- a/primitives/chain-westend/src/lib.rs +++ b/primitives/chain-westend/src/lib.rs @@ -56,13 +56,13 @@ impl ChainWithGrandpa for Westend { const AVERAGE_HEADER_SIZE_IN_JUSTIFICATION: u32 = AVERAGE_HEADER_SIZE_IN_JUSTIFICATION; } -/// Westmint parachain definition +/// `AssetHubWestend` parachain definition #[derive(Debug, Clone, Copy)] -pub struct Westmint; +pub struct AssetHubWestend; -// Westmint seems to use the same configuration as all Polkadot-like chains, so we'll use Westend -// primitives here. -impl Chain for Westmint { +// AssetHubWestend seems to use the same configuration as all Polkadot-like chains, so we'll use +// Westend primitives here. +impl Chain for AssetHubWestend { type BlockNumber = BlockNumber; type Hash = Hash; type Hasher = Hasher; @@ -82,8 +82,8 @@ impl Chain for Westmint { } } -impl Parachain for Westmint { - const PARACHAIN_ID: u32 = WESTMINT_PARACHAIN_ID; +impl Parachain for AssetHubWestend { + const PARACHAIN_ID: u32 = ASSET_HUB_WESTEND_PARACHAIN_ID; } /// Name of the parachains pallet at the Westend runtime. @@ -100,9 +100,9 @@ pub const WITH_WESTEND_BRIDGE_PARAS_PALLET_NAME: &str = "BridgeWestendParachains /// reserve. pub const MAX_NESTED_PARACHAIN_HEAD_DATA_SIZE: u32 = 128; -/// Identifier of Westmint parachain at the Westend relay chain. -pub const WESTMINT_PARACHAIN_ID: u32 = 1000; +/// Identifier of `AssetHubWestend` parachain at the Westend relay chain. +pub const ASSET_HUB_WESTEND_PARACHAIN_ID: u32 = 1000; decl_bridge_finality_runtime_apis!(westend); -decl_bridge_finality_runtime_apis!(westmint); +decl_bridge_finality_runtime_apis!(AssetHubWestend); diff --git a/primitives/header-chain/Cargo.toml b/primitives/header-chain/Cargo.toml index bb372085292c..962d262d571b 100644 --- a/primitives/header-chain/Cargo.toml +++ b/primitives/header-chain/Cargo.toml @@ -19,9 +19,9 @@ bp-runtime = { path = "../runtime", default-features = false } # Substrate Dependencies frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -sp-consensus-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = ["serde"] } +sp-consensus-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = ["serde"] } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = ["serde"] } sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } [dev-dependencies] diff --git a/primitives/parachains/Cargo.toml b/primitives/parachains/Cargo.toml index 90cff6be3911..6cd138c62249 100644 --- a/primitives/parachains/Cargo.toml +++ b/primitives/parachains/Cargo.toml @@ -3,7 +3,7 @@ name = "bp-parachains" description = "Primitives of parachains module." version = "0.1.0" authors = ["Parity Technologies "] -edition = "2018" +edition = "2021" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] diff --git a/primitives/runtime/Cargo.toml b/primitives/runtime/Cargo.toml index 4a4bc932bce0..dea3c979b862 100644 --- a/primitives/runtime/Cargo.toml +++ b/primitives/runtime/Cargo.toml @@ -20,7 +20,7 @@ frame-support = { git = "https://github.com/paritytech/substrate", branch = "mas frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = ["serde"] } sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } diff --git a/primitives/runtime/src/lib.rs b/primitives/runtime/src/lib.rs index 0bfbd1c2ee91..150e015cb4f1 100644 --- a/primitives/runtime/src/lib.rs +++ b/primitives/runtime/src/lib.rs @@ -77,8 +77,8 @@ pub const KUSAMA_CHAIN_ID: ChainId = *b"ksma"; /// Westend chain id. pub const WESTEND_CHAIN_ID: ChainId = *b"wend"; -/// Westend chain id. -pub const WESTMINT_CHAIN_ID: ChainId = *b"wmnt"; +/// `AssetHubWestmint` chain id. +pub const ASSET_HUB_WESTEND_CHAIN_ID: ChainId = *b"ahwe"; /// Rococo chain id. pub const ROCOCO_CHAIN_ID: ChainId = *b"roco"; diff --git a/relays/bin-substrate/src/bridges/westend_millau/westend_parachains_to_millau.rs b/relays/bin-substrate/src/bridges/westend_millau/westend_parachains_to_millau.rs index 0556ecab368e..78164eb17e44 100644 --- a/relays/bin-substrate/src/bridges/westend_millau/westend_parachains_to_millau.rs +++ b/relays/bin-substrate/src/bridges/westend_millau/westend_parachains_to_millau.rs @@ -18,7 +18,7 @@ use crate::cli::bridge::{CliBridgeBase, ParachainToRelayHeadersCliBridge}; use relay_millau_client::Millau; -use relay_westend_client::{Westend, Westmint}; +use relay_westend_client::{AssetHubWestend, Westend}; use substrate_relay_helper::parachains::{ DirectSubmitParachainHeadsCallBuilder, SubstrateParachainsPipeline, }; @@ -28,7 +28,7 @@ use substrate_relay_helper::parachains::{ pub struct WestendParachainsToMillau; impl SubstrateParachainsPipeline for WestendParachainsToMillau { - type SourceParachain = Westmint; + type SourceParachain = AssetHubWestend; type SourceRelayChain = Westend; type TargetChain = Millau; @@ -44,16 +44,16 @@ pub type WestendParachainsToMillauSubmitParachainHeadsCallBuilder = >; //// `WestendParachain` to `Millau` bridge definition. -pub struct WestmintToMillauCliBridge {} +pub struct AssetHubWestendToMillauCliBridge {} -impl ParachainToRelayHeadersCliBridge for WestmintToMillauCliBridge { +impl ParachainToRelayHeadersCliBridge for AssetHubWestendToMillauCliBridge { type SourceRelay = Westend; type ParachainFinality = WestendParachainsToMillau; type RelayFinality = crate::bridges::westend_millau::westend_headers_to_millau::WestendFinalityToMillau; } -impl CliBridgeBase for WestmintToMillauCliBridge { - type Source = Westmint; +impl CliBridgeBase for AssetHubWestendToMillauCliBridge { + type Source = AssetHubWestend; type Target = Millau; } diff --git a/relays/bin-substrate/src/chains/westend.rs b/relays/bin-substrate/src/chains/westend.rs index 9cf639e98748..af404878ceb0 100644 --- a/relays/bin-substrate/src/chains/westend.rs +++ b/relays/bin-substrate/src/chains/westend.rs @@ -18,12 +18,12 @@ use crate::cli::CliChain; use relay_substrate_client::SimpleRuntimeVersion; -use relay_westend_client::{Westend, Westmint}; +use relay_westend_client::{AssetHubWestend, Westend}; impl CliChain for Westend { const RUNTIME_VERSION: Option = None; } -impl CliChain for Westmint { +impl CliChain for AssetHubWestend { const RUNTIME_VERSION: Option = None; } diff --git a/relays/bin-substrate/src/cli/relay_parachains.rs b/relays/bin-substrate/src/cli/relay_parachains.rs index 8c2aa1cc8c1f..67daf01c8f4b 100644 --- a/relays/bin-substrate/src/cli/relay_parachains.rs +++ b/relays/bin-substrate/src/cli/relay_parachains.rs @@ -24,7 +24,7 @@ use crate::bridges::{ rococo_parachains_to_bridge_hub_wococo::BridgeHubRococoToBridgeHubWococoCliBridge, wococo_parachains_to_bridge_hub_rococo::BridgeHubWococoToBridgeHubRococoCliBridge, }, - westend_millau::westend_parachains_to_millau::WestmintToMillauCliBridge, + westend_millau::westend_parachains_to_millau::AssetHubWestendToMillauCliBridge, }; use async_std::sync::Mutex; use async_trait::async_trait; @@ -115,7 +115,7 @@ where } impl ParachainsRelayer for RialtoParachainToMillauCliBridge {} -impl ParachainsRelayer for WestmintToMillauCliBridge {} +impl ParachainsRelayer for AssetHubWestendToMillauCliBridge {} impl ParachainsRelayer for BridgeHubRococoToBridgeHubWococoCliBridge {} impl ParachainsRelayer for BridgeHubWococoToBridgeHubRococoCliBridge {} impl ParachainsRelayer for BridgeHubKusamaToBridgeHubPolkadotCliBridge {} @@ -128,7 +128,7 @@ impl RelayParachains { RelayParachainsBridge::RialtoToMillau => RialtoParachainToMillauCliBridge::relay_parachains(self), RelayParachainsBridge::WestendToMillau => - WestmintToMillauCliBridge::relay_parachains(self), + AssetHubWestendToMillauCliBridge::relay_parachains(self), RelayParachainsBridge::RococoToBridgeHubWococo => BridgeHubRococoToBridgeHubWococoCliBridge::relay_parachains(self), RelayParachainsBridge::WococoToBridgeHubRococo => diff --git a/relays/client-westend/src/lib.rs b/relays/client-westend/src/lib.rs index 6013bfad128a..1251276fcfdb 100644 --- a/relays/client-westend/src/lib.rs +++ b/relays/client-westend/src/lib.rs @@ -58,21 +58,21 @@ impl ChainWithBalances for Westend { } } -/// Westmint parachain definition +/// `AssetHubWestend` parachain definition #[derive(Debug, Clone, Copy)] -pub struct Westmint; +pub struct AssetHubWestend; -impl UnderlyingChainProvider for Westmint { - type Chain = bp_westend::Westmint; +impl UnderlyingChainProvider for AssetHubWestend { + type Chain = bp_westend::AssetHubWestend; } // Westmint seems to use the same configuration as all Polkadot-like chains, so we'll use Westend // primitives here. -impl Chain for Westmint { - const ID: ChainId = bp_runtime::WESTMINT_CHAIN_ID; +impl Chain for AssetHubWestend { + const ID: ChainId = bp_runtime::ASSET_HUB_WESTEND_CHAIN_ID; const NAME: &'static str = "Westmint"; const BEST_FINALIZED_HEADER_ID_METHOD: &'static str = - bp_westend::BEST_FINALIZED_WESTMINT_HEADER_METHOD; + bp_westend::BEST_FINALIZED_ASSETHUBWESTEND_HEADER_METHOD; const AVERAGE_BLOCK_INTERVAL: Duration = Duration::from_secs(6); type SignedBlock = bp_westend::SignedBlock;