-
Notifications
You must be signed in to change notification settings - Fork 234
Patch Unlucky Tx
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.
Note: The recent v0.6.x release branch contains a patch that improve the performance significantly, it's recommended to build a custom binary from there.
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:
- Update
cronosd
binary tov0.6.10
. - Prepare a temporary node, and sync to block height
2693800
(v0.7.0
upgrade point). - Make sure the
cronosd
process is stopped. - Download the file of block numbers to patch, which is generated by command:
cronosd fix-unlucky-tx --end-block 2693799 --print-block-numbers | cut -d ' ' -f 1 > /tmp/blocks
. - 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
After v0.7.0
upgrade and before v0.7.1
release, there's still a minor issue regarding the tx that exceeds the block gas limit, although the tx is reverted in such case, but the tx fee is deducted from sender, and sender's nonce is also increased, but the tx is not shown in JSON-RPC response. The v0.7.1
has fixed the issue to show the tx, and for the blocks generated by v0.7.0
, either do a resync with v0.7.1
, or do a simple patch as described below: