Skip to content

cumulus: Remove max_depth for the parent search#10973

Merged
bkchr merged 2 commits intomasterfrom
bkchr-remove-max-depth
Feb 3, 2026
Merged

cumulus: Remove max_depth for the parent search#10973
bkchr merged 2 commits intomasterfrom
bkchr-remove-max-depth

Conversation

@bkchr
Copy link
Copy Markdown
Member

@bkchr bkchr commented Feb 3, 2026

We were just incrementing this number all the time and there is actually no need to have it, as the search is already automatically bounded. For chains with 500ms blocks and relay offset of 1 we easily go above this limit and this then leads to forks.

So, let's remove the value.

We were just incrementing this number all the time and there is actually no need to have it, as the search is already automatically bounded.
For chains with 500ms blocks and relay offset of 1 we easily go above this limit and this then leads to forks.

So, let's remove the value.
@bkchr bkchr added the T9-cumulus This PR/Issue is related to cumulus. label Feb 3, 2026
@lexnv lexnv self-requested a review February 3, 2026 16:25
// we can guarantee that all imported blocks respect the unincluded segment
// rules specified by the parachain's runtime and thus will never be too deep. This is just an extra
// sanity check.
const PARENT_SEARCH_DEPTH: usize = 40;
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.

Would it be worth bumping this to 256 instead? It might be a good safeguard, not sure what other defaults we have in code tho

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You can only go back to the included block and the list of pending blocks can not grow infinite.

Copy link
Copy Markdown
Contributor

@lexnv lexnv left a comment

Choose a reason for hiding this comment

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

For 20mins of data for 12cores parachains:

  • 945 imported total blocks
  • 911 [Parachain] 🏆 Imported #560302

The chance of forked blocks is ~4%, which stabilizes the block times around 0.85s ~ 0.95s.

@bkchr
Copy link
Copy Markdown
Member Author

bkchr commented Feb 3, 2026

/cmd prdoc --audience node_dev --bump major

@bkchr bkchr enabled auto-merge February 3, 2026 20:30
@bkchr bkchr added this pull request to the merge queue Feb 3, 2026
Merged via the queue into master with commit ce86fea Feb 3, 2026
219 of 220 checks passed
@bkchr bkchr deleted the bkchr-remove-max-depth branch February 3, 2026 22:04
github-merge-queue Bot pushed a commit that referenced this pull request Feb 18, 2026
While reviewing #10973 I found once more that our parent search is
totally overengineered:
- It offers the option to search branches that do not contain the
pending block -> These branches can never be taken
- It returns a list of potential parents -> Nobody uses the list, we
only care about the latest block that we should build on

By eliminating these two annoyances, the code is a lot more simple and
easier to follow. There are still some defensive checks that are not
strictly necessary, but does not hurt to keep them.

In summary, the mental model is: Build on the latest descendant of the
pending block that is still inside the relay parent ancestry. If no
pending block is available, use the included block in its place.

---------

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

T9-cumulus This PR/Issue is related to cumulus.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants