Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permit child MastNodeIds to exceed the MastNodeIds of their parents #1542

Conversation

PhilippGackstatter
Copy link
Contributor

Describe your changes

Permit child MastNodeIds to exceed the MastNodeIds of their parents during deserialization. This came up in the context of #1534 (see this comment chain for details).

Deserialization seems to be the only place where we had a requirement on the mentioned property, judging by the uses of MastNodeId::from_u32_safe.

A new constructor for MastNodeId was introduced that is similar to the existing one, except that it checks against a total expected node count of the forest instead of the current node count of the forest. This allows child IDs to exceed their parent's IDs, such as in a forest like

[Join(1, 2), Block(foo), Block(bar)]

However, we still want forests like this to fail during deserialization:

[Block(foo), Join(0, 2)]

And the added constructor handles these scenarios and both are tested.

Checklist before requesting a review

  • Repo forked and branch created from next according to naming convention.
  • Commit messages and codestyle follow conventions.
  • Relevant issues are linked in the PR description.
  • Tests added for new functionality.
  • Documentation/comments updated according to changes.

@PhilippGackstatter PhilippGackstatter changed the base branch from main to next October 22, 2024 08:07
@bobbinth
Copy link
Contributor

I'm wondering if we should try the approach I described in #1534 (comment) before going with this direction.

@PhilippGackstatter PhilippGackstatter force-pushed the pgackst-mast-forest-permit-child-ids-exceeding-parent-ids branch from 41b8a82 to a7d3dd9 Compare November 1, 2024 10:44
@PhilippGackstatter
Copy link
Contributor Author

@plafer @bitwalker Do you want to go ahead with this PR? I just rebased and it's ready from my side.

Copy link
Contributor

@plafer plafer left a comment

Choose a reason for hiding this comment

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

Yup, LGTM (with minor nit).

My only concern is that we're behind on reviewing #1531 , which also changes how serialization works. But the changes here are relatively minor and should be easy to fix any merge conflicts.

core/src/mast/mod.rs Show resolved Hide resolved
Copy link
Contributor

@bobbinth bobbinth 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! Thank you! I left just one small comment inline - but also would be good to get another look from @plafer or @bitwalker.

core/src/mast/serialization/info.rs Show resolved Hide resolved
@PhilippGackstatter PhilippGackstatter force-pushed the pgackst-mast-forest-permit-child-ids-exceeding-parent-ids branch from 400c0ac to c288b72 Compare November 1, 2024 19:27
@PhilippGackstatter PhilippGackstatter merged commit f1c0553 into next Nov 1, 2024
9 checks passed
@PhilippGackstatter PhilippGackstatter deleted the pgackst-mast-forest-permit-child-ids-exceeding-parent-ids branch November 1, 2024 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants