-
Notifications
You must be signed in to change notification settings - Fork 65
starknet_committer: hash leaves of both layouts #10918
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
base: ariel/add_index_layout_leaves
Are you sure you want to change the base?
Conversation
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 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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
429b73c to
e533d79
Compare
7501306 to
5ef8074
Compare
e533d79 to
a243807
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.
@ArielElp made 2 comments.
Reviewable status: 2 of 6 files reviewed, 2 unresolved discussions (waiting on @nimrod-starkware and @yoavGrs).
crates/starknet_committer/src/hash_function/hash.rs line 83 at r1 (raw file):
Previously, yoavGrs wrote…
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 be
TreeHashFunctionImpl. WDYT?
Done.
crates/starknet_committer/src/hash_function/hash.rs line 84 at r1 (raw file):
Previously, yoavGrs wrote…
It's worth using the const function
Felt::from_hex_uncheckedfor const strings.
Done.
5ef8074 to
aa16886
Compare
a243807 to
90e7204
Compare
aa16886 to
c737dbb
Compare
90e7204 to
3f524a2
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.
@yoavGrs reviewed 4 files and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ArielElp).
crates/starknet_committer/src/hash_function/hash.rs line 84 at r1 (raw file):
Previously, ArielElp wrote…
Done.
I want this Felt to be calculated at compilation time. For this, the variable should be const (or static).
Please define at the top of the module:
const CONTRACT_CLASS_LEAF_VERSION: Felt = Felt::from_hex_unchecked(CONTRACT_CLASS_LEAF_V0);
c737dbb to
b911edc
Compare
1c0264f to
a2c5570
Compare
b911edc to
2359a0b
Compare
a2c5570 to
b4a9eeb
Compare
2359a0b to
d3a873f
Compare
b4a9eeb to
7348d98
Compare
d3a873f to
4f38211
Compare
7348d98 to
f345f44
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.
@ArielElp made 1 comment.
Reviewable status: 2 of 6 files reviewed, 1 unresolved discussion (waiting on @yoavGrs).
crates/starknet_committer/src/hash_function/hash.rs line 84 at r1 (raw file):
Previously, yoavGrs wrote…
I want this Felt to be calculated at compilation time. For this, the variable should be
const(or static).
Please define at the top of the module:const CONTRACT_CLASS_LEAF_VERSION: Felt = Felt::from_hex_unchecked(CONTRACT_CLASS_LEAF_V0);
Done.
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.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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

No description provided.