Skip to content

chore(skeleton): add new ctor to PathToBottom #188

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 5, 2024

Conversation

TzahiTaub
Copy link
Contributor

@TzahiTaub TzahiTaub commented Jun 3, 2024

This change is Reviewable

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

codecov-commenter commented Jun 3, 2024

Codecov Report

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

Project coverage is 62.83%. Comparing base (8ed29fd) to head (cd30cc9).
Report is 6 commits behind head on main.

Files Patch % Lines
...r/src/patricia_merkle_tree/node_data/inner_node.rs 76.19% 4 Missing and 1 partial ⚠️
...src/patricia_merkle_tree/filled_tree/node_serde.rs 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #188      +/-   ##
==========================================
+ Coverage   61.74%   62.83%   +1.08%     
==========================================
  Files          36       36              
  Lines        1660     1816     +156     
  Branches     1660     1816     +156     
==========================================
+ Hits         1025     1141     +116     
- Misses        585      623      +38     
- Partials       50       52       +2     

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

Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 14 files at r1, all commit messages.
Reviewable status: 5 of 14 files reviewed, 2 unresolved discussions (waiting on @TzahiTaub)


crates/committer/src/patricia_merkle_tree/node_data/errors.rs line 15 at r1 (raw file):

    },

    #[error("EdgePath {path:?} is too long for EdgePathLength {length:?}.")]

no newline between error variants (for consistency with everyone else)

Suggestion:

    },
    #[error("EdgePath {path:?} is too long for EdgePathLength {length:?}.")]

crates/committer/src/patricia_merkle_tree/node_data/inner_node.rs line 95 at r1 (raw file):

}

#[non_exhaustive]

ok this doesn't work

Code quote:

#[non_exhaustive]

@TzahiTaub TzahiTaub force-pushed the tzahi/skeleton/path_to_bottom_new_ctor branch from b9cfc2d to bef17f8 Compare June 3, 2024 12:36
Copy link
Contributor Author

@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: 5 of 14 files reviewed, 1 unresolved discussion (waiting on @dorimedini-starkware and @TzahiTaub)


crates/committer/src/patricia_merkle_tree/node_data/inner_node.rs line 95 at r1 (raw file):

Previously, dorimedini-starkware wrote…

ok this doesn't work

:)

@TzahiTaub TzahiTaub force-pushed the tzahi/skeleton/path_to_bottom_new_ctor branch 2 times, most recently from 6484a6a to d21a176 Compare June 3, 2024 12:39
Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware left a comment

Choose a reason for hiding this comment

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

Reviewed 8 of 14 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @TzahiTaub)


crates/committer/src/patricia_merkle_tree/node_data/inner_node.rs line 107 at r2 (raw file):

    /// Creates a new [PathToBottom] instance.
    // Asserts the path is not longer than the length.
    pub fn new(path: EdgePath, length: EdgePathLength) -> Result<Self, PathToBottomError> {

define a type for this (usages below)

Suggestion:

PathToBottomResult

crates/committer/src/patricia_merkle_tree/node_data/inner_node.rs line 154 at r2 (raw file):

            _fake_field: (),
        }
    }

Suggestion:

    pub(crate) fn concat_paths(&self, other: Self) -> PathToBottomResult {
        Self::new(
            EdgePath::from((self.path.0 << other.length.0) + other.path.0),
            self.length + other.length,
        )
    }

crates/committer/src/patricia_merkle_tree/node_data/inner_node.rs line 160 at r2 (raw file):

        &self,
        n_edges: EdgePathLength,
    ) -> Result<Self, PathToBottomError> {

Suggestion:

PathToBottomResult

crates/committer/src/patricia_merkle_tree/node_data/inner_node.rs line 171 at r2 (raw file):

            length: self.length - n_edges,
            _fake_field: (),
        })

Suggestion:

        Self::new(
            EdgePath(self.path.0 >> n_edges.0),
            self.length - n_edges,
        )

crates/committer/src/storage/errors.rs line 28 at r2 (raw file):

    EdgePathError(#[from] EdgePathError),
    #[error("Illegal PathToBottom: {0}")]
    PathToBottomError(#[from] PathToBottomError),

while you're here... these should be transparent

Suggestion:

    #[error(transparent)]
    ParsingError(#[from] serde_json::Error),
    #[error(transparent)]
    EdgePathError(#[from] EdgePathError),
    #[error(transparent)]
    PathToBottomError(#[from] PathToBottomError),

@TzahiTaub TzahiTaub force-pushed the tzahi/skeleton/path_to_bottom_new_ctor branch from d21a176 to cd30cc9 Compare June 3, 2024 14:23
Copy link
Contributor Author

@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, 5 unresolved discussions (waiting on @dorimedini-starkware)


crates/committer/src/patricia_merkle_tree/node_data/inner_node.rs line 107 at r2 (raw file):

Previously, dorimedini-starkware wrote…

define a type for this (usages below)

Done.


crates/committer/src/patricia_merkle_tree/node_data/inner_node.rs line 154 at r2 (raw file):

            _fake_field: (),
        }
    }

Not sure if its better to expect inside the concat function, as concatenation of two valid PathToBottoms should be a valid PathToBottom (unless they are too long together, but I think this will panic with u8 overflow and won't raise an error in any case). WDYT?


crates/committer/src/patricia_merkle_tree/node_data/inner_node.rs line 160 at r2 (raw file):

        &self,
        n_edges: EdgePathLength,
    ) -> Result<Self, PathToBottomError> {

Done.


crates/committer/src/patricia_merkle_tree/node_data/inner_node.rs line 171 at r2 (raw file):

            length: self.length - n_edges,
            _fake_field: (),
        })

Done.


crates/committer/src/storage/errors.rs line 28 at r2 (raw file):

Previously, dorimedini-starkware wrote…

while you're here... these should be transparent

Done.

Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware 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 2 of 2 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @TzahiTaub)

@TzahiTaub TzahiTaub added this pull request to the merge queue Jun 5, 2024
Merged via the queue into main with commit 6da65a7 Jun 5, 2024
12 checks passed
@TzahiTaub TzahiTaub deleted the tzahi/skeleton/path_to_bottom_new_ctor branch June 5, 2024 07:51
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