From 56d558cca73e41c88f3a0bf02f6fae5c2aa89961 Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Tue, 15 Oct 2024 12:38:55 -0700 Subject: [PATCH 01/12] upgrade to go-ethereum 1.12 --- app/ante/eth.go | 13 ++- app/ante/interfaces.go | 2 +- app/ante/sigverify.go | 4 +- go.mod | 37 ++++--- go.sum | 97 +++++++++++++------ gomod2nix.toml | 90 +++++++++++------ rpc/backend/backend.go | 3 +- rpc/backend/chain_info.go | 3 +- rpc/backend/chain_info_test.go | 3 +- rpc/backend/sign_tx.go | 4 +- rpc/backend/utils.go | 4 +- rpc/namespaces/ethereum/debug/api.go | 12 --- rpc/namespaces/ethereum/eth/api.go | 5 +- tests/importer/chain_ctx.go | 7 +- tests/importer/chain_ctx_test.go | 6 +- tests/importer/importer_test.go | 11 ++- types/signer.go | 27 ++++++ x/evm/handler_test.go | 32 +++--- x/evm/keeper/config.go | 8 +- x/evm/keeper/gas.go | 10 +- x/evm/keeper/grpc_query.go | 78 +++++++-------- x/evm/keeper/grpc_query_test.go | 4 +- x/evm/keeper/hooks.go | 2 +- x/evm/keeper/hooks_test.go | 6 +- x/evm/keeper/keeper.go | 4 +- x/evm/keeper/state_transition.go | 66 ++++++------- .../keeper/state_transition_benchmark_test.go | 5 +- x/evm/keeper/state_transition_test.go | 15 +-- x/evm/keeper/statedb_benchmark_test.go | 2 +- x/evm/keeper/statedb_test.go | 10 +- x/evm/keeper/tracer.go | 6 +- x/evm/keeper/utils.go | 2 +- x/evm/statedb/journal.go | 22 +++++ x/evm/statedb/state_object.go | 5 + x/evm/statedb/statedb.go | 77 ++++++++++++--- x/evm/statedb/statedb_test.go | 54 ++++------- x/evm/statedb/transient_storage.go | 10 +- x/evm/types/chain_config.go | 3 - x/evm/types/interfaces.go | 2 +- x/evm/types/msg.go | 26 ++--- x/evm/types/tracer.go | 3 +- x/evm/types/tx_args.go | 20 +++- x/feemarket/migrations/v4/types/params.go | 4 +- x/feemarket/types/params.go | 4 +- 44 files changed, 473 insertions(+), 335 deletions(-) create mode 100644 types/signer.go diff --git a/app/ante/eth.go b/app/ante/eth.go index 3fe69e34..9806ae32 100644 --- a/app/ante/eth.go +++ b/app/ante/eth.go @@ -31,7 +31,6 @@ import ( evmtypes "github.com/zeta-chain/ethermint/x/evm/types" "github.com/ethereum/go-ethereum/common" - ethtypes "github.com/ethereum/go-ethereum/core/types" ) // EthAccountVerificationDecorator validates an account balance checks @@ -258,7 +257,7 @@ func NewCanTransferDecorator(evmKeeper EVMKeeper) CanTransferDecorator { func (ctd CanTransferDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { params := ctd.evmKeeper.GetParams(ctx) ethCfg := params.ChainConfig.EthereumConfig(ctd.evmKeeper.ChainID()) - signer := ethtypes.MakeSigner(ethCfg, big.NewInt(ctx.BlockHeight())) + signer := ethermint.MakeSigner(ethCfg, big.NewInt(ctx.BlockHeight())) for _, msg := range tx.GetMsgs() { msgEthTx, ok := msg.(*evmtypes.MsgEthereumTx) @@ -283,11 +282,11 @@ func (ctd CanTransferDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate "base fee is supported but evm block context value is nil", ) } - if coreMsg.GasFeeCap().Cmp(baseFee) < 0 { + if coreMsg.GasFeeCap.Cmp(baseFee) < 0 { return ctx, errorsmod.Wrapf( errortypes.ErrInsufficientFee, "max fee per gas less than block base fee (%s < %s)", - coreMsg.GasFeeCap(), baseFee, + coreMsg.GasFeeCap, baseFee, ) } } @@ -305,12 +304,12 @@ func (ctd CanTransferDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate // check that caller has enough balance to cover asset transfer for **topmost** call // NOTE: here the gas consumed is from the context with the infinite gas meter - if coreMsg.Value().Sign() > 0 && !evm.Context.CanTransfer(stateDB, coreMsg.From(), coreMsg.Value()) { + if coreMsg.Value.Sign() > 0 && !evm.Context.CanTransfer(stateDB, coreMsg.From, coreMsg.Value) { return ctx, errorsmod.Wrapf( errortypes.ErrInsufficientFunds, "failed to transfer %s from address %s using the EVM block context transfer function", - coreMsg.Value(), - coreMsg.From(), + coreMsg.Value, + coreMsg.From, ) } } diff --git a/app/ante/interfaces.go b/app/ante/interfaces.go index 553d8973..90313868 100644 --- a/app/ante/interfaces.go +++ b/app/ante/interfaces.go @@ -42,7 +42,7 @@ type EVMKeeper interface { statedb.Keeper DynamicFeeEVMKeeper - NewEVM(ctx sdk.Context, msg core.Message, cfg *statedb.EVMConfig, tracer vm.EVMLogger, stateDB vm.StateDB) *vm.EVM + NewEVM(ctx sdk.Context, msg *core.Message, cfg *statedb.EVMConfig, tracer vm.EVMLogger, stateDB vm.StateDB) *vm.EVM DeductTxCostsFromUserBalance(ctx sdk.Context, fees sdk.Coins, from common.Address) error GetBalance(ctx sdk.Context, addr common.Address) *big.Int ResetTransientGasUsed(ctx sdk.Context) diff --git a/app/ante/sigverify.go b/app/ante/sigverify.go index 23908c4d..864167e2 100644 --- a/app/ante/sigverify.go +++ b/app/ante/sigverify.go @@ -21,7 +21,7 @@ import ( errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" errortypes "github.com/cosmos/cosmos-sdk/types/errors" - ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/zeta-chain/ethermint/types" evmtypes "github.com/zeta-chain/ethermint/x/evm/types" ) @@ -48,7 +48,7 @@ func (esvd EthSigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, s chainCfg := evmParams.GetChainConfig() ethCfg := chainCfg.EthereumConfig(chainID) blockNum := big.NewInt(ctx.BlockHeight()) - signer := ethtypes.MakeSigner(ethCfg, blockNum) + signer := types.MakeSigner(ethCfg, blockNum) for _, msg := range tx.GetMsgs() { msgEthTx, ok := msg.(*evmtypes.MsgEthereumTx) diff --git a/go.mod b/go.mod index 7b42957d..e955d84a 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/cosmos/gogoproto v1.7.0 github.com/cosmos/ibc-go/v7 v7.2.0 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc - github.com/ethereum/go-ethereum v1.10.26 + github.com/ethereum/go-ethereum v1.12.2 github.com/golang/protobuf v1.5.4 github.com/gorilla/mux v1.8.0 github.com/gorilla/websocket v1.5.0 @@ -32,7 +32,7 @@ require ( github.com/spf13/cast v1.6.0 github.com/spf13/cobra v1.8.0 github.com/spf13/viper v1.18.2 - github.com/status-im/keycard-go v0.0.0-20200402102358-957c09536969 + github.com/status-im/keycard-go v0.2.0 github.com/stretchr/testify v1.9.0 github.com/tidwall/btree v1.6.0 github.com/tidwall/gjson v1.14.4 @@ -55,8 +55,10 @@ require ( cosmossdk.io/depinject v1.0.0-alpha.4 // indirect cosmossdk.io/log v1.4.1 // indirect filippo.io/edwards25519 v1.0.0 // indirect + github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect + github.com/DataDog/zstd v1.5.2 // indirect github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect github.com/VictoriaMetrics/fastcache v1.6.0 // indirect github.com/allegro/bigcache v1.2.1 // indirect @@ -64,6 +66,7 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect + github.com/bits-and-blooms/bitset v1.7.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect @@ -73,28 +76,32 @@ require ( github.com/cockroachdb/apd/v2 v2.0.2 // indirect github.com/cockroachdb/errors v1.10.0 // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect + github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 // indirect github.com/cockroachdb/redact v1.1.5 // indirect github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect github.com/confio/ics23/go v0.9.0 // indirect + github.com/consensys/bavard v0.1.13 // indirect + github.com/consensys/gnark-crypto v0.10.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v0.20.1 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.12.4 // indirect github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect + github.com/crate-crypto/go-kzg-4844 v0.3.0 // indirect github.com/creachadair/taskgroup v0.4.2 // indirect github.com/danieljoos/wincred v1.1.2 // indirect - github.com/deckarep/golang-set v1.8.0 // indirect + github.com/deckarep/golang-set/v2 v2.1.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v2 v2.2007.4 // indirect github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect - github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect - github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf // indirect + github.com/dlclark/regexp2 v1.7.0 // indirect + github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.6.0 // indirect - github.com/edsrzf/mmap-go v1.0.0 // indirect + github.com/ethereum/c-kzg-4844 v0.3.1 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect @@ -106,17 +113,19 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect - github.com/go-stack/stack v1.8.0 // indirect + github.com/go-stack/stack v1.8.1 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect + github.com/gofrs/flock v0.8.1 // indirect github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/glog v1.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/mock v1.6.0 // indirect - github.com/golang/snappy v0.0.4 // indirect + github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/google/btree v1.1.2 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/orderedcode v0.0.1 // indirect + github.com/google/pprof v0.0.0-20230207041349-798e818bf904 // indirect github.com/google/s2a-go v0.1.7 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect @@ -135,14 +144,13 @@ require ( github.com/hashicorp/hcl v1.0.0 // indirect github.com/hdevalence/ed25519consensus v0.1.0 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect - github.com/holiman/uint256 v1.2.1 // indirect + github.com/holiman/uint256 v1.2.3 // indirect github.com/huandu/skiplist v1.2.0 // indirect github.com/huin/goupnp v1.0.3 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d // indirect github.com/klauspost/compress v1.17.0 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect @@ -160,6 +168,7 @@ require ( github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/mtibben/percent v0.2.1 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect @@ -169,9 +178,7 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect - github.com/prometheus/tsdb v0.7.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect - github.com/rjeczalik/notify v0.9.1 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/rs/zerolog v1.33.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect @@ -183,6 +190,7 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/subosito/gotenv v1.6.0 // indirect + github.com/supranational/blst v0.3.11 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/go-amino v0.16.0 // indirect github.com/tidwall/match v1.1.1 // indirect @@ -218,11 +226,10 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect pgregory.net/rapid v1.1.0 // indirect + rsc.io/tmplfunc v0.0.3 // indirect ) replace ( - // use cosmos keyring - github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 github.com/ChainSafe/go-schnorrkel => github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d github.com/cometbft/cometbft => github.com/cometbft/cometbft v0.37.2 // Fix upstream GHSA-h395-qcrw-5vmq vulnerability. @@ -232,4 +239,4 @@ replace ( ) // ZetaChain maintained replacements -replace github.com/ethereum/go-ethereum => github.com/zeta-chain/go-ethereum v1.10.26-spc +replace github.com/ethereum/go-ethereum => github.com/zeta-chain/go-ethereum v1.12.3-0.20241015175757-891ef9f51367 diff --git a/go.sum b/go.sum index a44c8e9c..94b13437 100644 --- a/go.sum +++ b/go.sum @@ -201,6 +201,10 @@ cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= +github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= +github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= +github.com/99designs/keyring v1.2.1 h1:tYLp1ULvO7i3fI5vE21ReQuj99QFSs7lGm0xWyJo87o= +github.com/99designs/keyring v1.2.1/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= @@ -208,6 +212,8 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8= +github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= @@ -260,6 +266,8 @@ github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bits-and-blooms/bitset v1.7.0 h1:YjAGVd3XmtK9ktAbX8Zg2g2PwLIMjGREZJHlV4j7NEo= +github.com/bits-and-blooms/bitset v1.7.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A= @@ -305,12 +313,15 @@ github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/logex v1.2.0/go.mod h1:9+9sk7u7pGNWYMkh0hdiL++6OeibzJccyQU4p4MedaY= github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM= github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/readline v1.5.0/go.mod h1:x22KAscuvRqlLoK9CsoYsmxoXZMMFVyOl86cAH8qUic= github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI= github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/chzyer/test v0.0.0-20210722231415-061457976a23/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04= github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= @@ -331,10 +342,14 @@ github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa/go.mod h1:x/1Gn8zydmfq github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/cockroachdb/datadriven v1.0.2 h1:H9MtNqVoVhvd9nCBwOyDjUEdZCREqbIdCJD93PBm/jA= +github.com/cockroachdb/datadriven v1.0.2/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= github.com/cockroachdb/errors v1.10.0 h1:lfxS8zZz1+OjtV4MtNWgboi/W5tyLEB6VQZBXN+0VUU= github.com/cockroachdb/errors v1.10.0/go.mod h1:lknhIsEVQ9Ss/qKDBQS/UqFSvPQjOwNq2qyKAxtHRqE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 h1:ytcWPaNPhNoGMWEhDvS3zToKcDpRsLuRolQJBVGdozk= +github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811/go.mod h1:Nb5lgvnQ2+oGlE/EyZy4+2/CxRh9KfvCXnag1vtpxVM= github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= @@ -346,6 +361,10 @@ github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AK github.com/cometbft/cometbft-db v0.8.0/go.mod h1:6ASCP4pfhmrCBpfk01/9E1SI29nD3HfVHrY4PG8x5c0= github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak= +github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= +github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= +github.com/consensys/gnark-crypto v0.10.0 h1:zRh22SR7o4K35SoNqouS9J/TKHTyU2QWaj5ldehyXtA= +github.com/consensys/gnark-crypto v0.10.0/go.mod h1:Iq/P3HHl0ElSjsg2E1gsMwhAyxnxoKK5nVyZKd+/KhU= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -374,8 +393,6 @@ github.com/cosmos/ibc-go/v7 v7.2.0 h1:dx0DLUl7rxdyZ8NiT6UsrbzKOJx/w7s+BOaewFRH6c github.com/cosmos/ibc-go/v7 v7.2.0/go.mod h1:OOcjKIRku/j1Xs1RgKK0yvKRrJ5iFuZYMetR1n3yMlc= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= -github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 h1:DdzS1m6o/pCqeZ8VOAit/gyATedRgjvkVI+UCrLpyuU= -github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76/go.mod h1:0mkLWIoZuQ7uBoospo5Q9zIpqq6rYCPJDSUdeCJvPM8= github.com/cosmos/ledger-cosmos-go v0.12.4 h1:drvWt+GJP7Aiw550yeb3ON/zsrgW0jgh5saFCr7pDnw= github.com/cosmos/ledger-cosmos-go v0.12.4/go.mod h1:fjfVWRf++Xkygt9wzCsjEBdjcf7wiiY35fv3ctT+k4M= github.com/cosmos/rosetta-sdk-go v0.10.0 h1:E5RhTruuoA7KTIXUcMicL76cffyeoyvNybzUGSKFTcM= @@ -385,11 +402,12 @@ github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwc github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/crate-crypto/go-kzg-4844 v0.3.0 h1:UBlWE0CgyFqqzTI+IFyCzA7A3Zw4iip6uzRv5NIXG0A= +github.com/crate-crypto/go-kzg-4844 v0.3.0/go.mod h1:SBP7ikXEgDnUPONgm33HtuDZEDtWa3L4QtN1ocJSEQ4= github.com/creachadair/taskgroup v0.4.2 h1:jsBLdAJE42asreGss2xZGZ8fJra7WtwnHWeJFxv2Li8= github.com/creachadair/taskgroup v0.4.2/go.mod h1:qiXUOSrbwAY3u0JPGTzObbE3yf9hcXHDKBZ2ZjpCbgM= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/danieljoos/wincred v1.0.2/go.mod h1:SnuYRW9lp1oJrZX/dXJqr0cPK5gYXqx3EJbmjhLdK9U= github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -397,8 +415,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= -github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= +github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6dtGktsI= +github.com/deckarep/golang-set/v2 v2.1.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= @@ -416,27 +434,27 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 h1:Izz0+t1Z5nI16/II7vuEo/nHjodOg0p7+OiDpjX5t1E= github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/dlclark/regexp2 v1.7.0 h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo= +github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf h1:Yt+4K30SdjOkRoRRm3vYNQgR+/ZIy0RmeUDZo7Y8zeQ= -github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= +github.com/dop251/goja v0.0.0-20211022113120-dc8c55024d06/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= +github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3 h1:+3HCtB74++ClLy8GgjUQYeC8R4ILzVcIe8+5edAJJnE= +github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= +github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d/go.mod h1:DngW8aVqWbuLRMHItjPUyqdj+HWPvnQe8V8y1nDpIbM= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b/go.mod h1:7BvyPhdbLxMXIYTFPLsyJRFMsKmOZnQmzh6Gb+uquuM= github.com/dvsekhvalnov/jose2go v1.6.0 h1:Y9gnSnP4qEI0+/uQkHvFXeD2PLPJeXEL+ySMEA2EjTY= github.com/dvsekhvalnov/jose2go v1.6.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -451,6 +469,8 @@ github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go. github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= +github.com/ethereum/c-kzg-4844 v0.3.1 h1:sR65+68+WdnMKxseNWxSJuAv2tsUrihTpVBTfM/U5Zg= +github.com/ethereum/c-kzg-4844 v0.3.1/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= @@ -513,8 +533,9 @@ github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4 github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU= github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= +github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= @@ -524,6 +545,8 @@ github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/E github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= +github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= @@ -577,8 +600,9 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= @@ -627,9 +651,12 @@ github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20230207041349-798e818bf904 h1:4/hN5RUoecvl+RmJRE2YxKWtnnQls6rQjjW5oV7qg2U= +github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8qtYCYyzA+8c/9qtqgA3qsXGYqCPKARAFg= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= +github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -720,10 +747,12 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7HsjsjeEZ6auqU= github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= +github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7 h1:3JQNjnMRil1yD0IfZKHF9GxxWKDJGj8I0IqOUol//sw= +github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= -github.com/holiman/uint256 v1.2.1 h1:XRtyuda/zw2l+Bq/38n5XUoEF72aSOu/77Thd9pPp2o= -github.com/holiman/uint256 v1.2.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= +github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o= +github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= @@ -735,6 +764,7 @@ github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixH github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20220319035150-800ac71e25c2/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= @@ -769,8 +799,6 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d h1:Z+RDyXzjKE0i2sTjZ/b1uxiGtPhFy34Ou/Tk0qwN0kM= -github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -787,12 +815,17 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxv github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= +github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= @@ -848,6 +881,9 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= +github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= +github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= +github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -874,7 +910,6 @@ github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= @@ -951,7 +986,6 @@ github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6T github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= @@ -968,18 +1002,15 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= -github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rjeczalik/notify v0.9.1 h1:CLCKso/QK1snAlnhNR/CNvNiFU2saUtjV0bx3EwNeCE= -github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= @@ -1039,14 +1070,13 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= -github.com/status-im/keycard-go v0.0.0-20200402102358-957c09536969 h1:Oo2KZNP70KE0+IUJSidPj/BFS/RXNHmKIJOdckzml2E= -github.com/status-im/keycard-go v0.0.0-20200402102358-957c09536969/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= +github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= +github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= @@ -1065,6 +1095,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= +github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= @@ -1100,8 +1132,8 @@ github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0o github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli/v2 v2.10.2 h1:x3p8awjp/2arX+Nl/G2040AZpOCHS/eMJJ1/a+mye4Y= -github.com/urfave/cli/v2 v2.10.2/go.mod h1:f8iq5LtQ/bLxafbdBSLPPNsgaW0l/2fYYEHhAyPlwvo= +github.com/urfave/cli/v2 v2.24.1 h1:/QYYr7g0EhwXEML8jO+8OYt5trPnLHS0p3mrgExJ5NU= +github.com/urfave/cli/v2 v2.24.1/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= @@ -1112,8 +1144,8 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/zeta-chain/go-ethereum v1.10.26-spc h1:NvY4rR9yw52wfxWt7YoFsWbaIwVMyOtTsWKqGAXk+sE= -github.com/zeta-chain/go-ethereum v1.10.26-spc/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo= +github.com/zeta-chain/go-ethereum v1.12.3-0.20241015175757-891ef9f51367 h1:smcLz1TAQB/4lT/4knII3jae8vjYvByCqimzxaxI4bo= +github.com/zeta-chain/go-ethereum v1.12.3-0.20241015175757-891ef9f51367/go.mod h1:1cRAEV+rp/xX0zraSCBnu9Py3HQ+geRMj3HdR+k0wfI= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= @@ -1338,7 +1370,6 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1763,6 +1794,8 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= +gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= @@ -1801,6 +1834,8 @@ pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= +rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/gomod2nix.toml b/gomod2nix.toml index 96fa0d6f..fc0a7e3f 100644 --- a/gomod2nix.toml +++ b/gomod2nix.toml @@ -40,14 +40,19 @@ schema = 3 [mod."filippo.io/edwards25519"] version = "v1.0.0" hash = "sha256-APnPAcmItvtJ5Zsy863lzR2TjEBF9Y66TY1e4M1ap98=" + [mod."github.com/99designs/go-keychain"] + version = "v0.0.0-20191008050251-8e49817e8af4" + hash = "sha256-4EndKcspGC3GOPCmctXF1NnWzxWwMyY/OQpFMmr8Sc0=" [mod."github.com/99designs/keyring"] - version = "v1.1.7-0.20210622111912-ef00f8ac3d76" - hash = "sha256-oCalyOZWegRgKHZ1GvYHNkrMKh51j8cOE/K4yBPM5Oc=" - replaced = "github.com/cosmos/keyring" + version = "v1.2.1" + hash = "sha256-OG3YGMFql9Vd5IzysdmyGjXhd39wQq0qh3YRQi4k7SI=" [mod."github.com/ChainSafe/go-schnorrkel"] version = "v0.0.0-20200405005733-88cbf1b4c40d" hash = "sha256-i8RXZemJGlSjBT35oPm0SawFiBoIU5Pkq5xp4n/rzCY=" replaced = "github.com/ChainSafe/go-schnorrkel" + [mod."github.com/DataDog/zstd"] + version = "v1.5.2" + hash = "sha256-LVkZHLG8O4CzmqyQVbGn+0r6AKIMABej8a4HKMFw/xo=" [mod."github.com/StackExchange/wmi"] version = "v0.0.0-20180116203802-5d049714c4a6" hash = "sha256-0yUxhZB3v3ZE3QY36zHs2cJ1S4GXptXIhyAi6sI2nOo=" @@ -72,6 +77,9 @@ schema = 3 [mod."github.com/bgentry/speakeasy"] version = "v0.1.1-0.20220910012023-760eaf8b6816" hash = "sha256-Tx3sPuhsoVwrCfJdIwf4ipn7pD92OQNYvpCxl1Z9Wt0=" + [mod."github.com/bits-and-blooms/bitset"] + version = "v1.7.0" + hash = "sha256-URPyLi92d/Yjul8r5g7dtf0DZ4GHbBsh8Qz4O0fDpxA=" [mod."github.com/btcsuite/btcd"] version = "v0.24.2" hash = "sha256-ahlpwEr4KfyrEA899X07QtuSDnC8U+SnwL+z72DiK5E=" @@ -105,6 +113,9 @@ schema = 3 [mod."github.com/cockroachdb/logtags"] version = "v0.0.0-20230118201751-21c54148d20b" hash = "sha256-7dQH6j1o99fuxHKkw0RhNC5wJKkvRLMDJpUiVnDx6h8=" + [mod."github.com/cockroachdb/pebble"] + version = "v0.0.0-20230209160836-829675f94811" + hash = "sha256-DpbEXN/YWWXap83lz99r6sAUUk76ixDe4fRn1GpBWpo=" [mod."github.com/cockroachdb/redact"] version = "v1.1.5" hash = "sha256-0rtT7LRO0wxf9XovOK8GXRrhmx8OcbdPK/mXOKbJdog=" @@ -121,6 +132,12 @@ schema = 3 [mod."github.com/confio/ics23/go"] version = "v0.9.0" hash = "sha256-guD8w7YygfUp7lpTAUyXQuCPx8F3lXkcg+yR5+JOCbk=" + [mod."github.com/consensys/bavard"] + version = "v0.1.13" + hash = "sha256-DEx0JuvgqNCNv7IMHlbLJK6pb1ru29C/rTSKh6YksVg=" + [mod."github.com/consensys/gnark-crypto"] + version = "v0.10.0" + hash = "sha256-qcKMoiAzhJtGECQyXC/Wntmdc1qmHp89ZKkLu1Mi08o=" [mod."github.com/cosmos/btcutil"] version = "v1.0.5" hash = "sha256-t572Sr5iiHcuMKLMWa2i+LBAt192oa+G1oA371tG/eI=" @@ -154,6 +171,9 @@ schema = 3 [mod."github.com/cosmos/rosetta-sdk-go"] version = "v0.10.0" hash = "sha256-WmLq9E9mYV+ms6Tdb43lCoAy6cowkDnK4bvX/ApDzLY=" + [mod."github.com/crate-crypto/go-kzg-4844"] + version = "v0.3.0" + hash = "sha256-caco5452YhMLNnzp/q/jagYookdAP03n2OQNpmdeiRg=" [mod."github.com/creachadair/taskgroup"] version = "v0.4.2" hash = "sha256-AjtQRoLKLSAbyKd8YlaXcYn0pek6oo5U3R28dvtKv14=" @@ -163,9 +183,9 @@ schema = 3 [mod."github.com/davecgh/go-spew"] version = "v1.1.2-0.20180830191138-d8f796af33cc" hash = "sha256-fV9oI51xjHdOmEx6+dlq7Ku2Ag+m/bmbzPo6A4Y74qc=" - [mod."github.com/deckarep/golang-set"] - version = "v1.8.0" - hash = "sha256-ELJKphksU9AOYwV3BtjvwPtUpbZvX9YMmo7eIiauQSc=" + [mod."github.com/deckarep/golang-set/v2"] + version = "v2.1.0" + hash = "sha256-Co6gfAcVn256IUEJNNPmVlx8LZRI4sT+KmqGs2uIQ90=" [mod."github.com/decred/dcrd/dcrec/secp256k1/v4"] version = "v4.1.0" hash = "sha256-cS4ZrKz1B4G7+vqih6B7C/WNkcMvRKmvR6S8aw7PotY=" @@ -182,23 +202,23 @@ schema = 3 version = "v0.0.0-20200201041132-a6ae2369ad13" hash = "sha256-aOMlPwFY36bLiiIx4HonbCYRAhagk5N6HAWN7Ygif+E=" [mod."github.com/dlclark/regexp2"] - version = "v1.4.1-0.20201116162257-a2a8dda75c91" - hash = "sha256-VNNMZIc7NkDg3DVLnqeJNM/KZqkkaZu2/HTLBL8X2xE=" + version = "v1.7.0" + hash = "sha256-Z/M62esiZ0fVwvueVQhwz18z0eS22LZ3DJ4O8FKp3AY=" [mod."github.com/dop251/goja"] - version = "v0.0.0-20220405120441-9037c2b61cbf" - hash = "sha256-ueVIwPRUwxzd9+NybuFv1Pvp5tbwl9gGEgXB6cwqzEc=" + version = "v0.0.0-20230605162241-28ee0ee714f3" + hash = "sha256-dm3HFq1Y+eRt3SGQKTQd5h8BQnPqf4l4/3KD1s95HKY=" [mod."github.com/dustin/go-humanize"] version = "v1.0.1" hash = "sha256-yuvxYYngpfVkUg9yAmG99IUVmADTQA0tMbBXe0Fq0Mc=" [mod."github.com/dvsekhvalnov/jose2go"] version = "v1.6.0" hash = "sha256-IXn2BuUp4fi/i2zf1tGGW1m9xoYh3VCksB6GJ5Sf06g=" - [mod."github.com/edsrzf/mmap-go"] - version = "v1.0.0" - hash = "sha256-k1DYvCqO3BKNcGEve/nMW0RxzMkK2tGfXbUbycqcVSo=" + [mod."github.com/ethereum/c-kzg-4844"] + version = "v0.3.1" + hash = "sha256-TBgi2xaeR9Aq9VkvrnNduBjqNZEZLu+4si6qg68Si/s=" [mod."github.com/ethereum/go-ethereum"] - version = "v1.10.26-spc" - hash = "sha256-Xzp0RdXEo7a1IaZ2feEEGQnSdtL2xjLm8Ldhb6+oiHU=" + version = "v1.12.3-0.20241015175757-891ef9f51367" + hash = "sha256-ELRj7x4a5gf9AuP2Bj9u31imD5jnffg4gENRYyVxzdg=" replaced = "github.com/zeta-chain/go-ethereum" [mod."github.com/felixge/httpsnoop"] version = "v1.0.4" @@ -234,11 +254,14 @@ schema = 3 version = "v2.1.3+incompatible" hash = "sha256-eXhXPPLnAy/rmt/zDgeqni2G3o58UtnHjR8vHLXvISI=" [mod."github.com/go-stack/stack"] - version = "v1.8.0" - hash = "sha256-26RlTEcAkbewMUtmirKrDGQ1WJlNousp69v7HMopYnI=" + version = "v1.8.1" + hash = "sha256-ixcJ2RrK1ZH3YWGQZF9QFBo02NOuLeSp9wJ7gniipgY=" [mod."github.com/godbus/dbus"] version = "v0.0.0-20190726142602-4481cbc300e2" hash = "sha256-R7Gb9+Zjy80FbQSDGketoVEqfdOQKuOVTfWRjQ5kxZY=" + [mod."github.com/gofrs/flock"] + version = "v0.8.1" + hash = "sha256-pm3JJjYx+DjthmmdnIZQ4PvvtUVlpUTGiucIvmNI0dY=" [mod."github.com/gogo/googleapis"] version = "v1.4.1" hash = "sha256-4KgwVRIA6GOV/Lkv11c/vj2RMlgu4ZMjwJGeyb2DZC4=" @@ -258,8 +281,8 @@ schema = 3 version = "v1.5.4" hash = "sha256-N3+Lv9lEZjrdOWdQhFj6Y3Iap4rVLEQeI8/eFFyAMZ0=" [mod."github.com/golang/snappy"] - version = "v0.0.4" - hash = "sha256-Umx+5xHAQCN/Gi4HbtMhnDCSPFAXSsjVbXd8n5LhjAA=" + version = "v0.0.5-0.20220116011046-fa5810519dcb" + hash = "sha256-4GVLPBwJIXYFJU+Uvoa/sb5VHea7yJhwE7feABa7ucs=" [mod."github.com/google/btree"] version = "v1.1.2" hash = "sha256-K7V2obq3pLM71Mg0vhhHtZ+gtaubwXPQx3xcIyZDCjM=" @@ -269,6 +292,9 @@ schema = 3 [mod."github.com/google/orderedcode"] version = "v0.0.1" hash = "sha256-KrExYovtUQrHGI1mPQf57jGw8soz7eWOC2xqEaV0uGk=" + [mod."github.com/google/pprof"] + version = "v0.0.0-20230207041349-798e818bf904" + hash = "sha256-uBlQacjKVBHhsxJBudNqtpey0XS9kLG0A53KDI3p77w=" [mod."github.com/google/s2a-go"] version = "v0.1.7" hash = "sha256-E+SX/3VmRI5qN7SbnRP4Tt+gQTq93pScpY9U2tTmIU0=" @@ -333,8 +359,8 @@ schema = 3 version = "v2.0.3" hash = "sha256-5VsJMQzJSNd4F7yAl3iF/q6JodWOlE4dUvTQ0UGPe+k=" [mod."github.com/holiman/uint256"] - version = "v1.2.1" - hash = "sha256-1N+MvvzTIegV1UPEGUVyxBZaxczId/Z/BUVcnx7ckHE=" + version = "v1.2.3" + hash = "sha256-OGf+jb7sr0p8vwqiqIBZkzZDZ2zBWf9WpRi4iouS4uE=" [mod."github.com/huandu/skiplist"] version = "v1.2.0" hash = "sha256-/r4QP1SldMlhpkr1ZQFHImSYaeMZEtqBW7R53yN+JtQ=" @@ -356,9 +382,6 @@ schema = 3 [mod."github.com/jmhodges/levigo"] version = "v1.0.0" hash = "sha256-xEd0mDBeq3eR/GYeXjoTVb2sPs8sTCosn5ayWkcgENI=" - [mod."github.com/keybase/go-keychain"] - version = "v0.0.0-20190712205309-48d3d31d256d" - hash = "sha256-bn04wkDnhQ0tb/YzmPf7MNJlApOl+z6+EAbUqH7Ti5Q=" [mod."github.com/klauspost/compress"] version = "v1.17.0" hash = "sha256-Ig86slHz98UbvvkCYK1QXReArAK74T/UNedVq/ZjH5k=" @@ -410,6 +433,9 @@ schema = 3 [mod."github.com/mitchellh/mapstructure"] version = "v1.5.0" hash = "sha256-ztVhGQXs67MF8UadVvG72G3ly0ypQW0IRDdOOkjYwoE=" + [mod."github.com/mmcloughlin/addchain"] + version = "v0.4.0" + hash = "sha256-zSWSSUElCVFH5mydFlF2mzn4Wsm1WHASRxQ5TKa+To8=" [mod."github.com/mtibben/percent"] version = "v0.2.1" hash = "sha256-Zj1lpCP6mKQ0UUTMs2By4LC414ou+iJzKkK+eBHfEcc=" @@ -446,18 +472,12 @@ schema = 3 [mod."github.com/prometheus/procfs"] version = "v0.9.0" hash = "sha256-imZN+1HRpMvgmrot2V+AK5ueYLmsp49vZfHtx2N6Wek=" - [mod."github.com/prometheus/tsdb"] - version = "v0.7.1" - hash = "sha256-BPz7YJbfMZgeR+u9YaeWeipVzHIS73EdgXD7VSJSLbA=" [mod."github.com/rakyll/statik"] version = "v0.1.7" hash = "sha256-/bfnXHBmN8vviPL7D85IzcEVXCaWyjbPPNyauzEcQ8Q=" [mod."github.com/rcrowley/go-metrics"] version = "v0.0.0-20201227073835-cf1acfcdf475" hash = "sha256-10ytHQ1SpMKYTiKuOPdEMuOVa8HVvv9ryYSIF9BHEBI=" - [mod."github.com/rjeczalik/notify"] - version = "v0.9.1" - hash = "sha256-YLGNrHHM+mN4ElW/XWuylOnFrA/VjSY+eBuC4LN//5c=" [mod."github.com/rogpeppe/go-internal"] version = "v1.11.0" hash = "sha256-BucSndJVnqX9e6p5PfA6Z8N2bGfIeRfxAxYLUDXTbIo=" @@ -498,8 +518,8 @@ schema = 3 version = "v1.18.2" hash = "sha256-MXYbK6w1LEaoZ2/L/STF3WU1tbK+7NwGVxUCLKPkwks=" [mod."github.com/status-im/keycard-go"] - version = "v0.0.0-20200402102358-957c09536969" - hash = "sha256-yddXXuu6mEFEO2/K6c1tWymeBKzOcvLQnNsFGRjtfXk=" + version = "v0.2.0" + hash = "sha256-UUiGmlgaIZDeMUJv3fdZBoQ9hJeSsg2ixRGmm6TgHug=" [mod."github.com/stretchr/objx"] version = "v0.5.2" hash = "sha256-VKYxrrFb1nkX6Wu3tE5DoP9+fCttwSl9pgLN6567nck=" @@ -509,6 +529,9 @@ schema = 3 [mod."github.com/subosito/gotenv"] version = "v1.6.0" hash = "sha256-LspbjTniiq2xAICSXmgqP7carwlNaLqnCTQfw2pa80A=" + [mod."github.com/supranational/blst"] + version = "v0.3.11" + hash = "sha256-r0zdZzVvPYaTOPzLF742uYYQ5tzSiv0xxB52etEkGAk=" [mod."github.com/syndtr/goleveldb"] version = "v1.0.1-0.20210819022825-2ae1ddf74ef7" hash = "sha256-36a4hgVQfwtS2zhylKpQuFhrjdc/Y8pF0dxc26jcZIU=" @@ -639,6 +662,9 @@ schema = 3 [mod."pgregory.net/rapid"] version = "v1.1.0" hash = "sha256-sVQY9EQ9Y5blYyVYfaOa+y12e+399OqdHiEY3BaDnqo=" + [mod."rsc.io/tmplfunc"] + version = "v0.0.3" + hash = "sha256-Kii+7DxaSzzn2NphVcEk0W42TXMBFINtm3+B2t7e0cc=" [mod."sigs.k8s.io/yaml"] version = "v1.4.0" hash = "sha256-Hd/M0vIfIVobDd87eb58p1HyVOjYWNlGq2bRXfmtVno=" diff --git a/rpc/backend/backend.go b/rpc/backend/backend.go index c664527e..5aa7a4d0 100644 --- a/rpc/backend/backend.go +++ b/rpc/backend/backend.go @@ -28,6 +28,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/common/math" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" @@ -110,7 +111,7 @@ type EVMBackend interface { CurrentHeader() *ethtypes.Header PendingTransactions() ([]*sdk.Tx, error) GetCoinbase() (sdk.AccAddress, error) - FeeHistory(blockCount rpc.DecimalOrHex, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*rpctypes.FeeHistoryResult, error) + FeeHistory(blockCount math.HexOrDecimal64, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*rpctypes.FeeHistoryResult, error) SuggestGasTipCap(baseFee *big.Int) (*big.Int, error) // Tx Info diff --git a/rpc/backend/chain_info.go b/rpc/backend/chain_info.go index ad7a2ea5..0cca9807 100644 --- a/rpc/backend/chain_info.go +++ b/rpc/backend/chain_info.go @@ -24,6 +24,7 @@ import ( tmrpctypes "github.com/cometbft/cometbft/rpc/core/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/common/math" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" @@ -161,7 +162,7 @@ func (b *Backend) GetCoinbase() (sdk.AccAddress, error) { // FeeHistory returns data relevant for fee estimation based on the specified range of blocks. func (b *Backend) FeeHistory( - userBlockCount rpc.DecimalOrHex, // number blocks to fetch, maximum is 100 + userBlockCount math.HexOrDecimal64, // number blocks to fetch, maximum is 100 lastBlock rpc.BlockNumber, // the block to start search , to oldest rewardPercentiles []float64, // percentiles to fetch reward ) (*rpctypes.FeeHistoryResult, error) { diff --git a/rpc/backend/chain_info_test.go b/rpc/backend/chain_info_test.go index 102f8c9a..98f19f3e 100644 --- a/rpc/backend/chain_info_test.go +++ b/rpc/backend/chain_info_test.go @@ -5,6 +5,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/common/math" ethrpc "github.com/ethereum/go-ethereum/rpc" rpc "github.com/zeta-chain/ethermint/rpc/types" "github.com/zeta-chain/ethermint/tests" @@ -322,7 +323,7 @@ func (suite *BackendTestSuite) TestFeeHistory() { testCases := []struct { name string registerMock func(validator sdk.AccAddress) - userBlockCount ethrpc.DecimalOrHex + userBlockCount math.HexOrDecimal64 latestBlock ethrpc.BlockNumber expFeeHistory *rpc.FeeHistoryResult validator sdk.AccAddress diff --git a/rpc/backend/sign_tx.go b/rpc/backend/sign_tx.go index b1ec28dd..112e8086 100644 --- a/rpc/backend/sign_tx.go +++ b/rpc/backend/sign_tx.go @@ -26,10 +26,10 @@ import ( "github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/signer/core/apitypes" + "github.com/zeta-chain/ethermint/types" evmtypes "github.com/zeta-chain/ethermint/x/evm/types" ) @@ -63,7 +63,7 @@ func (b *Backend) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, e return common.Hash{}, err } - signer := ethtypes.MakeSigner(b.ChainConfig(), new(big.Int).SetUint64(uint64(bn))) + signer := types.MakeSigner(b.ChainConfig(), new(big.Int).SetUint64(uint64(bn))) // Sign transaction if err := msg.Sign(signer, b.clientCtx.Keyring); err != nil { diff --git a/rpc/backend/utils.go b/rpc/backend/utils.go index 51b83bcd..d8cb9567 100644 --- a/rpc/backend/utils.go +++ b/rpc/backend/utils.go @@ -29,7 +29,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/consensus/misc" + "github.com/ethereum/go-ethereum/consensus/misc/eip1559" ethtypes "github.com/ethereum/go-ethereum/core/types" abci "github.com/cometbft/cometbft/abci/types" @@ -134,7 +134,7 @@ func (b *Backend) processBlock( targetOneFeeHistory.BaseFee = blockBaseFee cfg := b.ChainConfig() if cfg.IsLondon(big.NewInt(blockHeight + 1)) { - targetOneFeeHistory.NextBaseFee = misc.CalcBaseFee(cfg, b.CurrentHeader()) + targetOneFeeHistory.NextBaseFee = eip1559.CalcBaseFee(cfg, b.CurrentHeader()) } else { targetOneFeeHistory.NextBaseFee = new(big.Int) } diff --git a/rpc/namespaces/ethereum/debug/api.go b/rpc/namespaces/ethereum/debug/api.go index 5c91cc4c..6ca3874d 100644 --- a/rpc/namespaces/ethereum/debug/api.go +++ b/rpc/namespaces/ethereum/debug/api.go @@ -18,7 +18,6 @@ package debug import ( "bytes" "errors" - "fmt" "io" "os" "runtime" @@ -38,7 +37,6 @@ import ( "github.com/cometbft/cometbft/libs/log" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/consensus/ethash" "github.com/ethereum/go-ethereum/rlp" "github.com/zeta-chain/ethermint/rpc/backend" rpctypes "github.com/zeta-chain/ethermint/rpc/types" @@ -331,16 +329,6 @@ func (a *API) PrintBlock(number uint64) (string, error) { return spew.Sdump(block), nil } -// SeedHash retrieves the seed hash of a block. -func (a *API) SeedHash(number uint64) (string, error) { - _, err := a.backend.HeaderByNumber(rpctypes.BlockNumber(number)) - if err != nil { - return "", err - } - - return fmt.Sprintf("0x%x", ethash.SeedHash(number)), nil -} - // IntermediateRoots executes a block, and returns a list // of intermediate roots: the stateroot after each transaction. func (a *API) IntermediateRoots(hash common.Hash, _ *evmtypes.TraceConfig) ([]common.Hash, error) { diff --git a/rpc/namespaces/ethereum/eth/api.go b/rpc/namespaces/ethereum/eth/api.go index b2843424..588e0f25 100644 --- a/rpc/namespaces/ethereum/eth/api.go +++ b/rpc/namespaces/ethereum/eth/api.go @@ -26,6 +26,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/common/math" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/zeta-chain/ethermint/rpc/backend" @@ -92,7 +93,7 @@ type EthereumAPI interface { ProtocolVersion() hexutil.Uint GasPrice() (*hexutil.Big, error) EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *rpctypes.BlockNumber) (hexutil.Uint64, error) - FeeHistory(blockCount rpc.DecimalOrHex, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*rpctypes.FeeHistoryResult, error) + FeeHistory(blockCount math.HexOrDecimal64, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*rpctypes.FeeHistoryResult, error) MaxPriorityFeePerGas() (*hexutil.Big, error) ChainId() (*hexutil.Big, error) @@ -323,7 +324,7 @@ func (e *PublicAPI) EstimateGas(args evmtypes.TransactionArgs, blockNrOptional * return e.backend.EstimateGas(args, blockNrOptional) } -func (e *PublicAPI) FeeHistory(blockCount rpc.DecimalOrHex, +func (e *PublicAPI) FeeHistory(blockCount math.HexOrDecimal64, lastBlock rpc.BlockNumber, rewardPercentiles []float64, ) (*rpctypes.FeeHistoryResult, error) { diff --git a/tests/importer/chain_ctx.go b/tests/importer/chain_ctx.go index 23c43e7c..6b236ab0 100644 --- a/tests/importer/chain_ctx.go +++ b/tests/importer/chain_ctx.go @@ -102,7 +102,7 @@ func (cc *ChainContext) CalcDifficulty(_ ethcons.ChainHeaderReader, _ uint64, _ // TODO: Figure out if this needs to be hooked up to any part of the ABCI? func (cc *ChainContext) Finalize( _ ethcons.ChainHeaderReader, _ *ethtypes.Header, _ *ethstate.StateDB, - _ []*ethtypes.Transaction, _ []*ethtypes.Header) { + _ []*ethtypes.Transaction, _ []*ethtypes.Header, _ []*ethtypes.Withdrawal) { } // FinalizeAndAssemble runs any post-transaction state modifications (e.g. block @@ -117,6 +117,7 @@ func (cc *ChainContext) FinalizeAndAssemble(_ ethcons.ChainHeaderReader, _ []*ethtypes.Transaction, _ []*ethtypes.Header, _ []*ethtypes.Receipt, + _ []*ethtypes.Withdrawal, ) (*ethtypes.Block, error) { return nil, nil } @@ -148,7 +149,7 @@ func (cc *ChainContext) SealHash(_ *ethtypes.Header) common.Hash { // // TODO: Figure out if this needs to be hooked up to any part of the Cosmos SDK // handlers? -func (cc *ChainContext) VerifyHeader(_ ethcons.ChainHeaderReader, _ *ethtypes.Header, _ bool) error { +func (cc *ChainContext) VerifyHeader(_ ethcons.ChainHeaderReader, _ *ethtypes.Header) error { return nil } @@ -157,7 +158,7 @@ func (cc *ChainContext) VerifyHeader(_ ethcons.ChainHeaderReader, _ *ethtypes.He // // TODO: Figure out if this needs to be hooked up to any part of the Cosmos SDK // handlers? -func (cc *ChainContext) VerifyHeaders(_ ethcons.ChainHeaderReader, _ []*ethtypes.Header, _ []bool) (chan<- struct{}, <-chan error) { +func (cc *ChainContext) VerifyHeaders(_ ethcons.ChainHeaderReader, _ []*ethtypes.Header) (chan<- struct{}, <-chan error) { return nil, nil } diff --git a/tests/importer/chain_ctx_test.go b/tests/importer/chain_ctx_test.go index cbd6f53e..f865ff46 100644 --- a/tests/importer/chain_ctx_test.go +++ b/tests/importer/chain_ctx_test.go @@ -72,7 +72,7 @@ func TestChainContextCalcDifficulty(t *testing.T) { func TestChainContextFinalize(t *testing.T) { cc := NewChainContext() - cc.Finalize(nil, nil, nil, nil, nil) + cc.Finalize(nil, nil, nil, nil, nil, nil) } func TestChainContextPrepare(t *testing.T) { @@ -92,14 +92,14 @@ func TestChainContextSeal(t *testing.T) { func TestChainContextVerifyHeader(t *testing.T) { cc := NewChainContext() - err := cc.VerifyHeader(nil, nil, false) + err := cc.VerifyHeader(nil, nil) require.Nil(t, err) } func TestChainContextVerifyHeaders(t *testing.T) { cc := NewChainContext() - ch, err := cc.VerifyHeaders(nil, nil, []bool{false}) + ch, err := cc.VerifyHeaders(nil, nil) require.Nil(t, err) require.Nil(t, ch) } diff --git a/tests/importer/importer_test.go b/tests/importer/importer_test.go index 49cf6c61..6a7960c1 100644 --- a/tests/importer/importer_test.go +++ b/tests/importer/importer_test.go @@ -10,6 +10,7 @@ import ( "time" "github.com/zeta-chain/ethermint/app" + "github.com/zeta-chain/ethermint/types" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" @@ -28,7 +29,7 @@ import ( ethparams "github.com/ethereum/go-ethereum/params" ethrlp "github.com/ethereum/go-ethereum/rlp" - "github.com/cometbft/cometbft/abci/types" + abcitypes "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/crypto/tmhash" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmversion "github.com/cometbft/cometbft/proto/tendermint/version" @@ -135,7 +136,7 @@ func (suite *ImporterTestSuite) TestImportBlocks() { tmheader := suite.ctx.BlockHeader() // fix due to that begin block can't have height 0 tmheader.Height = int64(block.NumberU64()) + 1 - suite.app.BeginBlock(types.RequestBeginBlock{ + suite.app.BeginBlock(abcitypes.RequestBeginBlock{ Header: tmheader, }) ctx := suite.app.NewContext(false, tmheader) @@ -159,7 +160,7 @@ func (suite *ImporterTestSuite) TestImportBlocks() { accumulateRewards(chainConfig, vmdb, header, block.Uncles()) // simulate BaseApp EndBlocker commitment - endBR := types.RequestEndBlock{Height: tmheader.Height} + endBR := abcitypes.RequestEndBlock{Height: tmheader.Height} suite.app.EndBlocker(ctx, endBR) suite.app.Commit() @@ -229,7 +230,7 @@ func applyTransaction( gp *ethcore.GasPool, evmKeeper *evmkeeper.Keeper, vmdb *statedb.StateDB, header *ethtypes.Header, tx *ethtypes.Transaction, usedGas *uint64, cfg ethvm.Config, ) (*ethtypes.Receipt, uint64, error) { - msg, err := tx.AsMessage(ethtypes.MakeSigner(config, header.Number), sdk.ZeroInt().BigInt()) + msg, err := ethcore.TransactionToMessage(tx, types.MakeSigner(config, header.Number), sdk.ZeroInt().BigInt()) if err != nil { return nil, 0, err } @@ -259,7 +260,7 @@ func applyTransaction( receipt.GasUsed = execResult.UsedGas // if the transaction created a contract, store the creation address in the receipt. - if msg.To() == nil { + if msg.To == nil { receipt.ContractAddress = crypto.CreateAddress(vmenv.TxContext.Origin, tx.Nonce()) } diff --git a/types/signer.go b/types/signer.go new file mode 100644 index 00000000..6662b97b --- /dev/null +++ b/types/signer.go @@ -0,0 +1,27 @@ +package types + +import ( + "math/big" + + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/params" +) + +// MakeSigner returns a Signer based on the given chain config and block number. +// We use this instead of ethtypes.MakeSigner because cosmos always uses blockNumber for hard forks +func MakeSigner(config *params.ChainConfig, blockNumber *big.Int) ethtypes.Signer { + var signer ethtypes.Signer + switch { + case config.IsLondon(blockNumber): + signer = ethtypes.NewLondonSigner(config.ChainID) + case config.IsBerlin(blockNumber): + signer = ethtypes.NewEIP2930Signer(config.ChainID) + case config.IsEIP155(blockNumber): + signer = ethtypes.NewEIP155Signer(config.ChainID) + case config.IsHomestead(blockNumber): + signer = ethtypes.HomesteadSigner{} + default: + signer = ethtypes.FrontierSigner{} + } + return signer +} diff --git a/x/evm/handler_test.go b/x/evm/handler_test.go index 3bed582c..43243223 100644 --- a/x/evm/handler_test.go +++ b/x/evm/handler_test.go @@ -513,22 +513,22 @@ func (suite *EvmTestSuite) deployERC20Contract() common.Address { nonce := k.GetNonce(suite.ctx, suite.from) ctorArgs, err := types.ERC20Contract.ABI.Pack("", suite.from, big.NewInt(10000000000)) suite.Require().NoError(err) - msg := ethtypes.NewMessage( - suite.from, - nil, - nonce, - big.NewInt(0), - 2000000, - big.NewInt(1), - nil, - nil, - append(types.ERC20Contract.Bin, ctorArgs...), - nil, - true, - ) + msg := &core.Message{ + From: suite.from, + To: nil, + Nonce: nonce, + Value: big.NewInt(0), + GasLimit: 2000000, + GasPrice: big.NewInt(1), + GasFeeCap: nil, + GasTipCap: nil, + Data: append(types.ERC20Contract.Bin, ctorArgs...), + AccessList: nil, + SkipAccountChecks: true, + } rsp, err := k.ApplyMessage(suite.ctx, msg, nil, true) suite.Require().NoError(err) - suite.Require().False(rsp.Failed()) + suite.Require().False(rsp.Failed(), rsp.VmError) return crypto.CreateAddress(suite.from, nonce) } @@ -694,13 +694,13 @@ func (suite *EvmTestSuite) TestContractDeploymentRevert() { // DummyHook implements EvmHooks interface type DummyHook struct{} -func (dh *DummyHook) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error { +func (dh *DummyHook) PostTxProcessing(ctx sdk.Context, msg *core.Message, receipt *ethtypes.Receipt) error { return nil } // FailureHook implements EvmHooks interface type FailureHook struct{} -func (dh *FailureHook) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error { +func (dh *FailureHook) PostTxProcessing(ctx sdk.Context, msg *core.Message, receipt *ethtypes.Receipt) error { return errors.New("mock error") } diff --git a/x/evm/keeper/config.go b/x/evm/keeper/config.go index 7783dca6..58e4d010 100644 --- a/x/evm/keeper/config.go +++ b/x/evm/keeper/config.go @@ -59,19 +59,13 @@ func (k *Keeper) TxConfig(ctx sdk.Context, txHash common.Hash) statedb.TxConfig // VMConfig creates an EVM configuration from the debug setting and the extra EIPs enabled on the // module parameters. The config generated uses the default JumpTable from the EVM. -func (k Keeper) VMConfig(ctx sdk.Context, _ core.Message, cfg *statedb.EVMConfig, tracer vm.EVMLogger) vm.Config { +func (k Keeper) VMConfig(ctx sdk.Context, _ *core.Message, cfg *statedb.EVMConfig, tracer vm.EVMLogger) vm.Config { noBaseFee := true if types.IsLondon(cfg.ChainConfig, ctx.BlockHeight()) { noBaseFee = k.feeMarketKeeper.GetParams(ctx).NoBaseFee } - var debug bool - if _, ok := tracer.(types.NoOpTracer); !ok { - debug = true - } - return vm.Config{ - Debug: debug, Tracer: tracer, NoBaseFee: noBaseFee, ExtraEips: cfg.Params.EIPs(), diff --git a/x/evm/keeper/gas.go b/x/evm/keeper/gas.go index e09d3550..e4edc008 100644 --- a/x/evm/keeper/gas.go +++ b/x/evm/keeper/gas.go @@ -31,21 +31,21 @@ import ( ) // GetEthIntrinsicGas returns the intrinsic gas cost for the transaction -func (k *Keeper) GetEthIntrinsicGas(ctx sdk.Context, msg core.Message, cfg *params.ChainConfig, isContractCreation bool) (uint64, error) { +func (k *Keeper) GetEthIntrinsicGas(ctx sdk.Context, msg *core.Message, cfg *params.ChainConfig, isContractCreation bool) (uint64, error) { height := big.NewInt(ctx.BlockHeight()) homestead := cfg.IsHomestead(height) istanbul := cfg.IsIstanbul(height) - return core.IntrinsicGas(msg.Data(), msg.AccessList(), isContractCreation, homestead, istanbul) + return core.IntrinsicGas(msg.Data, msg.AccessList, isContractCreation, homestead, istanbul, false) } // RefundGas transfers the leftover gas to the sender of the message, caped to half of the total gas // consumed in the transaction. Additionally, the function sets the total gas consumed to the value // returned by the EVM execution, thus ignoring the previous intrinsic gas consumed during in the // AnteHandler. -func (k *Keeper) RefundGas(ctx sdk.Context, msg core.Message, leftoverGas uint64, denom string) error { +func (k *Keeper) RefundGas(ctx sdk.Context, msg *core.Message, leftoverGas uint64, denom string) error { // Return EVM tokens for remaining gas, exchanged at the original rate. - remaining := new(big.Int).Mul(new(big.Int).SetUint64(leftoverGas), msg.GasPrice()) + remaining := new(big.Int).Mul(new(big.Int).SetUint64(leftoverGas), msg.GasPrice) switch remaining.Sign() { case -1: @@ -57,7 +57,7 @@ func (k *Keeper) RefundGas(ctx sdk.Context, msg core.Message, leftoverGas uint64 // refund to sender from the fee collector module account, which is the escrow account in charge of collecting tx fees - err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, authtypes.FeeCollectorName, msg.From().Bytes(), refundedCoins) + err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, authtypes.FeeCollectorName, msg.From.Bytes(), refundedCoins) if err != nil { err = errorsmod.Wrapf(errortypes.ErrInsufficientFunds, "fee collector account failed to refund fees: %s", err.Error()) return errorsmod.Wrapf(err, "failed to refund %d leftover gas (%s)", leftoverGas, refundedCoins.String()) diff --git a/x/evm/keeper/grpc_query.go b/x/evm/keeper/grpc_query.go index c61b9684..38fc5231 100644 --- a/x/evm/keeper/grpc_query.go +++ b/x/evm/keeper/grpc_query.go @@ -23,6 +23,7 @@ import ( "math/big" "time" + cmath "github.com/ethereum/go-ethereum/common/math" "github.com/ethereum/go-ethereum/eth/tracers" "github.com/ethereum/go-ethereum/eth/tracers/logger" @@ -340,20 +341,7 @@ func (k Keeper) EstimateGas(c context.Context, req *types.EthCallRequest) (*type // Create a helper to check if a gas allowance results in an executable transaction executable := func(gas uint64) (vmError bool, rsp *types.MsgEthereumTxResponse, err error) { - // update the message with the new gas value - msg = ethtypes.NewMessage( - msg.From(), - msg.To(), - msg.Nonce(), - msg.Value(), - gas, - msg.GasPrice(), - msg.GasFeeCap(), - msg.GasTipCap(), - msg.Data(), - msg.AccessList(), - msg.IsFake(), - ) + msg.GasLimit = gas // pass false to not commit StateDB rsp, err = k.ApplyMessageWithConfig(ctx, msg, nil, false, cfg, txConfig) @@ -429,19 +417,16 @@ func (k Keeper) TraceTx(c context.Context, req *types.QueryTraceTxRequest) (*typ for i, tx := range req.Predecessors { ethTx := tx.AsTransaction() - var msg ethtypes.Message - // if tx is not unsigned, from field should be derived from signer, which can be done using AsMessage function + + var msg *core.Message if !isUnsigned(ethTx) { - signer := ethtypes.MakeSigner(cfg.ChainConfig, big.NewInt(ctx.BlockHeight())) - msg, err = ethTx.AsMessage(signer, cfg.BaseFee) + signer := ethermint.MakeSigner(cfg.ChainConfig, big.NewInt(ctx.BlockHeight())) + msg, err = core.TransactionToMessage(ethTx, signer, cfg.BaseFee) if err != nil { - continue + return nil, fmt.Errorf("transaction to message: %w", err) } } else { - msg = unsignedTxAsMessage(msg.From(), ethTx) - } - if err != nil { - continue + msg = unsignedTxAsMessage(common.HexToAddress(req.Msg.From), ethTx, cfg.BaseFee) } txConfig.TxHash = ethTx.Hash() txConfig.TxIndex = uint(i) @@ -571,16 +556,16 @@ func (k *Keeper) traceTx( err error timeout = defaultTraceTimeout ) - // if tx is not unsigned, from field should be derived from signer, which can be done using AsMessage function + signer := ethermint.MakeSigner(cfg.ChainConfig, big.NewInt(ctx.BlockHeight())) + var msg *core.Message if !isUnsigned(tx) { - signer := ethtypes.MakeSigner(cfg.ChainConfig, big.NewInt(ctx.BlockHeight())) - m, err := tx.AsMessage(signer, cfg.BaseFee) + msg, err = core.TransactionToMessage(tx, signer, cfg.BaseFee) if err != nil { - return nil, 0, status.Error(codes.Internal, err.Error()) + return nil, 0, status.Errorf(codes.InvalidArgument, "transaction to message: %v", err.Error()) } - from = common.HexToAddress(m.From().String()) + } else { + msg = unsignedTxAsMessage(from, tx, cfg.BaseFee) } - msg := unsignedTxAsMessage(from, tx) if traceConfig == nil { traceConfig = &types.TraceConfig{} @@ -609,7 +594,7 @@ func (k *Keeper) traceTx( } if traceConfig.Tracer != "" { - if tracer, err = tracers.New(traceConfig.Tracer, tCtx, tracerJSONConfig); err != nil { + if tracer, err = tracers.DefaultDirectory.New(traceConfig.Tracer, tCtx, tracerJSONConfig); err != nil { return nil, 0, status.Error(codes.Internal, err.Error()) } } @@ -672,18 +657,23 @@ func getChainID(ctx sdk.Context, chainID int64) (*big.Int, error) { } // same as ethTx.AsMessage, just from is provided instead of calculated from signature -func unsignedTxAsMessage(from common.Address, ethTx *ethtypes.Transaction) ethtypes.Message { - return ethtypes.NewMessage( - from, - ethTx.To(), - ethTx.Nonce(), - ethTx.Value(), - ethTx.Gas(), - new(big.Int).Set(ethTx.GasPrice()), - new(big.Int).Set(ethTx.GasFeeCap()), - new(big.Int).Set(ethTx.GasTipCap()), - ethTx.Data(), - ethTx.AccessList(), - false, // isFake - ) +func unsignedTxAsMessage(from common.Address, ethTx *ethtypes.Transaction, baseFee *big.Int) *core.Message { + gasPrice := ethTx.GasPrice() + if baseFee != nil { + gasPrice = cmath.BigMin(ethTx.GasPrice().Add(ethTx.GasTipCap(), baseFee), ethTx.GasFeeCap()) + } + + return &core.Message{ + From: from, + To: ethTx.To(), + Nonce: ethTx.Nonce(), + Value: ethTx.Value(), + GasLimit: ethTx.Gas(), + GasPrice: gasPrice, + GasFeeCap: new(big.Int).Set(ethTx.GasFeeCap()), + GasTipCap: new(big.Int).Set(ethTx.GasTipCap()), + Data: ethTx.Data(), + AccessList: ethTx.AccessList(), + SkipAccountChecks: false, + } } diff --git a/x/evm/keeper/grpc_query_test.go b/x/evm/keeper/grpc_query_test.go index 90f599df..151b020d 100644 --- a/x/evm/keeper/grpc_query_test.go +++ b/x/evm/keeper/grpc_query_test.go @@ -1095,7 +1095,7 @@ func (suite *KeeperTestSuite) TestTraceBlock() { } }, expPass: true, - traceResponse: "[{\"error\":\"rpc error: code = Internal desc = tracer not found\"}]", + traceResponse: "[{\"error\":\"rpc error: code = Internal desc = ReferenceError: invalid_tracer is not defined at \\u003ceval\\u003e:1:2(0)\"}]", }, { msg: "invalid chain id", @@ -1105,7 +1105,7 @@ func (suite *KeeperTestSuite) TestTraceBlock() { chainID = &tmp }, expPass: true, - traceResponse: "[{\"error\":\"rpc error: code = Internal desc = invalid chain id for signer\"}]", + traceResponse: "[{\"error\":\"rpc error: code = InvalidArgument desc = transaction to message: invalid chain id for signer: have 9000 want 1\"}]", }, } diff --git a/x/evm/keeper/hooks.go b/x/evm/keeper/hooks.go index 738dfce8..b9c4c703 100644 --- a/x/evm/keeper/hooks.go +++ b/x/evm/keeper/hooks.go @@ -34,7 +34,7 @@ func NewMultiEvmHooks(hooks ...types.EvmHooks) MultiEvmHooks { } // PostTxProcessing delegate the call to underlying hooks -func (mh MultiEvmHooks) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error { +func (mh MultiEvmHooks) PostTxProcessing(ctx sdk.Context, msg *core.Message, receipt *ethtypes.Receipt) error { for i := range mh { if err := mh[i].PostTxProcessing(ctx, msg, receipt); err != nil { return errorsmod.Wrapf(err, "EVM hook %T failed", mh[i]) diff --git a/x/evm/keeper/hooks_test.go b/x/evm/keeper/hooks_test.go index 6aaad58b..c4eecc9b 100644 --- a/x/evm/keeper/hooks_test.go +++ b/x/evm/keeper/hooks_test.go @@ -19,7 +19,7 @@ type LogRecordHook struct { Logs []*ethtypes.Log } -func (dh *LogRecordHook) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error { +func (dh *LogRecordHook) PostTxProcessing(ctx sdk.Context, msg *core.Message, receipt *ethtypes.Receipt) error { dh.Logs = receipt.Logs return nil } @@ -27,7 +27,7 @@ func (dh *LogRecordHook) PostTxProcessing(ctx sdk.Context, msg core.Message, rec // FailureHook always fail type FailureHook struct{} -func (dh FailureHook) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error { +func (dh FailureHook) PostTxProcessing(ctx sdk.Context, msg *core.Message, receipt *ethtypes.Receipt) error { return errors.New("post tx processing failed") } @@ -82,7 +82,7 @@ func (suite *KeeperTestSuite) TestEvmHooks() { TxHash: txHash, Logs: logs, } - result := k.PostTxProcessing(ctx, ethtypes.Message{}, receipt) + result := k.PostTxProcessing(ctx, &core.Message{}, receipt) tc.expFunc(hook, result) } diff --git a/x/evm/keeper/keeper.go b/x/evm/keeper/keeper.go index c2414f1f..4a3364da 100644 --- a/x/evm/keeper/keeper.go +++ b/x/evm/keeper/keeper.go @@ -277,7 +277,7 @@ func (k *Keeper) SetHooks(eh types.EvmHooks) *Keeper { } // PostTxProcessing delegate the call to the hooks. If no hook has been registered, this function returns with a `nil` error -func (k *Keeper) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error { +func (k *Keeper) PostTxProcessing(ctx sdk.Context, msg *core.Message, receipt *ethtypes.Receipt) error { if k.hooks == nil { return nil } @@ -285,7 +285,7 @@ func (k *Keeper) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *et } // Tracer return a default vm.Tracer based on current keeper state -func (k Keeper) Tracer(ctx sdk.Context, msg core.Message, ethCfg *params.ChainConfig) vm.EVMLogger { +func (k Keeper) Tracer(ctx sdk.Context, msg *core.Message, ethCfg *params.ChainConfig) vm.EVMLogger { return NewTracer(k.tracer, msg, ethCfg, ctx.BlockHeight()) } diff --git a/x/evm/keeper/state_transition.go b/x/evm/keeper/state_transition.go index 5e602a7d..125b880a 100644 --- a/x/evm/keeper/state_transition.go +++ b/x/evm/keeper/state_transition.go @@ -48,7 +48,7 @@ import ( func (k *Keeper) NewEVM( ctx sdk.Context, - msg core.Message, + msg *core.Message, cfg *statedb.EVMConfig, tracer vm.EVMLogger, stateDB vm.StateDB, @@ -60,7 +60,7 @@ func (k *Keeper) NewEVM( Coinbase: cfg.CoinBase, GasLimit: ethermint.BlockGasLimit(ctx), BlockNumber: big.NewInt(ctx.BlockHeight()), - Time: big.NewInt(ctx.BlockHeader().Time.Unix()), + Time: uint64(ctx.BlockHeader().Time.Unix()), Difficulty: big.NewInt(0), // unused. Only required in PoW context BaseFee: cfg.BaseFee, Random: nil, // not supported @@ -75,7 +75,7 @@ func (k *Keeper) NewEVM( // rules are used to determine the active precompiles for the current block height. // i.e rules.IsByzantium, rules.IsConstantinople, etc. - rules := cfg.ChainConfig.Rules(big.NewInt(ctx.BlockHeight()), cfg.ChainConfig.MergeNetsplitBlock != nil) + rules := cfg.ChainConfig.Rules(big.NewInt(ctx.BlockHeight()), cfg.ChainConfig.MergeNetsplitBlock != nil, 1) contracts := make(map[common.Address]vm.PrecompiledContract) active := make([]common.Address, 0) @@ -200,7 +200,7 @@ func (k *Keeper) ApplyTransaction(ctx sdk.Context, msgEth *types.MsgEthereumTx) txConfig := k.TxConfig(ctx, ethTx.Hash()) // get the signer according to the chain rules from the config and block height - signer := ethtypes.MakeSigner(cfg.ChainConfig, big.NewInt(ctx.BlockHeight())) + signer := ethermint.MakeSigner(cfg.ChainConfig, big.NewInt(ctx.BlockHeight())) msg, err := msgEth.AsMessage(signer, cfg.BaseFee) if err != nil { return nil, errorsmod.Wrap(err, "failed to return ethereum transaction as core message") @@ -242,8 +242,8 @@ func (k *Keeper) ApplyTransaction(ctx sdk.Context, msgEth *types.MsgEthereumTx) } var contractAddr common.Address - if msg.To() == nil { - contractAddr = crypto.CreateAddress(msg.From(), msg.Nonce()) + if msg.To == nil { + contractAddr = crypto.CreateAddress(msg.From, msg.Nonce) } receipt := ðtypes.Receipt{ @@ -279,8 +279,8 @@ func (k *Keeper) ApplyTransaction(ctx sdk.Context, msgEth *types.MsgEthereumTx) } // refund gas in order to match the Ethereum gas consumption instead of the default SDK one. - if err = k.RefundGas(ctx, msg, msg.Gas()-res.GasUsed, cfg.Params.EvmDenom); err != nil { - return nil, errorsmod.Wrapf(err, "failed to refund gas leftover gas to sender %s", msg.From()) + if err = k.RefundGas(ctx, msg, msg.GasLimit-res.GasUsed, cfg.Params.EvmDenom); err != nil { + return nil, errorsmod.Wrapf(err, "failed to refund gas leftover gas to sender %s", msg.From) } if len(receipt.Logs) > 0 { @@ -302,7 +302,7 @@ func (k *Keeper) ApplyTransaction(ctx sdk.Context, msgEth *types.MsgEthereumTx) } // ApplyMessage calls ApplyMessageWithConfig with an empty TxConfig. -func (k *Keeper) ApplyMessage(ctx sdk.Context, msg core.Message, tracer vm.EVMLogger, commit bool) (*types.MsgEthereumTxResponse, error) { +func (k *Keeper) ApplyMessage(ctx sdk.Context, msg *core.Message, tracer vm.EVMLogger, commit bool) (*types.MsgEthereumTxResponse, error) { cfg, err := k.EVMConfig(ctx, sdk.ConsAddress(ctx.BlockHeader().ProposerAddress), k.eip155ChainID) if err != nil { return nil, errorsmod.Wrap(err, "failed to load evm config") @@ -351,7 +351,7 @@ func (k *Keeper) ApplyMessage(ctx sdk.Context, msg core.Message, tracer vm.EVMLo // // If commit is true, the `StateDB` will be committed, otherwise discarded. func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, - msg core.Message, + msg *core.Message, tracer vm.EVMLogger, commit bool, cfg *statedb.EVMConfig, @@ -363,28 +363,27 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, ) // return error if contract creation or call are disabled through governance - if !cfg.Params.EnableCreate && msg.To() == nil { + if !cfg.Params.EnableCreate && msg.To == nil { return nil, errorsmod.Wrap(types.ErrCreateDisabled, "failed to create new contract") - } else if !cfg.Params.EnableCall && msg.To() != nil { + } else if !cfg.Params.EnableCall && msg.To != nil { return nil, errorsmod.Wrap(types.ErrCallDisabled, "failed to call contract") } stateDB := statedb.New(ctx, k, txConfig) evm := k.NewEVM(ctx, msg, cfg, tracer, stateDB) - leftoverGas := msg.Gas() + leftoverGas := msg.GasLimit // Allow the tracer captures the tx level events, mainly the gas consumption. - vmCfg := evm.Config - if vmCfg.Debug { - vmCfg.Tracer.CaptureTxStart(leftoverGas) + if tracer != nil { + tracer.CaptureTxStart(leftoverGas) defer func() { - vmCfg.Tracer.CaptureTxEnd(leftoverGas) + tracer.CaptureTxEnd(leftoverGas) }() } - sender := vm.AccountRef(msg.From()) - contractCreation := msg.To() == nil + sender := vm.AccountRef(msg.From) + contractCreation := msg.To == nil isLondon := cfg.ChainConfig.IsLondon(evm.Context.BlockNumber) intrinsicGas, err := k.GetEthIntrinsicGas(ctx, msg, cfg.ChainConfig, contractCreation) @@ -400,21 +399,18 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, } leftoverGas -= intrinsicGas - // access list preparation is moved from ante handler to here, because it's needed when `ApplyMessage` is called - // under contexts where ante handlers are not run, for example `eth_call` and `eth_estimateGas`. - if rules := cfg.ChainConfig.Rules(big.NewInt(ctx.BlockHeight()), cfg.ChainConfig.MergeNetsplitBlock != nil); rules.IsBerlin { - stateDB.PrepareAccessList(msg.From(), msg.To(), evm.ActivePrecompiles(rules), msg.AccessList()) - } + rules := cfg.ChainConfig.Rules(big.NewInt(ctx.BlockHeight()), cfg.ChainConfig.MergeNetsplitBlock != nil, uint64(ctx.BlockTime().Unix())) + stateDB.Prepare(rules, msg.From, cfg.CoinBase, msg.To, evm.ActivePrecompiles(rules), msg.AccessList) if contractCreation { // take over the nonce management from evm: // - reset sender's nonce to msg.Nonce() before calling evm. // - increase sender's nonce by one no matter the result. - stateDB.SetNonce(sender.Address(), msg.Nonce()) - ret, _, leftoverGas, vmErr = evm.Create(sender, msg.Data(), leftoverGas, msg.Value()) - stateDB.SetNonce(sender.Address(), msg.Nonce()+1) + stateDB.SetNonce(sender.Address(), msg.Nonce) + ret, _, leftoverGas, vmErr = evm.Create(sender, msg.Data, leftoverGas, msg.Value) + stateDB.SetNonce(sender.Address(), msg.Nonce+1) } else { - ret, leftoverGas, vmErr = evm.Call(sender, *msg.To(), msg.Data(), leftoverGas, msg.Value()) + ret, leftoverGas, vmErr = evm.Call(sender, *msg.To, msg.Data, leftoverGas, msg.Value) } refundQuotient := params.RefundQuotient @@ -425,11 +421,11 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, } // calculate gas refund - if msg.Gas() < leftoverGas { + if msg.GasLimit < leftoverGas { return nil, errorsmod.Wrap(types.ErrGasOverflow, "apply message") } // refund gas - temporaryGasUsed := msg.Gas() - leftoverGas + temporaryGasUsed := msg.GasLimit - leftoverGas leftoverGas += GasToRefund(stateDB.GetRefund(), temporaryGasUsed, refundQuotient) // EVM execution error needs to be available for the JSON-RPC client @@ -447,18 +443,18 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, // calculate a minimum amount of gas to be charged to sender if GasLimit // is considerably higher than GasUsed to stay more aligned with Tendermint gas mechanics - // for more info https://github.com/zeta-chain/ethermint/issues/1085 - gasLimit := sdk.NewDec(int64(msg.Gas())) + // for more info https://github.com/evmos/ethermint/issues/1085 + gasLimit := sdk.NewDec(int64(msg.GasLimit)) minGasMultiplier := k.GetMinGasMultiplier(ctx) minimumGasUsed := gasLimit.Mul(minGasMultiplier) - if msg.Gas() < leftoverGas { - return nil, errorsmod.Wrapf(types.ErrGasOverflow, "message gas limit < leftover gas (%d < %d)", msg.Gas(), leftoverGas) + if msg.GasLimit < leftoverGas { + return nil, errorsmod.Wrapf(types.ErrGasOverflow, "message gas limit < leftover gas (%d < %d)", msg.GasLimit, leftoverGas) } gasUsed := sdk.MaxDec(minimumGasUsed, sdk.NewDec(int64(temporaryGasUsed))).TruncateInt().Uint64() // reset leftoverGas, to be used by the tracer - leftoverGas = msg.Gas() - gasUsed + leftoverGas = msg.GasLimit - gasUsed return &types.MsgEthereumTxResponse{ GasUsed: gasUsed, diff --git a/x/evm/keeper/state_transition_benchmark_test.go b/x/evm/keeper/state_transition_benchmark_test.go index 99e7cfc5..cc251bbc 100644 --- a/x/evm/keeper/state_transition_benchmark_test.go +++ b/x/evm/keeper/state_transition_benchmark_test.go @@ -12,6 +12,7 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/params" "github.com/stretchr/testify/require" + "github.com/zeta-chain/ethermint/types" evmtypes "github.com/zeta-chain/ethermint/x/evm/types" ) @@ -143,8 +144,8 @@ func newNativeMessage( txType byte, data []byte, accessList ethtypes.AccessList, -) (core.Message, error) { - msgSigner := ethtypes.MakeSigner(cfg, big.NewInt(blockHeight)) +) (*core.Message, error) { + msgSigner := types.MakeSigner(cfg, big.NewInt(blockHeight)) msg, baseFee, err := newEthMsgTx(nonce, blockHeight, address, cfg, krSigner, ethSigner, txType, data, accessList) if err != nil { diff --git a/x/evm/keeper/state_transition_test.go b/x/evm/keeper/state_transition_test.go index 39eec1fd..61d6ed51 100644 --- a/x/evm/keeper/state_transition_test.go +++ b/x/evm/keeper/state_transition_test.go @@ -16,6 +16,7 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/params" "github.com/zeta-chain/ethermint/tests" + ethermint "github.com/zeta-chain/ethermint/types" "github.com/zeta-chain/ethermint/x/evm/keeper" "github.com/zeta-chain/ethermint/x/evm/statedb" "github.com/zeta-chain/ethermint/x/evm/types" @@ -349,7 +350,7 @@ func (suite *KeeperTestSuite) TestGasToRefund() { func (suite *KeeperTestSuite) TestRefundGas() { var ( - m core.Message + m *core.Message err error ) @@ -433,7 +434,7 @@ func (suite *KeeperTestSuite) TestRefundGas() { vmdb.AddRefund(params.TxGas) - if tc.leftoverGas > m.Gas() { + if tc.leftoverGas > m.GasLimit { return } @@ -441,7 +442,7 @@ func (suite *KeeperTestSuite) TestRefundGas() { tc.malleate() } - gasUsed := m.Gas() - tc.leftoverGas + gasUsed := m.GasLimit - tc.leftoverGas refund := keeper.GasToRefund(vmdb.GetRefund(), gasUsed, tc.refundQuotient) suite.Require().Equal(tc.expGasRefund, refund) @@ -534,7 +535,7 @@ func (suite *KeeperTestSuite) TestContractDeployment() { func (suite *KeeperTestSuite) TestApplyMessage() { expectedGasUsed := params.TxGas - var msg core.Message + var msg *core.Message proposerAddress := suite.ctx.BlockHeader().ProposerAddress config, err := suite.app.EvmKeeper.EVMConfig(suite.ctx, proposerAddress, big.NewInt(9000)) @@ -568,7 +569,7 @@ func (suite *KeeperTestSuite) TestApplyMessage() { func (suite *KeeperTestSuite) TestApplyMessageWithConfig() { var ( - msg core.Message + msg *core.Message err error expectedGasUsed uint64 config *statedb.EVMConfig @@ -662,13 +663,13 @@ func (suite *KeeperTestSuite) TestApplyMessageWithConfig() { } } -func (suite *KeeperTestSuite) createContractGethMsg(nonce uint64, signer ethtypes.Signer, cfg *params.ChainConfig, gasPrice *big.Int) (core.Message, error) { +func (suite *KeeperTestSuite) createContractGethMsg(nonce uint64, signer ethtypes.Signer, cfg *params.ChainConfig, gasPrice *big.Int) (*core.Message, error) { ethMsg, err := suite.createContractMsgTx(nonce, signer, cfg, gasPrice) if err != nil { return nil, err } - msgSigner := ethtypes.MakeSigner(cfg, big.NewInt(suite.ctx.BlockHeight())) + msgSigner := ethermint.MakeSigner(cfg, big.NewInt(suite.ctx.BlockHeight())) return ethMsg.AsMessage(msgSigner, nil) } diff --git a/x/evm/keeper/statedb_benchmark_test.go b/x/evm/keeper/statedb_benchmark_test.go index 72219c78..3f6d1003 100644 --- a/x/evm/keeper/statedb_benchmark_test.go +++ b/x/evm/keeper/statedb_benchmark_test.go @@ -188,6 +188,6 @@ func BenchmarkSuicide(b *testing.B) { vmdb.CreateAccount(addr) b.StartTimer() - vmdb.Suicide(addr) + vmdb.SelfDestruct(addr) } } diff --git a/x/evm/keeper/statedb_test.go b/x/evm/keeper/statedb_test.go index 4e1c2439..c1ffd2f9 100644 --- a/x/evm/keeper/statedb_test.go +++ b/x/evm/keeper/statedb_test.go @@ -468,10 +468,8 @@ func (suite *KeeperTestSuite) TestSuicide() { } // Call Suicide - suite.Require().Equal(true, db.Suicide(suite.address)) - - // Check suicided is marked - suite.Require().Equal(true, db.HasSuicided(suite.address)) + db.SelfDestruct(suite.address) + suite.Require().Equal(true, db.HasSelfDestructed(suite.address)) // Commit state suite.Require().NoError(db.Commit()) @@ -492,7 +490,7 @@ func (suite *KeeperTestSuite) TestSuicide() { // Check code is still present in addr2 and suicided is false suite.Require().NotNil(db.GetCode(addr2)) - suite.Require().Equal(false, db.HasSuicided(addr2)) + suite.Require().Equal(false, db.HasSelfDestructed(addr2)) } func (suite *KeeperTestSuite) TestExist() { @@ -504,7 +502,7 @@ func (suite *KeeperTestSuite) TestExist() { }{ {"success, account exists", suite.address, func(vm.StateDB) {}, true}, {"success, has suicided", suite.address, func(vmdb vm.StateDB) { - vmdb.Suicide(suite.address) + vmdb.SelfDestruct(suite.address) }, true}, {"success, account doesn't exist", tests.GenerateAddress(), func(vm.StateDB) {}, false}, } diff --git a/x/evm/keeper/tracer.go b/x/evm/keeper/tracer.go index 35e77c8f..216fff02 100644 --- a/x/evm/keeper/tracer.go +++ b/x/evm/keeper/tracer.go @@ -28,7 +28,7 @@ import ( // NewTracer creates a new Logger tracer to collect execution traces from an // EVM transaction. -func NewTracer(tracer string, msg core.Message, cfg *params.ChainConfig, height int64) vm.EVMLogger { +func NewTracer(tracer string, msg *core.Message, cfg *params.ChainConfig, height int64) vm.EVMLogger { // TODO: enable additional log configuration logCfg := &logger.Config{ Debug: true, @@ -36,8 +36,8 @@ func NewTracer(tracer string, msg core.Message, cfg *params.ChainConfig, height switch tracer { case types.TracerAccessList: - preCompiles := vm.DefaultActivePrecompiles(cfg.Rules(big.NewInt(height), cfg.MergeNetsplitBlock != nil)) - return logger.NewAccessListTracer(msg.AccessList(), msg.From(), *msg.To(), preCompiles) + preCompiles := vm.DefaultActivePrecompiles(cfg.Rules(big.NewInt(height), cfg.MergeNetsplitBlock != nil, 1)) + return logger.NewAccessListTracer(msg.AccessList, msg.From, *msg.To, preCompiles) case types.TracerJSON: return logger.NewJSONLogger(logCfg, os.Stderr) case types.TracerMarkdown: diff --git a/x/evm/keeper/utils.go b/x/evm/keeper/utils.go index 604d6f60..61d68ecf 100644 --- a/x/evm/keeper/utils.go +++ b/x/evm/keeper/utils.go @@ -94,7 +94,7 @@ func VerifyFee( accessList = txData.GetAccessList() } - intrinsicGas, err := core.IntrinsicGas(txData.GetData(), accessList, isContractCreation, homestead, istanbul) + intrinsicGas, err := core.IntrinsicGas(txData.GetData(), accessList, isContractCreation, homestead, istanbul, false) if err != nil { return nil, errorsmod.Wrapf( err, diff --git a/x/evm/statedb/journal.go b/x/evm/statedb/journal.go index 49f61c00..31383bf3 100644 --- a/x/evm/statedb/journal.go +++ b/x/evm/statedb/journal.go @@ -139,6 +139,12 @@ type ( address *common.Address slot *common.Hash } + + // Changes to transient storage + transientStorageChange struct { + account *common.Address + key, prevalue common.Hash + } ) func (ch createObjectChange) Revert(s *StateDB) { @@ -209,6 +215,22 @@ func (ch refundChange) Dirtied() *common.Address { return nil } +func (ch transientStorageChange) Revert(s *StateDB) { + s.setTransientState(*ch.account, ch.key, ch.prevalue) +} + +func (ch transientStorageChange) Dirtied() *common.Address { + return nil +} + +func (ch transientStorageChange) copy() JournalEntry { + return transientStorageChange{ + account: ch.account, + key: ch.key, + prevalue: ch.prevalue, + } +} + func (ch addLogChange) Revert(s *StateDB) { s.logs = s.logs[:len(s.logs)-1] } diff --git a/x/evm/statedb/state_object.go b/x/evm/statedb/state_object.go index 415ee0d2..dba7aa02 100644 --- a/x/evm/statedb/state_object.go +++ b/x/evm/statedb/state_object.go @@ -17,6 +17,7 @@ package statedb import ( "bytes" + "maps" "math/big" "sort" @@ -50,6 +51,10 @@ func (acct Account) IsContract() bool { // Storage represents in-memory cache/buffer of contract storage. type Storage map[common.Hash]common.Hash +func (s Storage) Copy() Storage { + return maps.Clone(s) +} + // SortedKeys sort the keys for deterministic iteration func (s Storage) SortedKeys() []common.Hash { keys := make([]common.Hash, len(s)) diff --git a/x/evm/statedb/statedb.go b/x/evm/statedb/statedb.go index 111c0f11..53ef7f4d 100644 --- a/x/evm/statedb/statedb.go +++ b/x/evm/statedb/statedb.go @@ -27,6 +27,7 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/params" "github.com/zeta-chain/ethermint/store/cachemulti" evmtypes "github.com/zeta-chain/ethermint/x/evm/types" ) @@ -94,13 +95,14 @@ func New(ctx sdk.Context, keeper Keeper, txConfig TxConfig) *StateDB { return NewWithParams(ctx, keeper, txConfig, keeper.GetParams(ctx)) } -//nolint +// nolint func NewWithParams(ctx sdk.Context, keeper Keeper, txConfig TxConfig, params evmtypes.Params) *StateDB { db := &StateDB{ - keeper: keeper, - stateObjects: make(map[common.Address]*stateObject), - journal: newJournal(), - accessList: newAccessList(), + keeper: keeper, + stateObjects: make(map[common.Address]*stateObject), + journal: newJournal(), + accessList: newAccessList(), + transientStorage: newTransientStorage(), txConfig: txConfig, @@ -242,7 +244,7 @@ func (s *StateDB) GetRefund() uint64 { } // HasSuicided returns if the contract is suicided in current transaction. -func (s *StateDB) HasSuicided(addr common.Address) bool { +func (s *StateDB) HasSelfDestructed(addr common.Address) bool { stateObject := s.getStateObject(addr) if stateObject != nil { return stateObject.suicided @@ -417,15 +419,42 @@ func (s *StateDB) SetState(addr common.Address, key, value common.Hash) { } } -// Suicide marks the given account as suicided. +// SetTransientState sets transient storage for a given account. It +// adds the change to the journal so that it can be rolled back +// to its previous value if there is a revert. +func (s *StateDB) SetTransientState(addr common.Address, key, value common.Hash) { + prev := s.GetTransientState(addr, key) + if prev == value { + return + } + s.journal.append(transientStorageChange{ + account: &addr, + key: key, + prevalue: prev, + }) + s.setTransientState(addr, key, value) +} + +// setTransientState is a lower level setter for transient storage. It +// is called during a revert to prevent modifications to the journal. +func (s *StateDB) setTransientState(addr common.Address, key, value common.Hash) { + s.transientStorage.Set(addr, key, value) +} + +// GetTransientState gets transient storage for a given account. +func (s *StateDB) GetTransientState(addr common.Address, key common.Hash) common.Hash { + return s.transientStorage.Get(addr, key) +} + +// SelfDestruct marks the given account as suicided. // This clears the account balance. // // The account's state object is still available until the state is committed, -// getStateObject will return a non-nil account after Suicide. -func (s *StateDB) Suicide(addr common.Address) bool { +// getStateObject will return a non-nil account after SelfDestruct. +func (s *StateDB) SelfDestruct(addr common.Address) { stateObject := s.getStateObject(addr) if stateObject == nil { - return false + return } s.journal.append(suicideChange{ account: &addr, @@ -434,8 +463,34 @@ func (s *StateDB) Suicide(addr common.Address) bool { }) stateObject.markSuicided() stateObject.account.Balance = new(big.Int) +} + +func (s *StateDB) Selfdestruct6780(addr common.Address) { + s.SelfDestruct(addr) +} - return true +func (s *StateDB) Prepare(rules params.Rules, sender, coinbase common.Address, dest *common.Address, precompiles []common.Address, txAccesses ethtypes.AccessList) { + if rules.IsBerlin { + // Clear out any leftover from previous executions + s.accessList = newAccessList() + + s.AddAddressToAccessList(sender) + if dest != nil { + s.AddAddressToAccessList(*dest) + // If it's a create-tx, the destination will be added inside evm.create + } + for _, addr := range precompiles { + s.AddAddressToAccessList(addr) + } + for _, el := range txAccesses { + s.AddAddressToAccessList(el.Address) + for _, key := range el.StorageKeys { + s.AddSlotToAccessList(el.Address, key) + } + } + } + // Reset transient storage at the beginning of transaction execution + s.transientStorage = newTransientStorage() } // PrepareAccessList handles the preparatory steps for executing a state transition with diff --git a/x/evm/statedb/statedb_test.go b/x/evm/statedb/statedb_test.go index 89c0925b..9b585baf 100644 --- a/x/evm/statedb/statedb_test.go +++ b/x/evm/statedb/statedb_test.go @@ -85,8 +85,8 @@ func (suite *StateDBTestSuite) TestAccount() { }}, {"suicide", func(db *statedb.StateDB, cms sdk.MultiStore) { // non-exist account. - suite.Require().False(db.Suicide(address)) - suite.Require().False(db.HasSuicided(address)) + db.HasSelfDestructed(address) + suite.Require().False(db.HasSelfDestructed(address)) // create a contract account db.CreateAccount(address) @@ -102,12 +102,13 @@ func (suite *StateDBTestSuite) TestAccount() { suite.Require().NotEmpty(keeper.GetCode(ctx, codeHash)) // suicide - db = statedb.New(ctx, keeper, txConfig) - suite.Require().False(db.HasSuicided(address)) - suite.Require().True(db.Suicide(address)) + db = statedb.New(ctx, db.Keeper(), emptyTxConfig) + suite.Require().False(db.HasSelfDestructed(address)) + db.SelfDestruct(address) + suite.Require().True(db.HasSelfDestructed(address)) // check dirty state - suite.Require().True(db.HasSuicided(address)) + suite.Require().True(db.HasSelfDestructed(address)) // balance is cleared suite.Require().Equal(big.NewInt(0), db.GetBalance(address)) // but code and state are still accessible in dirty state @@ -161,15 +162,20 @@ func (suite *StateDBTestSuite) TestDBError() { name string malleate func(vm.StateDB) }{ - {"negative balance", func(db vm.StateDB) { - db.SubBalance(address, big.NewInt(10)) + {"set account", func(db vm.StateDB) { + db.SetNonce(errAddress, 1) + }}, + {"delete account", func(db vm.StateDB) { + db.SetNonce(errAddress, 1) + db.SelfDestruct(errAddress) + suite.Require().True(db.HasSelfDestructed(errAddress)) }}, } for _, tc := range testCases { - _, ctx, keeper := setupTestEnv(suite.T()) - db := statedb.New(ctx, keeper, emptyTxConfig) + _, ctx, _ := setupTestEnv(suite.T()) + db := statedb.New(ctx, NewMockKeeper(), emptyTxConfig) tc.malleate(db) - suite.Require().Error(db.Commit()) + suite.Require().Error(db.Commit(), "name: %s", tc.name) } } @@ -347,7 +353,8 @@ func (suite *StateDBTestSuite) TestRevertSnapshot() { {"suicide", func(db vm.StateDB) { db.SetState(address, v1, v2) db.SetCode(address, []byte("hello world")) - suite.Require().True(db.Suicide(address)) + db.SelfDestruct(address) + suite.Require().True(db.HasSelfDestructed(address)) }}, {"add log", func(db vm.StateDB) { db.AddLog(ðtypes.Log{ @@ -473,27 +480,6 @@ func (suite *StateDBTestSuite) TestAccessList() { suite.Require().True(addrPresent) suite.Require().True(slotPresent) }}, - {"prepare access list", func(db vm.StateDB) { - al := ethtypes.AccessList{{ - Address: address3, - StorageKeys: []common.Hash{value1}, - }} - db.PrepareAccessList(address, &address2, vm.PrecompiledAddressesBerlin, al) - - // check sender and dst - suite.Require().True(db.AddressInAccessList(address)) - suite.Require().True(db.AddressInAccessList(address2)) - // check precompiles - suite.Require().True(db.AddressInAccessList(common.BytesToAddress([]byte{1}))) - // check AccessList - suite.Require().True(db.AddressInAccessList(address3)) - addrPresent, slotPresent := db.SlotInAccessList(address3, value1) - suite.Require().True(addrPresent) - suite.Require().True(slotPresent) - addrPresent, slotPresent = db.SlotInAccessList(address3, value2) - suite.Require().True(addrPresent) - suite.Require().False(slotPresent) - }}, } for _, tc := range testCases { @@ -755,7 +741,7 @@ func (suite *StateDBTestSuite) TestNativeAction() { suite.Require().Equal(sdk.Events{{Type: "success1"}, {Type: "success3"}}, ctx.EventManager().Events()) } -func CollectContractStorage(db vm.StateDB) statedb.Storage { +func CollectContractStorage(db *statedb.StateDB) statedb.Storage { storage := make(statedb.Storage) db.ForEachStorage(address, func(k, v common.Hash) bool { storage[k] = v diff --git a/x/evm/statedb/transient_storage.go b/x/evm/statedb/transient_storage.go index ab2ba9de..ccf1cc3c 100644 --- a/x/evm/statedb/transient_storage.go +++ b/x/evm/statedb/transient_storage.go @@ -21,17 +21,14 @@ import ( ) // transientStorage is a representation of EIP-1153 "Transient Storage". -//nolint type transientStorage map[common.Address]Storage // newTransientStorage creates a new instance of a transientStorage. -//nolint func newTransientStorage() transientStorage { return make(transientStorage) } // Set sets the transient-storage `value` for `key` at the given `addr`. -//nolint func (t transientStorage) Set(addr common.Address, key, value common.Hash) { if _, ok := t[addr]; !ok { t[addr] = make(Storage) @@ -40,7 +37,6 @@ func (t transientStorage) Set(addr common.Address, key, value common.Hash) { } // Get gets the transient storage for `key` at the given `addr`. -//nolint func (t transientStorage) Get(addr common.Address, key common.Hash) common.Hash { val, ok := t[addr] if !ok { @@ -50,14 +46,10 @@ func (t transientStorage) Get(addr common.Address, key common.Hash) common.Hash } // Copy does a deep copy of the transientStorage -//nolint func (t transientStorage) Copy() transientStorage { storage := make(transientStorage) for key, value := range t { - storage[key] = make(Storage) - for k, v := range value { - storage[key][k] = v - } + storage[key] = value.Copy() } return storage } diff --git a/x/evm/types/chain_config.go b/x/evm/types/chain_config.go index 1d31c35e..3d82f1da 100644 --- a/x/evm/types/chain_config.go +++ b/x/evm/types/chain_config.go @@ -37,7 +37,6 @@ func (cc ChainConfig) EthereumConfig(chainID *big.Int) *params.ChainConfig { DAOForkBlock: getBlockValue(cc.DAOForkBlock), DAOForkSupport: cc.DAOForkSupport, EIP150Block: getBlockValue(cc.EIP150Block), - EIP150Hash: common.HexToHash(cc.EIP150Hash), EIP155Block: getBlockValue(cc.EIP155Block), EIP158Block: getBlockValue(cc.EIP158Block), ByzantiumBlock: getBlockValue(cc.ByzantiumBlock), @@ -50,8 +49,6 @@ func (cc ChainConfig) EthereumConfig(chainID *big.Int) *params.ChainConfig { ArrowGlacierBlock: getBlockValue(cc.ArrowGlacierBlock), GrayGlacierBlock: getBlockValue(cc.GrayGlacierBlock), MergeNetsplitBlock: getBlockValue(cc.MergeNetsplitBlock), - ShanghaiBlock: getBlockValue(cc.ShanghaiBlock), - CancunBlock: getBlockValue(cc.CancunBlock), TerminalTotalDifficulty: nil, Ethash: nil, Clique: nil, diff --git a/x/evm/types/interfaces.go b/x/evm/types/interfaces.go index 2e49c2b7..a45c1d85 100644 --- a/x/evm/types/interfaces.go +++ b/x/evm/types/interfaces.go @@ -72,7 +72,7 @@ type FeeMarketKeeper interface { // EvmHooks event hooks for evm tx processing type EvmHooks interface { // Must be called after tx is processed successfully, if return an error, the whole transaction is reverted. - PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error + PostTxProcessing(ctx sdk.Context, msg *core.Message, receipt *ethtypes.Receipt) error } type ( diff --git a/x/evm/types/msg.go b/x/evm/types/msg.go index 0f24f69e..dac225af 100644 --- a/x/evm/types/msg.go +++ b/x/evm/types/msg.go @@ -325,7 +325,7 @@ func (msg MsgEthereumTx) AsTransaction() *ethtypes.Transaction { } // AsMessage creates an Ethereum core.Message from the msg fields -func (msg MsgEthereumTx) AsMessage(signer ethtypes.Signer, baseFee *big.Int) (core.Message, error) { +func (msg MsgEthereumTx) AsMessage(signer ethtypes.Signer, baseFee *big.Int) (*core.Message, error) { txData, err := UnpackTxData(msg.Data) if err != nil { return nil, err @@ -349,17 +349,19 @@ func (msg MsgEthereumTx) AsMessage(signer ethtypes.Signer, baseFee *big.Int) (co return nil, err } } - ethMsg := ethtypes.NewMessage( - from, - txData.GetTo(), - txData.GetNonce(), - txData.GetValue(), - txData.GetGas(), - gasPrice, gasFeeCap, gasTipCap, - txData.GetData(), - txData.GetAccessList(), - false, - ) + ethMsg := &core.Message{ + From: from, + To: txData.GetTo(), + Nonce: txData.GetNonce(), + Value: txData.GetValue(), + GasLimit: txData.GetGas(), + GasPrice: gasPrice, + GasFeeCap: gasFeeCap, + GasTipCap: gasTipCap, + Data: txData.GetData(), + AccessList: txData.GetAccessList(), + SkipAccountChecks: false, + } return ethMsg, nil } diff --git a/x/evm/types/tracer.go b/x/evm/types/tracer.go index 7461ea21..737e41e9 100644 --- a/x/evm/types/tracer.go +++ b/x/evm/types/tracer.go @@ -17,7 +17,6 @@ package types import ( "math/big" - "time" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/vm" @@ -65,7 +64,7 @@ func (dt NoOpTracer) CaptureFault(_ uint64, _ vm.OpCode, _, _ uint64, _ *vm.Scop } // CaptureEnd implements vm.Tracer interface -func (dt NoOpTracer) CaptureEnd(_ []byte, _ uint64, _ time.Duration, _ error) {} +func (dt NoOpTracer) CaptureEnd(_ []byte, _ uint64, _ error) {} // CaptureEnter implements vm.Tracer interface func (dt NoOpTracer) CaptureEnter(_ vm.OpCode, _ common.Address, _ common.Address, _ []byte, _ uint64, _ *big.Int) { diff --git a/x/evm/types/tx_args.go b/x/evm/types/tx_args.go index 824d7172..559b549b 100644 --- a/x/evm/types/tx_args.go +++ b/x/evm/types/tx_args.go @@ -25,6 +25,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/math" + "github.com/ethereum/go-ethereum/core" ethtypes "github.com/ethereum/go-ethereum/core/types" ) @@ -169,10 +170,10 @@ func (args *TransactionArgs) ToTransaction() *MsgEthereumTx { // ToMessage converts the arguments to the Message type used by the core evm. // This assumes that setTxDefaults has been called. -func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int) (ethtypes.Message, error) { +func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int) (*core.Message, error) { // Reject invalid combinations of pre- and post-1559 fee styles if args.GasPrice != nil && (args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil) { - return ethtypes.Message{}, errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified") + return nil, errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified") } // Set sender address or use zero address if none specified. @@ -239,8 +240,19 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int) (e nonce = uint64(*args.Nonce) } - msg := ethtypes.NewMessage(addr, args.To, nonce, value, gas, gasPrice, gasFeeCap, gasTipCap, data, accessList, true) - return msg, nil + return &core.Message{ + From: addr, + To: args.To, + Nonce: nonce, + Value: value, + GasLimit: gas, + GasPrice: gasPrice, + GasFeeCap: gasFeeCap, + GasTipCap: gasTipCap, + Data: data, + AccessList: accessList, + SkipAccountChecks: true, + }, nil } // GetFrom retrieves the transaction sender address. diff --git a/x/feemarket/migrations/v4/types/params.go b/x/feemarket/migrations/v4/types/params.go index ca03f808..fc6b876a 100644 --- a/x/feemarket/migrations/v4/types/params.go +++ b/x/feemarket/migrations/v4/types/params.go @@ -77,8 +77,8 @@ func NewParams( func DefaultParams() Params { return Params{ NoBaseFee: DefaultNoBaseFee, - BaseFeeChangeDenominator: params.BaseFeeChangeDenominator, - ElasticityMultiplier: params.ElasticityMultiplier, + BaseFeeChangeDenominator: params.DefaultBaseFeeChangeDenominator, + ElasticityMultiplier: params.DefaultElasticityMultiplier, BaseFee: sdkmath.NewIntFromUint64(params.InitialBaseFee), EnableHeight: DefaultEnableHeight, MinGasPrice: DefaultMinGasPrice, diff --git a/x/feemarket/types/params.go b/x/feemarket/types/params.go index eba96e45..4965d871 100644 --- a/x/feemarket/types/params.go +++ b/x/feemarket/types/params.go @@ -90,8 +90,8 @@ func NewParams( func DefaultParams() Params { return Params{ NoBaseFee: DefaultNoBaseFee, - BaseFeeChangeDenominator: params.BaseFeeChangeDenominator, - ElasticityMultiplier: params.ElasticityMultiplier, + BaseFeeChangeDenominator: params.DefaultBaseFeeChangeDenominator, + ElasticityMultiplier: params.DefaultElasticityMultiplier, BaseFee: sdkmath.NewIntFromUint64(params.InitialBaseFee), EnableHeight: DefaultEnableHeight, MinGasPrice: DefaultMinGasPrice, From f0da02ffb57a644d7078db5e903500a1bf739c97 Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Fri, 18 Oct 2024 15:02:37 -0700 Subject: [PATCH 02/12] upgrade to go-ethereum 1.13 fix CanTranfer args --- app/ante/eth.go | 11 ++- app/ante/eth_test.go | 17 ++-- app/ante/sigs_test.go | 3 +- go.mod | 42 +++++----- go.sum | 109 ++++++++++++------------- gomod2nix.toml | 90 ++++++++++---------- server/json_rpc.go | 55 ++++++++++--- tests/importer/importer_test.go | 21 ++--- x/evm/genesis_test.go | 5 +- x/evm/keeper/keeper.go | 5 +- x/evm/keeper/keeper_test.go | 3 +- x/evm/keeper/state_transition.go | 44 ++++------ x/evm/keeper/statedb.go | 5 +- x/evm/keeper/statedb_benchmark_test.go | 6 +- x/evm/keeper/statedb_test.go | 44 ++++------ x/evm/keeper/tracer.go | 2 +- x/evm/keeper/utils_test.go | 22 +++-- x/evm/statedb/journal.go | 6 +- x/evm/statedb/state_object.go | 24 +++--- x/evm/statedb/statedb.go | 14 ++-- x/evm/statedb/statedb_test.go | 41 +++++----- 21 files changed, 304 insertions(+), 265 deletions(-) diff --git a/app/ante/eth.go b/app/ante/eth.go index 9806ae32..77594254 100644 --- a/app/ante/eth.go +++ b/app/ante/eth.go @@ -16,6 +16,7 @@ package ante import ( + "fmt" "math" "math/big" @@ -24,6 +25,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" errortypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/holiman/uint256" ethermint "github.com/zeta-chain/ethermint/types" "github.com/zeta-chain/ethermint/x/evm/keeper" @@ -93,7 +95,7 @@ func (avd EthAccountVerificationDecorator) AnteHandle( "the sender is not EOA: address %s, codeHash <%s>", fromAddr, acct.CodeHash) } - if err := keeper.CheckSenderBalance(sdkmath.NewIntFromBigInt(acct.Balance), txData); err != nil { + if err := keeper.CheckSenderBalance(sdkmath.NewIntFromBigInt(acct.Balance.ToBig()), txData); err != nil { return ctx, errorsmod.Wrap(err, "failed to check sender balance") } } @@ -302,9 +304,14 @@ func (ctd CanTransferDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate stateDB := statedb.New(ctx, ctd.evmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(ctx.HeaderHash().Bytes()))) evm := ctd.evmKeeper.NewEVM(ctx, coreMsg, cfg, evmtypes.NewNoOpTracer(), stateDB) + valueU256, isOverflow := uint256.FromBig(coreMsg.Value) + if isOverflow { + return ctx, fmt.Errorf("%v is not a valid uint256", coreMsg.Value) + } + // check that caller has enough balance to cover asset transfer for **topmost** call // NOTE: here the gas consumed is from the context with the infinite gas meter - if coreMsg.Value.Sign() > 0 && !evm.Context.CanTransfer(stateDB, coreMsg.From, coreMsg.Value) { + if coreMsg.Value.Sign() > 0 && !evm.Context.CanTransfer(stateDB, coreMsg.From, valueU256) { return ctx, errorsmod.Wrapf( errortypes.ErrInsufficientFunds, "failed to transfer %s from address %s using the EVM block context transfer function", diff --git a/app/ante/eth_test.go b/app/ante/eth_test.go index e077df9d..5c9d9d4a 100644 --- a/app/ante/eth_test.go +++ b/app/ante/eth_test.go @@ -5,6 +5,7 @@ import ( "math/big" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/holiman/uint256" "github.com/zeta-chain/ethermint/app/ante" "github.com/zeta-chain/ethermint/server/config" @@ -68,7 +69,7 @@ func (suite AnteTestSuite) TestNewEthAccountVerificationDecorator() { "success new account", tx, func() { - vmdb.AddBalance(addr, big.NewInt(1000000)) + vmdb.AddBalance(addr, uint256.NewInt(1000000)) }, true, true, @@ -80,7 +81,7 @@ func (suite AnteTestSuite) TestNewEthAccountVerificationDecorator() { acc := suite.app.AccountKeeper.NewAccountWithAddress(suite.ctx, addr.Bytes()) suite.app.AccountKeeper.SetAccount(suite.ctx, acc) - vmdb.AddBalance(addr, big.NewInt(1000000)) + vmdb.AddBalance(addr, uint256.NewInt(1000000)) }, true, true, @@ -241,7 +242,7 @@ func (suite AnteTestSuite) TestEthGasConsumeDecorator() { tx2, 0, func() { - vmdb.AddBalance(addr, big.NewInt(1000000)) + vmdb.AddBalance(addr, uint256.NewInt(1000000)) }, false, true, 0, @@ -251,7 +252,7 @@ func (suite AnteTestSuite) TestEthGasConsumeDecorator() { tx2, 0, func() { - vmdb.AddBalance(addr, big.NewInt(1000000)) + vmdb.AddBalance(addr, uint256.NewInt(1000000)) suite.ctx = suite.ctx.WithBlockGasMeter(sdk.NewGasMeter(1)) }, false, true, @@ -262,7 +263,7 @@ func (suite AnteTestSuite) TestEthGasConsumeDecorator() { tx2, tx2GasLimit, // it's capped func() { - vmdb.AddBalance(addr, big.NewInt(1001000000000000)) + vmdb.AddBalance(addr, uint256.NewInt(1001000000000000)) suite.ctx = suite.ctx.WithBlockGasMeter(sdk.NewGasMeter(10000000000000000000)) }, true, false, @@ -273,7 +274,7 @@ func (suite AnteTestSuite) TestEthGasConsumeDecorator() { dynamicFeeTx, tx2GasLimit, // it's capped func() { - vmdb.AddBalance(addr, big.NewInt(1001000000000000)) + vmdb.AddBalance(addr, uint256.NewInt(1001000000000000)) suite.ctx = suite.ctx.WithBlockGasMeter(sdk.NewGasMeter(10000000000000000000)) }, true, false, @@ -284,7 +285,7 @@ func (suite AnteTestSuite) TestEthGasConsumeDecorator() { dynamicFeeTx, 0, // for reCheckTX mode, gas limit should be set to 0 func() { - vmdb.AddBalance(addr, big.NewInt(1001000000000000)) + vmdb.AddBalance(addr, uint256.NewInt(1001000000000000)) suite.ctx = suite.ctx.WithIsReCheckTx(true) }, true, false, @@ -378,7 +379,7 @@ func (suite AnteTestSuite) TestCanTransferDecorator() { acc := suite.app.AccountKeeper.NewAccountWithAddress(suite.ctx, addr.Bytes()) suite.app.AccountKeeper.SetAccount(suite.ctx, acc) - vmdb.AddBalance(addr, big.NewInt(1000000)) + vmdb.AddBalance(addr, uint256.NewInt(1000000)) }, true, }, diff --git a/app/ante/sigs_test.go b/app/ante/sigs_test.go index 7dee412e..924031d7 100644 --- a/app/ante/sigs_test.go +++ b/app/ante/sigs_test.go @@ -3,6 +3,7 @@ package ante_test import ( "math/big" + "github.com/holiman/uint256" "github.com/zeta-chain/ethermint/tests" "github.com/zeta-chain/ethermint/x/evm/statedb" evmtypes "github.com/zeta-chain/ethermint/x/evm/types" @@ -17,7 +18,7 @@ func (suite AnteTestSuite) TestSignatures() { acc := statedb.NewEmptyAccount() acc.Nonce = 1 - acc.Balance = big.NewInt(10000000000) + acc.Balance = uint256.NewInt(10000000000) suite.app.EvmKeeper.SetAccount(suite.ctx, addr, *acc) msgEthereumTx := evmtypes.NewTx(suite.app.EvmKeeper.ChainID(), 1, &to, big.NewInt(10), 100000, big.NewInt(1), nil, nil, nil, nil) diff --git a/go.mod b/go.mod index e955d84a..eb537f31 100644 --- a/go.mod +++ b/go.mod @@ -18,11 +18,12 @@ require ( github.com/cosmos/gogoproto v1.7.0 github.com/cosmos/ibc-go/v7 v7.2.0 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc - github.com/ethereum/go-ethereum v1.12.2 + github.com/ethereum/go-ethereum v1.13.15 github.com/golang/protobuf v1.5.4 github.com/gorilla/mux v1.8.0 github.com/gorilla/websocket v1.5.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 + github.com/holiman/uint256 v1.2.4 github.com/improbable-eng/grpc-web v0.15.0 github.com/onsi/ginkgo/v2 v2.7.0 github.com/onsi/gomega v1.26.0 @@ -38,6 +39,7 @@ require ( github.com/tidwall/gjson v1.14.4 github.com/tidwall/sjson v1.2.5 github.com/tyler-smith/go-bip39 v1.1.0 + golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa golang.org/x/net v0.23.0 golang.org/x/text v0.14.0 google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 @@ -58,15 +60,15 @@ require ( github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect - github.com/DataDog/zstd v1.5.2 // indirect - github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect - github.com/VictoriaMetrics/fastcache v1.6.0 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/StackExchange/wmi v1.2.1 // indirect + github.com/VictoriaMetrics/fastcache v1.12.1 // indirect github.com/allegro/bigcache v1.2.1 // indirect github.com/aws/aws-sdk-go v1.44.203 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect - github.com/bits-and-blooms/bitset v1.7.0 // indirect + github.com/bits-and-blooms/bitset v1.10.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect @@ -76,19 +78,19 @@ require ( github.com/cockroachdb/apd/v2 v2.0.2 // indirect github.com/cockroachdb/errors v1.10.0 // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect - github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 // indirect github.com/cockroachdb/redact v1.1.5 // indirect github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect github.com/confio/ics23/go v0.9.0 // indirect github.com/consensys/bavard v0.1.13 // indirect - github.com/consensys/gnark-crypto v0.10.0 // indirect + github.com/consensys/gnark-crypto v0.12.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v0.20.1 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.12.4 // indirect github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect - github.com/crate-crypto/go-kzg-4844 v0.3.0 // indirect + github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 // indirect + github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect github.com/creachadair/taskgroup v0.4.2 // indirect github.com/danieljoos/wincred v1.1.2 // indirect github.com/deckarep/golang-set/v2 v2.1.0 // indirect @@ -98,22 +100,22 @@ require ( github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/dlclark/regexp2 v1.7.0 // indirect - github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3 // indirect + github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.6.0 // indirect - github.com/ethereum/c-kzg-4844 v0.3.1 // indirect + github.com/ethereum/c-kzg-4844 v0.4.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect + github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect github.com/getsentry/sentry-go v0.23.0 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-ole/go-ole v1.2.6 // indirect + github.com/go-ole/go-ole v1.3.0 // indirect github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect - github.com/go-stack/stack v1.8.1 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gofrs/flock v0.8.1 // indirect github.com/gogo/googleapis v1.4.1 // indirect @@ -144,9 +146,8 @@ require ( github.com/hashicorp/hcl v1.0.0 // indirect github.com/hdevalence/ed25519consensus v0.1.0 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect - github.com/holiman/uint256 v1.2.3 // indirect github.com/huandu/skiplist v1.2.0 // indirect - github.com/huin/goupnp v1.0.3 // indirect + github.com/huin/goupnp v1.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect @@ -161,7 +162,7 @@ require ( github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-runewidth v0.0.9 // indirect + github.com/mattn/go-runewidth v0.0.13 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect github.com/minio/highwayhash v1.0.2 // indirect @@ -179,6 +180,7 @@ require ( github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect + github.com/rivo/uniseg v0.2.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/rs/zerolog v1.33.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect @@ -195,8 +197,8 @@ require ( github.com/tendermint/go-amino v0.16.0 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.0 // indirect - github.com/tklauser/go-sysconf v0.3.10 // indirect - github.com/tklauser/numcpus v0.4.0 // indirect + github.com/tklauser/go-sysconf v0.3.12 // indirect + github.com/tklauser/numcpus v0.6.1 // indirect github.com/ulikunitz/xz v0.5.11 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect @@ -210,19 +212,19 @@ require ( go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.9.0 // indirect golang.org/x/crypto v0.21.0 // indirect - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/oauth2 v0.16.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.22.0 // indirect golang.org/x/term v0.18.0 // indirect golang.org/x/time v0.5.0 // indirect + golang.org/x/tools v0.15.0 // indirect google.golang.org/api v0.155.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect pgregory.net/rapid v1.1.0 // indirect @@ -239,4 +241,4 @@ replace ( ) // ZetaChain maintained replacements -replace github.com/ethereum/go-ethereum => github.com/zeta-chain/go-ethereum v1.12.3-0.20241015175757-891ef9f51367 +replace github.com/ethereum/go-ethereum => github.com/zeta-chain/go-ethereum v1.13.16-0.20241018211122-a3509360e99b diff --git a/go.sum b/go.sum index 94b13437..a93ce8bd 100644 --- a/go.sum +++ b/go.sum @@ -212,21 +212,19 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8= -github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= -github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= -github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= +github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= +github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= +github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= +github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= @@ -266,8 +264,8 @@ github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bits-and-blooms/bitset v1.7.0 h1:YjAGVd3XmtK9ktAbX8Zg2g2PwLIMjGREZJHlV4j7NEo= -github.com/bits-and-blooms/bitset v1.7.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= +github.com/bits-and-blooms/bitset v1.10.0 h1:ePXTeiPEazB5+opbv5fr8umg2R/1NlzgDsyepwsSr88= +github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A= @@ -342,14 +340,10 @@ github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa/go.mod h1:x/1Gn8zydmfq github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/cockroachdb/datadriven v1.0.2 h1:H9MtNqVoVhvd9nCBwOyDjUEdZCREqbIdCJD93PBm/jA= -github.com/cockroachdb/datadriven v1.0.2/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= github.com/cockroachdb/errors v1.10.0 h1:lfxS8zZz1+OjtV4MtNWgboi/W5tyLEB6VQZBXN+0VUU= github.com/cockroachdb/errors v1.10.0/go.mod h1:lknhIsEVQ9Ss/qKDBQS/UqFSvPQjOwNq2qyKAxtHRqE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= -github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 h1:ytcWPaNPhNoGMWEhDvS3zToKcDpRsLuRolQJBVGdozk= -github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811/go.mod h1:Nb5lgvnQ2+oGlE/EyZy4+2/CxRh9KfvCXnag1vtpxVM= github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= @@ -363,8 +357,8 @@ github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4 github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak= github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= -github.com/consensys/gnark-crypto v0.10.0 h1:zRh22SR7o4K35SoNqouS9J/TKHTyU2QWaj5ldehyXtA= -github.com/consensys/gnark-crypto v0.10.0/go.mod h1:Iq/P3HHl0ElSjsg2E1gsMwhAyxnxoKK5nVyZKd+/KhU= +github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M= +github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -402,8 +396,10 @@ github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwc github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/crate-crypto/go-kzg-4844 v0.3.0 h1:UBlWE0CgyFqqzTI+IFyCzA7A3Zw4iip6uzRv5NIXG0A= -github.com/crate-crypto/go-kzg-4844 v0.3.0/go.mod h1:SBP7ikXEgDnUPONgm33HtuDZEDtWa3L4QtN1ocJSEQ4= +github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 h1:d28BXYi+wUpz1KBmiF9bWrjEMacUEREV6MBi2ODnrfQ= +github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= +github.com/crate-crypto/go-kzg-4844 v0.7.0 h1:C0vgZRk4q4EZ/JgPfzuSoxdCq3C3mOZMBShovmncxvA= +github.com/crate-crypto/go-kzg-4844 v0.7.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= github.com/creachadair/taskgroup v0.4.2 h1:jsBLdAJE42asreGss2xZGZ8fJra7WtwnHWeJFxv2Li8= github.com/creachadair/taskgroup v0.4.2/go.mod h1:qiXUOSrbwAY3u0JPGTzObbE3yf9hcXHDKBZ2ZjpCbgM= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= @@ -442,8 +438,8 @@ github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5Xh github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dop251/goja v0.0.0-20211022113120-dc8c55024d06/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= -github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3 h1:+3HCtB74++ClLy8GgjUQYeC8R4ILzVcIe8+5edAJJnE= -github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4= +github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 h1:qwcF+vdFrvPSEUDSX5RVoRccG8a5DhOdWdQ4zN62zzo= +github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d/go.mod h1:DngW8aVqWbuLRMHItjPUyqdj+HWPvnQe8V8y1nDpIbM= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -469,14 +465,14 @@ github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go. github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= -github.com/ethereum/c-kzg-4844 v0.3.1 h1:sR65+68+WdnMKxseNWxSJuAv2tsUrihTpVBTfM/U5Zg= -github.com/ethereum/c-kzg-4844 v0.3.1/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= +github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY= +github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= -github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= +github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA= +github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= @@ -489,6 +485,8 @@ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nos github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= +github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 h1:BAIP2GihuqhwdILrV+7GJel5lyPV3u1+PgzrWLc0TkE= +github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46/go.mod h1:QNpY22eby74jVhqH4WhDLDwxc/vqsern6pW+u2kbkpc= github.com/getsentry/sentry-go v0.23.0 h1:dn+QRCeJv4pPt9OjVXiMcGIBIefaTJPw/h0bZWO05nE= github.com/getsentry/sentry-go v0.23.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -518,8 +516,9 @@ github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= -github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= +github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= @@ -534,8 +533,6 @@ github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyL github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= -github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= @@ -557,8 +554,8 @@ github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zV github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog= -github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= +github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= @@ -747,21 +744,20 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7HsjsjeEZ6auqU= github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= -github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7 h1:3JQNjnMRil1yD0IfZKHF9GxxWKDJGj8I0IqOUol//sw= -github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc= +github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 h1:X4egAf/gcS1zATw6wn4Ej8vjuVGxeHdan+bRb2ebyv4= +github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= -github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o= -github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= +github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= +github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw= github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= -github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= +github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= +github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20220319035150-800ac71e25c2/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= @@ -855,8 +851,9 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= +github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= @@ -1007,6 +1004,8 @@ github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Ung github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= @@ -1112,10 +1111,10 @@ github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= -github.com/tklauser/go-sysconf v0.3.10 h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03OUqALw= -github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk= -github.com/tklauser/numcpus v0.4.0 h1:E53Dm1HjH1/R2/aoCtXtPgzmElmn51aOkhCFSuZq//o= -github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= +github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= @@ -1132,8 +1131,8 @@ github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0o github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli/v2 v2.24.1 h1:/QYYr7g0EhwXEML8jO+8OYt5trPnLHS0p3mrgExJ5NU= -github.com/urfave/cli/v2 v2.24.1/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc= +github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= +github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= @@ -1144,8 +1143,8 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/zeta-chain/go-ethereum v1.12.3-0.20241015175757-891ef9f51367 h1:smcLz1TAQB/4lT/4knII3jae8vjYvByCqimzxaxI4bo= -github.com/zeta-chain/go-ethereum v1.12.3-0.20241015175757-891ef9f51367/go.mod h1:1cRAEV+rp/xX0zraSCBnu9Py3HQ+geRMj3HdR+k0wfI= +github.com/zeta-chain/go-ethereum v1.13.16-0.20241018211122-a3509360e99b h1:b8YPHSJ9sE86yZ085rN2kmjVTtWqfkV7fOISSFkuQAw= +github.com/zeta-chain/go-ethereum v1.13.16-0.20241018211122-a3509360e99b/go.mod h1:TN8ZiHrdJwSe8Cb6x+p0hs5CxhJZPbqB7hHkaUXcmIU= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= @@ -1216,8 +1215,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= +golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= +golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1244,8 +1243,8 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1411,7 +1410,6 @@ golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1446,7 +1444,10 @@ golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= @@ -1535,8 +1536,8 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8= +golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1796,8 +1797,6 @@ gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= -gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= -gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= diff --git a/gomod2nix.toml b/gomod2nix.toml index fc0a7e3f..38746288 100644 --- a/gomod2nix.toml +++ b/gomod2nix.toml @@ -50,15 +50,15 @@ schema = 3 version = "v0.0.0-20200405005733-88cbf1b4c40d" hash = "sha256-i8RXZemJGlSjBT35oPm0SawFiBoIU5Pkq5xp4n/rzCY=" replaced = "github.com/ChainSafe/go-schnorrkel" - [mod."github.com/DataDog/zstd"] - version = "v1.5.2" - hash = "sha256-LVkZHLG8O4CzmqyQVbGn+0r6AKIMABej8a4HKMFw/xo=" + [mod."github.com/Microsoft/go-winio"] + version = "v0.6.1" + hash = "sha256-BL0BVaHtmPKQts/711W59AbHXjGKqFS4ZTal0RYnR9I=" [mod."github.com/StackExchange/wmi"] - version = "v0.0.0-20180116203802-5d049714c4a6" - hash = "sha256-0yUxhZB3v3ZE3QY36zHs2cJ1S4GXptXIhyAi6sI2nOo=" + version = "v1.2.1" + hash = "sha256-1BoEeWAWyebH+1mMuyPhWZut8nWHb6r73MgcqlGuUEY=" [mod."github.com/VictoriaMetrics/fastcache"] - version = "v1.6.0" - hash = "sha256-u1dkRJ2Y5+hnYlkyMPm14HxKkAv999bjN622nZDjaBo=" + version = "v1.12.1" + hash = "sha256-1oFRz6us3BnHEzww9i4vODb/2lmbFHzZV6UCENEfrC4=" [mod."github.com/allegro/bigcache"] version = "v1.2.1" hash = "sha256-/DwqBxg75m1zzOB8BWbpjQ/jYnhoe/SMXc4310mOlMA=" @@ -78,8 +78,8 @@ schema = 3 version = "v0.1.1-0.20220910012023-760eaf8b6816" hash = "sha256-Tx3sPuhsoVwrCfJdIwf4ipn7pD92OQNYvpCxl1Z9Wt0=" [mod."github.com/bits-and-blooms/bitset"] - version = "v1.7.0" - hash = "sha256-URPyLi92d/Yjul8r5g7dtf0DZ4GHbBsh8Qz4O0fDpxA=" + version = "v1.10.0" + hash = "sha256-/Kkx33umYGS1keFnkmJ+DHgIAtkEDNI42nVpKYfUOTs=" [mod."github.com/btcsuite/btcd"] version = "v0.24.2" hash = "sha256-ahlpwEr4KfyrEA899X07QtuSDnC8U+SnwL+z72DiK5E=" @@ -113,9 +113,6 @@ schema = 3 [mod."github.com/cockroachdb/logtags"] version = "v0.0.0-20230118201751-21c54148d20b" hash = "sha256-7dQH6j1o99fuxHKkw0RhNC5wJKkvRLMDJpUiVnDx6h8=" - [mod."github.com/cockroachdb/pebble"] - version = "v0.0.0-20230209160836-829675f94811" - hash = "sha256-DpbEXN/YWWXap83lz99r6sAUUk76ixDe4fRn1GpBWpo=" [mod."github.com/cockroachdb/redact"] version = "v1.1.5" hash = "sha256-0rtT7LRO0wxf9XovOK8GXRrhmx8OcbdPK/mXOKbJdog=" @@ -136,8 +133,8 @@ schema = 3 version = "v0.1.13" hash = "sha256-DEx0JuvgqNCNv7IMHlbLJK6pb1ru29C/rTSKh6YksVg=" [mod."github.com/consensys/gnark-crypto"] - version = "v0.10.0" - hash = "sha256-qcKMoiAzhJtGECQyXC/Wntmdc1qmHp89ZKkLu1Mi08o=" + version = "v0.12.1" + hash = "sha256-M7S5XbXKsvx2Uw2qNtsQg0RmlhFtSCzXEL2T3vzeq7o=" [mod."github.com/cosmos/btcutil"] version = "v1.0.5" hash = "sha256-t572Sr5iiHcuMKLMWa2i+LBAt192oa+G1oA371tG/eI=" @@ -171,9 +168,12 @@ schema = 3 [mod."github.com/cosmos/rosetta-sdk-go"] version = "v0.10.0" hash = "sha256-WmLq9E9mYV+ms6Tdb43lCoAy6cowkDnK4bvX/ApDzLY=" + [mod."github.com/crate-crypto/go-ipa"] + version = "v0.0.0-20231025140028-3c0104f4b233" + hash = "sha256-FUTI6x4sWr5QuINpwXtEG202elrhwqbxsesDc7Mp/DU=" [mod."github.com/crate-crypto/go-kzg-4844"] - version = "v0.3.0" - hash = "sha256-caco5452YhMLNnzp/q/jagYookdAP03n2OQNpmdeiRg=" + version = "v0.7.0" + hash = "sha256-vQ2CLr+JFd6zotMhOFLr4Xv1xTJTHWubmO7d2bf+Lis=" [mod."github.com/creachadair/taskgroup"] version = "v0.4.2" hash = "sha256-AjtQRoLKLSAbyKd8YlaXcYn0pek6oo5U3R28dvtKv14=" @@ -205,8 +205,8 @@ schema = 3 version = "v1.7.0" hash = "sha256-Z/M62esiZ0fVwvueVQhwz18z0eS22LZ3DJ4O8FKp3AY=" [mod."github.com/dop251/goja"] - version = "v0.0.0-20230605162241-28ee0ee714f3" - hash = "sha256-dm3HFq1Y+eRt3SGQKTQd5h8BQnPqf4l4/3KD1s95HKY=" + version = "v0.0.0-20230806174421-c933cf95e127" + hash = "sha256-oIxFk8s7nvWerfma6kEfh1iqm+B+kBo+6H1mZLdHoeU=" [mod."github.com/dustin/go-humanize"] version = "v1.0.1" hash = "sha256-yuvxYYngpfVkUg9yAmG99IUVmADTQA0tMbBXe0Fq0Mc=" @@ -214,11 +214,11 @@ schema = 3 version = "v1.6.0" hash = "sha256-IXn2BuUp4fi/i2zf1tGGW1m9xoYh3VCksB6GJ5Sf06g=" [mod."github.com/ethereum/c-kzg-4844"] - version = "v0.3.1" - hash = "sha256-TBgi2xaeR9Aq9VkvrnNduBjqNZEZLu+4si6qg68Si/s=" + version = "v0.4.0" + hash = "sha256-Ol5bznli6Dh5uXi8GUGsjZo8DzCdF0hqsUMwDNUpxP0=" [mod."github.com/ethereum/go-ethereum"] - version = "v1.12.3-0.20241015175757-891ef9f51367" - hash = "sha256-ELRj7x4a5gf9AuP2Bj9u31imD5jnffg4gENRYyVxzdg=" + version = "v1.13.16-0.20241018211122-a3509360e99b" + hash = "sha256-ijnOmKYj308G5WOlFVkMFcQ7AqMdtxrWCadikdpTVkY=" replaced = "github.com/zeta-chain/go-ethereum" [mod."github.com/felixge/httpsnoop"] version = "v1.0.4" @@ -229,6 +229,9 @@ schema = 3 [mod."github.com/gballet/go-libpcsclite"] version = "v0.0.0-20190607065134-2772fd86a8ff" hash = "sha256-Nr5ocU9s1F2Lhx/Zq6/nIo+KkKEqMjDYOEs3yWRC48g=" + [mod."github.com/gballet/go-verkle"] + version = "v0.1.1-0.20231031103413-a67434b50f46" + hash = "sha256-ccLo8Dx6QMbsn8qBoRdz6Nj464O3PgcgsMF889gPjC8=" [mod."github.com/getsentry/sentry-go"] version = "v0.23.0" hash = "sha256-VR6IL+yIc+BV5xBGfPJ7ixsAVzJ/hzuvXmkkAn1cTk4=" @@ -248,14 +251,11 @@ schema = 3 version = "v1.2.2" hash = "sha256-rRweAP7XIb4egtT1f2gkz4sYOu7LDHmcJ5iNsJUd0sE=" [mod."github.com/go-ole/go-ole"] - version = "v1.2.6" - hash = "sha256-+oxitLeJxYF19Z6g+6CgmCHJ1Y5D8raMi2Cb3M6nXCs=" + version = "v1.3.0" + hash = "sha256-tF8t3VcV71jQ4jbPL91BwR59AKDpUAFV1waIKzkXJu8=" [mod."github.com/go-sourcemap/sourcemap"] version = "v2.1.3+incompatible" hash = "sha256-eXhXPPLnAy/rmt/zDgeqni2G3o58UtnHjR8vHLXvISI=" - [mod."github.com/go-stack/stack"] - version = "v1.8.1" - hash = "sha256-ixcJ2RrK1ZH3YWGQZF9QFBo02NOuLeSp9wJ7gniipgY=" [mod."github.com/godbus/dbus"] version = "v0.0.0-20190726142602-4481cbc300e2" hash = "sha256-R7Gb9+Zjy80FbQSDGketoVEqfdOQKuOVTfWRjQ5kxZY=" @@ -359,14 +359,14 @@ schema = 3 version = "v2.0.3" hash = "sha256-5VsJMQzJSNd4F7yAl3iF/q6JodWOlE4dUvTQ0UGPe+k=" [mod."github.com/holiman/uint256"] - version = "v1.2.3" - hash = "sha256-OGf+jb7sr0p8vwqiqIBZkzZDZ2zBWf9WpRi4iouS4uE=" + version = "v1.2.4" + hash = "sha256-a9sGs7uSpOLARDk+qxt3stiE8Dq+g8vqz84Qe4XlRT0=" [mod."github.com/huandu/skiplist"] version = "v1.2.0" hash = "sha256-/r4QP1SldMlhpkr1ZQFHImSYaeMZEtqBW7R53yN+JtQ=" [mod."github.com/huin/goupnp"] - version = "v1.0.3" - hash = "sha256-EMGmTdoQhP2bVbCPX37hes5krqXn6NFexfnKr9E5u8I=" + version = "v1.3.0" + hash = "sha256-/VTfjUhHLGuXymYBC1vQJv1N8O1AjYwC/xTGd6h3Uw0=" [mod."github.com/improbable-eng/grpc-web"] version = "v0.15.0" hash = "sha256-9oqKb5Y3hjleOFE2BczbEzLH6q2Jg7kUTP/M8Yk4Ne4=" @@ -413,8 +413,8 @@ schema = 3 version = "v0.0.20" hash = "sha256-qhw9hWtU5wnyFyuMbKx+7RB8ckQaFQ8D+8GKPkN3HHQ=" [mod."github.com/mattn/go-runewidth"] - version = "v0.0.9" - hash = "sha256-dK/kIPe1tcxEubwI4CWfov/HWRBgD/fqlPC3d5i30CY=" + version = "v0.0.13" + hash = "sha256-93AwJFA8B2pwNJAPe64yN0c/CwkJNGFDWFe/HpzDVuk=" [mod."github.com/matttproud/golang_protobuf_extensions"] version = "v1.0.4" hash = "sha256-uovu7OycdeZ2oYQ7FhVxLey5ZX3T0FzShaRldndyGvc=" @@ -478,6 +478,9 @@ schema = 3 [mod."github.com/rcrowley/go-metrics"] version = "v0.0.0-20201227073835-cf1acfcdf475" hash = "sha256-10ytHQ1SpMKYTiKuOPdEMuOVa8HVvv9ryYSIF9BHEBI=" + [mod."github.com/rivo/uniseg"] + version = "v0.2.0" + hash = "sha256-GLj0jiGrT03Ept4V6FXCN1yeZ/b6PpS3MEXK6rYQ8Eg=" [mod."github.com/rogpeppe/go-internal"] version = "v1.11.0" hash = "sha256-BucSndJVnqX9e6p5PfA6Z8N2bGfIeRfxAxYLUDXTbIo=" @@ -555,11 +558,11 @@ schema = 3 version = "v1.2.5" hash = "sha256-OYGNolkmL7E1Qs2qrQ3IVpQp5gkcHNU/AB/z2O+Myps=" [mod."github.com/tklauser/go-sysconf"] - version = "v0.3.10" - hash = "sha256-Zf2NsgM9+HeM949vCce4HQtSbfUiFpeiQ716yKcFyx4=" + version = "v0.3.12" + hash = "sha256-91VBZNb3L2TZkEETF1AE4wnraLoGxKeofUbC5ZiWVHk=" [mod."github.com/tklauser/numcpus"] - version = "v0.4.0" - hash = "sha256-ndE82nOb3agubhEV7aRzEqqTlN4DPbKFHEm2+XZLn8k=" + version = "v0.6.1" + hash = "sha256-8eFcw4YI0w6+GPhU5xMMQjiio94q/O5PpNO3QsvXve0=" [mod."github.com/tyler-smith/go-bip39"] version = "v1.1.0" hash = "sha256-3YhWBtSwRLGwm7vNwqumphZG3uLBW1vwT9QkQ8JuSjU=" @@ -603,8 +606,11 @@ schema = 3 version = "v0.21.0" hash = "sha256-Z4k1LvFh4Jai7HUe6TTuXSG3VnuiRpMwdARIdZZqSYk=" [mod."golang.org/x/exp"] - version = "v0.0.0-20230905200255-921286631fa9" - hash = "sha256-CyeVwjp12Wqh4ptqfi3KHCWPzOFhE8fSrP3sMjMXvec=" + version = "v0.0.0-20231110203233-9a3e6036ecaa" + hash = "sha256-m1T4KePBRCJpAjnuq4BnDYXebOHiVI6h2489XD5R9BA=" + [mod."golang.org/x/mod"] + version = "v0.14.0" + hash = "sha256-sx3hWp5l99DBfIrn821ohfoBwvaITSHMWbzPvX0btLM=" [mod."golang.org/x/net"] version = "v0.23.0" hash = "sha256-ZB4504rtgsHbcRfijjlqt4/2ddb8tyQB5IBn126uVTQ=" @@ -626,6 +632,9 @@ schema = 3 [mod."golang.org/x/time"] version = "v0.5.0" hash = "sha256-W6RgwgdYTO3byIPOFxrP2IpAZdgaGowAaVfYby7AULU=" + [mod."golang.org/x/tools"] + version = "v0.15.0" + hash = "sha256-C2YsNcJ2ZodVscy8fQOIz5R+rql407vLrvjwVm3nrkI=" [mod."google.golang.org/api"] version = "v0.155.0" hash = "sha256-lfQZ5XNJYLOSlu+lrwYYIA3qXrraLC/PIVRHha5mlqI=" @@ -650,9 +659,6 @@ schema = 3 [mod."gopkg.in/ini.v1"] version = "v1.67.0" hash = "sha256-V10ahGNGT+NLRdKUyRg1dos5RxLBXBk1xutcnquc/+4=" - [mod."gopkg.in/natefinch/npipe.v2"] - version = "v2.0.0-20160621034901-c1b8fa8bdcce" - hash = "sha256-ytqeVZqn4kd2uc65HvEjPlpPA2VnBmPfu5DsFlO0o+g=" [mod."gopkg.in/yaml.v3"] version = "v3.0.1" hash = "sha256-FqL9TKYJ0XkNwJFnq9j0VvJ5ZUU1RvH/52h/f5bkYAU=" diff --git a/server/json_rpc.go b/server/json_rpc.go index d5d804c8..88cb278d 100644 --- a/server/json_rpc.go +++ b/server/json_rpc.go @@ -16,9 +16,12 @@ package server import ( + "context" "net/http" "time" + "golang.org/x/exp/slog" + "github.com/gorilla/mux" "github.com/rs/cors" @@ -29,10 +32,50 @@ import ( ethrpc "github.com/ethereum/go-ethereum/rpc" "github.com/zeta-chain/ethermint/rpc" + tmlog "github.com/cometbft/cometbft/libs/log" "github.com/zeta-chain/ethermint/server/config" ethermint "github.com/zeta-chain/ethermint/types" ) +type gethLogsToTm struct { + logger tmlog.Logger + attrs []slog.Attr +} + +func (g *gethLogsToTm) Enabled(_ context.Context, _ slog.Level) bool { + return true +} + +func (g *gethLogsToTm) Handle(ctx context.Context, record slog.Record) error { + attrs := g.attrs + record.Attrs(func(attr slog.Attr) bool { + attrs = append(attrs, attr) + return true + }) + switch record.Level { + case slog.LevelDebug: + g.logger.Debug(record.Message, attrs) + case slog.LevelInfo: + g.logger.Info(record.Message, attrs) + case slog.LevelWarn: + g.logger.Info(record.Message, attrs) + case slog.LevelError: + g.logger.Error(record.Message, attrs) + } + return nil +} + +func (g *gethLogsToTm) WithAttrs(attrs []slog.Attr) slog.Handler { + return &gethLogsToTm{ + logger: g.logger, + attrs: append(g.attrs, attrs...), + } +} + +func (g *gethLogsToTm) WithGroup(name string) slog.Handler { + return g +} + // StartJSONRPC starts the JSON-RPC server func StartJSONRPC(ctx *server.Context, clientCtx client.Context, @@ -44,17 +87,7 @@ func StartJSONRPC(ctx *server.Context, tmWsClient := ConnectTmWS(tmRPCAddr, tmEndpoint, ctx.Logger) logger := ctx.Logger.With("module", "geth") - ethlog.Root().SetHandler(ethlog.FuncHandler(func(r *ethlog.Record) error { - switch r.Lvl { - case ethlog.LvlTrace, ethlog.LvlDebug: - logger.Debug(r.Msg, r.Ctx...) - case ethlog.LvlInfo, ethlog.LvlWarn: - logger.Info(r.Msg, r.Ctx...) - case ethlog.LvlError, ethlog.LvlCrit: - logger.Error(r.Msg, r.Ctx...) - } - return nil - })) + ethlog.SetDefault(ethlog.NewLogger(&gethLogsToTm{logger: logger})) rpcServer := ethrpc.NewServer() diff --git a/tests/importer/importer_test.go b/tests/importer/importer_test.go index 6a7960c1..3c3bd4de 100644 --- a/tests/importer/importer_test.go +++ b/tests/importer/importer_test.go @@ -4,11 +4,11 @@ import ( "flag" "fmt" "io" - "math/big" "os" "testing" "time" + "github.com/holiman/uint256" "github.com/zeta-chain/ethermint/app" "github.com/zeta-chain/ethermint/types" @@ -40,8 +40,8 @@ import ( var ( flagBlockchain string - rewardBig8 = big.NewInt(8) - rewardBig32 = big.NewInt(32) + reward8U256 = uint256.NewInt(8) + reward32U256 = uint256.NewInt(32) ) func init() { @@ -183,18 +183,19 @@ func accumulateRewards( if config.IsByzantium(header.Number) { blockReward = ethash.ByzantiumBlockReward } - // accumulate the rewards for the miner and any included uncles - reward := new(big.Int).Set(blockReward) - r := new(big.Int) + reward := new(uint256.Int).Set(blockReward) + r := new(uint256.Int) for _, uncle := range uncles { - r.Add(uncle.Number, rewardBig8) - r.Sub(r, header.Number) + uncleNumber, _ := uint256.FromBig(uncle.Number) + headerNumber, _ := uint256.FromBig(header.Number) + r.Add(uncleNumber, reward8U256) + r.Sub(r, headerNumber) r.Mul(r, blockReward) - r.Div(r, rewardBig8) + r.Div(r, reward8U256) vmdb.AddBalance(uncle.Coinbase, r) - r.Div(blockReward, rewardBig32) + r.Div(blockReward, reward32U256) reward.Add(reward, r) } diff --git a/x/evm/genesis_test.go b/x/evm/genesis_test.go index 763fbb03..2575d9f7 100644 --- a/x/evm/genesis_test.go +++ b/x/evm/genesis_test.go @@ -1,9 +1,8 @@ package evm_test import ( - "math/big" - "github.com/ethereum/go-ethereum/common" + "github.com/holiman/uint256" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/zeta-chain/ethermint/crypto/ethsecp256k1" @@ -36,7 +35,7 @@ func (suite *EvmTestSuite) TestInitGenesis() { { "valid account", func() { - vmdb.AddBalance(address, big.NewInt(1)) + vmdb.AddBalance(address, uint256.NewInt(1)) }, &types.GenesisState{ Params: types.DefaultParams(), diff --git a/x/evm/keeper/keeper.go b/x/evm/keeper/keeper.go index 4a3364da..41dcad74 100644 --- a/x/evm/keeper/keeper.go +++ b/x/evm/keeper/keeper.go @@ -31,6 +31,7 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/params" + "github.com/holiman/uint256" consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" ethermint "github.com/zeta-chain/ethermint/types" @@ -39,7 +40,7 @@ import ( ) // CustomContractFn defines a custom precompiled contract generator with ctx, rules and returns a precompiled contract. -type CustomContractFn func(sdk.Context, params.Rules) vm.PrecompiledContract +type CustomContractFn func(sdk.Context, params.Rules) vm.StatefulPrecompiledContract // EventConverter type represents a function that parses a list of EventAttributes to a list of Ethereum Log objects. type EventConverter = func([]abci.EventAttribute) []*ethtypes.Log @@ -319,7 +320,7 @@ func (k *Keeper) GetAccountOrEmpty(ctx sdk.Context, addr common.Address) statedb // empty account return statedb.Account{ - Balance: new(big.Int), + Balance: new(uint256.Int), CodeHash: types.EmptyCodeHash, } } diff --git a/x/evm/keeper/keeper_test.go b/x/evm/keeper/keeper_test.go index a98faba7..123dbce8 100644 --- a/x/evm/keeper/keeper_test.go +++ b/x/evm/keeper/keeper_test.go @@ -9,6 +9,7 @@ import ( "testing" "time" + "github.com/holiman/uint256" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -498,7 +499,7 @@ func (suite *KeeperTestSuite) TestGetAccountStorage() { func (suite *KeeperTestSuite) TestGetAccountOrEmpty() { empty := statedb.Account{ - Balance: new(big.Int), + Balance: new(uint256.Int), CodeHash: types.EmptyCodeHash, } diff --git a/x/evm/keeper/state_transition.go b/x/evm/keeper/state_transition.go index 125b880a..0d61350c 100644 --- a/x/evm/keeper/state_transition.go +++ b/x/evm/keeper/state_transition.go @@ -16,11 +16,11 @@ package keeper import ( - "bytes" + "fmt" "math/big" - "sort" tmtypes "github.com/cometbft/cometbft/types" + "github.com/holiman/uint256" errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" @@ -77,37 +77,19 @@ func (k *Keeper) NewEVM( // i.e rules.IsByzantium, rules.IsConstantinople, etc. rules := cfg.ChainConfig.Rules(big.NewInt(ctx.BlockHeight()), cfg.ChainConfig.MergeNetsplitBlock != nil, 1) - contracts := make(map[common.Address]vm.PrecompiledContract) - active := make([]common.Address, 0) - - // Creates the list of **default** precompiled contracts (not stateful) for this set of rules. - // contracts hold the list of all contracts, while active holds the list of all active addresses. - // i.e create the list of contracts for Berlin. - for addr, c := range vm.DefaultPrecompiles(rules) { - contracts[addr] = c - active = append(active, addr) - } + statefulPrecompiles := make([]vm.StatefulPrecompiledContract, 0) // Add the custom stateful precompiled contracts and their addresses to the list. // Then, mark them as active. for _, fn := range k.customContractFns { c := fn(ctx, rules) - addr := c.Address() - contracts[addr] = c - active = append(active, addr) + statefulPrecompiles = append(statefulPrecompiles, c) } - // Sort the active slice in address ascending order. - sort.SliceStable(active, func(i, j int) bool { - return bytes.Compare(active[i].Bytes(), active[j].Bytes()) < 0 - }) - evm := vm.NewEVM(blockCtx, txCtx, stateDB, cfg.ChainConfig, vmConfig) - // Set the precompiled contracts: - // - contracts contains all the precompiled contracts. - // - active contains *only* the addresses of the active precompiled contracts. - evm.WithPrecompiles(contracts, active) + // set precompiled contracts + evm.SetStatefulPrecompiles(statefulPrecompiles) return evm } @@ -400,17 +382,25 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, leftoverGas -= intrinsicGas rules := cfg.ChainConfig.Rules(big.NewInt(ctx.BlockHeight()), cfg.ChainConfig.MergeNetsplitBlock != nil, uint64(ctx.BlockTime().Unix())) - stateDB.Prepare(rules, msg.From, cfg.CoinBase, msg.To, evm.ActivePrecompiles(rules), msg.AccessList) + stateDB.Prepare(rules, msg.From, cfg.CoinBase, msg.To, evm.AllPrecompiledAddresses(rules), msg.AccessList) + + if msg.Value == nil { + msg.Value = new(big.Int) + } + valueUint256, isOverflow := uint256.FromBig(msg.Value) + if isOverflow { + return nil, fmt.Errorf("%v is not a valid uint256", msg.Value) + } if contractCreation { // take over the nonce management from evm: // - reset sender's nonce to msg.Nonce() before calling evm. // - increase sender's nonce by one no matter the result. stateDB.SetNonce(sender.Address(), msg.Nonce) - ret, _, leftoverGas, vmErr = evm.Create(sender, msg.Data, leftoverGas, msg.Value) + ret, _, leftoverGas, vmErr = evm.Create(sender, msg.Data, leftoverGas, valueUint256) stateDB.SetNonce(sender.Address(), msg.Nonce+1) } else { - ret, leftoverGas, vmErr = evm.Call(sender, *msg.To, msg.Data, leftoverGas, msg.Value) + ret, leftoverGas, vmErr = evm.Call(sender, *msg.To, msg.Data, leftoverGas, valueUint256) } refundQuotient := params.RefundQuotient diff --git a/x/evm/keeper/statedb.go b/x/evm/keeper/statedb.go index af896ac8..a68c480b 100644 --- a/x/evm/keeper/statedb.go +++ b/x/evm/keeper/statedb.go @@ -25,6 +25,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common" + "github.com/holiman/uint256" ethermint "github.com/zeta-chain/ethermint/types" "github.com/zeta-chain/ethermint/x/evm/statedb" "github.com/zeta-chain/ethermint/x/evm/types" @@ -43,7 +44,7 @@ func (k *Keeper) GetAccount(ctx sdk.Context, addr common.Address) *statedb.Accou return nil } - acct.Balance = k.GetBalance(ctx, addr) + acct.Balance, _ = uint256.FromBig(k.GetBalance(ctx, addr)) return acct } @@ -140,7 +141,7 @@ func (k *Keeper) SetAccount(ctx sdk.Context, addr common.Address, account stated k.accountKeeper.SetAccount(ctx, acct) - if err := k.SetBalance(ctx, addr, account.Balance); err != nil { + if err := k.SetBalance(ctx, addr, account.Balance.ToBig()); err != nil { return err } diff --git a/x/evm/keeper/statedb_benchmark_test.go b/x/evm/keeper/statedb_benchmark_test.go index 3f6d1003..8ef57334 100644 --- a/x/evm/keeper/statedb_benchmark_test.go +++ b/x/evm/keeper/statedb_benchmark_test.go @@ -1,9 +1,9 @@ package keeper_test import ( - "math/big" "testing" + "github.com/holiman/uint256" "github.com/stretchr/testify/require" "github.com/ethereum/go-ethereum/common" @@ -47,7 +47,7 @@ func BenchmarkAddBalance(b *testing.B) { suite.SetupTestWithT(b) vmdb := suite.StateDB() - amt := big.NewInt(10) + amt := uint256.NewInt(10) b.ResetTimer() b.ReportAllocs() @@ -139,7 +139,7 @@ func BenchmarkSubBalance(b *testing.B) { suite.SetupTestWithT(b) vmdb := suite.StateDB() - amt := big.NewInt(10) + amt := uint256.NewInt(10) b.ResetTimer() b.ReportAllocs() diff --git a/x/evm/keeper/statedb_test.go b/x/evm/keeper/statedb_test.go index c1ffd2f9..9f8fe1fb 100644 --- a/x/evm/keeper/statedb_test.go +++ b/x/evm/keeper/statedb_test.go @@ -11,6 +11,7 @@ import ( authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/holiman/uint256" "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" @@ -33,11 +34,11 @@ func (suite *KeeperTestSuite) TestCreateAccount() { "reset account (keep balance)", suite.address, func(vmdb vm.StateDB, addr common.Address) { - vmdb.AddBalance(addr, big.NewInt(100)) - suite.Require().NotZero(vmdb.GetBalance(addr).Int64()) + vmdb.AddBalance(addr, uint256.NewInt(100)) + suite.Require().NotZero(vmdb.GetBalance(addr).ToBig().Int64()) }, func(vmdb vm.StateDB, addr common.Address) { - suite.Require().Equal(vmdb.GetBalance(addr).Int64(), int64(100)) + suite.Require().Equal(vmdb.GetBalance(addr).ToBig().Int64(), int64(100)) }, }, { @@ -65,24 +66,19 @@ func (suite *KeeperTestSuite) TestCreateAccount() { func (suite *KeeperTestSuite) TestAddBalance() { testCases := []struct { name string - amount *big.Int + amount *uint256.Int isNoOp bool }{ { "positive amount", - big.NewInt(100), + uint256.NewInt(100), false, }, { "zero amount", - big.NewInt(0), + uint256.NewInt(0), true, }, - { - "negative amount", - big.NewInt(-1), - false, // seems to be consistent with go-ethereum's implementation - }, } for _, tc := range testCases { @@ -93,9 +89,9 @@ func (suite *KeeperTestSuite) TestAddBalance() { post := vmdb.GetBalance(suite.address) if tc.isNoOp { - suite.Require().Equal(prev.Int64(), post.Int64()) + suite.Require().Equal(prev.String(), post.String()) } else { - suite.Require().Equal(new(big.Int).Add(prev, tc.amount).Int64(), post.Int64()) + suite.Require().Equal(new(uint256.Int).Add(prev, tc.amount).String(), post.String()) } }) } @@ -104,36 +100,30 @@ func (suite *KeeperTestSuite) TestAddBalance() { func (suite *KeeperTestSuite) TestSubBalance() { testCases := []struct { name string - amount *big.Int + amount *uint256.Int malleate func(vm.StateDB) isNoOp bool }{ { "positive amount, below zero", - big.NewInt(100), + uint256.NewInt(100), func(vm.StateDB) {}, false, }, { "positive amount, above zero", - big.NewInt(50), + uint256.NewInt(50), func(vmdb vm.StateDB) { - vmdb.AddBalance(suite.address, big.NewInt(100)) + vmdb.AddBalance(suite.address, uint256.NewInt(100)) }, false, }, { "zero amount", - big.NewInt(0), + uint256.NewInt(0), func(vm.StateDB) {}, true, }, - { - "negative amount", - big.NewInt(-1), - func(vm.StateDB) {}, - false, - }, } for _, tc := range testCases { @@ -146,9 +136,9 @@ func (suite *KeeperTestSuite) TestSubBalance() { post := vmdb.GetBalance(suite.address) if tc.isNoOp { - suite.Require().Equal(prev.Int64(), post.Int64()) + suite.Require().Equal(prev.String(), post.String()) } else { - suite.Require().Equal(new(big.Int).Sub(prev, tc.amount).Int64(), post.Int64()) + suite.Require().Equal(new(uint256.Int).Sub(prev, tc.amount).String(), post.String()) } }) } @@ -528,7 +518,7 @@ func (suite *KeeperTestSuite) TestEmpty() { { "not empty, positive balance", suite.address, - func(vmdb vm.StateDB) { vmdb.AddBalance(suite.address, big.NewInt(100)) }, + func(vmdb vm.StateDB) { vmdb.AddBalance(suite.address, uint256.NewInt(100)) }, false, }, {"empty, account doesn't exist", tests.GenerateAddress(), func(vm.StateDB) {}, true}, diff --git a/x/evm/keeper/tracer.go b/x/evm/keeper/tracer.go index 216fff02..63e88f91 100644 --- a/x/evm/keeper/tracer.go +++ b/x/evm/keeper/tracer.go @@ -36,7 +36,7 @@ func NewTracer(tracer string, msg *core.Message, cfg *params.ChainConfig, height switch tracer { case types.TracerAccessList: - preCompiles := vm.DefaultActivePrecompiles(cfg.Rules(big.NewInt(height), cfg.MergeNetsplitBlock != nil, 1)) + preCompiles := vm.ActivePrecompiles(cfg.Rules(big.NewInt(height), cfg.MergeNetsplitBlock != nil, 1)) return logger.NewAccessListTracer(msg.AccessList, msg.From, *msg.To, preCompiles) case types.TracerJSON: return logger.NewJSONLogger(logCfg, os.Stderr) diff --git a/x/evm/keeper/utils_test.go b/x/evm/keeper/utils_test.go index 0159d909..94785c2b 100644 --- a/x/evm/keeper/utils_test.go +++ b/x/evm/keeper/utils_test.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" ethparams "github.com/ethereum/go-ethereum/params" + "github.com/holiman/uint256" "github.com/zeta-chain/ethermint/x/evm/keeper" evmtypes "github.com/zeta-chain/ethermint/x/evm/types" ) @@ -204,9 +205,11 @@ func (suite *KeeperTestSuite) TestCheckSenderBalance() { } vmdb := suite.StateDB() - vmdb.AddBalance(suite.address, hundredInt.BigInt()) + hundredU256, isOverflow := uint256.FromBig(hundredInt.BigInt()) + suite.Require().False(isOverflow) + vmdb.AddBalance(suite.address, hundredU256) balance := vmdb.GetBalance(suite.address) - suite.Require().Equal(balance, hundredInt.BigInt()) + suite.Require().Equal(balance.String(), hundredU256.String()) err := vmdb.Commit() suite.Require().NoError(err, "Unexpected error while committing to vmdb: %d", err) @@ -239,7 +242,7 @@ func (suite *KeeperTestSuite) TestCheckSenderBalance() { acct := suite.app.EvmKeeper.GetAccountOrEmpty(suite.ctx, suite.address) err := keeper.CheckSenderBalance( - sdkmath.NewIntFromBigInt(acct.Balance), + sdkmath.NewIntFromBigInt(acct.Balance.ToBig()), txData, ) @@ -455,17 +458,20 @@ func (suite *KeeperTestSuite) TestVerifyFeeAndDeductTxCostsFromUserBalance() { } else { gasTipCap = tc.gasTipCap } - vmdb.AddBalance(suite.address, initBalance.BigInt()) + initBalanceU256, isOverflow := uint256.FromBig(initBalance.BigInt()) + suite.Require().False(isOverflow) + vmdb.AddBalance(suite.address, initBalanceU256) balance := vmdb.GetBalance(suite.address) - suite.Require().Equal(balance, initBalance.BigInt()) + suite.Require().Equal(balance.String(), initBalanceU256.String()) } else { if tc.gasPrice != nil { gasPrice = tc.gasPrice.BigInt() } - - vmdb.AddBalance(suite.address, hundredInt.BigInt()) + hundredBalanceU256, isOverflow := uint256.FromBig(hundredInt.BigInt()) + suite.Require().False(isOverflow) + vmdb.AddBalance(suite.address, hundredBalanceU256) balance := vmdb.GetBalance(suite.address) - suite.Require().Equal(balance, hundredInt.BigInt()) + suite.Require().Equal(balance.String(), hundredInt.String()) } err := vmdb.Commit() suite.Require().NoError(err, "Unexpected error while committing to vmdb: %d", err) diff --git a/x/evm/statedb/journal.go b/x/evm/statedb/journal.go index 31383bf3..865a2862 100644 --- a/x/evm/statedb/journal.go +++ b/x/evm/statedb/journal.go @@ -18,10 +18,10 @@ package statedb import ( "bytes" - "math/big" "sort" "github.com/ethereum/go-ethereum/common" + "github.com/holiman/uint256" ) // JournalEntry is a modification entry in the state change journal that can be @@ -104,13 +104,13 @@ type ( suicideChange struct { account *common.Address prev bool // whether account had already suicided - prevbalance *big.Int + prevbalance *uint256.Int } // Changes to individual accounts. balanceChange struct { account *common.Address - prev *big.Int + prev *uint256.Int } nonceChange struct { account *common.Address diff --git a/x/evm/statedb/state_object.go b/x/evm/statedb/state_object.go index dba7aa02..a70e1b15 100644 --- a/x/evm/statedb/state_object.go +++ b/x/evm/statedb/state_object.go @@ -18,11 +18,11 @@ package statedb import ( "bytes" "maps" - "math/big" "sort" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" + "github.com/holiman/uint256" ) var emptyCodeHash = crypto.Keccak256(nil) @@ -31,14 +31,14 @@ var emptyCodeHash = crypto.Keccak256(nil) // These objects are stored in the storage of auth module. type Account struct { Nonce uint64 - Balance *big.Int + Balance *uint256.Int CodeHash []byte } // NewEmptyAccount returns an empty account. func NewEmptyAccount() *Account { return &Account{ - Balance: new(big.Int), + Balance: new(uint256.Int), CodeHash: emptyCodeHash, } } @@ -90,7 +90,7 @@ type stateObject struct { // newObject creates a state object. func newObject(db *StateDB, address common.Address, account Account) *stateObject { if account.Balance == nil { - account.Balance = new(big.Int) + account.Balance = new(uint256.Int) } if account.CodeHash == nil { account.CodeHash = emptyCodeHash @@ -115,32 +115,32 @@ func (s *stateObject) markSuicided() { // AddBalance adds amount to s's balance. // It is used to add funds to the destination account of a transfer. -func (s *stateObject) AddBalance(amount *big.Int) { +func (s *stateObject) AddBalance(amount *uint256.Int) { if amount.Sign() == 0 { return } - s.SetBalance(new(big.Int).Add(s.Balance(), amount)) + s.SetBalance(new(uint256.Int).Add(s.Balance(), amount)) } // SubBalance removes amount from s's balance. // It is used to remove funds from the origin account of a transfer. -func (s *stateObject) SubBalance(amount *big.Int) { +func (s *stateObject) SubBalance(amount *uint256.Int) { if amount.Sign() == 0 { return } - s.SetBalance(new(big.Int).Sub(s.Balance(), amount)) + s.SetBalance(new(uint256.Int).Sub(s.Balance(), amount)) } // SetBalance update account balance. -func (s *stateObject) SetBalance(amount *big.Int) { +func (s *stateObject) SetBalance(amount *uint256.Int) { s.db.journal.append(balanceChange{ account: &s.address, - prev: new(big.Int).Set(s.account.Balance), + prev: new(uint256.Int).Set(s.account.Balance), }) s.setBalance(amount) } -func (s *stateObject) setBalance(amount *big.Int) { +func (s *stateObject) setBalance(amount *uint256.Int) { s.account.Balance = amount } @@ -208,7 +208,7 @@ func (s *stateObject) CodeHash() []byte { } // Balance returns the balance of account -func (s *stateObject) Balance() *big.Int { +func (s *stateObject) Balance() *uint256.Int { return s.account.Balance } diff --git a/x/evm/statedb/statedb.go b/x/evm/statedb/statedb.go index 53ef7f4d..4ff5551f 100644 --- a/x/evm/statedb/statedb.go +++ b/x/evm/statedb/statedb.go @@ -17,7 +17,6 @@ package statedb import ( "fmt" - "math/big" "sort" errorsmod "cosmossdk.io/errors" @@ -26,6 +25,7 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" + "github.com/holiman/uint256" "github.com/ethereum/go-ethereum/params" "github.com/zeta-chain/ethermint/store/cachemulti" @@ -175,12 +175,12 @@ func (s *StateDB) Empty(addr common.Address) bool { } // GetBalance retrieves the balance from the given address or 0 if object not found -func (s *StateDB) GetBalance(addr common.Address) *big.Int { +func (s *StateDB) GetBalance(addr common.Address) *uint256.Int { stateObject := s.getStateObject(addr) if stateObject != nil { return stateObject.Balance() } - return common.Big0 + return common.U2560 } // GetNonce returns the nonce of account, 0 if not exists. @@ -380,7 +380,7 @@ func (s *StateDB) CacheContext() sdk.Context { */ // AddBalance adds amount to the account associated with addr. -func (s *StateDB) AddBalance(addr common.Address, amount *big.Int) { +func (s *StateDB) AddBalance(addr common.Address, amount *uint256.Int) { stateObject := s.getOrNewStateObject(addr) if stateObject != nil { stateObject.AddBalance(amount) @@ -388,7 +388,7 @@ func (s *StateDB) AddBalance(addr common.Address, amount *big.Int) { } // SubBalance subtracts amount from the account associated with addr. -func (s *StateDB) SubBalance(addr common.Address, amount *big.Int) { +func (s *StateDB) SubBalance(addr common.Address, amount *uint256.Int) { stateObject := s.getOrNewStateObject(addr) if stateObject != nil { stateObject.SubBalance(amount) @@ -459,10 +459,10 @@ func (s *StateDB) SelfDestruct(addr common.Address) { s.journal.append(suicideChange{ account: &addr, prev: stateObject.suicided, - prevbalance: new(big.Int).Set(stateObject.Balance()), + prevbalance: new(uint256.Int).Set(stateObject.Balance()), }) stateObject.markSuicided() - stateObject.account.Balance = new(big.Int) + stateObject.account.Balance = new(uint256.Int) } func (s *StateDB) Selfdestruct6780(addr common.Address) { diff --git a/x/evm/statedb/statedb_test.go b/x/evm/statedb/statedb_test.go index 9b585baf..2fd61237 100644 --- a/x/evm/statedb/statedb_test.go +++ b/x/evm/statedb/statedb_test.go @@ -7,6 +7,7 @@ import ( consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + "github.com/holiman/uint256" dbm "github.com/cometbft/cometbft-db" "github.com/cometbft/cometbft/libs/log" @@ -61,7 +62,7 @@ func (suite *StateDBTestSuite) TestAccount() { {"non-exist account", func(db *statedb.StateDB, cms sdk.MultiStore) { suite.Require().Equal(false, db.Exist(address)) suite.Require().Equal(true, db.Empty(address)) - suite.Require().Equal(big.NewInt(0), db.GetBalance(address)) + suite.Require().Equal(uint256.NewInt(0), db.GetBalance(address)) suite.Require().Equal([]byte(nil), db.GetCode(address)) suite.Require().Equal(common.Hash{}, db.GetCodeHash(address)) suite.Require().Equal(uint64(0), db.GetNonce(address)) @@ -78,7 +79,7 @@ func (suite *StateDBTestSuite) TestAccount() { db = statedb.New(ctx, keeper, txConfig) suite.Require().Equal(true, db.Exist(address)) suite.Require().Equal(true, db.Empty(address)) - suite.Require().Equal(big.NewInt(0), db.GetBalance(address)) + suite.Require().Equal(uint256.NewInt(0), db.GetBalance(address)) suite.Require().Equal([]byte(nil), db.GetCode(address)) suite.Require().Equal(common.BytesToHash(emptyCodeHash), db.GetCodeHash(address)) suite.Require().Equal(uint64(0), db.GetNonce(address)) @@ -91,7 +92,7 @@ func (suite *StateDBTestSuite) TestAccount() { // create a contract account db.CreateAccount(address) db.SetCode(address, []byte("hello world")) - db.AddBalance(address, big.NewInt(100)) + db.AddBalance(address, uint256.NewInt(100)) db.SetState(address, key1, value1) db.SetState(address, key2, value2) codeHash := db.GetCodeHash(address) @@ -110,7 +111,7 @@ func (suite *StateDBTestSuite) TestAccount() { // check dirty state suite.Require().True(db.HasSelfDestructed(address)) // balance is cleared - suite.Require().Equal(big.NewInt(0), db.GetBalance(address)) + suite.Require().Equal(uint256.NewInt(0), db.GetBalance(address)) // but code and state are still accessible in dirty state suite.Require().Equal(value1, db.GetState(address, key1)) suite.Require().Equal([]byte("hello world"), db.GetCode(address)) @@ -142,7 +143,7 @@ func (suite *StateDBTestSuite) TestAccountOverride() { _, ctx, keeper := setupTestEnv(suite.T()) db := statedb.New(ctx, keeper, emptyTxConfig) // test balance carry over when overwritten - amount := big.NewInt(1) + amount := uint256.NewInt(1) // init an EOA account, account overriden only happens on EOA account. db.AddBalance(address, amount) @@ -184,23 +185,23 @@ func (suite *StateDBTestSuite) TestBalance() { testCases := []struct { name string malleate func(*statedb.StateDB, sdk.MultiStore) - expBalance *big.Int + expBalance *uint256.Int }{ {"add balance", func(db *statedb.StateDB, cms sdk.MultiStore) { - db.AddBalance(address, big.NewInt(10)) - }, big.NewInt(10)}, + db.AddBalance(address, uint256.NewInt(10)) + }, uint256.NewInt(10)}, {"sub balance", func(db *statedb.StateDB, cms sdk.MultiStore) { - db.AddBalance(address, big.NewInt(10)) + db.AddBalance(address, uint256.NewInt(10)) // get dirty balance - suite.Require().Equal(big.NewInt(10), db.GetBalance(address)) - db.SubBalance(address, big.NewInt(2)) - }, big.NewInt(8)}, + suite.Require().Equal(uint256.NewInt(10), db.GetBalance(address)) + db.SubBalance(address, uint256.NewInt(2)) + }, uint256.NewInt(8)}, {"add zero balance", func(db *statedb.StateDB, cms sdk.MultiStore) { - db.AddBalance(address, big.NewInt(0)) - }, big.NewInt(0)}, + db.AddBalance(address, uint256.NewInt(0)) + }, uint256.NewInt(0)}, {"sub zero balance", func(db *statedb.StateDB, cms sdk.MultiStore) { - db.SubBalance(address, big.NewInt(0)) - }, big.NewInt(0)}, + db.SubBalance(address, uint256.NewInt(0)) + }, uint256.NewInt(0)}, } for _, tc := range testCases { @@ -213,7 +214,7 @@ func (suite *StateDBTestSuite) TestBalance() { suite.Require().Equal(tc.expBalance, db.GetBalance(address)) suite.Require().NoError(db.Commit()) // check committed balance too - suite.Require().Equal(tc.expBalance, keeper.GetBalance(ctx, address)) + suite.Require().Equal(tc.expBalance.String(), keeper.GetBalance(ctx, address).String()) }) } } @@ -341,8 +342,8 @@ func (suite *StateDBTestSuite) TestRevertSnapshot() { db.SetNonce(address, 10) }}, {"change balance", func(db vm.StateDB) { - db.AddBalance(address, big.NewInt(10)) - db.SubBalance(address, big.NewInt(5)) + db.AddBalance(address, uint256.NewInt(10)) + db.SubBalance(address, uint256.NewInt(5)) }}, {"override account", func(db vm.StateDB) { db.CreateAccount(address) @@ -379,7 +380,7 @@ func (suite *StateDBTestSuite) TestRevertSnapshot() { // do some arbitrary changes to the storage db := statedb.New(ctx, keeper, emptyTxConfig) db.SetNonce(address, 1) - db.AddBalance(address, big.NewInt(100)) + db.AddBalance(address, uint256.NewInt(100)) db.SetCode(address, []byte("hello world")) db.SetState(address, v1, v2) db.SetNonce(address2, 1) From a8bc9b954b4093e833ff23ac8e6be43ab6866976 Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Fri, 18 Oct 2024 15:44:50 -0700 Subject: [PATCH 03/12] Update expected tracer test output to include instrinsic gas https://github.com/ethereum/go-ethereum/pull/26048 --- tests/integration_tests/expected_constants.py | 9 ++++----- x/evm/keeper/state_transition.go | 7 ++++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/integration_tests/expected_constants.py b/tests/integration_tests/expected_constants.py index e3d39d85..8a18ccd8 100644 --- a/tests/integration_tests/expected_constants.py +++ b/tests/integration_tests/expected_constants.py @@ -134,10 +134,9 @@ EXPECTED_CALLTRACERS = { "from": "0x57f96e6b86cdefdb3d412547816a82e3e0ebf9d2", - "gas": "0x0", - "gasUsed": "0x0", + "gas": "0x5208", + "gasUsed": "0x5208", "input": "0x", - "output": "0x", "to": "0x378c50d9264c63f3f92b806d4ee56e9d86ffb3ec", "type": "CALL", "value": "0x64", @@ -152,8 +151,8 @@ EXPECTED_CONTRACT_CREATE_TRACER = { "from": "0x57f96e6b86cdefdb3d412547816a82e3e0ebf9d2", - "gas": "0x7ef9d", - "gasUsed": "0x7ef9d", + "gas": "0x96651", + "gasUsed": "0x96651", "input": "0x608060405234801561001057600080fd5b50604080518082018252600981526805465737445524332360bc1b60208083019182528351808501909452600484526315195cdd60e21b90840152815191929161005c91600391610156565b508051610070906004906020840190610156565b50505061008e336a52b7d2dcc80cd2e400000061009360201b60201c565b610250565b6001600160a01b0382166100ed5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b80600260008282546100ff91906101ef565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b82805461016290610215565b90600052602060002090601f01602090048101928261018457600085556101ca565b82601f1061019d57805160ff19168380011785556101ca565b828001600101855582156101ca579182015b828111156101ca5782518255916020019190600101906101af565b506101d69291506101da565b5090565b5b808211156101d657600081556001016101db565b6000821982111561021057634e487b7160e01b600052601160045260246000fd5b500190565b600181811c9082168061022957607f821691505b6020821081141561024a57634e487b7160e01b600052602260045260246000fd5b50919050565b61085d8061025f6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461012357806370a082311461013657806395d89b411461015f578063a457c2d714610167578063a9059cbb1461017a578063dd62ed3e1461018d57600080fd5b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ef57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b66101a0565b6040516100c3919061069a565b60405180910390f35b6100df6100da36600461070b565b610232565b60405190151581526020016100c3565b6002545b6040519081526020016100c3565b6100df61010f366004610735565b61024a565b604051601281526020016100c3565b6100df61013136600461070b565b61026e565b6100f3610144366004610771565b6001600160a01b031660009081526020819052604090205490565b6100b6610290565b6100df61017536600461070b565b61029f565b6100df61018836600461070b565b61031f565b6100f361019b366004610793565b61032d565b6060600380546101af906107c6565b80601f01602080910402602001604051908101604052809291908181526020018280546101db906107c6565b80156102285780601f106101fd57610100808354040283529160200191610228565b820191906000526020600020905b81548152906001019060200180831161020b57829003601f168201915b5050505050905090565b600033610240818585610358565b5060019392505050565b60003361025885828561047c565b6102638585856104f6565b506001949350505050565b600033610240818585610281838361032d565b61028b9190610801565b610358565b6060600480546101af906107c6565b600033816102ad828661032d565b9050838110156103125760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084015b60405180910390fd5b6102638286868403610358565b6000336102408185856104f6565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0383166103ba5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610309565b6001600160a01b03821661041b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610309565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610488848461032d565b905060001981146104f057818110156104e35760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610309565b6104f08484848403610358565b50505050565b6001600160a01b03831661055a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610309565b6001600160a01b0382166105bc5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610309565b6001600160a01b038316600090815260208190526040902054818110156106345760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610309565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36104f0565b600060208083528351808285015260005b818110156106c7578581018301518582016040015282016106ab565b818111156106d9576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461070657600080fd5b919050565b6000806040838503121561071e57600080fd5b610727836106ef565b946020939093013593505050565b60008060006060848603121561074a57600080fd5b610753846106ef565b9250610761602085016106ef565b9150604084013590509250925092565b60006020828403121561078357600080fd5b61078c826106ef565b9392505050565b600080604083850312156107a657600080fd5b6107af836106ef565b91506107bd602084016106ef565b90509250929050565b600181811c908216806107da57607f821691505b602082108114156107fb57634e487b7160e01b600052602260045260246000fd5b50919050565b6000821982111561082257634e487b7160e01b600052601160045260246000fd5b50019056fea2646970667358221220fee840cc9e1cfac46e073588ade030be1401c580c5849dd4e63f659a75eb220c64736f6c634300080a0033", # noqa: E501 "output": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461012357806370a082311461013657806395d89b411461015f578063a457c2d714610167578063a9059cbb1461017a578063dd62ed3e1461018d57600080fd5b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ef57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b66101a0565b6040516100c3919061069a565b60405180910390f35b6100df6100da36600461070b565b610232565b60405190151581526020016100c3565b6002545b6040519081526020016100c3565b6100df61010f366004610735565b61024a565b604051601281526020016100c3565b6100df61013136600461070b565b61026e565b6100f3610144366004610771565b6001600160a01b031660009081526020819052604090205490565b6100b6610290565b6100df61017536600461070b565b61029f565b6100df61018836600461070b565b61031f565b6100f361019b366004610793565b61032d565b6060600380546101af906107c6565b80601f01602080910402602001604051908101604052809291908181526020018280546101db906107c6565b80156102285780601f106101fd57610100808354040283529160200191610228565b820191906000526020600020905b81548152906001019060200180831161020b57829003601f168201915b5050505050905090565b600033610240818585610358565b5060019392505050565b60003361025885828561047c565b6102638585856104f6565b506001949350505050565b600033610240818585610281838361032d565b61028b9190610801565b610358565b6060600480546101af906107c6565b600033816102ad828661032d565b9050838110156103125760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084015b60405180910390fd5b6102638286868403610358565b6000336102408185856104f6565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0383166103ba5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610309565b6001600160a01b03821661041b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610309565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610488848461032d565b905060001981146104f057818110156104e35760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610309565b6104f08484848403610358565b50505050565b6001600160a01b03831661055a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610309565b6001600160a01b0382166105bc5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610309565b6001600160a01b038316600090815260208190526040902054818110156106345760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610309565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36104f0565b600060208083528351808285015260005b818110156106c7578581018301518582016040015282016106ab565b818111156106d9576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461070657600080fd5b919050565b6000806040838503121561071e57600080fd5b610727836106ef565b946020939093013593505050565b60008060006060848603121561074a57600080fd5b610753846106ef565b9250610761602085016106ef565b9150604084013590509250925092565b60006020828403121561078357600080fd5b61078c826106ef565b9392505050565b600080604083850312156107a657600080fd5b6107af836106ef565b91506107bd602084016106ef565b90509250929050565b600181811c908216806107da57607f821691505b602082108114156107fb57634e487b7160e01b600052602260045260246000fd5b50919050565b6000821982111561082257634e487b7160e01b600052601160045260246000fd5b50019056fea2646970667358221220fee840cc9e1cfac46e073588ade030be1401c580c5849dd4e63f659a75eb220c64736f6c634300080a0033", # noqa: E501 "to": "0x8c76cfc1934d5120cc673b6e5ddf7b88feb1c18c", diff --git a/x/evm/keeper/state_transition.go b/x/evm/keeper/state_transition.go index 0d61350c..b667b6d9 100644 --- a/x/evm/keeper/state_transition.go +++ b/x/evm/keeper/state_transition.go @@ -357,10 +357,11 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, leftoverGas := msg.GasLimit // Allow the tracer captures the tx level events, mainly the gas consumption. - if tracer != nil { - tracer.CaptureTxStart(leftoverGas) + vmCfg := evm.Config + if vmCfg.Tracer != nil { + vmCfg.Tracer.CaptureTxStart(leftoverGas) defer func() { - tracer.CaptureTxEnd(leftoverGas) + vmCfg.Tracer.CaptureTxEnd(leftoverGas) }() } From e2283829aa2637b78868af703f059e1a4914bdff Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Tue, 22 Oct 2024 11:43:55 -0700 Subject: [PATCH 04/12] fix go-ethereum spc --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index eb537f31..4eb97a7c 100644 --- a/go.mod +++ b/go.mod @@ -241,4 +241,4 @@ replace ( ) // ZetaChain maintained replacements -replace github.com/ethereum/go-ethereum => github.com/zeta-chain/go-ethereum v1.13.16-0.20241018211122-a3509360e99b +replace github.com/ethereum/go-ethereum => github.com/zeta-chain/go-ethereum v1.13.16-0.20241022183758-422c6ef93ccc diff --git a/go.sum b/go.sum index a93ce8bd..f52f5639 100644 --- a/go.sum +++ b/go.sum @@ -1143,8 +1143,8 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/zeta-chain/go-ethereum v1.13.16-0.20241018211122-a3509360e99b h1:b8YPHSJ9sE86yZ085rN2kmjVTtWqfkV7fOISSFkuQAw= -github.com/zeta-chain/go-ethereum v1.13.16-0.20241018211122-a3509360e99b/go.mod h1:TN8ZiHrdJwSe8Cb6x+p0hs5CxhJZPbqB7hHkaUXcmIU= +github.com/zeta-chain/go-ethereum v1.13.16-0.20241022183758-422c6ef93ccc h1:FVOttT/f7QCZMkOLssLTY1cbX8pT+HS/kg81zgUAmYE= +github.com/zeta-chain/go-ethereum v1.13.16-0.20241022183758-422c6ef93ccc/go.mod h1:MgO2/CmxFnj6W7v/5hrz3ypco3kHkb8856pRnFkY4xQ= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= From 19678f364a1932c9dd38965135af2ba372504531 Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Thu, 24 Oct 2024 10:20:48 -0700 Subject: [PATCH 05/12] always import types as ethermint --- app/ante/sigverify.go | 4 ++-- ethereum/eip712/encoding_legacy.go | 3 ++- gomod2nix.toml | 4 ++-- rpc/backend/sign_tx.go | 4 ++-- .../keeper/state_transition_benchmark_test.go | 4 ++-- x/evm/types/access_list_tx.go | 14 +++++++------- x/evm/types/dynamic_fee_tx.go | 18 +++++++++--------- x/evm/types/legacy_tx.go | 14 +++++++------- x/evm/types/msg.go | 4 ++-- x/evm/types/params.go | 4 ++-- 10 files changed, 37 insertions(+), 36 deletions(-) diff --git a/app/ante/sigverify.go b/app/ante/sigverify.go index 864167e2..8565ddeb 100644 --- a/app/ante/sigverify.go +++ b/app/ante/sigverify.go @@ -21,7 +21,7 @@ import ( errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" errortypes "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/zeta-chain/ethermint/types" + ethermint "github.com/zeta-chain/ethermint/types" evmtypes "github.com/zeta-chain/ethermint/x/evm/types" ) @@ -48,7 +48,7 @@ func (esvd EthSigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, s chainCfg := evmParams.GetChainConfig() ethCfg := chainCfg.EthereumConfig(chainID) blockNum := big.NewInt(ctx.BlockHeight()) - signer := types.MakeSigner(ethCfg, blockNum) + signer := ethermint.MakeSigner(ethCfg, blockNum) for _, msg := range tx.GetMsgs() { msgEthTx, ok := msg.(*evmtypes.MsgEthereumTx) diff --git a/ethereum/eip712/encoding_legacy.go b/ethereum/eip712/encoding_legacy.go index eb8bfa18..249d811a 100644 --- a/ethereum/eip712/encoding_legacy.go +++ b/ethereum/eip712/encoding_legacy.go @@ -27,6 +27,7 @@ import ( apitypes "github.com/ethereum/go-ethereum/signer/core/apitypes" "github.com/zeta-chain/ethermint/types" + ethermint "github.com/zeta-chain/ethermint/types" ) type aminoMessage struct { @@ -178,7 +179,7 @@ func legacyDecodeProtobufSignDoc(signDocBytes []byte) (apitypes.TypedData, error signerInfo := authInfo.SignerInfos[0] - chainID, err := types.ParseChainID(signDoc.ChainId) + chainID, err := ethermint.ParseChainID(signDoc.ChainId) if err != nil { return apitypes.TypedData{}, fmt.Errorf("invalid chain ID passed as argument: %w", err) } diff --git a/gomod2nix.toml b/gomod2nix.toml index 38746288..2a8aa9d4 100644 --- a/gomod2nix.toml +++ b/gomod2nix.toml @@ -217,8 +217,8 @@ schema = 3 version = "v0.4.0" hash = "sha256-Ol5bznli6Dh5uXi8GUGsjZo8DzCdF0hqsUMwDNUpxP0=" [mod."github.com/ethereum/go-ethereum"] - version = "v1.13.16-0.20241018211122-a3509360e99b" - hash = "sha256-ijnOmKYj308G5WOlFVkMFcQ7AqMdtxrWCadikdpTVkY=" + version = "v1.13.16-0.20241022183758-422c6ef93ccc" + hash = "sha256-Nxipk3PKrfSb/IxBz6r69rPtcnFSDMYj0UWOC0WJibI=" replaced = "github.com/zeta-chain/go-ethereum" [mod."github.com/felixge/httpsnoop"] version = "v1.0.4" diff --git a/rpc/backend/sign_tx.go b/rpc/backend/sign_tx.go index 112e8086..4204b5e5 100644 --- a/rpc/backend/sign_tx.go +++ b/rpc/backend/sign_tx.go @@ -29,7 +29,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/signer/core/apitypes" - "github.com/zeta-chain/ethermint/types" + ethermint "github.com/zeta-chain/ethermint/types" evmtypes "github.com/zeta-chain/ethermint/x/evm/types" ) @@ -63,7 +63,7 @@ func (b *Backend) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, e return common.Hash{}, err } - signer := types.MakeSigner(b.ChainConfig(), new(big.Int).SetUint64(uint64(bn))) + signer := ethermint.MakeSigner(b.ChainConfig(), new(big.Int).SetUint64(uint64(bn))) // Sign transaction if err := msg.Sign(signer, b.clientCtx.Keyring); err != nil { diff --git a/x/evm/keeper/state_transition_benchmark_test.go b/x/evm/keeper/state_transition_benchmark_test.go index cc251bbc..e1cfcf22 100644 --- a/x/evm/keeper/state_transition_benchmark_test.go +++ b/x/evm/keeper/state_transition_benchmark_test.go @@ -12,7 +12,7 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/params" "github.com/stretchr/testify/require" - "github.com/zeta-chain/ethermint/types" + ethermint "github.com/zeta-chain/ethermint/types" evmtypes "github.com/zeta-chain/ethermint/x/evm/types" ) @@ -145,7 +145,7 @@ func newNativeMessage( data []byte, accessList ethtypes.AccessList, ) (*core.Message, error) { - msgSigner := types.MakeSigner(cfg, big.NewInt(blockHeight)) + msgSigner := ethermint.MakeSigner(cfg, big.NewInt(blockHeight)) msg, baseFee, err := newEthMsgTx(nonce, blockHeight, address, cfg, krSigner, ethSigner, txType, data, accessList) if err != nil { diff --git a/x/evm/types/access_list_tx.go b/x/evm/types/access_list_tx.go index dbb41252..46f323b1 100644 --- a/x/evm/types/access_list_tx.go +++ b/x/evm/types/access_list_tx.go @@ -25,7 +25,7 @@ import ( "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/zeta-chain/ethermint/types" + ethermint "github.com/zeta-chain/ethermint/types" ) func newAccessListTx(tx *ethtypes.Transaction) (*AccessListTx, error) { @@ -41,7 +41,7 @@ func newAccessListTx(tx *ethtypes.Transaction) (*AccessListTx, error) { } if tx.Value() != nil { - amountInt, err := types.SafeNewIntFromBigInt(tx.Value()) + amountInt, err := ethermint.SafeNewIntFromBigInt(tx.Value()) if err != nil { return nil, err } @@ -49,7 +49,7 @@ func newAccessListTx(tx *ethtypes.Transaction) (*AccessListTx, error) { } if tx.GasPrice() != nil { - gasPriceInt, err := types.SafeNewIntFromBigInt(tx.GasPrice()) + gasPriceInt, err := ethermint.SafeNewIntFromBigInt(tx.GasPrice()) if err != nil { return nil, err } @@ -201,7 +201,7 @@ func (tx AccessListTx) Validate() error { if gasPrice == nil { return errorsmod.Wrap(ErrInvalidGasPrice, "cannot be nil") } - if !types.IsValidInt256(gasPrice) { + if !ethermint.IsValidInt256(gasPrice) { return errorsmod.Wrap(ErrInvalidGasPrice, "out of bound") } @@ -214,16 +214,16 @@ func (tx AccessListTx) Validate() error { if amount != nil && amount.Sign() == -1 { return errorsmod.Wrapf(ErrInvalidAmount, "amount cannot be negative %s", amount) } - if !types.IsValidInt256(amount) { + if !ethermint.IsValidInt256(amount) { return errorsmod.Wrap(ErrInvalidAmount, "out of bound") } - if !types.IsValidInt256(tx.Fee()) { + if !ethermint.IsValidInt256(tx.Fee()) { return errorsmod.Wrap(ErrInvalidGasFee, "out of bound") } if tx.To != "" { - if err := types.ValidateAddress(tx.To); err != nil { + if err := ethermint.ValidateAddress(tx.To); err != nil { return errorsmod.Wrap(err, "invalid to address") } } diff --git a/x/evm/types/dynamic_fee_tx.go b/x/evm/types/dynamic_fee_tx.go index d4e051e3..37626f34 100644 --- a/x/evm/types/dynamic_fee_tx.go +++ b/x/evm/types/dynamic_fee_tx.go @@ -25,7 +25,7 @@ import ( "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/zeta-chain/ethermint/types" + ethermint "github.com/zeta-chain/ethermint/types" ) func newDynamicFeeTx(tx *ethtypes.Transaction) (*DynamicFeeTx, error) { @@ -41,7 +41,7 @@ func newDynamicFeeTx(tx *ethtypes.Transaction) (*DynamicFeeTx, error) { } if tx.Value() != nil { - amountInt, err := types.SafeNewIntFromBigInt(tx.Value()) + amountInt, err := ethermint.SafeNewIntFromBigInt(tx.Value()) if err != nil { return nil, err } @@ -49,7 +49,7 @@ func newDynamicFeeTx(tx *ethtypes.Transaction) (*DynamicFeeTx, error) { } if tx.GasFeeCap() != nil { - gasFeeCapInt, err := types.SafeNewIntFromBigInt(tx.GasFeeCap()) + gasFeeCapInt, err := ethermint.SafeNewIntFromBigInt(tx.GasFeeCap()) if err != nil { return nil, err } @@ -57,7 +57,7 @@ func newDynamicFeeTx(tx *ethtypes.Transaction) (*DynamicFeeTx, error) { } if tx.GasTipCap() != nil { - gasTipCapInt, err := types.SafeNewIntFromBigInt(tx.GasTipCap()) + gasTipCapInt, err := ethermint.SafeNewIntFromBigInt(tx.GasTipCap()) if err != nil { return nil, err } @@ -226,11 +226,11 @@ func (tx DynamicFeeTx) Validate() error { return errorsmod.Wrapf(ErrInvalidGasCap, "gas fee cap cannot be negative %s", tx.GasFeeCap) } - if !types.IsValidInt256(tx.GetGasTipCap()) { + if !ethermint.IsValidInt256(tx.GetGasTipCap()) { return errorsmod.Wrap(ErrInvalidGasCap, "out of bound") } - if !types.IsValidInt256(tx.GetGasFeeCap()) { + if !ethermint.IsValidInt256(tx.GetGasFeeCap()) { return errorsmod.Wrap(ErrInvalidGasCap, "out of bound") } @@ -241,7 +241,7 @@ func (tx DynamicFeeTx) Validate() error { ) } - if !types.IsValidInt256(tx.Fee()) { + if !ethermint.IsValidInt256(tx.Fee()) { return errorsmod.Wrap(ErrInvalidGasFee, "out of bound") } @@ -250,12 +250,12 @@ func (tx DynamicFeeTx) Validate() error { if amount != nil && amount.Sign() == -1 { return errorsmod.Wrapf(ErrInvalidAmount, "amount cannot be negative %s", amount) } - if !types.IsValidInt256(amount) { + if !ethermint.IsValidInt256(amount) { return errorsmod.Wrap(ErrInvalidAmount, "out of bound") } if tx.To != "" { - if err := types.ValidateAddress(tx.To); err != nil { + if err := ethermint.ValidateAddress(tx.To); err != nil { return errorsmod.Wrap(err, "invalid to address") } } diff --git a/x/evm/types/legacy_tx.go b/x/evm/types/legacy_tx.go index 35eb2d50..39c943b2 100644 --- a/x/evm/types/legacy_tx.go +++ b/x/evm/types/legacy_tx.go @@ -21,7 +21,7 @@ import ( errorsmod "cosmossdk.io/errors" "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/zeta-chain/ethermint/types" + ethermint "github.com/zeta-chain/ethermint/types" ) func newLegacyTx(tx *ethtypes.Transaction) (*LegacyTx, error) { @@ -37,7 +37,7 @@ func newLegacyTx(tx *ethtypes.Transaction) (*LegacyTx, error) { } if tx.Value() != nil { - amountInt, err := types.SafeNewIntFromBigInt(tx.Value()) + amountInt, err := ethermint.SafeNewIntFromBigInt(tx.Value()) if err != nil { return nil, err } @@ -45,7 +45,7 @@ func newLegacyTx(tx *ethtypes.Transaction) (*LegacyTx, error) { } if tx.GasPrice() != nil { - gasPriceInt, err := types.SafeNewIntFromBigInt(tx.GasPrice()) + gasPriceInt, err := ethermint.SafeNewIntFromBigInt(tx.GasPrice()) if err != nil { return nil, err } @@ -181,10 +181,10 @@ func (tx LegacyTx) Validate() error { if gasPrice.Sign() == -1 { return errorsmod.Wrapf(ErrInvalidGasPrice, "gas price cannot be negative %s", gasPrice) } - if !types.IsValidInt256(gasPrice) { + if !ethermint.IsValidInt256(gasPrice) { return errorsmod.Wrap(ErrInvalidGasPrice, "out of bound") } - if !types.IsValidInt256(tx.Fee()) { + if !ethermint.IsValidInt256(tx.Fee()) { return errorsmod.Wrap(ErrInvalidGasFee, "out of bound") } @@ -193,12 +193,12 @@ func (tx LegacyTx) Validate() error { if amount != nil && amount.Sign() == -1 { return errorsmod.Wrapf(ErrInvalidAmount, "amount cannot be negative %s", amount) } - if !types.IsValidInt256(amount) { + if !ethermint.IsValidInt256(amount) { return errorsmod.Wrap(ErrInvalidAmount, "out of bound") } if tx.To != "" { - if err := types.ValidateAddress(tx.To); err != nil { + if err := ethermint.ValidateAddress(tx.To); err != nil { return errorsmod.Wrap(err, "invalid to address") } } diff --git a/x/evm/types/msg.go b/x/evm/types/msg.go index dac225af..d046482d 100644 --- a/x/evm/types/msg.go +++ b/x/evm/types/msg.go @@ -32,7 +32,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/signing" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" - "github.com/zeta-chain/ethermint/types" + ethermint "github.com/zeta-chain/ethermint/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/math" @@ -182,7 +182,7 @@ func (msg MsgEthereumTx) Type() string { return TypeMsgEthereumTx } // checks of a Transaction. If returns an error if validation fails. func (msg MsgEthereumTx) ValidateBasic() error { if msg.From != "" { - if err := types.ValidateAddress(msg.From); err != nil { + if err := ethermint.ValidateAddress(msg.From); err != nil { return errorsmod.Wrap(err, "invalid from address") } } diff --git a/x/evm/types/params.go b/x/evm/types/params.go index a5da0523..a94fd1bc 100644 --- a/x/evm/types/params.go +++ b/x/evm/types/params.go @@ -23,12 +23,12 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/core/vm" - "github.com/zeta-chain/ethermint/types" + ethermint "github.com/zeta-chain/ethermint/types" ) var ( // DefaultEVMDenom defines the default EVM denomination on Ethermint - DefaultEVMDenom = types.AttoPhoton + DefaultEVMDenom = ethermint.AttoPhoton // DefaultAllowUnprotectedTxs rejects all unprotected txs (i.e false) DefaultAllowUnprotectedTxs = false // DefaultEnableCreate enables contract creation (i.e true) From d0079a8ef8b03347cd91be67dd382707238d5d74 Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Thu, 24 Oct 2024 10:24:05 -0700 Subject: [PATCH 06/12] Use Eq to compare uint256 --- x/evm/keeper/statedb_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/x/evm/keeper/statedb_test.go b/x/evm/keeper/statedb_test.go index 9f8fe1fb..b493bd5c 100644 --- a/x/evm/keeper/statedb_test.go +++ b/x/evm/keeper/statedb_test.go @@ -89,9 +89,9 @@ func (suite *KeeperTestSuite) TestAddBalance() { post := vmdb.GetBalance(suite.address) if tc.isNoOp { - suite.Require().Equal(prev.String(), post.String()) + suite.Require().True(prev.Eq(post)) } else { - suite.Require().Equal(new(uint256.Int).Add(prev, tc.amount).String(), post.String()) + suite.Require().True(new(uint256.Int).Add(prev, tc.amount).Eq(post)) } }) } @@ -136,9 +136,9 @@ func (suite *KeeperTestSuite) TestSubBalance() { post := vmdb.GetBalance(suite.address) if tc.isNoOp { - suite.Require().Equal(prev.String(), post.String()) + suite.Require().True(prev.Eq(post)) } else { - suite.Require().Equal(new(uint256.Int).Sub(prev, tc.amount).String(), post.String()) + suite.Require().True(new(uint256.Int).Sub(prev, tc.amount).Eq(post)) } }) } From 0ccc301b3233f53089a135dc3edd73e2456df8c2 Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Thu, 24 Oct 2024 10:35:18 -0700 Subject: [PATCH 07/12] use uint256.NewInt(0) for clarity --- x/evm/statedb/statedb.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/evm/statedb/statedb.go b/x/evm/statedb/statedb.go index 4ff5551f..3fa7a47f 100644 --- a/x/evm/statedb/statedb.go +++ b/x/evm/statedb/statedb.go @@ -462,7 +462,7 @@ func (s *StateDB) SelfDestruct(addr common.Address) { prevbalance: new(uint256.Int).Set(stateObject.Balance()), }) stateObject.markSuicided() - stateObject.account.Balance = new(uint256.Int) + stateObject.account.Balance = uint256.NewInt(0) } func (s *StateDB) Selfdestruct6780(addr common.Address) { From 4a032cde0847943b3a1dd4b60aa308f833d3958d Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Thu, 24 Oct 2024 10:51:46 -0700 Subject: [PATCH 08/12] minimal linter fixes --- ethereum/eip712/encoding.go | 8 ++++---- ethereum/eip712/encoding_legacy.go | 3 +-- server/json_rpc.go | 4 ++-- tests/integration_tests/expected_constants.py | 4 ++-- testutil/tx/eip712.go | 8 ++++---- x/evm/statedb/journal.go | 8 -------- x/evm/statedb/statedb.go | 2 -- 7 files changed, 13 insertions(+), 24 deletions(-) diff --git a/ethereum/eip712/encoding.go b/ethereum/eip712/encoding.go index 144bffc4..af69fd58 100644 --- a/ethereum/eip712/encoding.go +++ b/ethereum/eip712/encoding.go @@ -25,7 +25,7 @@ import ( txTypes "github.com/cosmos/cosmos-sdk/types/tx" apitypes "github.com/ethereum/go-ethereum/signer/core/apitypes" - "github.com/zeta-chain/ethermint/types" + ethermint "github.com/zeta-chain/ethermint/types" "github.com/cosmos/cosmos-sdk/codec" ) @@ -39,7 +39,7 @@ var ( // The process of unmarshaling SignDoc bytes into a SignDoc object requires having a codec // populated with all relevant message types. As a result, we must call this method on app // initialization with the app's encoding config. -func SetEncodingConfig(cfg types.EncodingConfig) { +func SetEncodingConfig(cfg ethermint.EncodingConfig) { aminoCodec = cfg.Amino protoCodec = codec.NewProtoCodec(cfg.InterfaceRegistry) } @@ -115,7 +115,7 @@ func decodeAminoSignDoc(signDocBytes []byte) (apitypes.TypedData, error) { return apitypes.TypedData{}, err } - chainID, err := types.ParseChainID(aminoDoc.ChainID) + chainID, err := ethermint.ParseChainID(aminoDoc.ChainID) if err != nil { return apitypes.TypedData{}, errors.New("invalid chain ID passed as argument") } @@ -179,7 +179,7 @@ func decodeProtobufSignDoc(signDocBytes []byte) (apitypes.TypedData, error) { signerInfo := authInfo.SignerInfos[0] - chainID, err := types.ParseChainID(signDoc.ChainId) + chainID, err := ethermint.ParseChainID(signDoc.ChainId) if err != nil { return apitypes.TypedData{}, fmt.Errorf("invalid chain ID passed as argument: %w", err) } diff --git a/ethereum/eip712/encoding_legacy.go b/ethereum/eip712/encoding_legacy.go index 249d811a..0a360cd8 100644 --- a/ethereum/eip712/encoding_legacy.go +++ b/ethereum/eip712/encoding_legacy.go @@ -26,7 +26,6 @@ import ( txTypes "github.com/cosmos/cosmos-sdk/types/tx" apitypes "github.com/ethereum/go-ethereum/signer/core/apitypes" - "github.com/zeta-chain/ethermint/types" ethermint "github.com/zeta-chain/ethermint/types" ) @@ -109,7 +108,7 @@ func legacyDecodeAminoSignDoc(signDocBytes []byte) (apitypes.TypedData, error) { FeePayer: feePayer, } - chainID, err := types.ParseChainID(aminoDoc.ChainID) + chainID, err := ethermint.ParseChainID(aminoDoc.ChainID) if err != nil { return apitypes.TypedData{}, errors.New("invalid chain ID passed as argument") } diff --git a/server/json_rpc.go b/server/json_rpc.go index 88cb278d..658e9238 100644 --- a/server/json_rpc.go +++ b/server/json_rpc.go @@ -46,7 +46,7 @@ func (g *gethLogsToTm) Enabled(_ context.Context, _ slog.Level) bool { return true } -func (g *gethLogsToTm) Handle(ctx context.Context, record slog.Record) error { +func (g *gethLogsToTm) Handle(_ context.Context, record slog.Record) error { attrs := g.attrs record.Attrs(func(attr slog.Attr) bool { attrs = append(attrs, attr) @@ -72,7 +72,7 @@ func (g *gethLogsToTm) WithAttrs(attrs []slog.Attr) slog.Handler { } } -func (g *gethLogsToTm) WithGroup(name string) slog.Handler { +func (g *gethLogsToTm) WithGroup(_ string) slog.Handler { return g } diff --git a/tests/integration_tests/expected_constants.py b/tests/integration_tests/expected_constants.py index 8a18ccd8..7243834b 100644 --- a/tests/integration_tests/expected_constants.py +++ b/tests/integration_tests/expected_constants.py @@ -19,8 +19,8 @@ "0xf90211a07e164dfd7f1ae0e9c7a5276c54f44dde92965a6c2f33a6ab70f15837e7334846a08d1f58f0b8113267e9ae0b00cc2814bafd7abdf64ef092da4022252723ec4009a08e4bd9b065fa8dab94bac469f47a04f2c6cd269c5345de50566a54ec34ef21dba0f9a8d5511d60abf59d66a80a252ea86e3f3b6c325eeac5d861fca7e16c4e4111a006ad844c311fe3730f814ed96a75dd268f609c30bd4476c7842d877cb2baa0aaa076e6eedf4846cb47b5343708159de812ab27f6ad350e68ed70a936bcad30401fa0aa867723f3f21a5eb867ed5c5b99609ea535b967f710e547945e3ec2a212c68fa09d3e7fd8cd22ab508d079b58b40f75c3242f7c7704a82ec1c573f682e2168824a0aba33ff032dc7e10fc3a228adbcff47480580b292c4afee754394c6017872d5ca0ec2cd81c2048e35a4bedee1b27e077129edab50a40972c0f6ccd25bd864bedf2a0371c03a000f78dff313551c7afbf52a1348127ab17b737732191dbd64e68b700a0df0aad31c4c0887c6109cadb0d2341a65f18bc35f6e5583ebd417853b9f56329a07c6437031b7543922a3e6a74ae237a844226db3f632a16dffbedd8679b03b018a0538592d2b6933ab7f0d276e7509151632fbca90c10079ee0c9cce87925b19abaa0d79a8e5a546626e60d5d5c7bb839612a42b5724e880deae4bc282f42496a1ef4a03d172648e5e01d32748c96362e197e37a13aeffa0ae213a23b8898e6508bb6a380", # noqa: E501 "0xf90211a07f77a654bce6a83ce5674a2936de6ea0768f4f11e19039c8b83ef62956d2ac15a0854518c708b71c9dfb97eaf4c300c0951108dc96ba9877e565cffced4224fbfca0d60083a3e2bdd537e16b3e2a6e62812fad9b7fbec0e56cb76676007fc1ac44eba0105b6a16896fc82d33f9c742890700b9a0312e37d15c7eb12dde2e015ce8920ea0f127c635dcde1f4898e8abcb45a1a8c07a32cc4d78f2f1fdc7386d26f41dc4aea06916ed562e2b84c6a4145a9a3c5716b5493db0637023347a883a3753522a57fea021b88faa7e7af0a40d03950f42abece8892452c3ce5d94266a36d444c8e84d73a0216e4a004f60aa058d227553b404ee93b5758f28d5bed24d6f3a34157b9a18bba0326b9ef2f85defffc61fc3561349969ff8aef23759ab4a4bd49b8dcd1453ee58a0649731f153d117e5ad56b07e3edfb911b3592009da413d952ff7fc2c1e0c8a25a077edfe281169e6425d0795670d9a33ea32ae11ee71896f9064d5a6189ed6693fa0f986846a0fff0ab469ae226de91e3f350757f49e21f48a57fc7c1e4142fa0c3aa0aae0a489f6e8142bce91638db238a1a2d32cc2c31d82eab86d20c89edca5ac3da04a789fc4610da58da2204e3c9f21e351b574b72c7a4194c996e2bc05d3086376a0184a75c2da01cbc27c48a0335318a60c9535ecd54a79bf96a9f821d8202a2080a0c22686c5baef46ef1364919c08a2cfe113cbc2ac0854d2a890df938538a5c36d80", # noqa: E501 "0xf90211a00b5b38caa0b8e500946e01b36441c04b3932af0af937866756aea01208e630e5a0347a4bd5d736dc5dd178c724de94ca9f3cf351d6cc697f547e115ac955c12762a0fc12087179e3debe3505a5da9cb133650322b5846644289211785ad3ec8c2400a001ef26f67f5ff67e0480d40e9822329c834f2683cc4973d11276c1d252c67d07a0dab8a89872ab8887433393a58c6838f56dd33598c17bc65b67b3975909a1d7d9a0d8e72a6583ec2542c5153d46ff671efcf0e86d3dd6594148be6c8f45b962372aa05d3dfc9d0271fa2e17f1af8a36a105755d7c8ffcd75b523bc9e508d1e4a7f9c5a0367b15490f03ee256758187c63bff678de58c716b94fcee3c68de9b88d4d6d8da0557dd25a49b199b78d194b2c418afcf654415b2db9354b9836490117ac9d768ea0a58e109994f8dccbc777bdf9af2b756c62a1102aba71513f3cbd9aab76fe5d99a034bfcb38403a1a9f3409ea13cb8139f820b702ee757cf87d229949825180a89ea0e3f8b04c275387c6222b6536967f2f1e6fc76dc6ee0e705d3e505f3d07e8bdd4a0deaf89533b13c20ff50ff3f03ff3a2daa8d1329a6a6d17a58c422cbe5ee2f80aa0d0754b6fa85d507289806f64b5ce973e4ded8ec2afb631c2ee13b007eba090cda0a762a467cda2fb000a163abbde837a5d22dc526c8101ad9f32d93dfde1c67765a0508c8133b154fa93189918d82e1048ee0e4094064ddbcee9cfbecf6867546c2380", # noqa: E501 - "0xf90151a000595129cf1c67ce97ed615df7184fb47a0d018d9147a2a7952a639e464cdfd380a052081f67d885b439bee62a1c4e09c02a1ec729aef4d92be6584a29141a79c5c7a0d99cae2bc3b6fc3e8e2767b4d7a5884b9b2d9d20da7890318beefcdb9c7346d58080a0f63571735d99e763dafadb03d1abe3a93a98740ecddc8514d13df46a35a8d94680a081870f4697e57436ccdd8bdc1d624d7bc07861748ff8b3a352334df68f2c03ada0f0252504ee8753335ecf0ca1f73cf13d4505783ed5110bf4e9b384a68ad88f69a0d38a18ef7b993c9ad2d848453e7722c26998ff3d63e243b99cdab0dabf84157ea06e5ad479dbda7f1647ed613e35d837f5d2c697ef34160f3665173186553ee9c280a0bf8371cac505b6ea0cb0f67ef744713f306a2455f3f8844cfa527c62db59c69980a0d6d689405b1cf73786c5fdabb55ec22f9b5712d1ba9c0bfcd46d4b93721fcac780", # noqa: E501 - "0xf8669d37f29e142d49f8824d4e7f1735ec3da219687387629b5fccd86812df84b846f8440180a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a01d93f60f105899172f7255c030301c3af4564edd4a48577dbdc448aec7ddb0ac", # noqa: E501 + "0xf90151a000595129cf1c67ce97ed615df7184fb47a0d018d9147a2a7952a639e464cdfd380a052081f67d885b439bee62a1c4e09c02a1ec729aef4d92be6584a29141a79c5c7a0d99cae2bc3b6fc3e8e2767b4d7a5884b9b2d9d20da7890318beefcdb9c7346d58080a0f63571735d99e763dafadb03d1abe3a93a98740ecddc8514d13df46a35a8d94680a081870f4697e57436ccdd8bdc1d624d7bc07861748ff8b3a352334df68f2c03ada0f0252504ee8753335ecf0ca1f73cf13d4505783ed5110bf4e9b384a68ad88f69a0d38a18ef7b993c9ad2d848453e7722c26998ff3d63e243b99cdab0dabf84157ea06e5ad479dbda7f1647ed613e35d837f5d2c697ef34160f3665173186553ee9c280a0bf8371cac505b6ea0cb0f67ef744713f306a2455f3f8844cfa527c62db59c69980a0d6d689405b1cf73786c5fdabb55ec22f9b5712d1ba9c0bfcd46d4b93721fcac780", # noqa: E501 + "0xf8669d37f29e142d49f8824d4e7f1735ec3da219687387629b5fccd86812df84b846f8440180a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a01d93f60f105899172f7255c030301c3af4564edd4a48577dbdc448aec7ddb0ac", # noqa: E501 ], "address": "0x7f0d15c7faae65896648c8273b6d7e43f58fa842", "balance": "0x0", diff --git a/testutil/tx/eip712.go b/testutil/tx/eip712.go index 854cd08c..9ec95b32 100644 --- a/testutil/tx/eip712.go +++ b/testutil/tx/eip712.go @@ -35,7 +35,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/tx/signing" "github.com/ethereum/go-ethereum/signer/core/apitypes" - "github.com/zeta-chain/ethermint/types" + ethermint "github.com/zeta-chain/ethermint/types" "github.com/zeta-chain/ethermint/app" ) @@ -91,7 +91,7 @@ func PrepareEIP712CosmosTx( ) (client.TxBuilder, error) { txArgs := args.CosmosTxArgs - pc, err := types.ParseChainID(txArgs.ChainID) + pc, err := ethermint.ParseChainID(txArgs.ChainID) if err != nil { return nil, err } @@ -156,7 +156,7 @@ func PrepareEIP712CosmosTx( func createTypedData(args typedDataArgs, useLegacy bool) (apitypes.TypedData, error) { if useLegacy { registry := codectypes.NewInterfaceRegistry() - types.RegisterInterfaces(registry) + ethermint.RegisterInterfaces(registry) cryptocodec.RegisterInterfaces(registry) ethermintCodec := codec.NewProtoCodec(registry) @@ -262,7 +262,7 @@ func getTxSignatureV2(args signatureV2Args, useLegacyExtension bool) signing.Sig // setBuilderLegacyWeb3Extension creates a legacy ExtensionOptionsWeb3Tx and // appends it to the builder options. func setBuilderLegacyWeb3Extension(builder authtx.ExtensionOptionsTxBuilder, args legacyWeb3ExtensionArgs) error { - option, err := codectypes.NewAnyWithValue(&types.ExtensionOptionsWeb3Tx{ + option, err := codectypes.NewAnyWithValue(ðermint.ExtensionOptionsWeb3Tx{ FeePayer: args.feePayer, TypedDataChainID: args.chainID, FeePayerSig: args.signature, diff --git a/x/evm/statedb/journal.go b/x/evm/statedb/journal.go index 865a2862..4dedad56 100644 --- a/x/evm/statedb/journal.go +++ b/x/evm/statedb/journal.go @@ -223,14 +223,6 @@ func (ch transientStorageChange) Dirtied() *common.Address { return nil } -func (ch transientStorageChange) copy() JournalEntry { - return transientStorageChange{ - account: ch.account, - key: ch.key, - prevalue: ch.prevalue, - } -} - func (ch addLogChange) Revert(s *StateDB) { s.logs = s.logs[:len(s.logs)-1] } diff --git a/x/evm/statedb/statedb.go b/x/evm/statedb/statedb.go index 3fa7a47f..70a4a67a 100644 --- a/x/evm/statedb/statedb.go +++ b/x/evm/statedb/statedb.go @@ -77,7 +77,6 @@ type StateDB struct { accessList *accessList // Transient storage - //nolint transientStorage transientStorage // events emitted by native action @@ -95,7 +94,6 @@ func New(ctx sdk.Context, keeper Keeper, txConfig TxConfig) *StateDB { return NewWithParams(ctx, keeper, txConfig, keeper.GetParams(ctx)) } -// nolint func NewWithParams(ctx sdk.Context, keeper Keeper, txConfig TxConfig, params evmtypes.Params) *StateDB { db := &StateDB{ keeper: keeper, From ea969a4e2634ec6a838b4d2aeb3e4a228f389483 Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Mon, 28 Oct 2024 12:37:41 -0700 Subject: [PATCH 09/12] add gosec suppressions/fixes --- app/ante/authz.go | 2 +- app/ante/fee_checker.go | 2 ++ app/ante/setup.go | 1 + ethereum/eip712/domain.go | 2 +- ethereum/eip712/eip712_legacy.go | 5 ++-- indexer/kv_indexer.go | 9 ++++-- rpc/backend/account_info.go | 2 ++ rpc/backend/blocks.go | 4 +++ rpc/backend/chain_info.go | 3 ++ rpc/backend/node_info.go | 4 ++- rpc/backend/tracing.go | 1 + rpc/backend/tx_info.go | 15 ++++++++-- rpc/backend/utils.go | 1 + rpc/namespaces/ethereum/debug/api.go | 7 +++++ rpc/types/events.go | 11 +++++-- rpc/types/utils.go | 43 ++++++++++++++++------------ tests/rpc/utils.go | 2 +- testutil/tx/cosmos.go | 1 + x/evm/keeper/grpc_query.go | 8 ++++-- x/evm/keeper/keeper.go | 2 ++ x/evm/keeper/msg_server.go | 2 ++ x/evm/keeper/state_transition.go | 17 ++++++++--- x/evm/statedb/statedb.go | 17 +++++------ x/feemarket/keeper/abci.go | 2 ++ x/feemarket/keeper/grpc_query.go | 1 + 25 files changed, 119 insertions(+), 45 deletions(-) diff --git a/app/ante/authz.go b/app/ante/authz.go index 7a1bf4b3..5ad7cd04 100644 --- a/app/ante/authz.go +++ b/app/ante/authz.go @@ -49,7 +49,7 @@ func NewAuthzLimiterDecorator(disabledMsgTypes []string) AuthzLimiterDecorator { func (ald AuthzLimiterDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { if err := ald.checkDisabledMsgs(tx.GetMsgs(), false, 0); err != nil { - return ctx, errorsmod.Wrapf(errortypes.ErrUnauthorized, err.Error()) + return ctx, errorsmod.Wrapf(errortypes.ErrUnauthorized, "%v", err) } return next(ctx, tx, simulate) } diff --git a/app/ante/fee_checker.go b/app/ante/fee_checker.go index 57be1e95..703838f8 100644 --- a/app/ante/fee_checker.go +++ b/app/ante/fee_checker.go @@ -120,6 +120,7 @@ func checkTxFeeWithValidatorMinGasPrices(ctx sdk.Context, tx sdk.FeeTx) (sdk.Coi // Determine the required fees by multiplying each required minimum gas // price by the gas limit, where fee = ceil(minGasPrice * gasLimit). + // #nosec G115 always in range glDec := sdk.NewDec(int64(gas)) for i, gp := range minGasPrices { @@ -132,6 +133,7 @@ func checkTxFeeWithValidatorMinGasPrices(ctx sdk.Context, tx sdk.FeeTx) (sdk.Coi } } + // #nosec G115 always in range priority := getTxPriority(feeCoins, int64(gas)) return feeCoins, priority, nil } diff --git a/app/ante/setup.go b/app/ante/setup.go index 4bb44f6a..463c45d4 100644 --- a/app/ante/setup.go +++ b/app/ante/setup.go @@ -85,6 +85,7 @@ func (eeed EthEmitEventDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulat ctx.EventManager().EmitEvent(sdk.NewEvent( evmtypes.EventTypeEthereumTx, sdk.NewAttribute(evmtypes.AttributeKeyEthereumTxHash, msgEthTx.Hash), + // #nosec G115 index always positive sdk.NewAttribute(evmtypes.AttributeKeyTxIndex, strconv.FormatUint(txIndex+uint64(i), 10)), )) } diff --git a/ethereum/eip712/domain.go b/ethereum/eip712/domain.go index d51310e0..2e2c5f56 100644 --- a/ethereum/eip712/domain.go +++ b/ethereum/eip712/domain.go @@ -25,7 +25,7 @@ func createEIP712Domain(chainID uint64) apitypes.TypedDataDomain { domain := apitypes.TypedDataDomain{ Name: "Cosmos Web3", Version: "1.0.0", - ChainId: math.NewHexOrDecimal256(int64(chainID)), // #nosec G701 + ChainId: math.NewHexOrDecimal256(int64(chainID)), // #nosec G701 G115 VerifyingContract: "cosmos", Salt: "0", } diff --git a/ethereum/eip712/eip712_legacy.go b/ethereum/eip712/eip712_legacy.go index 73222b01..3c084038 100644 --- a/ethereum/eip712/eip712_legacy.go +++ b/ethereum/eip712/eip712_legacy.go @@ -59,8 +59,9 @@ func LegacyWrapTxToTypedData( } domain := apitypes.TypedDataDomain{ - Name: "Cosmos Web3", - Version: "1.0.0", + Name: "Cosmos Web3", + Version: "1.0.0", + // #nosec G115 chainID always positive ChainId: math.NewHexOrDecimal256(int64(chainID)), VerifyingContract: "cosmos", Salt: "0", diff --git a/indexer/kv_indexer.go b/indexer/kv_indexer.go index e2142c0d..c1528eaf 100644 --- a/indexer/kv_indexer.go +++ b/indexer/kv_indexer.go @@ -97,8 +97,10 @@ func (kv *KVIndexer) IndexBlock(block *tmtypes.Block, txResults []*abci.Response txHash := common.HexToHash(ethMsg.Hash) txResult := ethermint.TxResult{ - Height: height, - TxIndex: uint32(txIndex), + Height: height, + // #nosec G115 index always positive + TxIndex: uint32(txIndex), + // #nosec G115 index always positive MsgIndex: uint32(msgIndex), EthTxIndex: ethTxIndex, } @@ -180,7 +182,9 @@ func TxHashKey(hash common.Hash) []byte { // TxIndexKey returns the key for db entry: `(block number, tx index) -> tx hash` func TxIndexKey(blockNumber int64, txIndex int32) []byte { + // #nosec G115 block number always positive bz1 := sdk.Uint64ToBigEndian(uint64(blockNumber)) + // #nosec G115 index always positive bz2 := sdk.Uint64ToBigEndian(uint64(txIndex)) return append(append([]byte{KeyPrefixTxIndex}, bz1...), bz2...) } @@ -241,5 +245,6 @@ func parseBlockNumberFromKey(key []byte) (int64, error) { return 0, fmt.Errorf("wrong tx index key length, expect: %d, got: %d", TxIndexKeyLength, len(key)) } + // #nosec G115 block number always in range return int64(sdk.BigEndianToUint64(key[1:9])), nil } diff --git a/rpc/backend/account_info.go b/rpc/backend/account_info.go index 7832681f..a0eca3c4 100644 --- a/rpc/backend/account_info.go +++ b/rpc/backend/account_info.go @@ -77,6 +77,7 @@ func (b *Backend) GetProof(address common.Address, storageKeys []string, blockNr return nil, fmt.Errorf("not able to query block number greater than MaxInt64") } + // #nosec G115 block number always in range height = int64(bn) } @@ -195,6 +196,7 @@ func (b *Backend) GetTransactionCount(address common.Address, blockNum rpctypes. return &n, err } height := blockNum.Int64() + // #nosec G115 block number always in range currentHeight := int64(bn) if height > currentHeight { return &n, errorsmod.Wrapf( diff --git a/rpc/backend/blocks.go b/rpc/backend/blocks.go index e691d296..0474a39a 100644 --- a/rpc/backend/blocks.go +++ b/rpc/backend/blocks.go @@ -179,6 +179,7 @@ func (b *Backend) TendermintBlockByNumber(blockNum rpctypes.BlockNumber) (*tmrpc if err != nil { return nil, err } + // #nosec G115 always in range height = int64(n) } resBlock, err := b.clientCtx.Client.Block(b.ctx, &height) @@ -401,7 +402,9 @@ func (b *Backend) RPCBlockFromTendermintBlock( rpcTx, err := rpctypes.NewRPCTransaction( tx, common.BytesToHash(block.Hash()), + // #nosec G115 block height always positive uint64(block.Height), + // #nosec G115 txIndex always positive uint64(txIndex), baseFee, b.chainID, @@ -457,6 +460,7 @@ func (b *Backend) RPCBlockFromTendermintBlock( // block gas limit has exceeded, other txs must have failed with same reason. break } + // #nosec G115 gas used always positive gasUsed += uint64(txsResult.GetGasUsed()) } diff --git a/rpc/backend/chain_info.go b/rpc/backend/chain_info.go index 0cca9807..bcacf631 100644 --- a/rpc/backend/chain_info.go +++ b/rpc/backend/chain_info.go @@ -173,9 +173,11 @@ func (b *Backend) FeeHistory( if err != nil { return nil, err } + // #nosec G115 block number always in range blockEnd = int64(blockNumber) } + // #nosec G115 not security relevant blocks := int64(userBlockCount) maxBlockCount := int64(b.cfg.JSONRPC.FeeHistoryCap) if blocks > maxBlockCount { @@ -204,6 +206,7 @@ func (b *Backend) FeeHistory( // fetch block for blockID := blockStart; blockID <= blockEnd; blockID++ { + // #nosec G115 out of range would just result in confusing output index := int32(blockID - blockStart) // tendermint block tendermintblock, err := b.TendermintBlockByNumber(rpctypes.BlockNumber(blockID)) diff --git a/rpc/backend/node_info.go b/rpc/backend/node_info.go index 3f19748f..4b2ca616 100644 --- a/rpc/backend/node_info.go +++ b/rpc/backend/node_info.go @@ -80,8 +80,10 @@ func (b *Backend) Syncing() (interface{}, error) { } return map[string]interface{}{ + // #nosec G115 block height always positive "startingBlock": hexutil.Uint64(status.SyncInfo.EarliestBlockHeight), - "currentBlock": hexutil.Uint64(status.SyncInfo.LatestBlockHeight), + // #nosec G115 block height always positive + "currentBlock": hexutil.Uint64(status.SyncInfo.LatestBlockHeight), // "highestBlock": nil, // NA // "pulledStates": nil, // NA // "knownStates": nil, // NA diff --git a/rpc/backend/tracing.go b/rpc/backend/tracing.go index 7a158d56..b0fa3a00 100644 --- a/rpc/backend/tracing.go +++ b/rpc/backend/tracing.go @@ -50,6 +50,7 @@ func (b *Backend) TraceTransaction(hash common.Hash, config *evmtypes.TraceConfi } // check tx index is not out of bound + // #nosec G115 len() is always >= 0 if uint32(len(blk.Block.Txs)) < transaction.TxIndex { b.logger.Debug("tx index out of bounds", "index", transaction.TxIndex, "hash", hash.String(), "height", blk.Block.Height) return nil, fmt.Errorf("transaction not included in block %v", blk.Block.Height) diff --git a/rpc/backend/tx_info.go b/rpc/backend/tx_info.go index 91f7fad4..f4d80dc7 100644 --- a/rpc/backend/tx_info.go +++ b/rpc/backend/tx_info.go @@ -69,6 +69,7 @@ func (b *Backend) GetTransactionByHash(txHash common.Hash) (*rpctypes.RPCTransac msgs := b.EthMsgsFromTendermintBlock(block, blockRes) for i := range msgs { if msgs[i].Hash == hexTx { + // #nosec G115 block size limit prevents out of range res.EthTxIndex = int32(i) break } @@ -88,7 +89,9 @@ func (b *Backend) GetTransactionByHash(txHash common.Hash) (*rpctypes.RPCTransac return rpctypes.NewTransactionFromMsg( msg, common.BytesToHash(block.BlockID.Hash.Bytes()), + // #nosec G115 height always in range uint64(res.Height), + // #nosec G115 index always positive uint64(res.EthTxIndex), baseFee, b.chainID, @@ -179,6 +182,7 @@ func (b *Backend) GetTransactionReceipt(hash common.Hash) (map[string]interface{ return nil, nil } for _, txResult := range blockRes.TxsResults[0:res.TxIndex] { + // #nosec G115 txResult.GasUsed always positive cumulativeGasUsed += uint64(txResult.GasUsed) } cumulativeGasUsed += res.CumulativeGasUsed @@ -210,6 +214,7 @@ func (b *Backend) GetTransactionReceipt(hash common.Hash) (map[string]interface{ msgs := b.EthMsgsFromTendermintBlock(resBlock, blockRes) for i := range msgs { if msgs[i].Hash == hexTx { + // #nosec G115 block size limit prevents out of range res.EthTxIndex = int32(i) break } @@ -235,8 +240,10 @@ func (b *Backend) GetTransactionReceipt(hash common.Hash) (map[string]interface{ // Inclusion information: These fields provide information about the inclusion of the // transaction corresponding to this receipt. - "blockHash": common.BytesToHash(resBlock.Block.Header.Hash()).Hex(), - "blockNumber": hexutil.Uint64(res.Height), + "blockHash": common.BytesToHash(resBlock.Block.Header.Hash()).Hex(), + // #nosec G115 height always positive + "blockNumber": hexutil.Uint64(res.Height), + // #nosec G115 index always positive "transactionIndex": hexutil.Uint64(res.EthTxIndex), // sender and receiver (contract or EOA) addreses @@ -330,6 +337,7 @@ func (b *Backend) GetTxByEthHash(hash common.Hash) (*ethermint.TxResult, error) // GetTxByTxIndex uses `/tx_query` to find transaction by tx index of valid ethereum txs func (b *Backend) GetTxByTxIndex(height int64, index uint) (*ethermint.TxResult, error) { if b.indexer != nil { + // #nosec G115 not security relevant return b.indexer.GetByBlockAndIndex(height, int32(index)) } @@ -339,6 +347,7 @@ func (b *Backend) GetTxByTxIndex(height int64, index uint) (*ethermint.TxResult, evmtypes.AttributeKeyTxIndex, index, ) txResult, err := b.queryTendermintTxIndexer(query, func(txs *rpctypes.ParsedTxs) *rpctypes.ParsedTx { + // #nosec G115 out of range would just result in confusing output return txs.GetTxByTxIndex(int(index)) }) if err != nil { @@ -398,6 +407,7 @@ func (b *Backend) GetTransactionByBlockAndIndex(block *tmrpctypes.ResultBlock, i return nil, nil } } else { + // #nosec G115 out of range would just result in confusing output i := int(idx) ethMsgs := b.EthMsgsFromTendermintBlock(block, blockRes) if i >= len(ethMsgs) { @@ -417,6 +427,7 @@ func (b *Backend) GetTransactionByBlockAndIndex(block *tmrpctypes.ResultBlock, i return rpctypes.NewTransactionFromMsg( msg, common.BytesToHash(block.Block.Hash()), + // #nosec G115 block height always in range uint64(block.Block.Height), uint64(idx), baseFee, diff --git a/rpc/backend/utils.go b/rpc/backend/utils.go index d8cb9567..0fbdb875 100644 --- a/rpc/backend/utils.go +++ b/rpc/backend/utils.go @@ -181,6 +181,7 @@ func (b *Backend) processBlock( b.logger.Debug("failed to decode transaction in block", "height", blockHeight, "error", err.Error()) continue } + // #nosec G115 gas used always positive txGasUsed := uint64(eachTendermintTxResult.GasUsed) for _, msg := range tx.GetMsgs() { ethMsg, ok := msg.(*evmtypes.MsgEthereumTx) diff --git a/rpc/namespaces/ethereum/debug/api.go b/rpc/namespaces/ethereum/debug/api.go index 6ca3874d..348612a7 100644 --- a/rpc/namespaces/ethereum/debug/api.go +++ b/rpc/namespaces/ethereum/debug/api.go @@ -123,6 +123,7 @@ func (a *API) BlockProfile(file string, nsec uint) error { runtime.SetBlockProfileRate(1) defer runtime.SetBlockProfileRate(0) + // #nosec G115 out of range would just result in confusing output time.Sleep(time.Duration(nsec) * time.Second) return writeProfile("block", file, a.logger) } @@ -134,6 +135,7 @@ func (a *API) CpuProfile(file string, nsec uint) error { //nolint: golint, style if err := a.StartCPUProfile(file); err != nil { return err } + // #nosec G115 out of range would just result in confusing output time.Sleep(time.Duration(nsec) * time.Second) return a.StopCPUProfile() } @@ -153,6 +155,7 @@ func (a *API) GoTrace(file string, nsec uint) error { if err := a.StartGoTrace(file); err != nil { return err } + // #nosec G115 out of range would just result in confusing output time.Sleep(time.Duration(nsec) * time.Second) return a.StopGoTrace() } @@ -269,6 +272,7 @@ func (a *API) WriteMemProfile(file string) error { func (a *API) MutexProfile(file string, nsec uint) error { a.logger.Debug("debug_mutexProfile", "file", file, "nsec", nsec) runtime.SetMutexProfileFraction(1) + // #nosec G115 out of range would only result in confusing output time.Sleep(time.Duration(nsec) * time.Second) defer runtime.SetMutexProfileFraction(0) return writeProfile("mutex", file, a.logger) @@ -301,6 +305,7 @@ func (a *API) SetGCPercent(v int) int { // GetHeaderRlp retrieves the RLP encoded for of a single header. func (a *API) GetHeaderRlp(number uint64) (hexutil.Bytes, error) { + // #nosec G115 out of range would only result in confusing output header, err := a.backend.HeaderByNumber(rpctypes.BlockNumber(number)) if err != nil { return nil, err @@ -311,6 +316,7 @@ func (a *API) GetHeaderRlp(number uint64) (hexutil.Bytes, error) { // GetBlockRlp retrieves the RLP encoded for of a single block. func (a *API) GetBlockRlp(number uint64) (hexutil.Bytes, error) { + // #nosec G115 out of range would only result in confusing output block, err := a.backend.EthBlockByNumber(rpctypes.BlockNumber(number)) if err != nil { return nil, err @@ -321,6 +327,7 @@ func (a *API) GetBlockRlp(number uint64) (hexutil.Bytes, error) { // PrintBlock retrieves a block and returns its pretty printed form. func (a *API) PrintBlock(number uint64) (string, error) { + // #nosec G115 out of range would only result in confusing output block, err := a.backend.EthBlockByNumber(rpctypes.BlockNumber(number)) if err != nil { return "", err diff --git a/rpc/types/events.go b/rpc/types/events.go index 55a88351..c0521db5 100644 --- a/rpc/types/events.go +++ b/rpc/types/events.go @@ -17,6 +17,7 @@ package types import ( "fmt" + "math" "strconv" abci "github.com/cometbft/cometbft/abci/types" @@ -135,6 +136,7 @@ func ParseTxResult(result *abci.ResponseDeliverTx, tx sdk.Tx) (*ParsedTxs, error // some old versions miss some events, fill it with tx result if len(p.Txs) == 1 { + // #nosec G115 result.GasUsed always positive p.Txs[0].GasUsed = uint64(result.GasUsed) } @@ -164,8 +166,9 @@ func ParseTxIndexerResult(txResult *tmrpctypes.ResultTx, tx sdk.Tx, getter func( } return ðermint.TxResult{ - Height: txResult.Height, - TxIndex: txResult.Index, + Height: txResult.Height, + TxIndex: txResult.Index, + // #nosec G115 parsedTx.MsgIndex always positive MsgIndex: uint32(parsedTx.MsgIndex), EthTxIndex: parsedTx.EthTxIndex, Failed: parsedTx.Failed, @@ -251,6 +254,10 @@ func fillTxAttribute(tx *ParsedTx, key []byte, value []byte) error { if err != nil { return err } + if txIndex > math.MaxInt32 { + return fmt.Errorf("%s exceeds int32 range", value) + } + // #nosec G115 range checked tx.EthTxIndex = int32(txIndex) case evmtypes.AttributeKeyTxGasUsed: gasUsed, err := strconv.ParseUint(string(value), 10, 64) diff --git a/rpc/types/utils.go b/rpc/types/utils.go index 32cbb187..e0bfcfa4 100644 --- a/rpc/types/utils.go +++ b/rpc/types/utils.go @@ -82,11 +82,12 @@ func EthHeaderFromTendermint(header tmtypes.Header, bloom ethtypes.Bloom, baseFe Number: big.NewInt(header.Height), GasLimit: 0, GasUsed: 0, - Time: uint64(header.Time.UTC().Unix()), - Extra: []byte{}, - MixDigest: common.Hash{}, - Nonce: ethtypes.BlockNonce{}, - BaseFee: baseFee, + // #nosec G115 timestamp always positive + Time: uint64(header.Time.UTC().Unix()), + Extra: []byte{}, + MixDigest: common.Hash{}, + Nonce: ethtypes.BlockNonce{}, + BaseFee: baseFee, } } @@ -128,20 +129,24 @@ func FormatBlock( } result := map[string]interface{}{ - "number": hexutil.Uint64(header.Height), - "hash": hexutil.Bytes(header.Hash()), - "parentHash": common.BytesToHash(header.LastBlockID.Hash.Bytes()), - "nonce": ethtypes.BlockNonce{}, // PoW specific - "sha3Uncles": ethtypes.EmptyUncleHash, // No uncles in Tendermint - "logsBloom": bloom, - "stateRoot": hexutil.Bytes(header.AppHash), - "miner": validatorAddr, - "mixHash": common.Hash{}, - "difficulty": (*hexutil.Big)(big.NewInt(0)), - "extraData": "0x", - "size": hexutil.Uint64(size), - "gasLimit": hexutil.Uint64(gasLimit), // Static gas limit - "gasUsed": (*hexutil.Big)(gasUsed), + // #nosec G115 height always positive + "number": hexutil.Uint64(header.Height), + "hash": hexutil.Bytes(header.Hash()), + "parentHash": common.BytesToHash(header.LastBlockID.Hash.Bytes()), + "nonce": ethtypes.BlockNonce{}, // PoW specific + "sha3Uncles": ethtypes.EmptyUncleHash, // No uncles in Tendermint + "logsBloom": bloom, + "stateRoot": hexutil.Bytes(header.AppHash), + "miner": validatorAddr, + "mixHash": common.Hash{}, + "difficulty": (*hexutil.Big)(big.NewInt(0)), + "extraData": "0x", + // #nosec G115 size always positive + "size": hexutil.Uint64(size), + // #nosec G115 gasLimit always positive + "gasLimit": hexutil.Uint64(gasLimit), // Static gas limit + "gasUsed": (*hexutil.Big)(gasUsed), + // #nosec G115 timestamp always positive "timestamp": hexutil.Uint64(header.Time.Unix()), "transactionsRoot": transactionsRoot, "receiptsRoot": ethtypes.EmptyRootHash, diff --git a/tests/rpc/utils.go b/tests/rpc/utils.go index cbc8c6cb..00a14d4b 100644 --- a/tests/rpc/utils.go +++ b/tests/rpc/utils.go @@ -149,7 +149,7 @@ func CallWithError(method string, params interface{}) (*Response, error) { } if rpcRes.Error != nil { - return nil, fmt.Errorf(rpcRes.Error.Message) + return nil, errors.New(rpcRes.Error.Message) } return rpcRes, nil diff --git a/testutil/tx/cosmos.go b/testutil/tx/cosmos.go index 403ff293..8ba200fb 100644 --- a/testutil/tx/cosmos.go +++ b/testutil/tx/cosmos.go @@ -67,6 +67,7 @@ func PrepareCosmosTx( var fees sdk.Coins if args.GasPrice != nil { + // #nosec G115 always in range fees = sdk.Coins{{Denom: evmtypes.DefaultEVMDenom, Amount: args.GasPrice.MulRaw(int64(args.Gas))}} } else { fees = sdk.Coins{DefaultFee} diff --git a/x/evm/keeper/grpc_query.go b/x/evm/keeper/grpc_query.go index 38fc5231..bff6c671 100644 --- a/x/evm/keeper/grpc_query.go +++ b/x/evm/keeper/grpc_query.go @@ -306,6 +306,7 @@ func (k Keeper) EstimateGas(c context.Context, req *types.EthCallRequest) (*type return nil, err } if params != nil && params.Block != nil && params.Block.MaxGas > 0 { + // #nosec G115 MaxGas range checked hi = uint64(params.Block.MaxGas) } else { hi = req.GasCap @@ -429,6 +430,7 @@ func (k Keeper) TraceTx(c context.Context, req *types.QueryTraceTxRequest) (*typ msg = unsignedTxAsMessage(common.HexToAddress(req.Msg.From), ethTx, cfg.BaseFee) } txConfig.TxHash = ethTx.Hash() + // #nosec G115 block size limit prevents out of range txConfig.TxIndex = uint(i) rsp, err := k.ApplyMessageWithConfig(ctx, msg, types.NewNoOpTracer(), true, cfg, txConfig) if err != nil { @@ -514,6 +516,7 @@ func (k Keeper) TraceBlock(c context.Context, req *types.QueryTraceBlockRequest) result := types.TxTraceResult{} ethTx := tx.AsTransaction() txConfig.TxHash = ethTx.Hash() + // #nosec G115 block size limit prevents out of range txConfig.TxIndex = uint(i) traceResult, logIndex, err := k.traceTx( ctx, cfg, txConfig, common.HexToAddress(tx.From), @@ -589,8 +592,9 @@ func (k *Keeper) traceTx( tCtx := &tracers.Context{ BlockHash: txConfig.BlockHash, - TxIndex: int(txConfig.TxIndex), - TxHash: txConfig.TxHash, + // #nosec G115 TxIndex always positive + TxIndex: int(txConfig.TxIndex), + TxHash: txConfig.TxHash, } if traceConfig.Tracer != "" { diff --git a/x/evm/keeper/keeper.go b/x/evm/keeper/keeper.go index 41dcad74..8465dc76 100644 --- a/x/evm/keeper/keeper.go +++ b/x/evm/keeper/keeper.go @@ -186,6 +186,7 @@ func (k Keeper) GetAuthority() sdk.AccAddress { // GetBlockBloomTransient returns bloom bytes for the current block height func (k Keeper) GetBlockBloomTransient(ctx sdk.Context) *big.Int { store := prefix.NewStore(ctx.TransientStore(k.transientKey), types.KeyPrefixTransientBloom) + // #nosec G115 block height always positive heightBz := sdk.Uint64ToBigEndian(uint64(ctx.BlockHeight())) bz := store.Get(heightBz) if len(bz) == 0 { @@ -199,6 +200,7 @@ func (k Keeper) GetBlockBloomTransient(ctx sdk.Context) *big.Int { // every block. func (k Keeper) SetBlockBloomTransient(ctx sdk.Context, bloom *big.Int) { store := prefix.NewStore(ctx.TransientStore(k.transientKey), types.KeyPrefixTransientBloom) + // #nosec G115 block height always positive heightBz := sdk.Uint64ToBigEndian(uint64(ctx.BlockHeight())) store.Set(heightBz, bloom.Bytes()) } diff --git a/x/evm/keeper/msg_server.go b/x/evm/keeper/msg_server.go index 5b88d409..91a77f31 100644 --- a/x/evm/keeper/msg_server.go +++ b/x/evm/keeper/msg_server.go @@ -77,7 +77,9 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t // Observe which users define a gas limit >> gas used. Note, that // gas_limit and gas_used are always > 0 + // #nosec G115 always in range gasLimit := sdk.NewDec(int64(tx.Gas())) + // #nosec G115 always in range gasRatio, err := gasLimit.QuoInt64(int64(response.GasUsed)).Float64() if err == nil { telemetry.SetGaugeWithLabels( diff --git a/x/evm/keeper/state_transition.go b/x/evm/keeper/state_transition.go index b667b6d9..fbc55968 100644 --- a/x/evm/keeper/state_transition.go +++ b/x/evm/keeper/state_transition.go @@ -17,6 +17,7 @@ package keeper import ( "fmt" + "math" "math/big" tmtypes "github.com/cometbft/cometbft/types" @@ -60,10 +61,11 @@ func (k *Keeper) NewEVM( Coinbase: cfg.CoinBase, GasLimit: ethermint.BlockGasLimit(ctx), BlockNumber: big.NewInt(ctx.BlockHeight()), - Time: uint64(ctx.BlockHeader().Time.Unix()), - Difficulty: big.NewInt(0), // unused. Only required in PoW context - BaseFee: cfg.BaseFee, - Random: nil, // not supported + // #nosec G115 timestamp always positive + Time: uint64(ctx.BlockHeader().Time.Unix()), + Difficulty: big.NewInt(0), // unused. Only required in PoW context + BaseFee: cfg.BaseFee, + Random: nil, // not supported } txCtx := core.NewEVMTxContext(msg) @@ -382,6 +384,7 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, } leftoverGas -= intrinsicGas + // #nosec G115 timestamp always positive rules := cfg.ChainConfig.Rules(big.NewInt(ctx.BlockHeight()), cfg.ChainConfig.MergeNetsplitBlock != nil, uint64(ctx.BlockTime().Unix())) stateDB.Prepare(rules, msg.From, cfg.CoinBase, msg.To, evm.AllPrecompiledAddresses(rules), msg.AccessList) @@ -432,9 +435,14 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, } } + if msg.GasLimit > math.MaxInt64 { + return nil, errorsmod.Wrapf(types.ErrGasOverflow, "gas limit exceeds max int64 (%d)", math.MaxInt64) + } + // calculate a minimum amount of gas to be charged to sender if GasLimit // is considerably higher than GasUsed to stay more aligned with Tendermint gas mechanics // for more info https://github.com/evmos/ethermint/issues/1085 + // #nosec G115 msg.GasLimit range checked gasLimit := sdk.NewDec(int64(msg.GasLimit)) minGasMultiplier := k.GetMinGasMultiplier(ctx) minimumGasUsed := gasLimit.Mul(minGasMultiplier) @@ -443,6 +451,7 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, return nil, errorsmod.Wrapf(types.ErrGasOverflow, "message gas limit < leftover gas (%d < %d)", msg.GasLimit, leftoverGas) } + // #nosec G115 temporaryGasUsed always in range gasUsed := sdk.MaxDec(minimumGasUsed, sdk.NewDec(int64(temporaryGasUsed))).TruncateInt().Uint64() // reset leftoverGas, to be used by the tracer leftoverGas = msg.GasLimit - gasUsed diff --git a/x/evm/statedb/statedb.go b/x/evm/statedb/statedb.go index 70a4a67a..0a4ef9cd 100644 --- a/x/evm/statedb/statedb.go +++ b/x/evm/statedb/statedb.go @@ -81,12 +81,6 @@ type StateDB struct { // events emitted by native action nativeEvents sdk.Events - - // handle balances natively - //nolint - evmDenom string - //nolint - err error } // New creates a new state from a given trie. @@ -94,7 +88,7 @@ func New(ctx sdk.Context, keeper Keeper, txConfig TxConfig) *StateDB { return NewWithParams(ctx, keeper, txConfig, keeper.GetParams(ctx)) } -func NewWithParams(ctx sdk.Context, keeper Keeper, txConfig TxConfig, params evmtypes.Params) *StateDB { +func NewWithParams(ctx sdk.Context, keeper Keeper, txConfig TxConfig, _ evmtypes.Params) *StateDB { db := &StateDB{ keeper: keeper, stateObjects: make(map[common.Address]*stateObject), @@ -467,7 +461,14 @@ func (s *StateDB) Selfdestruct6780(addr common.Address) { s.SelfDestruct(addr) } -func (s *StateDB) Prepare(rules params.Rules, sender, coinbase common.Address, dest *common.Address, precompiles []common.Address, txAccesses ethtypes.AccessList) { +func (s *StateDB) Prepare( + rules params.Rules, + sender, + _ common.Address, + dest *common.Address, + precompiles []common.Address, + txAccesses ethtypes.AccessList, +) { if rules.IsBerlin { // Clear out any leftover from previous executions s.accessList = newAccessList() diff --git a/x/feemarket/keeper/abci.go b/x/feemarket/keeper/abci.go index ee5f4165..e3e6480c 100644 --- a/x/feemarket/keeper/abci.go +++ b/x/feemarket/keeper/abci.go @@ -66,7 +66,9 @@ func (k *Keeper) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) { // this will be keep BaseFee protected from un-penalized manipulation // more info here https://github.com/zeta-chain/ethermint/pull/1105#discussion_r888798925 minGasMultiplier := k.GetParams(ctx).MinGasMultiplier + // #nosec G115 gasWanted always in range limitedGasWanted := sdk.NewDec(int64(gasWanted)).Mul(minGasMultiplier) + // #nosec G115 gasUsed always in range gasWanted = sdk.MaxDec(limitedGasWanted, sdk.NewDec(int64(gasUsed))).TruncateInt().Uint64() k.SetBlockGasWanted(ctx, gasWanted) diff --git a/x/feemarket/keeper/grpc_query.go b/x/feemarket/keeper/grpc_query.go index ce8f7831..aaff13a2 100644 --- a/x/feemarket/keeper/grpc_query.go +++ b/x/feemarket/keeper/grpc_query.go @@ -57,6 +57,7 @@ func (k Keeper) BlockGas(c context.Context, _ *types.QueryBlockGasRequest) (*typ gas := k.GetBlockGasWanted(ctx) return &types.QueryBlockGasResponse{ + // #nosec G115 always in range Gas: int64(gas), }, nil } From 16b8a24419ff388b42e9e8e53bc74481a7e61ac0 Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Tue, 5 Nov 2024 09:55:23 -0800 Subject: [PATCH 10/12] pass shanghai parameter --- app/ante/eth.go | 3 ++- x/evm/handler_test.go | 2 +- x/evm/keeper/utils.go | 4 ++-- x/evm/keeper/utils_test.go | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/ante/eth.go b/app/ante/eth.go index 77594254..9101b565 100644 --- a/app/ante/eth.go +++ b/app/ante/eth.go @@ -157,6 +157,7 @@ func (egcd EthGasConsumeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simula blockHeight := big.NewInt(ctx.BlockHeight()) homestead := ethCfg.IsHomestead(blockHeight) istanbul := ethCfg.IsIstanbul(blockHeight) + shanghai := ethCfg.IsShanghai(blockHeight, 1) var events sdk.Events // Use the lowest priority of all the messages as the final one. @@ -187,7 +188,7 @@ func (egcd EthGasConsumeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simula evmDenom := evmParams.GetEvmDenom() - fees, err := keeper.VerifyFee(txData, evmDenom, baseFee, homestead, istanbul, ctx.IsCheckTx()) + fees, err := keeper.VerifyFee(txData, evmDenom, baseFee, homestead, istanbul, shanghai, ctx.IsCheckTx()) if err != nil { return ctx, errorsmod.Wrapf(err, "failed to verify the fees") } diff --git a/x/evm/handler_test.go b/x/evm/handler_test.go index 43243223..5b7405b8 100644 --- a/x/evm/handler_test.go +++ b/x/evm/handler_test.go @@ -602,7 +602,7 @@ func (suite *EvmTestSuite) TestERC20TransferReverted() { txData, err := types.UnpackTxData(tx.Data) suite.Require().NoError(err) - fees, err := keeper.VerifyFee(txData, "aphoton", baseFee, true, true, suite.ctx.IsCheckTx()) + fees, err := keeper.VerifyFee(txData, "aphoton", baseFee, true, true, false, suite.ctx.IsCheckTx()) suite.Require().NoError(err) err = k.DeductTxCostsFromUserBalance(suite.ctx, fees, common.HexToAddress(tx.From)) suite.Require().NoError(err) diff --git a/x/evm/keeper/utils.go b/x/evm/keeper/utils.go index 61d68ecf..a194e36b 100644 --- a/x/evm/keeper/utils.go +++ b/x/evm/keeper/utils.go @@ -83,7 +83,7 @@ func VerifyFee( txData types.TxData, denom string, baseFee *big.Int, - homestead, istanbul, isCheckTx bool, + homestead, istanbul, shanghai, isCheckTx bool, ) (sdk.Coins, error) { isContractCreation := txData.GetTo() == nil @@ -94,7 +94,7 @@ func VerifyFee( accessList = txData.GetAccessList() } - intrinsicGas, err := core.IntrinsicGas(txData.GetData(), accessList, isContractCreation, homestead, istanbul, false) + intrinsicGas, err := core.IntrinsicGas(txData.GetData(), accessList, isContractCreation, homestead, istanbul, shanghai) if err != nil { return nil, errorsmod.Wrapf( err, diff --git a/x/evm/keeper/utils_test.go b/x/evm/keeper/utils_test.go index 94785c2b..a500fe96 100644 --- a/x/evm/keeper/utils_test.go +++ b/x/evm/keeper/utils_test.go @@ -486,7 +486,7 @@ func (suite *KeeperTestSuite) TestVerifyFeeAndDeductTxCostsFromUserBalance() { baseFee := suite.app.EvmKeeper.GetBaseFee(suite.ctx, ethCfg) priority := evmtypes.GetTxPriority(txData, baseFee) - fees, err := keeper.VerifyFee(txData, evmtypes.DefaultEVMDenom, baseFee, false, false, suite.ctx.IsCheckTx()) + fees, err := keeper.VerifyFee(txData, evmtypes.DefaultEVMDenom, baseFee, false, false, false, suite.ctx.IsCheckTx()) if tc.expectPassVerify { suite.Require().NoError(err, "valid test %d failed - '%s'", i, tc.name) if tc.enableFeemarket { From 660d9a452b50457fd8637f7c81e7ef5c0643f764 Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Tue, 5 Nov 2024 10:11:48 -0800 Subject: [PATCH 11/12] more review feedback --- x/evm/keeper/state_transition.go | 7 ++++--- x/evm/statedb/state_object.go | 8 +++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/x/evm/keeper/state_transition.go b/x/evm/keeper/state_transition.go index fbc55968..9556a646 100644 --- a/x/evm/keeper/state_transition.go +++ b/x/evm/keeper/state_transition.go @@ -388,12 +388,13 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, rules := cfg.ChainConfig.Rules(big.NewInt(ctx.BlockHeight()), cfg.ChainConfig.MergeNetsplitBlock != nil, uint64(ctx.BlockTime().Unix())) stateDB.Prepare(rules, msg.From, cfg.CoinBase, msg.To, evm.AllPrecompiledAddresses(rules), msg.AccessList) + value := msg.Value if msg.Value == nil { - msg.Value = new(big.Int) + value = new(big.Int) } - valueUint256, isOverflow := uint256.FromBig(msg.Value) + valueUint256, isOverflow := uint256.FromBig(value) if isOverflow { - return nil, fmt.Errorf("%v is not a valid uint256", msg.Value) + return nil, fmt.Errorf("%v is not a valid uint256", value) } if contractCreation { diff --git a/x/evm/statedb/state_object.go b/x/evm/statedb/state_object.go index a70e1b15..9d117dca 100644 --- a/x/evm/statedb/state_object.go +++ b/x/evm/statedb/state_object.go @@ -128,7 +128,13 @@ func (s *stateObject) SubBalance(amount *uint256.Int) { if amount.Sign() == 0 { return } - s.SetBalance(new(uint256.Int).Sub(s.Balance(), amount)) + // the underflow condition should be checked at higher levels, but + // we will guard against it anyway to be safe + newBalance, isUnderflow := new(uint256.Int).SubOverflow(s.Balance(), amount) + if isUnderflow { + return + } + s.SetBalance(newBalance) } // SetBalance update account balance. From 38aff7901d436003807bc2585945a7f19851de08 Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Tue, 5 Nov 2024 10:34:46 -0800 Subject: [PATCH 12/12] fix test output subtracting from 0 balance should result in noop and zero result --- x/evm/keeper/statedb_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/evm/keeper/statedb_test.go b/x/evm/keeper/statedb_test.go index b493bd5c..bb305b69 100644 --- a/x/evm/keeper/statedb_test.go +++ b/x/evm/keeper/statedb_test.go @@ -108,7 +108,7 @@ func (suite *KeeperTestSuite) TestSubBalance() { "positive amount, below zero", uint256.NewInt(100), func(vm.StateDB) {}, - false, + true, }, { "positive amount, above zero",