Skip to content

chore!: move filled tree factory function to filled tree tree trait #125

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

Conversation

dorimedini-starkware
Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware commented May 18, 2024

This change is Reviewable

@codecov-commenter
Copy link

codecov-commenter commented May 18, 2024

Codecov Report

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

Project coverage is 72.62%. Comparing base (075757c) to head (d1a5e76).

Files Patch % Lines
...itter/src/patricia_merkle_tree/filled_tree/tree.rs 82.44% 8 Missing and 15 partials ⚠️
...patricia_merkle_tree/updated_skeleton_tree/tree.rs 63.63% 4 Missing ⚠️
...kle_tree/original_skeleton_tree/skeleton_forest.rs 0.00% 2 Missing ⚠️
crates/committer/src/block_committer/commit.rs 0.00% 1 Missing ⚠️
...ter/src/patricia_merkle_tree/filled_tree/errors.rs 0.00% 1 Missing ⚠️
...tricia_merkle_tree/updated_skeleton_tree/errors.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #125      +/-   ##
==========================================
+ Coverage   72.38%   72.62%   +0.23%     
==========================================
  Files          29       30       +1     
  Lines        1072     1074       +2     
  Branches     1072     1074       +2     
==========================================
+ Hits          776      780       +4     
+ Misses        258      257       -1     
+ Partials       38       37       -1     

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

@dorimedini-starkware dorimedini-starkware force-pushed the dori/move-filled-tree-creation-to-filled-tree-trait branch from 32e1676 to e065fe7 Compare May 18, 2024 11:18
Copy link
Collaborator Author

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

Reviewable status: 0 of 9 files reviewed, 5 unresolved discussions (waiting on @amosStarkware, @nimrod-starkware, and @TzahiTaub)

a discussion (no related file):
Outline:

  1. Moved error variants from the updated tree enum to the filled tree enum
  2. Moved methods from the updated tree to the filled tree (some became associated function on the way).
  3. As the updated skeleton no longer outputs a filled tree, it does not need a generic leaf type parameter anymore.
  4. The filled tree error now needs the L leaf type parameter
  5. Added get_nodes on the updated skeleton trait so the filled tree creation function has access to skeleton nodes for initilization


crates/committer/src/patricia_merkle_tree/filled_tree/errors.rs line 0 at r2 (raw file):

  1. errors moved from updated tree enum to filled tree enum since the construction logic has moved.
  2. derive_more::Display doesn't work for struct errors (e.g. DoubleUpdate), so removed this derive and replaced with #[error] attributes.

crates/committer/src/patricia_merkle_tree/filled_tree/tree.rs line 0 at r2 (raw file):
Functions copied from updated skeleton tree. Some minor changes:

  1. methods because associated functions (self. -> Self::)
  2. error types changed from updated skeleton error to filled tree error

crates/committer/src/patricia_merkle_tree/updated_skeleton_tree/errors.rs line 0 at r2 (raw file):
while moving errors from this enum to the filled tree error enum: added the thiserror::Error derive and the #[error] attribute


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

    },
    PoisonedLock(String),
    NonDroppedPointer(String),

this error was unused

Code quote:

NonDroppedPointer(String),

Copy link
Collaborator

@AvivYossef-starkware AvivYossef-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:

Reviewable status: 0 of 9 files reviewed, 5 unresolved discussions (waiting on @amosStarkware, @nimrod-starkware, and @TzahiTaub)

@dorimedini-starkware dorimedini-starkware force-pushed the dori/move-updated-skeleton-factory-function-to-updated-skeleton branch 2 times, most recently from 3bc484d to 1f9b578 Compare May 20, 2024 11:23
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 8 of 9 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 8 unresolved discussions (waiting on @amosStarkware, @dorimedini-starkware, and @nimrod-starkware)


crates/committer/src/patricia_merkle_tree/filled_tree/errors.rs line 21 at r2 (raw file):

    SerializeError(#[from] serde_json::Error),
    #[error(transparent)]
    UpdatedSkeletonError(#[from] UpdatedSkeletonTreeError),

Why was this added?

Code quote:

 UpdatedSkeletonError(#[from] UpdatedSkeletonTreeError),

crates/committer/src/patricia_merkle_tree/filled_tree/tree.rs line 193 at r2 (raw file):

    async fn create<H: HashFunction, TH: TreeHashFunction<L, H>>(
        updated_skeleton: impl UpdatedSkeletonTree,
        modifications: &Modifications<L>,

This was changed AFAIK

Suggestion:

LeafModifications

crates/committer/src/patricia_merkle_tree/updated_skeleton_tree/errors.rs line 4 at r2 (raw file):

#[derive(Debug, thiserror::Error)]
#[allow(dead_code)]

Is this needed?

Code quote:

#[allow(dead_code)]

@dorimedini-starkware dorimedini-starkware changed the base branch from dori/move-updated-skeleton-factory-function-to-updated-skeleton to main May 20, 2024 11:50
@dorimedini-starkware dorimedini-starkware force-pushed the dori/move-filled-tree-creation-to-filled-tree-trait branch from e065fe7 to 530387f Compare May 20, 2024 12:04
Copy link
Collaborator Author

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

Reviewable status: 4 of 9 files reviewed, 4 unresolved discussions (waiting on @amosStarkware, @nimrod-starkware, and @TzahiTaub)


crates/committer/src/patricia_merkle_tree/filled_tree/errors.rs line 21 at r2 (raw file):

Previously, TzahiTaub (Tzahi) wrote…

Why was this added?

this line in compute_filled_tree_rec:

let node = updated_skeleton.get_node(index)?;

crates/committer/src/patricia_merkle_tree/filled_tree/tree.rs line 193 at r2 (raw file):

Previously, TzahiTaub (Tzahi) wrote…

This was changed AFAIK

Done.

@dorimedini-starkware dorimedini-starkware force-pushed the dori/move-filled-tree-creation-to-filled-tree-trait branch from 530387f to 2aa06b9 Compare May 20, 2024 12:08
Signed-off-by: Dori Medini <dori@starkware.co>
@dorimedini-starkware dorimedini-starkware force-pushed the dori/move-filled-tree-creation-to-filled-tree-trait branch from 2aa06b9 to d1a5e76 Compare May 20, 2024 12:11
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 5 of 5 files at r3, 3 of 3 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @amosStarkware and @nimrod-starkware)

@dorimedini-starkware dorimedini-starkware added this pull request to the merge queue May 20, 2024
Merged via the queue into main with commit cc9877e May 20, 2024
10 of 11 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.

4 participants