Skip to content

Patch Unlucky Tx

yihuang edited this page May 16, 2022 · 21 revisions

There's a known issue in 0.6.x that when a transaction's execution exceeds the block gas limit, the execution side-effects are committed successfully, but the tx can't be found by the JSON-RPC APIs. The bug is fixed after the v0.7.0 upgrade, and a CLI command cronosd fix-unlucky-tx is provided in the v0.6.10 release to fix the historical block data for RPC nodes.

WARNING: Don't run the fix-unlucky-tx command on blocks generated after the v0.7.0 upgrade.

If you want to fully patch the historical block data, can follow such procedure:

  1. Update cronosd binary to v0.6.10.
  2. Prepare a temporary node, and sync to block height 2693800 (v0.7.0 upgrade point).
  3. Make sure the cronosd process is stopped.
  4. Download the block number list file, which is generated by command: cronosd fix-unlucky-tx --end-block 2693799 --print-block-numbers | cut -d ' ' -f 1 > /tmp/blocks.
  5. Run cronosd fix-unlucky-tx --blocks-file /tmp/blocks.

After the full patch, that unlucky txs will be returned in JSON-RPC responses.

But a full patch could take days to finish, you can share the patched DB snapshot to other nodes to avoid repeating this on multiple nodes.

The command also provides several flags to support flexible usage:

  • Patch a range of blocks (the range is inclusive):

    cronosd fix-unlucky-tx --start-block $START_BLOCK_NUMBER --end-block $END_BLOCK_NUMBER

  • Print the block numbers and tx indexes which need to be patched without actual patching, it's significantly faster than doing patching:

    cronosd fix-unlucky-tx --start-block $START_BLOCK_NUMBER --end-block $END_BLOCK_NUMBER --print-block-numbers

  • Read the block numbers to patch from a file (one block number per line):

    cronosd fix-unlucky-tx --blocks-file /path/to/file

Clone this wiki locally