o1js: Compiling ZkProgram in the browser never ends

I noticed that a simple zkprogram I created did not compile in the browser. Then I tried to compile the zkprogram in the tutorial to see if the problem was with my program, but it did not compile either. Finally, when I removed the “SelfProof” parts in the zkprogram and compiled it, I saw that the process was completed without any problems. That’s why I decided to open an issue about this.

Tutorial ZkProgram ` const Add = ZkProgram({ name: ‘add-example’, publicInput: Field,

methods: { init: { privateInputs: [],

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

addNumber: {
  privateInputs: [SelfProof, Field],

  async method(
    newState: Field,
    earlierProof: SelfProof<Field, void>,
    numberToAdd: Field
  ) {
    earlierProof.verify();
    newState.assertEquals(earlierProof.publicInput.add(numberToAdd));
  },
},

add: {
  privateInputs: [SelfProof, SelfProof],

  async method(
    newState: Field,
    earlierProof1: SelfProof<Field, void>,
    earlierProof2: SelfProof<Field, void>
  ) {
    earlierProof1.verify();
    earlierProof2.verify();
    newState.assertEquals(
      earlierProof1.publicInput.add(earlierProof2.publicInput)
    );
  },
},

}, }); `

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

Ah it’s only when using recursion. (Just like the performance regression!)

Finally, it’s working! This problem took me about 10 days. Thank u @kadirchan.

https://github.com/o1-labs/o1js/issues/1890#issuecomment-2469029108 can you try "o1js": "https://pkg.pr.new/o1-labs/o1js@fc16ce3"