BSC: Still getting Runtime Error: Index out of Range on eth_getTransactionByHash
System information
Erigon version: erigon version 2.28.0-dev-497d414b (Latest Devel commit)
OS & Version: Linux/Ubuntu 20.04.4
Commit hash : 497d414b36fa7ddc73baaf25fa183b0bba0c1e63
Running BSC Archival Node
Expected behaviour
When calling "getTransactionByHash" on pending transactions in the mempool, the node should respond with the appropriate body and deliver it to the client. This is an important feature to get hash details from pending TX's, such as the sender/receiver.
This was working as expected in version 2022.08.01-alpha
This #5739 does not seem to fix it sadly.
Actual behaviour
When calling "getTransactionByHash" on pending transactions in the mempool, the node responds with the following error message:
RPC method eth_getTransactionByHash crashed: runtime error: slice bounds out of range [32:26] this happens on most transactions, but oddly enough the occassional one is able to resolve.
Steps to reproduce the behaviour
- Create a websocket connection to the node via web3 library (Ethers, Web3, etc).
- Subscribe to "pendingTransactions" to receive mempool TX's
- On tx received, call "getTransaction" (Vanilla web3js), which invokes "getTransactionByHash" on the node
- The node will respond with the runtime error: slice bounds out of range exception
Backtrace
EROR[10-14|16:16:18.104] RPC method eth_getTransactionByHash crashed: runtime error: slice bounds out of range [32:26]
[service.go:217 panic.go:838 panic.go:117 decompress.go:541 block_reader.go:667 block_reader.go:768 block_snapshots.go:312 block_reader.go:767 eth_api.go:141 eth_txs.go:33 value.go:556 value.go:339 service.go:222 handler.go:494 handler.go:444 handler.go:392 handler.go:223 handler.go:316 asm_amd64.s:1571]
WARN[10-14|16:16:18.104] Served method=eth_getTransactionByHash reqid=177 t=1.21199ms err="method handler crashed"
Confirm, we are still getting this error when calling api.getReceipts which uses rawdb.ReadReceipts:
runtime error: index out of range [62] with length 62
[service.go:217 panic.go:884 panic.go:113 accessors_chain.go:950 kv_mdbx.go:553 accessors_chain.go:944 accessors_chain.go:972 eth_receipts.go:36 ...]
Having the same issue
@Zorato @atdefinative
I followed https://github.com/ledgerwatch/erigon/issues/5698#issuecomment-1279693934 And was able to fix it.
The steps specific steps I took to resolve this:
- Stop the erigon node
- Navigate to your data-directory/snapshots folder and fully delete all snapshot files
- Unwind the node 1 million blocks (not sure if this step is necessary)
- Restart erigon (make sure to change the torrentDownload flags to speed up the download)
- Let erigon rebuild the snapshots indexes
I am also on the latest version (2.28.1)
Thanks, Can you please elaborate on how to unwind and what torrentDownload flags did you use?
--torrent.download.rate=[YOUR_MAX_SPEED] a start-up flag (on in the service file).
Thanks, Can you please elaborate on how to unwind and what torrentDownload flags did you use?
Torrent download flags are:
--torrent.download.rate=1000mb && -torrent.download.slots=6
To unwind the node you need to cd erigon && make integration then run:
/build/bin/integration stage_exec --datadir=YourDataDir unwind AmountOfBlocksToUnwind --chain=bsc
Not entirely sure if the unwind stage is necessary. A few people claimed to have success without it.
Thanks, Can you please elaborate on how to unwind and what torrentDownload flags did you use?
Torrent download flags are:
--torrent.download.rate=1000mb&&-torrent.download.slots=6To unwind the node you need to cd erigon && make integration then run:
/build/bin/integration stage_exec --datadir=YourDataDir unwind AmountOfBlocksToUnwind --chain=bscNot entirely sure if the unwind stage is necessary. A few people claimed to have success without it.
I can confirm — it works without unwinding.