Skip to content

starknet_patricia: thread the leaf output map separately from LeafSource#14600

Merged
yoavGrs merged 1 commit into
mainfrom
starknet_patricia_separate_leaf_output_map
Jun 23, 2026
Merged

starknet_patricia: thread the leaf output map separately from LeafSource#14600
yoavGrs merged 1 commit into
mainfrom
starknet_patricia_separate_leaf_output_map

Conversation

@yoavGrs

@yoavGrs yoavGrs commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Move leaf_index_to_leaf_output out of the LeafSource::ComputeLeaves variant and
pass it to compute_filled_tree_rec as its own Arc, mirroring filled_tree_output_map.
This lets create reclaim the leaf output map via the existing
remove_arc_mutex_and_option_from_output_map helper instead of unwrapping the shared
LeafSource Arc and matching a single variant with an unreachable! arm.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

@yoavGrs yoavGrs self-assigned this Jun 23, 2026
@reviewable-StarkWare

Copy link
Copy Markdown

This change is Reviewable

@cursor

cursor Bot commented Jun 23, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Internal Patricia Merkle tree fill/refactor with unchanged public API; behavior should match prior Arc-reclaim logic with simpler teardown.

Overview
Refactors how computed leaf outputs are collected after FilledTreeImpl::create finishes the parallel fill.

LeafSource::ComputeLeaves now holds leaf_index_to_leaf_output as an Arc<HashMap<…>>, and create builds that map once, clones the Arc into the leaf source (same pattern as filled_tree_output_map). After compute_filled_tree_rec completes, it drop(leaf_source) so the caller’s Arc to the leaf output map can be reclaimed instead of Arc::into_inner on LeafSource plus a ComputeLeaves-only match with an unreachable! arm.

The duplicate remove_mutex_and_option_from_output_map helper is removed; leaf outputs are finalized with the existing remove_arc_mutex_and_option_from_output_map path used for the filled tree map.

Reviewed by Cursor Bugbot for commit 0427a83. Bugbot is set up for automated code reviews on this repo. Configure here.

@nimrod-starkware nimrod-starkware left a comment

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.

:lgtm:

@nimrod-starkware reviewed 1 file and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on yoavGrs).

Move leaf_index_to_leaf_output out of the LeafSource::ComputeLeaves variant and
pass it to compute_filled_tree_rec as its own Arc, mirroring filled_tree_output_map.
This lets create reclaim the leaf output map via the existing
remove_arc_mutex_and_option_from_output_map helper instead of unwrapping the shared
LeafSource Arc and matching a single variant with an unreachable! arm.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@yoavGrs yoavGrs changed the base branch from leaf_handling_in_a_single_match to graphite-base/14600 June 23, 2026 14:38
@yoavGrs yoavGrs force-pushed the starknet_patricia_separate_leaf_output_map branch from 0022d3b to 0427a83 Compare June 23, 2026 14:38
@yoavGrs yoavGrs force-pushed the graphite-base/14600 branch from 3efa5f7 to 01f17ad Compare June 23, 2026 14:38
@yoavGrs yoavGrs changed the base branch from graphite-base/14600 to main June 23, 2026 14:38
@yoavGrs yoavGrs added this pull request to the merge queue Jun 23, 2026
Merged via the queue into main with commit 23081d5 Jun 23, 2026
40 of 56 checks passed

Copy link
Copy Markdown

Security scan complete — no issues detected.


Generated by Claude Code

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.

4 participants