Refactor beefy-mmr implementation (#4719)

* update pallet-beefy-mmr implementation

* minor fix

* fix build

* use H256 for rococo leaf extra

* update lockfile for {"substrate"}

* fix fmt

Co-authored-by: acatangiu <adrian@parity.io>
This commit is contained in:
Web3 Smith
2022-04-01 11:09:45 +01:00
committed by GitHub
parent bd33013a4b
commit 30dcadacdc
5 changed files with 197 additions and 182 deletions
@@ -32,7 +32,7 @@ pub mod rialto_messages;
use crate::rialto_messages::{ToRialtoMessagePayload, WithRialtoMessageBridge};
use beefy_primitives::{crypto::AuthorityId as BeefyId, mmr::MmrLeafVersion, ValidatorSet};
use beefy_primitives::{crypto::AuthorityId as BeefyId, mmr::{MmrLeafVersion}, ValidatorSet};
use bridge_runtime_common::messages::{
source::estimate_message_dispatch_and_delivery_fee, MessageBridge,
};
@@ -281,7 +281,7 @@ parameter_types! {
impl pallet_beefy_mmr::Config for Runtime {
type LeafVersion = LeafVersion;
type BeefyAuthorityToMerkleLeaf = pallet_beefy_mmr::BeefyEcdsaToEthereum;
type ParachainHeads = ();
type BeefyDataProvider = ();
}
parameter_types! {
@@ -33,7 +33,7 @@ pub mod parachains;
use crate::millau_messages::{ToMillauMessagePayload, WithMillauMessageBridge};
use beefy_primitives::{crypto::AuthorityId as BeefyId, mmr::MmrLeafVersion, ValidatorSet};
use beefy_primitives::{crypto::AuthorityId as BeefyId, mmr::{MmrLeafVersion}, ValidatorSet};
use bridge_runtime_common::messages::{
source::estimate_message_dispatch_and_delivery_fee, MessageBridge,
};
@@ -280,10 +280,12 @@ impl pallet_grandpa::Config for Runtime {
type MaxAuthorities = MaxAuthorities;
}
type MmrHash = <Keccak256 as sp_runtime::traits::Hash>::Output;
impl pallet_mmr::Config for Runtime {
const INDEXING_PREFIX: &'static [u8] = b"mmr";
type Hashing = Keccak256;
type Hash = <Keccak256 as sp_runtime::traits::Hash>::Output;
type Hash = MmrHash;
type OnNewRoot = pallet_beefy_mmr::DepositBeefyDigest<Runtime>;
type WeightInfo = ();
type LeafData = pallet_beefy_mmr::Pallet<Runtime>;
@@ -309,7 +311,7 @@ parameter_types! {
impl pallet_beefy_mmr::Config for Runtime {
type LeafVersion = LeafVersion;
type BeefyAuthorityToMerkleLeaf = pallet_beefy_mmr::BeefyEcdsaToEthereum;
type ParachainHeads = ();
type BeefyDataProvider = ();
}
parameter_types! {