MinaProtocol / mina

Mina is a cryptocurrency protocol with a constant size blockchain, improving scaling while maintaining decentralization and security.
https://minaprotocol.com
Apache License 2.0
1.99k stars 529 forks source link

Transaction snark assert failure - zkapp-test-transaction CLI #11756

Open garethtdavies opened 2 years ago

garethtdavies commented 2 years ago

Preliminary Checks

Description

When running the mina-zkapp-test-transaction create-zkapp-account command with a --receiver-amount 0, the following error is generated. This happens for any account, even if they are in the ledger already. This works for an amount > 0, but if an amount > 0 is required, it should fail more gracefully.

(monitor.ml.Error
 "Assert_failure src/lib/transaction_snark/transaction_snark.ml:4460:6"
 ("Raised at Transaction_snark.For_tests.create_parties in file \"src/lib/transaction_snark/transaction_snark.ml\", line 4460, characters 6-266"
  "Called from Transaction_snark.For_tests.deploy_snapp in file \"src/lib/transaction_snark/transaction_snark.ml\", line 4610, characters 6-65"
  "Called from Zkapp_test_transaction_lib__Commands.create_zkapp_account.(fun) in file \"src/app/zkapp_test_transaction/lib/commands.ml\", line 324, characters 4-71"
  "Called from Async_kernel__Deferred0.bind.(fun) in file \"src/deferred0.ml\", line 54, characters 64-69"
  "Called from Async_kernel__Job_queue.run_job in file \"src/job_queue.ml\" (inlined), line 128, characters 2-5"
  "Called from Async_kernel__Job_queue.run_jobs in file \"src/job_queue.ml\", line 169, characters 6-47"))

Steps to Reproduce

  1. Use the command mina-zkapp-test-transaction create-zkapp-account --fee-payer-key ~/.mina-config/wallets/store/key --nonce x --receiver-amount 0 --zkapp-account-key ~/.mina-config/wallets/store/anotherkey

Expected Result

Assuming an amount must be > 0, it should give an error message to that effect.

Actual Result

(monitor.ml.Error
 "Assert_failure src/lib/transaction_snark/transaction_snark.ml:4460:6"
 ("Raised at Transaction_snark.For_tests.create_parties in file \"src/lib/transaction_snark/transaction_snark.ml\", line 4460, characters 6-266"
  "Called from Transaction_snark.For_tests.deploy_snapp in file \"src/lib/transaction_snark/transaction_snark.ml\", line 4610, characters 6-65"
  "Called from Zkapp_test_transaction_lib__Commands.create_zkapp_account.(fun) in file \"src/app/zkapp_test_transaction/lib/commands.ml\", line 324, characters 4-71"
  "Called from Async_kernel__Deferred0.bind.(fun) in file \"src/deferred0.ml\", line 54, characters 64-69"
  "Called from Async_kernel__Job_queue.run_job in file \"src/job_queue.ml\" (inlined), line 128, characters 2-5"
  "Called from Async_kernel__Job_queue.run_jobs in file \"src/job_queue.ml\", line 169, characters 6-47"))

How frequently do you see this issue?

Always

What is the impact of this issue on your ability to run a node?

Low

Status

N/A this is the mina-zkapp-test-transaction tool

Additional information

Running version mina-zkapp-test-transaction=1.3.2beta2-release-2.0.0-330d801 of the CLI transaction tool

garethtdavies commented 2 years ago

This tool assumes the address is not in the ledger yet (else get a fee excess error for an existing account), so always has an account creation fee, so an amount of < 1 would always fail.

shimkiv commented 2 years ago

@deepthiskumar can you please take a look?