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

Proving bug in Dex #498

Closed
bkase opened this issue Oct 19, 2022 · 2 comments · Fixed by #624
Closed

Proving bug in Dex #498

bkase opened this issue Oct 19, 2022 · 2 comments · Fixed by #624
Assignees
Labels
bug Something isn't working

Comments

@bkase
Copy link
Member

bkase commented Oct 19, 2022

This happens when creating a proof for Dex.redeemLiquidity()

In the Pickles wrap prover, the compute_witness step (in Plonk_constraint_system) fails when it tries to access external_vars at out-of-bounds indices.

The fact that this is the wrap prover makes the issue more mysterious because we wouldn't expect the wrap circuit to be influenced by a badly written snarkyjs circuit (which, for example, created less witnesses than expected or similar)

@Trivo25
Copy link
Member

Trivo25 commented Nov 10, 2022

Quick update: The bug seems to be caused by the method TokenContract.approveUpdateAndSend(zkappUpdate: AccountUpdate, to: PublicKey, amount: UInt64), more specifically, the AccountUpdate as argument.

@Trivo25 Trivo25 self-assigned this Nov 14, 2022
@Trivo25
Copy link
Member

Trivo25 commented Nov 21, 2022

The bug only appears when we try to prove an AccountUpdate (pass it as an argument to another zkApp method) where the authorization is either None_given or Proof, whereas signing the AccountUpdate (authorization: signature) works.

The bug appears when trying to prove the transaction (add the missing proofs to all AccountUpdates via the provers array https://github.com/MinaProtocol/mina/blob/develop/src/lib/snarky_js_bindings/lib/snarky_js_bindings_lib.ml#L2215)

panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: UnexpectedEof, message: "failed to fill whole buffer" }', src/arkworks/pasta_fp.rs:59:21 

this error can be traced back to compute_witness and https://github.com/MinaProtocol/mina/blob/develop/src/lib/crypto/kimchi_backend/common/plonk_constraint_system.ml#L464

where it seems like x is not being computed correctly(?) https://github.com/MinaProtocol/mina/blob/develop/src/lib/crypto/kimchi_backend/common/plonk_constraint_system.ml#L444

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants