feat!: Store eth tx index separately (#1121)

* Store eth tx index separately

Closes: #1075
Solution:
- run a optional indexer service
- adapt the json-rpc to the more efficient query

changelog

changelog

fix lint

fix backward compatibility

fix lint

timeout

better strconv

fix linter

fix package name

add cli command to index old tx

fix for loop

indexer cmd don't have access to local rpc

workaround exceed block gas limit situation

add unit tests for indexer

refactor

polish the indexer module

Update server/config/toml.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

improve comments

share code between GetTxByEthHash and GetTxByIndex

fix unit test

Update server/indexer.go

Co-authored-by: Freddy Caceres <facs95@gmail.com>

* Apply suggestions from code review

* test enable-indexer in integration test

* fix go lint

* address review suggestions

* fix linter

* address review suggestions

- test indexer in backend unit test
- add comments

* fix build

* fix test

* service name

Co-authored-by: Freddy Caceres <facs95@gmail.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
yihuang
2022-08-11 22:49:05 +02:00
committed by GitHub
co-authored by Freddy Caceres Federico Kunze Küllmer
parent 737c1de694
commit 77ed4aa754
31 changed files with 1559 additions and 345 deletions
+29
View File
@@ -0,0 +1,29 @@
syntax = "proto3";
package ethermint.types.v1;
import "gogoproto/gogo.proto";
option go_package = "github.com/evmos/ethermint/types";
// TxResult is the value stored in eth tx indexer
message TxResult {
option (gogoproto.goproto_getters) = false;
// the block height
int64 height = 1;
// cosmos tx index
uint32 tx_index = 2;
// the msg index in a batch tx
uint32 msg_index = 3;
// eth tx index, the index in the list of valid eth tx in the block,
// aka. the transaction list returned by eth_getBlock api.
int32 eth_tx_index = 4;
// if the eth tx is failed
bool failed = 5;
// gas used by tx, if exceeds block gas limit,
// it's set to gas limit which is what's actually deducted by ante handler.
uint64 gas_used = 6;
// the cumulative gas used within current batch tx
uint64 cumulative_gas_used = 7;
}