Beefy: use VersionedFinalityProof instead of SignedCommitment (#11962)

* beefy: use VersionedFinalityProof instead of SignedCommitment.

* Change the exposed RPC API to support versioned proofs.

Co-authored-by: Adrian Catangiu <adrian@parity.io>
This commit is contained in:
ZhiYong
2022-08-04 15:47:52 +08:00
committed by GitHub
parent 97b2a5ee75
commit b8ad45373f
8 changed files with 157 additions and 140 deletions
+11 -10
View File
@@ -19,7 +19,7 @@
use sc_utils::notification::{NotificationSender, NotificationStream, TracingKeyStr};
use sp_runtime::traits::Block as BlockT;
use crate::justification::BeefySignedCommitment;
use crate::justification::BeefyVersionedFinalityProof;
/// The sending half of the notifications channel(s) used to send
/// notifications about best BEEFY block from the gadget side.
@@ -31,13 +31,14 @@ pub type BeefyBestBlockStream<Block> =
NotificationStream<<Block as BlockT>::Hash, BeefyBestBlockTracingKey>;
/// The sending half of the notifications channel(s) used to send notifications
/// about signed commitments generated at the end of a BEEFY round.
pub type BeefySignedCommitmentSender<Block> = NotificationSender<BeefySignedCommitment<Block>>;
/// about versioned finality proof generated at the end of a BEEFY round.
pub type BeefyVersionedFinalityProofSender<Block> =
NotificationSender<BeefyVersionedFinalityProof<Block>>;
/// The receiving half of a notifications channel used to receive notifications
/// about signed commitments generated at the end of a BEEFY round.
pub type BeefySignedCommitmentStream<Block> =
NotificationStream<BeefySignedCommitment<Block>, BeefySignedCommitmentTracingKey>;
/// about versioned finality proof generated at the end of a BEEFY round.
pub type BeefyVersionedFinalityProofStream<Block> =
NotificationStream<BeefyVersionedFinalityProof<Block>, BeefyVersionedFinalityProofTracingKey>;
/// Provides tracing key for BEEFY best block stream.
#[derive(Clone)]
@@ -46,9 +47,9 @@ impl TracingKeyStr for BeefyBestBlockTracingKey {
const TRACING_KEY: &'static str = "mpsc_beefy_best_block_notification_stream";
}
/// Provides tracing key for BEEFY signed commitments stream.
/// Provides tracing key for BEEFY versioned finality proof stream.
#[derive(Clone)]
pub struct BeefySignedCommitmentTracingKey;
impl TracingKeyStr for BeefySignedCommitmentTracingKey {
const TRACING_KEY: &'static str = "mpsc_beefy_signed_commitments_notification_stream";
pub struct BeefyVersionedFinalityProofTracingKey;
impl TracingKeyStr for BeefyVersionedFinalityProofTracingKey {
const TRACING_KEY: &'static str = "mpsc_beefy_versioned_finality_proof_notification_stream";
}