Skip to content

Conversation

@ivokub
Copy link
Collaborator

@ivokub ivokub commented Jan 22, 2024

Description

This PR changes the mux from Lookup2 to selector.Mux which allows arbitrary switching. The change is backwards compatible (previously we threw an error if had more than 4 keys).

Fixes #966

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How has this been tested?

  • TestMux for non-native elements
  • TestMux for G1 elements (native and 2-chains)
  • Implemented PLONK aggregate verification with 5 keys instead of four.

How has this been benchmarked?

PLONK recursion over 10 proofs increase from 313833 to 314402.

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I did not modify files generated from templates
  • golangci-lint does not output errors locally
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@ivokub ivokub added the type: consolidate strengthen an existing feature label Jan 22, 2024
@ivokub ivokub requested review from gbotrel and yelhousni January 22, 2024 15:05
@ivokub ivokub self-assigned this Jan 22, 2024
@ivokub
Copy link
Collaborator Author

ivokub commented Jan 22, 2024

@gbotrel - included you for review as I'm doing some reflect stuff to switch over all fields in verification key.

@ivokub ivokub requested a review from gbotrel January 22, 2024 16:51
Copy link
Collaborator

@gbotrel gbotrel left a comment

Choose a reason for hiding this comment

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

high level tests looks decent to me, not sure about the specifics of the f.enforceWidthConditional and normalize each time I read emulated package I'm confused as to when to / when not to use them TBH.

@ivokub
Copy link
Collaborator Author

ivokub commented Jan 25, 2024

high level tests looks decent to me, not sure about the specifics of the f.enforceWidthConditional and normalize each time I read emulated package I'm confused as to when to / when not to use them TBH.

Regarding f.enforceWidthConditional - it is essentially to assert that witness limbs are in range. If it is already constrained the it is no-op, otherwise we range check.

I need normalize, as the the inputs may have different number of limbs or overflow. So the result needs to be with maximum number of limbs and overflow for further correct computations. I only need to use normalize for Select, Lookup2 and Mux.

@ivokub ivokub merged commit 2fbf083 into master Jan 25, 2024
@ivokub ivokub deleted the feat/n-bit-switch-plonk branch January 25, 2024 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: consolidate strengthen an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: allow arbitrary circuit verification in PLONK aggregation

3 participants