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

Generate witness WASM code input values mismatched #116

Open
psjm3 opened this issue Nov 15, 2024 · 1 comment
Open

Generate witness WASM code input values mismatched #116

psjm3 opened this issue Nov 15, 2024 · 1 comment

Comments

@psjm3
Copy link

psjm3 commented Nov 15, 2024

I am trying to use the EdDSAMiMCVerifier() in circomlib/circuits/eddsamimc.circom to do a proof on digital signature. My test case is pretty basic:

  1. Ran https://github.com/iden3/circomlib/blob/master/test/eddsamimc.js and obtained all the input values, this is what I got:
    { "Ax":13277427435165878497778222415993513565335242147425444199013288855685581939618, "Ay":13622229784656158136036771217484571176836296686641868549125388198837476602820, "R8x":11220723668893468001994760120794694848178115379170651044669708829805665054484, "R8y":2367470421002446880004241260470975644531657398480773647535134774673409612366, "S":1701898193987160140374512573986329501685719384866194117894109500242212188181, "M":1234 }

  2. Used this as the input.json.

  3. My test circom looks like this:

pragma circom 2.1.9;

include "comparators.circom";
include "eddsamimc.circom";

template signature_verifier() {
signal input Ax;
signal input Ay;
signal input R8x;
signal input R8y;
signal input S;
signal input M;

log("Ax: ", Ax);
log("Ay: ", Ay);
log("S: ", S);
log("R8x: ", R8x);
log("R8y: ", R8y);
log("M: ", M);

component verifier = EdDSAMiMCVerifier();
verifier.enabled <== 1;
verifier.R8x <== R8x;
verifier.R8y <== R8y;
verifier.S <== S;
verifier.M <== M;
verifier.Ax <== Ax;
verifier.Ay <== Ay;
}

component main {public [Ax, Ay, M] } = signature_verifier();

  1. Ran circom -l ${circomlib_root}/circuits --r1cs --wasm --sym and generated the _js source directory and other artifacts.

  2. cd to the _js source directory and ran:

node generate_witness.js exp_signature_proof.wasm input.json witness.wtns

  1. It failed with an assert error:

Error: Error: Assert Failed. Error in template ForceEqualIfEnabled_26 line: 56 Error in template EdDSAMiMCVerifier_27 line: 135 Error in template signature_verifier_28 line: 28

  1. Closer examination and noticed that the input values, when received in the signature_verifier() circuit, do not match with the values on input.json:

Ax: 13277427435165879229127886795061058173277359451067951153471836827297979039744 Ay: 13622229784656157736784627256215896066545076058497269563957821995114389569536 S: 1701898193987160122448868197294832073576701317149831509042190124625776607232 R8x: 11220723668893467327474997906289419325118072120038265370896252810391917166592 R8y: 2367470421002446701858687564640979405185980659008351169885193098691419832320 M: 1234

Could someone here helped me to debug this please? Thank you very much!

@psjm3
Copy link
Author

psjm3 commented Nov 15, 2024

Same behaviour when the cpp code was used to generate witness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant