-
Notifications
You must be signed in to change notification settings - Fork 136
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
Allow non-pure provable types as inputs/outputs in zkprogram #1828
Conversation
… ProvablePure to Provable
…m ProvablePure to Provable
…gram state for zk programs
…or clarity and consistency with its purpose
…e for better clarity and consistency in naming conventions
…r setting auxiliary output values
…ram function for future use and flexibility
…t for consistency and clarity
…r clarity and consistency
…to 'setAuxiliaryInput' for consistency
…f996b6ac35373dc27084ef
…by returning an empty array instead of throwing an error
…n favor of merging if else logic to improve readability
…utProgram example to handle case with only non-pure output
…e proof object for better readability and consistency in accessing proof properties
…nd publicInputAux by merging non-pure and pure input branch cases into one.
…p code and improve readability
…rack latest changes
…rogram to clean up code and improve readability docs(program-with-non-pure-input.ts): remove console logs related to NonPureInputProgram compilation for clarity and cleanliness
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! FYI I have reverted the mina and bindings commit
console.log('compile done'); | ||
let input = new MyStruct({ label: 'input', value: Field(5) }); | ||
let proof; | ||
({ proof } = await NonPureIOprogram.baseCase(input)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i actually didn't know you could reassign a deconstructed value without redeclaring the variable! :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implementation-wise, looks good to me!
we just have a problem with converting proofs to/from JSON now: proofs are serialized by doing toFields()
on publicInput
and publicOutput
and converting these fields to strings. this will work in toJSON()
, but will fail in fromJSON()
where the aux part in fromFields()
will be missing.
to solve that we'd need a general way to serialize any provable type. I have some ideas on that that I might post in a separate issue
huge simplification for so many zkprograms! 🥳 |
…le from o1js to clean up code and improve readability
Summary
This PR updates
ZkProgram
to allow non-pure provable types as inputs and outputs.Addresses #1675
Impact
Currently only pure provable types can be used as inputs and outputs to a
ZkProgram
. This PR improves the DX with changes that allow a developer to update rich provable types like aIndexedMerkleMap
or aMerkleList
in aZkProgram
.