-
Notifications
You must be signed in to change notification settings - Fork 562
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1121 +/- ##
==========================================
- Coverage 61.74% 61.59% -0.15%
==========================================
Files 89 88 -1
Lines 7303 7296 -7
==========================================
- Hits 4509 4494 -15
- Misses 2570 2581 +11
+ Partials 224 221 -3
|
4a0217d
to
81ff827
Compare
1bf47b8
to
ecb633e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could there be a test for the indexer?
Codecov Report
@@ Coverage Diff @@
## main #1121 +/- ##
==========================================
+ Coverage 52.27% 52.29% +0.02%
==========================================
Files 104 105 +1
Lines 9383 9519 +136
==========================================
+ Hits 4905 4978 +73
- Misses 4227 4274 +47
- Partials 251 267 +16
|
This pull request introduces 1 alert when merging 0f5cc5b2c4b37a1838985a4678ba675202318c4b into de21773 - view on LGTM.com new alerts:
|
The db size after a test run on a cronos mainnet node (block height: 3104880):
|
added some unit tests for the kv indexer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gave it another pass after conflicts were solved! LGTM 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final pass. @danburck can you also review?
- test indexer in backend unit test - add comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK. I think this PR could be refactored further tho. Let's work on a document for how to enable this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, aggree that we need documentation for this. @yihuang can you add some after the merge?
* 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 <[email protected]> improve comments share code between GetTxByEthHash and GetTxByIndex fix unit test Update server/indexer.go Co-authored-by: Freddy Caceres <[email protected]> * 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 <[email protected]> Co-authored-by: Federico Kunze Küllmer <[email protected]>
* Store eth tx index separately Closes: evmos#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 <[email protected]> improve comments share code between GetTxByEthHash and GetTxByIndex fix unit test Update server/indexer.go Co-authored-by: Freddy Caceres <[email protected]> * 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 <[email protected]> Co-authored-by: Federico Kunze Küllmer <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK: quick pass with a nit and thought
ethMsg := msg.(*evmtypes.MsgEthereumTx) | ||
txHash := common.HexToHash(ethMsg.Hash) | ||
|
||
txResult := ethermint.TxResult{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: For the following if-else block, could we set Failed
here as true
or would that be poor practice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can save a branch block if we init both GasUsed
and Failed
to the failed cases here.
"github.com/cosmos/cosmos-sdk/client" | ||
"github.com/cosmos/cosmos-sdk/codec" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: This package was deprecated and moved to its own module here "cosmossdk.io/errors"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can migrate that globally sometime.
if err := idxer.IndexBlock(blk, resBlk.DeliverTxs); err != nil { | ||
return err | ||
} | ||
fmt.Println(height) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider: A progress bar instead or remove it, this feels like a very vague way to keep track of the progress?
@@ -97,40 +83,38 @@ func ParseTxResult(result *abci.ResponseDeliverTx) (*ParsedTxs, error) { | |||
TxHashes: make(map[common.Hash]int), | |||
} | |||
for _, event := range result.Events { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider: extracting the format check, then seperate each formats into its own functional block, this will also make it easier to purge deprecated format eventually
* Store eth tx index separately Closes: evmos#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 <[email protected]> improve comments share code between GetTxByEthHash and GetTxByIndex fix unit test Update server/indexer.go Co-authored-by: Freddy Caceres <[email protected]> * 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 <[email protected]> Co-authored-by: Federico Kunze Küllmer <[email protected]> (cherry picked from commit a8723c5)
Closes: #1075
Description
run a optional indexer service
adapt the json-rpc to the more efficient query
a cli command to index block range manually.
For contributor use:
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerFor admin use:
WIP
,R4R
,docs
, etc)