Skip to content
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

Sinsemilla chip with HashDomain #67

Merged
merged 20 commits into from
Jun 22, 2021
Merged

Sinsemilla chip with HashDomain #67

merged 20 commits into from
Jun 22, 2021

Conversation

therealyingtong
Copy link
Contributor

@therealyingtong therealyingtong commented Apr 21, 2021

Part of #96. This PR only covers SinsemillaHash, not SinsemillaCommit.

The SinsemillaCommit functionality is in #118.

@therealyingtong therealyingtong force-pushed the ecc-chip-config branch 2 times, most recently from f90cee2 to 334c190 Compare April 23, 2021 13:31
@therealyingtong therealyingtong changed the base branch from ecc-chip-config to ecc-chip April 23, 2021 13:37
@therealyingtong therealyingtong force-pushed the sinsemilla-chip-config branch 2 times, most recently from 2395853 to a9f51be Compare April 28, 2021 20:45
@therealyingtong therealyingtong changed the base branch from ecc-chip to ecc-impl April 28, 2021 20:45
@codecov-commenter
Copy link

codecov-commenter commented May 3, 2021

Codecov Report

Merging #67 (6eba421) into ecc-chip (334c190) will increase coverage by 7.06%.
The diff coverage is 84.48%.

Impacted file tree graph

@@             Coverage Diff              @@
##           ecc-chip      #67      +/-   ##
============================================
+ Coverage     78.25%   85.32%   +7.06%     
============================================
  Files            36       56      +20     
  Lines          1964     4319    +2355     
============================================
+ Hits           1537     3685    +2148     
- Misses          427      634     +207     
Impacted Files Coverage Δ
src/constants/commit_ivk_r.rs 100.00% <ø> (ø)
src/constants/note_commit_r.rs 100.00% <ø> (ø)
src/constants/nullifier_k.rs 100.00% <ø> (ø)
src/constants/spend_auth_g.rs 100.00% <ø> (ø)
src/constants/value_commit_r.rs 100.00% <ø> (ø)
src/circuit/gadget/sinsemilla/message.rs 22.72% <22.72%> (ø)
src/primitives/redpallas.rs 64.28% <33.33%> (+1.78%) ⬆️
src/bundle.rs 44.76% <45.63%> (+44.76%) ⬆️
src/address.rs 66.66% <50.00%> (+66.66%) ⬆️
src/note/commitment.rs 76.47% <50.00%> (+76.47%) ⬆️
... and 86 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 96be699...6eba421. Read the comment docs.

@therealyingtong therealyingtong changed the title [WIP] Sinsemilla chip Sinsemilla chip May 4, 2021
@therealyingtong therealyingtong marked this pull request as ready for review May 4, 2021 13:50
@therealyingtong therealyingtong force-pushed the ecc-impl branch 2 times, most recently from 6f605a7 to 058e75b Compare May 6, 2021 08:00
@therealyingtong therealyingtong changed the title Sinsemilla chip [WIP] Sinsemilla chip May 11, 2021
@therealyingtong therealyingtong marked this pull request as draft May 11, 2021 13:02
therealyingtong and others added 3 commits June 20, 2021 11:00
This toggles the assignment of q_s2 on the last row of each piece.
We assign q_s2 = 2 on the last row of the final piece, and q_s2 = 0
on the last row of other pieces.

This allows us to process the final_piece in the main loop together
with the other pieces.

Co-authored-by: Jack Grigg <jack@electriccoin.co>
hash_piece() is an internal API, which means its caller hash_message()
is working in the same region. We rely on the caller to have already
assigned each piece's initial x_a at the correct offset before making
the call to hash_piece().

Co-authored-by: Jack Grigg <jack@electriccoin.co>
The gates "Secant line" and "Sinsemilla gate" were using the same
selectors and could be combined.

Co-authored-by: Jack Grigg <jack@electriccoin.co>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Copy link
Contributor

@str4d str4d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK. One small suggested refactor; the rest is doc comment fixes.

src/circuit/gadget/sinsemilla/chip/hash_to_point.rs Outdated Show resolved Hide resolved
src/circuit/gadget/sinsemilla/chip.rs Outdated Show resolved Hide resolved
src/circuit/gadget/sinsemilla/chip.rs Outdated Show resolved Hide resolved
src/circuit/gadget/sinsemilla/chip.rs Outdated Show resolved Hide resolved
src/circuit/gadget/sinsemilla/chip.rs Outdated Show resolved Hide resolved
src/circuit/gadget/sinsemilla/chip.rs Outdated Show resolved Hide resolved
src/circuit/gadget/sinsemilla/chip/hash_to_point.rs Outdated Show resolved Hide resolved
src/circuit/gadget/sinsemilla/chip/hash_to_point.rs Outdated Show resolved Hide resolved
src/circuit/gadget/sinsemilla/chip/hash_to_point.rs Outdated Show resolved Hide resolved
src/circuit/gadget/sinsemilla/message.rs Outdated Show resolved Hide resolved
@str4d

This comment has been minimized.

This allows the MockProver to see the fixed_y_q query as semantically
connected to q_sinsemilla1.

Co-authored-by: Jack Grigg <jack@electriccoin.co>
Copy link
Contributor

@str4d str4d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK bd08808.

sinsemilla-hash-layout

Comment on lines 180 to 182
// lambda2^2 - (x_a_next + x_r + x_a_cur) = 0
let secant_line =
lambda_2_cur.clone().square() - (x_a_next.clone() + x_r + x_a_cur.clone());
Copy link
Contributor

@daira daira Jun 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically this is implementing two secant lines, because x_r is itself computed by a secant line. ("Secant" means a line between two distinct points on a curve, extended to infinity in both directions.) I think this naming is fine though.

Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK bd08808 with minor comments.

@daira
Copy link
Contributor

daira commented Jun 21, 2021

(Image in #67 (review))

Why does this show some fixed columns being assigned outside a region? (or am I misinterpreting it?)

@str4d
Copy link
Contributor

str4d commented Jun 21, 2021

Why does this show some fixed columns being assigned outside a region? (or am I misinterpreting it?)

They aren't. Notice those fixed columns line up with equivalent rectangles in the advice columns. This is just an artifact of non-sequential columns being forced to take a sequence for rendering purposes; I split the same region across several boxes. It's clearer when labels are turned on, but in this case the lables overlapped too much and were distracting. It will be easier with an interactive viewer to indicate which boxes are part of the same region.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I resolved a remaining minor comment in 8af8447.

Copy link
Contributor

@str4d str4d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-ACK 8af8447 (trivial change)

@str4d str4d merged commit 66340e2 into main Jun 22, 2021
@str4d str4d deleted the sinsemilla-chip-config branch June 22, 2021 15:21
@r3ld3v r3ld3v removed the S-committed label Jul 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants