From 5aa46775c0600fe722510abff30fc3eff313acbc Mon Sep 17 00:00:00 2001 From: Adrian Catangiu Date: Wed, 31 May 2023 17:15:05 +0300 Subject: [PATCH] pallet-beefy-mmr: fix when using custom hashing (#14273) `Hash` is no longer part of `pallet_mmr::Config`, but this code would still build because it assumes we're referring to underlying `::Hash` which is not what we want when using different hashing between `frame_system` and `pallet_mmr`. Disambiguate by using correct `pallet_mmr::Config::Hashing` type. Signed-off-by: acatangiu --- frame/beefy-mmr/src/lib.rs | 2 +- primitives/consensus/beefy/src/lib.rs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/frame/beefy-mmr/src/lib.rs b/frame/beefy-mmr/src/lib.rs index 686f3c56f82b1..ba416922e2563 100644 --- a/frame/beefy-mmr/src/lib.rs +++ b/frame/beefy-mmr/src/lib.rs @@ -56,7 +56,7 @@ pub struct DepositBeefyDigest(sp_std::marker::PhantomData); impl pallet_mmr::primitives::OnNewRoot for DepositBeefyDigest where - T: pallet_mmr::Config, + T: pallet_mmr::Config, T: pallet_beefy::Config, { fn on_new_root(root: &sp_consensus_beefy::MmrRootHash) { diff --git a/primitives/consensus/beefy/src/lib.rs b/primitives/consensus/beefy/src/lib.rs index 268e1925b4449..6132c01187f01 100644 --- a/primitives/consensus/beefy/src/lib.rs +++ b/primitives/consensus/beefy/src/lib.rs @@ -47,7 +47,7 @@ use codec::{Codec, Decode, Encode}; use scale_info::TypeInfo; use sp_application_crypto::RuntimeAppPublic; use sp_core::H256; -use sp_runtime::traits::{Hash, NumberFor}; +use sp_runtime::traits::{Hash, Keccak256, NumberFor}; use sp_std::prelude::*; /// Key type for BEEFY module. @@ -156,6 +156,8 @@ impl ValidatorSet { /// The index of an authority. pub type AuthorityIndex = u32; +/// The Hashing used within MMR. +pub type MmrHashing = Keccak256; /// The type used to represent an MMR root hash. pub type MmrRootHash = H256;