From 908f8699fe728195fc300ef74fb63ba90a835b95 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Thu, 19 Sep 2024 13:18:10 -0400 Subject: [PATCH] trivial new precondition tests pass --- flake.lock | 4 ++-- src/bindings | 2 +- src/lib/mina/precondition.ts | 15 ++++++++++++++- src/mina | 2 +- src/mina-signer/src/sign-zkapp-command.ts | 5 +---- src/mina-signer/src/test-vectors/accountUpdate.ts | 11 ++--------- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/flake.lock b/flake.lock index 55fa6ed8f..1b6d7c690 100644 --- a/flake.lock +++ b/flake.lock @@ -265,8 +265,8 @@ "utils": "utils" }, "locked": { - "lastModified": 1726670537, - "narHash": "sha256-mmCw1+MidLxOlKPFNOojn2UfmFXYhNhtzwrwQilXKFA=", + "lastModified": 1726764844, + "narHash": "sha256-tY1QDOYuAQAmC9siEmsBUfmrohd8a3bOai5NXrMGXJA=", "path": "src/mina", "type": "path" }, diff --git a/src/bindings b/src/bindings index 27bee3418..153792ee6 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit 27bee341874cb9df402f15bfe78756a249bd577c +Subproject commit 153792ee677fe288ccbd13cc8dcc6d05c3ae0892 diff --git a/src/lib/mina/precondition.ts b/src/lib/mina/precondition.ts index b9022acff..e977d0417 100644 --- a/src/lib/mina/precondition.ts +++ b/src/lib/mina/precondition.ts @@ -126,6 +126,19 @@ const AccountPrecondition = { }, }; +type PermissionsPrecondition = Preconditions['permissions']; +const PermissionsPrecondition = { + ignoreAll(): PermissionsPrecondition { + let appState: Array> = []; + for (let i = 0; i < ZkappStateLength; ++i) { + appState.push(ignore(Field(0))); + } + return { + dummyBool: ignore(Bool(true)), + }; + }, +}; + type GlobalSlotPrecondition = Preconditions['validWhile']; const GlobalSlotPrecondition = { ignoreAll(): GlobalSlotPrecondition { @@ -137,7 +150,7 @@ const Preconditions = { ignoreAll(): Preconditions { return { account: AccountPrecondition.ignoreAll(), - test: AccountPrecondition.ignoreAll(), + permissions: PermissionsPrecondition.ignoreAll(), network: NetworkPrecondition.ignoreAll(), validWhile: GlobalSlotPrecondition.ignoreAll(), }; diff --git a/src/mina b/src/mina index cf3719623..57c2369c1 160000 --- a/src/mina +++ b/src/mina @@ -1 +1 @@ -Subproject commit cf3719623dbaddec319aa88dfac64679d937674a +Subproject commit 57c2369c1b5c760a98c1efa4a2061d0395aac7d1 diff --git a/src/mina-signer/src/sign-zkapp-command.ts b/src/mina-signer/src/sign-zkapp-command.ts index 88efd65e0..f4a6d7ae6 100644 --- a/src/mina-signer/src/sign-zkapp-command.ts +++ b/src/mina-signer/src/sign-zkapp-command.ts @@ -231,10 +231,7 @@ function accountUpdateFromFeePayer({ isSome: Bool(true), value: { lower: nonce, upper: nonce }, }; - body.preconditions.test.nonce = { - isSome: Bool(true), - value: { lower: nonce, upper: nonce }, - }; + // TODO set permisions here? body.useFullCommitment = Bool(true); body.implicitAccountCreationFee = Bool(true); body.authorizationKind = { diff --git a/src/mina-signer/src/test-vectors/accountUpdate.ts b/src/mina-signer/src/test-vectors/accountUpdate.ts index a9f0f0b30..66e1d17b4 100644 --- a/src/mina-signer/src/test-vectors/accountUpdate.ts +++ b/src/mina-signer/src/test-vectors/accountUpdate.ts @@ -84,15 +84,8 @@ let accountUpdateExample: Json.AccountUpdate = { provedState: null, isNew: true, }, - test: { - balance: { lower: '1000000000', upper: '1000000000' }, - nonce: null, - receiptChainHash: null, - delegate: 'B62qrja1a2wu3ciKygrqNiNoDZUsHCcE1VfF4LZQtQkzszWhogpWN9i', - state: ['9', null, null, null, null, null, null, null], - actionState: null, - provedState: null, - isNew: true, + permissions: { + dummyBool: true, }, validWhile: null, },