Skip to content

Commit f646d1f

Browse files
author
HuangYi
committed
imp(deps): Geth upgrade v1.10.19 (backport evmos#1159)
1 parent 4658529 commit f646d1f

File tree

10 files changed

+103
-322
lines changed

10 files changed

+103
-322
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ Ref: https://keepachangelog.com/en/1.0.0/
3737

3838
## Unreleased
3939

40+
### State Machine Breaking
41+
* (deps) [\#1159](https://github.com/evmos/ethermint/pull/1159) Bump Geth version to `v1.10.19`.
42+
4043
### Improvements
4144

4245
* (evm) [tharsis#1124](https://github.com/tharsis/ethermint/pull/1124) Reject non-replay-protected tx in ante handler to prevent replay attack

go.mod

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ require (
99
github.com/cosmos/go-bip39 v1.0.0
1010
github.com/cosmos/ibc-go/v2 v2.2.0
1111
github.com/davecgh/go-spew v1.1.1
12-
github.com/ethereum/go-ethereum v1.10.15
12+
github.com/ethereum/go-ethereum v1.10.19
1313
github.com/gogo/protobuf v1.3.3
1414
github.com/golang/protobuf v1.5.2
1515
github.com/gorilla/mux v1.8.0
1616
github.com/gorilla/websocket v1.5.0
1717
github.com/grpc-ecosystem/grpc-gateway v1.16.0
18-
github.com/holiman/uint256 v1.2.0
18+
github.com/holiman/uint256 v1.2.0 // indirect
1919
github.com/improbable-eng/grpc-web v0.15.0
2020
github.com/klauspost/compress v1.13.6 // indirect
2121
github.com/miguelmota/go-ethereum-hdwallet v0.1.1
@@ -53,6 +53,7 @@ require (
5353
github.com/armon/go-metrics v0.3.10 // indirect
5454
github.com/beorn7/perks v1.0.1 // indirect
5555
github.com/bgentry/speakeasy v0.1.0 // indirect
56+
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
5657
github.com/cenkalti/backoff/v4 v4.1.1 // indirect
5758
github.com/cespare/xxhash v1.1.0 // indirect
5859
github.com/cespare/xxhash/v2 v2.1.2 // indirect
@@ -64,11 +65,14 @@ require (
6465
github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect
6566
github.com/cosmos/ledger-go v0.9.2 // indirect
6667
github.com/danieljoos/wincred v1.0.2 // indirect
67-
github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea // indirect
68+
github.com/deckarep/golang-set v1.8.0 // indirect
69+
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
6870
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
6971
github.com/dgraph-io/badger/v2 v2.2007.2 // indirect
7072
github.com/dgraph-io/ristretto v0.0.3 // indirect
7173
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
74+
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect
75+
github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf // indirect
7276
github.com/dustin/go-humanize v1.0.0 // indirect
7377
github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b // indirect
7478
github.com/edsrzf/mmap-go v1.0.0 // indirect
@@ -79,6 +83,7 @@ require (
7983
github.com/go-kit/log v0.2.0 // indirect
8084
github.com/go-logfmt/logfmt v0.5.1 // indirect
8185
github.com/go-ole/go-ole v1.2.5 // indirect
86+
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
8287
github.com/go-stack/stack v1.8.0 // indirect
8388
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
8489
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
@@ -97,9 +102,9 @@ require (
97102
github.com/hashicorp/hcl v1.0.0 // indirect
98103
github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87 // indirect
99104
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
100-
github.com/huin/goupnp v1.0.2 // indirect
105+
github.com/huin/goupnp v1.0.3 // indirect
101106
github.com/inconshreveable/mousetrap v1.0.0 // indirect
102-
github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458 // indirect
107+
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
103108
github.com/jmhodges/levigo v1.0.0 // indirect
104109
github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d // indirect
105110
github.com/lib/pq v1.10.4 // indirect
@@ -143,10 +148,9 @@ require (
143148
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
144149
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
145150
golang.org/x/text v0.3.7 // indirect
146-
golang.org/x/tools v0.1.7 // indirect
151+
golang.org/x/tools v0.1.8-0.20211029000441-d6a9af8af023 // indirect
147152
gopkg.in/ini.v1 v1.66.4 // indirect
148153
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
149-
gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6 // indirect
150154
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
151155
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
152156
nhooyr.io/websocket v1.8.6 // indirect

go.sum

Lines changed: 21 additions & 80 deletions
Large diffs are not rendered by default.

rpc/ethereum/types/block.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ const (
3030
)
3131

3232
const (
33-
BlockParamEarliest = "earliest"
34-
BlockParamLatest = "latest"
35-
BlockParamPending = "pending"
33+
BlockParamEarliest = "earliest"
34+
BlockParamLatest = "latest"
35+
BlockParamFinalized = "finalized"
36+
BlockParamPending = "pending"
3637
)
3738

3839
// NewBlockNumber creates a new BlockNumber instance.
@@ -57,7 +58,7 @@ func ContextWithHeight(height int64) context.Context {
5758
}
5859

5960
// UnmarshalJSON parses the given JSON fragment into a BlockNumber. It supports:
60-
// - "latest", "earliest" or "pending" as string arguments
61+
// - "latest", "finalized", "earliest" or "pending" as string arguments
6162
// - the block number
6263
// Returned errors:
6364
// - an invalid block number error when the given argument isn't a known strings
@@ -72,7 +73,7 @@ func (bn *BlockNumber) UnmarshalJSON(data []byte) error {
7273
case BlockParamEarliest:
7374
*bn = EthEarliestBlockNumber
7475
return nil
75-
case BlockParamLatest:
76+
case BlockParamLatest, BlockParamFinalized:
7677
*bn = EthLatestBlockNumber
7778
return nil
7879
case BlockParamPending:

x/evm/keeper/grpc_query.go

Lines changed: 43 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -471,100 +471,75 @@ func (k *Keeper) traceTx(
471471
) (*interface{}, uint, error) {
472472
// Assemble the structured logger or the JavaScript tracer
473473
var (
474-
tracer vm.EVMLogger
474+
tracer tracers.Tracer
475475
overrides *ethparams.ChainConfig
476476
err error
477+
timeout = defaultTraceTimeout
477478
)
478-
479479
msg, err := tx.AsMessage(signer, cfg.BaseFee)
480480
if err != nil {
481481
return nil, 0, status.Error(codes.Internal, err.Error())
482482
}
483483

484-
if traceConfig != nil && traceConfig.Overrides != nil {
484+
if traceConfig == nil {
485+
traceConfig = &types.TraceConfig{}
486+
}
487+
488+
if traceConfig.Overrides != nil {
485489
overrides = traceConfig.Overrides.EthereumConfig(cfg.ChainConfig.ChainID)
486490
}
487491

488-
switch {
489-
case traceConfig != nil && traceConfig.Tracer != "":
490-
timeout := defaultTraceTimeout
491-
// TODO: change timeout to time.duration
492-
// Used string to comply with go ethereum
493-
if traceConfig.Timeout != "" {
494-
timeout, err = time.ParseDuration(traceConfig.Timeout)
495-
if err != nil {
496-
return nil, 0, status.Errorf(codes.InvalidArgument, "timeout value: %s", err.Error())
497-
}
498-
}
492+
logConfig := logger.Config{
493+
EnableMemory: traceConfig.EnableMemory,
494+
DisableStorage: traceConfig.DisableStorage,
495+
DisableStack: traceConfig.DisableStack,
496+
EnableReturnData: traceConfig.EnableReturnData,
497+
Debug: traceConfig.Debug,
498+
Limit: int(traceConfig.Limit),
499+
Overrides: overrides,
500+
}
499501

500-
tCtx := &tracers.Context{
501-
BlockHash: txConfig.BlockHash,
502-
TxIndex: int(txConfig.TxIndex),
503-
TxHash: txConfig.TxHash,
504-
}
502+
tracer = logger.NewStructLogger(&logConfig)
505503

506-
// Construct the JavaScript tracer to execute with
504+
tCtx := &tracers.Context{
505+
BlockHash: txConfig.BlockHash,
506+
TxIndex: int(txConfig.TxIndex),
507+
TxHash: txConfig.TxHash,
508+
}
509+
510+
if traceConfig.Tracer != "" {
507511
if tracer, err = tracers.New(traceConfig.Tracer, tCtx); err != nil {
508512
return nil, 0, status.Error(codes.Internal, err.Error())
509513
}
514+
}
510515

511-
// Handle timeouts and RPC cancellations
512-
deadlineCtx, cancel := context.WithTimeout(ctx.Context(), timeout)
513-
defer cancel()
514-
515-
go func() {
516-
<-deadlineCtx.Done()
517-
if errors.Is(deadlineCtx.Err(), context.DeadlineExceeded) {
518-
tracer.(tracers.Tracer).Stop(errors.New("execution timeout"))
519-
}
520-
}()
521-
522-
case traceConfig != nil:
523-
logConfig := logger.Config{
524-
EnableMemory: traceConfig.EnableMemory,
525-
DisableStorage: traceConfig.DisableStorage,
526-
DisableStack: traceConfig.DisableStack,
527-
EnableReturnData: traceConfig.EnableReturnData,
528-
Debug: traceConfig.Debug,
529-
Limit: int(traceConfig.Limit),
530-
Overrides: overrides,
516+
// Define a meaningful timeout of a single transaction trace
517+
if traceConfig.Timeout != "" {
518+
if timeout, err = time.ParseDuration(traceConfig.Timeout); err != nil {
519+
return nil, 0, status.Errorf(codes.InvalidArgument, "timeout value: %s", err.Error())
531520
}
532-
tracer = logger.NewStructLogger(&logConfig)
533-
default:
534-
tracer = types.NewTracer(types.TracerStruct, msg, cfg.ChainConfig, ctx.BlockHeight())
535521
}
536522

523+
// Handle timeouts and RPC cancellations
524+
deadlineCtx, cancel := context.WithTimeout(ctx.Context(), timeout)
525+
defer cancel()
526+
527+
go func() {
528+
<-deadlineCtx.Done()
529+
if errors.Is(deadlineCtx.Err(), context.DeadlineExceeded) {
530+
tracer.Stop(errors.New("execution timeout"))
531+
}
532+
}()
533+
537534
res, err := k.ApplyMessageWithConfig(ctx, msg, tracer, commitMessage, cfg, txConfig)
538535
if err != nil {
539536
return nil, 0, status.Error(codes.Internal, err.Error())
540537
}
541538

542539
var result interface{}
543-
544-
// Depending on the tracer type, format and return the trace result data.
545-
switch tracer := tracer.(type) {
546-
case *logger.StructLogger:
547-
returnVal := ""
548-
revert := res.Revert()
549-
if len(revert) > 0 {
550-
returnVal = fmt.Sprintf("%x", revert)
551-
} else {
552-
returnVal = fmt.Sprintf("%x", res.Return())
553-
}
554-
result = types.ExecutionResult{
555-
Gas: res.GasUsed,
556-
Failed: res.Failed(),
557-
ReturnValue: returnVal,
558-
StructLogs: types.FormatLogs(tracer.StructLogs()),
559-
}
560-
case tracers.Tracer:
561-
result, err = tracer.GetResult()
562-
if err != nil {
563-
return nil, 0, status.Error(codes.Internal, err.Error())
564-
}
565-
566-
default:
567-
return nil, 0, status.Errorf(codes.InvalidArgument, "invalid tracer type %T", tracer)
540+
result, err = tracer.GetResult()
541+
if err != nil {
542+
return nil, 0, status.Error(codes.Internal, err.Error())
568543
}
569544

570545
return &result, txConfig.LogIndex + uint(len(res.Logs)), nil

0 commit comments

Comments
 (0)