-
Notifications
You must be signed in to change notification settings - Fork 65
starknet_committer,starknet_patricia,starknet_patricia_storage: add context to prefix and serde #10678
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
26d94e0 to
cfe3560
Compare
cc7d63a to
0a489d1
Compare
nimrod-starkware
left a comment
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.
@nimrod-starkware reviewed 18 of 20 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: 19 of 20 files reviewed, 5 unresolved discussions (waiting on @ArielElp)
crates/starknet_committer/src/db/facts_db/types.rs line 43 at r2 (raw file):
PatriciaPrefix::InnerNode.into() } }
Please include this change in your previous PR, where you defined SubTreeTrait.
Code quote:
fn get_root_prefix<L: Leaf>(
&self,
_key_context: &<L as HasStaticPrefix>::KeyContext,
) -> DbKeyPrefix {
if self.is_leaf() {
PatriciaPrefix::Leaf(L::get_static_prefix(_key_context)).into()
} else {
PatriciaPrefix::InnerNode.into()
}
}crates/starknet_patricia_storage/src/db_object.rs line 5 at r2 (raw file):
pub trait HasDynamicPrefix { type KeyContext;
Please doc the type
Code quote:
type KeyContext;crates/starknet_patricia_storage/src/db_object.rs line 22 at r2 (raw file):
fn get_prefix(&self, key_context: &Self::KeyContext) -> DbKeyPrefix { T::get_static_prefix(key_context) }
new line + doc
Suggestion:
/// ....
type KeyContext = <T as HasStaticPrefix>::KeyContext;
fn get_prefix(&self, key_context: &Self::KeyContext) -> DbKeyPrefix {
T::get_static_prefix(key_context)
}crates/starknet_patricia_storage/src/db_object.rs line 32 at r2 (raw file):
value: &DbValue, deserialize_context: &Self::DeserializeContext, ) -> Result<Self, DeserializationError>;
new line
Suggestion:
fn serialize(&self) -> DbValue;
fn deserialize(
value: &DbValue,
deserialize_context: &Self::DeserializeContext,
) -> Result<Self, DeserializationError>;crates/starknet_patricia/src/patricia_merkle_tree/traversal.rs line 97 at r2 (raw file):
&self, key_context: &<L as HasStaticPrefix>::KeyContext, ) -> DbKeyPrefix;
should be added in previous PR
Code quote:
fn get_root_prefix<L: Leaf>(
&self,
key_context: &<L as HasStaticPrefix>::KeyContext,
) -> DbKeyPrefix;0a489d1 to
d780fa0
Compare
1b5ee01 to
ee606a2
Compare
d780fa0 to
de081a6
Compare
yoavGrs
left a comment
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: 16 of 20 files reviewed, 6 unresolved discussions (waiting on @ArielElp and @nimrod-starkware)
a discussion (no related file):
Please break this PR.
Separate between adding the context type and the serde functions?
ee606a2 to
dedb25a
Compare
de081a6 to
9fcfd25
Compare
ArielElp
left a comment
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: 9 of 20 files reviewed, 6 unresolved discussions (waiting on @nimrod-starkware and @yoavGrs)
a discussion (no related file):
Previously, yoavGrs wrote…
Please break this PR.
Separate between adding the context type and the serde functions?
Done, this PR now only deals with KeyContext, next PR deals with serde
dedb25a to
4b296a6
Compare
9fcfd25 to
5d02a92
Compare
ArielElp
left a comment
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: 9 of 20 files reviewed, 6 unresolved discussions (waiting on @nimrod-starkware and @yoavGrs)
crates/starknet_committer/src/db/facts_db/types.rs line 43 at r2 (raw file):
Previously, nimrod-starkware wrote…
Please include this change in your previous PR, where you defined
SubTreeTrait.
Done.
crates/starknet_patricia/src/patricia_merkle_tree/traversal.rs line 97 at r2 (raw file):
Previously, nimrod-starkware wrote…
should be added in previous PR
Done.
crates/starknet_patricia_storage/src/db_object.rs line 5 at r2 (raw file):
Previously, nimrod-starkware wrote…
Please doc the type
Done.
crates/starknet_patricia_storage/src/db_object.rs line 22 at r2 (raw file):
Previously, nimrod-starkware wrote…
new line + doc
Done.
crates/starknet_patricia_storage/src/db_object.rs line 32 at r2 (raw file):
Previously, nimrod-starkware wrote…
new line
moved to next PR (will fix there)
e9a92dc to
921c961
Compare
dorimedini-starkware
left a comment
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.
@dorimedini-starkware reviewed 4 of 4 files at r13, all commit messages.
Reviewable status: 21 of 22 files reviewed, 3 unresolved discussions (waiting on @ArielElp and @yoavGrs)
921c961 to
e3d214c
Compare
ee209b3 to
3ca5e79
Compare
ArielElp
left a comment
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: 18 of 22 files reviewed, 3 unresolved discussions (waiting on @dorimedini-starkware and @yoavGrs)
crates/starknet_committer/src/db/external_test_utils.rs line 31 at r12 (raw file):
Previously, dorimedini-starkware wrote…
why do you force this test body to only work for leaves with empty key contexts?
Leafalready has a trait bound ofHasStaticPrefix,
and I'm guessingcreate_original_skeleton_treewill need to be refactored to take key contexts as input anyway; how will this be done?
create_original_skeleton_tree will have a layout generic argument
Given it's only facts ATM I needed to limit it to Empty. In the PR that inttroduces layout, this test still only deals with facts (no PRs for tests yet), but this is easily changable there (tree_computation_flow will receive a layout arg, layout knows how to generate key context).
crates/starknet_committer/src/forest/filled_forest.rs line 36 at r12 (raw file):
Previously, dorimedini-starkware wrote…
how are the changes here related to this PR?
A gt sync accident, removed
crates/starknet_committer/src/patricia_merkle_tree/tree.rs line at r12 (raw file):
Previously, dorimedini-starkware wrote…
how will you handle generalizing the code here?
if you plan on doing it in subsequent PRs, please at least add TODOs in this PR
In the top of the stack, code in this module (get_leaves closure) is only used by the os crates. Given that we don't serve storage proofs now (or store history), I think we don't need to generalize yet.
crates/starknet_committer/src/patricia_merkle_tree/leaf/leaf_impl.rs line at r12 (raw file):
Previously, dorimedini-starkware wrote…
you will define different leaf types for indexed layout?
Yes, they will be trivial wrappers for different implementations of DBObject (which depends on HasDynamicPrefix, which will also be different).ff
e3d214c to
155bc91
Compare
3ca5e79 to
6f6fe6f
Compare
155bc91 to
3018130
Compare
dorimedini-starkware
left a comment
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.
@dorimedini-starkware reviewed 3 of 3 files at r14, 1 of 1 files at r15, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ArielElp)
crates/starknet_committer/src/db/external_test_utils.rs line 31 at r12 (raw file):
Previously, ArielElp wrote…
create_original_skeleton_tree will have a layout generic argument
Given it's only facts ATM I needed to limit it to Empty. In the PR that inttroduces layout, this test still only deals with facts (no PRs for tests yet), but this is easily changable there (tree_computation_flow will receive a layout arg, layout knows how to generate key context).
please add a TODO here then
crates/starknet_committer/src/patricia_merkle_tree/tree.rs line at r12 (raw file):
Previously, ArielElp wrote…
In the top of the stack, code in this module (get_leaves closure) is only used by the os crates. Given that we don't serve storage proofs now (or store history), I think we don't need to generalize yet.
ok, please add some comment / docstring explaining why this code is layout-specific
6f6fe6f to
5515e1c
Compare
3018130 to
80a31a1
Compare
dorimedini-starkware
left a comment
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.
@dorimedini-starkware reviewed 1 of 1 files at r16, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @ArielElp)
ArielElp
left a comment
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:
complete! all files reviewed, all discussions resolved (waiting on @ArielElp)
crates/starknet_patricia/src/patricia_merkle_tree/filled_tree/tree.rs line 45 at r12 (raw file):
Previously, dorimedini-starkware wrote…
consider this, if it reduces boilerplate (non-blocking)
Will consider when continuing the top of the stack with serialization.
dorimedini-starkware
left a comment
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:
complete! all files reviewed, all discussions resolved (waiting on @ArielElp)
crates/starknet_patricia/src/patricia_merkle_tree/filled_tree/tree.rs line 45 at r12 (raw file):
Previously, ArielElp wrote…
Will consider when continuing the top of the stack with serialization.
why not now? key context type is layout-dependent, not specific tree dependent
ArielElp
left a comment
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:
complete! all files reviewed, all discussions resolved (waiting on @ArielElp)
crates/starknet_patricia/src/patricia_merkle_tree/filled_tree/tree.rs line 45 at r12 (raw file):
Previously, dorimedini-starkware wrote…
why not now? key context type is layout-dependent, not specific tree dependent
Just because there will probably be more changes around that trait. Now Iv'e actually tried it and apparantly associated types defaults are not stable yet.
80a31a1 to
e7343be
Compare
5515e1c to
18c69e2
Compare
e7343be to
ee3e662
Compare
dorimedini-starkware
left a comment
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.
@dorimedini-starkware reviewed 1 of 1 files at r17, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @ArielElp)
dorimedini-starkware
left a comment
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:
complete! all files reviewed, all discussions resolved (waiting on @ArielElp)

No description provided.