Skip to content

starknet_patricia: extract finalize_binary_child helper from node_from_binary_data#14613

Open
yoavGrs wants to merge 1 commit into
starknet_patricia_separate_leaf_output_mapfrom
refactor_node_from_binary_data
Open

starknet_patricia: extract finalize_binary_child helper from node_from_binary_data#14613
yoavGrs wants to merge 1 commit into
starknet_patricia_separate_leaf_output_mapfrom
refactor_node_from_binary_data

Conversation

@yoavGrs

@yoavGrs yoavGrs commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Replace the two-iteration for loop with two calls to a new finalize_binary_child
helper, and collapse the let-else + re-match into a single direct match on the child.

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

@reviewable-StarkWare

Copy link
Copy Markdown

This change is Reviewable

yoavGrs commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

@cursor

cursor Bot commented Jun 23, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Mechanical refactor inside Patricia skeleton tree construction; logic is preserved with the same insert/assert paths.

Overview
Refactors node_from_binary_data when both children are non-empty: the inlined loop that finalized each child into the updated skeleton is replaced with two calls to a new private helper finalize_binary_child.

The helper uses a single match on TempSkeletonNode to map original binary/edge children to UpdatedSkeletonNode inserts, while leaves and unmodified subtrees still only get assertions or early returns (unchanged semantics).

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

@yoavGrs yoavGrs requested a review from nimrod-starkware June 23, 2026 13:45

@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).

…m_binary_data

Replace the two-iteration for loop with two calls to a new finalize_binary_child
helper, and collapse the let-else + re-match into a single direct match on the child.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@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 refactor_node_from_binary_data branch from 346ba06 to 2e27bf5 Compare June 23, 2026 14:38
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