Error when trying to submit signed ApplicationDeleteTxn transaction

Hello,

I’m trying to delete a deployed app (note: the app was created using teal version 4), but
I’m getting an error when trying to submit a signed ApplicationDeleteTxn transaction:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/dev/algo/src/main.py", line 46, in <module>
    nft_marketplace_service.delete_app(75908760)
  File "/dev/algo/src/services/nft_marketplace.py", line 52, in delete_app
    tx_id = NetworkInteraction.submit_transaction(
  File "/dev/algo/src/services/network_interaction.py", line 52, in submit_transaction
    txid = client.send_transaction(transaction)
  File "/usr/local/lib/python3.8/site-packages/algosdk/v2client/algod.py", line 194, in send_transaction
    return self.send_raw_transaction(encoding.msgpack_encode(txn),
  File "/usr/local/lib/python3.8/site-packages/algosdk/v2client/algod.py", line 211, in send_raw_transaction
    return self.algod_request("POST", req, data=txn, headers=headers, **kwargs)["txId"]
  File "/usr/local/lib/python3.8/site-packages/algosdk/v2client/algod.py", line 79, in algod_request
    raise error.AlgodHTTPError(e, code)
algosdk.error.AlgodHTTPError: {"message":"TransactionPool.Remember: transaction VR7T4QSOUAU4G4W7I46WOUEVZHV3EG3ZEVA3BEF5YI4UCINH7GQA: logic eval error: TEAL runtime encountered err opcode. Details: pc=11, opcodes===\nbnz label1\nerr\nlabel1:\n"}

This is the code I’m using (py algosdk):

        params = get_default_suggested_params(client=client)
        sender = algo_acc.address_from_private_key(private_key=creator_private_key)

        txn = algo_txn.ApplicationDeleteTxn(
            sender=sender,
            sp=params,
            index=index)

        signed_txn = txn.sign(private_key=creator_private_key)
        txid = client.send_transaction(signed_txn) # ERROR
        wait_for_confirmation(client, txid)

The args seems to be valid and the sender is the owner of the app. Any ideas why I’m getting this?

Thanks!

Does your contract allow for deletes? That is, is there a case in your handler to approve a transaction with the OnComplete set to delete? If its not handled, the application will decline the transaction.

When I see the encountered err opcode message its typically from some Cond where none of the cases match the transaction.

Ben

Ah that makes sense, no it doesn’t. Would just a

Txn.on_completion() == OnComplete.DeleteApplication,
on_delete,

on the program Cond where the on_delete just uses Approve() would be sufficient as a placeholder?

That fixed it thanks!

1 Like