mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 13:17:56 +00:00
Revert loop prevention (#4472)
* Provisioner: Only include and sign bitfields on fresh leaves.
This commit is contained in:
@@ -29,8 +29,8 @@ use polkadot_node_subsystem::{
|
||||
messages::{
|
||||
AllMessages, BoundToRelayParent, RuntimeApiMessage, RuntimeApiRequest, RuntimeApiSender,
|
||||
},
|
||||
overseer, ActiveLeavesUpdate, FromOverseer, OverseerSignal, SpawnedSubsystem, SubsystemContext,
|
||||
SubsystemSender,
|
||||
overseer, ActivatedLeaf, ActiveLeavesUpdate, FromOverseer, OverseerSignal, SpawnedSubsystem,
|
||||
SubsystemContext, SubsystemSender,
|
||||
};
|
||||
|
||||
pub use overseer::{
|
||||
@@ -48,7 +48,7 @@ use futures::{
|
||||
};
|
||||
use parity_scale_codec::Encode;
|
||||
use pin_project::pin_project;
|
||||
use polkadot_node_jaeger as jaeger;
|
||||
|
||||
use polkadot_primitives::v1::{
|
||||
AuthorityDiscoveryId, CandidateEvent, CommittedCandidateReceipt, CoreState, EncodeAs,
|
||||
GroupIndex, GroupRotationInfo, Hash, Id as ParaId, OccupiedCoreAssumption,
|
||||
@@ -64,7 +64,6 @@ use std::{
|
||||
fmt,
|
||||
marker::Unpin,
|
||||
pin::Pin,
|
||||
sync::Arc,
|
||||
task::{Context, Poll},
|
||||
time::Duration,
|
||||
};
|
||||
@@ -514,8 +513,7 @@ pub trait JobTrait: Unpin + Sized {
|
||||
///
|
||||
/// The job should be ended when `receiver` returns `None`.
|
||||
fn run<S: SubsystemSender>(
|
||||
parent: Hash,
|
||||
span: Arc<jaeger::Span>,
|
||||
leaf: ActivatedLeaf,
|
||||
run_args: Self::RunArgs,
|
||||
metrics: Self::Metrics,
|
||||
receiver: mpsc::Receiver<Self::ToJob>,
|
||||
@@ -563,8 +561,7 @@ where
|
||||
/// Spawn a new job for this `parent_hash`, with whatever args are appropriate.
|
||||
fn spawn_job<Job, Sender>(
|
||||
&mut self,
|
||||
parent_hash: Hash,
|
||||
span: Arc<jaeger::Span>,
|
||||
leaf: ActivatedLeaf,
|
||||
run_args: Job::RunArgs,
|
||||
metrics: Job::Metrics,
|
||||
sender: Sender,
|
||||
@@ -572,13 +569,13 @@ where
|
||||
Job: JobTrait<ToJob = ToJob>,
|
||||
Sender: SubsystemSender,
|
||||
{
|
||||
let hash = leaf.hash;
|
||||
let (to_job_tx, to_job_rx) = mpsc::channel(JOB_CHANNEL_CAPACITY);
|
||||
let (from_job_tx, from_job_rx) = mpsc::channel(JOB_CHANNEL_CAPACITY);
|
||||
|
||||
let (future, abort_handle) = future::abortable(async move {
|
||||
if let Err(e) = Job::run(
|
||||
parent_hash,
|
||||
span,
|
||||
leaf,
|
||||
run_args,
|
||||
metrics,
|
||||
to_job_rx,
|
||||
@@ -588,7 +585,7 @@ where
|
||||
{
|
||||
tracing::error!(
|
||||
job = Job::NAME,
|
||||
parent_hash = %parent_hash,
|
||||
parent_hash = %hash,
|
||||
err = ?e,
|
||||
"job finished with an error",
|
||||
);
|
||||
@@ -608,7 +605,7 @@ where
|
||||
|
||||
let handle = JobHandle { _abort_handle: AbortOnDrop(abort_handle), to_job: to_job_tx };
|
||||
|
||||
self.running.insert(parent_hash, handle);
|
||||
self.running.insert(hash, handle);
|
||||
}
|
||||
|
||||
/// Stop the job associated with this `parent_hash`.
|
||||
@@ -710,8 +707,7 @@ impl<Job: JobTrait, Spawner> JobSubsystem<Job, Spawner> {
|
||||
for activated in activated {
|
||||
let sender = ctx.sender().clone();
|
||||
jobs.spawn_job::<Job, _>(
|
||||
activated.hash,
|
||||
activated.span,
|
||||
activated,
|
||||
run_args.clone(),
|
||||
metrics.clone(),
|
||||
sender,
|
||||
|
||||
@@ -69,8 +69,7 @@ impl JobTrait for FakeCollatorProtocolJob {
|
||||
//
|
||||
// this function is in charge of creating and executing the job's main loop
|
||||
fn run<S: SubsystemSender>(
|
||||
_: Hash,
|
||||
_: Arc<jaeger::Span>,
|
||||
_: ActivatedLeaf,
|
||||
run_args: Self::RunArgs,
|
||||
_metrics: Self::Metrics,
|
||||
receiver: mpsc::Receiver<CollatorProtocolMessage>,
|
||||
|
||||
Reference in New Issue
Block a user