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

Expose array lookups to SnarkyJS #13086

Closed
joseandro opened this issue Apr 25, 2023 · 2 comments
Closed

Expose array lookups to SnarkyJS #13086

joseandro opened this issue Apr 25, 2023 · 2 comments
Assignees
Labels
Epic Issues which contain other issues.

Comments

@joseandro
Copy link
Member

No description provided.

@joseandro joseandro added the Epic Issues which contain other issues. label Apr 25, 2023
@dannywillems
Copy link
Member

dannywillems commented Jun 6, 2023

(note - DRAFT)

For more context, lookups from plookup are fixed lookup tables, i.e they are the same for all circuits, and we can not therefore make tables at runtime and perform lookups in it.
The RFC Extended lookup tables describes, in particular, the concept of runtime tables.

The Rust code already implements the runtime table feature, but it is not exposed to Caml/Snarky/SnarkyJS.
In SnarkyJS, the developer should be able to define arrays at runtime, and perform lookups in it. The suggested syntax would be the same than accessing the element at the index i of the array arr, i.e. arr[i].
Tests can be found here and can help to drive the finish the epic. The final SnarkyJS implementation is described in this task and this task.

Regarding the implementation of runtime tables:

  • the setup has to be prepared for the presence of runtime tables using RuntimeTableCfg. Currently, commit ca0b9e53d15e3ab5db6fb8c20617979cbf74215e, the constraint system structure defined here tracks the runtime tables in its definition in the LookupConstraintSystem and the builder correctly uses the information (see here). However, on the Caml side, nothing is tracked (see here). This should be implemented and it is relatd to this task.
  • At proving time, the prover can use RuntimeTable to specify the actual tables. This is related to this task.

The important files are:

  • runtime_tables. It contains the runtime tables description (i.e. a list of id's and the lengths of each table that will be defined at runtime) which must be given in the setup phase and it describes the RuntimeTable structure that the prover must give.
  • plonk_dlog_proof.ml which defines the interface for the Plonk prover. The function create and its derivative should take as arguments a runtime table value.
  • plonk_constraint_system should track the runtime tables specification.

@dannywillems
Copy link
Member

dannywillems commented Jul 11, 2023

List of PR's, in order:

Wasm/JS definitions and converters between Wasm/jsoo

Prover index creation: runtime table cfgs

Prover index creation: lookup tables - #13089 and #13468

Prover: runtime tables - #13090

Constraint system creation

MISC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Epic Issues which contain other issues.
Projects
None yet
Development

No branches or pull requests

2 participants