-
Notifications
You must be signed in to change notification settings - Fork 1.2k
cumulus: support submission for candidates with older relay parents (max_relay_parent_age_session alignment) #11624
Description
Problem Statement
When max_relay_parent_session_age > 0, the relay chain accepts candidates built against relay parents from older sessions. However, for V3 collations the collator-side parent search uses a narrow ancestry window (scheduling_lookahead - 1 blocks) that breaks at session boundaries unconditionally, and discards the blocks corresponding to candidates at the relay parents in the previous session. However, the parachain blocks at those relay parents can still be considered, by checking the relay parents at the scheduling parents via ancestor_relay_parent_info runtime API. Aditionally, it is important that the candidate's parachain parent block we build upon to have been submitted at a scheduling parent that is in the same session as the current scheduling parent session. Lastly, we don't want an unincluded segment to age out for many sessions (as many blocks as max_relay_parent_session_age allows), in case the candidates in the segment are not backed on-chain/included. Until the resubmission implementation arrives we should build the relay parents ancestry in a similar fashion to how we build for relay parents, for V2 collations, only that they'll be build for the scheduling_parent for V3.
Things to address for V3
- We should find the parachain parent while checking their relay parents if they are valid with the relay client
ancestor_relay_parent_info. - Cache relay best hashes session in the
RelayChainDataCache. - Session-aware parachain block filtering — when evaluating a parachain block as a potential parent during DFS traversal, determine the session of its scheduling parent. For each candidate parachain parent: query the para client at that block to obtain its relay_parent_offset, extract the relay parent hash from the para block digest, add the offset to derive the scheduling parent number, and look up the scheduling parent's session from the cache (point 2 — the cache already holds session indices for cached relay blocks). Compare against the current session to decide whether the parachain block is a valid parent.
- Check the parachain parents in DFS for their scheduling parents's sessions against a scheduling parent ancestry, computed like we compute for relay parents, for V2 collations.
Steps to reproduce
#10742 has V3 related zn-sdk tests related to a parachain with relay_parent_offset > 0, which has bad throughput because of issues in relation to the above subjects, and should have throughput similar with the test where relay_parent_offset is 0. Validating the fix should factor in prospective parachains fix PR on the relay chain side ideally (will be opened soon by @alindima ), and an appropriate zn-sdk test where we configure the parachain with relay parent offset big enough to be able to submit candidates built against relay parents in the previous session, but scheduled in the current session.
cargo test --features zombie-ci --test tests zombie_ci::elastic_scaling::upgrade_to_3_cores::elastic_scaling_upgrade_to_3_cores