starknet_committer: hash leaves of both layouts#10918
starknet_committer: hash leaves of both layouts#10918ArielElp merged 1 commit intomain-v0.14.1-committerfrom
Conversation
nimrod-starkware
left a comment
There was a problem hiding this comment.
@nimrod-starkware reviewed 3 files and all commit messages, and made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @yoavGrs).
yoavGrs
left a comment
There was a problem hiding this comment.
@yoavGrs made 2 comments.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @ArielElp).
crates/starknet_committer/src/hash_function/hash.rs line 83 at r1 (raw file):
let compiled_class_hash: &CompiledClassHash = compiled_class_hash_leaf.as_ref(); let contract_class_leaf_version: Felt = Felt::from_hex( TreeHashFunctionImpl::CONTRACT_CLASS_LEAF_V0,
In the "global" namespace (TreeHashFunctionImpl), there is a constant defined only for compiled class hashes. In the same way, utils for compiled class hashes should be defined in the same place.
In addition, I prefer that the common place won't beTreeHashFunctionImpl. WDYT?
Code quote:
TreeHashFunctionImpl::CONTRACT_CLASS_LEAF_V0crates/starknet_committer/src/hash_function/hash.rs line 84 at r1 (raw file):
let contract_class_leaf_version: Felt = Felt::from_hex( TreeHashFunctionImpl::CONTRACT_CLASS_LEAF_V0, )
It's worth using the const function Felt::from_hex_unchecked for const strings.
Code quote:
let contract_class_leaf_version: Felt = Felt::from_hex(
TreeHashFunctionImpl::CONTRACT_CLASS_LEAF_V0,
)723ff23 to
5308358
Compare
b6a9e41 to
7f36c64
Compare
5308358 to
429b73c
Compare
yoavGrs
left a comment
There was a problem hiding this comment.
@yoavGrs reviewed 4 files and all commit messages, and resolved 1 discussion.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @ArielElp).
f345f44 to
ee08d41
Compare
4f38211 to
47793bf
Compare
dorimedini-starkware
left a comment
There was a problem hiding this comment.
@dorimedini-starkware reviewed 6 files and all commit messages, and made 3 comments.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @ArielElp).
crates/starknet_committer/src/hash_function/hash.rs line 18 at r5 (raw file):
// The hex string corresponding to b'CONTRACT_CLASS_LEAF_V0' in big-endian. pub const CONTRACT_CLASS_LEAF_V0: Felt = Felt::from_hex_unchecked("0x434f4e54524143545f434c4153535f4c4541465f5630");
this move of constants should have been a separate PR - broad change (many small diffs in different places), very easy to LGTM quickly, and self-contained
Code quote:
pub const CONTRACT_STATE_HASH_VERSION: Felt = Felt::ZERO;
// The hex string corresponding to b'CONTRACT_CLASS_LEAF_V0' in big-endian.
pub const CONTRACT_CLASS_LEAF_V0: Felt =
Felt::from_hex_unchecked("0x434f4e54524143545f434c4153535f4c4541465f5630");crates/starknet_committer/src/patricia_merkle_tree/leaf/leaf_impl.rs line 28 at r5 (raw file):
self } }
ditto
Code quote:
impl AsRef<ContractState> for ContractState {
fn as_ref(&self) -> &ContractState {
self
}
}crates/starknet_committer/src/patricia_merkle_tree/types.rs line 29 at r5 (raw file):
fn as_ref(&self) -> &CompiledClassHash { self }
also, can't you derive_more::AsRef it?
Suggestion:
fn as_ref(&self) -> &Self {
self
}47793bf to
c1448aa
Compare
ee08d41 to
450bebb
Compare
c1448aa to
f89d76a
Compare
450bebb to
031bb06
Compare
ArielElp
left a comment
There was a problem hiding this comment.
@ArielElp made 2 comments.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dorimedini-starkware).
crates/starknet_committer/src/patricia_merkle_tree/types.rs line 29 at r5 (raw file):
Previously, dorimedini-starkware wrote…
also, can't you
derive_more::AsRefit?
Nope, derive_more is for trivial wrappers Outer(inner).
crates/starknet_committer/src/patricia_merkle_tree/leaf/leaf_impl.rs line 28 at r5 (raw file):
Previously, dorimedini-starkware wrote…
ditto
Same as above
dorimedini-starkware
left a comment
There was a problem hiding this comment.
@dorimedini-starkware resolved 2 discussions.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @ArielElp).
031bb06 to
225adf4
Compare
f89d76a to
b2de623
Compare
225adf4 to
4a916eb
Compare
b2de623 to
8189934
Compare
8189934 to
fddb4ee
Compare
4a916eb to
793aaec
Compare
793aaec to
ede901b
Compare
dorimedini-starkware
left a comment
There was a problem hiding this comment.
@dorimedini-starkware reviewed 1 file and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @ArielElp).
857730a

No description provided.