Skip to content

Commit 6952627

Browse files
Don't bubble up errors during collator score parsing in collator protocol (#11496)
When starting the node with a warp sync and we hit a period near the `WARP_SYNC_TARGET_BLOCK` (each 512 blocks) we might not be able to call a runtime apis for some blocks, which will yield an error in the collator protocol revamp. Don't bubble up such errors to prevent the subsystem from exiting. --------- Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> (cherry picked from commit 9d8a2fe)
1 parent 2fb9260 commit 6952627

File tree

2 files changed

+35
-1
lines changed
  • polkadot/node/network/collator-protocol/src/validator_side_experimental/peer_manager
  • prdoc

2 files changed

+35
-1
lines changed

polkadot/node/network/collator-protocol/src/validator_side_experimental/peer_manager/mod.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ async fn extract_reputation_bumps_on_new_finalized_block<Sender: CollatorProtoco
506506
target: LOG_TARGET,
507507
?latest_finalized_block_hash,
508508
processed_finalized_block_number,
509+
ancestors_len = ancestors.len(),
509510
"Processing reputation bumps for finalized relay parent {} and its {} ancestors",
510511
latest_finalized_block_number,
511512
ancestry_len
@@ -517,7 +518,30 @@ async fn extract_reputation_bumps_on_new_finalized_block<Sender: CollatorProtoco
517518
for i in 1..ancestors.len() {
518519
let rp = ancestors[i];
519520
let parent_rp = ancestors[i - 1];
520-
let candidate_events = recv_runtime(request_candidate_events(rp, sender).await).await?;
521+
522+
gum::trace!(
523+
target: LOG_TARGET,
524+
relay_parent=?rp,
525+
"request_candidate_events"
526+
);
527+
528+
let candidate_events = match recv_runtime(request_candidate_events(rp, sender).await).await
529+
{
530+
Ok(candidate_events) => candidate_events,
531+
Err(e) => {
532+
gum::trace!(
533+
target: LOG_TARGET,
534+
relay_parent=?rp,
535+
err=?e,
536+
"Error fetching candidate events for reputation bump extraction"
537+
);
538+
// `ancestors` are reversed so their order is from oldest to newest
539+
// (`get_ancestors()` returns newest -> oldest, but they are reversed after that).
540+
// So if this runtime call fails, the next one has got a better chance in
541+
// succeeding.
542+
continue;
543+
},
544+
};
521545

522546
for event in candidate_events {
523547
if let CandidateEvent::CandidateIncluded(receipt, _, _, _) = event {

prdoc/pr_11496.prdoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
title: Don't bubble up errors during collator score parsing in collator protocol
2+
doc:
3+
- audience: Node Dev
4+
description: |-
5+
When starting the node with a warp sync and we hit a period near the `WARP_SYNC_TARGET_BLOCK` (each 512 blocks) we might not be able to call a runtime apis for some blocks, which will yield an error in the collator protocol revamp.
6+
7+
Don't bubble up such errors to prevent the subsystem from exiting.
8+
crates:
9+
- name: polkadot-collator-protocol
10+
bump: patch

0 commit comments

Comments
 (0)