2

I'm putting a single transaction into a batch utility call with zero value. The batch extrinsic is shown below. Each time I submit the batch transaction, a huge value is submitted to an unknown account. The value is approximately 500 times the gas fee of the single transaction in the batch. The receiving account is not a contract. It is always the same account that receives the balance.

What is this balance transfer for?

I'm using substrate in dev mode on branch polkadot-v0.9.40.

Batch Extrinsic:

{
  "isSigned": true,
  "method": {
    "args": {
      "calls": [
        {
          "args": {
            "dest": {
              "Id": "5Fmo4KdCK7jTLbaSbZ5RYXhYMZxzPCxEv7SVHwzTJ3WUbGJJ"
            },
            "value": "0",
            "gas_limit": {
              "refTime": "9,946,641,144",
              "proofSize": "709,519"
            },
            "storage_deposit_limit": "1,448,339,956,379,238",
            "data": "0x5b965eaba456d313ea79628d7a768d77e3e5089289c4ada9170a647895125b73c3c1eee80105797b3529e14b9ff72548ef16865d4d9e0f79f1e393decd2f435ff5f2cc0c133b73f06b9945447b664b3f12cf45d227a315623db8611b110b2955b2531c10340f9161523bb730b4a180f9ab0144f89ce5d0c09d0934a386fbd3b804a0a9675a0b71a30f2531b3ac73f88bd8d0a15f1e3ce7840d456947a9c3235ff5f40e720101"
          },
          "method": "call",
          "section": "contracts"
        }
      ]
    },
    "method": "batch",
    "section": "utility"
  },
  "era": {
    "MortalEra": {
      "period": "128",
      "phase": "117"
    }
  },
  "nonce": "3",
  "signature": "0x01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101",
  "signer": {
    "Id": "5DExyKNTzoweUafckatwBs4TDCyPH4C4zjXJhJpPzP8J7xqr"
  },
  "tip": "0"
}

The hex encoded extrinsic:

0xa508840020c72af36a93a3b1aed897e3dfdcab993fcf002fa9ee7b043e7a70d667504972012c638bf5e21d3606f1338404c7a2ab61be62c0edb41ecbeae8b088635c2e940efd18b9a5b047cd0c6327fc68a8e2a4c2ac3d6bc0f324122320bc92627d88d48696060c0000010008130600a40b451091ece31354f2adf9864b6ae986de5f5fae473728e6900cff899635260007be3aa26702a6762b00010f662e9dec41250599025b965eab75c7a5d2da2fa1b7efb29e5e583b24adaba69426cb1aba8585d5fadc0a26245a0105797b3529e14b9ff72548ef16865d4d9e0f79f1e393decd2f435ff5f2cc0c640ee5b7b21dc015ec54f9f5730d8e1685928b94a09509770f6b3e69fe23e14c20c72af36a93a3b1aed897e3dfdcab993fcf002fa9ee7b043e7a70d6675049721e2a38e3ab30530788982adb381bbe732a53154804d3a543781ac5493e1881080101130600a40b451091ece31354f2adf9864b6ae986de5f5fae473728e6900cff89963526000787c15f65022e762b00010f662e9dec41250599025b965eab75c7a5d2da2fa1b7efb29e5e583b24adaba69426cb1aba8585d5fadc0a26245a0105797b3529e14b9ff72548ef16865d4d9e0f79f1e393decd2f435ff5f2cc0c1034cc61607ce2881a2e96fdef4eb44021791677a19592222c24ebc87532fe4220c72af36a93a3b1aed897e3dfdcab993fcf002fa9ee7b043e7a70d66750497260a9b3d30f22c2b7902267a17868d46e2980976e3093a7cb888f5819cd79b1320102

huge unknown balance transfer

14
  • Can you share the code of the contract you are calling? Commented Apr 12, 2023 at 10:32
  • Sure, the exact version of the contract is here. I build this extrinsics with this function. The contract function being batched is dappUserCommit
    – forgetso
    Commented Apr 12, 2023 at 10:34
  • Could you please share the link to the Polkadot apps? I would like to examine this block.
    – aurexav
    Commented Apr 12, 2023 at 10:46
  • Considered that when you transfer to/from a contract (e.g. #[ink(message, payable)] / self.env().transfer()), it uses the balances.Transfer? Commented Apr 12, 2023 at 10:47
  • @AurevoirXavier this is a local chain so there is no online block to inspect. Here is the hex encoded call pastebin.com/V13ySETn. Let me know if you need any more detail.
    – forgetso
    Commented Apr 12, 2023 at 11:15

1 Answer 1

2

Edited after feedback from @German Nikolishin below.

It seems this transfer is the cost associated with storing data in the contract. The value inside the transfer is sent to what I presume is the contract's deposit_account, which is why it isn't a contract itself.

The value sent to the deposit_account is the storageDeposit

faucetWithStore response.storageDeposit { Charge: '480.0000 Unit' }

The deposit stays in the deposit account until the contract is terminated, at which point the deposit account uses the funds to remove any storage associated with the contract and then sends the remaining funds back to the recipient.

            ink::env::terminate_contract::<ink::env::DefaultEnvironment>(recipient);

I've created a demo repo to demonstrate the fees shown above.

4
  • 1
    > "The fee is doubled when the above call is batched but this is still small:" You putting the same transaction into the batch twice: github.com/prosopo/batching/blob/… Commented Apr 28, 2023 at 17:35
  • 1
    Secondly, it is not related to sub-calls within a contract. I have cloned the repo and tried putting this line github.com/prosopo/batching/blob/… inside faucet_with_subcall() and it does produce the same TX Fee charge Commented Apr 28, 2023 at 17:59
  • Good spots. I see what you mean, so the push to the Mapping is where the charge is coming from. Is the fee correct?
    – forgetso
    Commented May 1, 2023 at 8:26
  • Yes. This is correct. Commented May 2, 2023 at 9:13

Your Answer

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

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