-
Notifications
You must be signed in to change notification settings - Fork 1
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
Nimrod/sort once #288
Nimrod/sort once #288
Conversation
7546f80
to
8cd1275
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #288 +/- ##
==========================================
+ Coverage 70.65% 70.68% +0.02%
==========================================
Files 38 38
Lines 2021 2040 +19
Branches 2021 2040 +19
==========================================
+ Hits 1428 1442 +14
- Misses 524 529 +5
Partials 69 69 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 11 files at r1, all commit messages.
Reviewable status: 1 of 11 files reviewed, 1 unresolved discussion (waiting on @nimrod-starkware and @TzahiTaub)
crates/committer/src/patricia_merkle_tree/types.rs
line 241 at r1 (raw file):
pub(crate) fn from_sorted(sorted_indices: &'a [NodeIndex]) -> Self { Self(sorted_indices) }
this kind of defeats the purpose of the type...
I see this is needed because the create
function gets a sorted slice as input?
can you remove this from_sorted
method and pass the create
function an instance of SortedLeafIndices
?
Code quote:
/// Creates a new instance from the given indices. Assumes indices are sorted.
pub(crate) fn from_sorted(sorted_indices: &'a [NodeIndex]) -> Self {
Self(sorted_indices)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 1 of 11 files reviewed, 1 unresolved discussion (waiting on @dorimedini-starkware and @TzahiTaub)
crates/committer/src/patricia_merkle_tree/types.rs
line 241 at r1 (raw file):
Previously, dorimedini-starkware wrote…
this kind of defeats the purpose of the type...
I see this is needed because thecreate
function gets a sorted slice as input?
can you remove thisfrom_sorted
method and pass thecreate
function an instance ofSortedLeafIndices
?
I agree; that is what I wanted to do in the first place, but it brings some lifetime issues with it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed all commit messages.
Reviewable status: 1 of 11 files reviewed, 2 unresolved discussions (waiting on @dorimedini-starkware and @nimrod-starkware)
crates/committer/src/patricia_merkle_tree/original_skeleton_tree/skeleton_forest.rs
line 86 at r1 (raw file):
OriginalSkeletonTreeImpl, HashMap<NodeIndex, ContractState>, Vec<NodeIndex>,
- Add the new returned value to the docstring.
- We would like to return the
SortedLeafIndices
struct here. I'm not too familiar with specifying lifetimes and how complicated this is, if it's too much, then I suggest removing this struct and just given the namesorted_leaf_indices
everywhere, and doc here that we return the sorted leaves. @dorimedini-starkware if we can do some lifetime magic and help the compiler enforce this, please say so.
Code quote:
Vec<NodeIndex>,
This change is