mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 16:51:03 +00:00
Implement PoV Distribution Subsystem (#1344)
* introduce candidatedescriptor type * add PoVDistribution message type * loosen bound on PoV Distribution to account for equivocations * re-export some types from the messages module * begin PoV Distribution subsystem * remove redundant index from PoV distribution * define state machine for pov distribution * handle overseer signals * set up control flow * remove `ValidatorStatement` section * implement PoV fetching * implement distribution logic * add missing ` * implement some network bridge event handlers * stub for message processing, handle our view change * control flow for handling messages * handle `awaiting` message * handle any incoming PoVs and redistribute * actually provide a subsystem implementation * remove set-builder notation * begin testing PoV distribution * test that we send awaiting messages only to peers with same view * ensure we distribute awaited PoVs to peers on view changes * test that peers can complete fetch and are rewarded * test some reporting logic * ensure peer is reported for flooding * test punishing peers diverging from awaited protocol * test that we eagerly complete peers' awaited PoVs based on what we receive * test that we prune the awaited set after receiving * expand pov-distribution in guide to match a change I made * remove unneeded import
This commit is contained in:
committed by
GitHub
parent
f83ba174f1
commit
151d73af5b
@@ -1 +1 @@
|
||||
Stub - This folder will hold networking subsystem implementations, each with their own crate.
|
||||
This folder holds all networking subsystem implementations, each with their own crate.
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
[package]
|
||||
name = "polkadot-pov-distribution"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
futures = "0.3.5"
|
||||
log = "0.4.8"
|
||||
futures-timer = "3.0.2"
|
||||
streamunordered = "0.5.1"
|
||||
polkadot-primitives = { path = "../../../primitives" }
|
||||
node-primitives = { package = "polkadot-node-primitives", path = "../../primitives" }
|
||||
parity-scale-codec = "1.3.0"
|
||||
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" }
|
||||
|
||||
[dev-dependencies]
|
||||
parking_lot = "0.10.0"
|
||||
subsystem-test = { package = "polkadot-subsystem-test-helpers", path = "../../test-helpers/subsystem" }
|
||||
assert_matches = "1.3.0"
|
||||
File diff suppressed because it is too large
Load Diff
@@ -28,11 +28,14 @@ use polkadot_primitives::{BlockNumber, Hash, Signature};
|
||||
use polkadot_primitives::parachain::{
|
||||
AbridgedCandidateReceipt, PoVBlock, ErasureChunk, BackedCandidate, Id as ParaId,
|
||||
SignedAvailabilityBitfield, SigningContext, ValidatorId, ValidationCode, ValidatorIndex,
|
||||
CandidateDescriptor,
|
||||
};
|
||||
use polkadot_node_primitives::{
|
||||
MisbehaviorReport, SignedFullStatement, View, ProtocolId,
|
||||
};
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
pub use sc_network::{ObservedRole, ReputationChange, PeerId};
|
||||
|
||||
/// A notification of a new backed candidate.
|
||||
@@ -214,6 +217,21 @@ pub enum ProvisionerMessage {
|
||||
ProvisionableData(ProvisionableData),
|
||||
}
|
||||
|
||||
/// Message to the PoV Distribution Subsystem.
|
||||
#[derive(Debug)]
|
||||
pub enum PoVDistributionMessage {
|
||||
/// Fetch a PoV from the network.
|
||||
///
|
||||
/// This `CandidateDescriptor` should correspond to a candidate seconded under the provided
|
||||
/// relay-parent hash.
|
||||
FetchPoV(Hash, CandidateDescriptor, oneshot::Sender<Arc<PoVBlock>>),
|
||||
/// Distribute a PoV for the given relay-parent and CandidateDescriptor.
|
||||
/// The PoV should correctly hash to the PoV hash mentioned in the CandidateDescriptor
|
||||
DistributePoV(Hash, CandidateDescriptor, Arc<PoVBlock>),
|
||||
/// An update from the network bridge.
|
||||
NetworkBridgeUpdate(NetworkBridgeEvent),
|
||||
}
|
||||
|
||||
/// A message type tying together all message types that are used across Subsystems.
|
||||
#[derive(Debug)]
|
||||
pub enum AllMessages {
|
||||
@@ -231,6 +249,8 @@ pub enum AllMessages {
|
||||
BitfieldDistribution(BitfieldDistributionMessage),
|
||||
/// Message for the Provisioner subsystem.
|
||||
Provisioner(ProvisionerMessage),
|
||||
/// Message for the PoV Distribution subsystem.
|
||||
PoVDistribution(PoVDistributionMessage),
|
||||
/// Message for the Runtime API subsystem.
|
||||
RuntimeApi(RuntimeApiMessage),
|
||||
/// Message for the availability store subsystem.
|
||||
|
||||
Reference in New Issue
Block a user