-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: leafdata implementations #115
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #115 +/- ##
==========================================
- Coverage 73.10% 72.03% -1.08%
==========================================
Files 30 31 +1
Lines 1071 1087 +16
Branches 1071 1087 +16
==========================================
Hits 783 783
- Misses 251 267 +16
Partials 37 37 ☔ View full report in Codecov by Sentry. |
I would love to hear if you have a more elegant way of doing it. |
c312db6
to
1401918
Compare
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 2 of 5 files at r1, all commit messages.
Reviewable status: 2 of 5 files reviewed, all discussions resolved (waiting on @amosStarkware)
7a44f0d
to
f1fdaff
Compare
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.
The PR is for LeafdataImpl impl DB object trait.
Reviewable status: 0 of 6 files reviewed, all discussions resolved (waiting on @amosStarkware and @dorimedini-starkware)
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 5 files at r1, 3 of 5 files at r2, 1 of 2 files at r3, all commit messages.
Reviewable status: 5 of 6 files reviewed, 5 unresolved discussions (waiting on @amosStarkware and @AvivYossef-starkware)
crates/committer/src/patricia_merkle_tree/filled_tree/node_serde.rs
line 42 at r3 (raw file):
} impl<L: LeafData + DBObject> DBObject for FilledNode<L> {
All "filled leaves" (i.e. leaves with actual data) should be DBObjects, right?
since this is the case, I would bind the LeafData trait to DBObject directly (and remove the extra binding here):
trait LeafData: Clone + Sync + Send + DBObject
Suggestion:
<L: LeafData>
crates/committer/src/patricia_merkle_tree/filled_tree/node_serde.rs
line 80 at r3 (raw file):
} /// Returns the prefix of the filled node.
move this docstring (and rephrase to be general) to the DbObject
trait; in general it's best to document functions once.
if the specific implementation of a trait function should get it's own docstring, that would be a special case.
Suggestion:
/// Returns the storage key prefix of the DB object.
crates/committer/src/storage/serde_trait.rs
line 0 at r3 (raw file):
this file should be renamed to db_object.rs
or something... "serde" is no longer a good name.
not part of this PR in any case (non-blocking)
crates/committer/src/storage/serde_trait.rs
line 9 at r3 (raw file):
fn get_prefix(&self) -> StoragePrefix; /// Returns a `StorageKey` from a prefix and a suffix.
newline between functions
Suggestion:
fn get_prefix(&self) -> StoragePrefix;
/// Returns a `StorageKey` from a prefix and a suffix.
crates/committer_cli/src/tests/python_tests.rs
line 0 at r3 (raw file):
In this file I see this pattern several times:
leaf.get_db_key(leaf.suffix());
where leaf
is a FilledNode
.
please change this to
leaf.db_key();
I know you can't just add a suffix()
function to the DBObject trait, but you can add a db_key()
function to the impl<L: LeafData> FilledNode<L>
block which uses the suffix.
f1fdaff
to
2c6c42b
Compare
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 4 of 4 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @amosStarkware and @AvivYossef-starkware)
2c6c42b
to
ddbdbce
Compare
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 2 of 2 files at r5, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @amosStarkware and @AvivYossef-starkware)
Needed for the implementation of serialize for FilledTree<L: LeafData>.
This change is