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

verifying a ZkProgram proof inside a smart contract breaks #605

Closed
Trivo25 opened this issue Nov 28, 2022 · 1 comment
Closed

verifying a ZkProgram proof inside a smart contract breaks #605

Trivo25 opened this issue Nov 28, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Trivo25
Copy link
Member

Trivo25 commented Nov 28, 2022

works before SnarkyJS 0.7.0

let MyProgram = Experimental.ZkProgram({
  publicInput: Field,

  methods: {
    baseCase: {
      privateInputs: [],

      method(publicInput: Field) {
        publicInput.assertEquals(Field(0));
      },
    },
  },
});

class MyProof extends Proof<Field> {
  static publicInputType = Field;
  static tag = () => MyProgram;
}

class SimpleZkapp extends SmartContract {
  deploy(args: DeployArgs) {
    super.deploy(args);
    this.setPermissions({
      ...Permissions.default(),
      send: Permissions.proof(),
    });
  }

  @method verify(p: MyProof) {
    p.verify(); // no good
  }
}

bad verify: dlog_check

edit: bindings need to be updated to include the original fix MinaProtocol/mina#11698

after some investigating, i figured using the bindings from MinaProtocol/mina#11698 work for both the example above as well as https://github.com/o1-labs/snarkyjs/blob/main/src/examples/program.ts#L53
but a newer change in the mina repo broke both code snippets, not sure which one yet - it seems to be similar to MinaProtocol/mina#11389, which has been fixed a while ago and worked fine after the fix

@Trivo25 Trivo25 added the bug Something isn't working label Nov 28, 2022
@mitschabaude
Copy link
Collaborator

noooo! 😭

but a newer change in the mina repo broke both code snippets, not sure which one yet

that's a great find, could mean this can be fixed fairly easily.

we need a unit-test in the Mina repo to prevent this in the future!

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

No branches or pull requests

2 participants