2

Environment: Delphinet using https://delphinet.smartpy.io. I'm connecting to it through the RPC via the java/kotlin library OkHttp.

Steps to reproduce:

Trying to send my max XTZ balance to another account. The account is not delegated so it should be able to be empty.

  • First dry-run the operation using /run_operation and /forge to get the fees, gas limit and storage limit. The simulation returns:
{
    "contents": [
        {
            "kind": "transaction",
            "source": "tz1Ydpp4ibTrGSPn2i6cqQZ6arWieUbcfWVn",
            "fee": "0",
            "counter": "780748",
            "gas_limit": "800000",
            "storage_limit": "60000",
            "amount": "692750",
            "destination": "tz1LnZxYuTUpf54cx8RWEX6EW9sZBoxGbqPQ",
            "metadata": {
                "balance_updates": [

                ],
                "operation_result": {
                    "status": "applied",
                    "balance_updates": [
                        {
                            "kind": "contract",
                            "contract": "tz1Ydpp4ibTrGSPn2i6cqQZ6arWieUbcfWVn",
                            "change": "-692750"
                        },
                        {
                            "kind": "contract",
                            "contract": "tz1LnZxYuTUpf54cx8RWEX6EW9sZBoxGbqPQ",
                            "change": "692750"
                        },
                        {
                            "kind": "contract",
                            "contract": "tz1Ydpp4ibTrGSPn2i6cqQZ6arWieUbcfWVn",
                            "change": "-64250"
                        }
                    ],
                    "consumed_gas": "1427",
                    "consumed_milligas": "1427000",
                    "allocated_destination_contract": true
                }
            }
        }
    ]
}
  • I send an operation that has:
    • amount = max balance - (0.001591 ꜩ + 0.06425 ꜩ) (baker fee + allocation fee)
    • gas_limit: 1527
    • storage_limit: 257

This returns an error: proto.007-PsDELPH1.gas_exhausted.operation

  • If I add 1 mutez padding to that amount the operation runs with no problem (that mutez gets left as balance). Example of this, where the balance was left as 1 mutez.

I tried this with several newly created accounts (all undelegated) and every time I tried to transfer all my funds found myself with this error.

1 Answer 1

1

The answer given by Raphael Cauderlier in the gitlab issue helped solve the issue:

"I have tried to reproduce this in sandbox (well, actually in mockup client); I think your problem is that 100 extra gas units are not enough to empty an account, apparently this consumes 400 gas units. Here is what I did (mockup_client is an alias for tezos-client --mode mockup --base-dir /tmp/mockup):"

$ mockup_client create mockup
Base dir /tmp/mockup has state `base_dir_does_not_exist`.
Some commands (e.g., transfer) might not work correctly.
Created mockup client base dir in /tmp/mockup
Tezos address added: tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx
Tezos address added: tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN
Tezos address added: tz1faswCTDciRzE4oJ9jn2Vm2dvjeyA9fUzU
Tezos address added: tz1b7tUupMgCNw2cCLpKTkSD1NZzB5TkP2sv
Tezos address added: tz1ddb9NMYHZi5UzPdzTZMYQQZoMub195zgv
$ mockup_client gen keys alice
$ mockup_client transfer 100 from bootstrap1 to alice --burn-cap 1
[..]Consumed gas: 1427[..]
$ mockup_client transfer 99 from alice to bootstrap1 --fee 1
[..]Consumed gas: 1827[..]
$ mockup_client get balance for alice
0 ꜩ

I tried to run it with a gas_limit = 1827 and it worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.