Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 4eeb8a1

Browse files
committed
Merge branch 'master' into andre/babe-next-epoch-api
2 parents 19a910e + 6b7f1f1 commit 4eeb8a1

File tree

6 files changed

+49
-38
lines changed

6 files changed

+49
-38
lines changed

Cargo.lock

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/core/backing/src/lib.rs

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -477,14 +477,14 @@ impl CandidateBackingJob {
477477
async fn run_loop(
478478
mut self,
479479
mut rx_to: mpsc::Receiver<CandidateBackingMessage>,
480-
span: &JaegerSpan
480+
span: PerLeafSpan,
481481
) -> Result<(), Error> {
482482
loop {
483483
futures::select! {
484484
validated_command = self.background_validation.next() => {
485485
let _span = span.child("process-validation-result");
486486
if let Some(c) = validated_command {
487-
self.handle_validated_candidate_command(c).await?;
487+
self.handle_validated_candidate_command(&span, c).await?;
488488
} else {
489489
panic!("`self` hasn't dropped and `self` holds a reference to this sender; qed");
490490
}
@@ -507,6 +507,7 @@ impl CandidateBackingJob {
507507
#[tracing::instrument(level = "trace", skip(self), fields(subsystem = LOG_TARGET))]
508508
async fn handle_validated_candidate_command(
509509
&mut self,
510+
parent_span: &JaegerSpan,
510511
command: ValidatedCandidateCommand,
511512
) -> Result<(), Error> {
512513
let candidate_hash = command.candidate_hash();
@@ -526,7 +527,7 @@ impl CandidateBackingJob {
526527
descriptor: candidate.descriptor.clone(),
527528
commitments,
528529
});
529-
self.sign_import_and_distribute_statement(statement).await?;
530+
self.sign_import_and_distribute_statement(statement, parent_span).await?;
530531
self.distribute_pov(candidate.descriptor, pov).await?;
531532
}
532533
}
@@ -545,7 +546,7 @@ impl CandidateBackingJob {
545546
};
546547

547548
self.issued_statements.insert(candidate_hash);
548-
self.sign_import_and_distribute_statement(statement).await?;
549+
self.sign_import_and_distribute_statement(statement, &parent_span).await?;
549550
}
550551
}
551552
}
@@ -601,8 +602,7 @@ impl CandidateBackingJob {
601602
}
602603

603604
let candidate_hash = candidate.hash();
604-
self.add_unbacked_span(&parent_span, candidate_hash);
605-
let span = self.get_unbacked_validation_child(&candidate_hash);
605+
let span = self.get_unbacked_validation_child(parent_span, candidate_hash);
606606

607607
self.background_validate_and_make_available(BackgroundValidationParams {
608608
tx_from: self.tx_from.clone(),
@@ -619,9 +619,13 @@ impl CandidateBackingJob {
619619
Ok(())
620620
}
621621

622-
async fn sign_import_and_distribute_statement(&mut self, statement: Statement) -> Result<(), Error> {
622+
async fn sign_import_and_distribute_statement(
623+
&mut self,
624+
statement: Statement,
625+
parent_span: &JaegerSpan,
626+
) -> Result<(), Error> {
623627
if let Some(signed_statement) = self.sign_statement(statement).await {
624-
self.import_statement(&signed_statement).await?;
628+
self.import_statement(&signed_statement, parent_span).await?;
625629
self.distribute_signed_statement(signed_statement).await?;
626630
}
627631

@@ -669,11 +673,12 @@ impl CandidateBackingJob {
669673
async fn import_statement(
670674
&mut self,
671675
statement: &SignedFullStatement,
676+
parent_span: &JaegerSpan,
672677
) -> Result<Option<TableSummary>, Error> {
673678
let import_statement_span = {
674679
// create a span only for candidates we're already aware of.
675680
let candidate_hash = statement.payload().candidate_hash();
676-
self.get_unbacked_statement_child(&candidate_hash, statement.validator_index())
681+
self.get_unbacked_statement_child(parent_span, candidate_hash, statement.validator_index())
677682
};
678683

679684
let stmt = primitive_statement_to_table(statement);
@@ -821,11 +826,10 @@ impl CandidateBackingJob {
821826
parent_span: &JaegerSpan,
822827
statement: SignedFullStatement,
823828
) -> Result<(), Error> {
824-
if let Some(summary) = self.import_statement(&statement).await? {
829+
if let Some(summary) = self.import_statement(&statement, parent_span).await? {
825830
if let Statement::Seconded(_) = statement.payload() {
826-
self.add_unbacked_span(parent_span, summary.candidate);
827831
if Some(summary.group_id) == self.assignment {
828-
let span = self.get_unbacked_validation_child(&summary.candidate);
832+
let span = self.get_unbacked_validation_child(parent_span, summary.candidate);
829833

830834
self.kick_off_validation_work(summary, span).await?;
831835
}
@@ -863,23 +867,32 @@ impl CandidateBackingJob {
863867
Ok(())
864868
}
865869

866-
fn add_unbacked_span(&mut self, parent_span: &JaegerSpan, hash: CandidateHash) {
870+
/// Insert or get the unbacked-span for the given candidate hash.
871+
fn insert_or_get_unbacked_span(&mut self, parent_span: &JaegerSpan, hash: CandidateHash) -> Option<&JaegerSpan> {
867872
if !self.backed.contains(&hash) {
868873
// only add if we don't consider this backed.
869-
self.unbacked_candidates.entry(hash).or_insert_with(|| {
874+
let span = self.unbacked_candidates.entry(hash).or_insert_with(|| {
870875
let mut span = parent_span.child("unbacked-candidate");
871876
span.add_string_tag("candidate-hash", &format!("{:?}", hash.0));
872877
span
873878
});
879+
Some(span)
880+
} else {
881+
None
874882
}
875883
}
876884

877-
fn get_unbacked_validation_child(&self, hash: &CandidateHash) -> Option<JaegerSpan> {
878-
self.unbacked_candidates.get(hash).map(|span| span.child("validation"))
885+
fn get_unbacked_validation_child(&mut self, parent_span: &JaegerSpan, hash: CandidateHash) -> Option<JaegerSpan> {
886+
self.insert_or_get_unbacked_span(parent_span, hash).map(|span| span.child("validation"))
879887
}
880888

881-
fn get_unbacked_statement_child(&self, hash: &CandidateHash, validator: ValidatorIndex) -> Option<JaegerSpan> {
882-
self.unbacked_candidates.get(hash).map(|span| {
889+
fn get_unbacked_statement_child(
890+
&mut self,
891+
parent_span: &JaegerSpan,
892+
hash: CandidateHash,
893+
validator: ValidatorIndex,
894+
) -> Option<JaegerSpan> {
895+
self.insert_or_get_unbacked_span(parent_span, hash).map(|span| {
883896
let mut span = span.child("import-statement");
884897
span.add_string_tag("validator-index", &format!("{}", validator));
885898
span
@@ -1053,7 +1066,7 @@ impl util::JobTrait for CandidateBackingJob {
10531066
};
10541067
drop(_span);
10551068

1056-
job.run_loop(rx_to, &span).await
1069+
job.run_loop(rx_to, span).await
10571070
}.boxed()
10581071
}
10591072
}

node/subsystem-test-helpers/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ tracing = "0.1.22"
1313
tracing-futures = "0.2.4"
1414
parity-scale-codec = { version = "1.3.5", default-features = false, features = ["derive"] }
1515
parking_lot = "0.11.1"
16-
pin-project = "1.0.2"
16+
pin-project = "1.0.3"
1717
polkadot-node-primitives = { path = "../primitives" }
1818
polkadot-node-subsystem = { path = "../subsystem" }
1919
polkadot-node-subsystem-util = { path = "../subsystem-util" }

node/subsystem-util/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ futures = "0.3.8"
1111
futures-timer = "3.0.2"
1212
parity-scale-codec = { version = "1.3.5", default-features = false, features = ["derive"] }
1313
parking_lot = { version = "0.11.1", optional = true }
14-
pin-project = "1.0.2"
14+
pin-project = "1.0.3"
1515
streamunordered = "0.5.1"
1616
thiserror = "1.0.23"
1717
tracing = "0.1.22"

node/subsystem/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ tracing = "0.1.22"
1717
tracing-futures = "0.2.4"
1818
parity-scale-codec = { version = "1.3.5", default-features = false, features = ["derive"] }
1919
parking_lot = "0.11.1"
20-
pin-project = "1.0.2"
20+
pin-project = "1.0.3"
2121
polkadot-node-primitives = { path = "../primitives" }
2222
polkadot-node-network-protocol = { path = "../network/protocol" }
2323
polkadot-primitives = { path = "../../primitives" }

runtime/common/src/claims.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,8 +1168,6 @@ mod benchmarking {
11681168
}
11691169

11701170
benchmarks! {
1171-
_ { }
1172-
11731171
// Benchmark `claim` including `validate_unsigned` logic.
11741172
claim {
11751173
let c = MAX_CLAIMS;

0 commit comments

Comments
 (0)