You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Right now pallet-beefy-mmr Declares a new Hasher trait and a new Keccak256 struct which implements it. I was wondering if this is needed.
I was thinking of 2 possible simplifications:
Instead of defining a new struct we could reuse the Keccak256 struct that's already present in sp_runtime, doing something like:
#[cfg(feature = "keccak")]
mod keccak256 {
pub use sp_runtime::traits::Keccak256;
/// Keccak256 hasher implementation.
impl super::Hasher for Keccak256 {
fn hash(data: &[u8]) -> super::Hash {
Self::hash(data).into()
}
}
}
Or we could do even something more generic:
impl<T> super::Hasher for T
where T: sp_runtime::traits::Hash,
<T as sp_runtime::traits::Hash>::Output: Into<super::Hash> {
fn hash(data: &[u8]) -> super::Hash {
Self::hash(data).into()
}
}
Could we go one step further and remove the Hasher trait completely and use sp_runtime::traits::Hash instead ? And maybe in the end we could also remove this.
@acatangiu WDYT ? If this issue makes sense I would be happy to implement it.