Add BEEFY finality pallet with basic functionality (#1606)

* pallet-bridge-beefy: initial commit
This commit is contained in:
Serban Iorga
2022-11-21 18:52:24 +02:00
committed by Bastian Köcher
parent b3ab4a1b6a
commit 1f9110a065
11 changed files with 1813 additions and 0 deletions
@@ -20,6 +20,7 @@
mod millau_hash;
use bp_beefy::ChainWithBeefy;
use bp_messages::{
InboundMessageDetails, LaneId, MessageNonce, MessagePayload, OutboundMessageDetails,
};
@@ -41,6 +42,7 @@ use sp_trie::{LayoutV0, LayoutV1, TrieConfiguration};
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
use sp_runtime::traits::Keccak256;
pub use millau_hash::MillauHash;
@@ -155,6 +157,16 @@ impl Chain for Millau {
}
}
impl ChainWithBeefy for Millau {
type CommitmentHasher = Keccak256;
type MmrHashing = Keccak256;
type MmrHash = <Keccak256 as sp_runtime::traits::Hash>::Output;
type BeefyMmrLeafExtra = ();
type AuthorityId = bp_beefy::EcdsaValidatorId;
type Signature = bp_beefy::EcdsaValidatorSignature;
type AuthorityIdToMerkleLeaf = bp_beefy::BeefyEcdsaToEthereum;
}
/// Millau Hasher (Blake2-256 ++ Keccak-256) implementation.
#[derive(PartialEq, Eq, Clone, Copy, RuntimeDebug, TypeInfo)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]