From 4330d0491c11e6bddd68ecf9da889fe2e99efa28 Mon Sep 17 00:00:00 2001 From: Branislav Kontur <bkontur@gmail.com> Date: Tue, 16 May 2023 16:46:21 +0200 Subject: [PATCH] Bump polkadot/substrate (#2134) * Bump polkadot/substrate * Fix millau network service * Fix polkadot_node_core_pvf_worker * Fix sc-network * Fix parachain rpc stuff * Check `integrity-test` for `bridge-runtime-common` * Backport fix from cumulus https://github.com/paritytech/cumulus/pull/2585/files#diff-5a942d80670b5ef31bb18b5acacab93ff30512d7cd21c19d7da364f76f6bb5c3 because of https://gitlab.parity.io/parity/mirrors/cumulus/-/jobs/2842938 * TODO * Bump cumulus --- bridges/bin/millau/node/Cargo.toml | 1 + bridges/bin/millau/node/src/service.rs | 23 +++++++++---------- bridges/bin/millau/runtime/src/lib.rs | 1 + bridges/bin/millau/runtime/src/xcm_config.rs | 2 ++ bridges/bin/rialto-parachain/node/src/cli.rs | 8 +++++-- .../bin/rialto-parachain/node/src/command.rs | 22 ++++-------------- .../bin/rialto-parachain/node/src/service.rs | 8 +++++-- .../bin/rialto-parachain/runtime/src/lib.rs | 3 +++ bridges/bin/rialto/node/Cargo.toml | 2 +- bridges/bin/rialto/node/src/command.rs | 4 ++-- bridges/bin/rialto/runtime/src/lib.rs | 1 + bridges/bin/rialto/runtime/src/xcm_config.rs | 2 ++ .../header-chain/src/justification.rs | 21 ++++++++++++++++- 13 files changed, 61 insertions(+), 37 deletions(-) diff --git a/bridges/bin/millau/node/Cargo.toml b/bridges/bin/millau/node/Cargo.toml index 3b64f98fa53..6710c6a217f 100644 --- a/bridges/bin/millau/node/Cargo.toml +++ b/bridges/bin/millau/node/Cargo.toml @@ -36,6 +36,7 @@ sc-executor = { git = "https://github.com/paritytech/substrate", branch = "maste sc-consensus-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-consensus-grandpa-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-service = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/bridges/bin/millau/node/src/service.rs b/bridges/bin/millau/node/src/service.rs index 07cd29a0d6d..3f0bc2536be 100644 --- a/bridges/bin/millau/node/src/service.rs +++ b/bridges/bin/millau/node/src/service.rs @@ -178,7 +178,7 @@ pub fn new_partial( } /// Builds a new service for a full client. -pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError> { +pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> { use sc_network_common::sync::warp::WarpSyncParams; let sc_service::PartialComponents { @@ -194,6 +194,8 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError> let genesis_hash = client.block_hash(0).ok().flatten().expect("Genesis block exists; qed"); + let mut net_config = sc_network::config::FullNetworkConfiguration::new(&config.network); + // 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. @@ -201,10 +203,9 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError> &client.block_hash(0).ok().flatten().expect("Genesis block exists; qed"), &config.chain_spec, ); - config - .network - .extra_sets - .push(sc_consensus_grandpa::grandpa_peers_set_config(grandpa_protocol_name.clone())); + net_config.add_notification_protocol(sc_consensus_grandpa::grandpa_peers_set_config( + grandpa_protocol_name.clone(), + )); let beefy_gossip_proto_name = sc_consensus_beefy::gossip_protocol_name(genesis_hash, config.chain_spec.fork_id()); @@ -217,13 +218,10 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError> client.clone(), config.prometheus_registry().cloned(), ); - config - .network - .extra_sets - .push(sc_consensus_beefy::communication::beefy_peers_set_config( - beefy_gossip_proto_name.clone(), - )); - config.network.request_response_protocols.push(beefy_req_resp_cfg); + net_config.add_notification_protocol( + sc_consensus_beefy::communication::beefy_peers_set_config(beefy_gossip_proto_name.clone()), + ); + net_config.add_request_response_protocol(beefy_req_resp_cfg); let warp_sync = Arc::new(sc_consensus_grandpa::warp_proof::NetworkProvider::new( backend.clone(), @@ -234,6 +232,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError> let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) = sc_service::build_network(sc_service::BuildNetworkParams { config: &config, + net_config, client: client.clone(), transaction_pool: transaction_pool.clone(), spawn_handle: task_manager.spawn_handle(), diff --git a/bridges/bin/millau/runtime/src/lib.rs b/bridges/bin/millau/runtime/src/lib.rs index ad424f5cae6..887d516248b 100644 --- a/bridges/bin/millau/runtime/src/lib.rs +++ b/bridges/bin/millau/runtime/src/lib.rs @@ -367,6 +367,7 @@ impl pallet_transaction_payment::Config for Runtime { impl pallet_sudo::Config for Runtime { type RuntimeEvent = RuntimeEvent; type RuntimeCall = RuntimeCall; + type WeightInfo = pallet_sudo::weights::SubstrateWeight<Runtime>; } parameter_types! { diff --git a/bridges/bin/millau/runtime/src/xcm_config.rs b/bridges/bin/millau/runtime/src/xcm_config.rs index cabb70f40cc..d6b763b116c 100644 --- a/bridges/bin/millau/runtime/src/xcm_config.rs +++ b/bridges/bin/millau/runtime/src/xcm_config.rs @@ -188,6 +188,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot<AccountId>; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } pub struct ToRialtoOrRialtoParachainSwitchExporter; diff --git a/bridges/bin/rialto-parachain/node/src/cli.rs b/bridges/bin/rialto-parachain/node/src/cli.rs index a003c91113c..77d5bd1ff94 100644 --- a/bridges/bin/rialto-parachain/node/src/cli.rs +++ b/bridges/bin/rialto-parachain/node/src/cli.rs @@ -136,7 +136,11 @@ impl RelayChainCli { ) -> Self { 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::parse_from(relay_chain_args) } + let base_path = para_config.base_path.path().join("rialto-bridge-node"); + Self { + base_path: Some(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 7393b014732..dce14df801b 100644 --- a/bridges/bin/rialto-parachain/node/src/command.rs +++ b/bridges/bin/rialto-parachain/node/src/command.rs @@ -320,14 +320,10 @@ impl DefaultConfigurationValues for RelayChainCli { 30334 } - fn rpc_ws_listen_port() -> u16 { + fn rpc_listen_port() -> u16 { 9945 } - fn rpc_http_listen_port() -> u16 { - 9934 - } - fn prometheus_listen_port() -> u16 { 9616 } @@ -357,16 +353,8 @@ impl CliConfiguration<Self> for RelayChainCli { .or_else(|| self.base_path.clone().map(Into::into))) } - fn rpc_http(&self, default_listen_port: u16) -> Result<Option<SocketAddr>> { - self.base.base.rpc_http(default_listen_port) - } - - fn rpc_ipc(&self) -> Result<Option<String>> { - self.base.base.rpc_ipc() - } - - fn rpc_ws(&self, default_listen_port: u16) -> Result<Option<SocketAddr>> { - self.base.base.rpc_ws(default_listen_port) + fn rpc_addr(&self, default_listen_port: u16) -> Result<Option<SocketAddr>> { + self.base.base.rpc_addr(default_listen_port) } fn prometheus_config( @@ -408,8 +396,8 @@ impl CliConfiguration<Self> for RelayChainCli { self.base.base.rpc_methods() } - fn rpc_ws_max_connections(&self) -> Result<Option<usize>> { - self.base.base.rpc_ws_max_connections() + fn rpc_max_connections(&self) -> Result<u32> { + self.base.base.rpc_max_connections() } fn rpc_cors(&self, is_dev: bool) -> Result<Option<Vec<String>>> { diff --git a/bridges/bin/rialto-parachain/node/src/service.rs b/bridges/bin/rialto-parachain/node/src/service.rs index 24eb94e655d..7e516ed5682 100644 --- a/bridges/bin/rialto-parachain/node/src/service.rs +++ b/bridges/bin/rialto-parachain/node/src/service.rs @@ -45,7 +45,7 @@ use sc_executor::{ HeapAllocStrategy, NativeElseWasmExecutor, NativeExecutionDispatch, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY, }; -use sc_network::NetworkBlock; +use sc_network::{config::FullNetworkConfiguration, NetworkBlock}; use sc_network_sync::SyncingService; use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager}; use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle}; @@ -278,10 +278,12 @@ where let prometheus_registry = parachain_config.prometheus_registry().cloned(); let transaction_pool = params.transaction_pool.clone(); let import_queue_service = params.import_queue.service(); + let net_config = FullNetworkConfiguration::new(¶chain_config.network); let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) = sc_service::build_network(sc_service::BuildNetworkParams { config: ¶chain_config, + net_config, client: client.clone(), transaction_pool: transaction_pool.clone(), spawn_handle: task_manager.spawn_handle(), @@ -333,7 +335,7 @@ where &task_manager, relay_chain_interface.clone(), transaction_pool, - sync_service, + sync_service.clone(), params.keystore_container.keystore(), force_authoring, )?; @@ -353,6 +355,7 @@ where collator_key: collator_key.expect("Command line arguments do not allow this. qed"), relay_chain_slot_duration, recovery_handle: Box::new(overseer_handle), + sync_service, }; start_collator(params).await?; @@ -366,6 +369,7 @@ where relay_chain_slot_duration, import_queue: import_queue_service, recovery_handle: Box::new(overseer_handle), + sync_service, }; start_full_node(params)?; diff --git a/bridges/bin/rialto-parachain/runtime/src/lib.rs b/bridges/bin/rialto-parachain/runtime/src/lib.rs index 32b25b0e0bd..d44ae22e17e 100644 --- a/bridges/bin/rialto-parachain/runtime/src/lib.rs +++ b/bridges/bin/rialto-parachain/runtime/src/lib.rs @@ -322,6 +322,7 @@ impl pallet_transaction_payment::Config for Runtime { impl pallet_sudo::Config for Runtime { type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; + type WeightInfo = pallet_sudo::weights::SubstrateWeight<Runtime>; } parameter_types! { @@ -497,6 +498,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = frame_system::EnsureRoot<AccountId>; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/bridges/bin/rialto/node/Cargo.toml b/bridges/bin/rialto/node/Cargo.toml index 7f28a154263..1a53acf044f 100644 --- a/bridges/bin/rialto/node/Cargo.toml +++ b/bridges/bin/rialto/node/Cargo.toml @@ -33,7 +33,7 @@ sp-consensus-grandpa = { git = "https://github.com/paritytech/substrate", branch sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } # Polkadot Dependencies -polkadot-node-core-pvf = { git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-node-core-pvf-worker = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false, features = [ "full-node", "polkadot-native" ] } diff --git a/bridges/bin/rialto/node/src/command.rs b/bridges/bin/rialto/node/src/command.rs index a21b3a88d2c..8a7178fbd31 100644 --- a/bridges/bin/rialto/node/src/command.rs +++ b/bridges/bin/rialto/node/src/command.rs @@ -164,7 +164,7 @@ pub fn run() -> sc_cli::Result<()> { builder.with_colors(false); let _ = builder.init(); - polkadot_node_core_pvf::prepare_worker_entrypoint( + polkadot_node_core_pvf_worker::prepare_worker_entrypoint( &cmd.socket_path, Some(&cmd.node_impl_version), ); @@ -175,7 +175,7 @@ pub fn run() -> sc_cli::Result<()> { builder.with_colors(false); let _ = builder.init(); - polkadot_node_core_pvf::execute_worker_entrypoint( + polkadot_node_core_pvf_worker::execute_worker_entrypoint( &cmd.socket_path, Some(&cmd.node_impl_version), ); diff --git a/bridges/bin/rialto/runtime/src/lib.rs b/bridges/bin/rialto/runtime/src/lib.rs index 0d2c667efa5..8f45a2a1919 100644 --- a/bridges/bin/rialto/runtime/src/lib.rs +++ b/bridges/bin/rialto/runtime/src/lib.rs @@ -365,6 +365,7 @@ impl pallet_transaction_payment::Config for Runtime { impl pallet_sudo::Config for Runtime { type RuntimeEvent = RuntimeEvent; type RuntimeCall = RuntimeCall; + type WeightInfo = pallet_sudo::weights::SubstrateWeight<Runtime>; } impl pallet_session::Config for Runtime { diff --git a/bridges/bin/rialto/runtime/src/xcm_config.rs b/bridges/bin/rialto/runtime/src/xcm_config.rs index 52c5af635b3..cee246ad67a 100644 --- a/bridges/bin/rialto/runtime/src/xcm_config.rs +++ b/bridges/bin/rialto/runtime/src/xcm_config.rs @@ -184,6 +184,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot<AccountId>; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } #[cfg(test)] diff --git a/bridges/primitives/header-chain/src/justification.rs b/bridges/primitives/header-chain/src/justification.rs index 06ed782763d..8433107fce2 100644 --- a/bridges/primitives/header-chain/src/justification.rs +++ b/bridges/primitives/header-chain/src/justification.rs @@ -38,7 +38,7 @@ use sp_std::{ /// /// This particular proof is used to prove that headers on a bridged chain /// (so not our chain) have been finalized correctly. -#[derive(Encode, Decode, RuntimeDebug, Clone, PartialEq, Eq, TypeInfo)] +#[derive(Encode, Decode, Clone, PartialEq, Eq, TypeInfo)] pub struct GrandpaJustification<Header: HeaderT> { /// The round (voting period) this justification is valid for. pub round: u64, @@ -49,6 +49,25 @@ pub struct GrandpaJustification<Header: HeaderT> { pub votes_ancestries: Vec<Header>, } +// TODO: remove and use `RuntimeDebug` (https://github.com/paritytech/parity-bridges-common/issues/2136) +impl<Header: HeaderT> sp_std::fmt::Debug for GrandpaJustification<Header> { + fn fmt(&self, fmt: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + #[cfg(feature = "std")] + { + fmt.debug_struct("GrandpaJustification") + .field("round", &self.round) + .field("commit", &self.commit) + .field("votes_ancestries", &self.votes_ancestries) + .finish() + } + + #[cfg(not(feature = "std"))] + { + fmt.write_str("<stripped>") + } + } +} + impl<H: HeaderT> GrandpaJustification<H> { /// Returns reasonable size of justification using constants from the provided chain. /// -- GitLab