-
Notifications
You must be signed in to change notification settings - Fork 38
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
Merkle hash chip #98
Merkle hash chip #98
Conversation
14b2bbc
to
f2ed4c8
Compare
aca3788
to
9667781
Compare
Codecov Report
@@ Coverage Diff @@
## main #98 +/- ##
===========================================
+ Coverage 52.31% 83.98% +31.66%
===========================================
Files 16 53 +37
Lines 583 4657 +4074
===========================================
+ Hits 305 3911 +3606
- Misses 278 746 +468
Continue to review full report at Codecov.
|
b279de3
to
5074388
Compare
b025ffb
to
9882fe8
Compare
7669068
to
23e5018
Compare
6935a6a
to
44dd0eb
Compare
23e5018
to
ca15012
Compare
44dd0eb
to
edc6ec4
Compare
ca15012
to
19bcfa0
Compare
edc6ec4
to
e20c6e6
Compare
8a5f541
to
527963c
Compare
e20c6e6
to
96290d9
Compare
527963c
to
2731554
Compare
96290d9
to
6eba421
Compare
2731554
to
8602455
Compare
6eba421
to
5936258
Compare
8602455
to
63ecab5
Compare
copy( | ||
&mut region, | ||
|| "copy a", | ||
config.advices[0], |
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.
Maybe name these rather than repeating the indices from earlier?
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.
Instead of naming the columns, I have chosen to inline a table in the doc comments showing how they're being used in the custom gate:
The pieces and subpieces are arranged in the following configuration:
| A_0 | A_1 | A_2 | A_3 | A_4 | l_plus_1 |
----------------------------------------------------
| a | b | c | left | right | l + 1 |
| z1_a | z1_b | b_1 | b_2 | | |
// z_1 of SinsemillaHash(b) = b_1 + 2^5 b_2 | ||
// => b_0 = b - (z1_b * 2^10) | ||
let z1_b = meta.query_advice(advices[1], Rotation::next()); | ||
// b_1 has been constrained to be 5 bits outside this gate. |
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.
I don't see where this is done (I may have just missed it). Similarly for b_2
.
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.
This is done when witness_short_check()
is called in hash_layer()
.
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.
utACK modulo comments and suggestions.
This has three const generic parameters: PATH_LENGTH, K, MAX_WORDS. PATH_LENGTH is the length of the Merkle path being hashed. K and MAX_WORDS parameterize the internal Sinsemilla instance used in hashing the path.
…tions for MerkleChip
MerkleChip::configure() takes a SinsemillaConfig as input.
Co-authored-by: Daira Hopwood <daira@jacaranda.org> Co-authored-by: Jack Grigg <jack@electriccoin.co>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
c42b99c
to
3806a9d
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.
utACK 3806a9d with a non-blocking question. Layout LGTM.
// is decomposed. | ||
// - Disabling the entire decomposition gate when set to zero | ||
// (i.e. replacing a Selector). | ||
|
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.
Nit: Visually connect the comment to the fixed column:
I merged my suggestions, after confirming that the |
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.
utACK 7c38f14 (last three commits).
Hmm, looking at the layout, there's a single cell in the middle column that is taking up its own row in each 5-column side, and there is space in the previous row(s) for it to be moved to. |
Closes #95.