From be2d1ce01bf6c93c35bf7265bd16516574bf6b27 Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Sat, 19 Jun 2021 17:46:06 +0200 Subject: [PATCH] Bump BEEFY (#3302) --- polkadot/Cargo.lock | 8 ++++---- polkadot/node/client/src/lib.rs | 5 ++--- polkadot/node/service/src/chain_spec.rs | 2 +- polkadot/node/service/src/lib.rs | 5 ++--- polkadot/rpc/src/lib.rs | 11 +++++------ polkadot/runtime/common/src/lib.rs | 2 +- polkadot/runtime/common/src/mmr.rs | 10 +++++----- polkadot/runtime/kusama/src/lib.rs | 4 ++-- polkadot/runtime/polkadot/src/lib.rs | 4 ++-- polkadot/runtime/rococo/src/lib.rs | 6 +++--- polkadot/runtime/test-runtime/src/lib.rs | 4 ++-- polkadot/runtime/westend/src/lib.rs | 4 ++-- 12 files changed, 31 insertions(+), 34 deletions(-) diff --git a/polkadot/Cargo.lock b/polkadot/Cargo.lock index ba6c6edb6d..95d28b7367 100644 --- a/polkadot/Cargo.lock +++ b/polkadot/Cargo.lock @@ -481,7 +481,7 @@ dependencies = [ [[package]] name = "beefy-gadget" version = "0.1.0" -source = "git+https://github.com/paritytech/grandpa-bridge-gadget?branch=master#a58179d4f59f4c31c7a09d5b0ce14df8450743a3" +source = "git+https://github.com/paritytech/grandpa-bridge-gadget?branch=master#29244671a1db0ee9c30b04f9a56f6bf2489522a5" dependencies = [ "beefy-primitives", "futures 0.3.15", @@ -509,7 +509,7 @@ dependencies = [ [[package]] name = "beefy-gadget-rpc" version = "0.1.0" -source = "git+https://github.com/paritytech/grandpa-bridge-gadget?branch=master#a58179d4f59f4c31c7a09d5b0ce14df8450743a3" +source = "git+https://github.com/paritytech/grandpa-bridge-gadget?branch=master#29244671a1db0ee9c30b04f9a56f6bf2489522a5" dependencies = [ "beefy-gadget", "beefy-primitives", @@ -530,7 +530,7 @@ dependencies = [ [[package]] name = "beefy-primitives" version = "0.1.0" -source = "git+https://github.com/paritytech/grandpa-bridge-gadget?branch=master#a58179d4f59f4c31c7a09d5b0ce14df8450743a3" +source = "git+https://github.com/paritytech/grandpa-bridge-gadget?branch=master#29244671a1db0ee9c30b04f9a56f6bf2489522a5" dependencies = [ "parity-scale-codec", "sp-api", @@ -4632,7 +4632,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "0.1.0" -source = "git+https://github.com/paritytech/grandpa-bridge-gadget?branch=master#a58179d4f59f4c31c7a09d5b0ce14df8450743a3" +source = "git+https://github.com/paritytech/grandpa-bridge-gadget?branch=master#29244671a1db0ee9c30b04f9a56f6bf2489522a5" dependencies = [ "beefy-primitives", "frame-support", diff --git a/polkadot/node/client/src/lib.rs b/polkadot/node/client/src/lib.rs index 5ce2f5135f..7a0a2264d9 100644 --- a/polkadot/node/client/src/lib.rs +++ b/polkadot/node/client/src/lib.rs @@ -20,7 +20,6 @@ //! There is also the [`Client`] enum that combines all the different clients into one common structure. use std::sync::Arc; -use beefy_primitives::ecdsa::AuthorityId as BeefyId; use sp_api::{ProvideRuntimeApi, CallApiAt, NumberFor}; use sp_blockchain::HeaderBackend; use sp_runtime::{ @@ -82,7 +81,7 @@ pub trait RuntimeApiCollection: + sp_offchain::OffchainWorkerApi + sp_session::SessionKeys + sp_authority_discovery::AuthorityDiscoveryApi - + beefy_primitives::BeefyApi + + beefy_primitives::BeefyApi where >::StateBackend: sp_api::StateBackend, {} @@ -102,7 +101,7 @@ where + sp_offchain::OffchainWorkerApi + sp_session::SessionKeys + sp_authority_discovery::AuthorityDiscoveryApi - + beefy_primitives::BeefyApi, + + beefy_primitives::BeefyApi, >::StateBackend: sp_api::StateBackend, {} diff --git a/polkadot/node/service/src/chain_spec.rs b/polkadot/node/service/src/chain_spec.rs index f9ebe94d0d..de66ad812d 100644 --- a/polkadot/node/service/src/chain_spec.rs +++ b/polkadot/node/service/src/chain_spec.rs @@ -18,7 +18,7 @@ use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; use sp_consensus_babe::AuthorityId as BabeId; -use beefy_primitives::ecdsa::AuthorityId as BeefyId; +use beefy_primitives::crypto::AuthorityId as BeefyId; use grandpa::AuthorityId as GrandpaId; #[cfg(feature = "kusama-native")] use kusama_runtime as kusama; diff --git a/polkadot/node/service/src/lib.rs b/polkadot/node/service/src/lib.rs index be78081ba1..ee0a2dd431 100644 --- a/polkadot/node/service/src/lib.rs +++ b/polkadot/node/service/src/lib.rs @@ -45,7 +45,6 @@ use { sp_trie::PrefixedMemoryDB, sc_client_api::ExecutorProvider, grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider}, - beefy_primitives::ecdsa::AuthoritySignature as BeefySignature, sp_runtime::traits::Header as HeaderT, }; @@ -248,7 +247,7 @@ fn new_partial( >, grandpa::LinkHalf, FullSelectChain>, babe::BabeLink, - beefy_gadget::notification::BeefySignedCommitmentSender, + beefy_gadget::notification::BeefySignedCommitmentSender, ), grandpa::SharedVoterState, std::time::Duration, // slot-duration @@ -848,7 +847,7 @@ pub fn new_full( prometheus_registry: prometheus_registry.clone(), }; - let gadget = beefy_gadget::start_beefy_gadget::<_, beefy_primitives::ecdsa::AuthorityPair, _, _, _>( + let gadget = beefy_gadget::start_beefy_gadget::<_, _, _, _>( beefy_params ); diff --git a/polkadot/rpc/src/lib.rs b/polkadot/rpc/src/lib.rs index 7be156aaaf..361e1d21fe 100644 --- a/polkadot/rpc/src/lib.rs +++ b/polkadot/rpc/src/lib.rs @@ -75,15 +75,15 @@ pub struct GrandpaDeps { } /// Dependencies for BEEFY -pub struct BeefyDeps { +pub struct BeefyDeps { /// Receives notifications about signed commitment events from BEEFY. - pub beefy_commitment_stream: beefy_gadget::notification::BeefySignedCommitmentStream, + pub beefy_commitment_stream: beefy_gadget::notification::BeefySignedCommitmentStream, /// Executor to drive the subscription manager in the BEEFY RPC handler. pub subscription_executor: sc_rpc::SubscriptionTaskExecutor, } /// Full client dependencies -pub struct FullDeps { +pub struct FullDeps { /// The client instance to use. pub client: Arc, /// Transaction pool instance. @@ -99,11 +99,11 @@ pub struct FullDeps { /// GRANDPA specific dependencies. pub grandpa: GrandpaDeps, /// BEEFY specific dependencies. - pub beefy: BeefyDeps, + pub beefy: BeefyDeps, } /// Instantiate all RPC extensions. -pub fn create_full(deps: FullDeps) -> RpcExtension where +pub fn create_full(deps: FullDeps) -> RpcExtension where C: ProvideRuntimeApi + HeaderBackend + AuxStore + HeaderMetadata + Send + Sync + 'static, C::Api: frame_rpc_system::AccountNonceApi, @@ -115,7 +115,6 @@ pub fn create_full(deps: FullDeps) -> RpcExten SC: SelectChain + 'static, B: sc_client_api::Backend + Send + Sync + 'static, B::State: sc_client_api::StateBackend>, - BS: Clone + Send + parity_scale_codec::Encode + 'static, { use frame_rpc_system::{FullSystem, SystemApi}; use pallet_mmr_rpc::{MmrApi, Mmr}; diff --git a/polkadot/runtime/common/src/lib.rs b/polkadot/runtime/common/src/lib.rs index c7ac287a87..406b3fc17c 100644 --- a/polkadot/runtime/common/src/lib.rs +++ b/polkadot/runtime/common/src/lib.rs @@ -36,7 +36,7 @@ mod mock; #[cfg(test)] mod integration_tests; -use beefy_primitives::ecdsa::AuthorityId as BeefyId; +use beefy_primitives::crypto::AuthorityId as BeefyId; use primitives::v1::{AccountId, AssignmentId, BlockNumber, ValidatorId}; use sp_runtime::{Perquintill, Perbill, FixedPointNumber}; use frame_system::limits; diff --git a/polkadot/runtime/common/src/mmr.rs b/polkadot/runtime/common/src/mmr.rs index 08d8154eef..2cf2bf115c 100644 --- a/polkadot/runtime/common/src/mmr.rs +++ b/polkadot/runtime/common/src/mmr.rs @@ -37,7 +37,7 @@ impl pallet_mmr::primitives::OnNewRoot for Dep let digest = sp_runtime::generic::DigestItem::Consensus( beefy_primitives::BEEFY_ENGINE_ID, parity_scale_codec::Encode::encode( - &beefy_primitives::ConsensusLog::<::AuthorityId>::MmrRoot(*root) + &beefy_primitives::ConsensusLog::<::BeefyId>::MmrRoot(*root) ), ); >::deposit_log(digest); @@ -46,8 +46,8 @@ impl pallet_mmr::primitives::OnNewRoot for Dep /// Convert BEEFY secp256k1 public keys into uncompressed form pub struct UncompressBeefyEcdsaKeys; -impl Convert> for UncompressBeefyEcdsaKeys { - fn convert(a: beefy_primitives::ecdsa::AuthorityId) -> Vec { +impl Convert> for UncompressBeefyEcdsaKeys { + fn convert(a: beefy_primitives::crypto::AuthorityId) -> Vec { use sp_core::crypto::Public; let compressed_key = a.as_slice(); // TODO [ToDr] Temporary workaround until we have a better way to get uncompressed keys. @@ -137,7 +137,7 @@ pub mod pallet { /// For instance for ECDSA (secp256k1) we want to store uncompressed public keys (65 bytes) /// to simplify using them on Ethereum chain, but the rest of the Substrate codebase /// is storing them compressed (33 bytes) for efficiency reasons. - type BeefyAuthorityToMerkleLeaf: Convert<::AuthorityId, Vec>; + type BeefyAuthorityToMerkleLeaf: Convert<::BeefyId, Vec>; /// Retrieve a list of current parachain heads. /// @@ -179,7 +179,7 @@ impl LeafDataProvider for Pallet where impl Pallet where MerkleRootOf: From, - ::AuthorityId: + ::BeefyId: { /// Returns latest root hash of a merkle tree constructed from all registered parachain headers. /// diff --git a/polkadot/runtime/kusama/src/lib.rs b/polkadot/runtime/kusama/src/lib.rs index 84841f028f..46959cb2c0 100644 --- a/polkadot/runtime/kusama/src/lib.rs +++ b/polkadot/runtime/kusama/src/lib.rs @@ -91,7 +91,7 @@ use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; use pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo}; use pallet_session::historical as session_historical; use static_assertions::const_assert; -use beefy_primitives::ecdsa::AuthorityId as BeefyId; +use beefy_primitives::crypto::AuthorityId as BeefyId; use pallet_mmr_primitives as mmr; #[cfg(feature = "std")] @@ -1664,7 +1664,7 @@ sp_api::impl_runtime_apis! { } } - impl beefy_primitives::BeefyApi for Runtime { + impl beefy_primitives::BeefyApi for Runtime { fn validator_set() -> beefy_primitives::ValidatorSet { // dummy implementation due to lack of BEEFY pallet. beefy_primitives::ValidatorSet { validators: Vec::new(), id: 0 } diff --git a/polkadot/runtime/polkadot/src/lib.rs b/polkadot/runtime/polkadot/src/lib.rs index 9ab67a2491..06c7e4a7d2 100644 --- a/polkadot/runtime/polkadot/src/lib.rs +++ b/polkadot/runtime/polkadot/src/lib.rs @@ -67,7 +67,7 @@ use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; use pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo}; use pallet_session::historical as session_historical; use static_assertions::const_assert; -use beefy_primitives::ecdsa::AuthorityId as BeefyId; +use beefy_primitives::crypto::AuthorityId as BeefyId; use pallet_mmr_primitives as mmr; #[cfg(feature = "std")] @@ -1241,7 +1241,7 @@ sp_api::impl_runtime_apis! { } } - impl beefy_primitives::BeefyApi for Runtime { + impl beefy_primitives::BeefyApi for Runtime { fn validator_set() -> beefy_primitives::ValidatorSet { // dummy implementation due to lack of BEEFY pallet. beefy_primitives::ValidatorSet { validators: Vec::new(), id: 0 } diff --git a/polkadot/runtime/rococo/src/lib.rs b/polkadot/runtime/rococo/src/lib.rs index 146becad08..e33ca703c3 100644 --- a/polkadot/runtime/rococo/src/lib.rs +++ b/polkadot/runtime/rococo/src/lib.rs @@ -64,7 +64,7 @@ use pallet_grandpa::{AuthorityId as GrandpaId, fg_primitives}; use sp_core::{OpaqueMetadata, RuntimeDebug}; use sp_staking::SessionIndex; use pallet_session::historical as session_historical; -use beefy_primitives::ecdsa::AuthorityId as BeefyId; +use beefy_primitives::crypto::AuthorityId as BeefyId; use pallet_mmr_primitives as mmr; use frame_system::EnsureRoot; use runtime_common::{paras_sudo_wrapper, paras_registrar, xcm_sender, auctions, crowdloan, slots}; @@ -812,7 +812,7 @@ impl paras_registrar::Config for Runtime { pub struct ParentHashRandomness; impl pallet_beefy::Config for Runtime { - type AuthorityId = BeefyId; + type BeefyId = BeefyId; } impl pallet_mmr::Config for Runtime { @@ -1244,7 +1244,7 @@ sp_api::impl_runtime_apis! { } } - impl beefy_primitives::BeefyApi for Runtime { + impl beefy_primitives::BeefyApi for Runtime { fn validator_set() -> beefy_primitives::ValidatorSet { Beefy::validator_set() } diff --git a/polkadot/runtime/test-runtime/src/lib.rs b/polkadot/runtime/test-runtime/src/lib.rs index afbf787566..b00ad0ac86 100644 --- a/polkadot/runtime/test-runtime/src/lib.rs +++ b/polkadot/runtime/test-runtime/src/lib.rs @@ -69,7 +69,7 @@ use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; use pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo}; use pallet_session::historical as session_historical; use polkadot_runtime_parachains::reward_points::RewardValidatorsWithEraPoints; -use beefy_primitives::ecdsa::AuthorityId as BeefyId; +use beefy_primitives::crypto::AuthorityId as BeefyId; use pallet_mmr_primitives as mmr; #[cfg(feature = "std")] @@ -704,7 +704,7 @@ sp_api::impl_runtime_apis! { } } - impl beefy_primitives::BeefyApi for Runtime { + impl beefy_primitives::BeefyApi for Runtime { fn validator_set() -> beefy_primitives::ValidatorSet { // dummy implementation due to lack of BEEFY pallet. beefy_primitives::ValidatorSet { validators: Vec::new(), id: 0 } diff --git a/polkadot/runtime/westend/src/lib.rs b/polkadot/runtime/westend/src/lib.rs index 1199d640ef..86533d03df 100644 --- a/polkadot/runtime/westend/src/lib.rs +++ b/polkadot/runtime/westend/src/lib.rs @@ -90,7 +90,7 @@ use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; use pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo}; use pallet_session::historical as session_historical; use frame_system::{EnsureRoot}; -use beefy_primitives::ecdsa::AuthorityId as BeefyId; +use beefy_primitives::crypto::AuthorityId as BeefyId; use pallet_mmr_primitives as mmr; #[cfg(feature = "std")] @@ -1248,7 +1248,7 @@ sp_api::impl_runtime_apis! { } } - impl beefy_primitives::BeefyApi for Runtime { + impl beefy_primitives::BeefyApi for Runtime { fn validator_set() -> beefy_primitives::ValidatorSet { // dummy implementation due to lack of BEEFY pallet. beefy_primitives::ValidatorSet { validators: Vec::new(), id: 0 }