refactor: Build dense MAST forests through finalization - #3329
Closed
huitseeker wants to merge 5 commits into
Closed
refactor: Build dense MAST forests through finalization#3329huitseeker wants to merge 5 commits into
huitseeker wants to merge 5 commits into
Conversation
huitseeker
force-pushed
the
issue-3325-mastforest-builder
branch
from
July 3, 2026 20:52
627c273 to
258f711
Compare
This was referenced Jul 3, 2026
huitseeker
force-pushed
the
issue-3067-rationalize-digests
branch
from
July 3, 2026 21:12
1454efa to
f2ee07d
Compare
huitseeker
force-pushed
the
issue-3325-mastforest-builder
branch
from
July 3, 2026 21:12
258f711 to
24b37d7
Compare
huitseeker
force-pushed
the
issue-3067-rationalize-digests
branch
from
July 3, 2026 23:54
f2ee07d to
74beb7b
Compare
huitseeker
force-pushed
the
issue-3325-mastforest-builder
branch
from
July 3, 2026 23:54
24b37d7 to
62af2ce
Compare
huitseeker
force-pushed
the
issue-3325-mastforest-builder
branch
from
July 4, 2026 01:06
62af2ce to
c3cd653
Compare
Collaborator
Author
|
Closing this in favor of #3334. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3325. On top of #3311. Re-do of #3326 after misclick
Dense
MastForestvalues now leave normal construction in canonical node order. Builders may still append while they are building, but they must call finalization before returning aMastForest.This PR adds
DenseMastForestBuilderfor dense construction.finish()andfinish_with_id_map()callMastForest::from_parts_with_id_map(), which ordersMastForest.nodesas external nodes, then basic blocks, then internal nodes. External nodes are sorted by digest. Children stay before parents. The returned ID map uses the final node IDs.MastForestMergernow builds through that builder and remaps root maps after finalization. The assemblyMastForestBuilderfinalizer now applies the final ID map before it builds source and debug metadata.The old append API is no longer available in normal builds.
add_to_forest()andmake_root()are limited to tests andarbitrary.Serialization now expects the in-memory order to be valid. It no longer rebuilds a canonical forest before writing. The dependency commitment reads the external node prefix directly.
Public examples now use
DenseMastForestBuilder, so docs do not point callers back to the append API.