#Signature only setState problems on a contract instance.

8 messages · Page 1 of 1 (latest)

stable parrot
#

I get this error:
** "Transaction verification failed: Cannot update field 'appState' because permission for this field is 'Signature', but the required authorization was not provided or is invalid."**

Running this code:

  const tx = await Mina.transaction(owner, () => {
    zkapp.somemethodcall(proof)
  });
  await tx.prove();
  const retTx = tx.sign([zkappKey, ownerKey]);
  const retTxId = await retTx.send();

The init contract init:

  init() {
    super.init();
    // some state update
    let p = Permissions.proof();
    let s = Permissions.signature();
    this.account.permissions.set({
      ...Permissions.allImpossible(),
      access: p,
      editState: s,
      editActionState: s,
      send: s,
      receive: p
    });
  }

What am I missing??

livid inlet
#

Can you print out the transaction using toPretty()? I think calling of the method sets the authorization to { isSigned: false, isProved: true }, so you might need to call this.requireSignature() inside of the method to use also signature authorization.

stable parrot
#
 authorizationKind: {
          isSigned: false,
          isProved: true,
          verificationKeyHash: '28873130871708446492440600360129267805033850949317645836087892752141973488529'
        },
#

You were right

stable parrot
#

It worked! Thank you @livid inlet

stable parrot
#

Actually I've seen result from a wrong tab.
It did not work.
It change the error to be:

which does not happen when using Proofs for setState..

gaunt cypress
#

@stable parrot there's not much point of calling a zkApp method when you just authorize it with a signature

stable parrot
#

Ah yeah. Still, is this why the problem occurs?
I mistakenly thought that there's something like proof&signatures authorization
Thanks