-
Notifications
You must be signed in to change notification settings - Fork 0
build: filled forest #118
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
build: filled forest #118
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #118 +/- ##
==========================================
- Coverage 71.83% 70.60% -1.24%
==========================================
Files 31 32 +1
Lines 1090 1109 +19
Branches 1090 1109 +19
==========================================
Hits 783 783
- Misses 270 289 +19
Partials 37 37 ☔ View full report in Codecov by Sentry. |
d6f7eb9
to
8e9a49e
Compare
eb82f78
to
1c8a8a8
Compare
8e9a49e
to
55c75a9
Compare
f7df30d
to
ab99050
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 1 of 2 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @amosStarkware and @AvivYossef-starkware)
crates/committer/src/patricia_merkle_tree/filled_tree/forest.rs
line 14 at r2 (raw file):
#[allow(dead_code)] /// Serialize each tree and store it. fn write_to_storage(&self, storage: &mut S);
does this work?
Suggestion:
pub(crate) trait FilledForest<L: LeafData> {
#[allow(dead_code)]
/// Serialize each tree and store it.
fn write_to_storage(&self, storage: &mut impl Storage);
crates/committer/src/patricia_merkle_tree/filled_tree/forest.rs
line 21 at r2 (raw file):
} pub(crate) struct FilledForestImpl<L: LeafData + DBObject, T: FilledTree<L>> {
Suggestion:
<L: LeafData
crates/committer/src/patricia_merkle_tree/filled_tree/forest.rs
line 28 at r2 (raw file):
} impl<L: LeafData + DBObject, T: FilledTree<L>, S: Storage> FilledForest<L, S>
Suggestion:
L: LeafData
crates/committer/src/patricia_merkle_tree/filled_tree/forest.rs
line 43 at r2 (raw file):
// Store the contract tree. storage.mset(self.contract_tree.serialize()); }
I am assuming that setting to storage is not a "local" operation, so I prefer to parallelize all sets to a single op.
to that end, I would construct an iterator over all new values and call mset
once only.
Suggestion:
#[allow(dead_code)]
fn write_to_storage(&self, storage: &mut S) {
let new_db_objects = self
.storage_trees
.values()
.iter()
// Serialize each storage tree and store it in the storage object.
.flat_map(|tree| tree.serialize().iter())
// Store the compiled class tree.
.chain(self.compiled_class_tree.serialize().iter())
// Store the contract tree.
.chain(self.contract_tree.serialize().iter());
storage.mset(new_db_objects.collect());
}
55c75a9
to
2e06b90
Compare
ab99050
to
24f128b
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 1 of 1 files at r3, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @amosStarkware)
24f128b
to
5a664e1
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 1 of 1 files at r4, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @amosStarkware)
This change is