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

r1cs: PoseidonSpongeVar permutation #30

Closed
redshiftzero opened this issue Nov 16, 2022 · 3 comments · Fixed by #49
Closed

r1cs: PoseidonSpongeVar permutation #30

redshiftzero opened this issue Nov 16, 2022 · 3 comments · Fixed by #49
Assignees

Comments

@redshiftzero
Copy link
Member

redshiftzero commented Nov 16, 2022

Followup from #29: We are using PoseidonSpongeVar from ark-sponge for in-circuit hashing (ref penumbra-zone/penumbra#714).

~However, the implementation of the permutation via PoseidonSpongeVar::permute does not use the optimizations we added support for in our parameter generation code in #17 and in our poseidon-permutation crate in #20. For some concrete numbers, we saw a 1.9x reduction in the number of multiplications for our 4:1 hash (see PR text #21 for where this number comes from).

Edit: These optimizations only work out of circuit, as (ref section 6.2.1 in the paper), the R1CS cost does not change due to the (constant multiplication) linear layers.

@redshiftzero
Copy link
Member Author

To prioritize the above here are the circuit costs of various gadgets as of commit 0db4a2be63ff444aa5e481cf82e6eb22e6653500 (in penumbra):

The numbers below include the constraint cost of witnessing the required instance variables:

  • diversified_basepoint_not_identity (requires 1 Element instance variable): 1396
  • ephemeral_public_key_integrity (requires 2 Element instance variable, plus 1 scalar): 4982
  • value_commitment_integrity (requires 1 Element instance variable, 1 Fq, plus 2 scalar): 3376
  • note_commitment_integrity (requires 6 Fq, 1 Element): 3201
  • Verifying merkle path (requires 2 Fq, 1 merkle path variable (72 Fqs)): 8631
  • rk_integrity (1 Element, 1 scalar, 1 Fq): 5689
  • nullifier_integrity (4 Fq): 311
  • ak_not_identity (1 Element): 1396
  • witnessing a single decaf377 element: 1392

@redshiftzero redshiftzero removed the status in Testnets Feb 3, 2023
@redshiftzero redshiftzero added this to the 0.2.0 releases milestone Feb 9, 2023
@redshiftzero redshiftzero moved this to Future in Testnets Feb 26, 2023
@avahowell avahowell moved this from Future to Testnet 49: Pasiphae in Testnets Mar 10, 2023
@redshiftzero redshiftzero moved this from Testnet 49: Pasiphae to Future in Testnets Mar 15, 2023
@redshiftzero
Copy link
Member Author

This is no longer planned for implementation due to #40

@redshiftzero redshiftzero closed this as not planned Won't fix, can't repro, duplicate, stale Apr 27, 2023
@github-project-automation github-project-automation bot moved this from Future to Testnet 52: Amalthe in Testnets Apr 27, 2023
@redshiftzero redshiftzero removed this from Testnets Apr 27, 2023
@redshiftzero
Copy link
Member Author

Reopening as #40 was backburnered

@redshiftzero redshiftzero reopened this May 30, 2023
@redshiftzero redshiftzero moved this from Done to In Progress in Reify complete system in ZK May 30, 2023
@redshiftzero redshiftzero moved this from In Progress to Todo in Reify complete system in ZK May 30, 2023
@redshiftzero redshiftzero moved this to Next in Testnets May 30, 2023
@redshiftzero redshiftzero moved this from Next to In Progress in Testnets May 31, 2023
@redshiftzero redshiftzero moved this from In Progress to Testnet 54: Europa in Testnets Jun 1, 2023
This was referenced Jun 2, 2023
@redshiftzero redshiftzero changed the title r1cs: optimized PoseidonSpongeVar permutation r1cs: PoseidonSpongeVar permutation Jun 8, 2023
@redshiftzero redshiftzero removed this from Testnets Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

1 participant