From eb90140d466a2c0204daba30c4dd53af6b5e4893 Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Thu, 27 Jan 2022 15:42:26 +0300 Subject: [PATCH] Bump Substrate/Polkadot/Cumulus refs (#1295) Substrate: 31d90c202d6df9ce3837ee55587b604619a912ba Polkadot: 60df3c55c711c2872872d6220f98b2611340e051 Cumulus: a9630551c2cd877952ab769c862af4c81b0ccd3c --- bridges/bin/millau/node/Cargo.toml | 2 +- bridges/bin/millau/node/src/chain_spec.rs | 4 +- bridges/bin/millau/node/src/cli.rs | 7 +- bridges/bin/millau/node/src/service.rs | 45 +++++-- bridges/bin/millau/runtime/src/lib.rs | 8 +- bridges/bin/rialto-parachain/node/Cargo.toml | 4 +- .../rialto-parachain/node/src/chain_spec.rs | 4 +- bridges/bin/rialto-parachain/node/src/cli.rs | 50 ++++---- .../bin/rialto-parachain/node/src/command.rs | 31 ++++- .../bin/rialto-parachain/node/src/service.rs | 121 ++++++++---------- .../bin/rialto-parachain/runtime/src/lib.rs | 17 ++- bridges/bin/rialto/node/Cargo.toml | 2 +- bridges/bin/rialto/node/src/chain_spec.rs | 18 ++- bridges/bin/rialto/node/src/cli.rs | 13 +- bridges/bin/rialto/runtime/src/lib.rs | 56 ++++---- .../bin/rialto/runtime/src/millau_messages.rs | 2 +- bridges/bin/rialto/runtime/src/parachains.rs | 23 +++- .../src/messages_benchmarking.rs | 18 +-- bridges/modules/dispatch/src/lib.rs | 8 +- bridges/modules/grandpa/src/lib.rs | 1 + bridges/modules/grandpa/src/mock.rs | 1 + .../modules/messages/src/instant_payments.rs | 2 +- bridges/modules/messages/src/lib.rs | 3 + bridges/modules/messages/src/mock.rs | 1 + .../modules/shift-session-manager/src/lib.rs | 2 + .../modules/token-swap/src/benchmarking.rs | 24 ++-- bridges/modules/token-swap/src/lib.rs | 1 + bridges/modules/token-swap/src/mock.rs | 1 + bridges/primitives/chain-kusama/src/lib.rs | 1 + bridges/primitives/chain-millau/src/lib.rs | 22 ++-- bridges/primitives/chain-polkadot/src/lib.rs | 1 + bridges/primitives/chain-rialto/src/lib.rs | 4 +- bridges/primitives/chain-rococo/src/lib.rs | 1 + bridges/primitives/chain-westend/src/lib.rs | 1 + .../header-chain/tests/justification.rs | 3 +- bridges/primitives/polkadot-core/src/lib.rs | 15 ++- bridges/primitives/runtime/src/chain.rs | 8 +- .../primitives/runtime/src/storage_proof.rs | 26 ++-- bridges/primitives/test-utils/src/keyring.rs | 3 +- .../bin-substrate/src/cli/encode_call.rs | 2 +- .../bin-substrate/src/cli/encode_message.rs | 2 +- .../bin-substrate/src/cli/send_message.rs | 4 +- .../src/messages_target.rs | 4 +- 43 files changed, 334 insertions(+), 232 deletions(-) diff --git a/bridges/bin/millau/node/Cargo.toml b/bridges/bin/millau/node/Cargo.toml index c4438d0cef3e..12a10ad6c22c 100644 --- a/bridges/bin/millau/node/Cargo.toml +++ b/bridges/bin/millau/node/Cargo.toml @@ -10,8 +10,8 @@ repository = "https://github.com/paritytech/parity-bridges-common/" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] +clap = { version = "3.0", features = ["derive"] } jsonrpc-core = "18.0" -structopt = "0.3.21" serde_json = "1.0.59" # Bridge dependencies diff --git a/bridges/bin/millau/node/src/chain_spec.rs b/bridges/bin/millau/node/src/chain_spec.rs index ad424ba463c8..a7e3c7c87718 100644 --- a/bridges/bin/millau/node/src/chain_spec.rs +++ b/bridges/bin/millau/node/src/chain_spec.rs @@ -95,6 +95,7 @@ impl Alternative { vec![], None, None, + None, properties, None, ), @@ -119,6 +120,7 @@ impl Alternative { vec![], None, None, + None, properties, None, ), @@ -195,7 +197,7 @@ fn testnet_genesis( aura: AuraConfig { authorities: Vec::new() }, beefy: BeefyConfig { authorities: Vec::new() }, grandpa: GrandpaConfig { authorities: Vec::new() }, - sudo: SudoConfig { key: root_key }, + sudo: SudoConfig { key: Some(root_key) }, session: SessionConfig { keys: initial_authorities .iter() diff --git a/bridges/bin/millau/node/src/cli.rs b/bridges/bin/millau/node/src/cli.rs index 086def633c59..c3c3d134e341 100644 --- a/bridges/bin/millau/node/src/cli.rs +++ b/bridges/bin/millau/node/src/cli.rs @@ -14,10 +14,10 @@ // You should have received a copy of the GNU General Public License // along with Parity Bridges Common. If not, see . +use clap::Parser; use sc_cli::RunCmd; -use structopt::StructOpt; -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] pub struct Cli { #[structopt(subcommand)] pub subcommand: Option, @@ -27,9 +27,10 @@ pub struct Cli { } /// Possible subcommands of the main binary. -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] pub enum Subcommand { /// Key management CLI utilities + #[clap(subcommand)] Key(sc_cli::KeySubcommand), /// Verify a signature for a message, provided on `STDIN`, with a given (public or secret) key. diff --git a/bridges/bin/millau/node/src/service.rs b/bridges/bin/millau/node/src/service.rs index 36e1b948752a..db64af878ff3 100644 --- a/bridges/bin/millau/node/src/service.rs +++ b/bridges/bin/millau/node/src/service.rs @@ -30,7 +30,7 @@ // ===================================================================================== use millau_runtime::{self, opaque::Block, RuntimeApi}; -use sc_client_api::ExecutorProvider; +use sc_client_api::{BlockBackend, ExecutorProvider}; use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams}; pub use sc_executor::NativeElseWasmExecutor; use sc_finality_grandpa::SharedVoterState; @@ -108,6 +108,7 @@ pub fn new_partial( config.wasm_method, config.default_heap_pages, config.max_runtime_instances, + config.runtime_cache_size, ); let (client, backend, keystore_container, task_manager) = @@ -210,8 +211,27 @@ pub fn new_full(mut config: Configuration) -> Result }; } - config.network.extra_sets.push(sc_finality_grandpa::grandpa_peers_set_config()); - config.network.extra_sets.push(beefy_gadget::beefy_peers_set_config()); + // Note: GrandPa is pushed before the Polkadot-specific protocols. This doesn't change + // anything in terms of behaviour, but makes the logs more consistent with the other + // Substrate nodes. + let grandpa_protocol_name = sc_finality_grandpa::protocol_standard_name( + &client.block_hash(0).ok().flatten().expect("Genesis block exists; qed"), + &config.chain_spec, + ); + config + .network + .extra_sets + .push(sc_finality_grandpa::grandpa_peers_set_config(grandpa_protocol_name.clone())); + + let beefy_protocol_name = beefy_gadget::protocol_standard_name( + &client.block_hash(0).ok().flatten().expect("Genesis block exists; qed"), + &config.chain_spec, + ); + config + .network + .extra_sets + .push(beefy_gadget::beefy_peers_set_config(beefy_protocol_name.clone())); + let warp_sync = Arc::new(sc_finality_grandpa::warp_proof::NetworkProvider::new( backend.clone(), grandpa_link.shared_authority_set().clone(), @@ -245,8 +265,10 @@ pub fn new_full(mut config: Configuration) -> Result let enable_grandpa = !config.disable_grandpa; let prometheus_registry = config.prometheus_registry().cloned(); let shared_voter_state = SharedVoterState::empty(); - let (signed_commitment_sender, signed_commitment_stream) = - beefy_gadget::notification::BeefySignedCommitmentStream::channel(); + let (beefy_commitment_link, beefy_commitment_stream) = + beefy_gadget::notification::BeefySignedCommitmentStream::::channel(); + let (beefy_best_block_link, beefy_best_block_stream) = + beefy_gadget::notification::BeefyBestBlockStream::::channel(); let rpc_extensions_builder = { use sc_finality_grandpa::FinalityProofProvider as GrandpaFinalityProofProvider; @@ -287,10 +309,12 @@ pub fn new_full(mut config: Configuration) -> Result finality_proof_provider.clone(), ))); io.extend_with(beefy_gadget_rpc::BeefyApi::to_delegate( - beefy_gadget_rpc::BeefyRpcHandler::new( - signed_commitment_stream.clone(), + beefy_gadget_rpc::BeefyRpcHandler::::new( + beefy_commitment_stream.clone(), + beefy_best_block_stream.clone(), subscription_executor, - ), + ) + .map_err(|e| sc_service::Error::Other(format!("{}", e)))?, )); io.extend_with(pallet_mmr_rpc::MmrApi::to_delegate(pallet_mmr_rpc::Mmr::new( client.clone(), @@ -374,9 +398,11 @@ pub fn new_full(mut config: Configuration) -> Result backend, key_store: keystore.clone(), network: network.clone(), - signed_commitment_sender, + signed_commitment_sender: beefy_commitment_link, + beefy_best_block_sender: beefy_best_block_link, min_block_delta: 4, prometheus_registry: prometheus_registry.clone(), + protocol_name: beefy_protocol_name, }; // Start the BEEFY bridge gadget. @@ -395,6 +421,7 @@ pub fn new_full(mut config: Configuration) -> Result keystore, local_role: role, telemetry: telemetry.as_ref().map(|x| x.handle()), + protocol_name: grandpa_protocol_name, }; if enable_grandpa { diff --git a/bridges/bin/millau/runtime/src/lib.rs b/bridges/bin/millau/runtime/src/lib.rs index 33839614e75c..e0c390362170 100644 --- a/bridges/bin/millau/runtime/src/lib.rs +++ b/bridges/bin/millau/runtime/src/lib.rs @@ -138,6 +138,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, + state_version: 0, }; /// The version information used to identify this runtime when compiled natively. @@ -204,6 +205,7 @@ impl frame_system::Config for Runtime { type SS58Prefix = SS58Prefix; /// The set code logic, just the default since we're not a parachain. type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; } impl pallet_randomness_collective_flip::Config for Runtime {} @@ -562,7 +564,7 @@ pub type Executive = frame_executive::Executive< Block, frame_system::ChainContext, Runtime, - AllPallets, + AllPalletsWithSystem, >; impl_runtime_apis! { @@ -664,7 +666,7 @@ impl_runtime_apis! { } impl beefy_primitives::BeefyApi for Runtime { - fn validator_set() -> ValidatorSet { + fn validator_set() -> Option> { Beefy::validator_set() } } @@ -841,7 +843,7 @@ impl_runtime_apis! { } fn bridged_relayer_id() -> Self::InboundRelayer { - Default::default() + [0u8; 32].into() } fn account_balance(account: &Self::AccountId) -> Self::OutboundMessageFee { diff --git a/bridges/bin/rialto-parachain/node/Cargo.toml b/bridges/bin/rialto-parachain/node/Cargo.toml index 8adc998e47ee..975d551b888c 100644 --- a/bridges/bin/rialto-parachain/node/Cargo.toml +++ b/bridges/bin/rialto-parachain/node/Cargo.toml @@ -18,10 +18,10 @@ default = [] runtime-benchmarks = ['rialto-parachain-runtime/runtime-benchmarks'] [dependencies] +clap = { version = "3.0", features = ["derive"] } derive_more = '0.99.2' log = '0.4.14' codec = { package = 'parity-scale-codec', version = '2.0.0' } -structopt = '0.3.8' serde = { version = '1.0', features = ['derive'] } hex-literal = '0.3.1' @@ -80,6 +80,8 @@ cumulus-client-network = { git = "https://github.com/paritytech/cumulus", branch cumulus-client-service = { git = "https://github.com/paritytech/cumulus", branch = "master" } cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "master" } cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus", branch = "master" } +cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus", branch = "master" } +cumulus-relay-chain-local = { git = "https://github.com/paritytech/cumulus", branch = "master" } # Polkadot dependencies polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master" } diff --git a/bridges/bin/rialto-parachain/node/src/chain_spec.rs b/bridges/bin/rialto-parachain/node/src/chain_spec.rs index 52012423fb71..6a8e751677df 100644 --- a/bridges/bin/rialto-parachain/node/src/chain_spec.rs +++ b/bridges/bin/rialto-parachain/node/src/chain_spec.rs @@ -89,6 +89,7 @@ pub fn development_config(id: ParaId) -> ChainSpec { None, None, None, + None, Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! para_id: id.into(), @@ -133,6 +134,7 @@ pub fn local_testnet_config(id: ParaId) -> ChainSpec { None, None, None, + None, Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! para_id: id.into(), @@ -155,7 +157,7 @@ fn testnet_genesis( balances: rialto_parachain_runtime::BalancesConfig { balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(), }, - sudo: rialto_parachain_runtime::SudoConfig { key: root_key }, + sudo: rialto_parachain_runtime::SudoConfig { key: Some(root_key) }, parachain_info: rialto_parachain_runtime::ParachainInfoConfig { parachain_id: id }, aura: rialto_parachain_runtime::AuraConfig { authorities: initial_authorities }, aura_ext: Default::default(), diff --git a/bridges/bin/rialto-parachain/node/src/cli.rs b/bridges/bin/rialto-parachain/node/src/cli.rs index 78c05f90c880..7abb72cb876c 100644 --- a/bridges/bin/rialto-parachain/node/src/cli.rs +++ b/bridges/bin/rialto-parachain/node/src/cli.rs @@ -15,18 +15,18 @@ // along with Parity Bridges Common. If not, see . use crate::chain_spec; +use clap::{AppSettings, Parser}; use std::path::PathBuf; -use structopt::StructOpt; /// Sub-commands supported by the collator. -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] pub enum Subcommand { /// Export the genesis state of the parachain. - #[structopt(name = "export-genesis-state")] + #[clap(name = "export-genesis-state")] ExportGenesisState(ExportGenesisStateCommand), /// Export the genesis wasm of the parachain. - #[structopt(name = "export-genesis-wasm")] + #[clap(name = "export-genesis-wasm")] ExportGenesisWasm(ExportGenesisWasmCommand), /// Build a chain specification. @@ -51,66 +51,66 @@ pub enum Subcommand { Revert(sc_cli::RevertCmd), /// The custom benchmark subcommmand benchmarking runtime pallets. - #[structopt(name = "benchmark", about = "Benchmark runtime pallets.")] + #[clap(name = "benchmark", about = "Benchmark runtime pallets.")] Benchmark(frame_benchmarking_cli::BenchmarkCmd), } /// Command for exporting the genesis state of the parachain -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] pub struct ExportGenesisStateCommand { /// Output file name or stdout if unspecified. - #[structopt(parse(from_os_str))] + #[clap(parse(from_os_str))] pub output: Option, /// Id of the parachain this state is for. /// /// Default: 100 - #[structopt(long, conflicts_with = "chain")] + #[clap(long, conflicts_with = "chain")] pub parachain_id: Option, /// Write output in binary. Default is to write in hex. - #[structopt(short, long)] + #[clap(short, long)] pub raw: bool, /// The name of the chain for that the genesis state should be exported. - #[structopt(long, conflicts_with = "parachain-id")] + #[clap(long, conflicts_with = "parachain-id")] pub chain: Option, } /// Command for exporting the genesis wasm file. -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] pub struct ExportGenesisWasmCommand { /// Output file name or stdout if unspecified. - #[structopt(parse(from_os_str))] + #[clap(parse(from_os_str))] pub output: Option, /// Write output in binary. Default is to write in hex. - #[structopt(short, long)] + #[clap(short, long)] pub raw: bool, /// The name of the chain for that the genesis wasm file should be exported. - #[structopt(long)] + #[clap(long)] pub chain: Option, } -#[derive(Debug, StructOpt)] -#[structopt(settings = &[ - structopt::clap::AppSettings::GlobalVersion, - structopt::clap::AppSettings::ArgsNegateSubcommands, - structopt::clap::AppSettings::SubcommandsNegateReqs, -])] +#[derive(Debug, Parser)] +#[clap(setting( + AppSettings::PropagateVersion | + AppSettings::ArgsNegateSubcommands | + AppSettings::SubcommandsNegateReqs, +))] pub struct Cli { - #[structopt(subcommand)] + #[clap(subcommand)] pub subcommand: Option, - #[structopt(long)] + #[clap(long)] pub parachain_id: Option, - #[structopt(flatten)] + #[clap(flatten)] pub run: cumulus_client_cli::RunCmd, /// Relaychain arguments - #[structopt(raw = true)] + #[clap(raw = true)] pub relaychain_args: Vec, } @@ -135,6 +135,6 @@ impl RelayChainCli { let extension = chain_spec::Extensions::try_get(&*para_config.chain_spec); let chain_id = extension.map(|e| e.relay_chain.clone()); let base_path = para_config.base_path.as_ref().map(|x| x.path().join("rialto-bridge-node")); - Self { base_path, chain_id, base: polkadot_cli::RunCmd::from_iter(relay_chain_args) } + Self { base_path, chain_id, base: polkadot_cli::RunCmd::parse_from(relay_chain_args) } } } diff --git a/bridges/bin/rialto-parachain/node/src/command.rs b/bridges/bin/rialto-parachain/node/src/command.rs index e4f52cc026a7..9a69042a8034 100644 --- a/bridges/bin/rialto-parachain/node/src/command.rs +++ b/bridges/bin/rialto-parachain/node/src/command.rs @@ -211,10 +211,12 @@ pub fn run() -> Result<()> { builder.with_profiling(sc_tracing::TracingReceiver::Log, ""); let _ = builder.init(); - let block: Block = generate_genesis_block(&load_spec( + let spec = load_spec( ¶ms.chain.clone().unwrap_or_default(), params.parachain_id.expect("Missing ParaId").into(), - )?)?; + )?; + let state_version = Cli::native_runtime_version(&spec).state_version(); + let block: Block = generate_genesis_block(&spec, state_version)?; let raw_header = block.header().encode(); let output_buf = if params.raw { raw_header @@ -278,8 +280,10 @@ pub fn run() -> Result<()> { let parachain_account = AccountIdConversion::::into_account(&id); - let block: Block = - generate_genesis_block(&config.chain_spec).map_err(|e| format!("{:?}", e))?; + let state_version = + RelayChainCli::native_runtime_version(&config.chain_spec).state_version(); + let block: Block = generate_genesis_block(&config.chain_spec, state_version) + .map_err(|e| format!("{:?}", e))?; let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode())); let polkadot_config = SubstrateCli::create_configuration( @@ -357,11 +361,24 @@ impl CliConfiguration for RelayChainCli { self.base.base.rpc_ws(default_listen_port) } - fn prometheus_config(&self, default_listen_port: u16) -> Result> { - self.base.base.prometheus_config(default_listen_port) + fn prometheus_config( + &self, + default_listen_port: u16, + chain_spec: &Box, + ) -> Result> { + self.base.base.prometheus_config(default_listen_port, chain_spec) } - fn init(&self) -> Result<()> { + fn init( + &self, + _support_url: &String, + _impl_version: &String, + _logger_hook: F, + _config: &sc_service::Configuration, + ) -> Result<()> + where + F: FnOnce(&mut sc_cli::LoggerBuilder, &sc_service::Configuration), + { unreachable!("PolkadotCli is never initialized; qed"); } diff --git a/bridges/bin/rialto-parachain/node/src/service.rs b/bridges/bin/rialto-parachain/node/src/service.rs index 54e626e0ead1..61f705086e99 100644 --- a/bridges/bin/rialto-parachain/node/src/service.rs +++ b/bridges/bin/rialto-parachain/node/src/service.rs @@ -22,21 +22,21 @@ //! `substrate_frame_rpc_system::SystemApi`. // std -use std::sync::Arc; +use std::{sync::Arc, time::Duration}; // Local Runtime Types use rialto_parachain_runtime::RuntimeApi; // Cumulus Imports -use cumulus_client_consensus_aura::{ - build_aura_consensus, BuildAuraConsensusParams, SlotProportion, -}; +use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion}; use cumulus_client_consensus_common::ParachainConsensus; -use cumulus_client_network::build_block_announce_validator; +use cumulus_client_network::BlockAnnounceValidator; use cumulus_client_service::{ prepare_node_config, start_collator, start_full_node, StartCollatorParams, StartFullNodeParams, }; use cumulus_primitives_core::ParaId; +use cumulus_relay_chain_interface::RelayChainInterface; +use cumulus_relay_chain_local::build_relay_chain_interface; // Substrate Imports use sc_client_api::ExecutorProvider; @@ -141,6 +141,7 @@ where config.wasm_method, config.default_heap_pages, config.max_runtime_instances, + config.runtime_cache_size, ); let (client, backend, keystore_container, task_manager) = @@ -247,7 +248,7 @@ where Option<&Registry>, Option, &TaskManager, - &polkadot_service::NewFull, + Arc, Arc< sc_transaction_pool::FullPool< Block, @@ -268,8 +269,9 @@ where let params = new_partial::(¶chain_config, build_import_queue)?; let (mut telemetry, telemetry_worker_handle) = params.other; - let relay_chain_full_node = - cumulus_client_service::build_polkadot_full_node(polkadot_config, telemetry_worker_handle) + let mut task_manager = params.task_manager; + let (relay_chain_interface, collator_key) = + build_relay_chain_interface(polkadot_config, telemetry_worker_handle, &mut task_manager) .map_err(|e| match e { polkadot_service::Error::Sub(x) => x, s => format!("{}", s).into(), @@ -277,18 +279,12 @@ where let client = params.client.clone(); let backend = params.backend.clone(); - let block_announce_validator = build_block_announce_validator( - relay_chain_full_node.client.clone(), - id, - Box::new(relay_chain_full_node.network.clone()), - relay_chain_full_node.backend.clone(), - ); + let block_announce_validator = BlockAnnounceValidator::new(relay_chain_interface.clone(), id); let force_authoring = parachain_config.force_authoring; let validator = parachain_config.role.is_authority(); let prometheus_registry = parachain_config.prometheus_registry().cloned(); let transaction_pool = params.transaction_pool.clone(); - let mut task_manager = params.task_manager; let import_queue = cumulus_client_service::SharedImportQueue::new(params.import_queue); let (network, system_rpc_tx, start_network) = sc_service::build_network(sc_service::BuildNetworkParams { @@ -297,7 +293,9 @@ where transaction_pool: transaction_pool.clone(), spawn_handle: task_manager.spawn_handle(), import_queue: import_queue.clone(), - block_announce_validator_builder: Some(Box::new(|_| block_announce_validator)), + block_announce_validator_builder: Some(Box::new(|_| { + Box::new(block_announce_validator) + })), warp_sync: None, })?; @@ -325,13 +323,15 @@ where Arc::new(move |hash, data| network.announce_block(hash, data)) }; + let relay_chain_slot_duration = Duration::from_secs(6); + if validator { let parachain_consensus = build_consensus( client.clone(), prometheus_registry.as_ref(), telemetry.as_ref().map(|t| t.handle()), &task_manager, - &relay_chain_full_node, + relay_chain_interface.clone(), transaction_pool, network, params.keystore_container.sync_keystore(), @@ -346,10 +346,12 @@ where announce_block, client: client.clone(), task_manager: &mut task_manager, - relay_chain_full_node, + relay_chain_interface, spawner, parachain_consensus, import_queue, + collator_key, + relay_chain_slot_duration, }; start_collator(params).await?; @@ -359,7 +361,9 @@ where announce_block, task_manager: &mut task_manager, para_id: id, - relay_chain_full_node, + relay_chain_interface, + relay_chain_slot_duration, + import_queue, }; start_full_node(params)?; @@ -447,7 +451,7 @@ pub async fn start_node( prometheus_registry, telemetry, task_manager, - relay_chain_node, + relay_chain_interface, transaction_pool, sync_oracle, keystore, @@ -462,60 +466,47 @@ pub async fn start_node( telemetry.clone(), ); - let relay_chain_backend = relay_chain_node.backend.clone(); - let relay_chain_client = relay_chain_node.client.clone(); - Ok(build_aura_consensus::< - sp_consensus_aura::sr25519::AuthorityPair, - _, - _, - _, - _, - _, - _, - _, - _, - _, - >(BuildAuraConsensusParams { - proposer_factory, - create_inherent_data_providers: move |_, (relay_parent, validation_data)| { - let parachain_inherent = - cumulus_primitives_parachain_inherent::ParachainInherentData::create_at_with_client( + Ok(AuraConsensus::build::( + BuildAuraConsensusParams { + proposer_factory, + create_inherent_data_providers: move |_, (relay_parent, validation_data)| { + let relay_chain_interface = relay_chain_interface.clone(); + async move { + let parachain_inherent = + cumulus_primitives_parachain_inherent::ParachainInherentData::create_at( relay_parent, - &relay_chain_client, - &*relay_chain_backend, + &relay_chain_interface, &validation_data, id, - ); - async move { - let time = sp_timestamp::InherentDataProvider::from_system_time(); + ).await; + let time = sp_timestamp::InherentDataProvider::from_system_time(); - let slot = sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration( + let slot = sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration( *time, slot_duration.slot_duration(), ); - let parachain_inherent = parachain_inherent.ok_or_else(|| { - Box::::from( - "Failed to create parachain inherent", - ) - })?; - Ok((time, slot, parachain_inherent)) - } + let parachain_inherent = parachain_inherent.ok_or_else(|| { + Box::::from( + "Failed to create parachain inherent", + ) + })?; + Ok((time, slot, parachain_inherent)) + } + }, + block_import: client.clone(), + para_client: client, + backoff_authoring_blocks: Option::<()>::None, + sync_oracle, + keystore, + force_authoring, + slot_duration, + // We got around 500ms for proposing + block_proposal_slot_portion: SlotProportion::new(1f32 / 24f32), + telemetry, + max_block_proposal_slot_portion: None, }, - block_import: client.clone(), - relay_chain_client: relay_chain_node.client.clone(), - relay_chain_backend: relay_chain_node.backend.clone(), - para_client: client, - backoff_authoring_blocks: Option::<()>::None, - sync_oracle, - keystore, - force_authoring, - slot_duration, - // We got around 500ms for proposing - block_proposal_slot_portion: SlotProportion::new(1f32 / 24f32), - telemetry, - max_block_proposal_slot_portion: None, - })) + )) }, ) .await diff --git a/bridges/bin/rialto-parachain/runtime/src/lib.rs b/bridges/bin/rialto-parachain/runtime/src/lib.rs index 5b71674b7fe9..e499c89f13ac 100644 --- a/bridges/bin/rialto-parachain/runtime/src/lib.rs +++ b/bridges/bin/rialto-parachain/runtime/src/lib.rs @@ -50,7 +50,7 @@ pub use frame_support::{ }, StorageValue, }; -pub use frame_system::Call as SystemCall; +pub use frame_system::{Call as SystemCall, EnsureRoot}; pub use pallet_balances::Call as BalancesCall; pub use pallet_timestamp::Call as TimestampCall; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; @@ -70,7 +70,7 @@ use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset, - ParentAsSuperuser, ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative, + ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, }; @@ -103,7 +103,7 @@ pub type Executive = frame_executive::Executive< Block, frame_system::ChainContext, Runtime, - AllPallets, + AllPalletsWithSystem, >; impl_opaque_keys! { @@ -122,6 +122,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, + state_version: 0, }; /// This determines the average expected block time that we are targeting. @@ -209,6 +210,7 @@ impl frame_system::Config for Runtime { type SS58Prefix = SS58Prefix; /// The action to take on a Runtime Upgrade type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; + type MaxConsumers = frame_support::traits::ConstU32<16>; } parameter_types! { @@ -267,7 +269,7 @@ parameter_types! { impl cumulus_pallet_parachain_system::Config for Runtime { type Event = Event; - type OnValidationData = (); + type OnSystemEvent = (); type SelfParaId = parachain_info::Pallet; type OutboundXcmpMessageSource = XcmpQueue; type DmpMessageHandler = DmpQueue; @@ -294,7 +296,7 @@ parameter_types! { /// `Transact` in order to determine the dispatch Origin. pub type LocationToAccountId = ( // The parent (Relay-chain) origin converts to the default `AccountId`. - ParentIsDefault, + ParentIsPreset, // Sibling parachain origins convert to AccountId via the `ParaId::into`. SiblingParachainConvertsVia, // Straight up local `AccountId32` origins just alias directly to `AccountId`. @@ -420,6 +422,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type XcmExecutor = XcmExecutor; type ChannelInfo = ParachainSystem; type VersionWrapper = (); + type ExecuteOverweightOrigin = EnsureRoot; } impl cumulus_pallet_dmp_queue::Config for Runtime { @@ -554,8 +557,8 @@ impl_runtime_apis! { } impl cumulus_primitives_core::CollectCollationInfo for Runtime { - fn collect_collation_info() -> cumulus_primitives_core::CollationInfo { - ParachainSystem::collect_collation_info() + fn collect_collation_info(header: &::Header) -> cumulus_primitives_core::CollationInfo { + ParachainSystem::collect_collation_info(header) } } diff --git a/bridges/bin/rialto/node/Cargo.toml b/bridges/bin/rialto/node/Cargo.toml index 77694e552acb..6c7bce4d4e0f 100644 --- a/bridges/bin/rialto/node/Cargo.toml +++ b/bridges/bin/rialto/node/Cargo.toml @@ -10,12 +10,12 @@ repository = "https://github.com/paritytech/parity-bridges-common/" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] +clap = { version = "3.0", features = ["derive"] } futures = "0.3" jsonrpc-core = "18.0" kvdb = "0.10" kvdb-rocksdb = "0.12" lru = "0.7" -structopt = "0.3.21" serde_json = "1.0.59" thiserror = "1.0" diff --git a/bridges/bin/rialto/node/src/chain_spec.rs b/bridges/bin/rialto/node/src/chain_spec.rs index 7e08e635317b..6bfacba83a1e 100644 --- a/bridges/bin/rialto/node/src/chain_spec.rs +++ b/bridges/bin/rialto/node/src/chain_spec.rs @@ -104,6 +104,7 @@ impl Alternative { vec![], None, None, + None, properties, Default::default(), ), @@ -128,6 +129,7 @@ impl Alternative { vec![], None, None, + None, properties, Default::default(), ), @@ -222,7 +224,7 @@ fn testnet_genesis( }, beefy: BeefyConfig { authorities: Vec::new() }, grandpa: GrandpaConfig { authorities: Vec::new() }, - sudo: SudoConfig { key: root_key }, + sudo: SudoConfig { key: Some(root_key) }, session: SessionConfig { keys: initial_authorities .iter() @@ -248,8 +250,8 @@ fn testnet_genesis( // (see /node/service/src/chain_spec.rs:default_parachains_host_configuration) configuration: ConfigurationConfig { config: polkadot_runtime_parachains::configuration::HostConfiguration { - validation_upgrade_frequency: 1u32, - validation_upgrade_delay: 1, + validation_upgrade_cooldown: 2u32, + validation_upgrade_delay: 2, code_retention_period: 1200, max_code_size: polkadot_primitives::v1::MAX_CODE_SIZE, max_pov_size: polkadot_primitives::v1::MAX_POV_SIZE, @@ -259,13 +261,8 @@ fn testnet_genesis( thread_availability_period: 4, max_upward_queue_count: 8, max_upward_queue_size: 1024 * 1024, - max_downward_message_size: 1024, - // this is approximatelly 4ms. - // - // Same as `4 * frame_support::weights::WEIGHT_PER_MILLIS`. We don't bother with - // an import since that's a made up number and should be replaced with a constant - // obtained by benchmarking anyway. - ump_service_total_weight: 4 * 1_000_000_000, + max_downward_message_size: 1024 * 1024, + ump_service_total_weight: 100_000_000_000, max_upward_message_size: 1024 * 1024, max_upward_message_num_per_candidate: 5, hrmp_sender_deposit: 0, @@ -284,6 +281,7 @@ fn testnet_genesis( needed_approvals: 2, relay_vrf_modulo_samples: 2, zeroth_delay_tranche_width: 0, + minimum_validation_upgrade_delay: 5, ..Default::default() }, }, diff --git a/bridges/bin/rialto/node/src/cli.rs b/bridges/bin/rialto/node/src/cli.rs index 3f85a69a713f..20155a1469e4 100644 --- a/bridges/bin/rialto/node/src/cli.rs +++ b/bridges/bin/rialto/node/src/cli.rs @@ -14,10 +14,10 @@ // You should have received a copy of the GNU General Public License // along with Parity Bridges Common. If not, see . +use clap::{AppSettings, Parser}; use sc_cli::RunCmd; -use structopt::StructOpt; -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] pub struct Cli { #[structopt(subcommand)] pub subcommand: Option, @@ -27,9 +27,10 @@ pub struct Cli { } /// Possible subcommands of the main binary. -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] pub enum Subcommand { /// Key management CLI utilities + #[clap(subcommand)] Key(sc_cli::KeySubcommand), /// Verify a signature for a message, provided on `STDIN`, with a given (public or secret) key. @@ -69,16 +70,16 @@ pub enum Subcommand { Benchmark(frame_benchmarking_cli::BenchmarkCmd), /// FOR INTERNAL USE: analog of the "prepare-worker" command of the polkadot binary. - #[structopt(name = "prepare-worker", setting = structopt::clap::AppSettings::Hidden)] + #[clap(name = "prepare-worker", setting = AppSettings::Hidden)] PvfPrepareWorker(ValidationWorkerCommand), /// FOR INTERNAL USE: analog of the "execute-worker" command of the polkadot binary. - #[structopt(name = "execute-worker", setting = structopt::clap::AppSettings::Hidden)] + #[clap(name = "execute-worker", setting = AppSettings::Hidden)] PvfExecuteWorker(ValidationWorkerCommand), } /// Validation worker command. -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] pub struct ValidationWorkerCommand { /// The path to the validation host's socket. pub socket_path: String, diff --git a/bridges/bin/rialto/runtime/src/lib.rs b/bridges/bin/rialto/runtime/src/lib.rs index 5f940bb58e07..42d2d880e06e 100644 --- a/bridges/bin/rialto/runtime/src/lib.rs +++ b/bridges/bin/rialto/runtime/src/lib.rs @@ -142,6 +142,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, + state_version: 1, }; /// The version information used to identify this runtime when compiled natively. @@ -208,6 +209,7 @@ impl frame_system::Config for Runtime { type SS58Prefix = SS58Prefix; /// The set code logic, just the default since we're not a parachain. type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; } /// The BABE epoch configuration at genesis. @@ -553,7 +555,7 @@ pub type Executive = frame_executive::Executive< Block, frame_system::ChainContext, Runtime, - AllPallets, + AllPalletsWithSystem, >; impl_runtime_apis! { @@ -605,7 +607,7 @@ impl_runtime_apis! { } impl beefy_primitives::BeefyApi for Runtime { - fn validator_set() -> ValidatorSet { + fn validator_set() -> Option> { Beefy::validator_set() } } @@ -715,15 +717,12 @@ impl_runtime_apis! { } } - impl polkadot_primitives::v1::ParachainHost for Runtime { + impl polkadot_primitives::v2::ParachainHost for Runtime { fn validators() -> Vec { polkadot_runtime_parachains::runtime_api_impl::v1::validators::() } - fn validator_groups() -> ( - Vec>, - polkadot_primitives::v1::GroupRotationInfo, - ) { + fn validator_groups() -> (Vec>, polkadot_primitives::v1::GroupRotationInfo) { polkadot_runtime_parachains::runtime_api_impl::v1::validator_groups::() } @@ -731,10 +730,7 @@ impl_runtime_apis! { polkadot_runtime_parachains::runtime_api_impl::v1::availability_cores::() } - fn persisted_validation_data( - para_id: polkadot_primitives::v1::Id, - assumption: polkadot_primitives::v1::OccupiedCoreAssumption, - ) + fn persisted_validation_data(para_id: polkadot_primitives::v1::Id, assumption: polkadot_primitives::v1::OccupiedCoreAssumption) -> Option> { polkadot_runtime_parachains::runtime_api_impl::v1::persisted_validation_data::(para_id, assumption) } @@ -743,7 +739,10 @@ impl_runtime_apis! { para_id: polkadot_primitives::v1::Id, expected_persisted_validation_data_hash: Hash, ) -> Option<(polkadot_primitives::v1::PersistedValidationData, polkadot_primitives::v1::ValidationCodeHash)> { - polkadot_runtime_parachains::runtime_api_impl::v1::assumed_validation_data::(para_id, expected_persisted_validation_data_hash) + polkadot_runtime_parachains::runtime_api_impl::v1::assumed_validation_data::( + para_id, + expected_persisted_validation_data_hash, + ) } fn check_validation_outputs( @@ -757,17 +756,12 @@ impl_runtime_apis! { polkadot_runtime_parachains::runtime_api_impl::v1::session_index_for_child::() } - fn validation_code( - para_id: polkadot_primitives::v1::Id, - assumption: polkadot_primitives::v1::OccupiedCoreAssumption, - ) + fn validation_code(para_id: polkadot_primitives::v1::Id, assumption: polkadot_primitives::v1::OccupiedCoreAssumption) -> Option { polkadot_runtime_parachains::runtime_api_impl::v1::validation_code::(para_id, assumption) } - fn candidate_pending_availability( - para_id: polkadot_primitives::v1::Id, - ) -> Option> { + fn candidate_pending_availability(para_id: polkadot_primitives::v1::Id) -> Option> { polkadot_runtime_parachains::runtime_api_impl::v1::candidate_pending_availability::(para_id) } @@ -782,13 +776,11 @@ impl_runtime_apis! { }) } - fn session_info(index: polkadot_primitives::v1::SessionIndex) -> Option { + fn session_info(index: polkadot_primitives::v1::SessionIndex) -> Option { polkadot_runtime_parachains::runtime_api_impl::v1::session_info::(index) } - fn dmq_contents( - recipient: polkadot_primitives::v1::Id, - ) -> Vec> { + fn dmq_contents(recipient: polkadot_primitives::v1::Id) -> Vec> { polkadot_runtime_parachains::runtime_api_impl::v1::dmq_contents::(recipient) } @@ -798,15 +790,27 @@ impl_runtime_apis! { polkadot_runtime_parachains::runtime_api_impl::v1::inbound_hrmp_channels_contents::(recipient) } - fn validation_code_by_hash( - hash: polkadot_primitives::v1::ValidationCodeHash, - ) -> Option { + fn validation_code_by_hash(hash: polkadot_primitives::v1::ValidationCodeHash) -> Option { polkadot_runtime_parachains::runtime_api_impl::v1::validation_code_by_hash::(hash) } fn on_chain_votes() -> Option> { polkadot_runtime_parachains::runtime_api_impl::v1::on_chain_votes::() } + + fn submit_pvf_check_statement(stmt: polkadot_primitives::v2::PvfCheckStatement, signature: polkadot_primitives::v1::ValidatorSignature) { + polkadot_runtime_parachains::runtime_api_impl::v1::submit_pvf_check_statement::(stmt, signature) + } + + fn pvfs_require_precheck() -> Vec { + polkadot_runtime_parachains::runtime_api_impl::v1::pvfs_require_precheck::() + } + + fn validation_code_hash(para_id: polkadot_primitives::v1::Id, assumption: polkadot_primitives::v1::OccupiedCoreAssumption) + -> Option + { + polkadot_runtime_parachains::runtime_api_impl::v1::validation_code_hash::(para_id, assumption) + } } impl sp_authority_discovery::AuthorityDiscoveryApi for Runtime { diff --git a/bridges/bin/rialto/runtime/src/millau_messages.rs b/bridges/bin/rialto/runtime/src/millau_messages.rs index 05935c90ea10..22d11c68be20 100644 --- a/bridges/bin/rialto/runtime/src/millau_messages.rs +++ b/bridges/bin/rialto/runtime/src/millau_messages.rs @@ -316,7 +316,7 @@ mod tests { SystemConfig::default().build_storage::().unwrap().into(); ext.execute_with(|| { let bridge = MILLAU_CHAIN_ID; - let call: Call = SystemCall::remark { remark: vec![] }.into(); + let call: Call = SystemCall::set_heap_pages { pages: 64 }.into(); let dispatch_weight = call.get_dispatch_info().weight; let dispatch_fee = ::WeightToFee::calc( &dispatch_weight, diff --git a/bridges/bin/rialto/runtime/src/parachains.rs b/bridges/bin/rialto/runtime/src/parachains.rs index 332a3387ac69..9a316ef0e2a7 100644 --- a/bridges/bin/rialto/runtime/src/parachains.rs +++ b/bridges/bin/rialto/runtime/src/parachains.rs @@ -16,7 +16,10 @@ //! Parachains support in Rialto runtime. -use crate::{AccountId, Balance, Balances, BlockNumber, Event, Origin, Registrar, Runtime, Slots}; +use crate::{ + AccountId, Babe, Balance, Balances, BlockNumber, Call, Event, Origin, Registrar, Runtime, + Slots, UncheckedExtrinsic, +}; use frame_support::{parameter_types, weights::Weight}; use frame_system::EnsureRoot; @@ -29,6 +32,15 @@ use polkadot_runtime_parachains::{ paras_inherent as parachains_paras_inherent, scheduler as parachains_scheduler, session_info as parachains_session_info, shared as parachains_shared, ump as parachains_ump, }; +use sp_runtime::transaction_validity::TransactionPriority; + +impl frame_system::offchain::SendTransactionTypes for Runtime +where + Call: From, +{ + type Extrinsic = UncheckedExtrinsic; + type OverarchingCall = Call; +} /// Special `RewardValidators` that does nothing ;) pub struct RewardValidators; @@ -49,6 +61,7 @@ impl parachains_hrmp::Config for Runtime { type Event = Event; type Origin = Origin; type Currency = Balances; + type WeightInfo = parachains_hrmp::TestWeightInfo; } impl parachains_inclusion::Config for Runtime { @@ -65,10 +78,15 @@ impl parachains_initializer::Config for Runtime { impl parachains_origin::Config for Runtime {} +parameter_types! { + pub const ParasUnsignedPriority: TransactionPriority = TransactionPriority::max_value(); +} + impl parachains_paras::Config for Runtime { - type Origin = Origin; type Event = Event; type WeightInfo = parachains_paras::TestWeightInfo; + type UnsignedPriority = ParasUnsignedPriority; + type NextSessionRotation = Babe; } impl parachains_paras_inherent::Config for Runtime { @@ -120,6 +138,7 @@ impl slots::Config for Runtime { type LeasePeriod = LeasePeriod; type WeightInfo = slots::TestWeightInfo; type LeaseOffset = (); + type ForceOrigin = EnsureRoot; } impl paras_sudo_wrapper::Config for Runtime {} diff --git a/bridges/bin/runtime-common/src/messages_benchmarking.rs b/bridges/bin/runtime-common/src/messages_benchmarking.rs index 1b14ee30aee8..12c270d8666f 100644 --- a/bridges/bin/runtime-common/src/messages_benchmarking.rs +++ b/bridges/bin/runtime-common/src/messages_benchmarking.rs @@ -40,7 +40,7 @@ use pallet_bridge_messages::benchmarking::{ use sp_core::Hasher; use sp_runtime::traits::{Header, IdentifyAccount, MaybeSerializeDeserialize, Zero}; use sp_std::{fmt::Debug, prelude::*}; -use sp_trie::{record_all_keys, trie_types::TrieDBMut, Layout, MemoryDB, Recorder, TrieMut}; +use sp_trie::{record_all_keys, trie_types::TrieDBMutV1, LayoutV1, MemoryDB, Recorder, TrieMut}; use sp_version::RuntimeVersion; /// Prepare outbound message for the `send_message` call. @@ -177,7 +177,7 @@ where let mut root = Default::default(); let mut mdb = MemoryDB::default(); { - let mut trie = TrieDBMut::::new(&mut mdb, &mut root); + let mut trie = TrieDBMutV1::::new(&mut mdb, &mut root); trie.insert(&storage_key, ¶ms.inbound_lane_data.encode()) .map_err(|_| "TrieMut::insert has failed") .expect("TrieMut::insert should not fail in benchmarks"); @@ -186,7 +186,7 @@ where // generate storage proof to be delivered to This chain let mut proof_recorder = Recorder::::new(); - record_all_keys::, _>(&mdb, &root, &mut proof_recorder) + record_all_keys::, _>(&mdb, &root, &mut proof_recorder) .map_err(|_| "record_all_keys has failed") .expect("record_all_keys should not fail in benchmarks"); let storage_proof = proof_recorder.drain().into_iter().map(|n| n.data.to_vec()).collect(); @@ -220,7 +220,7 @@ where let mut root = Default::default(); let mut mdb = MemoryDB::default(); { - let mut trie = TrieDBMut::::new(&mut mdb, &mut root); + let mut trie = TrieDBMutV1::::new(&mut mdb, &mut root); // insert messages for nonce in params.message_nonces.clone() { @@ -256,7 +256,7 @@ where // generate storage proof to be delivered to This chain let mut proof_recorder = Recorder::::new(); - record_all_keys::, _>(&mdb, &root, &mut proof_recorder) + record_all_keys::, _>(&mdb, &root, &mut proof_recorder) .map_err(|_| "record_all_keys has failed") .expect("record_all_keys should not fail in benchmarks"); let storage_proof = proof_recorder.drain().into_iter().map(|n| n.data.to_vec()).collect(); @@ -339,7 +339,7 @@ fn grow_trie(mut root: H::Out, mdb: &mut MemoryDB, trie_size: Proo loop { // generate storage proof to be delivered to This chain let mut proof_recorder = Recorder::::new(); - record_all_keys::, _>(mdb, &root, &mut proof_recorder) + record_all_keys::, _>(mdb, &root, &mut proof_recorder) .map_err(|_| "record_all_keys has failed") .expect("record_all_keys should not fail in benchmarks"); let size: usize = proof_recorder.drain().into_iter().map(|n| n.data.len()).sum(); @@ -347,9 +347,9 @@ fn grow_trie(mut root: H::Out, mdb: &mut MemoryDB, trie_size: Proo return root } - let mut trie = TrieDBMut::::from_existing(mdb, &mut root) - .map_err(|_| "TrieDBMut::from_existing has failed") - .expect("TrieDBMut::from_existing should not fail in benchmarks"); + let mut trie = TrieDBMutV1::::from_existing(mdb, &mut root) + .map_err(|_| "TrieDBMutV1::from_existing has failed") + .expect("TrieDBMutV1::from_existing should not fail in benchmarks"); for _ in 0..iterations { trie.insert(&key_index.encode(), &vec![42u8; leaf_size as _]) .map_err(|_| "TrieMut::insert has failed") diff --git a/bridges/modules/dispatch/src/lib.rs b/bridges/modules/dispatch/src/lib.rs index f467bab0d946..1e030b733205 100644 --- a/bridges/modules/dispatch/src/lib.rs +++ b/bridges/modules/dispatch/src/lib.rs @@ -64,8 +64,7 @@ pub mod pallet { + MaybeSerializeDeserialize + Debug + MaybeDisplay - + Ord - + Default; + + Ord; /// Type of account public key on target chain. type TargetChainAccountPublic: Parameter + IdentifyAccount; /// Type of signature that may prove that the message has been signed by @@ -520,6 +519,7 @@ mod tests { type DbWeight = (); type SS58Prefix = (); type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; } impl Config for TestRuntime { @@ -649,11 +649,11 @@ mod tests { fn should_fail_on_weight_mismatch() { new_test_ext().execute_with(|| { let id = [0; 4]; - let call = Call::System(frame_system::Call::remark { remark: vec![1, 2, 3] }); + let call = Call::System(frame_system::Call::set_heap_pages { pages: 42 }); let call_weight = call.get_dispatch_info().weight; let mut message = prepare_root_message(call); message.weight = 7; - assert!(call_weight != 7, "needed for test to actually trigger a weight mismatch"); + assert!(call_weight > 7, "needed for test to actually trigger a weight mismatch"); System::set_block_number(1); let result = Dispatch::dispatch( diff --git a/bridges/modules/grandpa/src/lib.rs b/bridges/modules/grandpa/src/lib.rs index 31b5280bb039..a8267e65eb3b 100644 --- a/bridges/modules/grandpa/src/lib.rs +++ b/bridges/modules/grandpa/src/lib.rs @@ -101,6 +101,7 @@ pub mod pallet { } #[pallet::pallet] + #[pallet::without_storage_info] pub struct Pallet(PhantomData<(T, I)>); #[pallet::hooks] diff --git a/bridges/modules/grandpa/src/mock.rs b/bridges/modules/grandpa/src/mock.rs index 37d93df779bf..bfc749d5230c 100644 --- a/bridges/modules/grandpa/src/mock.rs +++ b/bridges/modules/grandpa/src/mock.rs @@ -77,6 +77,7 @@ impl frame_system::Config for TestRuntime { type BlockLength = (); type SS58Prefix = (); type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; } parameter_types! { diff --git a/bridges/modules/messages/src/instant_payments.rs b/bridges/modules/messages/src/instant_payments.rs index c145687af994..d67b82ade8d2 100644 --- a/bridges/modules/messages/src/instant_payments.rs +++ b/bridges/modules/messages/src/instant_payments.rs @@ -145,7 +145,7 @@ fn pay_relayers_rewards( relayer_fund_account: &AccountId, confirmation_fee: Currency::Balance, ) where - AccountId: Debug + Default + Encode + PartialEq, + AccountId: Debug + Encode + PartialEq, Currency: CurrencyT, Currency::Balance: From, { diff --git a/bridges/modules/messages/src/lib.rs b/bridges/modules/messages/src/lib.rs index 66bfecd2592b..f37dc88481e8 100644 --- a/bridges/modules/messages/src/lib.rs +++ b/bridges/modules/messages/src/lib.rs @@ -209,6 +209,7 @@ pub mod pallet { #[pallet::pallet] #[pallet::generate_store(pub(super) trait Store)] + #[pallet::without_storage_info] pub struct Pallet(PhantomData<(T, I)>); #[pallet::call] @@ -2116,6 +2117,7 @@ mod tests { #[test] #[should_panic] + #[cfg(debug_assertions)] fn receive_messages_panics_in_debug_mode_if_callback_is_wrong() { run_test(|| { TestOnDeliveryConfirmed1::set_consumed_weight_per_message( @@ -2248,6 +2250,7 @@ mod tests { #[test] #[should_panic] + #[cfg(debug_assertions)] fn message_accepted_panics_in_debug_mode_if_callback_is_wrong() { run_test(|| { TestOnMessageAccepted::set_consumed_weight_per_message( diff --git a/bridges/modules/messages/src/mock.rs b/bridges/modules/messages/src/mock.rs index a333c95bb58b..ef5081472279 100644 --- a/bridges/modules/messages/src/mock.rs +++ b/bridges/modules/messages/src/mock.rs @@ -125,6 +125,7 @@ impl frame_system::Config for TestRuntime { type DbWeight = DbWeight; type SS58Prefix = (); type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; } parameter_types! { diff --git a/bridges/modules/shift-session-manager/src/lib.rs b/bridges/modules/shift-session-manager/src/lib.rs index 06d0b3fb0f8d..9cf84412575a 100644 --- a/bridges/modules/shift-session-manager/src/lib.rs +++ b/bridges/modules/shift-session-manager/src/lib.rs @@ -35,6 +35,7 @@ pub mod pallet { #[pallet::pallet] #[pallet::generate_store(pub(super) trait Store)] + #[pallet::without_storage_info] pub struct Pallet(PhantomData); #[pallet::hooks] @@ -162,6 +163,7 @@ mod tests { type DbWeight = (); type SS58Prefix = (); type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; } parameter_types! { diff --git a/bridges/modules/token-swap/src/benchmarking.rs b/bridges/modules/token-swap/src/benchmarking.rs index 6ca35f5f3947..c68fb6b64283 100644 --- a/bridges/modules/token-swap/src/benchmarking.rs +++ b/bridges/modules/token-swap/src/benchmarking.rs @@ -23,13 +23,13 @@ use crate::{ }; use bp_token_swap::{TokenSwap, TokenSwapCreation, TokenSwapState, TokenSwapType}; -use codec::Encode; +use codec::{Decode, Encode}; use frame_benchmarking::{account, benchmarks_instance_pallet}; use frame_support::{traits::Currency, Parameter}; use frame_system::RawOrigin; use sp_core::H256; use sp_io::hashing::blake2_256; -use sp_runtime::traits::Bounded; +use sp_runtime::traits::{Bounded, TrailingZeroInput}; use sp_std::{boxed::Box, vec::Vec}; const SEED: u32 = 0; @@ -43,8 +43,8 @@ pub trait Config: crate::Config { benchmarks_instance_pallet! { where_clause { where - BridgedAccountPublicOf: Default + Parameter, - BridgedAccountSignatureOf: Default, + BridgedAccountPublicOf: Decode + Parameter, + BridgedAccountSignatureOf: Decode, } // @@ -138,8 +138,8 @@ fn test_swap_hash, I: 'static>(sender: T::AccountId, is_create: boo /// Returns test token swap creation params. fn test_swap_creation, I: 'static>() -> TokenSwapCreationOf where - BridgedAccountPublicOf: Default, - BridgedAccountSignatureOf: Default, + BridgedAccountPublicOf: Decode, + BridgedAccountSignatureOf: Decode, { TokenSwapCreation { target_public_at_bridged_chain: target_public_at_bridged_chain::(), @@ -176,20 +176,22 @@ fn target_balance_to_swap, I: 'static>() -> BridgedBalanceOf /// Public key of `target_account_at_bridged_chain`. fn target_public_at_bridged_chain, I: 'static>() -> BridgedAccountPublicOf where - BridgedAccountPublicOf: Default, + BridgedAccountPublicOf: Decode, { - Default::default() + BridgedAccountPublicOf::::decode(&mut TrailingZeroInput::zeroes()) + .expect("failed to decode `BridgedAccountPublicOf` from zeroes") } /// Signature of `target_account_at_bridged_chain` over message. fn bridged_currency_transfer_signature, I: 'static>() -> BridgedAccountSignatureOf where - BridgedAccountSignatureOf: Default, + BridgedAccountSignatureOf: Decode, { - Default::default() + BridgedAccountSignatureOf::::decode(&mut TrailingZeroInput::zeroes()) + .expect("failed to decode `BridgedAccountSignatureOf` from zeroes") } /// Account at the bridged chain that is participating in the swap. fn target_account_at_bridged_chain, I: 'static>() -> BridgedAccountIdOf { - Default::default() + account("target_account_at_bridged_chain", 0, SEED) } diff --git a/bridges/modules/token-swap/src/lib.rs b/bridges/modules/token-swap/src/lib.rs index 59db89b6fd51..32fd2db3c7cb 100644 --- a/bridges/modules/token-swap/src/lib.rs +++ b/bridges/modules/token-swap/src/lib.rs @@ -179,6 +179,7 @@ pub mod pallet { #[pallet::pallet] #[pallet::generate_store(pub(super) trait Store)] + #[pallet::without_storage_info] pub struct Pallet(PhantomData<(T, I)>); #[pallet::hooks] diff --git a/bridges/modules/token-swap/src/mock.rs b/bridges/modules/token-swap/src/mock.rs index 2c24e282af62..78b8a3381d3a 100644 --- a/bridges/modules/token-swap/src/mock.rs +++ b/bridges/modules/token-swap/src/mock.rs @@ -91,6 +91,7 @@ impl frame_system::Config for TestRuntime { type DbWeight = (); type SS58Prefix = (); type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; } frame_support::parameter_types! { diff --git a/bridges/primitives/chain-kusama/src/lib.rs b/bridges/primitives/chain-kusama/src/lib.rs index 0f25ac710de6..3fa3993a98a1 100644 --- a/bridges/primitives/chain-kusama/src/lib.rs +++ b/bridges/primitives/chain-kusama/src/lib.rs @@ -41,6 +41,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_version: 0, apis: sp_version::create_apis_vec![[]], transaction_version: 5, + state_version: 0, }; // NOTE: This needs to be kept up to date with the Kusama runtime found in the Polkadot repo. diff --git a/bridges/primitives/chain-millau/src/lib.rs b/bridges/primitives/chain-millau/src/lib.rs index 2e671e901c36..d83b4ea433a7 100644 --- a/bridges/primitives/chain-millau/src/lib.rs +++ b/bridges/primitives/chain-millau/src/lib.rs @@ -30,13 +30,13 @@ use frame_support::{ }; use frame_system::limits; use scale_info::TypeInfo; -use sp_core::Hasher as HasherT; +use sp_core::{storage::StateVersion, Hasher as HasherT}; use sp_runtime::{ traits::{Convert, IdentifyAccount, Verify}, MultiSignature, MultiSigner, Perbill, }; use sp_std::prelude::*; -use sp_trie::{trie_types::Layout, TrieConfiguration}; +use sp_trie::{LayoutV0, LayoutV1, TrieConfiguration}; #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; @@ -206,12 +206,18 @@ impl sp_core::Hasher for BlakeTwoAndKeccak256 { impl sp_runtime::traits::Hash for BlakeTwoAndKeccak256 { type Output = MillauHash; - fn trie_root(input: Vec<(Vec, Vec)>) -> Self::Output { - Layout::::trie_root(input) + fn trie_root(input: Vec<(Vec, Vec)>, state_version: StateVersion) -> Self::Output { + match state_version { + StateVersion::V0 => LayoutV0::::trie_root(input), + StateVersion::V1 => LayoutV1::::trie_root(input), + } } - fn ordered_trie_root(input: Vec>) -> Self::Output { - Layout::::ordered_trie_root(input) + fn ordered_trie_root(input: Vec>, state_version: StateVersion) -> Self::Output { + match state_version { + StateVersion::V0 => LayoutV0::::ordered_trie_root(input), + StateVersion::V1 => LayoutV1::::ordered_trie_root(input), + } } } @@ -340,9 +346,9 @@ mod tests { #[test] fn maximal_account_size_does_not_overflow_constant() { assert!( - MAXIMAL_ENCODED_ACCOUNT_ID_SIZE as usize >= AccountId::default().encode().len(), + MAXIMAL_ENCODED_ACCOUNT_ID_SIZE as usize >= AccountId::from([0u8; 32]).encode().len(), "Actual maximal size of encoded AccountId ({}) overflows expected ({})", - AccountId::default().encode().len(), + AccountId::from([0u8; 32]).encode().len(), MAXIMAL_ENCODED_ACCOUNT_ID_SIZE, ); } diff --git a/bridges/primitives/chain-polkadot/src/lib.rs b/bridges/primitives/chain-polkadot/src/lib.rs index 19cf1a797062..31141a25dcf0 100644 --- a/bridges/primitives/chain-polkadot/src/lib.rs +++ b/bridges/primitives/chain-polkadot/src/lib.rs @@ -41,6 +41,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_version: 0, apis: sp_version::create_apis_vec![[]], transaction_version: 7, + state_version: 0, }; // NOTE: This needs to be kept up to date with the Polkadot runtime found in the Polkadot repo. diff --git a/bridges/primitives/chain-rialto/src/lib.rs b/bridges/primitives/chain-rialto/src/lib.rs index c6cb1bceb87f..0adb703c1367 100644 --- a/bridges/primitives/chain-rialto/src/lib.rs +++ b/bridges/primitives/chain-rialto/src/lib.rs @@ -312,9 +312,9 @@ mod tests { #[test] fn maximal_account_size_does_not_overflow_constant() { assert!( - MAXIMAL_ENCODED_ACCOUNT_ID_SIZE as usize >= AccountId::default().encode().len(), + MAXIMAL_ENCODED_ACCOUNT_ID_SIZE as usize >= AccountId::from([0u8; 32]).encode().len(), "Actual maximal size of encoded AccountId ({}) overflows expected ({})", - AccountId::default().encode().len(), + AccountId::from([0u8; 32]).encode().len(), MAXIMAL_ENCODED_ACCOUNT_ID_SIZE, ); } diff --git a/bridges/primitives/chain-rococo/src/lib.rs b/bridges/primitives/chain-rococo/src/lib.rs index d485e916cf82..9a7ac9da67da 100644 --- a/bridges/primitives/chain-rococo/src/lib.rs +++ b/bridges/primitives/chain-rococo/src/lib.rs @@ -48,6 +48,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_version: 0, apis: sp_version::create_apis_vec![[]], transaction_version: 0, + state_version: 0, }; // NOTE: This needs to be kept up to date with the Rococo runtime found in the Polkadot repo. diff --git a/bridges/primitives/chain-westend/src/lib.rs b/bridges/primitives/chain-westend/src/lib.rs index 68bc22c7cdcb..91f4a61e47e8 100644 --- a/bridges/primitives/chain-westend/src/lib.rs +++ b/bridges/primitives/chain-westend/src/lib.rs @@ -59,6 +59,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_version: 0, apis: sp_version::create_apis_vec![[]], transaction_version: 5, + state_version: 0, }; /// Westend Runtime `Call` enum. diff --git a/bridges/primitives/header-chain/tests/justification.rs b/bridges/primitives/header-chain/tests/justification.rs index 85846c6d50f9..5b4981a0f69a 100644 --- a/bridges/primitives/header-chain/tests/justification.rs +++ b/bridges/primitives/header-chain/tests/justification.rs @@ -136,7 +136,8 @@ fn justification_with_invalid_commit_rejected() { #[test] fn justification_with_invalid_authority_signature_rejected() { let mut justification = make_default_justification::(&test_header(1)); - justification.commit.precommits[0].signature = Default::default(); + justification.commit.precommits[0].signature = + sp_core::crypto::UncheckedFrom::unchecked_from([1u8; 64]); assert_eq!( verify_justification::( diff --git a/bridges/primitives/polkadot-core/src/lib.rs b/bridges/primitives/polkadot-core/src/lib.rs index 8be9cc17daca..50e842343740 100644 --- a/bridges/primitives/polkadot-core/src/lib.rs +++ b/bridges/primitives/polkadot-core/src/lib.rs @@ -33,7 +33,8 @@ use scale_info::{StaticTypeInfo, TypeInfo}; use sp_core::Hasher as HasherT; use sp_runtime::{ generic, - traits::{BlakeTwo256, IdentifyAccount, Verify}, + traits::{BlakeTwo256, DispatchInfoOf, IdentifyAccount, Verify}, + transaction_validity::TransactionValidityError, MultiAddress, MultiSignature, OpaqueExtrinsic, }; use sp_std::prelude::Vec; @@ -332,6 +333,16 @@ where ) -> Result { Ok(self.additional_signed) } + + fn pre_dispatch( + self, + who: &Self::AccountId, + call: &Self::Call, + info: &DispatchInfoOf, + len: usize, + ) -> Result { + Ok(self.validate(who, call, info, len).map(|_| ())?) + } } /// Polkadot-like chain. @@ -399,7 +410,7 @@ mod tests { #[test] fn maximal_encoded_account_id_size_is_correct() { - let actual_size = AccountId::default().encode().len(); + let actual_size = AccountId::from([0u8; 32]).encode().len(); assert!( actual_size <= MAXIMAL_ENCODED_ACCOUNT_ID_SIZE as usize, "Actual size of encoded account id for Polkadot-like chains ({}) is larger than expected {}", diff --git a/bridges/primitives/runtime/src/chain.rs b/bridges/primitives/runtime/src/chain.rs index 9dfe6216a7ca..30e754b5702f 100644 --- a/bridges/primitives/runtime/src/chain.rs +++ b/bridges/primitives/runtime/src/chain.rs @@ -83,13 +83,7 @@ pub trait Chain: Send + Sync + 'static { + MaybeSerializeDeserialize; /// The user account identifier type for the runtime. - type AccountId: Parameter - + Member - + MaybeSerializeDeserialize - + Debug - + MaybeDisplay - + Ord - + Default; + type AccountId: Parameter + Member + MaybeSerializeDeserialize + Debug + MaybeDisplay + Ord; /// Balance of an account in native tokens. /// /// The chain may support multiple tokens, but this particular type is for token that is used diff --git a/bridges/primitives/runtime/src/storage_proof.rs b/bridges/primitives/runtime/src/storage_proof.rs index 9cc5b48ebd91..177b0f8664e4 100644 --- a/bridges/primitives/runtime/src/storage_proof.rs +++ b/bridges/primitives/runtime/src/storage_proof.rs @@ -19,7 +19,7 @@ use hash_db::{HashDB, Hasher, EMPTY_PREFIX}; use sp_runtime::RuntimeDebug; use sp_std::vec::Vec; -use sp_trie::{read_trie_value, Layout, MemoryDB, StorageProof}; +use sp_trie::{read_trie_value, LayoutV1, MemoryDB, StorageProof}; /// This struct is used to read storage values from a subset of a Merklized database. The "proof" /// is a subset of the nodes in the Merkle structure of the database, so that it provides @@ -52,7 +52,8 @@ where /// Reads a value from the available subset of storage. If the value cannot be read due to an /// incomplete or otherwise invalid proof, this returns an error. pub fn read_value(&self, key: &[u8]) -> Result>, Error> { - read_trie_value::, _>(&self.db, &self.root, key) + // LayoutV1 or LayoutV0 is identical for proof that only read values. + read_trie_value::, _>(&self.db, &self.root, key) .map_err(|_| Error::StorageValueUnavailable) } } @@ -70,15 +71,20 @@ pub enum Error { pub fn craft_valid_storage_proof() -> (sp_core::H256, StorageProof) { use sp_state_machine::{backend::Backend, prove_read, InMemoryBackend}; + let state_version = sp_runtime::StateVersion::default(); + // construct storage proof - let backend = >::from(vec![ - (None, vec![(b"key1".to_vec(), Some(b"value1".to_vec()))]), - (None, vec![(b"key2".to_vec(), Some(b"value2".to_vec()))]), - (None, vec![(b"key3".to_vec(), Some(b"value3".to_vec()))]), - // Value is too big to fit in a branch node - (None, vec![(b"key11".to_vec(), Some(vec![0u8; 32]))]), - ]); - let root = backend.storage_root(std::iter::empty()).0; + let backend = >::from(( + vec![ + (None, vec![(b"key1".to_vec(), Some(b"value1".to_vec()))]), + (None, vec![(b"key2".to_vec(), Some(b"value2".to_vec()))]), + (None, vec![(b"key3".to_vec(), Some(b"value3".to_vec()))]), + // Value is too big to fit in a branch node + (None, vec![(b"key11".to_vec(), Some(vec![0u8; 32]))]), + ], + state_version, + )); + let root = backend.storage_root(std::iter::empty(), state_version).0; let proof = StorageProof::new( prove_read(backend, &[&b"key1"[..], &b"key2"[..], &b"key22"[..]]) .unwrap() diff --git a/bridges/primitives/test-utils/src/keyring.rs b/bridges/primitives/test-utils/src/keyring.rs index 059d6eb5be4f..2436d7933923 100644 --- a/bridges/primitives/test-utils/src/keyring.rs +++ b/bridges/primitives/test-utils/src/keyring.rs @@ -19,7 +19,6 @@ use codec::Encode; use ed25519_dalek::{Keypair, PublicKey, SecretKey, Signature}; use finality_grandpa::voter_set::VoterSet; -use sp_application_crypto::Public; use sp_finality_grandpa::{AuthorityId, AuthorityList, AuthorityWeight}; use sp_runtime::RuntimeDebug; use sp_std::prelude::*; @@ -70,7 +69,7 @@ impl Account { impl From for AuthorityId { fn from(p: Account) -> Self { - AuthorityId::from_slice(&p.public().to_bytes()) + sp_application_crypto::UncheckedFrom::unchecked_from(p.public().to_bytes()) } } diff --git a/bridges/relays/bin-substrate/src/cli/encode_call.rs b/bridges/relays/bin-substrate/src/cli/encode_call.rs index b409cf383ed7..707e78378302 100644 --- a/bridges/relays/bin-substrate/src/cli/encode_call.rs +++ b/bridges/relays/bin-substrate/src/cli/encode_call.rs @@ -343,7 +343,7 @@ mod tests { // then assert!(format!("{:?}", call_hex).starts_with( - "0x0f030000000001000000381409000000000001d43593c715fdd31c61141abd04a99fd6822c8558854cc\ + "0x0f030000000001000000000000000000000001d43593c715fdd31c61141abd04a99fd6822c8558854cc\ de39a5684e7a56da27d01d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d01" )) } diff --git a/bridges/relays/bin-substrate/src/cli/encode_message.rs b/bridges/relays/bin-substrate/src/cli/encode_message.rs index 98e1269aa68e..ee77fc4a46ef 100644 --- a/bridges/relays/bin-substrate/src/cli/encode_message.rs +++ b/bridges/relays/bin-substrate/src/cli/encode_message.rs @@ -106,6 +106,6 @@ mod tests { let hex = encode_message.encode().unwrap(); // then - assert_eq!(format!("{:?}", hex), "0x0100000010f108000000000002d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d003c000130000000000000000000000000"); + assert_eq!(format!("{:?}", hex), "0x01000000000000000000000002d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d003c000130000000000000000000000000"); } } diff --git a/bridges/relays/bin-substrate/src/cli/send_message.rs b/bridges/relays/bin-substrate/src/cli/send_message.rs index 2d81576de3dd..e3597f766b74 100644 --- a/bridges/relays/bin-substrate/src/cli/send_message.rs +++ b/bridges/relays/bin-substrate/src/cli/send_message.rs @@ -324,7 +324,7 @@ mod tests { payload, MessagePayload { spec_version: relay_millau_client::Millau::RUNTIME_VERSION.spec_version, - weight: 576000, + weight: 0, origin: CallOrigin::SourceAccount( sp_keyring::AccountKeyring::Alice.to_account_id() ), @@ -366,7 +366,7 @@ mod tests { payload, MessagePayload { spec_version: relay_millau_client::Millau::RUNTIME_VERSION.spec_version, - weight: 576000, + weight: 0, origin: CallOrigin::TargetAccount( sp_keyring::AccountKeyring::Alice.to_account_id(), sp_keyring::AccountKeyring::Bob.into(), diff --git a/bridges/relays/lib-substrate-relay/src/messages_target.rs b/bridges/relays/lib-substrate-relay/src/messages_target.rs index f973cef89735..5336e065a92b 100644 --- a/bridges/relays/lib-substrate-relay/src/messages_target.rs +++ b/bridges/relays/lib-substrate-relay/src/messages_target.rs @@ -290,7 +290,7 @@ where &self.transaction_params, HeaderId(Default::default(), Default::default()), Zero::zero(), - Default::default(), + self.relayer_id_at_source.clone(), nonces.clone(), prepare_dummy_messages_proof::( nonces.clone(), @@ -332,7 +332,7 @@ where &self.transaction_params, HeaderId(Default::default(), Default::default()), Zero::zero(), - Default::default(), + self.relayer_id_at_source.clone(), nonces.clone(), prepare_dummy_messages_proof::( nonces.clone(),