Skip to content

Commit 4064890

Browse files
paritytech-release-backport-bot[bot]eskimorgithub-actions[bot]
authored
[stable2603] Backport #11463 (#11471)
Backport #11463 into `stable2603` from eskimor. See the [documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md) on how to use this bot. <!-- # To be used by other automation, do not modify: original-pr-number: #${pull_number} --> Co-authored-by: eskimor <jfanatiker@gmx.at> Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 52ad53b commit 4064890

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

polkadot/node/core/backing/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2150,6 +2150,11 @@ async fn handle_second_message<Context>(
21502150
"Not seconding candidate: {}",
21512151
reason,
21522152
);
2153+
ctx.send_message(CollatorProtocolMessage::Invalid(
2154+
candidate.descriptor().scheduling_parent(),
2155+
candidate,
2156+
))
2157+
.await;
21532158
return Ok(());
21542159
}
21552160

polkadot/node/core/backing/src/tests/mod.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4234,8 +4234,11 @@ fn ambiguous_candidate_rejected_on_second() {
42344234

42354235
virtual_overseer.send(FromOrchestra::Communication { msg: second }).await;
42364236

4237-
// The candidate should be silently rejected — no validation work issued.
4238-
assert_matches!(virtual_overseer.recv().timeout(Duration::from_secs(1)).await, None);
4237+
// The candidate should be rejected and reported as invalid to collator protocol.
4238+
assert_matches!(
4239+
virtual_overseer.recv().await,
4240+
AllMessages::CollatorProtocol(CollatorProtocolMessage::Invalid(_, _))
4241+
);
42394242

42404243
virtual_overseer
42414244
});
@@ -4408,7 +4411,10 @@ fn version_acceptance_before_and_after_v3_activation_on_second() {
44084411
},
44094412
})
44104413
.await;
4411-
assert_matches!(virtual_overseer.recv().timeout(Duration::from_secs(1)).await, None);
4414+
assert_matches!(
4415+
virtual_overseer.recv().await,
4416+
AllMessages::CollatorProtocol(CollatorProtocolMessage::Invalid(_, _))
4417+
);
44124418

44134419
// 2. V3 candidate: rejected (V3NotEnabled).
44144420
let v3_candidate = CommittedCandidateReceipt {
@@ -4440,7 +4446,10 @@ fn version_acceptance_before_and_after_v3_activation_on_second() {
44404446
},
44414447
})
44424448
.await;
4443-
assert_matches!(virtual_overseer.recv().timeout(Duration::from_secs(1)).await, None);
4449+
assert_matches!(
4450+
virtual_overseer.recv().await,
4451+
AllMessages::CollatorProtocol(CollatorProtocolMessage::Invalid(_, _))
4452+
);
44444453

44454454
// --- Activate V3 ---
44464455
activate_v3_via_block_finalized(&mut virtual_overseer).await;
@@ -4458,7 +4467,10 @@ fn version_acceptance_before_and_after_v3_activation_on_second() {
44584467
},
44594468
})
44604469
.await;
4461-
assert_matches!(virtual_overseer.recv().timeout(Duration::from_secs(1)).await, None);
4470+
assert_matches!(
4471+
virtual_overseer.recv().await,
4472+
AllMessages::CollatorProtocol(CollatorProtocolMessage::Invalid(_, _))
4473+
);
44624474

44634475
// 4. V3 candidate: NOW ACCEPTED — passes check_version_acceptance.
44644476
// It proceeds past the version check into the normal seconding flow.

prdoc/pr_11463.prdoc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
title: Report back when candidate is rejected.
2+
doc:
3+
- audience: Node Dev
4+
description: |
5+
When the backing subsystem rejects a candidate due to descriptor version
6+
acceptance failure, it now sends `CollatorProtocolMessage::Invalid` back to
7+
the collator protocol so the collator's reputation is penalized. Previously
8+
this case silently dropped the candidate with no feedback.
9+
crates:
10+
- name: polkadot-node-core-backing
11+
bump: patch

0 commit comments

Comments
 (0)