Skip to content

fix: wrong handling of insert return value #186

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

Merged
merged 1 commit into from
Jun 3, 2024

Conversation

nimrod-starkware
Copy link
Contributor

@nimrod-starkware nimrod-starkware commented Jun 3, 2024

This change is Reviewable

@nimrod-starkware nimrod-starkware self-assigned this Jun 3, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jun 3, 2024

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 62.17%. Comparing base (303f6d7) to head (80c0090).
Report is 1 commits behind head on main.

Files Patch % Lines
...patricia_merkle_tree/updated_skeleton_tree/tree.rs 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #186      +/-   ##
==========================================
+ Coverage   62.13%   62.17%   +0.03%     
==========================================
  Files          36       36              
  Lines        1624     1631       +7     
  Branches     1624     1631       +7     
==========================================
+ Hits         1009     1014       +5     
- Misses        565      567       +2     
  Partials       50       50              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@TzahiTaub TzahiTaub left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @nimrod-starkware)


crates/committer/src/patricia_merkle_tree/updated_skeleton_tree/tree.rs line 76 at r1 (raw file):

                };

                let _ = updated_skeleton_tree

No need

Copy link
Contributor

@TzahiTaub TzahiTaub left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @nimrod-starkware)


crates/committer/src/patricia_merkle_tree/updated_skeleton_tree/tree.rs line 79 at r1 (raw file):

                    .skeleton_tree
                    .insert(NodeIndex::ROOT, new_node)
                    .map(|_| panic!("Root node already exists in the updated skeleton tree"));

WDYT on this?

Suggestion:

updated_skeleton_tree
    .skeleton_tree
    .insert(NodeIndex::ROOT, new_node)
    .map_or((), |_| {
        unreachable!("Root node already exists in the updated skeleton tree")
    })

Copy link
Contributor

@TzahiTaub TzahiTaub left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @nimrod-starkware)


crates/committer/src/patricia_merkle_tree/updated_skeleton_tree/tree.rs line 79 at r1 (raw file):

Previously, TzahiTaub (Tzahi) wrote…

WDYT on this?

panic instead of unreachable

@nimrod-starkware nimrod-starkware force-pushed the nimrod/root_index_fix branch from 78f3339 to 80c0090 Compare June 3, 2024 13:40
Copy link
Contributor Author

@nimrod-starkware nimrod-starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @nimrod-starkware)


crates/committer/src/patricia_merkle_tree/updated_skeleton_tree/tree.rs line 79 at r1 (raw file):

Previously, TzahiTaub (Tzahi) wrote…

panic instead of unreachable

done

Copy link
Contributor

@TzahiTaub TzahiTaub left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @nimrod-starkware)

@nimrod-starkware nimrod-starkware added this pull request to the merge queue Jun 3, 2024
Merged via the queue into main with commit 586a960 Jun 3, 2024
12 checks passed
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