mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 10:31:03 +00:00
Make CandidateHash a real type (#1916)
* Make `CandidateHash` a real type This pr adds a new type `CandidateHash` that is used instead of the opaque `Hash` type. This helps to ensure on the type system level that we are passing the correct types. This pr also fixes wrong usage of `relay_parent` as `candidate_hash` when communicating with the av storage. * Update core-primitives/src/lib.rs Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com> * Wrap the lines Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
This commit is contained in:
@@ -36,7 +36,7 @@ use polkadot_primitives::v1::{
|
||||
CollatorId, CommittedCandidateReceipt, CoreState, ErasureChunk,
|
||||
GroupRotationInfo, Hash, Id as ParaId, OccupiedCoreAssumption,
|
||||
PersistedValidationData, PoV, SessionIndex, SignedAvailabilityBitfield,
|
||||
ValidationCode, ValidatorId, ValidationData,
|
||||
ValidationCode, ValidatorId, ValidationData, CandidateHash,
|
||||
ValidatorIndex, ValidatorSignature, InboundDownwardMessage,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
@@ -289,31 +289,31 @@ impl BitfieldSigningMessage {
|
||||
#[derive(Debug)]
|
||||
pub enum AvailabilityStoreMessage {
|
||||
/// Query a `AvailableData` from the AV store.
|
||||
QueryAvailableData(Hash, oneshot::Sender<Option<AvailableData>>),
|
||||
QueryAvailableData(CandidateHash, oneshot::Sender<Option<AvailableData>>),
|
||||
|
||||
/// Query whether a `AvailableData` exists within the AV Store.
|
||||
///
|
||||
/// This is useful in cases when existence
|
||||
/// matters, but we don't want to necessarily pass around multiple
|
||||
/// megabytes of data to get a single bit of information.
|
||||
QueryDataAvailability(Hash, oneshot::Sender<bool>),
|
||||
QueryDataAvailability(CandidateHash, oneshot::Sender<bool>),
|
||||
|
||||
/// Query an `ErasureChunk` from the AV store by the candidate hash and validator index.
|
||||
QueryChunk(Hash, ValidatorIndex, oneshot::Sender<Option<ErasureChunk>>),
|
||||
QueryChunk(CandidateHash, ValidatorIndex, oneshot::Sender<Option<ErasureChunk>>),
|
||||
|
||||
/// Query whether an `ErasureChunk` 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 large
|
||||
/// quantities of data to get a single bit of information.
|
||||
QueryChunkAvailability(Hash, ValidatorIndex, oneshot::Sender<bool>),
|
||||
QueryChunkAvailability(CandidateHash, ValidatorIndex, oneshot::Sender<bool>),
|
||||
|
||||
/// Store an `ErasureChunk` in the AV store.
|
||||
///
|
||||
/// Return `Ok(())` if the store operation succeeded, `Err(())` if it failed.
|
||||
StoreChunk {
|
||||
/// A hash of the candidate this chunk belongs to.
|
||||
candidate_hash: Hash,
|
||||
candidate_hash: CandidateHash,
|
||||
/// A relevant relay parent.
|
||||
relay_parent: Hash,
|
||||
/// The index of the validator this chunk belongs to.
|
||||
@@ -328,7 +328,7 @@ pub enum AvailabilityStoreMessage {
|
||||
/// If `ValidatorIndex` is present store corresponding chunk also.
|
||||
///
|
||||
/// Return `Ok(())` if the store operation succeeded, `Err(())` if it failed.
|
||||
StoreAvailableData(Hash, Option<ValidatorIndex>, u32, AvailableData, oneshot::Sender<Result<(), ()>>),
|
||||
StoreAvailableData(CandidateHash, Option<ValidatorIndex>, u32, AvailableData, oneshot::Sender<Result<(), ()>>),
|
||||
}
|
||||
|
||||
impl AvailabilityStoreMessage {
|
||||
|
||||
Reference in New Issue
Block a user