Skip to content

Commit 4352b11

Browse files
committed
make use of sdk
1 parent 60f19b2 commit 4352b11

File tree

15 files changed

+71
-169
lines changed

15 files changed

+71
-169
lines changed

evmd/go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ require (
289289
replace (
290290
// use cosmos fork of keyring
291291
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
292+
github.com/cosmos/cosmos-sdk => github.com/mmsqe/cosmos-sdk v0.46.0-beta2.0.20251117111808-6aaa69ce93f3
292293
github.com/cosmos/evm => ../
293294
// use Cosmos geth fork
294295
// branch: release/1.16

evmd/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,6 @@ github.com/cosmos/cosmos-db v1.1.3 h1:7QNT77+vkefostcKkhrzDK9uoIEryzFrU9eoMeaQOP
272272
github.com/cosmos/cosmos-db v1.1.3/go.mod h1:kN+wGsnwUJZYn8Sy5Q2O0vCYA99MJllkKASbs6Unb9U=
273273
github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA=
274274
github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec=
275-
github.com/cosmos/cosmos-sdk v0.54.0-beta.0 h1:KOyM1CjuriSxMm2CNhceGfEc2LbRWuImKw7L9yp3+SM=
276-
github.com/cosmos/cosmos-sdk v0.54.0-beta.0/go.mod h1:VBGchDTNoLW3xNy5mPNlnDFZiEjgRN/06vwSkXuBQdg=
277275
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
278276
github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
279277
github.com/cosmos/go-ethereum v1.16.2-cosmos-1 h1:QIaIS6HIdPSBdTvpFhxswhMLUJgcr4irbd2o9ZKldAI=
@@ -738,6 +736,8 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua
738736
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
739737
github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A=
740738
github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4=
739+
github.com/mmsqe/cosmos-sdk v0.46.0-beta2.0.20251117111808-6aaa69ce93f3 h1:/QA3gFnuWLFihwNzVxvaE7GU9hhMH6PASvaLG5QdHu8=
740+
github.com/mmsqe/cosmos-sdk v0.46.0-beta2.0.20251117111808-6aaa69ce93f3/go.mod h1:VBGchDTNoLW3xNy5mPNlnDFZiEjgRN/06vwSkXuBQdg=
741741
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
742742
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
743743
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=

evmd/tests/network/util.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
cmttime "github.com/cometbft/cometbft/types/time"
2121

2222
"github.com/cosmos/evm/server"
23-
"github.com/cosmos/evm/server/config"
2423
evmtypes "github.com/cosmos/evm/x/vm/types"
2524

2625
"cosmossdk.io/log"
@@ -129,10 +128,6 @@ func startInProcess(cfg Config, val *Validator) error {
129128
if val.Ctx == nil || val.Ctx.Viper == nil {
130129
return fmt.Errorf("validator %s context is nil", val.Moniker)
131130
}
132-
133-
gprcClients := config.BackupGRPCConnections{
134-
{0, 1}: val.ClientCtx.GRPCClient,
135-
}
136131
val.jsonrpc, err = server.StartJSONRPC(
137132
ctx,
138133
val.Ctx,
@@ -142,7 +137,6 @@ func startInProcess(cfg Config, val *Validator) error {
142137
nil,
143138
app.(server.AppWithPendingTxStream),
144139
nil,
145-
gprcClients,
146140
)
147141
if err != nil {
148142
return err

go.mod

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ require (
109109
github.com/bytedance/sonic/loader v0.3.0 // indirect
110110
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
111111
github.com/cespare/xxhash/v2 v2.3.0 // indirect
112-
github.com/chigopher/pathlib v0.19.1 // indirect
113112
github.com/chzyer/readline v1.5.1 // indirect
114113
github.com/cloudwego/base64x v0.1.5 // indirect
115114
github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443 // indirect
@@ -184,12 +183,10 @@ require (
184183
github.com/hdevalence/ed25519consensus v0.2.0 // indirect
185184
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
186185
github.com/huandu/skiplist v1.2.1 // indirect
187-
github.com/huandu/xstrings v1.4.0 // indirect
188186
github.com/huin/goupnp v1.3.0 // indirect
189187
github.com/iancoleman/strcase v0.3.0 // indirect
190188
github.com/inconshreveable/mousetrap v1.1.0 // indirect
191189
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
192-
github.com/jinzhu/copier v0.4.0 // indirect
193190
github.com/jmhodges/levigo v1.0.0 // indirect
194191
github.com/klauspost/compress v1.18.0 // indirect
195192
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
@@ -246,7 +243,6 @@ require (
246243
github.com/tklauser/numcpus v0.10.0 // indirect
247244
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
248245
github.com/ulikunitz/xz v0.5.15 // indirect
249-
github.com/vektra/mockery/v2 v2.53.5 // indirect
250246
github.com/yusufpapurcu/wmi v1.2.4 // indirect
251247
github.com/zeebo/errs v1.4.0 // indirect
252248
github.com/zondax/golem v0.27.0 // indirect
@@ -268,7 +264,6 @@ require (
268264
go.yaml.in/yaml/v3 v3.0.4 // indirect
269265
golang.org/x/arch v0.21.0 // indirect
270266
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // indirect
271-
golang.org/x/mod v0.28.0 // indirect
272267
golang.org/x/oauth2 v0.31.0 // indirect
273268
golang.org/x/sys v0.37.0 // indirect
274269
golang.org/x/term v0.36.0 // indirect
@@ -288,6 +283,7 @@ require (
288283
replace (
289284
// use cosmos fork of keyring
290285
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
286+
github.com/cosmos/cosmos-sdk => github.com/mmsqe/cosmos-sdk v0.46.0-beta2.0.20251117111808-6aaa69ce93f3
291287
// use Cosmos geth fork
292288
// branch: release/1.16
293289
github.com/ethereum/go-ethereum => github.com/cosmos/go-ethereum v1.16.2-cosmos-1

go.sum

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,6 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF
204204
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
205205
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
206206
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
207-
github.com/chigopher/pathlib v0.19.1 h1:RoLlUJc0CqBGwq239cilyhxPNLXTK+HXoASGyGznx5A=
208-
github.com/chigopher/pathlib v0.19.1/go.mod h1:tzC1dZLW8o33UQpWkNkhvPwL5n4yyFRFm/jL1YGWFvY=
209207
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
210208
github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM=
211209
github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ=
@@ -269,8 +267,6 @@ github.com/cosmos/cosmos-db v1.1.3 h1:7QNT77+vkefostcKkhrzDK9uoIEryzFrU9eoMeaQOP
269267
github.com/cosmos/cosmos-db v1.1.3/go.mod h1:kN+wGsnwUJZYn8Sy5Q2O0vCYA99MJllkKASbs6Unb9U=
270268
github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA=
271269
github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec=
272-
github.com/cosmos/cosmos-sdk v0.54.0-beta.0 h1:KOyM1CjuriSxMm2CNhceGfEc2LbRWuImKw7L9yp3+SM=
273-
github.com/cosmos/cosmos-sdk v0.54.0-beta.0/go.mod h1:VBGchDTNoLW3xNy5mPNlnDFZiEjgRN/06vwSkXuBQdg=
274270
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
275271
github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
276272
github.com/cosmos/go-ethereum v1.16.2-cosmos-1 h1:QIaIS6HIdPSBdTvpFhxswhMLUJgcr4irbd2o9ZKldAI=
@@ -602,8 +598,6 @@ github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3
602598
github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U=
603599
github.com/huandu/skiplist v1.2.1 h1:dTi93MgjwErA/8idWTzIw4Y1kZsMWx35fmI2c8Rij7w=
604600
github.com/huandu/skiplist v1.2.1/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w=
605-
github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU=
606-
github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
607601
github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg=
608602
github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc=
609603
github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8=
@@ -627,8 +621,6 @@ github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M
627621
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
628622
github.com/jhump/protoreflect v1.17.0 h1:qOEr613fac2lOuTgWN4tPAtLL7fUSbuJL5X5XumQh94=
629623
github.com/jhump/protoreflect v1.17.0/go.mod h1:h9+vUUL38jiBzck8ck+6G/aeMX8Z4QUY/NiJPwPNi+8=
630-
github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8=
631-
github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg=
632624
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
633625
github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U=
634626
github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ=
@@ -725,6 +717,8 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua
725717
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
726718
github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A=
727719
github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4=
720+
github.com/mmsqe/cosmos-sdk v0.46.0-beta2.0.20251117111808-6aaa69ce93f3 h1:/QA3gFnuWLFihwNzVxvaE7GU9hhMH6PASvaLG5QdHu8=
721+
github.com/mmsqe/cosmos-sdk v0.46.0-beta2.0.20251117111808-6aaa69ce93f3/go.mod h1:VBGchDTNoLW3xNy5mPNlnDFZiEjgRN/06vwSkXuBQdg=
728722
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
729723
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
730724
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
@@ -985,8 +979,6 @@ github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY=
985979
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
986980
github.com/urfave/cli/v2 v2.27.5 h1:WoHEJLdsXr6dDWoJgMq/CboDmyY/8HMMH1fTECbih+w=
987981
github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ=
988-
github.com/vektra/mockery/v2 v2.53.5 h1:iktAY68pNiMvLoHxKqlSNSv/1py0QF/17UGrrAMYDI8=
989-
github.com/vektra/mockery/v2 v2.53.5/go.mod h1:hIFFb3CvzPdDJJiU7J4zLRblUMv7OuezWsHPmswriwo=
990982
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
991983
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4=
992984
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
@@ -1097,8 +1089,6 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
10971089
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
10981090
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
10991091
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
1100-
golang.org/x/mod v0.28.0 h1:gQBtGhjxykdjY9YhZpSlZIsbnaE2+PgjfLWUQTnoZ1U=
1101-
golang.org/x/mod v0.28.0/go.mod h1:yfB/L0NOf/kmEbXjzCPOx1iK1fRutOydrCMsqRhEBxI=
11021092
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
11031093
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
11041094
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=

rpc/apis.go

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
"github.com/cosmos/evm/rpc/namespaces/ethereum/txpool"
1717
"github.com/cosmos/evm/rpc/namespaces/ethereum/web3"
1818
"github.com/cosmos/evm/rpc/stream"
19-
"github.com/cosmos/evm/server/config"
2019
servertypes "github.com/cosmos/evm/server/types"
2120

2221
"github.com/cosmos/cosmos-sdk/client"
@@ -50,7 +49,6 @@ type APICreator = func(
5049
allowUnprotectedTxs bool,
5150
indexer servertypes.EVMTxIndexer,
5251
mempool *evmmempool.ExperimentalEVMMempool,
53-
backupGRPCClientConns config.BackupGRPCConnections,
5452
) []rpc.API
5553

5654
// apiCreators defines the JSON-RPC API namespaces.
@@ -64,9 +62,8 @@ func init() {
6462
allowUnprotectedTxs bool,
6563
indexer servertypes.EVMTxIndexer,
6664
mempool *evmmempool.ExperimentalEVMMempool,
67-
backupGRPCClientConns config.BackupGRPCConnections,
6865
) []rpc.API {
69-
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer, mempool, backupGRPCClientConns)
66+
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer, mempool)
7067
return []rpc.API{
7168
{
7269
Namespace: EthNamespace,
@@ -82,7 +79,7 @@ func init() {
8279
},
8380
}
8481
},
85-
Web3Namespace: func(*server.Context, client.Context, *stream.RPCStream, bool, servertypes.EVMTxIndexer, *evmmempool.ExperimentalEVMMempool, config.BackupGRPCConnections) []rpc.API {
82+
Web3Namespace: func(*server.Context, client.Context, *stream.RPCStream, bool, servertypes.EVMTxIndexer, *evmmempool.ExperimentalEVMMempool) []rpc.API {
8683
return []rpc.API{
8784
{
8885
Namespace: Web3Namespace,
@@ -92,7 +89,7 @@ func init() {
9289
},
9390
}
9491
},
95-
NetNamespace: func(ctx *server.Context, clientCtx client.Context, _ *stream.RPCStream, _ bool, _ servertypes.EVMTxIndexer, _ *evmmempool.ExperimentalEVMMempool, _ config.BackupGRPCConnections) []rpc.API {
92+
NetNamespace: func(ctx *server.Context, clientCtx client.Context, _ *stream.RPCStream, _ bool, _ servertypes.EVMTxIndexer, _ *evmmempool.ExperimentalEVMMempool) []rpc.API {
9693
return []rpc.API{
9794
{
9895
Namespace: NetNamespace,
@@ -108,9 +105,8 @@ func init() {
108105
allowUnprotectedTxs bool,
109106
indexer servertypes.EVMTxIndexer,
110107
mempool *evmmempool.ExperimentalEVMMempool,
111-
backupGRPCClientConns config.BackupGRPCConnections,
112108
) []rpc.API {
113-
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer, mempool, backupGRPCClientConns)
109+
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer, mempool)
114110
return []rpc.API{
115111
{
116112
Namespace: PersonalNamespace,
@@ -126,9 +122,8 @@ func init() {
126122
allowUnprotectedTxs bool,
127123
indexer servertypes.EVMTxIndexer,
128124
mempool *evmmempool.ExperimentalEVMMempool,
129-
backupGRPCClientConns config.BackupGRPCConnections,
130125
) []rpc.API {
131-
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer, mempool, backupGRPCClientConns)
126+
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer, mempool)
132127
return []rpc.API{
133128
{
134129
Namespace: TxPoolNamespace,
@@ -144,9 +139,8 @@ func init() {
144139
allowUnprotectedTxs bool,
145140
indexer servertypes.EVMTxIndexer,
146141
mempool *evmmempool.ExperimentalEVMMempool,
147-
backupGRPCClientConns config.BackupGRPCConnections,
148142
) []rpc.API {
149-
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer, mempool, backupGRPCClientConns)
143+
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer, mempool)
150144
return []rpc.API{
151145
{
152146
Namespace: DebugNamespace,
@@ -162,9 +156,8 @@ func init() {
162156
allowUnprotectedTxs bool,
163157
indexer servertypes.EVMTxIndexer,
164158
mempool *evmmempool.ExperimentalEVMMempool,
165-
backupGRPCClientConns config.BackupGRPCConnections,
166159
) []rpc.API {
167-
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer, mempool, backupGRPCClientConns)
160+
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer, mempool)
168161
return []rpc.API{
169162
{
170163
Namespace: MinerNamespace,
@@ -185,13 +178,12 @@ func GetRPCAPIs(ctx *server.Context,
185178
indexer servertypes.EVMTxIndexer,
186179
selectedAPIs []string,
187180
mempool *evmmempool.ExperimentalEVMMempool,
188-
backupGRPCClientConns config.BackupGRPCConnections,
189181
) []rpc.API {
190182
var apis []rpc.API
191183

192184
for _, ns := range selectedAPIs {
193185
if creator, ok := apiCreators[ns]; ok {
194-
apis = append(apis, creator(ctx, clientCtx, stream, allowUnprotectedTxs, indexer, mempool, backupGRPCClientConns)...)
186+
apis = append(apis, creator(ctx, clientCtx, stream, allowUnprotectedTxs, indexer, mempool)...)
195187
} else {
196188
ctx.Logger.Error("invalid namespace value", "namespace", ns)
197189
}

rpc/backend/backend.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"github.com/cosmos/evm/rpc/types"
2323
"github.com/cosmos/evm/server/config"
2424
servertypes "github.com/cosmos/evm/server/types"
25-
feemarkettypes "github.com/cosmos/evm/x/feemarket/types"
2625
evmtypes "github.com/cosmos/evm/x/vm/types"
2726

2827
"cosmossdk.io/log"
@@ -31,7 +30,6 @@ import (
3130
"github.com/cosmos/cosmos-sdk/crypto/keyring"
3231
"github.com/cosmos/cosmos-sdk/server"
3332
sdk "github.com/cosmos/cosmos-sdk/types"
34-
"github.com/cosmos/cosmos-sdk/types/tx"
3533
)
3634

3735
// BackendI implements the Cosmos and EVM backend.
@@ -175,7 +173,6 @@ type Backend struct {
175173
Indexer servertypes.EVMTxIndexer
176174
ProcessBlocker ProcessBlocker
177175
Mempool *evmmempool.ExperimentalEVMMempool
178-
BackupQueryClients map[config.BlockRange]*types.QueryClient
179176
}
180177

181178
func (b *Backend) GetConfig() config.Config {
@@ -190,7 +187,6 @@ func NewBackend(
190187
allowUnprotectedTxs bool,
191188
indexer servertypes.EVMTxIndexer,
192189
mempool *evmmempool.ExperimentalEVMMempool,
193-
backupGRPCClientConns config.BackupGRPCConnections,
194190
) *Backend {
195191
appConf, err := config.GetConfig(ctx.Viper)
196192
if err != nil {
@@ -213,15 +209,7 @@ func NewBackend(
213209
AllowUnprotectedTxs: allowUnprotectedTxs,
214210
Indexer: indexer,
215211
Mempool: mempool,
216-
BackupQueryClients: make(map[config.BlockRange]*types.QueryClient),
217212
}
218213
b.ProcessBlocker = b.ProcessBlock
219-
for key, conn := range backupGRPCClientConns {
220-
b.BackupQueryClients[key] = &types.QueryClient{
221-
ServiceClient: tx.NewServiceClient(conn),
222-
QueryClient: evmtypes.NewQueryClient(conn),
223-
FeeMarket: feemarkettypes.NewQueryClient(conn),
224-
}
225-
}
226214
return b
227215
}

rpc/backend/tx_info_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"github.com/cosmos/evm/indexer"
2424
"github.com/cosmos/evm/rpc/backend/mocks"
2525
rpctypes "github.com/cosmos/evm/rpc/types"
26-
"github.com/cosmos/evm/server/config"
2726
servertypes "github.com/cosmos/evm/server/types"
2827
"github.com/cosmos/evm/testutil/constants"
2928
utiltx "github.com/cosmos/evm/testutil/tx"
@@ -69,7 +68,7 @@ func setupMockBackend(t *testing.T) *Backend {
6968
allowUnprotectedTxs := false
7069
idxer := indexer.NewKVIndexer(dbm.NewMemDB(), ctx.Logger, clientCtx)
7170

72-
backend := NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, idxer, nil, make(config.BackupGRPCConnections))
71+
backend := NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, idxer, nil)
7372
backend.Cfg.JSONRPC.GasCap = 25000000
7473
backend.Cfg.JSONRPC.EVMTimeout = 0
7574
backend.Cfg.JSONRPC.AllowInsecureUnlock = true

rpc/backend/utils.go

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"cosmossdk.io/log"
2727

2828
sdk "github.com/cosmos/cosmos-sdk/types"
29+
"github.com/cosmos/cosmos-sdk/types/tx"
2930
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
3031
)
3132

@@ -339,17 +340,13 @@ func GetHexProofs(proof *crypto.ProofOps) []string {
339340
return proofs
340341
}
341342

343+
// getGrpcClient returns a query client for the given height using SDK's connection routing
342344
func (b *Backend) getGrpcClient(height int64) *types.QueryClient {
343-
// height = 0 means latest block, use the default client
344-
if height <= 0 {
345-
return b.QueryClient
345+
// Use SDK's GRPCConnProvider to get the appropriate connection
346+
grpcConn := b.ClientCtx.GetGRPCConn(height)
347+
return &types.QueryClient{
348+
ServiceClient: tx.NewServiceClient(grpcConn),
349+
QueryClient: evmtypes.NewQueryClient(grpcConn),
350+
FeeMarket: feemarkettypes.NewQueryClient(grpcConn),
346351
}
347-
for blocks, client := range b.BackupQueryClients {
348-
// b1-b2 -> g1
349-
// b3-b4 -> g2
350-
if int64(blocks[0]) <= height && int64(blocks[1]) >= height {
351-
return client
352-
}
353-
}
354-
return b.QueryClient
355352
}

0 commit comments

Comments
 (0)