mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 19:47:59 +00:00
remove unused RequestBlockAuthorshipData (#2455)
This commit is contained in:
committed by
GitHub
parent
4004217059
commit
59e2a810bb
@@ -84,7 +84,6 @@ struct ProvisioningJob {
|
||||
relay_parent: Hash,
|
||||
sender: mpsc::Sender<FromJobCommand>,
|
||||
receiver: mpsc::Receiver<ProvisionerMessage>,
|
||||
provisionable_data_channels: Vec<mpsc::Sender<ProvisionableData>>,
|
||||
backed_candidates: Vec<CandidateReceipt>,
|
||||
signed_bitfields: Vec<SignedAvailabilityBitfield>,
|
||||
metrics: Metrics,
|
||||
@@ -173,7 +172,6 @@ impl ProvisioningJob {
|
||||
relay_parent,
|
||||
sender,
|
||||
receiver,
|
||||
provisionable_data_channels: Vec::new(),
|
||||
backed_candidates: Vec::new(),
|
||||
signed_bitfields: Vec::new(),
|
||||
metrics,
|
||||
@@ -184,7 +182,7 @@ impl ProvisioningJob {
|
||||
|
||||
async fn run_loop(mut self, span: PerLeafSpan) -> Result<(), Error> {
|
||||
use ProvisionerMessage::{
|
||||
ProvisionableData, RequestBlockAuthorshipData, RequestInherentData,
|
||||
ProvisionableData, RequestInherentData,
|
||||
};
|
||||
loop {
|
||||
futures::select! {
|
||||
@@ -199,45 +197,11 @@ impl ProvisioningJob {
|
||||
self.awaiting_inherent.push(return_sender);
|
||||
}
|
||||
}
|
||||
Some(RequestBlockAuthorshipData(_, sender)) => {
|
||||
let _span = span.child("req-block-authorship");
|
||||
self.provisionable_data_channels.push(sender)
|
||||
}
|
||||
Some(ProvisionableData(_, data)) => {
|
||||
let _span = span.child("provisionable-data");
|
||||
let _timer = self.metrics.time_provisionable_data();
|
||||
|
||||
let mut bad_indices = Vec::new();
|
||||
for (idx, channel) in self.provisionable_data_channels.iter_mut().enumerate() {
|
||||
match channel.send(data.clone()).await {
|
||||
Ok(_) => {}
|
||||
Err(_) => bad_indices.push(idx),
|
||||
}
|
||||
}
|
||||
self.note_provisionable_data(data);
|
||||
|
||||
// clean up our list of channels by removing the bad indices
|
||||
// start by reversing it for efficient pop
|
||||
bad_indices.reverse();
|
||||
// Vec::retain would be nicer here, but it doesn't provide
|
||||
// an easy API for retaining by index, so we re-collect instead.
|
||||
self.provisionable_data_channels = self
|
||||
.provisionable_data_channels
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
.filter(|(idx, _)| {
|
||||
if bad_indices.is_empty() {
|
||||
return true;
|
||||
}
|
||||
let tail = bad_indices[bad_indices.len() - 1];
|
||||
let retain = *idx != tail;
|
||||
if *idx >= tail {
|
||||
let _ = bad_indices.pop();
|
||||
}
|
||||
retain
|
||||
})
|
||||
.map(|(_, item)| item)
|
||||
.collect();
|
||||
}
|
||||
None => break,
|
||||
},
|
||||
|
||||
@@ -551,9 +551,6 @@ pub type ProvisionerInherentData = (Vec<SignedAvailabilityBitfield>, Vec<BackedC
|
||||
/// In all cases, the Hash is that of the relay parent.
|
||||
#[derive(Debug)]
|
||||
pub enum ProvisionerMessage {
|
||||
/// This message allows potential block authors to be kept updated with all new authorship data
|
||||
/// as it becomes available.
|
||||
RequestBlockAuthorshipData(Hash, mpsc::Sender<ProvisionableData>),
|
||||
/// This message allows external subsystems to request the set of bitfields and backed candidates
|
||||
/// associated with a particular potential block hash.
|
||||
///
|
||||
@@ -567,7 +564,6 @@ pub enum ProvisionerMessage {
|
||||
impl BoundToRelayParent for ProvisionerMessage {
|
||||
fn relay_parent(&self) -> Hash {
|
||||
match self {
|
||||
Self::RequestBlockAuthorshipData(hash, _) => *hash,
|
||||
Self::RequestInherentData(hash, _) => *hash,
|
||||
Self::ProvisionableData(hash, _) => *hash,
|
||||
}
|
||||
|
||||
@@ -382,10 +382,7 @@ sequenceDiagram
|
||||
participant RA as RuntimeApi
|
||||
participant PO as Proposer
|
||||
|
||||
alt receive request to forward block authorship data
|
||||
A ->> PV: RequestBlockAuthorshipData
|
||||
Note over A,PV: This request contains a mpsc::Sender, which the Provisioner keeps
|
||||
else receive provisionable data
|
||||
alt receive provisionable data
|
||||
alt
|
||||
CB ->> PV: ProvisionableData
|
||||
else
|
||||
@@ -415,8 +412,7 @@ sequenceDiagram
|
||||
```
|
||||
|
||||
In principle, any arbitrary subsystem could send a `RequestInherentData` to the `Provisioner`. In practice,
|
||||
only the `Proposer` does so. Likewise, any arbitrary subsystem could send a `RequestBlockAuthorshipData`; the
|
||||
distinction is that no subsystem currently does so.
|
||||
only the `Proposer` does so.
|
||||
|
||||
The proposer is an atypical subsystem in that, unlike most of them, it is not primarily driven by
|
||||
the `Overseer`, but instead by the `sp_consensus::Environment` and `sp_consensus::Proposer` traits
|
||||
|
||||
@@ -34,9 +34,9 @@ Dispute resolution is complex and is explained in substantially more detail [her
|
||||
|
||||
Input: [`ProvisionerMessage`](../../types/overseer-protocol.md#provisioner-message). Backed candidates come from the [Candidate Backing subsystem](../backing/candidate-backing.md), signed bitfields come from the [Bitfield Distribution subsystem](../availability/bitfield-distribution.md), and misbehavior reports and disputes come from the [Misbehavior Arbitration subsystem](misbehavior-arbitration.md).
|
||||
|
||||
At initialization, this subsystem has no outputs. Block authors can send a `ProvisionerMessage::RequestBlockAuthorshipData`, which includes a channel over which provisionable data can be sent. All appropriate provisionable data will then be sent over this channel, as it is received.
|
||||
At initialization, this subsystem has no outputs.
|
||||
|
||||
Note that block authors must re-send a `ProvisionerMessage::RequestBlockAuthorshipData` for each relay parent they are interested in receiving provisionable data for.
|
||||
Block authors request the inherent data they should use for constructing the inherent in the block which contains parachain execution information.
|
||||
|
||||
## Block Production
|
||||
|
||||
@@ -89,8 +89,6 @@ To compute bitfield availability, then:
|
||||
|
||||
See also: [Scheduler Module: Availability Cores](../../runtime/scheduler.md#availability-cores).
|
||||
|
||||
One might ask: given `ProvisionerMessage::RequestInherentData`, what's the point of `ProvisionerMessage::RequestBlockAuthorshipData`? The answer is that the block authorship data includes more information than is present in the inherent data; disputes, for example.
|
||||
|
||||
## Functionality
|
||||
|
||||
The subsystem should maintain a set of handles to Block Authorship Provisioning Jobs that are currently live.
|
||||
|
||||
@@ -453,9 +453,6 @@ enum ProvisionableData {
|
||||
///
|
||||
/// In all cases, the Hash is that of the relay parent.
|
||||
enum ProvisionerMessage {
|
||||
/// This message allows potential block authors to be kept updated with all new authorship data
|
||||
/// as it becomes available.
|
||||
RequestBlockAuthorshipData(Hash, Sender<ProvisionableData>),
|
||||
/// This message allows external subsystems to request current inherent data that could be used for
|
||||
/// advancing the state of parachain consensus in a block building upon the given hash.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user