-
Notifications
You must be signed in to change notification settings - Fork 0
fix: fix bug in tree hash function definition #121
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
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #121 +/- ##
==========================================
+ Coverage 69.98% 73.01% +3.02%
==========================================
Files 27 29 +2
Lines 1036 1156 +120
Branches 1036 1156 +120
==========================================
+ Hits 725 844 +119
- Misses 277 280 +3
+ Partials 34 32 -2 ☔ View full report in Codecov by Sentry. |
f674574
to
3724a6a
Compare
fae2d41
to
7ed54e3
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 3 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @amosStarkware, @aner-starkware, @nimrod-starkware, and @TzahiTaub)
crates/committer/src/patricia_merkle_tree/updated_skeleton_tree/hash_function.rs
line 28 at r2 (raw file):
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: &str = "0x434f4e54524143545f434c4153535f4c4541465f5630";
add a tiny unit test that asserts this is true
Code quote:
// The hex string corresponding to b'CONTRACT_CLASS_LEAF_V0' in big-endian.
pub const CONTRACT_CLASS_LEAF_V0: &str = "0x434f4e54524143545f434c4153535f4c4541465f5630";
crates/committer/src/patricia_merkle_tree/updated_skeleton_tree/hash_function_test.rs
line 65 at r2 (raw file):
#[rstest] // expected hash value was computed independently.
Suggestion:
Exp
2599da5
to
74e8936
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.
Reviewable status: 2 of 3 files reviewed, 1 unresolved discussion (waiting on @amosStarkware, @dorimedini-starkware, @nimrod-starkware, and @TzahiTaub)
crates/committer/src/patricia_merkle_tree/updated_skeleton_tree/hash_function.rs
line 28 at r2 (raw file):
Previously, dorimedini-starkware wrote…
add a tiny unit test that asserts this is true
Done.
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, @nimrod-starkware, and @TzahiTaub)
52f7e47
to
cbb2b68
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 4 of 4 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @amosStarkware, @aner-starkware, @nimrod-starkware, and @TzahiTaub)
crates/committer/src/patricia_merkle_tree/updated_skeleton_tree/hash_function.rs
line 49 at r4 (raw file):
"could not parse hex string corresponding to b'CONTRACT_CLASS_LEAF_V0' to Felt", ); PoseidonHashFunction::compute_hash(HashInputPair(
I don't like this... trees need two hash functions now? because the compiled class tree uses pedersen on internal nodes and poseidon on leaves?
Code quote:
PoseidonHashFunction
Previously, dorimedini-starkware wrote…
That's as far as I understand. Maybe we could leave it as an implementation detail (i.e., without generics) for now - we don't know if the second hash function (which is already Poseidon) will need to be changed. |
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: all files reviewed, 1 unresolved discussion (waiting on @amosStarkware, @aner-starkware, @nimrod-starkware, and @TzahiTaub)
crates/committer/src/patricia_merkle_tree/updated_skeleton_tree/hash_function.rs
line 49 at r4 (raw file):
Previously, aner-starkware wrote…
That's as far as I understand. Maybe we could leave it as an implementation detail (i.e., without generics) for now - we don't know if the second hash function (which is already Poseidon) will need to be changed.
I think we need to get rid of HashFunction
and only keep TreeHashFunction
, and all implementation details / low-level hash function choices should be in the tree hash function.
Out of scope of this PR anyway;
please add a TODO over this line and I'll unblock
cbb2b68
to
b064108
Compare
Previously, dorimedini-starkware wrote…
Done. |
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 r5, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @amosStarkware, @nimrod-starkware, and @TzahiTaub)
This change is