docs2 icon indicating copy to clipboard operation
docs2 copied to clipboard

Update code to most recent o1js for Tutorial 10: Account Updates

Open jackryanservia opened this issue 1 year ago • 4 comments

The example code for Tutorial 10: Account Updates needs to be updated so it's compatible with current versions of o1js. More code focus required: Feedback from @qwadratic for Tutorial 10: Tutorial 10: Account Updates > Non-upgradeable proof only: it is stated that asserting provedState == false is recommended in zkApps (multiple times), however we don’t use this assertion anywhere else.

jackryanservia avatar Oct 17 '23 19:10 jackryanservia

@jackryanservia Is this meant to be in the Docs repo?

ymekuria avatar Oct 17 '23 20:10 ymekuria

@ymekuria yes... can you help me understand the question? (I was wondering if this issue were in another repo... but it looks to me like docs2 is correct)

barriebyron avatar Oct 20 '23 17:10 barriebyron

I think I had a very similar thought when I went through tutorial 10. It says that image

But in all other code examples this pattern is absent.

Pfed-prog avatar Oct 29 '23 06:10 Pfed-prog

My understanding is that the following function runs on deploy and sets this.account.provedState to true

@method init() {
  this.account.provedState.requireEquals(this.account.provedState.get());
  this.account.provedState.get().assertFalse();

  super.init();
  this.num.set(Field(1));
  this.calls.set(Field(0));
}

Combined with in other methods

this.account.provedState.requireEquals(this.account.provedState.get());
this.account.provedState.get().assertTrue();

It ensures that first runs init() and not any other method except for deploy

And why we have this pattern here is because we enable proofs, which is not explicitly specified. But it is very important.

Pfed-prog avatar Feb 19 '24 01:02 Pfed-prog