mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 21:51:06 +00:00
Move BEEFY code to consensus (#13484)
* Move beefy primitives to consensus dir * Move beefy gadget to client consensus folder * Rename beefy crates
This commit is contained in:
@@ -36,11 +36,11 @@
|
||||
use sp_runtime::traits::{Convert, Member};
|
||||
use sp_std::prelude::*;
|
||||
|
||||
use beefy_primitives::{
|
||||
use pallet_mmr::{LeafDataProvider, ParentNumberAndHash};
|
||||
use sp_consensus_beefy::{
|
||||
mmr::{BeefyAuthoritySet, BeefyDataProvider, BeefyNextAuthoritySet, MmrLeaf, MmrLeafVersion},
|
||||
ValidatorSet as BeefyValidatorSet,
|
||||
};
|
||||
use pallet_mmr::{LeafDataProvider, ParentNumberAndHash};
|
||||
|
||||
use frame_support::{crypto::ecdsa::ECDSAExt, traits::Get};
|
||||
|
||||
@@ -54,15 +54,15 @@ mod tests;
|
||||
/// A BEEFY consensus digest item with MMR root hash.
|
||||
pub struct DepositBeefyDigest<T>(sp_std::marker::PhantomData<T>);
|
||||
|
||||
impl<T> pallet_mmr::primitives::OnNewRoot<beefy_primitives::MmrRootHash> for DepositBeefyDigest<T>
|
||||
impl<T> pallet_mmr::primitives::OnNewRoot<sp_consensus_beefy::MmrRootHash> for DepositBeefyDigest<T>
|
||||
where
|
||||
T: pallet_mmr::Config<Hash = beefy_primitives::MmrRootHash>,
|
||||
T: pallet_mmr::Config<Hash = sp_consensus_beefy::MmrRootHash>,
|
||||
T: pallet_beefy::Config,
|
||||
{
|
||||
fn on_new_root(root: &<T as pallet_mmr::Config>::Hash) {
|
||||
let digest = sp_runtime::generic::DigestItem::Consensus(
|
||||
beefy_primitives::BEEFY_ENGINE_ID,
|
||||
codec::Encode::encode(&beefy_primitives::ConsensusLog::<
|
||||
sp_consensus_beefy::BEEFY_ENGINE_ID,
|
||||
codec::Encode::encode(&sp_consensus_beefy::ConsensusLog::<
|
||||
<T as pallet_beefy::Config>::BeefyId,
|
||||
>::MmrRoot(*root)),
|
||||
);
|
||||
@@ -72,8 +72,8 @@ where
|
||||
|
||||
/// Convert BEEFY secp256k1 public keys into Ethereum addresses
|
||||
pub struct BeefyEcdsaToEthereum;
|
||||
impl Convert<beefy_primitives::crypto::AuthorityId, Vec<u8>> for BeefyEcdsaToEthereum {
|
||||
fn convert(beefy_id: beefy_primitives::crypto::AuthorityId) -> Vec<u8> {
|
||||
impl Convert<sp_consensus_beefy::crypto::AuthorityId, Vec<u8>> for BeefyEcdsaToEthereum {
|
||||
fn convert(beefy_id: sp_consensus_beefy::crypto::AuthorityId) -> Vec<u8> {
|
||||
sp_core::ecdsa::Public::from(beefy_id)
|
||||
.to_eth_address()
|
||||
.map(|v| v.to_vec())
|
||||
@@ -156,7 +156,7 @@ impl<T: Config> LeafDataProvider for Pallet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> beefy_primitives::OnNewValidatorSet<<T as pallet_beefy::Config>::BeefyId> for Pallet<T>
|
||||
impl<T> sp_consensus_beefy::OnNewValidatorSet<<T as pallet_beefy::Config>::BeefyId> for Pallet<T>
|
||||
where
|
||||
T: pallet::Config,
|
||||
{
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
use std::vec;
|
||||
|
||||
use beefy_primitives::mmr::MmrLeafVersion;
|
||||
use codec::Encode;
|
||||
use frame_support::{
|
||||
construct_runtime, parameter_types,
|
||||
@@ -25,6 +24,7 @@ use frame_support::{
|
||||
traits::{ConstU16, ConstU32, ConstU64, GenesisBuild, KeyOwnerProofSystem},
|
||||
BasicExternalities,
|
||||
};
|
||||
use sp_consensus_beefy::mmr::MmrLeafVersion;
|
||||
use sp_core::{crypto::KeyTypeId, Hasher, H256};
|
||||
use sp_runtime::{
|
||||
app_crypto::ecdsa::Public,
|
||||
@@ -35,7 +35,7 @@ use sp_runtime::{
|
||||
|
||||
use crate as pallet_beefy_mmr;
|
||||
|
||||
pub use beefy_primitives::{
|
||||
pub use sp_consensus_beefy::{
|
||||
crypto::AuthorityId as BeefyId, mmr::BeefyDataProvider, ConsensusLog, BEEFY_ENGINE_ID,
|
||||
};
|
||||
|
||||
@@ -101,7 +101,7 @@ impl pallet_session::Config for Test {
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
pub type MmrLeaf = beefy_primitives::mmr::MmrLeaf<
|
||||
pub type MmrLeaf = sp_consensus_beefy::mmr::MmrLeaf<
|
||||
<Test as frame_system::Config>::BlockNumber,
|
||||
<Test as frame_system::Config>::Hash,
|
||||
<Test as pallet_mmr::Config>::Hash,
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
|
||||
use std::vec;
|
||||
|
||||
use beefy_primitives::{
|
||||
use codec::{Decode, Encode};
|
||||
use sp_consensus_beefy::{
|
||||
mmr::{BeefyNextAuthoritySet, MmrLeafVersion},
|
||||
ValidatorSet,
|
||||
};
|
||||
use codec::{Decode, Encode};
|
||||
|
||||
use sp_core::H256;
|
||||
use sp_io::TestExternalities;
|
||||
|
||||
Reference in New Issue
Block a user