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

Authdecode (continued) #669

Open
wants to merge 4 commits into
base: poseidon_bn254_pad14
Choose a base branch
from
Open

Conversation

themighty1
Copy link
Member

@themighty1 themighty1 commented Dec 3, 2024

NOT YET READY FOR REVIEW.

(This PR is a continuation of #479. 479 was squash-merged to avoid rebase conflicts I've been getting).

This PR implements the AuthDecode protocol to be used to create zk-friendly commitments.

Temporarily, it uses a zk circuit which reveals to the Verifier the ranges being committed to. In the future, we will modify the circuit to hide the ranges.

* update to work with PSE halo2 0.3.0

- simpify protocol
- rebase on dev
- add mock backend
- fix failing tests
- use dedicated field element for salt

* add params from Axiom's setup

* add a constraint on 3 MSBs

* protocol refactor

* halo2 backend refactor. one test is failing.

* don't use `slice_to_columns` since it is bugged. all tests pass now.

* fix an incorrect constraint for unused advice cells

* use F::zero() instead of F::from(0)

* restore the use of `slice_to_columns`

* change plaintext type to u8 vec

* remove encoding verification

* make the protocol accept uncorrelated encodings

* use itybity for bit ops

* pack plaintext with byte granularity

This will make handling of commitments easier for the user since there will be no need
to perform bit manipulations.

* use opaque_debug with generics

* measure commitment chunk size in bytes, not bits

* cleanups

* split into core and io crates

* docs and cleanups

* move to crates root dir

* add changes in preparation to integration

* use `poseidon-gadget`s permute; change to lbs0;
@themighty1
Copy link
Member Author

I added commits in 479 which still need to be reviewed here:

Re commit: use poseidon-gadgets permute; change to lbs0;
The commit makes security-sensitive changes to the circuit:

  • uses a permutation chip from PSE's poseidon-gadget to achieve circomlib-compatible hashing
  • handles plaintext bits in LSB0 order (before it was in MSB0) and counts the limbs from low to high. This is in line with how other projects deal with bits and limbs.
  • introduces a zero advice cell to constrain values to be zero
  • hashes the salt with rate-3 Poseidon, since rate-2 Poseidon of circomlib requires 57 partial rounds but poseidon-gadget supports only even amount of partial rounds.

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.

1 participant