Skip to content

Add CandidateDescriptorV3 support to experimental validator#11306

Merged
AlexandruCihodaru merged 19 commits intomasterfrom
acihodaru/experimental_validator_candidate_v3
Mar 24, 2026
Merged

Add CandidateDescriptorV3 support to experimental validator#11306
AlexandruCihodaru merged 19 commits intomasterfrom
acihodaru/experimental_validator_candidate_v3

Conversation

@AlexandruCihodaru
Copy link
Copy Markdown
Contributor

Adds CandidateDescriptorV3 support to the experimental validator-side collator protocol.

Fixes: #11084

… validator side

* Enable V3 candidate descriptor handling in the experimental collator
* Add tests for V3 acceptance, scheduling parent leaf enforcement,
  backwards compatibility, and unknown version rejection

Signed-off-by: Alexandru Cihodaru <alexandru.cihodaru@parity.io>
@AlexandruCihodaru AlexandruCihodaru self-assigned this Mar 9, 2026
@AlexandruCihodaru AlexandruCihodaru added T8-polkadot This PR/Issue is related to/affects the Polkadot network. T20-low-latency for issues and PRs related to Low Latency work labels Mar 9, 2026
@AlexandruCihodaru
Copy link
Copy Markdown
Contributor Author

/cmd prdoc --audience node_dev --bump minor

Comment thread polkadot/node/network/collator-protocol/src/validator_side_experimental/tests.rs Outdated
}

#[tokio::test]
// Test that a V3 descriptor is treated as V1 via backward compatibility
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about v2 ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can't be treated as v1, but indeed would be good to test a v2 descriptor is fine with v3 enabled

@eskimor eskimor added the A4-backport-stable2603 Pull request must be backported to the stable2603 release branch label Mar 9, 2026
Comment thread polkadot/node/network/collator-protocol/src/validator_side_experimental/common.rs Outdated
@AlexandruCihodaru
Copy link
Copy Markdown
Contributor Author

/cmd fmt

Extract LeafSchedulingInfo, slot extraction, and scheduling parent
validation into shared functions in lib.rs. Fix V3 tests that
incorrectly asserted scheduling_parent instead of relay_parent
for PVD requests.

Signed-off-by: Alexandru Cihodaru <alexandru.cihodaru@parity.io>
Copy link
Copy Markdown
Contributor

@alindima alindima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, some suggestions for the tests remain

}

#[tokio::test]
// Test that a V3 descriptor is treated as V1 via backward compatibility
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can't be treated as v1, but indeed would be good to test a v2 descriptor is fine with v3 enabled

Copy link
Copy Markdown
Member

@eskimor eskimor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work!

Some nits, but overall looks good!

Comment thread polkadot/node/network/collator-protocol/src/validator_side/mod.rs Outdated
Comment thread polkadot/node/network/collator-protocol/src/validator_side_experimental/common.rs Outdated
Signed-off-by: Alexandru Cihodaru <alexandru.cihodaru@parity.io>
Signed-off-by: Alexandru Cihodaru <alexandru.cihodaru@parity.io>
github-merge-queue Bot pushed a commit that referenced this pull request Mar 18, 2026
See discussion here:
#11306 (comment)

also fixes a bug, where for held off advertisements we would assume v3
descriptors are never used.
paritytech-release-backport-bot Bot pushed a commit that referenced this pull request Mar 18, 2026
See discussion here:
#11306 (comment)

also fixes a bug, where for held off advertisements we would assume v3
descriptors are never used.

(cherry picked from commit f02ad9e)
@AlexandruCihodaru
Copy link
Copy Markdown
Contributor Author

/cmd fmt

github-actions Bot and others added 2 commits March 20, 2026 21:53
Signed-off-by: Alexandru Cihodaru <alexandru.cihodaru@parity.io>
Copy link
Copy Markdown
Member

@eskimor eskimor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good on a quick pass, a few nits from last time don't seem addressed yet though.

Comment thread polkadot/node/network/collator-protocol/src/validator_side_experimental/common.rs Outdated
Signed-off-by: Alexandru Cihodaru <alexandru.cihodaru@parity.io>
Comment thread polkadot/node/network/collator-protocol/src/validator_side_experimental/common.rs Outdated
},
};

