Alter BEEFY primitives to prepare for potential BLS integration (#10466)

* Generalize signature.

* Fix tests.

* Introduce VersionedFinalityProof.

* cargo +nightly fmt --all

* Rework packing a tad.
This commit is contained in:
Tomasz Drwięga
2021-12-20 14:57:32 +01:00
committed by GitHub
parent 6eb6fa32fc
commit daa41ea5cc
5 changed files with 64 additions and 57 deletions
+2 -1
View File
@@ -24,7 +24,8 @@ use sp_runtime::traits::{Block, NumberFor};
use parking_lot::Mutex;
/// Stream of signed commitments returned when subscribing.
pub type SignedCommitment<Block> = beefy_primitives::SignedCommitment<NumberFor<Block>>;
pub type SignedCommitment<Block> =
beefy_primitives::SignedCommitment<NumberFor<Block>, beefy_primitives::crypto::Signature>;
/// Stream of signed commitments returned when subscribing.
type SignedCommitmentStream<Block> = TracingUnboundedReceiver<SignedCommitment<Block>>;
+2 -2
View File
@@ -37,7 +37,7 @@ use sp_runtime::{
use beefy_primitives::{
crypto::{AuthorityId, Public, Signature},
known_payload_ids, BeefyApi, Commitment, ConsensusLog, MmrRootHash, Payload, SignedCommitment,
ValidatorSet, VersionedCommitment, VoteMessage, BEEFY_ENGINE_ID, GENESIS_AUTHORITY_SET_ID,
ValidatorSet, VersionedFinalityProof, VoteMessage, BEEFY_ENGINE_ID, GENESIS_AUTHORITY_SET_ID,
};
use crate::{
@@ -330,7 +330,7 @@ where
BlockId::Number(round.1),
(
BEEFY_ENGINE_ID,
VersionedCommitment::V1(signed_commitment.clone()).encode(),
VersionedFinalityProof::V1(signed_commitment.clone()).encode(),
),
)
.is_err()