Skip to content

Commit

Permalink
Bump polkadot/substrate (#2134)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
bkontur authored May 16, 2023
1 parent 9233f0a commit 0f6091d
Show file tree
Hide file tree
Showing 15 changed files with 1,253 additions and 1,147 deletions.
2,301 changes: 1,191 additions & 1,110 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions bin/millau/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
23 changes: 11 additions & 12 deletions bin/millau/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -194,17 +194,18 @@ 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.
let grandpa_protocol_name = sc_consensus_grandpa::protocol_standard_name(
&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());
Expand All @@ -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(),
Expand All @@ -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(),
Expand Down
1 change: 1 addition & 0 deletions bin/millau/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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! {
Expand Down
2 changes: 2 additions & 0 deletions bin/millau/runtime/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 6 additions & 2 deletions bin/rialto-parachain/node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}
}
22 changes: 5 additions & 17 deletions bin/rialto-parachain/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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>>> {
Expand Down
8 changes: 6 additions & 2 deletions bin/rialto-parachain/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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(&parachain_config.network);

let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =
sc_service::build_network(sc_service::BuildNetworkParams {
config: &parachain_config,
net_config,
client: client.clone(),
transaction_pool: transaction_pool.clone(),
spawn_handle: task_manager.spawn_handle(),
Expand Down Expand Up @@ -333,7 +335,7 @@ where
&task_manager,
relay_chain_interface.clone(),
transaction_pool,
sync_service,
sync_service.clone(),
params.keystore_container.keystore(),
force_authoring,
)?;
Expand All @@ -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?;
Expand All @@ -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)?;
Expand Down
3 changes: 3 additions & 0 deletions bin/rialto-parachain/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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! {
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion bin/rialto/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" ] }
Expand Down
4 changes: 2 additions & 2 deletions bin/rialto/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
);
Expand All @@ -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),
);
Expand Down
1 change: 1 addition & 0 deletions bin/rialto/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions bin/rialto/runtime/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
21 changes: 20 additions & 1 deletion primitives/header-chain/src/justification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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.
///
Expand Down
1 change: 1 addition & 0 deletions scripts/verify-pallets-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ cargo check -p pallet-bridge-relayers --features runtime-benchmarks
cargo check -p pallet-bridge-relayers --features try-runtime
cargo check -p bridge-runtime-common
cargo check -p bridge-runtime-common --features runtime-benchmarks
cargo check -p bridge-runtime-common --features integrity-test

# we're removing lock file after all chechs are done. Otherwise we may use different
# Substrate/Polkadot/Cumulus commits and our checks will fail
Expand Down

0 comments on commit 0f6091d

Please sign in to comment.