docs2
docs2 copied to clipboard
Update code to most recent o1js for Tutorial 10: Account Updates
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 Is this meant to be in the Docs repo?
@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)
I think I had a very similar thought when I went through tutorial 10. It says that
But in all other code examples this pattern is absent.
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.