starknet_committer,starknet_committer_and_os_cli,starknet_patricia: make FilledNode generic#10750
Conversation
d9f45cd to
f3cd943
Compare
db10bd7 to
12afbd4
Compare
f3cd943 to
fec938d
Compare
12afbd4 to
2732847
Compare
2732847 to
4cc4295
Compare
fec938d to
525d944
Compare
nimrod-starkware
left a comment
There was a problem hiding this comment.
@nimrod-starkware reviewed 4 of 6 files at r1, all commit messages.
Reviewable status: 4 of 6 files reviewed, 5 unresolved discussions (waiting on @ArielElp and @yoavGrs)
crates/starknet_patricia/src/patricia_merkle_tree/filled_tree/tree_test.rs line 29 at r1 (raw file):
}; type FactDbFilledNode<L> = FilledNode<L, HashOutput>;
you already defined this alias. please delete here, define the alias as pub and use it here.
Code quote:
type FactDbFilledNode<L> = FilledNode<L, HashOutput>;crates/starknet_patricia/src/patricia_merkle_tree/filled_tree/node_serde.rs line 58 at r1 (raw file):
impl<L: Leaf> HasDynamicPrefix for FilledNode<L, HashOutput> { type KeyContext = <L as HasStaticPrefix>::KeyContext;
Did you intentionally delete the comment?
// Inherit the KeyContext from the HasStaticPrefix implementation of the leaf.
Code quote:
impl<L: Leaf> HasDynamicPrefix for FilledNode<L, HashOutput> {
type KeyContext = <L as HasStaticPrefix>::KeyContext;crates/starknet_patricia/src/patricia_merkle_tree/filled_tree/node_serde.rs line 66 at r1 (raw file):
.into() } }
does that work? I don't see a specific usage of the HashOutput type here.
Suggestion:
impl<L: Leaf, ChildData> FilledNode<L, ChildData> {
pub fn suffix(&self) -> [u8; SERIALIZE_HASH_BYTES] {
self.hash.0.to_bytes_be()
}
pub fn db_key(&self, key_context: &<L as HasStaticPrefix>::KeyContext) -> DbKey {
self.get_db_key(key_context, &self.suffix())
}
}
impl<L: Leaf, ChildData> HasDynamicPrefix for FilledNode<L, ChildData> {
type KeyContext = <L as HasStaticPrefix>::KeyContext;
fn get_prefix(&self, _key_context: &Self::KeyContext) -> DbKeyPrefix {
match &self.data {
NodeData::Binary(_) | NodeData::Edge(_) => PatriciaPrefix::InnerNode,
NodeData::Leaf(_) => PatriciaPrefix::Leaf(L::get_static_prefix(_key_context)),
}
.into()
}
}crates/starknet_patricia/src/patricia_merkle_tree/filled_tree/node_serde.rs line 75 at r1 (raw file):
} impl<L: Leaf> DBObject for FilledNode<L, HashOutput> {
use the alias you defined
Suggestion:
impl<L: Leaf> DBObject for FactDbFilledNode<L>crates/starknet_patricia/src/patricia_merkle_tree/filled_tree/tree.rs line 20 at r1 (raw file):
use crate::patricia_merkle_tree::updated_skeleton_tree::tree::UpdatedSkeletonTree; type FactDbFilledNode<L> = FilledNode<L, HashOutput>;
Please use this type wherever possible.
I actually think this should be defined somewhere in the facts_db module. is that possible? if currently not due to crate dependencies, please add a todo
Code quote:
type FactDbFilledNode<L> = FilledNode<L, HashOutput>;4cc4295 to
d1bbb0d
Compare
0ccc605 to
7cb7c31
Compare
d1bbb0d to
5a904f7
Compare
7cb7c31 to
6d39c01
Compare
5a904f7 to
57e9320
Compare
6ab1555 to
66d80a2
Compare
dorimedini-starkware
left a comment
There was a problem hiding this comment.
@dorimedini-starkware reviewed 1 of 6 files at r1, 5 of 6 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ArielElp)
crates/starknet_patricia/src/patricia_merkle_tree/filled_tree/tree.rs line 54 at r4 (raw file):
pub tree_map: HashMap<NodeIndex, FactDbFilledNode<L>>, pub root_hash: HashOutput, }
planning on making this generic...? or a separate type?
Code quote:
pub struct FilledTreeImpl<L: Leaf> {
pub tree_map: HashMap<NodeIndex, FactDbFilledNode<L>>,
pub root_hash: HashOutput,
}66d80a2 to
ac6ddd3
Compare
ArielElp
left a comment
There was a problem hiding this comment.
Reviewable status: 6 of 9 files reviewed, 1 unresolved discussion (waiting on @dorimedini-starkware, @nimrod-starkware, and @yoavGrs)
crates/starknet_patricia/src/patricia_merkle_tree/filled_tree/tree.rs line 54 at r4 (raw file):
Previously, dorimedini-starkware wrote…
planning on making this generic...? or a separate type?
Probably generic, but the code for serialization is mostly not written yet (there is an early draft)
dorimedini-starkware
left a comment
There was a problem hiding this comment.
@dorimedini-starkware reviewed 3 of 3 files at r5, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ArielElp)
crates/starknet_committer/src/db/facts_db/traversal.rs line 123 at r5 (raw file):
if !right_subtree.is_unmodified() { next_subtrees.push(right_subtree); }
move this to the prev PR
Code quote:
if !left_subtree.is_unmodified() {
next_subtrees.push(left_subtree);
}
if !right_subtree.is_unmodified() {
next_subtrees.push(right_subtree);
}d972786 to
d38f137
Compare
ac6ddd3 to
6ec738c
Compare
ArielElp
left a comment
There was a problem hiding this comment.
Reviewable status: 7 of 9 files reviewed, 1 unresolved discussion (waiting on @dorimedini-starkware, @nimrod-starkware, and @yoavGrs)
crates/starknet_committer/src/db/facts_db/traversal.rs line 123 at r5 (raw file):
Previously, dorimedini-starkware wrote…
move this to the prev PR
Done.
dorimedini-starkware
left a comment
There was a problem hiding this comment.
@dorimedini-starkware reviewed 2 of 2 files at r6, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @ArielElp)
6ec738c to
7b41917
Compare
d38f137 to
a3cc5b7
Compare
85b89ee to
f542a05
Compare
dorimedini-starkware
left a comment
There was a problem hiding this comment.
@dorimedini-starkware reviewed 1 of 1 files at r7, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @ArielElp)
Merge activity
|
…ake FilledNode generic
f542a05 to
a33b741
Compare
a3cc5b7 to
0eb7c84
Compare
dorimedini-starkware
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! all files reviewed, all discussions resolved (waiting on @ArielElp)
ece2fd3

No description provided.