Developers Forum for XinFin XDC Network

Vikash Kumar
Vikash Kumar

Posted on

Issue Report – Unexpected Gas Behavior on XDC Network

Scenario 1 — TX Sent but Reverts With “Out of Gas”
What happens

With a lower gas fee configuration (lower gasPrice or lower gasLimit), the transaction is:

successfully broadcast

TX hash is produced

…but then fails during execution.

Image description

Scenario 2 — After Increasing Gas Fee → TX Sent & Successful, But Gas Fee Extremely High (~0.4 XDC)

When we increase gasPrice (and/or gasLimit) so that the first error disappears:

What happens

The transaction is broadcast

It is mined
Image description

It succeeds (no revert, no error)

But…

Problem

The transaction fee becomes extremely high.
Image description

Discussion (1)

Collapse
gzliudan profile image
Daniel Liu • Edited on

For the tx 0xfea1216fa41fdb5f116d6275d1dc785d... on XDC chain, the gas price is 12.5 GWei, and the used gas is 29355011(0x1bfec03), so the tx cost is 0.3669376375 XDC.


Request:

RPC="https://earpc.xinfin.network/"
hash=0xfea1216fa41fdb5f116d6275d1dc785dd5072e99798aa7611d7c1cf1cb396b11

curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
  "jsonrpc": "2.0",
  "id": 5002,
  "method": "eth_getTransactionReceipt",
  "params": [
    "'"${hash}"'"
  ]
}' | jq
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "jsonrpc": "2.0",
  "id": 5002,
  "result": {
    "blockHash": "0xae171f38ff190472b5076cf92069f16156c26bdd1fa391629fc7d70d6e967664",
    "blockNumber": "0x5bd0be4",
    "contractAddress": null,
    "cumulativeGasUsed": "0x1bfec03",
    "from": "0x177073570f9ac28aec0074340e193a3a71454aea",
    "gasUsed": "0x1bfec03",
    "logs": [
      {
        "address": "0x45895b2cf3381e3f0022b249bd18a6772b04bf45",
        "topics": [
          "0x5686b160fa72829552d45956674c9b431d51600d10e79e4525679c6206131179"
        ],
        "data": "0x0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000004061356461353364613531343164343735333236363232343666623131666234343664666630303938636135383564643831653738383366653938303639666264000000000000000000000000000000000000000000000000000000000000000b53616e7961204465736169000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000645647562756b0000000000000000000000000000000000000000000000000000",
        "blockNumber": "0x5bd0be4",
        "transactionHash": "0xfea1216fa41fdb5f116d6275d1dc785dd5072e99798aa7611d7c1cf1cb396b11",
        "transactionIndex": "0x0",
        "blockHash": "0xae171f38ff190472b5076cf92069f16156c26bdd1fa391629fc7d70d6e967664",
        "logIndex": "0x0",
        "removed": false
      }
    ],
    "logsBloom": "0x00000000000000000000000000000000001002000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "status": "0x1",
    "to": "0x45895b2cf3381e3f0022b249bd18a6772b04bf45",
    "transactionHash": "0xfea1216fa41fdb5f116d6275d1dc785dd5072e99798aa7611d7c1cf1cb396b11",
    "transactionIndex": "0x0",
    "type": "0x0"
  }
}
Enter fullscreen mode Exit fullscreen mode