You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in o1js, and the zkApps protocol, we can set preconditions on certain network or account state in transactions/account updates (smart contracts) that only succeed if the preconditions are fulfilled.
There are two types of preconditions that we have access to:
network - anything network related (slot, timestamp, ..)
account - anything account related (balance, app state, nonce, ..)
However, account preconditions can not be set on account permissions. We want to enable zkApp developers to set preconditions on permissions. For example, we want a transaction only to succeed if another account has their permissions set to something specific.
In a zkApp, this would look like this:
classSimpleZkappextendsSmartContract{
@methodasyncdoSmth(){// do something// assert that the balance is greater than 10letbalance=this.account.balance.getAndRequireEquals();balance.assertGreaterThanOrEqual(UInt64.from(10));// assert that the nonce to equal to 1letnonce=this.account.nonce.getAndRequireEquals();nonce.assertEquals(UInt32.from(1));// ideally, setting preconditions on permissions would work the same way!}}
In order to add preconditions on permissions, we have to adjust the protocol (and any resulting transaction structures, checks and o1js) accordingly.
For example, the body of an account update has a preconditions field that looks like this currently (this is auto generated from ocaml)
Goal: Change the zkApps protocol (OCaml, transaction structure, txn snark checks, and eventually o1js) accordingly to support preconditions on accounts
The text was updated successfully, but these errors were encountered:
in o1js, and the zkApps protocol, we can set preconditions on certain network or account state in transactions/account updates (smart contracts) that only succeed if the preconditions are fulfilled.
There are two types of preconditions that we have access to:
However, account preconditions can not be set on account permissions. We want to enable zkApp developers to set preconditions on permissions. For example, we want a transaction only to succeed if another account has their permissions set to something specific.
In a zkApp, this would look like this:
In order to add preconditions on permissions, we have to adjust the protocol (and any resulting transaction structures, checks and o1js) accordingly.
For example, the
body
of an account update has apreconditions
field that looks like this currently (this is auto generated from ocaml)https://github.com/o1-labs/o1js-bindings/blob/ff3588199eaf8f423c4474862f049bf1d8ed4c77/mina-transaction/gen/transaction.ts#L268-L373?plain=1
Goal: Change the zkApps protocol (OCaml, transaction structure, txn snark checks, and eventually o1js) accordingly to support preconditions on accounts
The text was updated successfully, but these errors were encountered: