mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 22:51:13 +00:00
implement bitfield signing subsystem (#1364)
* update guide to reduce confusion and TODOs * work from previous bitfield signing effort There were large merge issues with the old bitfield signing PR, so we're just copying all the work from that onto this and restarting. Much of the existing work will be discarded because we now have better tools available, but that's fine. * start rewriting bitfield signing in terms of the util module * implement construct_availability_bitvec It's not an ideal implementation--we can make it much more concurrent-- but at least it compiles. * implement the unimplemented portions of bitfield signing * get core availability concurrently, not sequentially * use sp-std instead of std for a parachain item * resolve type inference failure caused by multiple From impls * handle bitfield signing subsystem & Allmessages variant in overseer * fix more multi-From inference issues * more concisely handle overflow Co-authored-by: Andronik Ordian <write@reusable.software> * Revert "resolve type inference failure caused by multiple From impls" This reverts commit 7fc77805de5e5074a1b01037f8d4e3919e03e0e1. * Revert "fix more multi-From inference issues" This reverts commit f14ffe589e20d664d8a900ed62f68b6fb844a514. * impl From<i32> for ParaId * handle another instance of AllSubsystems * improve consistency when returning existing options Co-authored-by: Andronik Ordian <write@reusable.software>
This commit is contained in:
committed by
GitHub
parent
a1c704d446
commit
ba4bfa4dd0
@@ -26,7 +26,7 @@ use futures::channel::{mpsc, oneshot};
|
||||
|
||||
use polkadot_primitives::v1::{
|
||||
BlockNumber, Hash,
|
||||
CandidateReceipt, PoV, ErasureChunk, BackedCandidate, Id as ParaId,
|
||||
CandidateReceipt, CommittedCandidateReceipt, PoV, ErasureChunk, BackedCandidate, Id as ParaId,
|
||||
SignedAvailabilityBitfield, SigningContext, ValidatorId, ValidationCode, ValidatorIndex,
|
||||
CoreAssignment, CoreOccupied, HeadData, CandidateDescriptor,
|
||||
ValidatorSignature, OmittedValidationData,
|
||||
@@ -219,12 +219,32 @@ impl BitfieldDistributionMessage {
|
||||
}
|
||||
}
|
||||
|
||||
/// Bitfield signing message.
|
||||
///
|
||||
/// Currently non-instantiable.
|
||||
#[derive(Debug)]
|
||||
pub enum BitfieldSigningMessage {}
|
||||
|
||||
impl BitfieldSigningMessage {
|
||||
/// If the current variant contains the relay parent hash, return it.
|
||||
pub fn relay_parent(&self) -> Option<Hash> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Availability store subsystem message.
|
||||
#[derive(Debug)]
|
||||
pub enum AvailabilityStoreMessage {
|
||||
/// Query a `PoV` from the AV store.
|
||||
QueryPoV(Hash, oneshot::Sender<Option<PoV>>),
|
||||
|
||||
/// Query whether a `PoV` exists within the AV Store.
|
||||
///
|
||||
/// This is useful in cases like bitfield signing, when existence
|
||||
/// matters, but we don't want to necessarily pass around multiple
|
||||
/// megabytes of data to get a single bit of information.
|
||||
QueryPoVAvailable(Hash, oneshot::Sender<bool>),
|
||||
|
||||
/// Query an `ErasureChunk` from the AV store.
|
||||
QueryChunk(Hash, ValidatorIndex, oneshot::Sender<ErasureChunk>),
|
||||
|
||||
@@ -237,6 +257,7 @@ impl AvailabilityStoreMessage {
|
||||
pub fn relay_parent(&self) -> Option<Hash> {
|
||||
match self {
|
||||
Self::QueryPoV(hash, _) => Some(*hash),
|
||||
Self::QueryPoVAvailable(hash, _) => Some(*hash),
|
||||
Self::QueryChunk(hash, _, _) => Some(*hash),
|
||||
Self::StoreChunk(hash, _, _) => Some(*hash),
|
||||
}
|
||||
@@ -271,6 +292,8 @@ pub enum RuntimeApiRequest {
|
||||
ValidationCode(ParaId, BlockNumber, Option<BlockNumber>, oneshot::Sender<ValidationCode>),
|
||||
/// Get head data for a specific para.
|
||||
HeadData(ParaId, oneshot::Sender<HeadData>),
|
||||
/// Get a the candidate pending availability for a particular parachain by parachain / core index
|
||||
CandidatePendingAvailability(ParaId, oneshot::Sender<Option<CommittedCandidateReceipt>>),
|
||||
}
|
||||
|
||||
/// A message to the Runtime API subsystem.
|
||||
@@ -397,6 +420,8 @@ pub enum AllMessages {
|
||||
AvailabilityDistribution(AvailabilityDistributionMessage),
|
||||
/// Message for the bitfield distribution subsystem.
|
||||
BitfieldDistribution(BitfieldDistributionMessage),
|
||||
/// Message for the bitfield signing subsystem.
|
||||
BitfieldSigning(BitfieldSigningMessage),
|
||||
/// Message for the Provisioner subsystem.
|
||||
Provisioner(ProvisionerMessage),
|
||||
/// Message for the PoV Distribution subsystem.
|
||||
|
||||
Reference in New Issue
Block a user