zkapp-cli icon indicating copy to clipboard operation
zkapp-cli copied to clipboard

It is impossible to deploy zkApp using `zk deploy` command while there are 1 or more txns in the mempool

Open shimkiv opened this issue 2 years ago • 5 comments

Failure reason: Failed to send transaction to relayer. Errors: Couldn't send zkApp command: ["Insufficient_replace_fee"] Simply create several txns using any method, GraphQL mutation query for instance:

mutation MyMutation {
  __typename
  sendPayment(input: {fee: "1000000", amount: "1100000000", to: "B62qnFLnd2qRUF7UfAum2c7VfMVEzMoSJwecTarLTMtxEFV9pmJRWDu", from: "B62qnfoRu26dfdBYxZKkQP8kczd6tE2krjnBhy8Kj1MbxCPDiTiRKSY"})
}

And while txns are waiting to be added into the blocks (while they stay in the mempool) try to deploy the zkApp => It will fail. But once mempool is empty - zkApp deployment will succeed.

Should be fixed by: https://github.com/MinaProtocol/mina/pull/11005, https://github.com/MinaProtocol/mina/pull/11331

shimkiv avatar Jun 19 '22 08:06 shimkiv

@shimkiv, to clarify: Does this error also occur if the to and from fields on the sendPayment txns in the mempool do not take part in the zkapp deployment (either as fee payer of as zkapp account)?

Because my original impression was that the error was caused by stale nonces: The zkapp deploy command uses account nonces fetched from the ledger, which fails if one those nonces is already incremented on earlier transactions in the mempool, because the nonces from the ledger are outdated. (The solution to that could be to fetch nonces from the mempool somehow.)

Do you know if that could be the issue?

mitschabaude avatar Jun 20 '22 09:06 mitschabaude

I also the think the issue is due to stale nonce. From the description it seems like the nonce in the zkapp deploy transaction is the same as what's in one of the payments already enqueued in the pool. In such cases the pool tries to replace the payment with the zkapp transaction provided the replace fee is > fee of the queued transaction.

deepthiskumar avatar Jun 21 '22 20:06 deepthiskumar

Does this error also occur if the to and from fields on the sendPayment txns in the mempool do not take part in the zkapp deployment (either as fee payer of as zkapp account)? @mitschabaude, this error doesn't happen in case described, deploy txn successfully added into the mempool. Screenshot 2022-06-24 at 18 27 27

shimkiv avatar Jun 24 '22 15:06 shimkiv

@mitschabaude do you think this is still a stale nonce issue? I believe we updated some nonce logic in the cli deploy file awhile back.

ymekuria avatar Jan 05 '23 17:01 ymekuria

I think we didn't change where nonces are fetched from, so I'd assume this issue still persists

mitschabaude avatar Jan 05 '23 17:01 mitschabaude