Skip to content

Instantly share code, notes, and snippets.

@marekyggdrasil
Last active January 17, 2022 04:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marekyggdrasil/609e7d509def712f4b318cfb781d8283 to your computer and use it in GitHub Desktop.
Save marekyggdrasil/609e7d509def712f4b318cfb781d8283 to your computer and use it in GitHub Desktop.
weird MINA issue with keypair generation, attempting to develop a test for preimage proof https://github.com/o1-labs/snarkyjs-examples/blob/master/src/ex00_preimage.ts

Runs and passes, but if I uncomment line 27 it fails with

 console.log
    oo

      at Object.mM [as caml_pasta_fp_plonk_index_create] (node_modules/snarkyjs/dist/server/node_bindings/snarky_js_node.bc.js:2:23985)

  console.log
    eyo

      at Object.mM [as caml_pasta_fp_plonk_index_create] (node_modules/snarkyjs/dist/server/node_bindings/snarky_js_node.bc.js:2:24062)

 FAIL  src/balance.test.ts (23.983 s)
  balanceproof
    ✕ hash should match (8683 ms)

  ● balanceproof › hash should match

    thrown: "todo"

      31 |   });
      32 | });
    > 33 |
         | ^

      at src/balanceproof.test.ts:33:5
      at src/balanceproof.test.ts:26:1

my environment and snapp version

$ node -v
v17.3.0
$ snapp --version
0.1.28
import {
Poseidon,
Field,
isReady,
shutdown, Circuit, circuitMain, public_
} from 'snarkyjs';
class Main extends Circuit {
@circuitMain
static main(preimage: Field, @public_ hash: Field) {
Poseidon.hash([preimage]).assertEquals(hash);
}
}
describe('balanceproof', () => {
beforeAll(async () => {
await isReady;
});
afterAll(async () => {
await shutdown();
});
it('hash should match', async () => {
const preimage = Field.random();
const hash = Poseidon.hash([preimage]);
//const kp = Main.generateKeypair();
//const pi = Main.prove([preimage], [hash], kp);
//const isvalid = pi.verify(kp.verificationKey(), [hash]);
//expect(isvalid).toBe(true);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment