Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

fix: index-eth-tx cmd fail on empty indexer db #1362

Merged
merged 5 commits into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (rpc) [#1284](https://github.com/evmos/ethermint/pull/1284) Fix internal trace response upon incomplete `eth_sendTransaction` call.
* (rpc) [#1340](https://github.com/evmos/ethermint/pull/1340) Fix error response when `eth_estimateGas` height provided is not found.
* (rpc) [#1354](https://github.com/evmos/ethermint/pull/1354) Fix grpc query failure(`BaseFee` and `EthCall`) on legacy block states.
* (cli) [#1362](https://github.com/evmos/ethermint/pull/1362) Fix `index-eth-tx` error when the indexer db is empty.

## [v0.19.2] - 2022-08-29

Expand Down
4 changes: 2 additions & 2 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ schema = 3
version = "v0.19.2-0.20220916140702-9b6be3095313"
hash = "sha256-49xr/7/4L1wZ45eW5lE7C4SlcbGf4gBY+662SfJiWPQ="
[mod."github.com/cosmos/ibc-go/v5"]
version = "v5.0.0-rc2"
hash = "sha256-p4tpb6I6bdXix1sTYivJEygUtM4q+nTIKdSlf6c/LCw="
version = "v5.0.0"
hash = "sha256-sDZdmuGohaaBF7bxrjo9PWJnmoF+VOkjySYhsFixPz4="
[mod."github.com/cosmos/ledger-cosmos-go"]
version = "v0.11.1"
hash = "sha256-yli+VvVtZmHo2LPvCY6lYVUfcCDn3sBLDL+a8KIlqDA="
Expand Down
10 changes: 7 additions & 3 deletions server/indexer_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ import (

func NewIndexTxCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "index-eth-tx [forward|backward]",
Use: "index-eth-tx [backward|forward]",
Short: "Index historical eth txs",
Long: `Index historical eth txs, it only support two traverse direction to avoid creating gaps in the indexer db if using arbitrary block ranges:
- backward: index the blocks from the first indexed block to the earliest block in the chain.
- backward: index the blocks from the first indexed block to the earliest block in the chain, if indexer db is empty, start from the latest block.
- forward: index the blocks from the latest indexed block to latest block in the chain.

When start the node, the indexer start from the latest indexed block to avoid creating gap.
Backward mode should be used most of the time, so the latest indexed block is always up-to-date.
`,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -82,7 +85,8 @@ func NewIndexTxCmd() *cobra.Command {
return err
}
if first == -1 {
return fmt.Errorf("indexer db is empty")
// start from the latest block if indexer db is empty
first = blockStore.Height()
}
for i := first - 1; i > 0; i-- {
if err := indexBlock(i); err != nil {
Expand Down