Skip to content

Commit c093016

Browse files
author
yihuang
authored
Problem: customer tx indexer feature is not enabled (#549)
* Problem: customer tx indexer feature is not enabled Solution: - enable and test the custom tx indexer feature test seperate indexer in integration test fix lint fix cronos fixture update nixpkgs for pystarport fix nix stuff update pystarport fix integration test revert nixpkgs fix integration test update ethermint ethermint -> evmos fix indexer cmd fix indexer gofmt * fix build * changelog * set min_gas_multiplier to 0 to fix the test cases
1 parent 21d79ac commit c093016

File tree

11 files changed

+84
-30
lines changed

11 files changed

+84
-30
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- [cronos#489](https://github.com/crypto-org-chain/cronos/pull/489) Enable jemalloc memory allocator, and update rocksdb src to `v6.29.5`.
2020
- [cronos#511](https://github.com/crypto-org-chain/cronos/pull/511) Replace ibc-hook with ibc middleware, use ibc-go upstream version.
2121
- [cronos#550](https://github.com/crypto-org-chain/cronos/pull/550) Support basic json-rpc apis on pruned nodes.
22+
- [cronos#549](https://github.com/crypto-org-chain/cronos/pull/549) Use custom tx indexer feature of ethermint.
2223

2324
*May 3, 2022*
2425

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ pystarport supervisorctl stop all
154154
- [Technical Documentation](http://cronos.org/docs)
155155
- Community chatrooms (non-technical): [Discord](https://discord.gg/nsp9JTC) [Telegram](https://t.me/CryptoComOfficial)
156156
- Developer community channel (technical): [![Support Server](https://img.shields.io/discord/783264383978569728.svg?color=7289da&label=Cronos&logo=discord&style=flat-square)](https://discord.gg/pahqHz26q4)
157-
- [Ethermint](https://github.com/tharsis/ethermint) by Tharsis
157+
- [Ethermint](https://github.com/evmos/ethermint) by Tharsis
158158
- [Cosmos SDK documentation](https://docs.cosmos.network)
159159
- [Cosmos Discord](https://discord.gg/W8trcGV)
160160
- [Pystarport](https://github.com/crypto-com/pystarport/blob/main/README.md)

app/app.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,10 @@ func New(
644644
minttypes.ModuleName,
645645
crisistypes.ModuleName,
646646
ibchost.ModuleName,
647+
// evm module denomination is used by the feemarket module, in AnteHandle
647648
evmtypes.ModuleName,
649+
// NOTE: feemarket need to be initialized before genutil module:
650+
// gentx transactions use MinGasPriceDecorator.AnteHandle
648651
feemarkettypes.ModuleName,
649652
genutiltypes.ModuleName,
650653
evidencetypes.ModuleName,

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/cosmos/cosmos-sdk v0.46.0
99
github.com/cosmos/ibc-go/v5 v5.0.0-beta1
1010
github.com/ethereum/go-ethereum v1.10.19
11-
github.com/evmos/ethermint v0.6.1-0.20220810223338-b1cd16e5bfb1
11+
github.com/evmos/ethermint v0.6.1-0.20220814092117-f11bc3559467
1212
github.com/gogo/protobuf v1.3.3
1313
github.com/golang/protobuf v1.5.2
1414
github.com/gorilla/mux v1.8.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,8 @@ github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcH
426426
github.com/ethereum/go-ethereum v1.10.19 h1:EOR5JbL4MD5yeOqv8W2iC1s4NximrTjqFccUz8lyBRA=
427427
github.com/ethereum/go-ethereum v1.10.19/go.mod h1:IJBNMtzKcNHPtllYihy6BL2IgK1u+32JriaTbdt4v+w=
428428
github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY=
429-
github.com/evmos/ethermint v0.6.1-0.20220810223338-b1cd16e5bfb1 h1:lIWSElIU+zcLzEGXsQU7pDEzHlh3mu12BZTToXuBdwA=
430-
github.com/evmos/ethermint v0.6.1-0.20220810223338-b1cd16e5bfb1/go.mod h1:3UVQJyCBB9tW3zvtmqGtVTfSRgNBFP29izugIxyizQE=
429+
github.com/evmos/ethermint v0.6.1-0.20220814092117-f11bc3559467 h1:5MJ8N97jA/zXmEdkhxPV+Ccv5/jroGp9Iq26DC9c95s=
430+
github.com/evmos/ethermint v0.6.1-0.20220814092117-f11bc3559467/go.mod h1:3UVQJyCBB9tW3zvtmqGtVTfSRgNBFP29izugIxyizQE=
431431
github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64=
432432
github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0=
433433
github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64=

gomod2nix.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ schema = 3
158158
version = "v1.10.19"
159159
hash = "sha256-7FPnTGcCb8Xd1QVR+6PmGTaHdTY1mm/8osFTW1JLuG8="
160160
[mod."github.com/evmos/ethermint"]
161-
version = "v0.6.1-0.20220810223338-b1cd16e5bfb1"
162-
hash = "sha256-gwr9r+HTR5MRj8MEDWv3VTcwLCyzdfkHS+z/CkJfglQ="
161+
version = "v0.6.1-0.20220814092117-f11bc3559467"
162+
hash = "sha256-gpnOKw6jq8BVbUKdq5MhFwmXESI+tAGbETvh4fjQsvs="
163163
[mod."github.com/felixge/httpsnoop"]
164164
version = "v1.0.1"
165165
hash = "sha256-TNXnnC/ZGNY9lInAcES1cBGqIdEljKuh5LH/khVFjVk="
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
local config = import 'default.jsonnet';
2+
3+
config {
4+
'cronos_777-1'+: {
5+
config+: {
6+
tx_index+: {
7+
indexer: 'null',
8+
},
9+
},
10+
'app-config'+: {
11+
'json-rpc'+: {
12+
'enable-indexer': true,
13+
},
14+
},
15+
genesis+: {
16+
app_state+: {
17+
feemarket+: {
18+
params+: {
19+
min_gas_multiplier: '0',
20+
},
21+
},
22+
},
23+
},
24+
},
25+
}

integration_tests/conftest.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import os
22
import sys
3+
from pathlib import Path
34

45
import pytest
56

6-
from .network import setup_cronos, setup_geth
7+
from .network import setup_cronos, setup_custom_cronos, setup_geth
78

89
dir = os.path.dirname(os.path.realpath(__file__))
910
sys.path.append(dir + "/protobuf")
@@ -41,10 +42,17 @@ def __exit__(self, _1, _2, _3):
4142
yield SuspendGuard()
4243

4344

44-
@pytest.fixture(scope="session")
45-
def cronos(tmp_path_factory):
46-
path = tmp_path_factory.mktemp("cronos")
47-
yield from setup_cronos(path, 26650)
45+
@pytest.fixture(scope="session", params=[True])
46+
def cronos(request, tmp_path_factory):
47+
enable_indexer = request.param
48+
if enable_indexer:
49+
path = tmp_path_factory.mktemp("indexer")
50+
yield from setup_custom_cronos(
51+
path, 27000, Path(__file__).parent / "configs/enable-indexer.jsonnet"
52+
)
53+
else:
54+
path = tmp_path_factory.mktemp("cronos")
55+
yield from setup_cronos(path, 26650)
4856

4957

5058
@pytest.fixture(scope="session")

scripts/devnet.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ dotenv: .env
22
cronos_777-1:
33
cmd: ./build/cronosd
44
start-flags: "--trace --unsafe-experimental"
5+
config:
6+
tx_index:
7+
indexer: "null"
58
app-config:
69
json-rpc:
710
address: "0.0.0.0:{EVMRPC_PORT}"
811
ws-address: "0.0.0.0:{EVMRPC_PORT_WS}"
912
api: "eth,net,web3,debug,cronos"
13+
enable-indexer: true
1014
validators:
1115
- coins: 1000000000000000000stake,1000000000000000000basetcro
1216
staked: 1000000000000000000stake
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
syntax = "proto3";
2+
package ethermint.types.v1;
3+
4+
import "gogoproto/gogo.proto";
5+
6+
option go_package = "github.com/evmos/ethermint/types";
7+
8+
message TxResult {
9+
option (gogoproto.goproto_getters) = false;
10+
11+
int64 height = 1;
12+
uint32 tx_index = 2;
13+
uint32 msg_index = 3;
14+
15+
// eth tx index, -1 if not found
16+
int32 eth_tx_index = 4;
17+
bool failed = 5;
18+
uint64 gas_used = 6;
19+
// the cumulative gas used within current batch tx
20+
uint64 cumulative_gas_used = 7;
21+
}

0 commit comments

Comments
 (0)