Search code examples
transactionsblockchainnearprotocolnearcore

"gas_burnt" and "tokens_burnt" values in the refund receipt are not zero and are not the same


Based on documentation, the gas_burnt and tokens_burnt in the refund receipt is zero:

{
     "block_hash": "Gm6TFS1ZxmA45itVj8a7vE8yJF8V5hXeNF1EhEVr7GVS",
     "id": "7NMpF9ZGwSj48bpvJK2xVobJkTasEkakazTKi2zotHR4",
     "outcome": {
       "executor_id": "near",
       "gas_burnt": 0,
       "logs": [],
       "metadata": { "gas_profile": null, "version": 1 },
       "receipt_ids": [],
       "status": { "SuccessValue": "" },
       "tokens_burnt": "0"
     },
     "proof": []
   }

explorer link

However i made a transaction to create an account and these values are not zero.

near tx-status mlibre.testnet:v3eawe5UJmMBvNQe2rgoKEuS92HfXMtM5BLLRcBix39

The gas_burnt is 223182562500 and tokens_burnt is 0. what does it mean? and why is that?

{
  block_hash: 'BXkhJFVsWcDgaFznMTwk674WvzokS62pfPL879EbrmAN',
  id: 'EXNe4EKTFSm75TrGnvtUhMTqxsoUPDPYw7jEoDi3LweL',
  outcome: {
    executor_id: 'mlibre.testnet',
    gas_burnt: 223182562500,
    logs: [],
    metadata: { gas_profile: [], version: 3 },
    receipt_ids: [],
    status: { SuccessValue: '' },
    tokens_burnt: '0'
  },
  proof: [
    {
      direction: 'Right',
      hash: '97J5UUmsVCKeThLf2RxQ4ZkjySdNvVzaUsRrh1YJQZEn'
    },
    {
      direction: 'Left',
      hash: '5HqirRFCGCpNF3A8bE9v9xLX8ZzaByPsiGPdoWraEZPU'
    },
    {
      direction: 'Right',
      hash: 'HU97NYSfmXZftzDakJmcYc9xy4ZS2m8LWpmPSuG9asZ9'
    }
  ]
}

Solution

  • That snippet in the docs is outdated. tokens_burnt will be always zero for refund receipts, but gas_burnt will still be counted to avoid DoS due to too many "zero-gas" receipts pack into a single block: https://github.com/near/nearcore/pull/4405