From 54d3279fc17ba7807ce8bc202c7d30bd2a5ba224 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Tue, 14 Mar 2023 13:03:40 +0100 Subject: [PATCH] Bump substrate/polkadot/cumulus (#1962) * Bump substrate/polkadot/cumulus * sp_finality_grandpa - >sp_consensus_grandpa * sp_beefy -> sp_consensus_beefy * pallet_randomness_collective_flip -> pallet_insecure_randomness_collective_flip * fix * Cumulus parachain stuff * Cumulus parachain stuff one more * Millau/Rialto runtimes * Removed pallet_insecure_randomness_collective_flip * Millau node * Removed session historial * TMP: just try disable all fetches * Docs in gitlab.yml --- bridges/bin/millau/node/Cargo.toml | 13 ++-- bridges/bin/millau/node/src/chain_spec.rs | 4 +- bridges/bin/millau/node/src/service.rs | 65 +++++++++++-------- bridges/bin/millau/runtime/Cargo.toml | 8 +-- bridges/bin/millau/runtime/src/lib.rs | 39 ++++++----- bridges/bin/rialto-parachain/node/Cargo.toml | 1 + .../bin/rialto-parachain/node/src/service.rs | 30 +++++---- .../bin/rialto-parachain/runtime/Cargo.toml | 2 - .../bin/rialto-parachain/runtime/src/lib.rs | 3 - bridges/bin/rialto/node/Cargo.toml | 4 +- bridges/bin/rialto/node/src/chain_spec.rs | 4 +- bridges/bin/rialto/runtime/Cargo.toml | 7 +- bridges/bin/rialto/runtime/src/lib.rs | 61 +++++++++-------- bridges/modules/beefy/Cargo.toml | 2 +- bridges/modules/beefy/src/lib.rs | 2 +- bridges/modules/beefy/src/mock.rs | 4 +- bridges/modules/beefy/src/mock_chain.rs | 4 +- bridges/modules/beefy/src/utils.rs | 2 +- bridges/modules/grandpa/Cargo.toml | 4 +- bridges/modules/grandpa/src/benchmarking.rs | 2 +- bridges/modules/grandpa/src/lib.rs | 14 ++-- bridges/modules/grandpa/src/storage_types.rs | 2 +- bridges/primitives/beefy/Cargo.toml | 4 +- bridges/primitives/beefy/src/lib.rs | 14 ++-- bridges/primitives/header-chain/Cargo.toml | 4 +- .../header-chain/src/justification.rs | 6 +- bridges/primitives/header-chain/src/lib.rs | 4 +- .../tests/implementation_match.rs | 2 +- .../header-chain/tests/justification.rs | 2 +- bridges/primitives/test-utils/Cargo.toml | 4 +- bridges/primitives/test-utils/src/keyring.rs | 2 +- bridges/primitives/test-utils/src/lib.rs | 4 +- .../client-bridge-hub-wococo/Cargo.toml | 2 +- .../src/runtime_wrapper.rs | 2 +- .../src/codegen_runtime.rs | 4 +- bridges/relays/lib-substrate-relay/Cargo.toml | 2 +- .../relays/lib-substrate-relay/src/error.rs | 2 +- .../src/finality/engine.rs | 6 +- 38 files changed, 184 insertions(+), 157 deletions(-) diff --git a/bridges/bin/millau/node/Cargo.toml b/bridges/bin/millau/node/Cargo.toml index bf169ebe40d98..cca94bbe7b10e 100644 --- a/bridges/bin/millau/node/Cargo.toml +++ b/bridges/bin/millau/node/Cargo.toml @@ -19,9 +19,9 @@ millau-runtime = { path = "../runtime" } # Substrate Dependencies -beefy-gadget = { git = "https://github.com/paritytech/substrate", branch = "master" } -beefy-gadget-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-beefy = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-consensus-beefy = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-consensus-beefy-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-consensus-beefy = { git = "https://github.com/paritytech/substrate", branch = "master" } frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master" } frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "master" } node-inspect = { git = "https://github.com/paritytech/substrate", branch = "master" } @@ -33,8 +33,8 @@ sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "mas sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" } -sc-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" } -sc-finality-grandpa-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" } +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-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-service = { git = "https://github.com/paritytech/substrate", branch = "master" } @@ -42,10 +42,11 @@ sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "mast sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-consensus-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master" } substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "master" } [build-dependencies] substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/bridges/bin/millau/node/src/chain_spec.rs b/bridges/bin/millau/node/src/chain_spec.rs index d18634eb9836d..8669ca92cc801 100644 --- a/bridges/bin/millau/node/src/chain_spec.rs +++ b/bridges/bin/millau/node/src/chain_spec.rs @@ -19,10 +19,10 @@ use millau_runtime::{ BridgeRialtoParachainMessagesConfig, BridgeWestendGrandpaConfig, GenesisConfig, GrandpaConfig, SessionConfig, SessionKeys, Signature, SudoConfig, SystemConfig, WASM_BINARY, }; -use sp_beefy::crypto::AuthorityId as BeefyId; use sp_consensus_aura::sr25519::AuthorityId as AuraId; +use sp_consensus_beefy::crypto::AuthorityId as BeefyId; +use sp_consensus_grandpa::AuthorityId as GrandpaId; use sp_core::{sr25519, Pair, Public}; -use sp_finality_grandpa::AuthorityId as GrandpaId; use sp_runtime::traits::{IdentifyAccount, Verify}; /// "Names" of the authorities accounts at local testnet. diff --git a/bridges/bin/millau/node/src/service.rs b/bridges/bin/millau/node/src/service.rs index 8b0bc828957f0..f8e6d34933dd5 100644 --- a/bridges/bin/millau/node/src/service.rs +++ b/bridges/bin/millau/node/src/service.rs @@ -20,8 +20,8 @@ use jsonrpsee::RpcModule; use millau_runtime::{self, opaque::Block, RuntimeApi}; use sc_client_api::BlockBackend; use sc_consensus_aura::{CompatibilityMode, ImportQueueParams, SlotProportion, StartAuraParams}; +use sc_consensus_grandpa::SharedVoterState; pub use sc_executor::NativeElseWasmExecutor; -use sc_finality_grandpa::SharedVoterState; use sc_keystore::LocalKeystore; use sc_service::{error::Error as ServiceError, Configuration, TaskManager}; use sc_telemetry::{Telemetry, TelemetryWorker}; @@ -64,15 +64,15 @@ pub fn new_partial( sc_consensus::DefaultImportQueue, sc_transaction_pool::FullPool, ( - sc_finality_grandpa::GrandpaBlockImport< + sc_consensus_grandpa::GrandpaBlockImport< FullBackend, Block, FullClient, FullSelectChain, >, - sc_finality_grandpa::LinkHalf, - beefy_gadget::BeefyVoterLinks, - beefy_gadget::BeefyRPCLinks, + sc_consensus_grandpa::LinkHalf, + sc_consensus_beefy::BeefyVoterLinks, + sc_consensus_beefy::BeefyRPCLinks, Option, ), >, @@ -123,7 +123,7 @@ pub fn new_partial( client.clone(), ); - let (grandpa_block_import, grandpa_link) = sc_finality_grandpa::block_import( + let (grandpa_block_import, grandpa_link) = sc_consensus_grandpa::block_import( client.clone(), &client, select_chain.clone(), @@ -131,10 +131,11 @@ pub fn new_partial( )?; let (beefy_block_import, beefy_voter_links, beefy_rpc_links) = - beefy_gadget::beefy_block_import_and_links( + sc_consensus_beefy::beefy_block_import_and_links( grandpa_block_import.clone(), backend.clone(), client.clone(), + config.prometheus_registry().cloned(), ); let slot_duration = sc_consensus_aura::slot_duration(&*client)?; @@ -183,6 +184,8 @@ fn remote_keystore(_url: &str) -> Result, &'static str> { /// Builds a new service for a full client. pub fn new_full(mut config: Configuration) -> Result { + use sc_network_common::sync::warp::WarpSyncParams; + let sc_service::PartialComponents { client, backend, @@ -209,38 +212,41 @@ pub fn new_full(mut config: Configuration) -> Result // 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( + 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_finality_grandpa::grandpa_peers_set_config(grandpa_protocol_name.clone())); + .push(sc_consensus_grandpa::grandpa_peers_set_config(grandpa_protocol_name.clone())); let beefy_gossip_proto_name = - beefy_gadget::gossip_protocol_name(genesis_hash, config.chain_spec.fork_id()); + sc_consensus_beefy::gossip_protocol_name(genesis_hash, config.chain_spec.fork_id()); // `beefy_on_demand_justifications_handler` is given to `beefy-gadget` task to be run, // while `beefy_req_resp_cfg` is added to `config.network.request_response_protocols`. let (beefy_on_demand_justifications_handler, beefy_req_resp_cfg) = - beefy_gadget::communication::request_response::BeefyJustifsRequestHandler::new( + sc_consensus_beefy::communication::request_response::BeefyJustifsRequestHandler::new( genesis_hash, config.chain_spec.fork_id(), client.clone(), + config.prometheus_registry().cloned(), ); config .network .extra_sets - .push(beefy_gadget::communication::beefy_peers_set_config(beefy_gossip_proto_name.clone())); + .push(sc_consensus_beefy::communication::beefy_peers_set_config( + beefy_gossip_proto_name.clone(), + )); config.network.request_response_protocols.push(beefy_req_resp_cfg); - let warp_sync = Arc::new(sc_finality_grandpa::warp_proof::NetworkProvider::new( + let warp_sync = Arc::new(sc_consensus_grandpa::warp_proof::NetworkProvider::new( backend.clone(), grandpa_link.shared_authority_set().clone(), Vec::default(), )); - let (network, system_rpc_tx, tx_handler_controller, network_starter) = + let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) = sc_service::build_network(sc_service::BuildNetworkParams { config: &config, client: client.clone(), @@ -248,7 +254,7 @@ pub fn new_full(mut config: Configuration) -> Result spawn_handle: task_manager.spawn_handle(), import_queue, block_announce_validator_builder: None, - warp_sync: Some(warp_sync), + warp_sync_params: Some(WarpSyncParams::WithProvider(warp_sync)), })?; if config.offchain_worker.enabled { @@ -269,12 +275,12 @@ pub fn new_full(mut config: Configuration) -> Result let shared_voter_state = SharedVoterState::empty(); let rpc_extensions_builder = { - use sc_finality_grandpa::FinalityProofProvider as GrandpaFinalityProofProvider; + use sc_consensus_grandpa::FinalityProofProvider as GrandpaFinalityProofProvider; - use beefy_gadget_rpc::{Beefy, BeefyApiServer}; use mmr_rpc::{Mmr, MmrApiServer}; use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; - use sc_finality_grandpa_rpc::{Grandpa, GrandpaApiServer}; + use sc_consensus_beefy_rpc::{Beefy, BeefyApiServer}; + use sc_consensus_grandpa_rpc::{Grandpa, GrandpaApiServer}; use sc_rpc::DenyUnsafe; use substrate_frame_rpc_system::{System, SystemApiServer}; @@ -329,6 +335,7 @@ pub fn new_full(mut config: Configuration) -> Result keystore: keystore_container.sync_keystore(), task_manager: &mut task_manager, transaction_pool: transaction_pool.clone(), + sync_service: sync_service.clone(), rpc_builder: rpc_extensions_builder, backend: backend.clone(), system_rpc_tx, @@ -369,8 +376,8 @@ pub fn new_full(mut config: Configuration) -> Result force_authoring, backoff_authoring_blocks, keystore: keystore_container.sync_keystore(), - sync_oracle: network.clone(), - justification_sync_link: network.clone(), + sync_oracle: sync_service.clone(), + justification_sync_link: sync_service.clone(), block_proposal_slot_portion: SlotProportion::new(2f32 / 3f32), max_block_proposal_slot_portion: None, telemetry: telemetry.as_ref().map(|x| x.handle()), @@ -391,15 +398,16 @@ pub fn new_full(mut config: Configuration) -> Result if role.is_authority() { Some(keystore_container.sync_keystore()) } else { None }; let justifications_protocol_name = beefy_on_demand_justifications_handler.protocol_name(); - let payload_provider = sp_beefy::mmr::MmrRootProvider::new(client.clone()); - let beefy_params = beefy_gadget::BeefyParams { + let payload_provider = sp_consensus_beefy::mmr::MmrRootProvider::new(client.clone()); + let beefy_params = sc_consensus_beefy::BeefyParams { client: client.clone(), backend, payload_provider, runtime: client, key_store: keystore.clone(), - network_params: beefy_gadget::BeefyNetworkParams { + network_params: sc_consensus_beefy::BeefyNetworkParams { network: network.clone(), + sync: sync_service.clone(), gossip_protocol_name: beefy_gossip_proto_name, justifications_protocol_name, _phantom: core::marker::PhantomData::, @@ -414,10 +422,10 @@ pub fn new_full(mut config: Configuration) -> Result task_manager.spawn_essential_handle().spawn_blocking( "beefy-gadget", None, - beefy_gadget::start_beefy_gadget::<_, _, _, _, _, _>(beefy_params), + sc_consensus_beefy::start_beefy_gadget::<_, _, _, _, _, _, _>(beefy_params), ); - let grandpa_config = sc_finality_grandpa::Config { + let grandpa_config = sc_consensus_grandpa::Config { // FIXME #1578 make this available through chainspec gossip_duration: Duration::from_millis(333), justification_period: 512, @@ -436,11 +444,12 @@ pub fn new_full(mut config: Configuration) -> Result // and vote data availability than the observer. The observer has not // been tested extensively yet and having most nodes in a network run it // could lead to finality stalls. - let grandpa_config = sc_finality_grandpa::GrandpaParams { + let grandpa_config = sc_consensus_grandpa::GrandpaParams { config: grandpa_config, link: grandpa_link, network, - voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(), + sync: sync_service, + voting_rule: sc_consensus_grandpa::VotingRulesBuilder::default().build(), prometheus_registry, shared_voter_state, telemetry: telemetry.as_ref().map(|x| x.handle()), @@ -451,7 +460,7 @@ pub fn new_full(mut config: Configuration) -> Result task_manager.spawn_essential_handle().spawn_blocking( "grandpa-voter", None, - sc_finality_grandpa::run_grandpa_voter(grandpa_config)?, + sc_consensus_grandpa::run_grandpa_voter(grandpa_config)?, ); } diff --git a/bridges/bin/millau/runtime/Cargo.toml b/bridges/bin/millau/runtime/Cargo.toml index 07e3e135aca4b..2f828393336f5 100644 --- a/bridges/bin/millau/runtime/Cargo.toml +++ b/bridges/bin/millau/runtime/Cargo.toml @@ -31,7 +31,7 @@ pallet-shift-session-manager = { path = "../../../modules/shift-session-manager" # Substrate Dependencies -sp-beefy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sp-consensus-beefy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } frame-executive = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -43,8 +43,7 @@ pallet-beefy = { git = "https://github.com/paritytech/substrate", branch = "mast pallet-beefy-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = ["historical"]} pallet-sudo = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -80,7 +79,7 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran [features] default = ["std"] std = [ - "sp-beefy/std", + "sp-consensus-beefy/std", "bp-messages/std", "bp-millau/std", "bp-parachains/std", @@ -106,7 +105,6 @@ std = [ "pallet-bridge-relayers/std", "pallet-grandpa/std", "pallet-mmr/std", - "pallet-randomness-collective-flip/std", "pallet-session/std", "pallet-shift-session-manager/std", "pallet-sudo/std", diff --git a/bridges/bin/millau/runtime/src/lib.rs b/bridges/bin/millau/runtime/src/lib.rs index beb2a4063a800..21fff0e564e4c 100644 --- a/bridges/bin/millau/runtime/src/lib.rs +++ b/bridges/bin/millau/runtime/src/lib.rs @@ -41,9 +41,9 @@ use pallet_grandpa::{ }; use pallet_transaction_payment::{FeeDetails, Multiplier, RuntimeDispatchInfo}; use sp_api::impl_runtime_apis; -use sp_beefy::{crypto::AuthorityId as BeefyId, mmr::MmrLeafVersion, ValidatorSet}; use sp_consensus_aura::sr25519::AuthorityId as AuraId; -use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; +use sp_consensus_beefy::{crypto::AuthorityId as BeefyId, mmr::MmrLeafVersion, ValidatorSet}; +use sp_core::OpaqueMetadata; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, traits::{Block as BlockT, IdentityLookup, Keccak256, NumberFor, OpaqueKeys}, @@ -223,8 +223,6 @@ impl frame_system::Config for Runtime { type MaxConsumers = frame_support::traits::ConstU32<16>; } -impl pallet_randomness_collective_flip::Config for Runtime {} - impl pallet_aura::Config for Runtime { type AuthorityId = AuraId; type MaxAuthorities = ConstU32<10>; @@ -234,23 +232,21 @@ impl pallet_aura::Config for Runtime { impl pallet_beefy::Config for Runtime { type BeefyId = BeefyId; type MaxAuthorities = ConstU32<10>; + type MaxSetIdSessionEntries = ConstU64<0>; type OnNewValidatorSet = MmrLeaf; + type WeightInfo = (); + type KeyOwnerProof = sp_core::Void; + type EquivocationReportSystem = (); } impl pallet_grandpa::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type KeyOwnerProofSystem = (); - type KeyOwnerProof = - >::Proof; - type KeyOwnerIdentification = >::IdentificationTuple; - type HandleEquivocation = (); // TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78) type WeightInfo = (); type MaxAuthorities = ConstU32<10>; type MaxSetIdSessionEntries = ConstU64<0>; + type KeyOwnerProof = sp_core::Void; + type EquivocationReportSystem = (); } /// MMR helper types. @@ -292,7 +288,7 @@ parameter_types! { pub struct BeefyDummyDataProvider; -impl sp_beefy::mmr::BeefyDataProvider<()> for BeefyDummyDataProvider { +impl sp_consensus_beefy::mmr::BeefyDataProvider<()> for BeefyDummyDataProvider { fn extra_data() {} } @@ -555,7 +551,6 @@ construct_runtime!( Session: pallet_session::{Pallet, Call, Storage, Event, Config}, Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event}, ShiftSessionManager: pallet_shift_session_manager::{Pallet}, - RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage}, // BEEFY Bridges support. Beefy: pallet_beefy::{Pallet, Storage, Config}, @@ -743,7 +738,7 @@ impl_runtime_apis! { } } - impl sp_beefy::BeefyApi for Runtime { + impl sp_consensus_beefy::BeefyApi for Runtime { fn beefy_genesis() -> Option { Beefy::genesis_block() } @@ -751,6 +746,20 @@ impl_runtime_apis! { fn validator_set() -> Option> { Beefy::validator_set() } + + fn submit_report_equivocation_unsigned_extrinsic( + _equivocation_proof: sp_consensus_beefy::EquivocationProof< + NumberFor, + sp_consensus_beefy::crypto::AuthorityId, + sp_consensus_beefy::crypto::Signature + >, + _key_owner_proof: sp_consensus_beefy::OpaqueKeyOwnershipProof, + ) -> Option<()> { None } + + fn generate_key_ownership_proof( + _set_id: sp_consensus_beefy::ValidatorSetId, + _authority_id: sp_consensus_beefy::crypto::AuthorityId, + ) -> Option { None } } impl pallet_mmr::primitives::MmrApi< diff --git a/bridges/bin/rialto-parachain/node/Cargo.toml b/bridges/bin/rialto-parachain/node/Cargo.toml index c20b7f248cc22..4cdaa93bad0ef 100644 --- a/bridges/bin/rialto-parachain/node/Cargo.toml +++ b/bridges/bin/rialto-parachain/node/Cargo.toml @@ -45,6 +45,7 @@ sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "mas sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-network-sync = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-service = { git = "https://github.com/paritytech/substrate", branch = "master"} diff --git a/bridges/bin/rialto-parachain/node/src/service.rs b/bridges/bin/rialto-parachain/node/src/service.rs index 254340a8ad4cc..7e7fa2ed09be8 100644 --- a/bridges/bin/rialto-parachain/node/src/service.rs +++ b/bridges/bin/rialto-parachain/node/src/service.rs @@ -38,11 +38,12 @@ use cumulus_client_service::{ prepare_node_config, start_collator, start_full_node, StartCollatorParams, StartFullNodeParams, }; use cumulus_primitives_core::ParaId; -use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface}; +use cumulus_relay_chain_interface::RelayChainInterface; use sc_consensus::ImportQueue; // Substrate Imports use sc_executor::{NativeElseWasmExecutor, NativeExecutionDispatch}; -use sc_network::{NetworkBlock, NetworkService}; +use sc_network::NetworkBlock; +use sc_network_sync::SyncingService; use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager}; use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle}; use sp_api::ConstructRuntimeApi; @@ -54,7 +55,6 @@ use substrate_prometheus_endpoint::Registry; type BlockNumber = u32; type Header = sp_runtime::generic::Header; pub type Block = sp_runtime::generic::Block; -type Hash = sp_core::H256; type ParachainClient = TFullClient>; @@ -236,7 +236,7 @@ where &TaskManager, Arc, Arc>>, - Arc>, + Arc>, SyncCryptoStorePtr, bool, ) -> Result>, sc_service::Error>, @@ -257,10 +257,7 @@ where None, ) .await - .map_err(|e| match e { - RelayChainError::ServiceError(polkadot_service::Error::Sub(x)) => x, - s => s.to_string().into(), - })?; + .map_err(|e| sc_service::Error::Application(Box::new(e) as Box<_>))?; let client = params.client.clone(); let backend = params.backend.clone(); @@ -272,7 +269,7 @@ where let transaction_pool = params.transaction_pool.clone(); let import_queue_service = params.import_queue.service(); - let (network, system_rpc_tx, tx_handler_controller, start_network) = + let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) = sc_service::build_network(sc_service::BuildNetworkParams { config: ¶chain_config, client: client.clone(), @@ -282,7 +279,7 @@ where block_announce_validator_builder: Some(Box::new(|_| { Box::new(block_announce_validator) })), - warp_sync: None, + warp_sync_params: None, })?; let rpc_client = client.clone(); @@ -300,18 +297,23 @@ where keystore: params.keystore_container.sync_keystore(), backend: backend.clone(), network: network.clone(), + sync_service: sync_service.clone(), system_rpc_tx, tx_handler_controller, telemetry: telemetry.as_mut(), })?; let announce_block = { - let network = network.clone(); - Arc::new(move |hash, data| network.announce_block(hash, data)) + let sync_service = sync_service.clone(); + Arc::new(move |hash, data| sync_service.announce_block(hash, data)) }; let relay_chain_slot_duration = Duration::from_secs(6); + let overseer_handle = relay_chain_interface + .overseer_handle() + .map_err(|e| sc_service::Error::Application(Box::new(e)))?; + if validator { let parachain_consensus = build_consensus( client.clone(), @@ -321,7 +323,7 @@ where &task_manager, relay_chain_interface.clone(), transaction_pool, - network, + sync_service, params.keystore_container.sync_keystore(), force_authoring, )?; @@ -340,6 +342,7 @@ where import_queue: import_queue_service, collator_key: collator_key.expect("Command line arguments do not allow this. qed"), relay_chain_slot_duration, + recovery_handle: Box::new(overseer_handle), }; start_collator(params).await?; @@ -352,6 +355,7 @@ where relay_chain_interface, relay_chain_slot_duration, import_queue: import_queue_service, + recovery_handle: Box::new(overseer_handle), }; start_full_node(params)?; diff --git a/bridges/bin/rialto-parachain/runtime/Cargo.toml b/bridges/bin/rialto-parachain/runtime/Cargo.toml index b91e1cd2751a3..ec8955e7fd1b0 100644 --- a/bridges/bin/rialto-parachain/runtime/Cargo.toml +++ b/bridges/bin/rialto-parachain/runtime/Cargo.toml @@ -52,7 +52,6 @@ frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate" ## Substrate Pallet Dependencies pallet-aura = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-sudo = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -116,7 +115,6 @@ std = [ "pallet-bridge-grandpa/std", "pallet-bridge-messages/std", "pallet-bridge-relayers/std", - "pallet-randomness-collective-flip/std", "pallet-timestamp/std", "pallet-sudo/std", "pallet-transaction-payment/std", diff --git a/bridges/bin/rialto-parachain/runtime/src/lib.rs b/bridges/bin/rialto-parachain/runtime/src/lib.rs index 593c7b21228d5..d8e087c5a6a9e 100644 --- a/bridges/bin/rialto-parachain/runtime/src/lib.rs +++ b/bridges/bin/rialto-parachain/runtime/src/lib.rs @@ -302,8 +302,6 @@ impl parachain_info::Config for Runtime {} impl cumulus_pallet_aura_ext::Config for Runtime {} -impl pallet_randomness_collective_flip::Config for Runtime {} - parameter_types! { pub const RelayLocation: MultiLocation = MultiLocation::parent(); pub const RelayNetwork: NetworkId = CustomNetworkId::Rialto.as_network_id(); @@ -588,7 +586,6 @@ construct_runtime!( System: frame_system::{Pallet, Call, Storage, Config, Event}, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, Sudo: pallet_sudo::{Pallet, Call, Storage, Config, Event}, - RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage}, TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event}, ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event} = 20, diff --git a/bridges/bin/rialto/node/Cargo.toml b/bridges/bin/rialto/node/Cargo.toml index 5d68714235b22..be83e02424aa2 100644 --- a/bridges/bin/rialto/node/Cargo.toml +++ b/bridges/bin/rialto/node/Cargo.toml @@ -18,7 +18,7 @@ rialto-runtime = { path = "../runtime" } # Substrate Dependencies -sp-beefy = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-consensus-beefy = { git = "https://github.com/paritytech/substrate", branch = "master" } frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master" } frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "master" } frame-support = { git = "https://github.com/paritytech/substrate", branch = "master" } @@ -29,7 +29,7 @@ sc-service = { git = "https://github.com/paritytech/substrate", branch = "master sp-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-consensus-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } # Polkadot Dependencies diff --git a/bridges/bin/rialto/node/src/chain_spec.rs b/bridges/bin/rialto/node/src/chain_spec.rs index cfc0ed62e1061..c51ca1197f61c 100644 --- a/bridges/bin/rialto/node/src/chain_spec.rs +++ b/bridges/bin/rialto/node/src/chain_spec.rs @@ -23,10 +23,10 @@ use rialto_runtime::{ }; use serde_json::json; use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; -use sp_beefy::crypto::AuthorityId as BeefyId; use sp_consensus_babe::AuthorityId as BabeId; +use sp_consensus_beefy::crypto::AuthorityId as BeefyId; +use sp_consensus_grandpa::AuthorityId as GrandpaId; use sp_core::{sr25519, Pair, Public}; -use sp_finality_grandpa::AuthorityId as GrandpaId; use sp_runtime::traits::{IdentifyAccount, Verify}; /// "Names" of the authorities accounts at local testnet. diff --git a/bridges/bin/rialto/runtime/Cargo.toml b/bridges/bin/rialto/runtime/Cargo.toml index d5d018fb86414..4f0f64cbc9597 100644 --- a/bridges/bin/rialto/runtime/Cargo.toml +++ b/bridges/bin/rialto/runtime/Cargo.toml @@ -26,7 +26,7 @@ pallet-shift-session-manager = { path = "../../../modules/shift-session-manager" # Substrate Dependencies -sp-beefy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } +sp-consensus-beefy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } frame-executive = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -39,7 +39,7 @@ pallet-beefy = { git = "https://github.com/paritytech/substrate", branch = "mast pallet-beefy-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = ["historical"]} pallet-sudo = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -78,7 +78,7 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran [features] default = ["std"] std = [ - "sp-beefy/std", + "sp-consensus-beefy/std", "bp-messages/std", "bp-millau/std", "bp-relayers/std", @@ -103,6 +103,7 @@ std = [ "pallet-grandpa/std", "pallet-mmr/std", "pallet-xcm/std", + "pallet-session/std", "pallet-shift-session-manager/std", "pallet-sudo/std", "pallet-timestamp/std", diff --git a/bridges/bin/rialto/runtime/src/lib.rs b/bridges/bin/rialto/runtime/src/lib.rs index 9873a6fd85593..9db181e284035 100644 --- a/bridges/bin/rialto/runtime/src/lib.rs +++ b/bridges/bin/rialto/runtime/src/lib.rs @@ -39,8 +39,8 @@ use pallet_grandpa::{ use pallet_transaction_payment::{FeeDetails, Multiplier, RuntimeDispatchInfo}; use sp_api::impl_runtime_apis; use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; -use sp_beefy::{crypto::AuthorityId as BeefyId, mmr::MmrLeafVersion, ValidatorSet}; -use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; +use sp_consensus_beefy::{crypto::AuthorityId as BeefyId, mmr::MmrLeafVersion, ValidatorSet}; +use sp_core::OpaqueMetadata; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, traits::{AccountIdLookup, Block as BlockT, Keccak256, NumberFor, OpaqueKeys}, @@ -225,56 +225,47 @@ parameter_types! { impl pallet_babe::Config for Runtime { type EpochDuration = EpochDuration; type ExpectedBlockTime = ExpectedBlockTime; - type MaxAuthorities = ConstU32<10>; - // session module is the trigger type EpochChangeTrigger = pallet_babe::ExternalTrigger; - // equivocation related configuration - we don't expect any equivocations in our testnets - type KeyOwnerProofSystem = (); - type KeyOwnerProof = >::Proof; - type KeyOwnerIdentification = >::IdentificationTuple; - type HandleEquivocation = (); - type DisabledValidators = (); + type WeightInfo = (); + + type MaxAuthorities = ConstU32<10>; + + // equivocation related configuration - we don't expect any equivocations in our testnets + type KeyOwnerProof = sp_core::Void; + type EquivocationReportSystem = (); } impl pallet_beefy::Config for Runtime { type BeefyId = BeefyId; type MaxAuthorities = ConstU32<10>; + type MaxSetIdSessionEntries = ConstU64<0>; type OnNewValidatorSet = MmrLeaf; + type WeightInfo = (); + type KeyOwnerProof = sp_core::Void; + type EquivocationReportSystem = (); } impl pallet_grandpa::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type MaxAuthorities = ConstU32<10>; - type KeyOwnerProofSystem = (); - type KeyOwnerProof = - >::Proof; - type KeyOwnerIdentification = >::IdentificationTuple; - type HandleEquivocation = (); // TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78) type WeightInfo = (); + type MaxAuthorities = ConstU32<10>; type MaxSetIdSessionEntries = ConstU64<0>; + type KeyOwnerProof = sp_core::Void; + type EquivocationReportSystem = (); } impl pallet_mmr::Config for Runtime { const INDEXING_PREFIX: &'static [u8] = b"mmr"; type Hashing = Keccak256; type Hash = ::Output; + type LeafData = pallet_beefy_mmr::Pallet; type OnNewRoot = pallet_beefy_mmr::DepositBeefyDigest; type WeightInfo = (); - type LeafData = pallet_beefy_mmr::Pallet; } parameter_types! { @@ -296,7 +287,7 @@ parameter_types! { pub struct BeefyDummyDataProvider; -impl sp_beefy::mmr::BeefyDataProvider<()> for BeefyDummyDataProvider { +impl sp_consensus_beefy::mmr::BeefyDataProvider<()> for BeefyDummyDataProvider { fn extra_data() {} } @@ -616,7 +607,7 @@ impl_runtime_apis! { } } - impl sp_beefy::BeefyApi for Runtime { + impl sp_consensus_beefy::BeefyApi for Runtime { fn beefy_genesis() -> Option { Beefy::genesis_block() } @@ -624,6 +615,20 @@ impl_runtime_apis! { fn validator_set() -> Option> { Beefy::validator_set() } + + fn submit_report_equivocation_unsigned_extrinsic( + _equivocation_proof: sp_consensus_beefy::EquivocationProof< + NumberFor, + sp_consensus_beefy::crypto::AuthorityId, + sp_consensus_beefy::crypto::Signature + >, + _key_owner_proof: sp_consensus_beefy::OpaqueKeyOwnershipProof, + ) -> Option<()> { None } + + fn generate_key_ownership_proof( + _set_id: sp_consensus_beefy::ValidatorSetId, + _authority_id: sp_consensus_beefy::crypto::AuthorityId, + ) -> Option { None } } impl pallet_mmr::primitives::MmrApi< diff --git a/bridges/modules/beefy/Cargo.toml b/bridges/modules/beefy/Cargo.toml index 1908bd50c8a27..b50ac723db2a6 100644 --- a/bridges/modules/beefy/Cargo.toml +++ b/bridges/modules/beefy/Cargo.toml @@ -25,7 +25,7 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } [dev-dependencies] -sp-beefy = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-consensus-beefy = { git = "https://github.com/paritytech/substrate", branch = "master" } mmr-lib = { package = "ckb-merkle-mountain-range", version = "0.3.2" } pallet-beefy-mmr = { git = "https://github.com/paritytech/substrate", branch = "master" } pallet-mmr = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/bridges/modules/beefy/src/lib.rs b/bridges/modules/beefy/src/lib.rs index a717acfe914fd..a3a68928bc5bc 100644 --- a/bridges/modules/beefy/src/lib.rs +++ b/bridges/modules/beefy/src/lib.rs @@ -419,7 +419,7 @@ mod tests { use frame_support::{assert_noop, assert_ok, traits::Get}; use mock::*; use mock_chain::*; - use sp_beefy::mmr::BeefyAuthoritySet; + use sp_consensus_beefy::mmr::BeefyAuthoritySet; use sp_runtime::DispatchError; fn next_block() { diff --git a/bridges/modules/beefy/src/mock.rs b/bridges/modules/beefy/src/mock.rs index 551800090f7d5..1ffccc5dfbc5c 100644 --- a/bridges/modules/beefy/src/mock.rs +++ b/bridges/modules/beefy/src/mock.rs @@ -32,7 +32,7 @@ use sp_runtime::{ Perbill, }; -pub use sp_beefy::crypto::{AuthorityId as BeefyId, Pair as BeefyPair}; +pub use sp_consensus_beefy::crypto::{AuthorityId as BeefyId, Pair as BeefyPair}; use sp_core::crypto::Wraps; use sp_runtime::traits::Keccak256; @@ -49,7 +49,7 @@ pub type TestBridgedMmrHashing = BridgedMmrHashing; pub type TestBridgedMmrHash = BridgedMmrHash; pub type TestBridgedBeefyMmrLeafExtra = BridgedBeefyMmrLeafExtra; pub type TestBridgedMmrProof = BridgedMmrProof; -pub type TestBridgedRawMmrLeaf = sp_beefy::mmr::MmrLeaf< +pub type TestBridgedRawMmrLeaf = sp_consensus_beefy::mmr::MmrLeaf< TestBridgedBlockNumber, TestBridgedBlockHash, TestBridgedMmrHash, diff --git a/bridges/modules/beefy/src/mock_chain.rs b/bridges/modules/beefy/src/mock_chain.rs index ca7e84b121a95..c736aed074247 100644 --- a/bridges/modules/beefy/src/mock_chain.rs +++ b/bridges/modules/beefy/src/mock_chain.rs @@ -30,7 +30,7 @@ use bp_beefy::{BeefyPayload, Commitment, ValidatorSetId, MMR_ROOT_PAYLOAD_ID}; use codec::Encode; use pallet_mmr::NodeIndex; use rand::Rng; -use sp_beefy::mmr::{BeefyNextAuthoritySet, MmrLeafVersion}; +use sp_consensus_beefy::mmr::{BeefyNextAuthoritySet, MmrLeafVersion}; use sp_core::Pair; use sp_runtime::traits::{Hash, Header as HeaderT}; use std::collections::HashMap; @@ -188,7 +188,7 @@ impl HeaderBuilder { next_validator_keys.iter().map(|pair| pair.public()).collect::>(); let next_validators_mmr_root = get_authorities_mmr_root::(next_validators.iter()); - let leaf = sp_beefy::mmr::MmrLeaf { + let leaf = sp_consensus_beefy::mmr::MmrLeaf { version: MmrLeafVersion::new(1, 0), parent_number_and_hash: (header.number().saturating_sub(1), *header.parent_hash()), beefy_next_authority_set: BeefyNextAuthoritySet { diff --git a/bridges/modules/beefy/src/utils.rs b/bridges/modules/beefy/src/utils.rs index fac9a2c92e6c0..45e14ecbfe0b6 100644 --- a/bridges/modules/beefy/src/utils.rs +++ b/bridges/modules/beefy/src/utils.rs @@ -163,7 +163,7 @@ mod tests { use crate::{mock::*, mock_chain::*, *}; use bp_beefy::{BeefyPayload, MMR_ROOT_PAYLOAD_ID}; use frame_support::{assert_noop, assert_ok}; - use sp_beefy::ValidatorSet; + use sp_consensus_beefy::ValidatorSet; #[test] fn submit_commitment_checks_metadata() { diff --git a/bridges/modules/grandpa/Cargo.toml b/bridges/modules/grandpa/Cargo.toml index 9e260a335379c..095c1d9f4e4b1 100644 --- a/bridges/modules/grandpa/Cargo.toml +++ b/bridges/modules/grandpa/Cargo.toml @@ -22,7 +22,7 @@ bp-header-chain = { path = "../../primitives/header-chain", default-features = f frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sp-consensus-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -48,7 +48,7 @@ std = [ "frame-benchmarking/std", "log/std", "scale-info/std", - "sp-finality-grandpa/std", + "sp-consensus-grandpa/std", "sp-runtime/std", "sp-std/std", "sp-trie/std", diff --git a/bridges/modules/grandpa/src/benchmarking.rs b/bridges/modules/grandpa/src/benchmarking.rs index f79deb7e7527c..5b9faea2a9965 100644 --- a/bridges/modules/grandpa/src/benchmarking.rs +++ b/bridges/modules/grandpa/src/benchmarking.rs @@ -49,7 +49,7 @@ use bp_test_utils::{ }; use frame_benchmarking::{benchmarks_instance_pallet, whitelisted_caller}; use frame_system::RawOrigin; -use sp_finality_grandpa::AuthorityId; +use sp_consensus_grandpa::AuthorityId; use sp_runtime::traits::{One, Zero}; use sp_std::vec::Vec; diff --git a/bridges/modules/grandpa/src/lib.rs b/bridges/modules/grandpa/src/lib.rs index 4304e82eeb103..2b9e49d4c95e1 100644 --- a/bridges/modules/grandpa/src/lib.rs +++ b/bridges/modules/grandpa/src/lib.rs @@ -45,7 +45,7 @@ use bp_header_chain::{ use bp_runtime::{BlockNumberOf, HashOf, HasherOf, HeaderId, HeaderOf, OwnedBridgeModule}; use finality_grandpa::voter_set::VoterSet; use frame_support::{dispatch::PostDispatchInfo, ensure}; -use sp_finality_grandpa::{ConsensusLog, GRANDPA_ENGINE_ID}; +use sp_consensus_grandpa::{ConsensusLog, GRANDPA_ENGINE_ID}; use sp_runtime::{ traits::{Header as HeaderT, Zero}, SaturatedConversion, @@ -403,7 +403,7 @@ pub mod pallet { /// Returned value will indicate if a change was enacted or not. pub(crate) fn try_enact_authority_change, I: 'static>( header: &BridgedHeader, - current_set_id: sp_finality_grandpa::SetId, + current_set_id: sp_consensus_grandpa::SetId, ) -> Result { let mut change_enacted = false; @@ -584,7 +584,7 @@ impl, I: 'static> HeaderChain> for GrandpaChainH pub(crate) fn find_scheduled_change( header: &H, -) -> Option> { +) -> Option> { use sp_runtime::generic::OpaqueDigestItemId; let id = OpaqueDigestItemId::Consensus(&GRANDPA_ENGINE_ID); @@ -603,7 +603,7 @@ pub(crate) fn find_scheduled_change( /// extracts it. pub(crate) fn find_forced_change( header: &H, -) -> Option<(H::Number, sp_finality_grandpa::ScheduledChange)> { +) -> Option<(H::Number, sp_consensus_grandpa::ScheduledChange)> { use sp_runtime::generic::OpaqueDigestItemId; let id = OpaqueDigestItemId::Consensus(&GRANDPA_ENGINE_ID); @@ -695,7 +695,7 @@ mod tests { fn change_log(delay: u64) -> Digest { let consensus_log = - ConsensusLog::::ScheduledChange(sp_finality_grandpa::ScheduledChange { + ConsensusLog::::ScheduledChange(sp_consensus_grandpa::ScheduledChange { next_authorities: vec![(ALICE.into(), 1), (BOB.into(), 1)], delay, }); @@ -706,7 +706,7 @@ mod tests { fn forced_change_log(delay: u64) -> Digest { let consensus_log = ConsensusLog::::ForcedChange( delay, - sp_finality_grandpa::ScheduledChange { + sp_consensus_grandpa::ScheduledChange { next_authorities: vec![(ALICE.into(), 1), (BOB.into(), 1)], delay, }, @@ -717,7 +717,7 @@ mod tests { fn many_authorities_log() -> Digest { let consensus_log = - ConsensusLog::::ScheduledChange(sp_finality_grandpa::ScheduledChange { + ConsensusLog::::ScheduledChange(sp_consensus_grandpa::ScheduledChange { next_authorities: std::iter::repeat((ALICE.into(), 1)) .take(MAX_BRIDGED_AUTHORITIES as usize + 1) .collect(), diff --git a/bridges/modules/grandpa/src/storage_types.rs b/bridges/modules/grandpa/src/storage_types.rs index d674f1a7b0ad6..704482863350b 100644 --- a/bridges/modules/grandpa/src/storage_types.rs +++ b/bridges/modules/grandpa/src/storage_types.rs @@ -22,7 +22,7 @@ use bp_header_chain::{AuthoritySet, ChainWithGrandpa}; use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::{traits::Get, BoundedVec, RuntimeDebugNoBound}; use scale_info::TypeInfo; -use sp_finality_grandpa::{AuthorityId, AuthorityList, AuthorityWeight, SetId}; +use sp_consensus_grandpa::{AuthorityId, AuthorityList, AuthorityWeight, SetId}; use sp_std::marker::PhantomData; /// A bounded list of Grandpa authorities with associated weights. diff --git a/bridges/primitives/beefy/Cargo.toml b/bridges/primitives/beefy/Cargo.toml index 58cc268e698c9..4b4044252ca99 100644 --- a/bridges/primitives/beefy/Cargo.toml +++ b/bridges/primitives/beefy/Cargo.toml @@ -18,7 +18,7 @@ bp-runtime = { path = "../runtime", default-features = false } # Substrate Dependencies binary-merkle-tree = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -sp-beefy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sp-consensus-beefy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-beefy-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -35,7 +35,7 @@ std = [ "pallet-mmr/std", "scale-info/std", "serde", - "sp-beefy/std", + "sp-consensus-beefy/std", "sp-runtime/std", "sp-std/std" ] diff --git a/bridges/primitives/beefy/src/lib.rs b/bridges/primitives/beefy/src/lib.rs index 042d1d0e66134..de260d45eca68 100644 --- a/bridges/primitives/beefy/src/lib.rs +++ b/bridges/primitives/beefy/src/lib.rs @@ -25,7 +25,7 @@ pub use pallet_mmr::{ primitives::{DataOrHash as MmrDataOrHash, Proof as MmrProof}, verify_leaves_proof as verify_mmr_leaves_proof, }; -pub use sp_beefy::{ +pub use sp_consensus_beefy::{ crypto::{AuthorityId as EcdsaValidatorId, AuthoritySignature as EcdsaValidatorSignature}, known_payloads::MMR_ROOT_ID as MMR_ROOT_PAYLOAD_ID, mmr::{BeefyAuthoritySet, MmrLeafVersion}, @@ -51,7 +51,7 @@ use sp_std::prelude::*; pub trait ChainWithBeefy: Chain { /// The hashing algorithm used to compute the digest of the BEEFY commitment. /// - /// Corresponds to the hashing algorithm, used by `beefy_gadget::BeefyKeystore`. + /// Corresponds to the hashing algorithm, used by `sc_consensus_beefy::BeefyKeystore`. type CommitmentHasher: sp_runtime::traits::Hash; /// The hashing algorithm used to build the MMR. @@ -95,7 +95,7 @@ pub type BeefyAuthorityIdOf = ::AuthorityId; /// BEEFY validator set, containing both validator identifiers and the numeric set id. pub type BeefyAuthoritySetOf = ValidatorSet>; /// BEEFY authority set, containing both validator identifiers and the numeric set id. -pub type BeefyAuthoritySetInfoOf = sp_beefy::mmr::BeefyAuthoritySet>; +pub type BeefyAuthoritySetInfoOf = sp_consensus_beefy::mmr::BeefyAuthoritySet>; /// BEEFY validator signature used by given Substrate chain. pub type BeefyValidatorSignatureOf = <::AuthorityId as RuntimeAppPublic>::Signature; @@ -116,8 +116,12 @@ pub type BeefyMmrLeafExtraOf = ::BeefyMmrLeafExtra; /// the given Substrate chain. pub type BeefyAuthorityIdToMerkleLeafOf = ::AuthorityIdToMerkleLeaf; /// Actual type of leafs in the BEEFY MMR. -pub type BeefyMmrLeafOf = - sp_beefy::mmr::MmrLeaf, HashOf, MmrHashOf, BeefyMmrLeafExtraOf>; +pub type BeefyMmrLeafOf = sp_consensus_beefy::mmr::MmrLeaf< + BlockNumberOf, + HashOf, + MmrHashOf, + BeefyMmrLeafExtraOf, +>; /// Data required for initializing the BEEFY pallet. /// diff --git a/bridges/primitives/header-chain/Cargo.toml b/bridges/primitives/header-chain/Cargo.toml index be87cce460e38..0335836e328b4 100644 --- a/bridges/primitives/header-chain/Cargo.toml +++ b/bridges/primitives/header-chain/Cargo.toml @@ -20,7 +20,7 @@ bp-runtime = { path = "../runtime", default-features = false } frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sp-consensus-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -39,7 +39,7 @@ std = [ "frame-support/std", "scale-info/std", "sp-core/std", - "sp-finality-grandpa/std", + "sp-consensus-grandpa/std", "sp-runtime/std", "sp-std/std", ] diff --git a/bridges/primitives/header-chain/src/justification.rs b/bridges/primitives/header-chain/src/justification.rs index 88dac0acf9f6d..06ed782763dfc 100644 --- a/bridges/primitives/header-chain/src/justification.rs +++ b/bridges/primitives/header-chain/src/justification.rs @@ -17,7 +17,7 @@ //! Pallet for checking GRANDPA Finality Proofs. //! //! Adapted copy of substrate/client/finality-grandpa/src/justification.rs. If origin -//! will ever be moved to the sp_finality_grandpa, we should reuse that implementation. +//! will ever be moved to the sp_consensus_grandpa, we should reuse that implementation. use crate::ChainWithGrandpa; @@ -26,7 +26,7 @@ use codec::{Decode, Encode, MaxEncodedLen}; use finality_grandpa::voter_set::VoterSet; use frame_support::RuntimeDebug; use scale_info::TypeInfo; -use sp_finality_grandpa::{AuthorityId, AuthoritySignature, SetId}; +use sp_consensus_grandpa::{AuthorityId, AuthoritySignature, SetId}; use sp_runtime::{traits::Header as HeaderT, SaturatedConversion}; use sp_std::{ collections::{btree_map::BTreeMap, btree_set::BTreeSet}, @@ -307,7 +307,7 @@ where ); // verify authority signature - if !sp_finality_grandpa::check_message_signature_with_buffer( + if !sp_consensus_grandpa::check_message_signature_with_buffer( &finality_grandpa::Message::Precommit(signed.precommit.clone()), &signed.id, &signed.signature, diff --git a/bridges/primitives/header-chain/src/lib.rs b/bridges/primitives/header-chain/src/lib.rs index 5d05a1b15d8fa..5e2bbad242e5b 100644 --- a/bridges/primitives/header-chain/src/lib.rs +++ b/bridges/primitives/header-chain/src/lib.rs @@ -29,7 +29,7 @@ use frame_support::PalletError; use scale_info::TypeInfo; #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; -use sp_finality_grandpa::{AuthorityList, ConsensusLog, SetId, GRANDPA_ENGINE_ID}; +use sp_consensus_grandpa::{AuthorityList, ConsensusLog, SetId, GRANDPA_ENGINE_ID}; use sp_runtime::{traits::Header as HeaderT, Digest, RuntimeDebug}; use sp_std::boxed::Box; @@ -145,7 +145,7 @@ pub struct GrandpaConsensusLogReader(sp_std::marker::PhantomData impl GrandpaConsensusLogReader { pub fn find_authorities_change( digest: &Digest, - ) -> Option> { + ) -> Option> { // find the first consensus digest with the right ID which converts to // the right kind of consensus log. digest diff --git a/bridges/primitives/header-chain/tests/implementation_match.rs b/bridges/primitives/header-chain/tests/implementation_match.rs index 5d0fa35c37683..c70683b173d1f 100644 --- a/bridges/primitives/header-chain/tests/implementation_match.rs +++ b/bridges/primitives/header-chain/tests/implementation_match.rs @@ -27,7 +27,7 @@ use bp_test_utils::{ JustificationGeneratorParams, ALICE, BOB, CHARLIE, DAVE, EVE, FERDIE, TEST_GRANDPA_SET_ID, }; use finality_grandpa::voter_set::VoterSet; -use sp_finality_grandpa::{AuthorityId, AuthorityWeight}; +use sp_consensus_grandpa::{AuthorityId, AuthorityWeight}; use sp_runtime::traits::Header as HeaderT; type TestHeader = sp_runtime::testing::Header; diff --git a/bridges/primitives/header-chain/tests/justification.rs b/bridges/primitives/header-chain/tests/justification.rs index 52fa33ae97491..3cd63b935d00e 100644 --- a/bridges/primitives/header-chain/tests/justification.rs +++ b/bridges/primitives/header-chain/tests/justification.rs @@ -76,7 +76,7 @@ fn valid_justification_accepted_with_single_fork() { #[test] fn valid_justification_accepted_with_arbitrary_number_of_authorities() { use finality_grandpa::voter_set::VoterSet; - use sp_finality_grandpa::AuthorityId; + use sp_consensus_grandpa::AuthorityId; let n = 15; let required_signatures = required_justification_precommits(n as _); diff --git a/bridges/primitives/test-utils/Cargo.toml b/bridges/primitives/test-utils/Cargo.toml index 0a591334577af..8307534093f1f 100644 --- a/bridges/primitives/test-utils/Cargo.toml +++ b/bridges/primitives/test-utils/Cargo.toml @@ -11,7 +11,7 @@ codec = { package = "parity-scale-codec", version = "3.1.5", default-features = ed25519-dalek = { version = "1.0", default-features = false, features = ["u64_backend"] } finality-grandpa = { version = "0.16.0", default-features = false } sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sp-consensus-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -23,7 +23,7 @@ std = [ "ed25519-dalek/std", "finality-grandpa/std", "sp-application-crypto/std", - "sp-finality-grandpa/std", + "sp-consensus-grandpa/std", "sp-runtime/std", "sp-std/std", ] diff --git a/bridges/primitives/test-utils/src/keyring.rs b/bridges/primitives/test-utils/src/keyring.rs index 8b7a2b3925814..b1782109668ae 100644 --- a/bridges/primitives/test-utils/src/keyring.rs +++ b/bridges/primitives/test-utils/src/keyring.rs @@ -19,7 +19,7 @@ use codec::Encode; use ed25519_dalek::{Keypair, PublicKey, SecretKey, Signature}; use finality_grandpa::voter_set::VoterSet; -use sp_finality_grandpa::{AuthorityId, AuthorityList, AuthorityWeight}; +use sp_consensus_grandpa::{AuthorityId, AuthorityList, AuthorityWeight}; use sp_runtime::RuntimeDebug; use sp_std::prelude::*; diff --git a/bridges/primitives/test-utils/src/lib.rs b/bridges/primitives/test-utils/src/lib.rs index a6bb3d9b8feb6..6bb4adbf45092 100644 --- a/bridges/primitives/test-utils/src/lib.rs +++ b/bridges/primitives/test-utils/src/lib.rs @@ -20,7 +20,7 @@ use bp_header_chain::justification::{required_justification_precommits, GrandpaJustification}; use codec::Encode; -use sp_finality_grandpa::{AuthorityId, AuthoritySignature, AuthorityWeight, SetId}; +use sp_consensus_grandpa::{AuthorityId, AuthoritySignature, AuthorityWeight, SetId}; use sp_runtime::traits::{Header as HeaderT, One, Zero}; use sp_std::prelude::*; @@ -170,7 +170,7 @@ pub fn signed_precommit( ) -> finality_grandpa::SignedPrecommit { let precommit = finality_grandpa::Precommit { target_hash: target.0, target_number: target.1 }; - let encoded = sp_finality_grandpa::localized_payload( + let encoded = sp_consensus_grandpa::localized_payload( round, set_id, &finality_grandpa::Message::Precommit(precommit.clone()), diff --git a/bridges/relays/client-bridge-hub-wococo/Cargo.toml b/bridges/relays/client-bridge-hub-wococo/Cargo.toml index 7c9b90975d6ba..8164ae5afed21 100644 --- a/bridges/relays/client-bridge-hub-wococo/Cargo.toml +++ b/bridges/relays/client-bridge-hub-wococo/Cargo.toml @@ -29,4 +29,4 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master [dev-dependencies] bp-polkadot-core = { path = "../../primitives/polkadot-core" } -sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-consensus-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/bridges/relays/client-bridge-hub-wococo/src/runtime_wrapper.rs b/bridges/relays/client-bridge-hub-wococo/src/runtime_wrapper.rs index 13fb1a7e6ab4b..374dd5b44ce8c 100644 --- a/bridges/relays/client-bridge-hub-wococo/src/runtime_wrapper.rs +++ b/bridges/relays/client-bridge-hub-wococo/src/runtime_wrapper.rs @@ -75,8 +75,8 @@ impl From> for Call { mod tests { use super::*; use bp_runtime::BasicOperatingMode; + use sp_consensus_grandpa::AuthorityList; use sp_core::hexdisplay::HexDisplay; - use sp_finality_grandpa::AuthorityList; use sp_runtime::traits::Header; use std::str::FromStr; diff --git a/bridges/relays/client-rialto-parachain/src/codegen_runtime.rs b/bridges/relays/client-rialto-parachain/src/codegen_runtime.rs index 16a539f28435c..d725aafd41553 100644 --- a/bridges/relays/client-rialto-parachain/src/codegen_runtime.rs +++ b/bridges/relays/client-rialto-parachain/src/codegen_runtime.rs @@ -7034,7 +7034,7 @@ pub mod api { )] pub struct StoredAuthoritySet { pub authorities: runtime_types::sp_core::bounded::bounded_vec::BoundedVec<( - runtime_types::sp_finality_grandpa::app::Public, + runtime_types::sp_consensus_grandpa::app::Public, ::core::primitive::u64, )>, pub set_id: ::core::primitive::u64, @@ -8115,7 +8115,7 @@ pub mod api { pub struct Signature(pub [::core::primitive::u8; 64usize]); } } - pub mod sp_finality_grandpa { + pub mod sp_consensus_grandpa { use super::runtime_types; pub mod app { use super::runtime_types; diff --git a/bridges/relays/lib-substrate-relay/Cargo.toml b/bridges/relays/lib-substrate-relay/Cargo.toml index bb19515964752..9c336056dc644 100644 --- a/bridges/relays/lib-substrate-relay/Cargo.toml +++ b/bridges/relays/lib-substrate-relay/Cargo.toml @@ -44,7 +44,7 @@ frame-support = { git = "https://github.com/paritytech/substrate", branch = "mas frame-system = { git = "https://github.com/paritytech/substrate", branch = "master" } pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-consensus-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } [dev-dependencies] diff --git a/bridges/relays/lib-substrate-relay/src/error.rs b/bridges/relays/lib-substrate-relay/src/error.rs index b41870a181d93..2ebd9130f3912 100644 --- a/bridges/relays/lib-substrate-relay/src/error.rs +++ b/bridges/relays/lib-substrate-relay/src/error.rs @@ -17,7 +17,7 @@ //! Relay errors. use relay_substrate_client as client; -use sp_finality_grandpa::AuthorityList; +use sp_consensus_grandpa::AuthorityList; use sp_runtime::traits::MaybeDisplay; use std::fmt::Debug; use thiserror::Error; diff --git a/bridges/relays/lib-substrate-relay/src/finality/engine.rs b/bridges/relays/lib-substrate-relay/src/finality/engine.rs index 4fc503011bba1..f2ddd32db8600 100644 --- a/bridges/relays/lib-substrate-relay/src/finality/engine.rs +++ b/bridges/relays/lib-substrate-relay/src/finality/engine.rs @@ -30,8 +30,8 @@ use relay_substrate_client::{ BlockNumberOf, Chain, ChainWithGrandpa, Client, Error as SubstrateError, HashOf, HeaderOf, Subscription, SubstrateFinalityClient, SubstrateGrandpaFinalityClient, }; +use sp_consensus_grandpa::{AuthorityList as GrandpaAuthoritiesSet, GRANDPA_ENGINE_ID}; use sp_core::{storage::StorageKey, Bytes}; -use sp_finality_grandpa::{AuthorityList as GrandpaAuthoritiesSet, GRANDPA_ENGINE_ID}; use sp_runtime::{traits::Header, ConsensusEngineId}; use std::marker::PhantomData; @@ -155,8 +155,8 @@ impl Engine for Grandpa { C::WITH_CHAIN_GRANDPA_PALLET_NAME, ); let (authority_set, authority_set_id): ( - sp_finality_grandpa::AuthorityList, - sp_finality_grandpa::SetId, + sp_consensus_grandpa::AuthorityList, + sp_consensus_grandpa::SetId, ) = target_client .storage_value(current_authority_set_key, None) .await?