let core = match self.get_our_core(sender, leaf, session_index).await {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-existing but this looks wrong. We should determine our core based on the scheduling parent - not the active leaf. Otherwise calling this in the loop is also completely pointless: We enforce the session index to be the same for all ancestors, so this call will return the same core always.

Related: Requesting the session index for each ancestor may be sensible, if we use it to enforce the same session constraint (but that should already be enforced elsewhere), otherwise it is completely pointless to call here either.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this is pre-existing, not opposing a follow-up to keep diffs small.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-existing but this looks wrong. We should determine our core based on the scheduling parent - not the active leaf. Otherwise calling this in the loop is also completely pointless:

Indeed, this should be the ancestor.

Given that this is pre-existing, not opposing a follow-up to keep diffs small.

I agree

Copy link
Copy Markdown
Contributor Author

@AlexandruCihodaru AlexandruCihodaru Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

polkadot/node/network/collator-protocol/src/validator_side_experimental/collation_manager/mod.rs whould this do the trick?

I think so, although the test is setting the same core for all relay parents, so it would pass even without the fix. Moreover, maybe we could add a regression test that exercises the core index check instead of exposing this implementation detail as a test-only getter function.

Considering that this PR is already open for quite a while and ready for merge, let's merge it and open a subsequent PR later (this bug has already been here for a while)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eskimor can you approve?

Copy link
Copy Markdown
Member

@eskimor eskimor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found two issues, which should be addressed in a followup:

  1. Pre-existing, mixing up leaf with ancestor fetches.
  2. We validate the pvd on advertisements - but we use the scheduling parent. We should either just skip that check or use the relay parent if available (v3 protocol as introduced by Alin).

futures::join!(
state.handle_fetched_collation(&mut sender, (adv, res)),
test_state.assert_pvd_request(adv, None)
test_state.assert_pvd_request(adv, None, adv.scheduling_parent)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fail with v3. We should either skip this check entirely or use the relay parent Alin introduced in the advertisement.

@AlexandruCihodaru AlexandruCihodaru added this pull request to the merge queue Mar 24, 2026
@alindima
Copy link
Copy Markdown
Contributor

We validate the pvd on advertisements - but we use the scheduling parent. We should either just skip that check or use the relay parent if available (v3 protocol as introduced by Alin).

Where?

@alindima
Copy link
Copy Markdown
Contributor

We validate the pvd on advertisements - but we use the scheduling parent. We should either just skip that check or use the relay parent if available (v3 protocol as introduced by Alin).

Where?

You mean as part of the CanSecond request? I'll add the relay parent there on the prospective parachains PR

@eskimor
Copy link
Copy Markdown
Member

eskimor commented Mar 24, 2026

Sorry looked deeper, we only check that for v2. So it is fine. @AlexandruCihodaru

Merged via the queue into master with commit a1eb95e Mar 24, 2026
257 of 258 checks passed
@AlexandruCihodaru AlexandruCihodaru deleted the acihodaru/experimental_validator_candidate_v3 branch March 24, 2026 11:12
paritytech-release-backport-bot Bot pushed a commit that referenced this pull request Mar 24, 2026
Adds CandidateDescriptorV3 support to the experimental validator-side
collator protocol.

Fixes: #11084

---------

Signed-off-by: Alexandru Cihodaru <alexandru.cihodaru@parity.io>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
(cherry picked from commit a1eb95e)
@paritytech-release-backport-bot
Copy link
Copy Markdown

Successfully created backport PR for stable2603:

EgorPopelyaev pushed a commit that referenced this pull request Mar 24, 2026
Backport #11306 into `stable2603` from AlexandruCihodaru.

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}
-->

Signed-off-by: Alexandru Cihodaru <alexandru.cihodaru@parity.io>
Co-authored-by: Alexandru Cihodaru <40807189+AlexandruCihodaru@users.noreply.github.com>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
franciscoaguirre pushed a commit that referenced this pull request Mar 24, 2026
Adds CandidateDescriptorV3 support to the experimental validator-side
collator protocol.

Fixes: #11084

---------

Signed-off-by: Alexandru Cihodaru <alexandru.cihodaru@parity.io>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A4-backport-stable2603 Pull request must be backported to the stable2603 release branch T8-polkadot This PR/Issue is related to/affects the Polkadot network. T20-low-latency for issues and PRs related to Low Latency work

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Port collator protocol changes to new experimental collator protocol

5 participants