diff --git a/.codecov.yml b/.codecov.yml index 010b1a63..ab9a3c07 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -38,3 +38,4 @@ ignore: - "x/evm/contracts" - "**/*.sol" - "tests/" + - "**/mock.go" \ No newline at end of file diff --git a/Makefile b/Makefile index 5b247867..0181c282 100644 --- a/Makefile +++ b/Makefile @@ -187,16 +187,16 @@ test: contracts-gen test-unit test-integration test-all: contracts-gen test-unit test-race test-cover test-integration test-unit: - @VERSION=$(VERSION) go test -mod=readonly -tags='ledger test_ledger_mock' ./... + @VERSION=$(VERSION) go test -mod=readonly -tags='ledger test_ledger_mock test' ./... test-integration: - @VERSION=$(VERSION) go test -mod=readonly -tags='ledger test_ledger_mock' ./integration-tests/... + @VERSION=$(VERSION) go test -mod=readonly -tags='ledger test_ledger_mock test' ./integration-tests/... test-race: - @VERSION=$(VERSION) go test -mod=readonly -race -tags='ledger test_ledger_mock' ./... + @VERSION=$(VERSION) go test -mod=readonly -race -tags='ledger test_ledger_mock test' ./... test-cover: - @go test -mod=readonly -timeout 30m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock' ./... + @go test -mod=readonly -timeout 30m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock test' ./... contracts-gen: $(CONTRACTS_DIR)/* @bash ./scripts/contractsgen.sh diff --git a/app/app.go b/app/app.go index 11104876..90119591 100644 --- a/app/app.go +++ b/app/app.go @@ -64,7 +64,7 @@ import ( "github.com/initia-labs/minievm/app/checktx" "github.com/initia-labs/minievm/app/keepers" "github.com/initia-labs/minievm/app/posthandler" - "github.com/initia-labs/minievm/app/upgrades/v1_1_9" + "github.com/initia-labs/minievm/app/upgrades/v1_2_0" evmindexer "github.com/initia-labs/minievm/indexer" evmconfig "github.com/initia-labs/minievm/x/evm/config" evmtypes "github.com/initia-labs/minievm/x/evm/types" @@ -271,7 +271,7 @@ func NewMinitiaApp( // The cosmos upgrade handler attempts to create ${HOME}/.minitia/data to check for upgrade info, // but this isn't required during initial encoding config setup. if loadLatest { - v1_1_9.RegisterUpgradeHandlers(app) + v1_2_0.RegisterUpgradeHandlers(app) } // register executor change plans for later use diff --git a/app/checktx/handler.go b/app/checktx/handler.go index a3bff999..0d01d016 100644 --- a/app/checktx/handler.go +++ b/app/checktx/handler.go @@ -169,7 +169,7 @@ func (w *CheckTxWrapper) flushQueue(sender *common.Address, nonce uint64) { func (w *CheckTxWrapper) validateTx(sdkCtx sdk.Context, tx sdk.Tx, ethTx *coretypes.Transaction, expectedSender common.Address) (*abci.ResponseCheckTx, error) { // check intrinsic gas - intrGas, err := core.IntrinsicGas(ethTx.Data(), ethTx.AccessList(), ethTx.To() == nil, true, true, true) + intrGas, err := core.IntrinsicGas(ethTx.Data(), ethTx.AccessList(), []coretypes.SetCodeAuthorization{}, ethTx.To() == nil, true, true, true) if err != nil { return nil, err } diff --git a/app/ibc-hooks/ack_test.go b/app/ibc-hooks/ack_test.go index 4850a93f..afa243bc 100644 --- a/app/ibc-hooks/ack_test.go +++ b/app/ibc-hooks/ack_test.go @@ -87,7 +87,7 @@ func Test_onAckIcs20Packet_memo(t *testing.T) { // check the contract state queryInputBz, err := abi.Pack("count") require.NoError(t, err) - queryRes, logs, err := input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, queryInputBz, nil, nil) + queryRes, logs, err := input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, queryInputBz, nil, nil, nil) require.NoError(t, err) require.Equal(t, uint256.NewInt(0).Bytes32(), [32]byte(queryRes)) require.Empty(t, logs) @@ -102,7 +102,7 @@ func Test_onAckIcs20Packet_memo(t *testing.T) { require.NoError(t, err) // check the contract state; increased by 99 if ack is success - queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, queryInputBz, nil, nil) + queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, queryInputBz, nil, nil, nil) require.NoError(t, err) require.Equal(t, uint256.NewInt(99).Bytes32(), [32]byte(queryRes)) require.Empty(t, logs) @@ -114,7 +114,7 @@ func Test_onAckIcs20Packet_memo(t *testing.T) { require.NoError(t, err) // check the contract state; increased by 1 if ack is failed - queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, queryInputBz, nil, nil) + queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, queryInputBz, nil, nil, nil) require.NoError(t, err) require.Equal(t, uint256.NewInt(100).Bytes32(), [32]byte(queryRes)) require.Empty(t, logs) @@ -197,7 +197,7 @@ func Test_onAckPacket_memo_ICS721(t *testing.T) { // check the contract state queryInputBz, err := abi.Pack("count") require.NoError(t, err) - queryRes, logs, err := input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, queryInputBz, nil, nil) + queryRes, logs, err := input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, queryInputBz, nil, nil, nil) require.NoError(t, err) require.Equal(t, uint256.NewInt(0).Bytes32(), [32]byte(queryRes)) require.Empty(t, logs) @@ -212,7 +212,7 @@ func Test_onAckPacket_memo_ICS721(t *testing.T) { require.NoError(t, err) // check the contract state; increased by 99 if ack is success - queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, queryInputBz, nil, nil) + queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, queryInputBz, nil, nil, nil) require.NoError(t, err) require.Equal(t, uint256.NewInt(99).Bytes32(), [32]byte(queryRes)) require.Empty(t, logs) @@ -224,7 +224,7 @@ func Test_onAckPacket_memo_ICS721(t *testing.T) { require.NoError(t, err) // check the contract state; increased by 1 if ack is failed - queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, queryInputBz, nil, nil) + queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, queryInputBz, nil, nil, nil) require.NoError(t, err) require.Equal(t, uint256.NewInt(100).Bytes32(), [32]byte(queryRes)) require.Empty(t, logs) diff --git a/app/ibc-hooks/receive_test.go b/app/ibc-hooks/receive_test.go index 482b7879..c1532bf1 100644 --- a/app/ibc-hooks/receive_test.go +++ b/app/ibc-hooks/receive_test.go @@ -222,7 +222,7 @@ func Test_onReceivePacket_memo_ICS721(t *testing.T) { require.NoError(t, err) // check the contract state - queryRes, logs, err := input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, queryInputBz, nil, nil) + queryRes, logs, err := input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, queryInputBz, nil, nil, nil) require.NoError(t, err) require.Equal(t, uint256.NewInt(1).Bytes32(), [32]byte(queryRes)) require.Empty(t, logs) diff --git a/app/ibc-hooks/timeout_test.go b/app/ibc-hooks/timeout_test.go index 7e18e9fa..974dad83 100644 --- a/app/ibc-hooks/timeout_test.go +++ b/app/ibc-hooks/timeout_test.go @@ -81,7 +81,7 @@ func Test_onTimeoutIcs20Packet_memo(t *testing.T) { // check the contract state queryInputBz, err := abi.Pack("count") require.NoError(t, err) - queryRes, logs, err := input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, queryInputBz, nil, nil) + queryRes, logs, err := input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, queryInputBz, nil, nil, nil) require.NoError(t, err) require.Equal(t, uint256.NewInt(0).Bytes32(), [32]byte(queryRes)) require.Empty(t, logs) @@ -96,7 +96,7 @@ func Test_onTimeoutIcs20Packet_memo(t *testing.T) { require.NoError(t, err) // check the contract state; increased by 99 - queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, queryInputBz, nil, nil) + queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, queryInputBz, nil, nil, nil) require.NoError(t, err) require.Equal(t, uint256.NewInt(99).Bytes32(), [32]byte(queryRes)) require.Empty(t, logs) @@ -169,7 +169,7 @@ func Test_onTimeoutPacket_memo_ICS721(t *testing.T) { // check the contract state queryInputBz, err := abi.Pack("count") require.NoError(t, err) - queryRes, logs, err := input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, queryInputBz, nil, nil) + queryRes, logs, err := input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, queryInputBz, nil, nil, nil) require.NoError(t, err) require.Equal(t, uint256.NewInt(0).Bytes32(), [32]byte(queryRes)) require.Empty(t, logs) @@ -184,7 +184,7 @@ func Test_onTimeoutPacket_memo_ICS721(t *testing.T) { require.NoError(t, err) // check the contract state; increased by 99 - queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, queryInputBz, nil, nil) + queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, queryInputBz, nil, nil, nil) require.NoError(t, err) require.Equal(t, uint256.NewInt(99).Bytes32(), [32]byte(queryRes)) require.Empty(t, logs) diff --git a/app/upgrades/v1_2_0/upgrade.go b/app/upgrades/v1_2_0/upgrade.go new file mode 100644 index 00000000..34137b3c --- /dev/null +++ b/app/upgrades/v1_2_0/upgrade.go @@ -0,0 +1,71 @@ +package v1_2_0 + +import ( + "context" + + upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/ethereum/go-ethereum/common/hexutil" + + "github.com/initia-labs/minievm/app/upgrades" + "github.com/initia-labs/minievm/app/upgrades/contracts/erc20_factory" + "github.com/initia-labs/minievm/app/upgrades/contracts/erc20_wrapper" +) + +const upgradeName = "v1.2.0" + +// RegisterUpgradeHandlers registers the upgrade handlers for the app. +func RegisterUpgradeHandlers(app upgrades.MinitiaApp) { + app.GetUpgradeKeeper().SetUpgradeHandler( + upgradeName, + func(ctx context.Context, _ upgradetypes.Plan, versionMap module.VersionMap) (module.VersionMap, error) { + + // 0. update params with normalized address + params, err := app.GetEVMKeeper().Params.Get(ctx) + if err != nil { + return nil, err + } + + err = params.NormalizeAddresses(app.GetAccountKeeper().AddressCodec()) + if err != nil { + return nil, err + } + + err = app.GetEVMKeeper().Params.Set(ctx, params) + if err != nil { + return nil, err + } + + // 1. update erc20 wrapper contract + wrapperAddr, err := app.GetEVMKeeper().GetERC20WrapperAddr(ctx) + if err != nil { + return nil, err + } + wrapperRuntimeCode, err := hexutil.Decode(erc20_wrapper.Erc20WrapperBin) + if err != nil { + return nil, err + } + wrapperCodeHash := upgrades.CodeHash(wrapperRuntimeCode) + if err := upgrades.ReplaceCodeAndCodeHash(ctx, app, wrapperAddr.Bytes(), wrapperRuntimeCode, wrapperCodeHash); err != nil { + return nil, err + } + + // 2. update erc20 factory contract + factoryAddr, err := app.GetEVMKeeper().GetERC20FactoryAddr(ctx) + if err != nil { + return nil, err + } + factoryRuntimeCode, err := hexutil.Decode(erc20_factory.Erc20FactoryBin) + if err != nil { + return nil, err + } + factoryCodeHash := upgrades.CodeHash(factoryRuntimeCode) + if err := upgrades.ReplaceCodeAndCodeHash(ctx, app, factoryAddr.Bytes(), factoryRuntimeCode, factoryCodeHash); err != nil { + return nil, err + } + + // 3. run migrations + return app.GetModuleManager().RunMigrations(ctx, app.GetConfigurator(), versionMap) + }, + ) +} diff --git a/go.mod b/go.mod index a15f0b2b..3b4ebc80 100644 --- a/go.mod +++ b/go.mod @@ -25,13 +25,13 @@ require ( github.com/cosmos/ibc-apps/modules/rate-limiting/v8 v8.0.0 github.com/cosmos/ibc-go/modules/capability v1.0.1 github.com/cosmos/ibc-go/v8 v8.7.0 - github.com/ethereum/go-ethereum v1.14.11 + github.com/ethereum/go-ethereum v1.15.11 github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.4 github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/hashicorp/go-metrics v0.5.3 - github.com/holiman/uint256 v1.3.1 + github.com/holiman/uint256 v1.3.2 github.com/initia-labs/OPinit v1.1.3 github.com/initia-labs/initia v1.1.2 github.com/initia-labs/kvindexer v0.2.0 @@ -52,9 +52,9 @@ require ( github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.10.0 github.com/valyala/fastjson v1.6.4 - golang.org/x/crypto v0.32.0 - golang.org/x/net v0.34.0 - golang.org/x/sync v0.10.0 + golang.org/x/crypto v0.35.0 + golang.org/x/net v0.36.0 + golang.org/x/sync v0.11.0 google.golang.org/genproto/googleapis/api v0.0.0-20241202173237-19429a94021a google.golang.org/grpc v1.70.0 google.golang.org/protobuf v1.36.4 @@ -83,7 +83,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.14.2 // indirect + github.com/bits-and-blooms/bitset v1.20.0 // indirect github.com/btcsuite/btcd v0.24.2 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/btcsuite/btcd/btcutil v1.1.6 // indirect @@ -100,16 +100,16 @@ require ( github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/cometbft/cometbft-db v0.15.0 // indirect - github.com/consensys/bavard v0.1.13 // indirect - github.com/consensys/gnark-crypto v0.12.1 // indirect + github.com/consensys/bavard v0.1.27 // indirect + github.com/consensys/gnark-crypto v0.16.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/interchain-security/v6 v6.3.0 // indirect github.com/cosmos/ledger-cosmos-go v0.14.0 // indirect github.com/cosmos/relayer/v2 v2.5.2 // indirect - github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c // indirect - github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect + github.com/crate-crypto/go-eth-kzg v1.3.0 // indirect + github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect github.com/creachadair/atomicfile v0.3.1 // indirect github.com/creachadair/tomledit v0.0.24 // indirect github.com/danieljoos/wincred v1.1.2 // indirect @@ -122,12 +122,11 @@ require ( github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.6.0 // indirect github.com/emicklei/dot v1.6.2 // indirect - github.com/ethereum/c-kzg-4844 v1.0.0 // indirect - github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 // indirect + github.com/ethereum/c-kzg-4844/v2 v2.1.0 // indirect + github.com/ethereum/go-verkle v0.2.2 // indirect github.com/fatih/color v1.18.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/getsentry/sentry-go v0.27.0 // indirect github.com/go-kit/kit v0.13.0 // indirect github.com/go-kit/log v0.2.1 // indirect @@ -201,6 +200,11 @@ require ( github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect + github.com/pion/dtls/v2 v2.2.7 // indirect + github.com/pion/logging v0.2.2 // indirect + github.com/pion/stun/v2 v2.0.0 // indirect + github.com/pion/transport/v2 v2.2.1 // indirect + github.com/pion/transport/v3 v3.0.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect @@ -216,9 +220,8 @@ require ( github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.11.0 // indirect - github.com/status-im/keycard-go v0.2.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/supranational/blst v0.3.13 // indirect + github.com/supranational/blst v0.3.14 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/go-amino v0.16.0 // indirect github.com/tidwall/btree v1.7.0 // indirect @@ -241,10 +244,10 @@ require ( golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect golang.org/x/mod v0.22.0 // indirect golang.org/x/oauth2 v0.24.0 // indirect - golang.org/x/sys v0.29.0 // indirect - golang.org/x/term v0.28.0 // indirect - golang.org/x/text v0.21.0 // indirect - golang.org/x/time v0.6.0 // indirect + golang.org/x/sys v0.30.0 // indirect + golang.org/x/term v0.29.0 // indirect + golang.org/x/text v0.22.0 // indirect + golang.org/x/time v0.9.0 // indirect google.golang.org/api v0.198.0 // indirect google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a // indirect @@ -296,7 +299,7 @@ replace ( github.com/cometbft/cometbft => github.com/initia-labs/cometbft v0.0.0-20250724054804-4480c844bbb4 github.com/cosmos/cosmos-sdk => github.com/initia-labs/cosmos-sdk v0.0.0-20250415174140-9fd233bcf847 github.com/cosmos/ibc-go/v8 => github.com/initia-labs/ibc-go/v8 v8.0.0-20250313020428-36b81501adfc - github.com/ethereum/go-ethereum => github.com/initia-labs/evm v0.0.0-20250502185204-604b1666eb18 + github.com/ethereum/go-ethereum => github.com/initia-labs/evm v0.0.0-20250912102056-ba6c5e82e490 github.com/skip-mev/connect/v2 => github.com/initia-labs/connect/v2 v2.3.1 // cosmos/relayer seems having problem with the latest version of grpc; return nil in the below line diff --git a/go.sum b/go.sum index 146726f0..e7acdaf7 100644 --- a/go.sum +++ b/go.sum @@ -877,8 +877,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.14.2 h1:YXVoyPndbdvcEVcseEovVfp0qjJp7S+i5+xgp/Nfbdc= -github.com/bits-and-blooms/bitset v1.14.2/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= +github.com/bits-and-blooms/bitset v1.20.0 h1:2F+rfL86jE2d/bmw7OhqUg2Sj/1rURkBn3MdfoPyRVU= +github.com/bits-and-blooms/bitset v1.20.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= @@ -976,10 +976,10 @@ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1: github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/cometbft/cometbft-db v0.15.0 h1:VLtsRt8udD4jHCyjvrsTBpgz83qne5hnL245AcPJVRk= github.com/cometbft/cometbft-db v0.15.0/go.mod h1:EBrFs1GDRiTqrWXYi4v90Awf/gcdD5ExzdPbg4X8+mk= -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.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M= -github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= +github.com/consensys/bavard v0.1.27 h1:j6hKUrGAy/H+gpNrpLU3I26n1yc+VMGmd6ID5+gAhOs= +github.com/consensys/bavard v0.1.27/go.mod h1:k/zVjHHC4B+PQy1Pg7fgvG3ALicQw540Crag8qx+dZs= +github.com/consensys/gnark-crypto v0.16.0 h1:8Dl4eYmUWK9WmlP1Bj6je688gBRJCJbT8Mw4KoTAawo= +github.com/consensys/gnark-crypto v0.16.0/go.mod h1:Ke3j06ndtPTVvo++PhGNgvm+lgpLvzbcE2MqljY7diU= 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/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -1018,12 +1018,15 @@ github.com/cosmos/ledger-cosmos-go v0.14.0/go.mod h1:E07xCWSBl3mTGofZ2QnL4cIUzMb github.com/cosmos/relayer/v2 v2.5.2 h1:AF0MOo1GvJo94QNB996fBHdKlH+vrIY3JcFNrIvZNP0= github.com/cosmos/relayer/v2 v2.5.2/go.mod h1:h4Ng2QsVpxExIq5S+WvLr8slDb9MSBh82gQS4DeMwDo= 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.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c h1:uQYC5Z1mdLRPrZhHjHxufI8+2UG/i25QG92j0Er9p6I= -github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= -github.com/crate-crypto/go-kzg-4844 v1.0.0 h1:TsSgHwrkTKecKJ4kadtHi4b3xHW5dCFUDFnUp1TsawI= -github.com/crate-crypto/go-kzg-4844 v1.0.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= +github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc= +github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/crate-crypto/go-eth-kzg v1.3.0 h1:05GrhASN9kDAidaFJOda6A4BEvgvuXbazXg/0E3OOdI= +github.com/crate-crypto/go-eth-kzg v1.3.0/go.mod h1:J9/u5sWfznSObptgfa92Jq8rTswn6ahQWEuiLHOjCUI= +github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a h1:W8mUrRp6NOVl3J+MYp5kPMoUZPp7aOYHtaua31lwRHg= +github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a/go.mod h1:sTwzHBvIzm2RfVCGNEBZgRyjwK40bVoun3ZnGOCafNM= +github.com/crate-crypto/go-kzg-4844 v1.1.0 h1:EN/u9k2TF6OWSHrCCDBBU6GLNMq88OspHHlMnHfoyU4= +github.com/crate-crypto/go-kzg-4844 v1.1.0/go.mod h1:JolLjpSff1tCCJKaJx4psrlEdlXuJEC996PL3tTAFks= github.com/creachadair/atomicfile v0.3.1 h1:yQORkHjSYySh/tv5th1dkKcn02NEW5JleB84sjt+W4Q= github.com/creachadair/atomicfile v0.3.1/go.mod h1:mwfrkRxFKwpNAflYZzytbSwxvbK6fdGRRlp0KEQc0qU= github.com/creachadair/tomledit v0.0.24 h1:5Xjr25R2esu1rKCbQEmjZYlrhFkDspoAbAKb6QKQDhQ= @@ -1046,6 +1049,8 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeC github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/deepmap/oapi-codegen v1.6.0 h1:w/d1ntwh91XI0b/8ja7+u5SvA4IFfM0UNNLmiDR1gg0= +github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= github.com/dgraph-io/badger/v4 v4.3.0 h1:lcsCE1/1qrRhqP+zYx6xDZb8n7U+QlwNicpc676Ub40= @@ -1081,16 +1086,18 @@ github.com/envoyproxy/protoc-gen-validate v0.9.1/go.mod h1:OKNgG7TCp5pF4d6XftA0+ github.com/envoyproxy/protoc-gen-validate v0.10.0/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= -github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA= -github.com/ethereum/c-kzg-4844 v1.0.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= -github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 h1:8NfxH2iXvJ60YRB8ChToFTUzl8awsc3cJ8CbLjGIl/A= -github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk= +github.com/ethereum/c-kzg-4844/v2 v2.1.0 h1:gQropX9YFBhl3g4HYhwE70zq3IHFRgbbNPw0Shwzf5w= +github.com/ethereum/c-kzg-4844/v2 v2.1.0/go.mod h1:TC48kOKjJKPbN7C++qIgt0TJzZ70QznYR7Ob+WXl57E= +github.com/ethereum/go-verkle v0.2.2 h1:I2W0WjnrFUIzzVPwm8ykY+7pL2d4VhlsePn4j7cnFk8= +github.com/ethereum/go-verkle v0.2.2/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/ferranbt/fastssz v0.1.2 h1:Dky6dXlngF6Qjc+EfDipAkE83N5I5DE68bY6O0VLNPk= +github.com/ferranbt/fastssz v0.1.2/go.mod h1:X5UPrE2u1UJjxHA8X54u04SBwdAQjG2sFtWs39YxyWs= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= @@ -1169,8 +1176,9 @@ github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/E github.com/gobwas/ws v1.2.1 h1:F2aeBZrm2NDsc7vbovKrWSogd4wvfAxg0FQ89/iqOTk= github.com/gobwas/ws v1.2.1/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/KY= github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/goccy/go-json v0.10.4 h1:JSwxQzIqKfmFX1swYPpUThQZp/Ka4wzJdK0LWVytLPM= +github.com/goccy/go-json v0.10.4/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= 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= @@ -1186,8 +1194,8 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP 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.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -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-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo= +github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= @@ -1341,6 +1349,8 @@ github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/graph-gophers/graphql-go v1.3.0 h1:Eb9x/q6MFpCLz7jBCiP/WTxjSDrYLR1QY41SORZyNJ0= +github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= @@ -1411,8 +1421,8 @@ github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 h1:X4egAf/gcS1zATw6w 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.3.1 h1:JfTzmih28bittyHM8z360dCjIA9dbPIBlcTI6lmctQs= -github.com/holiman/uint256 v1.3.1/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= +github.com/holiman/uint256 v1.3.2 h1:a9EgMPSC1AAaj1SZL5zIQD3WbwTuHrMGOerLjGmM/TA= +github.com/holiman/uint256 v1.3.2/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= @@ -1433,7 +1443,13 @@ github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPt github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/influxdata/influxdb-client-go/v2 v2.4.0 h1:HGBfZYStlx3Kqvsv1h2pJixbCl/jhnFtxpKFAv9Tu5k= +github.com/influxdata/influxdb-client-go/v2 v2.4.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c h1:qSHzRbhzK8RdXOsAdfDgO49TtqC1oZ+acxPrkfTxcCs= +github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 h1:W9WBk7wlPfJLvMCdtV4zPulc4uCPrlywQOmbFOhgQNU= +github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= github.com/initia-labs/OPinit v1.1.3 h1:Eh8wh5slLri2jA6HTcuf8gCEmDLKQyho1jB5wGkNW1I= github.com/initia-labs/OPinit v1.1.3/go.mod h1:Z7oAueQBVIBeV8+pJgZHFte9l5gh08DwifSUirihZwk= github.com/initia-labs/OPinit/api v1.1.0 h1:9ymAHFELWeqsKwT+RJYbG6GX4fQgL2kjdoR3DZL7LuQ= @@ -1444,8 +1460,8 @@ github.com/initia-labs/connect/v2 v2.3.1 h1:Y32LCwUHDBgUzzQHqPBJeWeItYoNu2oYD57J github.com/initia-labs/connect/v2 v2.3.1/go.mod h1:35hM7xSgI0h3GMUTgspzKY8Ff2yCXNGNwmAdjqo3z8s= github.com/initia-labs/cosmos-sdk v0.0.0-20250415174140-9fd233bcf847 h1:MUusHIRbaraL//dic8nCj7wXvVLT3LvKbS0k+Bj12oM= github.com/initia-labs/cosmos-sdk v0.0.0-20250415174140-9fd233bcf847/go.mod h1:hrWEFMU1eoXqLJeE6VVESpJDQH67FS1nnMrQIjO2daw= -github.com/initia-labs/evm v0.0.0-20250502185204-604b1666eb18 h1:I8enHyOzpP72XjFcjcQy90P9c93lK67iYie8mdtqOis= -github.com/initia-labs/evm v0.0.0-20250502185204-604b1666eb18/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E= +github.com/initia-labs/evm v0.0.0-20250912102056-ba6c5e82e490 h1:1W8uKX6aB63o8ob/rC1x7LXA3DUq5qZ/HfpIlh6GOO0= +github.com/initia-labs/evm v0.0.0-20250912102056-ba6c5e82e490/go.mod h1:mf8YiHIb0GR4x4TipcvBUPxJLw1mFdmxzoDi11sDRoI= github.com/initia-labs/ibc-go/v8 v8.0.0-20250313020428-36b81501adfc h1:fHVkBDhQl3uRtY2GMoYWt0rfh8vNZ+KKZlst+GrDxqc= github.com/initia-labs/ibc-go/v8 v8.0.0-20250313020428-36b81501adfc/go.mod h1:G2z+Q6ZQSMcyHI2+BVcJdvfOupb09M2h/tgpXOEdY6k= github.com/initia-labs/initia v1.1.2 h1:u+rrvGa4eaFPyC2dEzOTm7wEsRtMIwqoBM6Qb7Lpsn4= @@ -1528,8 +1544,8 @@ 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/leanovate/gopter v0.2.11 h1:vRjThO1EKPb/1NsDXuDrzldR28RLkBflWYcU9CvzWu4= +github.com/leanovate/gopter v0.2.11/go.mod h1:aK3tzZP/C+p1m3SPRE4SYZFGP7jjkuSI4f7Xvpt0S9c= github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= @@ -1573,6 +1589,8 @@ github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcs github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE= github.com/minio/highwayhash v1.0.3 h1:kbnuUMoHYyVl7szWjSxJnxw11k2U709jqFPPmIUyD6Q= github.com/minio/highwayhash v1.0.3/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ= +github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= +github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -1651,6 +1669,8 @@ github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= @@ -1666,6 +1686,8 @@ github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNc github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7 h1:oYW+YCJ1pachXTQmzR3rNLYGGz4g/UgFcjb28p/viDM= +github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 h1:Dx7Ovyv/SFnMFw3fD4oEoeorXc6saIiQ23LrGLth0Gw= github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY= @@ -1676,6 +1698,16 @@ github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/pion/dtls/v2 v2.2.7 h1:cSUBsETxepsCSFSxC3mc/aDo14qQLMSL+O6IjG28yV8= +github.com/pion/dtls/v2 v2.2.7/go.mod h1:8WiMkebSHFD0T+dIU+UeBaoV7kDhOW5oDCzZ7WZ/F9s= +github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY= +github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= +github.com/pion/stun/v2 v2.0.0 h1:A5+wXKLAypxQri59+tmQKVs7+l6mMM+3d+eER9ifRU0= +github.com/pion/stun/v2 v2.0.0/go.mod h1:22qRSh08fSEttYUmJZGlriq9+03jtVmXNODgLccj8GQ= +github.com/pion/transport/v2 v2.2.1 h1:7qYnCBlpgSJNYMbLCKuSY9KbQdBFoETvPNETv0y4N7c= +github.com/pion/transport/v2 v2.2.1/go.mod h1:cXXWavvCnFF6McHTft3DWS9iic2Mftcz1Aq29pGcU5g= +github.com/pion/transport/v3 v3.0.1 h1:gDTlPJwROfSfz6QfSi0ZmeCSkFcnWWiiR9ES0ouANiM= +github.com/pion/transport/v3 v3.0.1/go.mod h1:UY7kiITrlMv7/IKgd5eTUcaahZx5oUN3l9SzK5f5xE0= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -1794,8 +1826,6 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= -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/strangelove-ventures/cometbft-client v0.1.1 h1:chBZCTcTOGl3i+CjXWU+kIJZ7s6mY2uZ1gzwr7W2f0g= github.com/strangelove-ventures/cometbft-client v0.1.1/go.mod h1:aVposiPW9FOUeAeJ7JjJRdE3g+L6i8YDxFn6Cv6+Az4= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= @@ -1823,8 +1853,8 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf github.com/stretchr/testify v1.10.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.13 h1:AYeSxdOMacwu7FBmpfloBz5pbFXDmJL33RuwnKtmTjk= -github.com/supranational/blst v0.3.13/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= +github.com/supranational/blst v0.3.14 h1:xNMoHRJOTwMn63ip6qoWJ2Ymgvj7E2b9jY2FAwY+qRo= +github.com/supranational/blst v0.3.14/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= @@ -1849,13 +1879,13 @@ 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.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= -github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= +github.com/urfave/cli/v2 v2.27.5 h1:WoHEJLdsXr6dDWoJgMq/CboDmyY/8HMMH1fTECbih+w= +github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ= github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ= github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= -github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4= +github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -1941,16 +1971,18 @@ golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= +golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= -golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= -golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= +golang.org/x/crypto v0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs= +golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -2087,14 +2119,15 @@ golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= +golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= -golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= -golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= +golang.org/x/net v0.36.0 h1:vWF2fRbw4qslQsQzgFqZff+BItCvGFQqKzKIzx1rmoA= +golang.org/x/net v0.36.0/go.mod h1:bFmbeoIPfrw4sMHNhb4J9f6+tPziuGjq7Jk/38fxi1I= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -2147,8 +2180,8 @@ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= +golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -2264,8 +2297,8 @@ golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= -golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= +golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -2276,14 +2309,15 @@ golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo= +golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= -golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg= -golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= +golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU= +golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -2300,11 +2334,12 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= +golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -2312,8 +2347,8 @@ golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= -golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY= +golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/indexer/abci.go b/indexer/abci.go index b340287f..4b31b487 100644 --- a/indexer/abci.go +++ b/indexer/abci.go @@ -198,7 +198,7 @@ func (e *EVMIndexerImpl) doIndexing(args *indexingArgs, req *abci.RequestFinaliz blockHeader := coretypes.Header{ TxHash: coretypes.DeriveSha(coretypes.Transactions(ethTxs), hasher), ReceiptHash: coretypes.DeriveSha(coretypes.Receipts(receipts), hasher), - Bloom: coretypes.CreateBloom(receipts), + Bloom: coretypes.MergeBloom(receipts), GasLimit: blockGasMeter.Limit(), GasUsed: blockGasMeter.GasConsumedToLimit(), Number: big.NewInt(blockHeight), diff --git a/indexer/bloom.go b/indexer/bloom.go index e65fbdc3..c55ccc74 100644 --- a/indexer/bloom.go +++ b/indexer/bloom.go @@ -87,6 +87,9 @@ func (e *EVMIndexerImpl) bloomIndexing(ctx context.Context, height uint64) error return err } + // update the last bloom indexed height + e.lastBloomIndexedHeight.Store(height) + return nil } diff --git a/indexer/indexer.go b/indexer/indexer.go index c1a49ef7..540e6490 100644 --- a/indexer/indexer.go +++ b/indexer/indexer.go @@ -99,9 +99,11 @@ type EVMIndexerImpl struct { retainHeight uint64 backfillStartHeight uint64 - pruningRunning *atomic.Bool - bloomIndexingRunning *atomic.Bool - lastIndexedHeight *atomic.Uint64 + pruningRunning *atomic.Bool + bloomIndexingRunning *atomic.Bool + lastIndexedHeight *atomic.Uint64 + lastPrunedHeight *atomic.Uint64 + lastBloomIndexedHeight *atomic.Uint64 db dbm.DB logger log.Logger @@ -182,9 +184,11 @@ func NewEVMIndexer( retainHeight: cfg.IndexerRetainHeight, backfillStartHeight: cfg.IndexerBackfillStartHeight, - pruningRunning: &atomic.Bool{}, - bloomIndexingRunning: &atomic.Bool{}, - lastIndexedHeight: &atomic.Uint64{}, + pruningRunning: &atomic.Bool{}, + bloomIndexingRunning: &atomic.Bool{}, + lastIndexedHeight: &atomic.Uint64{}, + lastPrunedHeight: &atomic.Uint64{}, + lastBloomIndexedHeight: &atomic.Uint64{}, db: db, store: store, @@ -303,6 +307,14 @@ func (e *EVMIndexerImpl) GetLastIndexedHeight(ctx context.Context) (uint64, erro return lastIndexedHeight, nil } +func (e *EVMIndexerImpl) GetLastPrunedHeight() uint64 { + return e.lastPrunedHeight.Load() +} + +func (e *EVMIndexerImpl) GetLastBloomIndexedHeight() uint64 { + return e.lastBloomIndexedHeight.Load() +} + // blockEvents is a struct to emit block events. type blockEvents struct { header *coretypes.Header diff --git a/indexer/prune.go b/indexer/prune.go index 7e1b1c97..825ba02b 100644 --- a/indexer/prune.go +++ b/indexer/prune.go @@ -50,8 +50,12 @@ func (e *EVMIndexerImpl) prune(ctx context.Context, curHeight uint64) error { return err } + // write the changes to the store e.store.Write() + // update the last pruned height + e.lastPrunedHeight.Store(curHeight) + return nil } diff --git a/indexer/prune_test.go b/indexer/prune_test.go index 0b83d21f..27475b90 100644 --- a/indexer/prune_test.go +++ b/indexer/prune_test.go @@ -126,14 +126,16 @@ func Test_PruneIndexer_BloomBits(t *testing.T) { // set retain height to 1, only last block is indexed indexer.SetRetainHeight(1) - for i := uint64(0); i < evmconfig.SectionSize; i++ { + startHeight := uint64(app.LastBlockHeight()) + nextSectionHeight := (startHeight/evmconfig.SectionSize + 1) * evmconfig.SectionSize + for range evmconfig.SectionSize + 1 { tests.IncreaseBlockHeight(t, app) } // wait for bloom indexing for { time.Sleep(100 * time.Millisecond) - if indexer.IsBloomIndexingRunning() { + if indexer.GetLastBloomIndexedHeight() < nextSectionHeight { continue } else { break @@ -143,21 +145,20 @@ func Test_PruneIndexer_BloomBits(t *testing.T) { // wait for pruning for { time.Sleep(100 * time.Millisecond) - - if indexer.IsPruningRunning() { + if indexer.GetLastPrunedHeight() < nextSectionHeight { continue } else { break } } - // create a new block to trigger bloom indexing + // increase block height to trigger bloom indexing and pruning tests.IncreaseBlockHeight(t, app) // wait for bloom indexing for { time.Sleep(100 * time.Millisecond) - if indexer.IsBloomIndexingRunning() { + if indexer.GetLastBloomIndexedHeight() < nextSectionHeight { continue } else { break @@ -167,7 +168,7 @@ func Test_PruneIndexer_BloomBits(t *testing.T) { // wait for pruning for { time.Sleep(100 * time.Millisecond) - if indexer.IsPruningRunning() { + if indexer.GetLastPrunedHeight() < nextSectionHeight { continue } else { break diff --git a/integration-tests/erc721_transfer_test.go b/integration-tests/erc721_transfer_test.go index f07124fb..5c5ae95a 100644 --- a/integration-tests/erc721_transfer_test.go +++ b/integration-tests/erc721_transfer_test.go @@ -77,7 +77,7 @@ func (suite *KeeperTestSuite) MintNft( contractAddr, err := evmtypes.ContractAddressFromClassId(ctx, nftKeeper, classId) suite.Require().NoError(err) - _, _, err = nftKeeper.EVMCall(ctx, createAccountAddr, contractAddr, inputBz, nil, nil) + _, _, err = nftKeeper.EVMCall(ctx, createAccountAddr, contractAddr, inputBz, nil, nil, nil) suite.Require().NoError(err) } diff --git a/integration-tests/go.mod b/integration-tests/go.mod index ab859c0f..96597c4a 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -7,7 +7,7 @@ require ( github.com/cometbft/cometbft v0.38.17 github.com/cosmos/cosmos-sdk v0.50.13 github.com/cosmos/ibc-go/v8 v8.7.0 - github.com/ethereum/go-ethereum v1.14.11 + github.com/ethereum/go-ethereum v1.15.11 github.com/initia-labs/initia v1.1.2 github.com/initia-labs/minievm v1.0.7 github.com/stretchr/testify v1.10.0 @@ -48,8 +48,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.14.2 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect + github.com/bits-and-blooms/bitset v1.20.0 // indirect github.com/celestiaorg/go-square/v2 v2.0.0 // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect @@ -62,8 +61,8 @@ require ( github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/cometbft/cometbft-db v0.15.0 // indirect - github.com/consensys/bavard v0.1.13 // indirect - github.com/consensys/gnark-crypto v0.12.1 // indirect + github.com/consensys/bavard v0.1.27 // indirect + github.com/consensys/gnark-crypto v0.16.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/cosmos-db v1.1.1 // indirect github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect @@ -76,8 +75,8 @@ require ( github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/interchain-security/v6 v6.3.0 // indirect github.com/cosmos/ledger-cosmos-go v0.14.0 // indirect - github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c // indirect - github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect + github.com/crate-crypto/go-eth-kzg v1.3.0 // indirect + github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect github.com/danieljoos/wincred v1.1.2 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/deckarep/golang-set/v2 v2.6.0 // indirect @@ -88,8 +87,8 @@ require ( github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.6.0 // indirect github.com/emicklei/dot v1.6.2 // indirect - github.com/ethereum/c-kzg-4844 v1.0.0 // indirect - github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 // indirect + github.com/ethereum/c-kzg-4844/v2 v2.1.0 // indirect + github.com/ethereum/go-verkle v0.2.2 // indirect github.com/fatih/color v1.18.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect @@ -136,13 +135,13 @@ require ( github.com/hashicorp/yamux v0.1.1 // indirect github.com/hdevalence/ed25519consensus v0.1.0 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect - github.com/holiman/uint256 v1.3.1 // indirect + github.com/holiman/uint256 v1.3.2 // indirect github.com/huandu/skiplist v1.2.0 // indirect github.com/iancoleman/orderedmap v0.3.0 // indirect github.com/iancoleman/strcase v0.3.0 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/initia-labs/OPinit v1.1.1 // indirect + github.com/initia-labs/OPinit v1.1.3 // indirect github.com/initia-labs/OPinit/api v1.1.0 // indirect github.com/initia-labs/kvindexer v0.2.0 // indirect github.com/initia-labs/kvindexer/submodules/block v0.2.0 // indirect @@ -201,7 +200,7 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.19.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/supranational/blst v0.3.13 // indirect + github.com/supranational/blst v0.3.14 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/go-amino v0.16.0 // indirect github.com/tidwall/btree v1.7.0 // indirect @@ -219,16 +218,16 @@ require ( go.opentelemetry.io/otel/metric v1.32.0 // indirect go.opentelemetry.io/otel/trace v1.32.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.32.0 // indirect + golang.org/x/crypto v0.35.0 // indirect golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect golang.org/x/mod v0.22.0 // indirect - golang.org/x/net v0.34.0 // indirect + golang.org/x/net v0.36.0 // indirect golang.org/x/oauth2 v0.24.0 // indirect - golang.org/x/sync v0.10.0 // indirect - golang.org/x/sys v0.29.0 // indirect - golang.org/x/term v0.28.0 // indirect - golang.org/x/text v0.21.0 // indirect - golang.org/x/time v0.6.0 // indirect + golang.org/x/sync v0.11.0 // indirect + golang.org/x/sys v0.30.0 // indirect + golang.org/x/term v0.29.0 // indirect + golang.org/x/text v0.22.0 // indirect + golang.org/x/time v0.9.0 // indirect google.golang.org/api v0.198.0 // indirect google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20241202173237-19429a94021a // indirect @@ -281,7 +280,7 @@ replace ( github.com/cometbft/cometbft => github.com/initia-labs/cometbft v0.0.0-20250724054804-4480c844bbb4 github.com/cosmos/cosmos-sdk => github.com/initia-labs/cosmos-sdk v0.0.0-20250415174140-9fd233bcf847 github.com/cosmos/ibc-go/v8 => github.com/initia-labs/ibc-go/v8 v8.0.0-20250313020428-36b81501adfc - github.com/ethereum/go-ethereum => github.com/initia-labs/evm v0.0.0-20250502185204-604b1666eb18 + github.com/ethereum/go-ethereum => github.com/initia-labs/evm v0.0.0-20250912102056-ba6c5e82e490 github.com/skip-mev/connect/v2 => github.com/initia-labs/connect/v2 v2.3.1 // cosmos/relayer seems having problem with the latest version of grpc; return nil in the below line diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 4a533102..6f479d99 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -872,8 +872,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.14.2 h1:YXVoyPndbdvcEVcseEovVfp0qjJp7S+i5+xgp/Nfbdc= -github.com/bits-and-blooms/bitset v1.14.2/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= +github.com/bits-and-blooms/bitset v1.20.0 h1:2F+rfL86jE2d/bmw7OhqUg2Sj/1rURkBn3MdfoPyRVU= +github.com/bits-and-blooms/bitset v1.20.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= github.com/btcsuite/btcd v0.24.2 h1:aLmxPguqxza+4ag8R1I2nnJjSu2iFn/kqtHTIImswcY= @@ -881,8 +881,6 @@ github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurT github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/btcutil v1.1.6 h1:zFL2+c3Lb9gEgqKNzowKUPQNb8jV7v5Oaodi/AYFd6c= github.com/btcsuite/btcd/btcutil v1.1.6/go.mod h1:9dFymx8HpuLqBnsPELrImQeTQfKBQqzqGbbV3jK55aE= -github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6sjybR934QNHSJZPTQ= -github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= @@ -951,10 +949,10 @@ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1: github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/cometbft/cometbft-db v0.15.0 h1:VLtsRt8udD4jHCyjvrsTBpgz83qne5hnL245AcPJVRk= github.com/cometbft/cometbft-db v0.15.0/go.mod h1:EBrFs1GDRiTqrWXYi4v90Awf/gcdD5ExzdPbg4X8+mk= -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.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M= -github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= +github.com/consensys/bavard v0.1.27 h1:j6hKUrGAy/H+gpNrpLU3I26n1yc+VMGmd6ID5+gAhOs= +github.com/consensys/bavard v0.1.27/go.mod h1:k/zVjHHC4B+PQy1Pg7fgvG3ALicQw540Crag8qx+dZs= +github.com/consensys/gnark-crypto v0.16.0 h1:8Dl4eYmUWK9WmlP1Bj6je688gBRJCJbT8Mw4KoTAawo= +github.com/consensys/gnark-crypto v0.16.0/go.mod h1:Ke3j06ndtPTVvo++PhGNgvm+lgpLvzbcE2MqljY7diU= 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/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -991,12 +989,15 @@ github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStK github.com/cosmos/ledger-cosmos-go v0.14.0 h1:WfCHricT3rPbkPSVKRH+L4fQGKYHuGOK9Edpel8TYpE= github.com/cosmos/ledger-cosmos-go v0.14.0/go.mod h1:E07xCWSBl3mTGofZ2QnL4cIUzMbbGVyik84QYKbX3RA= 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.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c h1:uQYC5Z1mdLRPrZhHjHxufI8+2UG/i25QG92j0Er9p6I= -github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= -github.com/crate-crypto/go-kzg-4844 v1.0.0 h1:TsSgHwrkTKecKJ4kadtHi4b3xHW5dCFUDFnUp1TsawI= -github.com/crate-crypto/go-kzg-4844 v1.0.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= +github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc= +github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/crate-crypto/go-eth-kzg v1.3.0 h1:05GrhASN9kDAidaFJOda6A4BEvgvuXbazXg/0E3OOdI= +github.com/crate-crypto/go-eth-kzg v1.3.0/go.mod h1:J9/u5sWfznSObptgfa92Jq8rTswn6ahQWEuiLHOjCUI= +github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a h1:W8mUrRp6NOVl3J+MYp5kPMoUZPp7aOYHtaua31lwRHg= +github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a/go.mod h1:sTwzHBvIzm2RfVCGNEBZgRyjwK40bVoun3ZnGOCafNM= +github.com/crate-crypto/go-kzg-4844 v1.1.0 h1:EN/u9k2TF6OWSHrCCDBBU6GLNMq88OspHHlMnHfoyU4= +github.com/crate-crypto/go-kzg-4844 v1.1.0/go.mod h1:JolLjpSff1tCCJKaJx4psrlEdlXuJEC996PL3tTAFks= 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.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= @@ -1011,6 +1012,8 @@ github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5il github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= +github.com/deepmap/oapi-codegen v1.6.0 h1:w/d1ntwh91XI0b/8ja7+u5SvA4IFfM0UNNLmiDR1gg0= +github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= github.com/dgraph-io/badger/v4 v4.3.0 h1:lcsCE1/1qrRhqP+zYx6xDZb8n7U+QlwNicpc676Ub40= @@ -1046,16 +1049,18 @@ github.com/envoyproxy/protoc-gen-validate v0.9.1/go.mod h1:OKNgG7TCp5pF4d6XftA0+ github.com/envoyproxy/protoc-gen-validate v0.10.0/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= -github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA= -github.com/ethereum/c-kzg-4844 v1.0.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= -github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 h1:8NfxH2iXvJ60YRB8ChToFTUzl8awsc3cJ8CbLjGIl/A= -github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk= +github.com/ethereum/c-kzg-4844/v2 v2.1.0 h1:gQropX9YFBhl3g4HYhwE70zq3IHFRgbbNPw0Shwzf5w= +github.com/ethereum/c-kzg-4844/v2 v2.1.0/go.mod h1:TC48kOKjJKPbN7C++qIgt0TJzZ70QznYR7Ob+WXl57E= +github.com/ethereum/go-verkle v0.2.2 h1:I2W0WjnrFUIzzVPwm8ykY+7pL2d4VhlsePn4j7cnFk8= +github.com/ethereum/go-verkle v0.2.2/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/ferranbt/fastssz v0.1.2 h1:Dky6dXlngF6Qjc+EfDipAkE83N5I5DE68bY6O0VLNPk= +github.com/ferranbt/fastssz v0.1.2/go.mod h1:X5UPrE2u1UJjxHA8X54u04SBwdAQjG2sFtWs39YxyWs= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= @@ -1134,8 +1139,9 @@ github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/E github.com/gobwas/ws v1.2.1 h1:F2aeBZrm2NDsc7vbovKrWSogd4wvfAxg0FQ89/iqOTk= github.com/gobwas/ws v1.2.1/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/KY= github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/goccy/go-json v0.10.4 h1:JSwxQzIqKfmFX1swYPpUThQZp/Ka4wzJdK0LWVytLPM= +github.com/goccy/go-json v0.10.4/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= 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= @@ -1151,8 +1157,8 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP 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.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -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-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo= +github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= @@ -1301,6 +1307,8 @@ github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/graph-gophers/graphql-go v1.3.0 h1:Eb9x/q6MFpCLz7jBCiP/WTxjSDrYLR1QY41SORZyNJ0= +github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= @@ -1371,8 +1379,8 @@ github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 h1:X4egAf/gcS1zATw6w 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.3.1 h1:JfTzmih28bittyHM8z360dCjIA9dbPIBlcTI6lmctQs= -github.com/holiman/uint256 v1.3.1/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= +github.com/holiman/uint256 v1.3.2 h1:a9EgMPSC1AAaj1SZL5zIQD3WbwTuHrMGOerLjGmM/TA= +github.com/holiman/uint256 v1.3.2/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= @@ -1393,9 +1401,15 @@ github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPt github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/influxdata/influxdb-client-go/v2 v2.4.0 h1:HGBfZYStlx3Kqvsv1h2pJixbCl/jhnFtxpKFAv9Tu5k= +github.com/influxdata/influxdb-client-go/v2 v2.4.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/initia-labs/OPinit v1.1.1 h1:RyeDc84vqDDJhADSkDa7qP4UeJaL3fTuCBhZZsMNip0= -github.com/initia-labs/OPinit v1.1.1/go.mod h1:Z7oAueQBVIBeV8+pJgZHFte9l5gh08DwifSUirihZwk= +github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c h1:qSHzRbhzK8RdXOsAdfDgO49TtqC1oZ+acxPrkfTxcCs= +github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 h1:W9WBk7wlPfJLvMCdtV4zPulc4uCPrlywQOmbFOhgQNU= +github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= +github.com/initia-labs/OPinit v1.1.3 h1:Eh8wh5slLri2jA6HTcuf8gCEmDLKQyho1jB5wGkNW1I= +github.com/initia-labs/OPinit v1.1.3/go.mod h1:Z7oAueQBVIBeV8+pJgZHFte9l5gh08DwifSUirihZwk= github.com/initia-labs/OPinit/api v1.1.0 h1:9ymAHFELWeqsKwT+RJYbG6GX4fQgL2kjdoR3DZL7LuQ= github.com/initia-labs/OPinit/api v1.1.0/go.mod h1:Qz11o6zlTtJe495JO7FhEyLhJLPit0rEuLN4pweKL24= github.com/initia-labs/cometbft v0.0.0-20250724054804-4480c844bbb4 h1:2jorpnQ/m4o4oThb6Wt9mNQIT2HRqGh62jOflIi5zsI= @@ -1404,8 +1418,8 @@ github.com/initia-labs/connect/v2 v2.3.1 h1:Y32LCwUHDBgUzzQHqPBJeWeItYoNu2oYD57J github.com/initia-labs/connect/v2 v2.3.1/go.mod h1:35hM7xSgI0h3GMUTgspzKY8Ff2yCXNGNwmAdjqo3z8s= github.com/initia-labs/cosmos-sdk v0.0.0-20250415174140-9fd233bcf847 h1:MUusHIRbaraL//dic8nCj7wXvVLT3LvKbS0k+Bj12oM= github.com/initia-labs/cosmos-sdk v0.0.0-20250415174140-9fd233bcf847/go.mod h1:hrWEFMU1eoXqLJeE6VVESpJDQH67FS1nnMrQIjO2daw= -github.com/initia-labs/evm v0.0.0-20250502185204-604b1666eb18 h1:I8enHyOzpP72XjFcjcQy90P9c93lK67iYie8mdtqOis= -github.com/initia-labs/evm v0.0.0-20250502185204-604b1666eb18/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E= +github.com/initia-labs/evm v0.0.0-20250912102056-ba6c5e82e490 h1:1W8uKX6aB63o8ob/rC1x7LXA3DUq5qZ/HfpIlh6GOO0= +github.com/initia-labs/evm v0.0.0-20250912102056-ba6c5e82e490/go.mod h1:mf8YiHIb0GR4x4TipcvBUPxJLw1mFdmxzoDi11sDRoI= github.com/initia-labs/ibc-go/v8 v8.0.0-20250313020428-36b81501adfc h1:fHVkBDhQl3uRtY2GMoYWt0rfh8vNZ+KKZlst+GrDxqc= github.com/initia-labs/ibc-go/v8 v8.0.0-20250313020428-36b81501adfc/go.mod h1:G2z+Q6ZQSMcyHI2+BVcJdvfOupb09M2h/tgpXOEdY6k= github.com/initia-labs/initia v1.1.2 h1:u+rrvGa4eaFPyC2dEzOTm7wEsRtMIwqoBM6Qb7Lpsn4= @@ -1482,8 +1496,8 @@ 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/leanovate/gopter v0.2.11 h1:vRjThO1EKPb/1NsDXuDrzldR28RLkBflWYcU9CvzWu4= +github.com/leanovate/gopter v0.2.11/go.mod h1:aK3tzZP/C+p1m3SPRE4SYZFGP7jjkuSI4f7Xvpt0S9c= github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= @@ -1527,6 +1541,8 @@ github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcs github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE= github.com/minio/highwayhash v1.0.3 h1:kbnuUMoHYyVl7szWjSxJnxw11k2U709jqFPPmIUyD6Q= github.com/minio/highwayhash v1.0.3/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ= +github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= +github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -1604,6 +1620,8 @@ github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= @@ -1619,6 +1637,8 @@ github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNc github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7 h1:oYW+YCJ1pachXTQmzR3rNLYGGz4g/UgFcjb28p/viDM= +github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 h1:Dx7Ovyv/SFnMFw3fD4oEoeorXc6saIiQ23LrGLth0Gw= github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY= @@ -1629,6 +1649,16 @@ github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/pion/dtls/v2 v2.2.7 h1:cSUBsETxepsCSFSxC3mc/aDo14qQLMSL+O6IjG28yV8= +github.com/pion/dtls/v2 v2.2.7/go.mod h1:8WiMkebSHFD0T+dIU+UeBaoV7kDhOW5oDCzZ7WZ/F9s= +github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY= +github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= +github.com/pion/stun/v2 v2.0.0 h1:A5+wXKLAypxQri59+tmQKVs7+l6mMM+3d+eER9ifRU0= +github.com/pion/stun/v2 v2.0.0/go.mod h1:22qRSh08fSEttYUmJZGlriq9+03jtVmXNODgLccj8GQ= +github.com/pion/transport/v2 v2.2.1 h1:7qYnCBlpgSJNYMbLCKuSY9KbQdBFoETvPNETv0y4N7c= +github.com/pion/transport/v2 v2.2.1/go.mod h1:cXXWavvCnFF6McHTft3DWS9iic2Mftcz1Aq29pGcU5g= +github.com/pion/transport/v3 v3.0.1 h1:gDTlPJwROfSfz6QfSi0ZmeCSkFcnWWiiR9ES0ouANiM= +github.com/pion/transport/v3 v3.0.1/go.mod h1:UY7kiITrlMv7/IKgd5eTUcaahZx5oUN3l9SzK5f5xE0= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -1747,8 +1777,6 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= -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= @@ -1774,8 +1802,8 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf github.com/stretchr/testify v1.10.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.13 h1:AYeSxdOMacwu7FBmpfloBz5pbFXDmJL33RuwnKtmTjk= -github.com/supranational/blst v0.3.13/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= +github.com/supranational/blst v0.3.14 h1:xNMoHRJOTwMn63ip6qoWJ2Ymgvj7E2b9jY2FAwY+qRo= +github.com/supranational/blst v0.3.14/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= @@ -1790,8 +1818,6 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1 github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= -github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= -github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= @@ -1800,13 +1826,13 @@ 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.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= -github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= +github.com/urfave/cli/v2 v2.27.5 h1:WoHEJLdsXr6dDWoJgMq/CboDmyY/8HMMH1fTECbih+w= +github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ= github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ= github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= -github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4= +github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -1899,8 +1925,8 @@ golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1m golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= -golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= -golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= +golang.org/x/crypto v0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs= +golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -2042,8 +2068,8 @@ golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= -golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= -golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= +golang.org/x/net v0.36.0 h1:vWF2fRbw4qslQsQzgFqZff+BItCvGFQqKzKIzx1rmoA= +golang.org/x/net v0.36.0/go.mod h1:bFmbeoIPfrw4sMHNhb4J9f6+tPziuGjq7Jk/38fxi1I= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -2096,8 +2122,8 @@ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= +golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -2213,8 +2239,8 @@ golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= -golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= +golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -2231,8 +2257,8 @@ golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= -golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg= -golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= +golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU= +golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -2252,8 +2278,8 @@ golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= +golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -2261,8 +2287,8 @@ golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= -golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY= +golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/integration-tests/wrapper_test.go b/integration-tests/wrapper_test.go index 53683bb7..bc29fb51 100644 --- a/integration-tests/wrapper_test.go +++ b/integration-tests/wrapper_test.go @@ -145,7 +145,7 @@ func (suite *KeeperTestSuite) createAndMintERC20(endpoint *ibctesting.Endpoint, inputBz, err := abi.Pack("createERC20", "foo", "foo", decimals) suite.Require().NoError(err) - result, _, err := evmKeeper.EVMCall(ctx, toAddr, ethFactoryAddr, inputBz, nil, nil) + result, _, err := evmKeeper.EVMCall(ctx, toAddr, ethFactoryAddr, inputBz, nil, nil, nil) suite.Require().NoError(err) tokenAddr := common.BytesToAddress(result) @@ -156,7 +156,7 @@ func (suite *KeeperTestSuite) createAndMintERC20(endpoint *ibctesting.Endpoint, inputBz, err = abi.Pack("mint", toAddr, amount) suite.Require().NoError(err) - _, _, err = evmKeeper.EVMCall(ctx, toAddr, tokenAddr, inputBz, nil, nil) + _, _, err = evmKeeper.EVMCall(ctx, toAddr, tokenAddr, inputBz, nil, nil, nil) suite.Require().NoError(err) return tokenAddr @@ -192,7 +192,7 @@ func (suite *KeeperTestSuite) wrapLocal( // approve inputBz, err := erc20Keeper.GetERC20ABI().Pack("approve", wrapperAddr, amount) suite.Require().NoError(err) - _, _, err = evmKeeper.EVMCall(fromCtx, senderAddr, tokenAddress, inputBz, nil, nil) + _, _, err = evmKeeper.EVMCall(fromCtx, senderAddr, tokenAddress, inputBz, nil, nil, nil) suite.Require().NoError(err) // wrap 18dp token to 6dp token @@ -461,7 +461,7 @@ func (suite *KeeperTestSuite) unwrapRemote( // approve inputBz, err := erc20Keeper.GetERC20ABI().Pack("approve", wrapperAddr, amount) suite.Require().NoError(err) - _, _, err = evmKeeper.EVMCall(fromCtx, senderAddr, tokenAddress, inputBz, nil, nil) + _, _, err = evmKeeper.EVMCall(fromCtx, senderAddr, tokenAddress, inputBz, nil, nil, nil) suite.Require().NoError(err) // unwrap 18dp token to 6dp token diff --git a/jsonrpc/backend/tracer.go b/jsonrpc/backend/tracer.go index 9dec9741..609417cd 100644 --- a/jsonrpc/backend/tracer.go +++ b/jsonrpc/backend/tracer.go @@ -21,7 +21,7 @@ import ( rpctypes "github.com/initia-labs/minievm/jsonrpc/types" "github.com/initia-labs/minievm/x/evm/state" - evmtypes "github.com/initia-labs/minievm/x/evm/types" + "github.com/initia-labs/minievm/x/evm/types" ) // TraceBlockByNumber configures a new tracer according to the provided configuration, and @@ -299,7 +299,7 @@ func (b *JSONRPCBackend) traceTx( Stop: logger.Stop, } } else { - tracer, err = tracers.DefaultDirectory.New(*config.Tracer, txctx, config.TracerConfig) + tracer, err = tracers.DefaultDirectory.New(*config.Tracer, txctx, config.TracerConfig, types.DefaultChainConfig(sdkCtx)) if err != nil { return nil, err } @@ -350,15 +350,15 @@ func (b *JSONRPCBackend) runTxWithTracer( return err } - tracing := evmtypes.NewTracing(evm, tracer.Hooks) - sdkCtx = sdkCtx.WithValue(evmtypes.CONTEXT_KEY_TRACING, tracing) - sdkCtx = sdkCtx.WithValue(evmtypes.CONTEXT_KEY_TRACE_EVM, evmPointer) + tracing := types.NewTracing(evm, tracer.Hooks) + sdkCtx = sdkCtx.WithValue(types.CONTEXT_KEY_TRACING, tracing) + sdkCtx = sdkCtx.WithValue(types.CONTEXT_KEY_TRACE_EVM, evmPointer) if tracer.OnTxStart != nil { - tracer.OnTxStart(tracing.VMContext(), evmtypes.TracingTx(gasLimit), feePayer) + tracer.OnTxStart(tracing.VMContext(), types.TracingTx(gasLimit), feePayer) } if tracer.OnEnter != nil { - tracer.OnEnter(0, byte(vm.CALL), evmtypes.NullAddress, evmtypes.NullAddress, []byte{}, gasLimit, nil) + tracer.OnEnter(0, byte(vm.CALL), types.NullAddress, types.NullAddress, []byte{}, gasLimit, nil) } } @@ -396,7 +396,7 @@ func (b *JSONRPCBackend) runTxWithTracer( if tracer != nil { gasUsed := sdkCtx.GasMeter().GasConsumedToLimit() if tracer.OnExit != nil { - if revertErr, ok := err.(*evmtypes.RevertError); ok { + if revertErr, ok := err.(*types.RevertError); ok { tracer.OnExit(0, revertErr.Ret(), gasUsed, vm.ErrExecutionReverted, true) } else { tracer.OnExit(0, nil, gasUsed, err, false) diff --git a/jsonrpc/types/tx.go b/jsonrpc/types/tx.go index 875d5360..59e92832 100644 --- a/jsonrpc/types/tx.go +++ b/jsonrpc/types/tx.go @@ -5,6 +5,8 @@ import ( "gopkg.in/yaml.v3" + "github.com/holiman/uint256" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" coretypes "github.com/ethereum/go-ethereum/core/types" @@ -131,6 +133,21 @@ func (rpcTx RPCTransaction) ToTransaction() *coretypes.Transaction { R: rpcTx.R.ToInt(), S: rpcTx.S.ToInt(), })) + case coretypes.SetCodeTxType: + return coretypes.NewTx((&coretypes.SetCodeTx{ + ChainID: uint256.MustFromBig(rpcTx.ChainID.ToInt()), + Nonce: uint64(rpcTx.Nonce), + GasTipCap: uint256.MustFromBig(rpcTx.GasTipCap.ToInt()), + GasFeeCap: uint256.MustFromBig(rpcTx.GasFeeCap.ToInt()), + Gas: uint64(rpcTx.Gas), + To: *rpcTx.To, + Value: uint256.MustFromBig(rpcTx.Value.ToInt()), + Data: rpcTx.Input, + AccessList: accessList, + V: uint256.MustFromBig(rpcTx.V.ToInt()), + R: uint256.MustFromBig(rpcTx.R.ToInt()), + S: uint256.MustFromBig(rpcTx.S.ToInt()), + })) default: return nil } diff --git a/jsonrpc/types/tx_test.go b/jsonrpc/types/tx_test.go index 9aa63c2b..acabadc0 100644 --- a/jsonrpc/types/tx_test.go +++ b/jsonrpc/types/tx_test.go @@ -5,11 +5,14 @@ import ( "math/big" "testing" + "github.com/holiman/uint256" + "github.com/stretchr/testify/require" + "github.com/ethereum/go-ethereum/common" coretypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" + types "github.com/initia-labs/minievm/jsonrpc/types" - "github.com/stretchr/testify/require" ) func TestLegacyTxTypeRPCTransaction(t *testing.T) { @@ -32,7 +35,7 @@ func TestLegacyTxTypeRPCTransaction(t *testing.T) { S: nil, }) - signedTx, err := coretypes.SignTx(tx, coretypes.NewCancunSigner(chainID), privateKey) + signedTx, err := coretypes.SignTx(tx, coretypes.NewPragueSigner(chainID), privateKey) if err != nil { t.Fatalf("Failed to sign transaction: %v", err) } @@ -67,7 +70,7 @@ func TestAccessListTypeRPCTransaction(t *testing.T) { S: nil, }) - signedTx, err := coretypes.SignTx(tx, coretypes.NewCancunSigner(chainID), privateKey) + signedTx, err := coretypes.SignTx(tx, coretypes.NewPragueSigner(chainID), privateKey) if err != nil { t.Fatalf("Failed to sign transaction: %v", err) } @@ -101,7 +104,7 @@ func TestDynamicFeeTxTypeRPCTransaction(t *testing.T) { S: nil, }) - signedTx, err := coretypes.SignTx(tx, coretypes.NewCancunSigner(chainID), privateKey) + signedTx, err := coretypes.SignTx(tx, coretypes.NewPragueSigner(chainID), privateKey) if err != nil { t.Fatalf("Failed to sign transaction: %v", err) } @@ -114,6 +117,41 @@ func TestDynamicFeeTxTypeRPCTransaction(t *testing.T) { _ = rpcTx.String() } +func TestSetCodeTxTypeRPCTransaction(t *testing.T) { + privateKey, err := crypto.GenerateKey() + if err != nil { + t.Fatalf("Failed to generate private key: %v", err) + } + + toAddress := crypto.PubkeyToAddress(privateKey.PublicKey) + chainID := big.NewInt(1) + tx := coretypes.NewTx(&coretypes.SetCodeTx{ + ChainID: uint256.MustFromBig(chainID), + Nonce: 0, + GasTipCap: uint256.MustFromBig(big.NewInt(20)), + GasFeeCap: uint256.MustFromBig(big.NewInt(100)), + Gas: 21000, + To: toAddress, + Value: uint256.MustFromBig(big.NewInt(1000)), + Data: []byte{0x01, 0x02, 0x03, 0x04}, + AccessList: nil, + V: uint256.MustFromBig(big.NewInt(0)), + R: uint256.MustFromBig(big.NewInt(0)), + S: uint256.MustFromBig(big.NewInt(0)), + }) + + signedTx, err := coretypes.SignTx(tx, coretypes.NewPragueSigner(chainID), privateKey) + if err != nil { + t.Fatalf("Failed to sign transaction: %v", err) + } + rpcTx := types.NewRPCTransaction(signedTx, common.Hash{}, 0, 0, chainID) + ethTx := rpcTx.ToTransaction() + err = matchTx(signedTx, ethTx) + require.NoError(t, err) + + _ = rpcTx.String() +} + func matchTx(signedTx *coretypes.Transaction, ethTx *coretypes.Transaction) error { if signedTx.Type() != ethTx.Type() { return fmt.Errorf("Expected transaction type %v, got %v", signedTx.Type(), ethTx.Type()) diff --git a/proto/minievm/evm/v1/query.proto b/proto/minievm/evm/v1/query.proto index 9f6fb84d..9ea400f2 100644 --- a/proto/minievm/evm/v1/query.proto +++ b/proto/minievm/evm/v1/query.proto @@ -199,6 +199,8 @@ message QueryCallRequest { // whether to trace the call // `nil` means no trace TraceOptions trace_options = 6; + // AuthList is a list of authorizations that allow code deployment at specific addresses. + repeated SetCodeAuthorization auth_list = 7 [(gogoproto.nullable) = false]; } // TraceOption is the option for tracing diff --git a/proto/minievm/evm/v1/tx.proto b/proto/minievm/evm/v1/tx.proto index aebfc8ce..08f2d610 100644 --- a/proto/minievm/evm/v1/tx.proto +++ b/proto/minievm/evm/v1/tx.proto @@ -139,6 +139,10 @@ message MsgCall { (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + // AuthList is a list of authorizations that allow code deployment at specific addresses. + // Uses amino omitempty to seamlessly work with existing libraries. + repeated SetCodeAuthorization auth_list = 6 [(gogoproto.nullable) = false]; } // MsgCallResponse defines the Msg/Call response type. diff --git a/proto/minievm/evm/v1/types.proto b/proto/minievm/evm/v1/types.proto index 9ec23f08..b6ab9c2d 100644 --- a/proto/minievm/evm/v1/types.proto +++ b/proto/minievm/evm/v1/types.proto @@ -102,6 +102,7 @@ message Log { string data = 3; } +// AccessTuple is the element type of an access list. message AccessTuple { // Address of the contract that will be accessed during the transaction execution. string address = 1; @@ -122,3 +123,11 @@ message ERC721ClassInfo { string class_uri = 3; string class_descs = 4; } + +// SetCodeAuthorization is an authorization from an account to deploy code at its address. +message SetCodeAuthorization { + string chain_id = 1; + string address = 2; + uint64 nonce = 3; + bytes signature = 4; +} diff --git a/x/bank/keeper/grpc_query_test.go b/x/bank/keeper/grpc_query_test.go index 064c73e5..69e038eb 100644 --- a/x/bank/keeper/grpc_query_test.go +++ b/x/bank/keeper/grpc_query_test.go @@ -164,7 +164,7 @@ func TestQueryDenomMetadata(t *testing.T) { erc20WrapperAddr, err := input.EVMKeeper.ERC20FactoryAddr.Get(ctx) require.NoError(t, err) - retBz, _, err := input.EVMKeeper.EVMCall(ctx, evmAddr, common.BytesToAddress(erc20WrapperAddr), callBz, nil, nil) + retBz, _, err := input.EVMKeeper.EVMCall(ctx, evmAddr, common.BytesToAddress(erc20WrapperAddr), callBz, nil, nil, nil) require.NoError(t, err) require.NotEmpty(t, retBz) diff --git a/x/evm/keeper/common_test.go b/x/evm/keeper/common_test.go index b877b1e7..f7a5b7ec 100644 --- a/x/evm/keeper/common_test.go +++ b/x/evm/keeper/common_test.go @@ -40,7 +40,9 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/cosmos/gogoproto/proto" + cryptocodec "github.com/initia-labs/initia/crypto/codec" "github.com/initia-labs/initia/crypto/ethsecp256k1" + custombankkeeper "github.com/initia-labs/minievm/x/bank/keeper" "github.com/initia-labs/minievm/x/evm" evmconfig "github.com/initia-labs/minievm/x/evm/config" @@ -84,6 +86,9 @@ func MakeEncodingConfig(_ testing.TB) EncodingConfig { std.RegisterInterfaces(interfaceRegistry) std.RegisterLegacyAminoCodec(legacyAmino) + cryptocodec.RegisterLegacyAminoCodec(legacyAmino) + cryptocodec.RegisterInterfaces(interfaceRegistry) + ModuleBasics.RegisterLegacyAminoCodec(legacyAmino) ModuleBasics.RegisterInterfaces(interfaceRegistry) diff --git a/x/evm/keeper/context.go b/x/evm/keeper/context.go index c2a5bd5a..45601508 100644 --- a/x/evm/keeper/context.go +++ b/x/evm/keeper/context.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "fmt" - "math" "math/big" "github.com/holiman/uint256" @@ -14,12 +13,10 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/state" - coretype "github.com/ethereum/go-ethereum/core/types" + coretypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/trie/utils" evmstate "github.com/initia-labs/minievm/x/evm/state" @@ -34,40 +31,6 @@ func (k Keeper) NewStateDB(ctx context.Context, evm *vm.EVM, fee types.Fee) (*ev ) } -func (k Keeper) chargeIntrinsicGas(gasBalance uint64, isContractCreation bool, data []byte, list coretype.AccessList, rules params.Rules) (uint64, error) { - intrinsicGas, err := core.IntrinsicGas(data, list, isContractCreation, rules.IsHomestead, rules.IsIstanbul, rules.IsShanghai) - if err != nil { - return 0, err - } - if gasBalance < intrinsicGas { - return 0, fmt.Errorf("%w: have %d, want %d", core.ErrIntrinsicGas, gasBalance, intrinsicGas) - } - return gasBalance - intrinsicGas, nil -} - -func (k Keeper) computeGasLimit(sdkCtx sdk.Context) uint64 { - gasLimit := sdkCtx.GasMeter().Limit() - sdkCtx.GasMeter().GasConsumedToLimit() - if sdkCtx.ExecMode() == sdk.ExecModeSimulate { - gasLimit = k.config.ContractSimulationGasLimit - } - - return gasLimit -} - -func (k Keeper) buildDefaultBlockContext(ctx context.Context) (vm.BlockContext, error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - headerHash := sdkCtx.HeaderHash() - if len(headerHash) == 0 { - headerHash = make([]byte, 32) - } - - return vm.BlockContext{ - BlockNumber: big.NewInt(sdkCtx.BlockHeight()), - Time: uint64(sdkCtx.BlockTime().Unix()), - Random: (*common.Hash)(headerHash), - }, nil -} - func (k Keeper) buildBlockContext(ctx context.Context, defaultBlockCtx vm.BlockContext, evm *vm.EVM, fee types.Fee) (vm.BlockContext, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) baseFee, err := k.baseFee(ctx, fee) @@ -100,7 +63,7 @@ func (k Keeper) buildBlockContext(ctx context.Context, defaultBlockCtx vm.BlockC evm.IncreaseDepth() defer func() { evm.DecreaseDepth() }() - retBz, _, err := evm.StaticCall(vm.AccountRef(types.NullAddress), fee.Contract(), inputBz, 100000) + retBz, _, err := evm.StaticCall(types.NullAddress, fee.Contract(), inputBz, 100000) if err != nil { k.Logger(ctx).Warn("failed to check balance", "error", err) return false @@ -132,7 +95,7 @@ func (k Keeper) buildBlockContext(ctx context.Context, defaultBlockCtx vm.BlockC evm.IncreaseDepth() defer func() { evm.DecreaseDepth() }() - _, _, err = evm.Call(vm.AccountRef(a1), fee.Contract(), inputBz, 100000, uint256.NewInt(0)) + _, _, err = evm.Call(a1, fee.Contract(), inputBz, 100000, uint256.NewInt(0)) if err != nil { k.Logger(ctx).Warn("failed to transfer token", "error", err) panic(err) @@ -199,7 +162,7 @@ func (k Keeper) CreateEVM(ctx context.Context, caller common.Address) (context.C vmConfig := vm.Config{ExtraEips: extraEIPs, NumRetainBlockHashes: ¶ms.NumRetainBlockHashes} // use default block context for chain rules in EVM creation - defaultBlockContext, err := k.buildDefaultBlockContext(ctx) + defaultBlockContext, err := buildDefaultBlockContext(ctx) if err != nil { return ctx, nil, func() {}, err } @@ -212,7 +175,6 @@ func (k Keeper) CreateEVM(ctx context.Context, caller common.Address) (context.C // NOTE: need to check if the EVM is correctly initialized with empty context and stateDB evm := vm.NewEVM( defaultBlockContext, - txContext, nil, chainConfig, vmConfig, @@ -222,74 +184,30 @@ func (k Keeper) CreateEVM(ctx context.Context, caller common.Address) (context.C if err != nil { return ctx, nil, func() {}, err } - evm.StateDB, err = k.NewStateDB(ctx, evm, fee) + + stateDB, err := k.NewStateDB(ctx, evm, fee) if err != nil { return ctx, nil, func() {}, err } - rules := chainConfig.Rules(evm.Context.BlockNumber, evm.Context.Random != nil, evm.Context.Time) - precompiles, err := k.precompiles(rules, evm.StateDB.(types.StateDB)) + cleanup, err := decorateTracing(ctx, evm, stateDB) if err != nil { return ctx, nil, func() {}, err } - evm.SetPrecompiles(precompiles) - cleanup, err := prepareTracing(ctx, evm) + evm.SetTxContext(txContext) + rules := chainConfig.Rules(evm.Context.BlockNumber, evm.Context.Random != nil, evm.Context.Time) + precompiles, err := k.precompiles(rules, stateDB) if err != nil { return ctx, nil, func() {}, err } + evm.SetPrecompiles(precompiles) return ctx, evm, cleanup, nil } -// prepareSDKContext prepares the SDK context for EVM execution. -// 1. sets the cosmos messages to context -// 2. checks the recursive depth and increments it (the maximum depth is 8) -func prepareSDKContext(ctx sdk.Context) (sdk.Context, error) { - // set cosmos messages to context - ctx = ctx.WithValue(types.CONTEXT_KEY_EXECUTE_REQUESTS, &[]types.ExecuteRequest{}) - - depth := 1 - if val := ctx.Value(types.CONTEXT_KEY_RECURSIVE_DEPTH); val != nil { - depth = val.(int) + 1 - if depth > types.MAX_RECURSIVE_DEPTH { - return ctx, types.ErrExceedMaxRecursiveDepth - } - } - - // set recursive depth to context - return ctx.WithValue(types.CONTEXT_KEY_RECURSIVE_DEPTH, depth), nil -} - -// prepareTracing prepares the tracing for the EVM execution. -// 1. sets the tracer to the EVM and the stateDB to the tracing VMContext. -// 2. returns a cleanup function to rollback the tracing. -func prepareTracing(ctx context.Context, evm *vm.EVM) (func(), error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - if sdkCtx.Value(types.CONTEXT_KEY_TRACING) == nil || sdkCtx.Value(types.CONTEXT_KEY_TRACE_EVM) == nil { - return func() {}, nil - } - - tracing := sdkCtx.Value(types.CONTEXT_KEY_TRACING).(*types.Tracing) - evmPointer := sdkCtx.Value(types.CONTEXT_KEY_TRACE_EVM).(**vm.EVM) - - evm.Config.Tracer = tracing.Tracer() - evm.StateDB.(types.StateDB).SetTracer(tracing.Tracer()) - - originalStateDB := tracing.VMContext().StateDB - tracing.VMContext().StateDB = evm.StateDB - - originalEVM := *evmPointer - *evmPointer = evm - - return func() { - tracing.VMContext().StateDB = originalStateDB - *evmPointer = originalEVM - }, nil -} - // EVMStaticCall executes an EVM call with the given input data in static mode. -func (k Keeper) EVMStaticCall(ctx context.Context, caller common.Address, contractAddr common.Address, inputBz []byte, accessList coretype.AccessList) ([]byte, error) { +func (k Keeper) EVMStaticCall(ctx context.Context, caller common.Address, contractAddr common.Address, inputBz []byte, accessList coretypes.AccessList) ([]byte, error) { ctx, evm, cleanup, err := k.CreateEVM(ctx, caller) if err != nil { return nil, err @@ -300,7 +218,7 @@ func (k Keeper) EVMStaticCall(ctx context.Context, caller common.Address, contra sdkCtx := sdk.UnwrapSDKContext(ctx) gasBalance := k.computeGasLimit(sdkCtx) rules := evm.ChainConfig().Rules(evm.Context.BlockNumber, evm.Context.Random != nil, evm.Context.Time) - gasRemaining, err := k.chargeIntrinsicGas(gasBalance, false, inputBz, accessList, rules) + gasRemaining, err := chargeIntrinsicGas(gasBalance, false, inputBz, accessList, nil, rules) if err != nil { return nil, err } @@ -311,7 +229,7 @@ func (k Keeper) EVMStaticCall(ctx context.Context, caller common.Address, contra evm.StateDB.Prepare(rules, caller, types.NullAddress, &contractAddr, k.precompileAddrs(rules), accessList) retBz, gasRemaining, err := evm.StaticCall( - vm.AccountRef(caller), + caller, contractAddr, inputBz, gasRemaining, @@ -328,7 +246,15 @@ func (k Keeper) EVMStaticCall(ctx context.Context, caller common.Address, contra } // EVMCall executes an EVM call with the given input data. -func (k Keeper) EVMCall(ctx context.Context, caller common.Address, contractAddr common.Address, inputBz []byte, value *uint256.Int, accessList coretype.AccessList) ([]byte, types.Logs, error) { +func (k Keeper) EVMCall( + ctx context.Context, + caller common.Address, + contractAddr common.Address, + inputBz []byte, + value *uint256.Int, + accessList coretypes.AccessList, + authList []coretypes.SetCodeAuthorization, +) ([]byte, types.Logs, error) { ctx, evm, cleanup, err := k.CreateEVM(ctx, caller) if err != nil { return nil, nil, err @@ -343,7 +269,7 @@ func (k Keeper) EVMCall(ctx context.Context, caller common.Address, contractAddr } rules := evm.ChainConfig().Rules(evm.Context.BlockNumber, evm.Context.Random != nil, evm.Context.Time) - gasRemaining, err := k.chargeIntrinsicGas(gasBalance, false, inputBz, accessList, rules) + gasRemaining, err := chargeIntrinsicGas(gasBalance, false, inputBz, accessList, authList, rules) if err != nil { return nil, nil, err } @@ -355,8 +281,13 @@ func (k Keeper) EVMCall(ctx context.Context, caller common.Address, contractAddr evm.StateDB.Prepare(rules, caller, types.NullAddress, &contractAddr, k.precompileAddrs(rules), accessList) + // apply set code authorizations + if err := applyAuthorizations(sdkCtx, evm, authList); err != nil { + return nil, nil, err + } + retBz, gasRemaining, err := evm.Call( - vm.AccountRef(caller), + caller, contractAddr, inputBz, gasRemaining, @@ -389,7 +320,7 @@ func (k Keeper) EVMCall(ctx context.Context, caller common.Address, contractAddr } // commit state transition - stateDB := evm.StateDB.(*evmstate.StateDB) + stateDB := evm.StateDB.(types.StateDB) if err := stateDB.Commit(); err != nil { return nil, nil, err } @@ -431,19 +362,19 @@ func (k Keeper) EVMCall(ctx context.Context, caller common.Address, contractAddr } // EVMCreate creates a new contract with the given code. -func (k Keeper) EVMCreate(ctx context.Context, caller common.Address, codeBz []byte, value *uint256.Int, accessList coretype.AccessList) ([]byte, common.Address, types.Logs, error) { +func (k Keeper) EVMCreate(ctx context.Context, caller common.Address, codeBz []byte, value *uint256.Int, accessList coretypes.AccessList) ([]byte, common.Address, types.Logs, error) { return k.evmCreate(ctx, caller, codeBz, value, nil, accessList) } // EVMCreate2 creates a new contract with the given code. -func (k Keeper) EVMCreate2(ctx context.Context, caller common.Address, codeBz []byte, value *uint256.Int, salt *uint256.Int, accessList coretype.AccessList) ([]byte, common.Address, types.Logs, error) { +func (k Keeper) EVMCreate2(ctx context.Context, caller common.Address, codeBz []byte, value *uint256.Int, salt *uint256.Int, accessList coretypes.AccessList) ([]byte, common.Address, types.Logs, error) { return k.evmCreate(ctx, caller, codeBz, value, salt, accessList) } // evmCreate creates a new contract with the given code and tracer. // if salt is nil, it will create a contract with the CREATE opcode. // if salt is not nil, it will create a contract with the CREATE2 opcode. -func (k Keeper) evmCreate(ctx context.Context, caller common.Address, codeBz []byte, value *uint256.Int, salt *uint256.Int, accessList coretype.AccessList) (retBz []byte, contractAddr common.Address, logs types.Logs, err error) { +func (k Keeper) evmCreate(ctx context.Context, caller common.Address, codeBz []byte, value *uint256.Int, salt *uint256.Int, accessList coretypes.AccessList) (retBz []byte, contractAddr common.Address, logs types.Logs, err error) { ctx, evm, cleanup, err := k.CreateEVM(ctx, caller) if err != nil { return nil, common.Address{}, nil, err @@ -459,7 +390,7 @@ func (k Keeper) evmCreate(ctx context.Context, caller common.Address, codeBz []b rules := evm.ChainConfig().Rules(evm.Context.BlockNumber, evm.Context.Random != nil, evm.Context.Time) - gasRemaining, err := k.chargeIntrinsicGas(gasBalance, true, codeBz, accessList, rules) + gasRemaining, err := chargeIntrinsicGas(gasBalance, true, codeBz, accessList, nil, rules) if err != nil { return nil, common.Address{}, nil, err } @@ -471,14 +402,14 @@ func (k Keeper) evmCreate(ctx context.Context, caller common.Address, codeBz []b evm.StateDB.Prepare(rules, caller, types.NullAddress, nil, k.precompileAddrs(rules), accessList) if salt == nil { retBz, contractAddr, gasRemaining, err = evm.Create( - vm.AccountRef(caller), + caller, codeBz, gasRemaining, value, ) } else { retBz, contractAddr, gasRemaining, err = evm.Create2( - vm.AccountRef(caller), + caller, codeBz, gasRemaining, value, @@ -512,7 +443,7 @@ func (k Keeper) evmCreate(ctx context.Context, caller common.Address, codeBz []b } // commit state transition - stateDB := evm.StateDB.(*evmstate.StateDB) + stateDB := evm.StateDB.(types.StateDB) err = stateDB.Commit() if err != nil { return nil, common.Address{}, nil, err @@ -642,7 +573,7 @@ func (k Keeper) dispatchMessage(parentCtx sdk.Context, request types.ExecuteRequ } var callbackLogs types.Logs - _, callbackLogs, err = k.EVMCall(parentCtx, caller.Address(), caller.Address(), inputBz, nil, nil) + _, callbackLogs, err = k.EVMCall(parentCtx, caller, caller, inputBz, nil, nil, nil) if err != nil { return } @@ -678,17 +609,3 @@ func (k Keeper) dispatchMessage(parentCtx sdk.Context, request types.ExecuteRequ return } - -// consumeGas consumes gas -func consumeGas(ctx sdk.Context, gasUsed, gasRemaining uint64, description string) { - // evm sometimes return 0 gasRemaining, but it's not an out of gas error. - // cosmos use infinite gas meter at simulation and block operations. - // - // to prevent uint64 overflow, we don't consume gas when gas meter is infinite - // and gasRemaining is 0. - if ctx.GasMeter().Limit() == math.MaxUint64 && gasRemaining == 0 { - return - } - - ctx.GasMeter().ConsumeGas(gasUsed, description) -} diff --git a/x/evm/keeper/context_test.go b/x/evm/keeper/context_test.go index 17e7108b..b5e71c88 100644 --- a/x/evm/keeper/context_test.go +++ b/x/evm/keeper/context_test.go @@ -1,23 +1,27 @@ package keeper_test import ( + "bytes" "fmt" "testing" - "cosmossdk.io/math" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/vm" "github.com/holiman/uint256" + "github.com/stretchr/testify/require" "golang.org/x/crypto/sha3" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/initia-labs/minievm/x/evm/contracts/counter" "github.com/initia-labs/minievm/x/evm/contracts/erc20" "github.com/initia-labs/minievm/x/evm/types" - "github.com/stretchr/testify/require" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + coretypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/core/vm/program" + "github.com/ethereum/go-ethereum/crypto" ) func Test_Create(t *testing.T) { @@ -96,7 +100,7 @@ func Test_Call(t *testing.T) { queryInputBz, err := parsed.Pack("count") require.NoError(t, err) - queryRes, logs, err := input.EVMKeeper.EVMCall(ctx, caller, contractAddr, queryInputBz, nil, nil) + queryRes, logs, err := input.EVMKeeper.EVMCall(ctx, caller, contractAddr, queryInputBz, nil, nil, nil) require.NoError(t, err) require.Equal(t, uint256.NewInt(0).Bytes32(), [32]byte(queryRes)) require.Empty(t, logs) @@ -105,7 +109,7 @@ func Test_Call(t *testing.T) { require.NoError(t, err) // call with value - res, logs, err := input.EVMKeeper.EVMCall(ctx, caller, contractAddr, inputBz, uint256.NewInt(100), nil) + res, logs, err := input.EVMKeeper.EVMCall(ctx, caller, contractAddr, inputBz, uint256.NewInt(100), nil, nil) require.NoError(t, err) require.Empty(t, res) require.Len(t, logs, int(2)) @@ -115,7 +119,7 @@ func Test_Call(t *testing.T) { require.NoError(t, err) require.Equal(t, balance, math.NewInt(100)) - queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, caller, contractAddr, queryInputBz, nil, nil) + queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, caller, contractAddr, queryInputBz, nil, nil, nil) require.NoError(t, err) require.Equal(t, uint256.NewInt(1).Bytes32(), [32]byte(queryRes)) require.Empty(t, logs) @@ -127,7 +131,7 @@ func Test_Call(t *testing.T) { queryInputBz, err = erc20ABI.Pack("balanceOf", caller) require.NoError(t, err) - _, _, err = input.EVMKeeper.EVMCall(ctx, caller, contractAddr, queryInputBz, nil, nil) + _, _, err = input.EVMKeeper.EVMCall(ctx, caller, contractAddr, queryInputBz, nil, nil, nil) require.ErrorContains(t, err, types.ErrReverted.Error()) } @@ -174,7 +178,7 @@ func Test_GetHash(t *testing.T) { queryInputBz, err := parsed.Pack("get_blockhash", uint64(99)) require.NoError(t, err) - queryRes, logs, err := input.EVMKeeper.EVMCall(ctx, caller, contractAddr, queryInputBz, nil, nil) + queryRes, logs, err := input.EVMKeeper.EVMCall(ctx, caller, contractAddr, queryInputBz, nil, nil, nil) require.NoError(t, err) require.Equal(t, [32]byte{}, [32]byte(queryRes)) require.Empty(t, logs) @@ -183,7 +187,7 @@ func Test_GetHash(t *testing.T) { queryInputBz, err = parsed.Pack("get_blockhash", uint64(100)) require.NoError(t, err) - queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, caller, contractAddr, queryInputBz, nil, nil) + queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, caller, contractAddr, queryInputBz, nil, nil, nil) require.NoError(t, err) require.Equal(t, hash100, [32]byte(queryRes)) require.Empty(t, logs) @@ -192,7 +196,7 @@ func Test_GetHash(t *testing.T) { queryInputBz, err = parsed.Pack("get_blockhash", uint64(101)) require.NoError(t, err) - queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, caller, contractAddr, queryInputBz, nil, nil) + queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, caller, contractAddr, queryInputBz, nil, nil, nil) require.NoError(t, err) require.Equal(t, hash101, [32]byte(queryRes)) require.Empty(t, logs) @@ -201,7 +205,7 @@ func Test_GetHash(t *testing.T) { queryInputBz, err = parsed.Pack("get_blockhash", uint64(356)) require.NoError(t, err) - queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, caller, contractAddr, queryInputBz, nil, nil) + queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, caller, contractAddr, queryInputBz, nil, nil, nil) require.NoError(t, err) require.Equal(t, hash356, [32]byte(queryRes)) require.Empty(t, logs) @@ -210,7 +214,7 @@ func Test_GetHash(t *testing.T) { queryInputBz, err = parsed.Pack("get_blockhash", uint64(357)) require.NoError(t, err) - queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, caller, contractAddr, queryInputBz, nil, nil) + queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, caller, contractAddr, queryInputBz, nil, nil, nil) require.NoError(t, err) require.Equal(t, [32]byte{}, [32]byte(queryRes)) require.Empty(t, logs) @@ -237,7 +241,7 @@ func Test_RecursiveDepth(t *testing.T) { inputBz, err := parsed.Pack("recursive", uint64(types.MAX_RECURSIVE_DEPTH-1)) require.NoError(t, err) - _, logs, err := input.EVMKeeper.EVMCall(ctx, caller, contractAddr, inputBz, nil, nil) + _, logs, err := input.EVMKeeper.EVMCall(ctx, caller, contractAddr, inputBz, nil, nil, nil) require.NoError(t, err) require.Equal(t, 1< addr1 which is delegated to aa + // 2. addr1:aa calls into addr2:bb + // 3. addr2:bb writes to storage + ctx = ctx.WithChainID("minievm-1") + evmChainID := types.ConvertCosmosChainIDToEthereumChainID(ctx.ChainID()) + auth1, _ := coretypes.SignSetCode(key1, coretypes.SetCodeAuthorization{ + ChainID: *uint256.MustFromBig(evmChainID), + Address: aa, + Nonce: 0, + }) + auth2, _ := coretypes.SignSetCode(key2, coretypes.SetCodeAuthorization{ + Address: bb, + Nonce: 0, + }) + + // call addr1ErrAuthorizationNonceMismatch + _, _, err = input.EVMKeeper.EVMCall( + ctx, + addr1, + addr1, + nil, + nil, + nil, + []coretypes.SetCodeAuthorization{auth1, auth2}, + ) + require.NoError(t, err) + + _, evm, _, err = input.EVMKeeper.CreateEVM(ctx, types.StdAddress) + require.NoError(t, err) + require.NotNil(t, evm) + + state := evm.StateDB + code, want := state.GetCode(addr1), coretypes.AddressToDelegation(auth1.Address) + if !bytes.Equal(code, want) { + t.Fatalf("addr1 code incorrect: got %s, want %s", common.Bytes2Hex(code), common.Bytes2Hex(want)) + } + code, want = state.GetCode(addr2), coretypes.AddressToDelegation(auth2.Address) + if !bytes.Equal(code, want) { + t.Fatalf("addr2 code incorrect: got %s, want %s", common.Bytes2Hex(code), common.Bytes2Hex(want)) + } + + var ( + fortyTwo = common.BytesToHash([]byte{0x42}) + actual = state.GetState(addr2, fortyTwo) + ) + require.True(t, actual.Cmp(fortyTwo) == 0) +} diff --git a/x/evm/keeper/context_utils.go b/x/evm/keeper/context_utils.go index cd501b6c..e264ef84 100644 --- a/x/evm/keeper/context_utils.go +++ b/x/evm/keeper/context_utils.go @@ -3,14 +3,24 @@ package keeper import ( "context" "errors" + "fmt" + "math" "math/big" "cosmossdk.io/collections" - "cosmossdk.io/math" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/tracing" + coretypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/params" + "github.com/initia-labs/initia/crypto/ethsecp256k1" + + evmstate "github.com/initia-labs/minievm/x/evm/state" "github.com/initia-labs/minievm/x/evm/types" ) @@ -49,7 +59,7 @@ func (k Keeper) extractGasPriceFromContext(ctx context.Context, fee types.Fee) ( // multiply by 1e9 to prevent decimal drops gasPrice := gasPriceDec. - MulTruncate(math.LegacyNewDec(1e9)). + MulTruncate(sdkmath.LegacyNewDec(1e9)). TruncateInt().BigInt() return types.ToEthersUnit(fee.Decimals()+9, gasPrice), nil @@ -63,7 +73,7 @@ func (k Keeper) baseFee(ctx context.Context, fee types.Fee) (*big.Int, error) { // multiply by 1e9 to prevent decimal drops gasPrice := gasPriceDec. - MulTruncate(math.LegacyNewDec(1e9)). + MulTruncate(sdkmath.LegacyNewDec(1e9)). TruncateInt().BigInt() return types.ToEthersUnit(fee.Decimals()+9, gasPrice), nil @@ -82,3 +92,143 @@ func (k Keeper) BaseFee(ctx context.Context) (*big.Int, error) { return k.baseFee(ctx, fee) } + +// prepareSDKContext prepares the SDK context for EVM execution. +// 1. sets the cosmos messages to context +// 2. checks the recursive depth and increments it (the maximum depth is 8) +func prepareSDKContext(ctx sdk.Context) (sdk.Context, error) { + // set cosmos messages to context + ctx = ctx.WithValue(types.CONTEXT_KEY_EXECUTE_REQUESTS, &[]types.ExecuteRequest{}) + + depth := 1 + if val := ctx.Value(types.CONTEXT_KEY_RECURSIVE_DEPTH); val != nil { + depth = val.(int) + 1 + if depth > types.MAX_RECURSIVE_DEPTH { + return ctx, types.ErrExceedMaxRecursiveDepth + } + } + + // set recursive depth to context + return ctx.WithValue(types.CONTEXT_KEY_RECURSIVE_DEPTH, depth), nil +} + +// decorateTracing setup the tracing for the EVM execution if there is tracing configuration or not return evm without tracing. +// 1. sets the tracer to the EVM and the stateDB to the tracing VMContext. +// 2. returns a cleanup function to rollback the tracing. +func decorateTracing(ctx context.Context, evm *vm.EVM, stateDB *evmstate.StateDB) (func(), error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + // if tracing is not enabled, return the evm with pure stateDB + if sdkCtx.Value(types.CONTEXT_KEY_TRACING) == nil || sdkCtx.Value(types.CONTEXT_KEY_TRACE_EVM) == nil { + evm.StateDB = stateDB + return func() {}, nil + } + // setup hooked stateDB and cleanup function + tracing := sdkCtx.Value(types.CONTEXT_KEY_TRACING).(*types.Tracing) + evmPointer := sdkCtx.Value(types.CONTEXT_KEY_TRACE_EVM).(**vm.EVM) + + originalStateDB := tracing.VMContext().StateDB + + evm.Config.Tracer = tracing.Tracer() + evm.StateDB = evmstate.NewHookedState(stateDB, tracing.Tracer()) + tracing.VMContext().StateDB = evm.StateDB + + originalEVM := *evmPointer + *evmPointer = evm + + return func() { + tracing.VMContext().StateDB = originalStateDB + *evmPointer = originalEVM + }, nil +} + +// chargeIntrinsicGas charges the intrinsic gas for the given data, list, and authList. +func chargeIntrinsicGas(gasBalance uint64, isContractCreation bool, data []byte, list coretypes.AccessList, authList []coretypes.SetCodeAuthorization, rules params.Rules) (uint64, error) { + intrinsicGas, err := core.IntrinsicGas(data, list, authList, isContractCreation, rules.IsHomestead, rules.IsIstanbul, rules.IsShanghai) + if err != nil { + return 0, err + } + if gasBalance < intrinsicGas { + return 0, fmt.Errorf("%w: have %d, want %d", core.ErrIntrinsicGas, gasBalance, intrinsicGas) + } + return gasBalance - intrinsicGas, nil +} + +// buildDefaultBlockContext builds the default block context for the given context. +func buildDefaultBlockContext(ctx context.Context) (vm.BlockContext, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + headerHash := sdkCtx.HeaderHash() + if len(headerHash) == 0 { + headerHash = make([]byte, 32) + } + + return vm.BlockContext{ + BlockNumber: big.NewInt(sdkCtx.BlockHeight()), + Time: uint64(sdkCtx.BlockTime().Unix()), + Random: (*common.Hash)(headerHash), + }, nil +} + +// computeGasLimit computes the gas limit for the given context. +func (k Keeper) computeGasLimit(sdkCtx sdk.Context) uint64 { + gasLimit := sdkCtx.GasMeter().Limit() - sdkCtx.GasMeter().GasConsumedToLimit() + if sdkCtx.ExecMode() == sdk.ExecModeSimulate { + gasLimit = k.config.ContractSimulationGasLimit + } + + return gasLimit +} + +// consumeGas consumes gas +func consumeGas(ctx sdk.Context, gasUsed, gasRemaining uint64, description string) { + // evm sometimes return 0 gasRemaining, but it's not an out of gas error. + // cosmos use infinite gas meter at simulation and block operations. + // + // to prevent uint64 overflow, we don't consume gas when gas meter is infinite + // and gasRemaining is 0. + if ctx.GasMeter().Limit() == math.MaxUint64 && gasRemaining == 0 { + return + } + + ctx.GasMeter().ConsumeGas(gasUsed, description) +} + +// applyAuthorizations applies the given set code authorizations to the EVM state. +func applyAuthorizations(ctx sdk.Context, evm *vm.EVM, authList []coretypes.SetCodeAuthorization) error { + for _, auth := range authList { + authority, pub, err := auth.AuthorityWithPubKey() + if err != nil { + return fmt.Errorf("%w: %v", core.ErrAuthorizationInvalidSignature, err) + } + + evm.StateDB.AddAddressToAccessList(authority) + code := evm.StateDB.GetCode(authority) + if _, ok := coretypes.ParseDelegation(code); len(code) != 0 && !ok { + return core.ErrAuthorizationDestinationHasCode + } + if have := evm.StateDB.GetNonce(authority); have != auth.Nonce { + return core.ErrAuthorizationNonceMismatch + } + // If the account already exists in state, refund the new account cost + // charged in the intrinsic calculation. + if evm.StateDB.Exist(authority) { + evm.StateDB.AddRefund(params.CallNewAccountGas - params.TxAuthTupleGas) + } + // parse pubkey + pubKey, err := ethsecp256k1.NewPubKeyFromBytes(pub) + if err != nil { + return fmt.Errorf("%w: %v", core.ErrAuthorizationInvalidSignature, err) + } + // Update nonce, pubkey and account code. + evm.StateDB.(*evmstate.StateDB).SetNonceAndPubKey(authority, auth.Nonce+1, pubKey, tracing.NonceChangeAuthorization) + if auth.Address == (common.Address{}) { + // Delegation to zero address means clear. + evm.StateDB.SetCode(authority, nil) + return nil + } + + // Otherwise install delegation to auth.Address. + evm.StateDB.SetCode(authority, coretypes.AddressToDelegation(auth.Address)) + } + + return nil +} diff --git a/x/evm/keeper/erc20.go b/x/evm/keeper/erc20.go index b6311991..ca9a26dc 100644 --- a/x/evm/keeper/erc20.go +++ b/x/evm/keeper/erc20.go @@ -103,7 +103,7 @@ func (k ERC20Keeper) BurnCoins(ctx context.Context, addr sdk.AccAddress, amount } // ignore the return values - _, _, err = k.EVMCall(ctx, types.StdAddress, contractAddr, inputBz, nil, nil) + _, _, err = k.EVMCall(ctx, types.StdAddress, contractAddr, inputBz, nil, nil, nil) if err != nil { return err } @@ -152,7 +152,7 @@ func (k ERC20Keeper) MintCoins(ctx context.Context, addr sdk.AccAddress, amount } // ignore the return values - _, _, err = k.EVMCall(ctx, types.StdAddress, contractAddr, inputBz, nil, nil) + _, _, err = k.EVMCall(ctx, types.StdAddress, contractAddr, inputBz, nil, nil, nil) if err != nil { return err } @@ -185,7 +185,7 @@ func (k ERC20Keeper) CreateERC20(ctx context.Context, denom string, decimals uin return types.ErrFailedToPackABI.Wrap(err.Error()) } - ret, _, err := k.EVMCall(ctx, types.StdAddress, factoryAddr, inputBz, nil, nil) + ret, _, err := k.EVMCall(ctx, types.StdAddress, factoryAddr, inputBz, nil, nil, nil) if err != nil { return err } @@ -284,7 +284,7 @@ func (k ERC20Keeper) transfer(ctx context.Context, evmFromAddr, evmToAddr common } // ignore the return values - _, _, err = k.EVMCall(ctx, types.StdAddress, contractAddr, inputBz, nil, nil) + _, _, err = k.EVMCall(ctx, types.StdAddress, contractAddr, inputBz, nil, nil, nil) if err != nil { return err } diff --git a/x/evm/keeper/erc20_test.go b/x/evm/keeper/erc20_test.go index 56615547..d8a6e9b2 100644 --- a/x/evm/keeper/erc20_test.go +++ b/x/evm/keeper/erc20_test.go @@ -30,7 +30,7 @@ func deployERC20(t *testing.T, ctx sdk.Context, input TestKeepers, caller common factoryAddr, err := input.EVMKeeper.GetERC20FactoryAddr(ctx) require.NoError(t, err) - ret, _, err := input.EVMKeeper.EVMCall(ctx, caller, factoryAddr, inputBz, nil, nil) + ret, _, err := input.EVMKeeper.EVMCall(ctx, caller, factoryAddr, inputBz, nil, nil, nil) require.NoError(t, err) return common.BytesToAddress(ret[12:]) @@ -57,7 +57,7 @@ func deployERC20WithSalt(t *testing.T, ctx sdk.Context, input TestKeepers, calle inputBz, err = abi.Pack("createERC20WithSalt", symbol, symbol, uint8(6), salt) require.NoError(t, err) - ret, _, err := input.EVMKeeper.EVMCall(ctx, caller, factoryAddr, inputBz, nil, nil) + ret, _, err := input.EVMKeeper.EVMCall(ctx, caller, factoryAddr, inputBz, nil, nil, nil) require.NoError(t, err) require.Equal(t, expected[12:], ret[12:]) @@ -75,13 +75,13 @@ func burnERC20(t *testing.T, ctx sdk.Context, input TestKeepers, caller, from co inputBz, err := abi.Pack("approve", caller, amount.Amount.BigInt()) require.NoError(t, err) - _, _, err = input.EVMKeeper.EVMCall(ctx, from, erc20ContractAddr, inputBz, nil, nil) + _, _, err = input.EVMKeeper.EVMCall(ctx, from, erc20ContractAddr, inputBz, nil, nil, nil) require.NoError(t, err) inputBz, err = abi.Pack("burnFrom", from, amount.Amount.BigInt()) require.NoError(t, err) - _, _, err = input.EVMKeeper.EVMCall(ctx, caller, erc20ContractAddr, inputBz, nil, nil) + _, _, err = input.EVMKeeper.EVMCall(ctx, caller, erc20ContractAddr, inputBz, nil, nil, nil) if expectErr { require.Error(t, err) } else { @@ -99,7 +99,7 @@ func mintERC20(t *testing.T, ctx sdk.Context, input TestKeepers, caller, recipie erc20ContractAddr, err := types.DenomToContractAddr(ctx, &input.EVMKeeper, amount.Denom) require.NoError(t, err) - _, _, err = input.EVMKeeper.EVMCall(ctx, caller, erc20ContractAddr, inputBz, nil, nil) + _, _, err = input.EVMKeeper.EVMCall(ctx, caller, erc20ContractAddr, inputBz, nil, nil, nil) if expectErr { require.Error(t, err) } else { @@ -117,7 +117,7 @@ func transferERC20(t *testing.T, ctx sdk.Context, input TestKeepers, caller, rec erc20ContractAddr, err := types.DenomToContractAddr(ctx, &input.EVMKeeper, amount.Denom) require.NoError(t, err) - _, _, err = input.EVMKeeper.EVMCall(ctx, caller, erc20ContractAddr, inputBz, nil, nil) + _, _, err = input.EVMKeeper.EVMCall(ctx, caller, erc20ContractAddr, inputBz, nil, nil, nil) if expectErr { require.Error(t, err) } else { @@ -136,7 +136,7 @@ func approveERC20(t *testing.T, ctx sdk.Context, input TestKeepers, caller, spen erc20ContractAddr, err := types.DenomToContractAddr(ctx, &input.EVMKeeper, amount.Denom) require.NoError(t, err) - _, _, err = input.EVMKeeper.EVMCall(ctx, caller, erc20ContractAddr, inputBz, nil, nil) + _, _, err = input.EVMKeeper.EVMCall(ctx, caller, erc20ContractAddr, inputBz, nil, nil, nil) if expectErr { require.Error(t, err) } else { @@ -154,7 +154,7 @@ func transferFromERC20(t *testing.T, ctx sdk.Context, input TestKeepers, caller, erc20ContractAddr, err := types.DenomToContractAddr(ctx, &input.EVMKeeper, amount.Denom) require.NoError(t, err) - _, _, err = input.EVMKeeper.EVMCall(ctx, caller, erc20ContractAddr, inputBz, nil, nil) + _, _, err = input.EVMKeeper.EVMCall(ctx, caller, erc20ContractAddr, inputBz, nil, nil, nil) if expectErr { require.Error(t, err) } else { @@ -172,7 +172,7 @@ func updateMetadataERC20(t *testing.T, ctx sdk.Context, input TestKeepers, calle erc20ContractAddr, err := types.DenomToContractAddr(ctx, &input.EVMKeeper, denom) require.NoError(t, err) - _, _, err = input.EVMKeeper.EVMCall(ctx, caller, erc20ContractAddr, inputBz, nil, nil) + _, _, err = input.EVMKeeper.EVMCall(ctx, caller, erc20ContractAddr, inputBz, nil, nil, nil) return err } @@ -546,7 +546,7 @@ func TestERC20Keeper_GetMetadata(t *testing.T) { erc20WrapperAddr, err := input.EVMKeeper.ERC20FactoryAddr.Get(ctx) require.NoError(t, err) - retBz, _, err := input.EVMKeeper.EVMCall(ctx, evmAddr, common.BytesToAddress(erc20WrapperAddr), callBz, nil, nil) + retBz, _, err := input.EVMKeeper.EVMCall(ctx, evmAddr, common.BytesToAddress(erc20WrapperAddr), callBz, nil, nil, nil) require.NoError(t, err) require.NotEmpty(t, retBz) @@ -726,7 +726,7 @@ func Test_ERC20TransferGas(t *testing.T) { // mint token to address inputBz, err = abi.Pack("mint", evmAddr, math.NewInt(100).BigInt()) require.NoError(t, err) - _, _, err = input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, inputBz, nil, nil) + _, _, err = input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, inputBz, nil, nil, nil) require.NoError(t, err) // should fail to send coins due to out of gas @@ -764,7 +764,7 @@ func Test_ERC20StaticCallGas(t *testing.T) { // mint token to address inputBz, err = abi.Pack("mint", evmAddr, math.NewInt(100).BigInt()) require.NoError(t, err) - _, _, err = input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, inputBz, nil, nil) + _, _, err = input.EVMKeeper.EVMCall(ctx, evmAddr, contractAddr, inputBz, nil, nil, nil) require.NoError(t, err) // return 0 balance due to out of gas diff --git a/x/evm/keeper/erc721.go b/x/evm/keeper/erc721.go index 0d391aa7..77eca7ea 100644 --- a/x/evm/keeper/erc721.go +++ b/x/evm/keeper/erc721.go @@ -123,7 +123,7 @@ func (k ERC721Keeper) Transfers(ctx context.Context, sender, receiver sdk.AccAdd } // ignore the return values - _, _, err = k.EVMCall(ctx, senderAddr, contractAddr, inputBz, nil, nil) + _, _, err = k.EVMCall(ctx, senderAddr, contractAddr, inputBz, nil, nil, nil) if err != nil { return err } @@ -140,7 +140,7 @@ func (k ERC721Keeper) Burn( return types.ErrFailedToPackABI.Wrap(err.Error()) } - _, _, err = k.EVMCall(ctx, owner, contractAddr, inputBz, nil, nil) + _, _, err = k.EVMCall(ctx, owner, contractAddr, inputBz, nil, nil, nil) if err != nil { return err } @@ -192,7 +192,7 @@ func (k ERC721Keeper) Mint( return types.ErrFailedToPackABI.Wrap(err.Error()) } - _, _, err = k.EVMCall(ctx, types.StdAddress, contractAddr, inputBz, nil, nil) + _, _, err = k.EVMCall(ctx, types.StdAddress, contractAddr, inputBz, nil, nil, nil) if err != nil { return err } diff --git a/x/evm/keeper/fuzz_test.go b/x/evm/keeper/fuzz_test.go index ed18643d..b1bf86cc 100644 --- a/x/evm/keeper/fuzz_test.go +++ b/x/evm/keeper/fuzz_test.go @@ -56,7 +56,7 @@ func Fuzz_Concurrent_Counter(f *testing.F) { defer wg.Done() // call with value - res, logs, err := input.EVMKeeper.EVMCall(ctx, caller, contractAddr, inputBz, nil, nil) + res, logs, err := input.EVMKeeper.EVMCall(ctx, caller, contractAddr, inputBz, nil, nil, nil) require.NoError(t, err) require.Empty(t, res) assertLogs(t, contractAddr, logs) diff --git a/x/evm/keeper/genesis.go b/x/evm/keeper/genesis.go index 9deb1fd0..0e0a47e9 100644 --- a/x/evm/keeper/genesis.go +++ b/x/evm/keeper/genesis.go @@ -82,7 +82,7 @@ func (k Keeper) DeployERC20Factory(ctx context.Context) error { return err } - _, _, err = k.EVMCall(ctx, types.StdAddress, common.BytesToAddress(wrapperAddr), inputBz, nil, nil) + _, _, err = k.EVMCall(ctx, types.StdAddress, common.BytesToAddress(wrapperAddr), inputBz, nil, nil, nil) if err != nil { return err } diff --git a/x/evm/keeper/msg_server.go b/x/evm/keeper/msg_server.go index 0aec1aa2..f30e3021 100644 --- a/x/evm/keeper/msg_server.go +++ b/x/evm/keeper/msg_server.go @@ -9,6 +9,7 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/tracing" coretypes "github.com/ethereum/go-ethereum/core/types" + "github.com/holiman/uint256" "cosmossdk.io/collections" @@ -54,7 +55,7 @@ func (ms *msgServerImpl) Create(ctx context.Context, msg *types.MsgCreate) (*typ } // argument validation - caller, codeBz, value, accessList, err := ms.validateArguments(ctx, sender, msg.Code, msg.Value, msg.AccessList, true) + caller, codeBz, value, accessList, _, err := ms.validateArguments(ctx, sender, msg.Code, msg.Value, msg.AccessList, nil, true) if err != nil { return nil, err } @@ -106,7 +107,7 @@ func (ms *msgServerImpl) Create2(ctx context.Context, msg *types.MsgCreate2) (*t } // argument validation - caller, codeBz, value, accessList, err := ms.validateArguments(ctx, sender, msg.Code, msg.Value, msg.AccessList, true) + caller, codeBz, value, accessList, _, err := ms.validateArguments(ctx, sender, msg.Code, msg.Value, msg.AccessList, nil, true) if err != nil { return nil, err } @@ -143,13 +144,13 @@ func (ms *msgServerImpl) Call(ctx context.Context, msg *types.MsgCall) (*types.M } // argument validation - caller, inputBz, value, accessList, err := ms.validateArguments(ctx, sender, msg.Input, msg.Value, msg.AccessList, false) + caller, inputBz, value, accessList, authList, err := ms.validateArguments(ctx, sender, msg.Input, msg.Value, msg.AccessList, msg.AuthList, false) if err != nil { return nil, err } // call a contract - retBz, logs, err := ms.EVMCall(ctx, caller, contractAddr, inputBz, value, accessList) + retBz, logs, err := ms.EVMCall(ctx, caller, contractAddr, inputBz, value, accessList, authList) if err != nil { return nil, err } @@ -259,27 +260,42 @@ func (k *msgServerImpl) handleSequenceIncremented(ctx context.Context, sender sd } // validateArguments validates the arguments of create, create2, and call messages. -func (ms *msgServerImpl) validateArguments( - ctx context.Context, sender []byte, data string, - value math.Int, accessList []types.AccessTuple, isCreate bool, -) (common.Address, []byte, *uint256.Int, coretypes.AccessList, error) { - caller, err := ms.convertToEVMAddress(ctx, sender, true) +func (k Keeper) validateArguments( + ctx context.Context, sender []byte, data string, value math.Int, + accessList []types.AccessTuple, setCodeAuthorizations []types.SetCodeAuthorization, isCreate bool, +) (common.Address, []byte, *uint256.Int, coretypes.AccessList, []coretypes.SetCodeAuthorization, error) { + caller, err := k.convertToEVMAddress(ctx, sender, true) if err != nil { - return common.Address{}, nil, nil, nil, err + return common.Address{}, nil, nil, nil, nil, err } if isCreate && len(data) == 0 { - return common.Address{}, nil, nil, nil, sdkerrors.ErrInvalidRequest.Wrap("empty code bytes") + return common.Address{}, nil, nil, nil, nil, sdkerrors.ErrInvalidRequest.Wrap("empty code bytes") } dataBz, err := hexutil.Decode(data) if err != nil { - return common.Address{}, nil, nil, nil, types.ErrInvalidHexString.Wrap(err.Error()) + return common.Address{}, nil, nil, nil, nil, types.ErrInvalidHexString.Wrap(err.Error()) } val, overflow := uint256.FromBig(value.BigInt()) if overflow { - return common.Address{}, nil, nil, nil, types.ErrInvalidValue.Wrap("value is out of range") + return common.Address{}, nil, nil, nil, nil, types.ErrInvalidValue.Wrap("value is out of range") + } + + // validate set code authorizations + var authList []coretypes.SetCodeAuthorization + if len(setCodeAuthorizations) > 0 { + authList, err = types.ConvertCosmosSetCodeAuthorizationsToEth(setCodeAuthorizations) + if err != nil { + return common.Address{}, nil, nil, nil, nil, err + } + for _, auth := range authList { + err = types.ValidateAuthorization(sdk.UnwrapSDKContext(ctx), auth) + if err != nil { + return common.Address{}, nil, nil, nil, nil, err + } + } } - return caller, dataBz, val, types.ConvertCosmosAccessListToEth(accessList), nil + return caller, dataBz, val, types.ConvertCosmosAccessListToEth(accessList), authList, nil } // assertAllowedPublishers asserts the sender is allowed to deploy a contract. diff --git a/x/evm/keeper/msg_server_test.go b/x/evm/keeper/msg_server_test.go index f02c02dc..97d2503b 100644 --- a/x/evm/keeper/msg_server_test.go +++ b/x/evm/keeper/msg_server_test.go @@ -109,7 +109,7 @@ func Test_MsgServer_Call(t *testing.T) { queryInputBz, err := parsed.Pack("count") require.NoError(t, err) - queryRes, logs, err := input.EVMKeeper.EVMCall(ctx, caller, contractAddr, queryInputBz, nil, nil) + queryRes, logs, err := input.EVMKeeper.EVMCall(ctx, caller, contractAddr, queryInputBz, nil, nil, nil) require.NoError(t, err) require.Equal(t, uint256.NewInt(0).Bytes32(), [32]byte(queryRes)) require.Empty(t, logs) @@ -127,7 +127,7 @@ func Test_MsgServer_Call(t *testing.T) { require.Equal(t, "0x", res.Result) require.NotEmpty(t, res.Logs) - queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, caller, contractAddr, queryInputBz, nil, nil) + queryRes, logs, err = input.EVMKeeper.EVMCall(ctx, caller, contractAddr, queryInputBz, nil, nil, nil) require.NoError(t, err) require.Equal(t, uint256.NewInt(1).Bytes32(), [32]byte(queryRes)) require.Empty(t, logs) diff --git a/x/evm/keeper/precompiles_test.go b/x/evm/keeper/precompiles_test.go index e40d85f2..90d5fab1 100644 --- a/x/evm/keeper/precompiles_test.go +++ b/x/evm/keeper/precompiles_test.go @@ -63,7 +63,7 @@ func Test_ExecuteCosmosMessage(t *testing.T) { `, addr, addr2), uint64(150_000)) require.NoError(t, err) - _, _, err = input.EVMKeeper.EVMCall(ctx, evmAddr, types.CosmosPrecompileAddress, inputBz, nil, nil) + _, _, err = input.EVMKeeper.EVMCall(ctx, evmAddr, types.CosmosPrecompileAddress, inputBz, nil, nil, nil) require.NoError(t, err) balance := input.BankKeeper.GetBalance(ctx, addr2, "bar") @@ -93,7 +93,7 @@ func Test_QueryCosmosMessage(t *testing.T) { }`, addr)) require.NoError(t, err) - retBz, _, err := input.EVMKeeper.EVMCall(ctx, evmAddr, types.CosmosPrecompileAddress, inputBz, nil, nil) + retBz, _, err := input.EVMKeeper.EVMCall(ctx, evmAddr, types.CosmosPrecompileAddress, inputBz, nil, nil, nil) require.NoError(t, err) unpackedRet, err := abi.Methods["query_cosmos"].Outputs.Unpack(retBz) @@ -137,7 +137,7 @@ func Test_QueryCosmosFromContract(t *testing.T) { }`, addr)) require.NoError(t, err) - retBz, _, err = input.EVMKeeper.EVMCall(ctx, contractAddr, types.CosmosPrecompileAddress, inputBz, nil, nil) + retBz, _, err = input.EVMKeeper.EVMCall(ctx, contractAddr, types.CosmosPrecompileAddress, inputBz, nil, nil, nil) require.NoError(t, err) unpackedRet, err := abi.Methods["query_cosmos"].Outputs.Unpack(retBz) @@ -173,7 +173,7 @@ func Test_ToDenom(t *testing.T) { inputBz, err := abi.Pack("to_denom", contractAddr) require.NoError(t, err) - retBz, _, err := input.EVMKeeper.EVMCall(ctx, evmAddr, types.CosmosPrecompileAddress, inputBz, nil, nil) + retBz, _, err := input.EVMKeeper.EVMCall(ctx, evmAddr, types.CosmosPrecompileAddress, inputBz, nil, nil, nil) require.NoError(t, err) unpackedRet, err := abi.Methods["to_denom"].Outputs.Unpack(retBz) @@ -205,7 +205,7 @@ func Test_ToERC20(t *testing.T) { inputBz, err := abi.Pack("to_erc20", "bar") require.NoError(t, err) - retBz, _, err := input.EVMKeeper.EVMCall(ctx, evmAddr, types.CosmosPrecompileAddress, inputBz, nil, nil) + retBz, _, err := input.EVMKeeper.EVMCall(ctx, evmAddr, types.CosmosPrecompileAddress, inputBz, nil, nil, nil) require.NoError(t, err) unpackedRet, err := abi.Methods["to_erc20"].Outputs.Unpack(retBz) @@ -225,7 +225,7 @@ func Test_JSONMerge(t *testing.T) { inputBz, err := abi.Pack("merge_json", `{"a": 1, "b": 2}`, `{"b": 3, "c": 4}`) require.NoError(t, err) - retBz, _, err := input.EVMKeeper.EVMCall(ctx, evmAddr, types.JSONUtilsPrecompileAddress, inputBz, nil, nil) + retBz, _, err := input.EVMKeeper.EVMCall(ctx, evmAddr, types.JSONUtilsPrecompileAddress, inputBz, nil, nil, nil) require.NoError(t, err) unpackedRet, err := abi.Methods["merge_json"].Outputs.Unpack(retBz) @@ -269,7 +269,7 @@ func Test_PrecompileRevertError(t *testing.T) { ) require.NoError(t, err) - _, _, err = input.EVMKeeper.EVMCall(ctx, caller, contractAddr, inputBz, nil, nil) + _, _, err = input.EVMKeeper.EVMCall(ctx, caller, contractAddr, inputBz, nil, nil, nil) require.ErrorIs(t, err, types.ErrReverted) require.ErrorContains(t, err, sdkerrors.ErrUnauthorized.Error()) @@ -335,7 +335,7 @@ func Test_JSONUnmarshalObject(t *testing.T) { inputBz, err := abi.Pack("unmarshal_to_object", tc.input) require.NoError(t, err) - retBz, _, err := input.EVMKeeper.EVMCall(ctx, evmAddr, types.JSONUtilsPrecompileAddress, inputBz, nil, nil) + retBz, _, err := input.EVMKeeper.EVMCall(ctx, evmAddr, types.JSONUtilsPrecompileAddress, inputBz, nil, nil, nil) if tc.expectedErr { require.Error(t, err) return @@ -375,7 +375,7 @@ func Test_ConnectOracle_GetPrice(t *testing.T) { inputBz, err := abi.Pack("get_price", `BTC/USD`) require.NoError(t, err) - _, _, err = input.EVMKeeper.EVMCall(ctx, evmAddr, oracleAddr, inputBz, nil, nil) + _, _, err = input.EVMKeeper.EVMCall(ctx, evmAddr, oracleAddr, inputBz, nil, nil, nil) require.ErrorContains(t, err, types.ErrPrecompileFailed.Error()) require.ErrorIs(t, err, types.ErrReverted) require.ErrorContains(t, err, "no price / nonce reported for CurrencyPair") @@ -383,7 +383,7 @@ func Test_ConnectOracle_GetPrice(t *testing.T) { inputBz, err = abi.Pack("get_price", `Error`) require.NoError(t, err) - _, _, err = input.EVMKeeper.EVMCall(ctx, evmAddr, oracleAddr, inputBz, nil, nil) + _, _, err = input.EVMKeeper.EVMCall(ctx, evmAddr, oracleAddr, inputBz, nil, nil, nil) require.ErrorContains(t, err, types.ErrPrecompileFailed.Error()) require.ErrorIs(t, err, types.ErrReverted) require.ErrorContains(t, err, "incorrectly formatted CurrencyPair") @@ -422,7 +422,7 @@ func Test_ConnectOracle_GetPrice(t *testing.T) { inputBz, err = abi.Pack("get_price", `BTC/USD`) require.NoError(t, err) - ret, _, err := input.EVMKeeper.EVMCall(ctx, evmAddr, oracleAddr, inputBz, nil, nil) + ret, _, err := input.EVMKeeper.EVMCall(ctx, evmAddr, oracleAddr, inputBz, nil, nil, nil) require.NoError(t, err) unpackedRet, err := abi.Methods["get_price"].Outputs.Unpack(ret) @@ -442,7 +442,7 @@ func Test_ConnectOracle_GetPrice(t *testing.T) { inputBz, err = abi.Pack("get_prices", []string{`BTC/USD`, `ETH/USD`}) require.NoError(t, err) - ret, _, err = input.EVMKeeper.EVMCall(ctx, evmAddr, oracleAddr, inputBz, nil, nil) + ret, _, err = input.EVMKeeper.EVMCall(ctx, evmAddr, oracleAddr, inputBz, nil, nil, nil) require.NoError(t, err) unpackedRet, err = abi.Methods["get_prices"].Outputs.Unpack(ret) @@ -510,7 +510,7 @@ func Test_ExecuteCosmosMessage_Disabled(t *testing.T) { ) require.NoError(t, err) - _, _, err = input.EVMKeeper.EVMCall(ctx, caller, contractAddr, inputBz, nil, nil) + _, _, err = input.EVMKeeper.EVMCall(ctx, caller, contractAddr, inputBz, nil, nil, nil) require.ErrorIs(t, err, types.ErrReverted) require.ErrorContains(t, err, types.ErrExecuteCosmosDisabled.Error()) @@ -527,7 +527,7 @@ func Test_ExecuteCosmosMessage_Disabled(t *testing.T) { ) require.NoError(t, err) - _, _, err = input.EVMKeeper.EVMCall(ctx, caller, contractAddr, inputBz, nil, nil) + _, _, err = input.EVMKeeper.EVMCall(ctx, caller, contractAddr, inputBz, nil, nil, nil) require.ErrorIs(t, err, types.ErrReverted) require.ErrorContains(t, err, types.ErrExecuteCosmosDisabled.Error()) @@ -548,7 +548,7 @@ func Test_ExecuteCosmosMessage_Disabled(t *testing.T) { ) require.NoError(t, err) - _, _, err = input.EVMKeeper.EVMCall(ctx, caller, contractAddr, inputBz, nil, nil) + _, _, err = input.EVMKeeper.EVMCall(ctx, caller, contractAddr, inputBz, nil, nil, nil) require.NoError(t, err) // check balance diff --git a/x/evm/keeper/query_server.go b/x/evm/keeper/query_server.go index 69a7336d..0e04848f 100644 --- a/x/evm/keeper/query_server.go +++ b/x/evm/keeper/query_server.go @@ -9,8 +9,6 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "github.com/holiman/uint256" - "cosmossdk.io/collections" errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" @@ -44,16 +42,10 @@ func (qs *queryServerImpl) Call(ctx context.Context, req *types.QueryCallRequest sdkCtx := sdk.UnwrapSDKContext(ctx) - caller := common.Address{} - if req.Sender != "" { - senderBz, err := qs.ac.StringToBytes(req.Sender) - if err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - - caller = common.BytesToAddress(senderBz) + sender, err := qs.ac.StringToBytes(req.Sender) + if err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) } - contractAddr := common.Address{} if req.ContractAddr != "" { contractAddr, err = types.ContractAddressFromString(qs.ac, req.ContractAddr) @@ -61,19 +53,11 @@ func (qs *queryServerImpl) Call(ctx context.Context, req *types.QueryCallRequest return nil, status.Error(codes.InvalidArgument, err.Error()) } } - - inputBz, err := hexutil.Decode(req.Input) + caller, inputBz, value, accessList, authList, err := qs.validateArguments(ctx, sender, req.Input, req.Value, req.AccessList, req.AuthList, false) if err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } - value, overflow := uint256.FromBig(req.Value.BigInt()) - if overflow { - return nil, status.Error(codes.InvalidArgument, "value is out of range") - } - - list := types.ConvertCosmosAccessListToEth(req.AccessList) - var tracer *tracing.Hooks tracerOutput := new(strings.Builder) if req.TraceOptions != nil { @@ -129,9 +113,9 @@ func (qs *queryServerImpl) Call(ctx context.Context, req *types.QueryCallRequest var logs []types.Log if contractAddr == (common.Address{}) { // if contract address is not provided, then it's a contract creation - retBz, _, logs, err = qs.EVMCreate(sdkCtx, caller, inputBz, value, list) + retBz, _, logs, err = qs.EVMCreate(sdkCtx, caller, inputBz, value, accessList) } else { - retBz, logs, err = qs.EVMCall(sdkCtx, caller, contractAddr, inputBz, value, list) + retBz, logs, err = qs.EVMCall(sdkCtx, caller, contractAddr, inputBz, value, accessList, authList) } gasUsed := sdkCtx.GasMeter().GasConsumedToLimit() diff --git a/x/evm/keeper/txutils_test.go b/x/evm/keeper/txutils_test.go index 6c785a52..e2fe7b0f 100644 --- a/x/evm/keeper/txutils_test.go +++ b/x/evm/keeper/txutils_test.go @@ -26,6 +26,248 @@ import ( "github.com/initia-labs/minievm/x/evm/types" ) +func Test_SetCodeTxConversion(t *testing.T) { + ctx, input := createDefaultTestInput(t) + + _, _, addr := keyPubAddr() + input.Faucet.Mint(ctx, addr, sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(1000000000000000000))) + decimals := input.Decimals + gasLimit := uint64(1_000_000) + feeAmount := new(big.Int).Mul( + big.NewInt(int64(gasLimit)), + new(big.Int).Exp(big.NewInt(10), big.NewInt(int64(decimals)-8), nil), // gas price is 1e-8 + ) + + ethFactoryAddr, err := input.EVMKeeper.GetERC20FactoryAddr(ctx) + require.NoError(t, err) + + abi, err := erc20_factory.Erc20FactoryMetaData.GetAbi() + require.NoError(t, err) + + inputBz, err := abi.Pack("createERC20", "bar", "bar", uint8(6)) + require.NoError(t, err) + + gasFeeCap := types.ToEthersUnit(decimals, feeAmount) + gasFeeCap = gasFeeCap.Quo(gasFeeCap, new(big.Int).SetUint64(gasLimit)) + value := types.ToEthersUnit(decimals, big.NewInt(100)) + + ethChainID := types.ConvertCosmosChainIDToEthereumChainID(ctx.ChainID()) + dynTx := &coretypes.DynamicFeeTx{ + ChainID: types.ConvertCosmosChainIDToEthereumChainID(ctx.ChainID()), + Nonce: 100, + GasTipCap: big.NewInt(100), + GasFeeCap: gasFeeCap, + Gas: gasLimit, + To: ðFactoryAddr, + Data: inputBz, + Value: value, + AccessList: coretypes.AccessList{ + coretypes.AccessTuple{Address: ethFactoryAddr, + StorageKeys: []common.Hash{ + common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"), + common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000001"), + common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000002"), + }}, + }, + } + ethTx := coretypes.NewTx(dynTx) + randBytes := make([]byte, 64) + _, err = rand.Read(randBytes) + require.NoError(t, err) + reader := bytes.NewReader(randBytes) + privKey, err := ecdsa.GenerateKey(crypto.S256(), reader) + require.NoError(t, err) + signer := coretypes.LatestSignerForChainID(ethChainID) + signedTx, err := coretypes.SignTx(ethTx, signer, privKey) + require.NoError(t, err) + + cosmosKey := ethsecp256k1.PrivKey{ + Key: crypto.FromECDSA(privKey), + } + addrBz := cosmosKey.PubKey().Address() + + // 1. Create a dynamic fee tx without max gas configuration + // Convert to cosmos tx + sdkTx, err := keeper.NewTxUtils(&input.EVMKeeper).ConvertEthereumTxToCosmosTx(ctx, signedTx) + require.NoError(t, err) + expectedMsg := &types.MsgCall{ + Sender: sdk.AccAddress(addrBz).String(), + ContractAddr: ethFactoryAddr.Hex(), + Input: hexutil.Encode(inputBz), + Value: math.NewInt(100), + AccessList: []types.AccessTuple{ + { + Address: ethFactoryAddr.String(), + StorageKeys: []string{ + common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000").Hex(), + common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000001").Hex(), + common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000002").Hex()}, + }, + }, + } + msgs := sdkTx.GetMsgs() + require.Len(t, msgs, 1) + msg, ok := msgs[0].(*types.MsgCall) + require.True(t, ok) + require.Equal(t, msg, expectedMsg) + + authTx := sdkTx.(authsigning.Tx) + expectedFeeAmount := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewIntFromBigInt(feeAmount).AddRaw(1))) + require.Equal(t, authTx.GetFee(), expectedFeeAmount) + + sigs, err := authTx.GetSignaturesV2() + require.NoError(t, err) + require.Len(t, sigs, 1) + + sig := sigs[0] + require.Equal(t, sig.PubKey, cosmosKey.PubKey()) + require.Equal(t, sig.Sequence, uint64(100)) + + v, r, s := signedTx.RawSignatureValues() + sigData := sig.Data.(*signing.SingleSignatureData) + require.Equal(t, sigData.SignMode, keeper.SignMode_SIGN_MODE_ETHEREUM) + + sigBytes := make([]byte, 65) + copy(sigBytes[32-len(r.Bytes()):32], r.Bytes()) + copy(sigBytes[64-len(s.Bytes()):64], s.Bytes()) + sigBytes[64] = byte(v.Uint64()) + + require.Equal(t, sigData.Signature, sigBytes) + + // Convert back to ethereum tx + ethTx2, _, err := keeper.NewTxUtils(&input.EVMKeeper).ConvertCosmosTxToEthereumTx(ctx, sdkTx) + require.NoError(t, err) + equalEthTransaction(t, signedTx, ethTx2) + + // manipulate the fee amount + txBuilder := sdkTx.(client.TxBuilder) + txBuilder.SetFeeAmount(expectedFeeAmount.Add(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(1)))) + _, _, err = keeper.NewTxUtils(&input.EVMKeeper).ConvertCosmosTxToEthereumTx(ctx, txBuilder.GetTx()) + require.ErrorIs(t, err, types.ErrTxConversionFailed) + + // 2. Set the max params of gas configuration + // Set the gas enforcement parameters with unlimited sender + maxGasLimit := gasLimit / 2 + params, err := input.EVMKeeper.Params.Get(ctx) + require.NoError(t, err) + maxGasFeeCap := math.NewIntFromBigInt(gasFeeCap.Div(gasFeeCap, big.NewInt(2))) + + gasEnforcement := &types.GasEnforcement{ + MaxGasLimit: maxGasLimit, + MaxGasFeeCap: maxGasFeeCap, + UnlimitedGasSenders: []string{ + common.BytesToAddress(addrBz.Bytes()).String(), + }, + } + params.GasEnforcement = gasEnforcement + err = input.EVMKeeper.Params.Set(ctx, params) + require.NoError(t, err) + + // Convert to cosmos tx + // Since the sender is in the unlimited gas senders, the gas limit will be still the original gas limit + sdkTx, err = keeper.NewTxUtils(&input.EVMKeeper).ConvertEthereumTxToCosmosTx(ctx, signedTx) + require.NoError(t, err) + + msgs = sdkTx.GetMsgs() + require.Len(t, msgs, 1) + msg, ok = msgs[0].(*types.MsgCall) + require.True(t, ok) + + require.Equal(t, msg, expectedMsg) + + authTx = sdkTx.(authsigning.Tx) + expectedFeeAmount = sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewIntFromBigInt(feeAmount).AddRaw(1))) + require.Equal(t, authTx.GetFee(), expectedFeeAmount) + require.Equal(t, authTx.GetGas(), gasLimit) + + sigs, err = authTx.GetSignaturesV2() + require.NoError(t, err) + require.Len(t, sigs, 1) + + sig = sigs[0] + require.Equal(t, sig.PubKey, cosmosKey.PubKey()) + require.Equal(t, sig.Sequence, uint64(100)) + + v, r, s = signedTx.RawSignatureValues() + sigData = sig.Data.(*signing.SingleSignatureData) + require.Equal(t, sigData.SignMode, keeper.SignMode_SIGN_MODE_ETHEREUM) + + sigBytes = make([]byte, 65) + copy(sigBytes[32-len(r.Bytes()):32], r.Bytes()) + copy(sigBytes[64-len(s.Bytes()):64], s.Bytes()) + sigBytes[64] = byte(v.Uint64()) + + require.Equal(t, sigData.Signature, sigBytes) + + // Convert back to ethereum tx + ethTx2, _, err = keeper.NewTxUtils(&input.EVMKeeper).ConvertCosmosTxToEthereumTx(ctx, sdkTx) + require.NoError(t, err) + + // Verify the signature to check sender is correct + sender, err := signer.Sender(ethTx2) + require.NoError(t, err) + require.Equal(t, common.BytesToAddress(addrBz), sender) + equalEthTransaction(t, signedTx, ethTx2) + + // 3. Set without unlimited sender + // Set the gas enforcement parameters without unlimited sender + params, err = input.EVMKeeper.Params.Get(ctx) + require.NoError(t, err) + gasEnforcement.UnlimitedGasSenders = []string{} + params.GasEnforcement = gasEnforcement + err = input.EVMKeeper.Params.Set(ctx, params) + require.NoError(t, err) + + // feeAmount will be quarter of the original fee amount + expectedFeeAmount = sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewIntFromBigInt(feeAmount.Div(feeAmount, big.NewInt(4))).AddRaw(1))) + + // Convert to cosmos tx + // Since the sender is in the unlimited gas senders, the gas limit will be set to maxGasLimit + sdkTx, err = keeper.NewTxUtils(&input.EVMKeeper).ConvertEthereumTxToCosmosTx(ctx, signedTx) + require.NoError(t, err) + + msgs = sdkTx.GetMsgs() + require.Len(t, msgs, 1) + msg, ok = msgs[0].(*types.MsgCall) + require.True(t, ok) + + expectedMsg.Sender = sdk.AccAddress(addrBz).String() + require.Equal(t, msg, expectedMsg) + + authTx = sdkTx.(authsigning.Tx) + require.Equal(t, authTx.GetGas(), maxGasLimit) + require.Equal(t, authTx.GetFee(), expectedFeeAmount) + + sigs, err = authTx.GetSignaturesV2() + require.NoError(t, err) + require.Len(t, sigs, 1) + + sig = sigs[0] + require.Equal(t, sig.PubKey, cosmosKey.PubKey()) + require.Equal(t, sig.Sequence, uint64(100)) + + v, r, s = signedTx.RawSignatureValues() + sigData = sig.Data.(*signing.SingleSignatureData) + require.Equal(t, sigData.SignMode, keeper.SignMode_SIGN_MODE_ETHEREUM) + + sigBytes = make([]byte, 65) + copy(sigBytes[32-len(r.Bytes()):32], r.Bytes()) + copy(sigBytes[64-len(s.Bytes()):64], s.Bytes()) + sigBytes[64] = byte(v.Uint64()) + + require.Equal(t, sigData.Signature, sigBytes) + + // Convert back to ethereum tx + ethTx2, _, err = keeper.NewTxUtils(&input.EVMKeeper).ConvertCosmosTxToEthereumTx(ctx, sdkTx) + require.NoError(t, err) + + // Verify the signature to check sender is correct + sender, err = signer.Sender(ethTx2) + require.NoError(t, err) + require.Equal(t, common.BytesToAddress(addrBz), sender) + equalEthTransaction(t, signedTx, ethTx2) +} + func Test_DynamicFeeTxConversion(t *testing.T) { ctx, input := createDefaultTestInput(t) @@ -137,7 +379,7 @@ func Test_DynamicFeeTxConversion(t *testing.T) { // Convert back to ethereum tx ethTx2, _, err := keeper.NewTxUtils(&input.EVMKeeper).ConvertCosmosTxToEthereumTx(ctx, sdkTx) require.NoError(t, err) - EqualEthTransaction(t, signedTx, ethTx2) + equalEthTransaction(t, signedTx, ethTx2) // manipulate the fee amount txBuilder := sdkTx.(client.TxBuilder) @@ -207,7 +449,7 @@ func Test_DynamicFeeTxConversion(t *testing.T) { sender, err := signer.Sender(ethTx2) require.NoError(t, err) require.Equal(t, common.BytesToAddress(addrBz), sender) - EqualEthTransaction(t, signedTx, ethTx2) + equalEthTransaction(t, signedTx, ethTx2) // 3. Set without unlimited sender // Set the gas enforcement parameters without unlimited sender @@ -265,7 +507,7 @@ func Test_DynamicFeeTxConversion(t *testing.T) { sender, err = signer.Sender(ethTx2) require.NoError(t, err) require.Equal(t, common.BytesToAddress(addrBz), sender) - EqualEthTransaction(t, signedTx, ethTx2) + equalEthTransaction(t, signedTx, ethTx2) } func Test_AccessTxConversion(t *testing.T) { @@ -366,7 +608,7 @@ func Test_AccessTxConversion(t *testing.T) { // Convert back to ethereum tx ethTx2, _, err := keeper.NewTxUtils(&input.EVMKeeper).ConvertCosmosTxToEthereumTx(ctx, sdkTx) require.NoError(t, err) - EqualEthTransaction(t, signedTx, ethTx2) + equalEthTransaction(t, signedTx, ethTx2) // 2. Test Normal Case ethTx = coretypes.NewTx(&coretypes.AccessListTx{ @@ -452,7 +694,7 @@ func Test_AccessTxConversion(t *testing.T) { // Convert back to ethereum tx ethTx2, _, err = keeper.NewTxUtils(&input.EVMKeeper).ConvertCosmosTxToEthereumTx(ctx, sdkTx) require.NoError(t, err) - EqualEthTransaction(t, signedTx, ethTx2) + equalEthTransaction(t, signedTx, ethTx2) // manipulate the fee amount txBuilder := sdkTx.(client.TxBuilder) @@ -556,7 +798,7 @@ func Test_LegacyTxConversion(t *testing.T) { // Convert back to ethereum tx ethTx2, _, err := keeper.NewTxUtils(&input.EVMKeeper).ConvertCosmosTxToEthereumTx(ctx, sdkTx) require.NoError(t, err) - EqualEthTransaction(t, signedTx, ethTx2) + equalEthTransaction(t, signedTx, ethTx2) // manipulate the fee amount txBuilder := sdkTx.(client.TxBuilder) @@ -618,8 +860,7 @@ func Test_LegacyTxConversion(t *testing.T) { sender, err := signer.Sender(ethTx2) require.NoError(t, err) require.Equal(t, common.BytesToAddress(addrBz), sender) - EqualEthTransaction(t, signedTx, ethTx2) - + equalEthTransaction(t, signedTx, ethTx2) } func Test_IsEthereumTx(t *testing.T) { @@ -633,7 +874,7 @@ func Test_IsEthereumTx(t *testing.T) { require.True(t, ok) } -func EqualEthTransaction(t *testing.T, expected, actual *coretypes.Transaction) { +func equalEthTransaction(t *testing.T, expected, actual *coretypes.Transaction) { require.Equal(t, expected.ChainId(), actual.ChainId()) require.Equal(t, expected.Nonce(), actual.Nonce()) require.Equal(t, expected.GasTipCap(), actual.GasTipCap()) @@ -643,4 +884,6 @@ func EqualEthTransaction(t *testing.T, expected, actual *coretypes.Transaction) require.Equal(t, expected.Data(), actual.Data()) require.Equal(t, expected.Value(), actual.Value()) require.Equal(t, expected.Type(), actual.Type()) + require.Equal(t, expected.AccessList(), actual.AccessList()) + require.Equal(t, expected.SetCodeAuthorizations(), actual.SetCodeAuthorizations()) } diff --git a/x/evm/precompiles/cosmos/contract.go b/x/evm/precompiles/cosmos/contract.go index 0d8d1aac..701bbe0a 100644 --- a/x/evm/precompiles/cosmos/contract.go +++ b/x/evm/precompiles/cosmos/contract.go @@ -97,7 +97,7 @@ func (e *CosmosPrecompile) originAddress(ctx context.Context, addrBz []byte) (sd } // ExtendedRun implements vm.ExtendedPrecompiledContract. -func (e *CosmosPrecompile) ExtendedRun(caller vm.ContractRef, input []byte, suppliedGas uint64, readOnly bool) (resBz []byte, usedGas uint64, err error) { +func (e *CosmosPrecompile) ExtendedRun(caller common.Address, input []byte, suppliedGas uint64, readOnly bool) (resBz []byte, usedGas uint64, err error) { snapshot := e.stateDB.Snapshot() ctx := e.stateDB.Context().WithGasMeter(storetypes.NewGasMeter(suppliedGas)) @@ -285,7 +285,7 @@ func (e *CosmosPrecompile) ExtendedRun(caller vm.ContractRef, input []byte, supp } // convert shorthand account to original address - callerAddr, err := e.originAddress(ctx, caller.Address().Bytes()) + callerAddr, err := e.originAddress(ctx, caller.Bytes()) if err != nil { return nil, ctx.GasMeter().GasConsumedToLimit(), types.ErrPrecompileFailed.Wrap(err.Error()) } @@ -294,7 +294,7 @@ func (e *CosmosPrecompile) ExtendedRun(caller vm.ContractRef, input []byte, supp if !bytes.Equal(callerAddr, signer) { return nil, ctx.GasMeter().GasConsumedToLimit(), sdkerrors.ErrUnauthorized.Wrapf( "required signer: `%s`, given signer: `%s`", - hexutil.Encode(signer), caller.Address(), + hexutil.Encode(signer), caller, ) } } diff --git a/x/evm/precompiles/cosmos/contract_test.go b/x/evm/precompiles/cosmos/contract_test.go index f3ff24e2..1d195170 100644 --- a/x/evm/precompiles/cosmos/contract_test.go +++ b/x/evm/precompiles/cosmos/contract_test.go @@ -33,6 +33,7 @@ import ( contracts "github.com/initia-labs/minievm/x/evm/contracts/i_cosmos" precompiles "github.com/initia-labs/minievm/x/evm/precompiles/cosmos" + precompiletesting "github.com/initia-labs/minievm/x/evm/precompiles/testing" "github.com/initia-labs/minievm/x/evm/types" oracletypes "github.com/skip-mev/connect/v2/x/oracle/types" @@ -57,15 +58,15 @@ func setup() (sdk.Context, codec.Codec, address.Codec, types.AccountKeeper, type ac := codecaddress.NewBech32Codec("init") return ctx, cdc, ac, - &MockAccountKeeper{ac: ac, accounts: make(map[string]sdk.AccountI)}, - &MockBankKeeper{ac: ac, blockedAddresses: make(map[string]bool)} + &precompiletesting.MockAccountKeeper{Codec: ac, Accounts: make(map[string]sdk.AccountI)}, + &precompiletesting.MockBankKeeper{Codec: ac, BlockedAddresses: make(map[string]bool)} } func Test_CosmosPrecompile_IsBlockedAddress(t *testing.T) { ctx, cdc, ac, ak, bk := setup() authorityAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() - stateDB := NewMockStateDB(ctx) + stateDB := precompiletesting.NewMockStateDB(ctx) cosmosPrecompile, err := precompiles.NewCosmosPrecompile(stateDB, cdc, ac, ak, bk, nil, nil, nil, authorityAddr) require.NoError(t, err) @@ -81,11 +82,11 @@ func Test_CosmosPrecompile_IsBlockedAddress(t *testing.T) { require.NoError(t, err) // out of gas error - output, _, err := cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.IS_BLOCKED_ADDRESS_GAS-1, true) + output, _, err := cosmosPrecompile.ExtendedRun(evmAddr, inputBz, precompiles.IS_BLOCKED_ADDRESS_GAS-1, true) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, string(output), "out of gas") - retBz, _, err := cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.IS_BLOCKED_ADDRESS_GAS+uint64(len(inputBz)), true) + retBz, _, err := cosmosPrecompile.ExtendedRun(evmAddr, inputBz, precompiles.IS_BLOCKED_ADDRESS_GAS+uint64(len(inputBz)), true) require.NoError(t, err) ret, err := abi.Unpack(precompiles.METHOD_IS_BLOCKED_ADDRESS, retBz) @@ -93,13 +94,13 @@ func Test_CosmosPrecompile_IsBlockedAddress(t *testing.T) { require.False(t, ret[0].(bool)) // block address - bk.(*MockBankKeeper).blockedAddresses[cosmosAddr] = true + bk.(*precompiletesting.MockBankKeeper).BlockedAddresses[cosmosAddr] = true // is blocked address inputBz, err = abi.Pack(precompiles.METHOD_IS_BLOCKED_ADDRESS, evmAddr) require.NoError(t, err) - retBz, _, err = cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.IS_BLOCKED_ADDRESS_GAS+uint64(len(inputBz)), true) + retBz, _, err = cosmosPrecompile.ExtendedRun(evmAddr, inputBz, precompiles.IS_BLOCKED_ADDRESS_GAS+uint64(len(inputBz)), true) require.NoError(t, err) ret, err = abi.Unpack(precompiles.METHOD_IS_BLOCKED_ADDRESS, retBz) @@ -111,7 +112,7 @@ func Test_CosmosPrecompile_IsModuleAddress(t *testing.T) { ctx, cdc, ac, ak, bk := setup() authorityAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() - stateDB := NewMockStateDB(ctx) + stateDB := precompiletesting.NewMockStateDB(ctx) cosmosPrecompile, err := precompiles.NewCosmosPrecompile(stateDB, cdc, ac, ak, bk, nil, nil, nil, authorityAddr) require.NoError(t, err) @@ -127,11 +128,11 @@ func Test_CosmosPrecompile_IsModuleAddress(t *testing.T) { require.NoError(t, err) // out of gas error - output, _, err := cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.IS_MODULE_ADDRESS_GAS-1, true) + output, _, err := cosmosPrecompile.ExtendedRun(evmAddr, inputBz, precompiles.IS_MODULE_ADDRESS_GAS-1, true) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, string(output), "out of gas") - retBz, _, err := cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.IS_MODULE_ADDRESS_GAS+uint64(len(inputBz)), true) + retBz, _, err := cosmosPrecompile.ExtendedRun(evmAddr, inputBz, precompiles.IS_MODULE_ADDRESS_GAS+uint64(len(inputBz)), true) require.NoError(t, err) ret, err := abi.Unpack(precompiles.METHOD_IS_MODULE_ADDRESS, retBz) @@ -139,13 +140,13 @@ func Test_CosmosPrecompile_IsModuleAddress(t *testing.T) { require.False(t, ret[0].(bool)) // module address - ak.(*MockAccountKeeper).accounts[cosmosAddr] = authtypes.NewEmptyModuleAccount("test") + ak.(*precompiletesting.MockAccountKeeper).Accounts[cosmosAddr] = authtypes.NewEmptyModuleAccount("test") // is module address inputBz, err = abi.Pack(precompiles.METHOD_IS_MODULE_ADDRESS, evmAddr) require.NoError(t, err) - retBz, _, err = cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.IS_MODULE_ADDRESS_GAS+uint64(len(inputBz)), true) + retBz, _, err = cosmosPrecompile.ExtendedRun(evmAddr, inputBz, precompiles.IS_MODULE_ADDRESS_GAS+uint64(len(inputBz)), true) require.NoError(t, err) ret, err = abi.Unpack(precompiles.METHOD_IS_MODULE_ADDRESS, retBz) @@ -157,7 +158,7 @@ func Test_CosmosPrecompile_IsAuthorityAddress(t *testing.T) { ctx, cdc, ac, ak, bk := setup() authorityAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() - stateDB := NewMockStateDB(ctx) + stateDB := precompiletesting.NewMockStateDB(ctx) cosmosPrecompile, err := precompiles.NewCosmosPrecompile(stateDB, cdc, ac, ak, bk, nil, nil, nil, authorityAddr) require.NoError(t, err) @@ -172,11 +173,11 @@ func Test_CosmosPrecompile_IsAuthorityAddress(t *testing.T) { require.NoError(t, err) // out of gas error - output, _, err := cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.IS_AUTHORITY_ADDRESS_GAS-1, true) + output, _, err := cosmosPrecompile.ExtendedRun(evmAddr, inputBz, precompiles.IS_AUTHORITY_ADDRESS_GAS-1, true) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, string(output), "out of gas") - retBz, _, err := cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.IS_AUTHORITY_ADDRESS_GAS+uint64(len(inputBz)), true) + retBz, _, err := cosmosPrecompile.ExtendedRun(evmAddr, inputBz, precompiles.IS_AUTHORITY_ADDRESS_GAS+uint64(len(inputBz)), true) require.NoError(t, err) ret, err := abi.Unpack(precompiles.METHOD_IS_AUTHORITY_ADDRESS, retBz) @@ -188,7 +189,7 @@ func Test_CosmosPrecompile_IsAuthorityAddress(t *testing.T) { inputBz, err = abi.Pack(precompiles.METHOD_IS_AUTHORITY_ADDRESS, authorityEVMAddr) require.NoError(t, err) - retBz, _, err = cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.IS_AUTHORITY_ADDRESS_GAS+uint64(len(inputBz)), true) + retBz, _, err = cosmosPrecompile.ExtendedRun(evmAddr, inputBz, precompiles.IS_AUTHORITY_ADDRESS_GAS+uint64(len(inputBz)), true) require.NoError(t, err) ret, err = abi.Unpack(precompiles.METHOD_IS_AUTHORITY_ADDRESS, retBz) @@ -200,7 +201,7 @@ func Test_CosmosPrecompile_ToCosmosAddress(t *testing.T) { ctx, cdc, ac, ak, bk := setup() authorityAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() - stateDB := NewMockStateDB(ctx) + stateDB := precompiletesting.NewMockStateDB(ctx) cosmosPrecompile, err := precompiles.NewCosmosPrecompile(stateDB, cdc, ac, ak, bk, nil, nil, nil, authorityAddr) require.NoError(t, err) @@ -216,11 +217,11 @@ func Test_CosmosPrecompile_ToCosmosAddress(t *testing.T) { require.NoError(t, err) // out of gas error - output, _, err := cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.TO_COSMOS_ADDRESS_GAS-1, true) + output, _, err := cosmosPrecompile.ExtendedRun(evmAddr, inputBz, precompiles.TO_COSMOS_ADDRESS_GAS-1, true) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, string(output), "out of gas") - retBz, _, err := cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.TO_COSMOS_ADDRESS_GAS+uint64(len(inputBz)), true) + retBz, _, err := cosmosPrecompile.ExtendedRun(evmAddr, inputBz, precompiles.TO_COSMOS_ADDRESS_GAS+uint64(len(inputBz)), true) require.NoError(t, err) ret, err := abi.Unpack(precompiles.METHOD_TO_COSMOS_ADDRESS, retBz) @@ -232,7 +233,7 @@ func Test_CosmosPrecompile_ToEVMAddress(t *testing.T) { ctx, cdc, ac, ak, bk := setup() authorityAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() - stateDB := NewMockStateDB(ctx) + stateDB := precompiletesting.NewMockStateDB(ctx) cosmosPrecompile, err := precompiles.NewCosmosPrecompile(stateDB, cdc, ac, ak, bk, nil, nil, nil, authorityAddr) require.NoError(t, err) @@ -248,11 +249,11 @@ func Test_CosmosPrecompile_ToEVMAddress(t *testing.T) { require.NoError(t, err) // out of gas error - output, _, err := cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.TO_EVM_ADDRESS_GAS-1, true) + output, _, err := cosmosPrecompile.ExtendedRun(evmAddr, inputBz, precompiles.TO_EVM_ADDRESS_GAS-1, true) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, string(output), "out of gas") - retBz, _, err := cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.TO_EVM_ADDRESS_GAS+uint64(len(inputBz)), true) + retBz, _, err := cosmosPrecompile.ExtendedRun(evmAddr, inputBz, precompiles.TO_EVM_ADDRESS_GAS+uint64(len(inputBz)), true) require.NoError(t, err) ret, err := abi.Unpack(precompiles.METHOD_TO_EVM_ADDRESS, retBz) @@ -264,7 +265,7 @@ func Test_ExecuteCosmos(t *testing.T) { ctx, cdc, ac, ak, bk := setup() authorityAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() - stateDB := NewMockStateDB(ctx) + stateDB := precompiletesting.NewMockStateDB(ctx) cosmosPrecompile, err := precompiles.NewCosmosPrecompile(stateDB, cdc, ac, ak, bk, nil, nil, nil, authorityAddr) require.NoError(t, err) @@ -292,29 +293,29 @@ func Test_ExecuteCosmos(t *testing.T) { require.NoError(t, err) // out of gas error - output, _, err := cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, contractExecGas+precompiles.EXECUTE_COSMOS_GAS-1, false) + output, _, err := cosmosPrecompile.ExtendedRun(evmAddr, inputBz, contractExecGas+precompiles.EXECUTE_COSMOS_GAS-1, false) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, string(output), "out of gas") // cannot call execute in readonly mode - _, _, err = cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, contractExecGas+precompiles.EXECUTE_COSMOS_GAS+uint64(len(inputBz)), true) + _, _, err = cosmosPrecompile.ExtendedRun(evmAddr, inputBz, contractExecGas+precompiles.EXECUTE_COSMOS_GAS+uint64(len(inputBz)), true) require.ErrorIs(t, err, vm.ErrExecutionReverted) // failed with disabled error stateDB.EVM().SetDisallowCosmosDispatch(true) - ret, _, err := cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, contractExecGas+precompiles.EXECUTE_COSMOS_GAS+uint64(len(inputBz)), false) + ret, _, err := cosmosPrecompile.ExtendedRun(evmAddr, inputBz, contractExecGas+precompiles.EXECUTE_COSMOS_GAS+uint64(len(inputBz)), false) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, types.NewRevertError(ret).Error(), types.ErrExecuteCosmosDisabled.Error()) stateDB.EVM().SetDisallowCosmosDispatch(false) // succeed - _, _, err = cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, contractExecGas+precompiles.EXECUTE_COSMOS_GAS+uint64(len(inputBz)), false) + _, _, err = cosmosPrecompile.ExtendedRun(evmAddr, inputBz, contractExecGas+precompiles.EXECUTE_COSMOS_GAS+uint64(len(inputBz)), false) require.NoError(t, err) messages := stateDB.Context().Value(types.CONTEXT_KEY_EXECUTE_REQUESTS).(*[]types.ExecuteRequest) require.Len(t, *messages, 1) require.Equal(t, (*messages)[0], types.ExecuteRequest{ - Caller: vm.AccountRef(evmAddr), + Caller: evmAddr, Msg: &banktypes.MsgSend{ FromAddress: cosmosAddr, ToAddress: "init1enjh88u7c9s08fgdu28wj6umz94cetjy0hpcxf", @@ -340,7 +341,7 @@ func Test_ExecuteCosmos(t *testing.T) { require.NoError(t, err) // failed with unauthorized error - ret, _, err = cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, contractExecGas+precompiles.EXECUTE_COSMOS_GAS+uint64(len(inputBz)), false) + ret, _, err = cosmosPrecompile.ExtendedRun(evmAddr, inputBz, contractExecGas+precompiles.EXECUTE_COSMOS_GAS+uint64(len(inputBz)), false) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, types.NewRevertError(ret).Error(), sdkerrors.ErrUnauthorized.Error()) } @@ -349,7 +350,7 @@ func Test_ExecuteCosmosWithOptions(t *testing.T) { ctx, cdc, ac, ak, bk := setup() authorityAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() - stateDB := NewMockStateDB(ctx) + stateDB := precompiletesting.NewMockStateDB(ctx) cosmosPrecompile, err := precompiles.NewCosmosPrecompile(stateDB, cdc, ac, ak, bk, nil, nil, nil, authorityAddr) require.NoError(t, err) @@ -378,22 +379,22 @@ func Test_ExecuteCosmosWithOptions(t *testing.T) { require.NoError(t, err) // out of gas error - output, _, err := cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, contractExecGas+precompiles.EXECUTE_COSMOS_GAS-1, false) + output, _, err := cosmosPrecompile.ExtendedRun(evmAddr, inputBz, contractExecGas+precompiles.EXECUTE_COSMOS_GAS-1, false) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, string(output), "out of gas") // cannot call execute in readonly mode - _, _, err = cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, contractExecGas+precompiles.EXECUTE_COSMOS_GAS+uint64(len(inputBz)), true) + _, _, err = cosmosPrecompile.ExtendedRun(evmAddr, inputBz, contractExecGas+precompiles.EXECUTE_COSMOS_GAS+uint64(len(inputBz)), true) require.ErrorIs(t, err, vm.ErrExecutionReverted) // succeed - _, _, err = cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, contractExecGas+precompiles.EXECUTE_COSMOS_GAS+uint64(len(inputBz)), false) + _, _, err = cosmosPrecompile.ExtendedRun(evmAddr, inputBz, contractExecGas+precompiles.EXECUTE_COSMOS_GAS+uint64(len(inputBz)), false) require.NoError(t, err) messages := stateDB.Context().Value(types.CONTEXT_KEY_EXECUTE_REQUESTS).(*[]types.ExecuteRequest) require.Len(t, *messages, 1) require.Equal(t, (*messages)[0], types.ExecuteRequest{ - Caller: vm.AccountRef(evmAddr), + Caller: evmAddr, Msg: &banktypes.MsgSend{ FromAddress: cosmosAddr, ToAddress: "init1enjh88u7c9s08fgdu28wj6umz94cetjy0hpcxf", @@ -419,7 +420,7 @@ func Test_ExecuteCosmosWithOptions(t *testing.T) { require.NoError(t, err) // failed with unauthorized error - ret, _, err := cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, contractExecGas+precompiles.EXECUTE_COSMOS_GAS+uint64(len(inputBz)), false) + ret, _, err := cosmosPrecompile.ExtendedRun(evmAddr, inputBz, contractExecGas+precompiles.EXECUTE_COSMOS_GAS+uint64(len(inputBz)), false) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, types.NewRevertError(ret).Error(), sdkerrors.ErrUnauthorized.Error()) } @@ -441,9 +442,9 @@ func Test_QueryCosmos(t *testing.T) { }, } - stateDB := NewMockStateDB(ctx) - cosmosPrecompile, err := precompiles.NewCosmosPrecompile(stateDB, cdc, ac, ak, bk, nil, MockGRPCRouter{ - routes: map[string]baseapp.GRPCQueryHandler{ + stateDB := precompiletesting.NewMockStateDB(ctx) + cosmosPrecompile, err := precompiles.NewCosmosPrecompile(stateDB, cdc, ac, ak, bk, nil, precompiletesting.MockGRPCRouter{ + Routes: map[string]baseapp.GRPCQueryHandler{ queryPath: func(ctx sdk.Context, req *abci.RequestQuery) (*abci.ResponseQuery, error) { resBz, err := cdc.Marshal(&expectedRet) if err != nil { @@ -474,12 +475,12 @@ func Test_QueryCosmos(t *testing.T) { require.NoError(t, err) // out of gas error - output, _, err := cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.QUERY_COSMOS_GAS-1, false) + output, _, err := cosmosPrecompile.ExtendedRun(evmAddr, inputBz, precompiles.QUERY_COSMOS_GAS-1, false) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, string(output), "out of gas") // succeed - retBz, _, err := cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.QUERY_COSMOS_GAS+uint64(len(inputBz)), true) + retBz, _, err := cosmosPrecompile.ExtendedRun(evmAddr, inputBz, precompiles.QUERY_COSMOS_GAS+uint64(len(inputBz)), true) require.NoError(t, err) // unpack response @@ -500,12 +501,12 @@ func Test_ToDenom(t *testing.T) { erc20Addr := common.HexToAddress("0x123") denom := "evm/0000000000000000000000000000000000000123" - stateDB := NewMockStateDB(ctx) - cosmosPrecompile, err := precompiles.NewCosmosPrecompile(stateDB, cdc, ac, ak, bk, &MockERC20DenomKeeper{ - denomMap: map[string]common.Address{ + stateDB := precompiletesting.NewMockStateDB(ctx) + cosmosPrecompile, err := precompiles.NewCosmosPrecompile(stateDB, cdc, ac, ak, bk, &precompiletesting.MockERC20DenomKeeper{ + DenomMap: map[string]common.Address{ denom: erc20Addr, }, - addrMap: map[common.Address]string{ + AddrMap: map[common.Address]string{ erc20Addr: denom, }, }, nil, nil, authorityAddr) @@ -521,12 +522,12 @@ func Test_ToDenom(t *testing.T) { require.NoError(t, err) // out of gas error - output, _, err := cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.TO_DENOM_GAS-1, false) + output, _, err := cosmosPrecompile.ExtendedRun(evmAddr, inputBz, precompiles.TO_DENOM_GAS-1, false) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, string(output), "out of gas") // succeed - retBz, _, err := cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.TO_DENOM_GAS+uint64(len(inputBz)), true) + retBz, _, err := cosmosPrecompile.ExtendedRun(evmAddr, inputBz, precompiles.TO_DENOM_GAS+uint64(len(inputBz)), true) require.NoError(t, err) // unpack response @@ -542,12 +543,12 @@ func Test_ToErc20(t *testing.T) { erc20Addr := common.HexToAddress("0x123") denom := "evm/0000000000000000000000000000000000000123" - stateDB := NewMockStateDB(ctx) - cosmosPrecompile, err := precompiles.NewCosmosPrecompile(stateDB, cdc, ac, ak, bk, &MockERC20DenomKeeper{ - denomMap: map[string]common.Address{ + stateDB := precompiletesting.NewMockStateDB(ctx) + cosmosPrecompile, err := precompiles.NewCosmosPrecompile(stateDB, cdc, ac, ak, bk, &precompiletesting.MockERC20DenomKeeper{ + DenomMap: map[string]common.Address{ denom: erc20Addr, }, - addrMap: map[common.Address]string{ + AddrMap: map[common.Address]string{ erc20Addr: denom, }, }, nil, nil, authorityAddr) @@ -563,12 +564,12 @@ func Test_ToErc20(t *testing.T) { require.NoError(t, err) // out of gas panic - output, _, err := cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.TO_ERC20_GAS-1, false) + output, _, err := cosmosPrecompile.ExtendedRun(evmAddr, inputBz, precompiles.TO_ERC20_GAS-1, false) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, string(output), "out of gas") // succeed - retBz, _, err := cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.TO_ERC20_GAS+uint64(len(inputBz)), true) + retBz, _, err := cosmosPrecompile.ExtendedRun(evmAddr, inputBz, precompiles.TO_ERC20_GAS+uint64(len(inputBz)), true) require.NoError(t, err) // unpack response @@ -581,7 +582,7 @@ func Test_DisableExecuteCosmos(t *testing.T) { ctx, cdc, ac, ak, bk := setup() authorityAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() - stateDB := NewMockStateDB(ctx) + stateDB := precompiletesting.NewMockStateDB(ctx) cosmosPrecompile, err := precompiles.NewCosmosPrecompile(stateDB, cdc, ac, ak, bk, nil, nil, nil, authorityAddr) require.NoError(t, err) @@ -595,12 +596,12 @@ func Test_DisableExecuteCosmos(t *testing.T) { require.NoError(t, err) // out of gas error - output, _, err := cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.DISABLE_EXECUTE_COSMOS_GAS-1, false) + output, _, err := cosmosPrecompile.ExtendedRun(evmAddr, inputBz, precompiles.DISABLE_EXECUTE_COSMOS_GAS-1, false) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, string(output), "out of gas") // success - _, _, err = cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.DISABLE_EXECUTE_COSMOS_GAS+uint64(len(inputBz)), false) + _, _, err = cosmosPrecompile.ExtendedRun(evmAddr, inputBz, precompiles.DISABLE_EXECUTE_COSMOS_GAS+uint64(len(inputBz)), false) require.NoError(t, err) // check if execute cosmos is disabled diff --git a/x/evm/precompiles/cosmos/types.go b/x/evm/precompiles/cosmos/types.go index f3b25a99..65980c61 100644 --- a/x/evm/precompiles/cosmos/types.go +++ b/x/evm/precompiles/cosmos/types.go @@ -43,13 +43,8 @@ type ExecuteCosmosWithOptions struct { Options ExecuteOptions `abi:"options"` } -//nolint:gosimple func (eco ExecuteCosmosWithOptions) ToExecuteCosmos() ExecuteCosmos { - return ExecuteCosmos{ - Msg: eco.Msg, - GasLimit: eco.GasLimit, - Options: eco.Options, - } + return ExecuteCosmos(eco) } type ExecuteOptions struct { diff --git a/x/evm/precompiles/erc20_registry/common_test.go b/x/evm/precompiles/erc20_registry/common_test.go deleted file mode 100644 index 02d461a4..00000000 --- a/x/evm/precompiles/erc20_registry/common_test.go +++ /dev/null @@ -1,255 +0,0 @@ -package erc20registryprecompile_test - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/stateless" - "github.com/ethereum/go-ethereum/core/tracing" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/trie/utils" - "github.com/holiman/uint256" - - "github.com/initia-labs/minievm/x/evm/state" - evmtypes "github.com/initia-labs/minievm/x/evm/types" -) - -var _ evmtypes.StateDB = &MockStateDB{} - -type MockStateDB struct { - ctx state.Context - initialCtx state.Context - - // Snapshot stack - snaps []*state.Snapshot - - evm *vm.EVM -} - -func NewMockStateDB(sdkCtx sdk.Context) *MockStateDB { - ctx := state.NewContext(sdkCtx) - return &MockStateDB{ - ctx: ctx, - initialCtx: ctx, - - evm: &vm.EVM{}, - } -} - -// Snapshot implements types.StateDB. -func (m *MockStateDB) Snapshot() int { - // get a current snapshot id - sid := len(m.snaps) - 1 - - // create a new snapshot - snap := state.NewSnapshot(m.ctx) - m.snaps = append(m.snaps, snap) - - // use the new snapshot context - m.ctx = snap.Context() - - // return the current snapshot id - return sid -} - -// RevertToSnapshot implements types.StateDB. -func (m *MockStateDB) RevertToSnapshot(i int) { - if i == -1 { - m.ctx = m.initialCtx - m.snaps = m.snaps[:0] - return - } - - // revert to the snapshot with the given id - snap := m.snaps[i] - m.ctx = snap.Context() - - // clear the snapshots after the given id - m.snaps = m.snaps[:i+1] -} - -// Context implements types.StateDB. -func (m *MockStateDB) Context() sdk.Context { - return m.ctx.Context -} - -// EVM implements types.StateDB. -func (m *MockStateDB) EVM() *vm.EVM { - return m.evm -} - -func (m *MockStateDB) SetTracer(tracer *tracing.Hooks) {} - -//////////////////////// MOCKED METHODS //////////////////////// - -// AddAddressToAccessList implements types.StateDB. -func (m *MockStateDB) AddAddressToAccessList(addr common.Address) { - panic("unimplemented") -} - -// AddBalance implements types.StateDB. -func (m *MockStateDB) AddBalance(common.Address, *uint256.Int, tracing.BalanceChangeReason) { - panic("unimplemented") -} - -// AddLog implements types.StateDB. -func (m *MockStateDB) AddLog(*types.Log) { - panic("unimplemented") -} - -// AddPreimage implements types.StateDB. -func (m *MockStateDB) AddPreimage(common.Hash, []byte) { - panic("unimplemented") -} - -// AddRefund implements types.StateDB. -func (m *MockStateDB) AddRefund(uint64) { - panic("unimplemented") -} - -// AddSlotToAccessList implements types.StateDB. -func (m *MockStateDB) AddSlotToAccessList(addr common.Address, slot common.Hash) { - panic("unimplemented") -} - -// AddressInAccessList implements types.StateDB. -func (m *MockStateDB) AddressInAccessList(addr common.Address) bool { - panic("unimplemented") -} - -// CreateAccount implements types.StateDB. -func (m *MockStateDB) CreateAccount(common.Address) { - panic("unimplemented") -} - -// CreateContract implements types.StateDB. -func (m *MockStateDB) CreateContract(common.Address) { - panic("unimplemented") -} - -// Empty implements types.StateDB. -func (m *MockStateDB) Empty(common.Address) bool { - panic("unimplemented") -} - -// Exist implements types.StateDB. -func (m *MockStateDB) Exist(common.Address) bool { - panic("unimplemented") -} - -// GetBalance implements types.StateDB. -func (m *MockStateDB) GetBalance(common.Address) *uint256.Int { - panic("unimplemented") -} - -// GetCode implements types.StateDB. -func (m *MockStateDB) GetCode(common.Address) []byte { - panic("unimplemented") -} - -// GetCodeHash implements types.StateDB. -func (m *MockStateDB) GetCodeHash(common.Address) common.Hash { - panic("unimplemented") -} - -// GetCodeSize implements types.StateDB. -func (m *MockStateDB) GetCodeSize(common.Address) int { - panic("unimplemented") -} - -// GetCommittedState implements types.StateDB. -func (m *MockStateDB) GetCommittedState(common.Address, common.Hash) common.Hash { - panic("unimplemented") -} - -// GetNonce implements types.StateDB. -func (m *MockStateDB) GetNonce(common.Address) uint64 { - panic("unimplemented") -} - -// GetRefund implements types.StateDB. -func (m *MockStateDB) GetRefund() uint64 { - panic("unimplemented") -} - -// GetState implements types.StateDB. -func (m *MockStateDB) GetState(common.Address, common.Hash) common.Hash { - panic("unimplemented") -} - -// GetStorageRoot implements types.StateDB. -func (m *MockStateDB) GetStorageRoot(addr common.Address) common.Hash { - panic("unimplemented") -} - -// GetTransientState implements types.StateDB. -func (m *MockStateDB) GetTransientState(addr common.Address, key common.Hash) common.Hash { - panic("unimplemented") -} - -// HasSelfDestructed implements types.StateDB. -func (m *MockStateDB) HasSelfDestructed(common.Address) bool { - panic("unimplemented") -} - -// PointCache implements types.StateDB. -func (m *MockStateDB) PointCache() *utils.PointCache { - panic("unimplemented") -} - -// Prepare implements types.StateDB. -func (m *MockStateDB) Prepare(rules params.Rules, sender common.Address, coinbase common.Address, dest *common.Address, precompiles []common.Address, txAccesses types.AccessList) { - panic("unimplemented") -} - -// SelfDestruct implements types.StateDB. -func (m *MockStateDB) SelfDestruct(common.Address) { - panic("unimplemented") -} - -// Selfdestruct6780 implements types.StateDB. -func (m *MockStateDB) Selfdestruct6780(common.Address) { - panic("unimplemented") -} - -// SetCode implements types.StateDB. -func (m *MockStateDB) SetCode(common.Address, []byte) { - panic("unimplemented") -} - -// SetNonce implements types.StateDB. -func (m *MockStateDB) SetNonce(common.Address, uint64) { - panic("unimplemented") -} - -// SetState implements types.StateDB. -func (m *MockStateDB) SetState(common.Address, common.Hash, common.Hash) { - panic("unimplemented") -} - -// SetTransientState implements types.StateDB. -func (m *MockStateDB) SetTransientState(addr common.Address, key common.Hash, value common.Hash) { - panic("unimplemented") -} - -// SlotInAccessList implements types.StateDB. -func (m *MockStateDB) SlotInAccessList(addr common.Address, slot common.Hash) (addressOk bool, slotOk bool) { - panic("unimplemented") -} - -// SubBalance implements types.StateDB. -func (m *MockStateDB) SubBalance(common.Address, *uint256.Int, tracing.BalanceChangeReason) { - panic("unimplemented") -} - -// SubRefund implements types.StateDB. -func (m *MockStateDB) SubRefund(uint64) { - panic("unimplemented") -} - -// Witness implements types.StateDB. -func (m *MockStateDB) Witness() *stateless.Witness { - panic("unimplemented") -} diff --git a/x/evm/precompiles/erc20_registry/contract.go b/x/evm/precompiles/erc20_registry/contract.go index 52bd36eb..14139e42 100644 --- a/x/evm/precompiles/erc20_registry/contract.go +++ b/x/evm/precompiles/erc20_registry/contract.go @@ -4,6 +4,7 @@ import ( "errors" "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/vm" storetypes "cosmossdk.io/store/types" @@ -43,7 +44,7 @@ const ( ) // ExtendedRun implements vm.ExtendedPrecompiledContract. -func (e *ERC20RegistryPrecompile) ExtendedRun(caller vm.ContractRef, input []byte, suppliedGas uint64, readOnly bool) (resBz []byte, usedGas uint64, err error) { +func (e *ERC20RegistryPrecompile) ExtendedRun(caller common.Address, input []byte, suppliedGas uint64, readOnly bool) (resBz []byte, usedGas uint64, err error) { snapshot := e.stateDB.Snapshot() ctx := e.stateDB.Context().WithGasMeter(storetypes.NewGasMeter(suppliedGas)) @@ -92,7 +93,7 @@ func (e *ERC20RegistryPrecompile) ExtendedRun(caller vm.ContractRef, input []byt // charge the gas for the register erc20 ctx.GasMeter().ConsumeGas(REGISTER_GAS, "register_erc20") - if err := e.k.Register(ctx, caller.Address()); err != nil { + if err := e.k.Register(ctx, caller); err != nil { return nil, ctx.GasMeter().GasConsumedToLimit(), types.ErrPrecompileFailed.Wrap(err.Error()) } @@ -113,7 +114,7 @@ func (e *ERC20RegistryPrecompile) ExtendedRun(caller vm.ContractRef, input []byt return nil, ctx.GasMeter().GasConsumedToLimit(), types.ErrPrecompileFailed.Wrap(err.Error()) } - if err := e.k.RegisterFromFactory(ctx, caller.Address(), registerArgs.ERC20); err != nil { + if err := e.k.RegisterFromFactory(ctx, caller, registerArgs.ERC20); err != nil { return nil, ctx.GasMeter().GasConsumedToLimit(), types.ErrPrecompileFailed.Wrap(err.Error()) } @@ -134,7 +135,7 @@ func (e *ERC20RegistryPrecompile) ExtendedRun(caller vm.ContractRef, input []byt return nil, ctx.GasMeter().GasConsumedToLimit(), types.ErrPrecompileFailed.Wrap(err.Error()) } - if err := e.k.RegisterStore(ctx, registerArgs.Account.Bytes(), caller.Address()); err != nil { + if err := e.k.RegisterStore(ctx, registerArgs.Account.Bytes(), caller); err != nil { return nil, ctx.GasMeter().GasConsumedToLimit(), types.ErrPrecompileFailed.Wrap(err.Error()) } @@ -150,7 +151,7 @@ func (e *ERC20RegistryPrecompile) ExtendedRun(caller vm.ContractRef, input []byt return nil, ctx.GasMeter().GasConsumedToLimit(), types.ErrPrecompileFailed.Wrap(err.Error()) } - ok, err := e.k.IsStoreRegistered(ctx, isRegisteredArgs.Account.Bytes(), caller.Address()) + ok, err := e.k.IsStoreRegistered(ctx, isRegisteredArgs.Account.Bytes(), caller) if err != nil { return nil, ctx.GasMeter().GasConsumedToLimit(), types.ErrPrecompileFailed.Wrap(err.Error()) } diff --git a/x/evm/precompiles/erc20_registry/contract_test.go b/x/evm/precompiles/erc20_registry/contract_test.go index 14fc6239..95c1f5b2 100644 --- a/x/evm/precompiles/erc20_registry/contract_test.go +++ b/x/evm/precompiles/erc20_registry/contract_test.go @@ -17,6 +17,7 @@ import ( contracts "github.com/initia-labs/minievm/x/evm/contracts/i_erc20_registry" precompiles "github.com/initia-labs/minievm/x/evm/precompiles/erc20_registry" + precompiletesting "github.com/initia-labs/minievm/x/evm/precompiles/testing" "github.com/initia-labs/minievm/x/evm/types" ) @@ -71,7 +72,7 @@ func (e ERC20StoresKeeper) RegisterStore(ctx context.Context, addr sdk.AccAddres func Test_ERC20RegistryPrecompile(t *testing.T) { ctx, k := setup() - stateDB := NewMockStateDB(ctx) + stateDB := precompiletesting.NewMockStateDB(ctx) registry, err := precompiles.NewERC20RegistryPrecompile(stateDB, k) require.NoError(t, err) @@ -87,16 +88,16 @@ func Test_ERC20RegistryPrecompile(t *testing.T) { require.NoError(t, err) // out of gas error - output, _, err := registry.ExtendedRun(vm.AccountRef(erc20Addr), bz, precompiles.REGISTER_GAS-1, false) + output, _, err := registry.ExtendedRun(erc20Addr, bz, precompiles.REGISTER_GAS-1, false) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, string(output), "out of gas") // non read only method fail - _, _, err = registry.ExtendedRun(vm.AccountRef(erc20Addr), bz, precompiles.REGISTER_GAS+uint64(len(bz)), true) + _, _, err = registry.ExtendedRun(erc20Addr, bz, precompiles.REGISTER_GAS+uint64(len(bz)), true) require.Error(t, err) // success - _, usedGas, err := registry.ExtendedRun(vm.AccountRef(erc20Addr), bz, precompiles.REGISTER_GAS+uint64(len(bz)), false) + _, usedGas, err := registry.ExtendedRun(erc20Addr, bz, precompiles.REGISTER_GAS+uint64(len(bz)), false) require.NoError(t, err) require.Equal(t, usedGas, uint64(precompiles.REGISTER_GAS)+uint64(len(bz))) @@ -105,16 +106,16 @@ func Test_ERC20RegistryPrecompile(t *testing.T) { require.NoError(t, err) // out of gas error - output, _, err = registry.ExtendedRun(vm.AccountRef(erc20FactoryAddr), bz, precompiles.REGISTER_FROM_FACTORY_GAS-1, false) + output, _, err = registry.ExtendedRun(erc20FactoryAddr, bz, precompiles.REGISTER_FROM_FACTORY_GAS-1, false) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, string(output), "out of gas") // non read only method fail - _, _, err = registry.ExtendedRun(vm.AccountRef(erc20FactoryAddr), bz, precompiles.REGISTER_FROM_FACTORY_GAS+uint64(len(bz)), true) + _, _, err = registry.ExtendedRun(erc20FactoryAddr, bz, precompiles.REGISTER_FROM_FACTORY_GAS+uint64(len(bz)), true) require.Error(t, err) // success - _, usedGas, err = registry.ExtendedRun(vm.AccountRef(erc20FactoryAddr), bz, precompiles.REGISTER_FROM_FACTORY_GAS+uint64(len(bz)), false) + _, usedGas, err = registry.ExtendedRun(erc20FactoryAddr, bz, precompiles.REGISTER_FROM_FACTORY_GAS+uint64(len(bz)), false) require.NoError(t, err) require.Equal(t, usedGas, uint64(precompiles.REGISTER_GAS)+uint64(len(bz))) @@ -125,7 +126,7 @@ func Test_ERC20RegistryPrecompile(t *testing.T) { bz, err = abi.Pack(precompiles.METHOD_IS_STORE_REGISTERED, accountAddr) require.NoError(t, err) - resBz, usedGas, err := registry.ExtendedRun(vm.AccountRef(erc20Addr), bz, precompiles.IS_STORE_REGISTERED_GAS+uint64(len(bz)), true) + resBz, usedGas, err := registry.ExtendedRun(erc20Addr, bz, precompiles.IS_STORE_REGISTERED_GAS+uint64(len(bz)), true) require.NoError(t, err) require.Equal(t, usedGas, uint64(precompiles.IS_STORE_REGISTERED_GAS)+uint64(len(bz))) @@ -138,16 +139,16 @@ func Test_ERC20RegistryPrecompile(t *testing.T) { require.NoError(t, err) // out of gas error - output, _, err = registry.ExtendedRun(vm.AccountRef(erc20Addr), bz, precompiles.REGISTER_STORE_GAS-1, false) + output, _, err = registry.ExtendedRun(erc20Addr, bz, precompiles.REGISTER_STORE_GAS-1, false) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, string(output), "out of gas") // non read only method fail - _, _, err = registry.ExtendedRun(vm.AccountRef(erc20Addr), bz, precompiles.REGISTER_STORE_GAS+uint64(len(bz)), true) + _, _, err = registry.ExtendedRun(erc20Addr, bz, precompiles.REGISTER_STORE_GAS+uint64(len(bz)), true) require.Error(t, err) // success - _, usedGas, err = registry.ExtendedRun(vm.AccountRef(erc20Addr), bz, precompiles.REGISTER_STORE_GAS+uint64(len(bz)), false) + _, usedGas, err = registry.ExtendedRun(erc20Addr, bz, precompiles.REGISTER_STORE_GAS+uint64(len(bz)), false) require.NoError(t, err) require.Equal(t, usedGas, uint64(precompiles.REGISTER_STORE_GAS)+uint64(len(bz))) @@ -156,11 +157,11 @@ func Test_ERC20RegistryPrecompile(t *testing.T) { require.NoError(t, err) // out of gas panic - output, _, err = registry.ExtendedRun(vm.AccountRef(erc20Addr), bz, precompiles.IS_STORE_REGISTERED_GAS-1, true) + output, _, err = registry.ExtendedRun(erc20Addr, bz, precompiles.IS_STORE_REGISTERED_GAS-1, true) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, string(output), "out of gas") - resBz, usedGas, err = registry.ExtendedRun(vm.AccountRef(erc20Addr), bz, precompiles.IS_STORE_REGISTERED_GAS+uint64(len(bz)), true) + resBz, usedGas, err = registry.ExtendedRun(erc20Addr, bz, precompiles.IS_STORE_REGISTERED_GAS+uint64(len(bz)), true) require.NoError(t, err) require.Equal(t, usedGas, uint64(precompiles.IS_STORE_REGISTERED_GAS)+uint64(len(bz))) diff --git a/x/evm/precompiles/jsonutils/common_test.go b/x/evm/precompiles/jsonutils/common_test.go deleted file mode 100644 index 8b778401..00000000 --- a/x/evm/precompiles/jsonutils/common_test.go +++ /dev/null @@ -1,255 +0,0 @@ -package jsonutils_test - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/stateless" - "github.com/ethereum/go-ethereum/core/tracing" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/trie/utils" - "github.com/holiman/uint256" - - "github.com/initia-labs/minievm/x/evm/state" - evmtypes "github.com/initia-labs/minievm/x/evm/types" -) - -var _ evmtypes.StateDB = &MockStateDB{} - -type MockStateDB struct { - ctx state.Context - initialCtx state.Context - - // Snapshot stack - snaps []*state.Snapshot - - evm *vm.EVM -} - -func NewMockStateDB(sdkCtx sdk.Context) *MockStateDB { - ctx := state.NewContext(sdkCtx) - return &MockStateDB{ - ctx: ctx, - initialCtx: ctx, - - evm: &vm.EVM{}, - } -} - -// Snapshot implements types.StateDB. -func (m *MockStateDB) Snapshot() int { - // get a current snapshot id - sid := len(m.snaps) - 1 - - // create a new snapshot - snap := state.NewSnapshot(m.ctx) - m.snaps = append(m.snaps, snap) - - // use the new snapshot context - m.ctx = snap.Context() - - // return the current snapshot id - return sid -} - -// RevertToSnapshot implements types.StateDB. -func (m *MockStateDB) RevertToSnapshot(i int) { - if i == -1 { - m.ctx = m.initialCtx - m.snaps = m.snaps[:0] - return - } - - // revert to the snapshot with the given id - snap := m.snaps[i] - m.ctx = snap.Context() - - // clear the snapshots after the given id - m.snaps = m.snaps[:i+1] -} - -// Context implements types.StateDB. -func (m *MockStateDB) Context() sdk.Context { - return m.ctx.Context -} - -// EVM implements types.StateDB. -func (m *MockStateDB) EVM() *vm.EVM { - return m.evm -} - -func (m *MockStateDB) SetTracer(tracer *tracing.Hooks) {} - -//////////////////////// MOCKED METHODS //////////////////////// - -// AddAddressToAccessList implements types.StateDB. -func (m *MockStateDB) AddAddressToAccessList(addr common.Address) { - panic("unimplemented") -} - -// AddBalance implements types.StateDB. -func (m *MockStateDB) AddBalance(common.Address, *uint256.Int, tracing.BalanceChangeReason) { - panic("unimplemented") -} - -// AddLog implements types.StateDB. -func (m *MockStateDB) AddLog(*types.Log) { - panic("unimplemented") -} - -// AddPreimage implements types.StateDB. -func (m *MockStateDB) AddPreimage(common.Hash, []byte) { - panic("unimplemented") -} - -// AddRefund implements types.StateDB. -func (m *MockStateDB) AddRefund(uint64) { - panic("unimplemented") -} - -// AddSlotToAccessList implements types.StateDB. -func (m *MockStateDB) AddSlotToAccessList(addr common.Address, slot common.Hash) { - panic("unimplemented") -} - -// AddressInAccessList implements types.StateDB. -func (m *MockStateDB) AddressInAccessList(addr common.Address) bool { - panic("unimplemented") -} - -// CreateAccount implements types.StateDB. -func (m *MockStateDB) CreateAccount(common.Address) { - panic("unimplemented") -} - -// CreateContract implements types.StateDB. -func (m *MockStateDB) CreateContract(common.Address) { - panic("unimplemented") -} - -// Empty implements types.StateDB. -func (m *MockStateDB) Empty(common.Address) bool { - panic("unimplemented") -} - -// Exist implements types.StateDB. -func (m *MockStateDB) Exist(common.Address) bool { - panic("unimplemented") -} - -// GetBalance implements types.StateDB. -func (m *MockStateDB) GetBalance(common.Address) *uint256.Int { - panic("unimplemented") -} - -// GetCode implements types.StateDB. -func (m *MockStateDB) GetCode(common.Address) []byte { - panic("unimplemented") -} - -// GetCodeHash implements types.StateDB. -func (m *MockStateDB) GetCodeHash(common.Address) common.Hash { - panic("unimplemented") -} - -// GetCodeSize implements types.StateDB. -func (m *MockStateDB) GetCodeSize(common.Address) int { - panic("unimplemented") -} - -// GetCommittedState implements types.StateDB. -func (m *MockStateDB) GetCommittedState(common.Address, common.Hash) common.Hash { - panic("unimplemented") -} - -// GetNonce implements types.StateDB. -func (m *MockStateDB) GetNonce(common.Address) uint64 { - panic("unimplemented") -} - -// GetRefund implements types.StateDB. -func (m *MockStateDB) GetRefund() uint64 { - panic("unimplemented") -} - -// GetState implements types.StateDB. -func (m *MockStateDB) GetState(common.Address, common.Hash) common.Hash { - panic("unimplemented") -} - -// GetStorageRoot implements types.StateDB. -func (m *MockStateDB) GetStorageRoot(addr common.Address) common.Hash { - panic("unimplemented") -} - -// GetTransientState implements types.StateDB. -func (m *MockStateDB) GetTransientState(addr common.Address, key common.Hash) common.Hash { - panic("unimplemented") -} - -// HasSelfDestructed implements types.StateDB. -func (m *MockStateDB) HasSelfDestructed(common.Address) bool { - panic("unimplemented") -} - -// PointCache implements types.StateDB. -func (m *MockStateDB) PointCache() *utils.PointCache { - panic("unimplemented") -} - -// Prepare implements types.StateDB. -func (m *MockStateDB) Prepare(rules params.Rules, sender common.Address, coinbase common.Address, dest *common.Address, precompiles []common.Address, txAccesses types.AccessList) { - panic("unimplemented") -} - -// SelfDestruct implements types.StateDB. -func (m *MockStateDB) SelfDestruct(common.Address) { - panic("unimplemented") -} - -// Selfdestruct6780 implements types.StateDB. -func (m *MockStateDB) Selfdestruct6780(common.Address) { - panic("unimplemented") -} - -// SetCode implements types.StateDB. -func (m *MockStateDB) SetCode(common.Address, []byte) { - panic("unimplemented") -} - -// SetNonce implements types.StateDB. -func (m *MockStateDB) SetNonce(common.Address, uint64) { - panic("unimplemented") -} - -// SetState implements types.StateDB. -func (m *MockStateDB) SetState(common.Address, common.Hash, common.Hash) { - panic("unimplemented") -} - -// SetTransientState implements types.StateDB. -func (m *MockStateDB) SetTransientState(addr common.Address, key common.Hash, value common.Hash) { - panic("unimplemented") -} - -// SlotInAccessList implements types.StateDB. -func (m *MockStateDB) SlotInAccessList(addr common.Address, slot common.Hash) (addressOk bool, slotOk bool) { - panic("unimplemented") -} - -// SubBalance implements types.StateDB. -func (m *MockStateDB) SubBalance(common.Address, *uint256.Int, tracing.BalanceChangeReason) { - panic("unimplemented") -} - -// SubRefund implements types.StateDB. -func (m *MockStateDB) SubRefund(uint64) { - panic("unimplemented") -} - -// Witness implements types.StateDB. -func (m *MockStateDB) Witness() *stateless.Witness { - panic("unimplemented") -} diff --git a/x/evm/precompiles/jsonutils/contract.go b/x/evm/precompiles/jsonutils/contract.go index 2983933f..0625caa7 100644 --- a/x/evm/precompiles/jsonutils/contract.go +++ b/x/evm/precompiles/jsonutils/contract.go @@ -8,6 +8,7 @@ import ( "time" "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/vm" "github.com/pkg/errors" @@ -52,7 +53,7 @@ const ( ) // ExtendedRun implements vm.ExtendedPrecompiledContract. -func (e *JSONUtilsPrecompile) ExtendedRun(caller vm.ContractRef, input []byte, suppliedGas uint64, readOnly bool) (resBz []byte, usedGas uint64, err error) { +func (e *JSONUtilsPrecompile) ExtendedRun(caller common.Address, input []byte, suppliedGas uint64, readOnly bool) (resBz []byte, usedGas uint64, err error) { snapshot := e.stateDB.Snapshot() ctx := e.stateDB.Context().WithGasMeter(storetypes.NewGasMeter(suppliedGas)) diff --git a/x/evm/precompiles/jsonutils/contract_test.go b/x/evm/precompiles/jsonutils/contract_test.go index 61fe6b71..0c48c118 100644 --- a/x/evm/precompiles/jsonutils/contract_test.go +++ b/x/evm/precompiles/jsonutils/contract_test.go @@ -10,6 +10,7 @@ import ( cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" abiapi "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/vm" "cosmossdk.io/core/address" @@ -27,6 +28,7 @@ import ( contracts "github.com/initia-labs/minievm/x/evm/contracts/i_jsonutils" precompiles "github.com/initia-labs/minievm/x/evm/precompiles/jsonutils" + precompiletesting "github.com/initia-labs/minievm/x/evm/precompiles/testing" "github.com/initia-labs/minievm/x/evm/types" ) @@ -94,7 +96,7 @@ func Test_JSONUtilsPrecompile_Merge(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { ctx, _, _ := setup() - stateDB := NewMockStateDB(ctx) + stateDB := precompiletesting.NewMockStateDB(ctx) contract, err := precompiles.NewJSONUtilsPrecompile(stateDB) require.NoError(t, err) @@ -105,12 +107,12 @@ func Test_JSONUtilsPrecompile_Merge(t *testing.T) { require.NoError(t, err) // out of gas error - output, _, err := contract.ExtendedRun(nil, bz, precompiles.MERGE_GAS-1, false) + output, _, err := contract.ExtendedRun(common.Address{}, bz, precompiles.MERGE_GAS-1, false) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, string(output), "out of gas") // success - resBz, _, err := contract.ExtendedRun(nil, bz, precompiles.MERGE_GAS+uint64(len(bz)), false) + resBz, _, err := contract.ExtendedRun(common.Address{}, bz, precompiles.MERGE_GAS+uint64(len(bz)), false) if tc.expectedErr { require.Error(t, err) return @@ -150,7 +152,7 @@ func Test_JSONUtilsPrecompile_Stringify(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { ctx, _, _ := setup() - stateDB := NewMockStateDB(ctx) + stateDB := precompiletesting.NewMockStateDB(ctx) contract, err := precompiles.NewJSONUtilsPrecompile(stateDB) require.NoError(t, err) @@ -161,12 +163,12 @@ func Test_JSONUtilsPrecompile_Stringify(t *testing.T) { require.NoError(t, err) // out of gas error - output, _, err := contract.ExtendedRun(nil, bz, precompiles.STRINGIFY_JSON_GAS-1, false) + output, _, err := contract.ExtendedRun(common.Address{}, bz, precompiles.STRINGIFY_JSON_GAS-1, false) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, string(output), "out of gas") // success - resBz, _, err := contract.ExtendedRun(nil, bz, precompiles.STRINGIFY_JSON_GAS+uint64(len(bz)), false) + resBz, _, err := contract.ExtendedRun(common.Address{}, bz, precompiles.STRINGIFY_JSON_GAS+uint64(len(bz)), false) require.NoError(t, err) res, err := abi.Unpack(precompiles.METHOD_STRINGIFY_JSON, resBz) require.NoError(t, err) @@ -213,7 +215,7 @@ func Test_JSONUtilsPrecompile_UnmarshalToObject(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { ctx, _, _ := setup() - stateDB := NewMockStateDB(ctx) + stateDB := precompiletesting.NewMockStateDB(ctx) contract, err := precompiles.NewJSONUtilsPrecompile(stateDB) require.NoError(t, err) @@ -224,11 +226,11 @@ func Test_JSONUtilsPrecompile_UnmarshalToObject(t *testing.T) { require.NoError(t, err) // out of gas error - output, _, err := contract.ExtendedRun(nil, bz, precompiles.UNMARSHAL_JSON_GAS-1, false) + output, _, err := contract.ExtendedRun(common.Address{}, bz, precompiles.UNMARSHAL_JSON_GAS-1, false) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, string(output), "out of gas") - resBz, _, err := contract.ExtendedRun(nil, bz, precompiles.UNMARSHAL_JSON_GAS+uint64(len(bz))+100, false) + resBz, _, err := contract.ExtendedRun(common.Address{}, bz, precompiles.UNMARSHAL_JSON_GAS+uint64(len(bz))+100, false) if tc.expectedErr { require.Error(t, err) return @@ -273,7 +275,7 @@ func Test_JSONUtilsPrecompile_UnmarshalToString(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { ctx, _, _ := setup() - stateDB := NewMockStateDB(ctx) + stateDB := precompiletesting.NewMockStateDB(ctx) contract, err := precompiles.NewJSONUtilsPrecompile(stateDB) require.NoError(t, err) @@ -284,12 +286,12 @@ func Test_JSONUtilsPrecompile_UnmarshalToString(t *testing.T) { require.NoError(t, err) // out of gas error - output, _, err := contract.ExtendedRun(nil, bz, precompiles.UNMARSHAL_JSON_GAS-1, false) + output, _, err := contract.ExtendedRun(common.Address{}, bz, precompiles.UNMARSHAL_JSON_GAS-1, false) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, string(output), "out of gas") // success - resBz, _, err := contract.ExtendedRun(nil, bz, precompiles.UNMARSHAL_JSON_GAS+uint64(len(bz)), false) + resBz, _, err := contract.ExtendedRun(common.Address{}, bz, precompiles.UNMARSHAL_JSON_GAS+uint64(len(bz)), false) if tc.expectedErr { require.Error(t, err) return @@ -332,7 +334,7 @@ func Test_JSONUtilsPrecompile_UnmarshalToUint(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { ctx, _, _ := setup() - stateDB := NewMockStateDB(ctx) + stateDB := precompiletesting.NewMockStateDB(ctx) contract, err := precompiles.NewJSONUtilsPrecompile(stateDB) require.NoError(t, err) @@ -343,12 +345,12 @@ func Test_JSONUtilsPrecompile_UnmarshalToUint(t *testing.T) { require.NoError(t, err) // out of gas error - output, _, err := contract.ExtendedRun(nil, bz, precompiles.UNMARSHAL_JSON_GAS-1, false) + output, _, err := contract.ExtendedRun(common.Address{}, bz, precompiles.UNMARSHAL_JSON_GAS-1, false) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, string(output), "out of gas") // success - resBz, _, err := contract.ExtendedRun(nil, bz, precompiles.UNMARSHAL_JSON_GAS+uint64(len(bz)), false) + resBz, _, err := contract.ExtendedRun(common.Address{}, bz, precompiles.UNMARSHAL_JSON_GAS+uint64(len(bz)), false) if tc.expectedErr { require.Error(t, err) return @@ -396,7 +398,7 @@ func Test_JSONUtilsPrecompile_UnmarshalToBool(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { ctx, _, _ := setup() - stateDB := NewMockStateDB(ctx) + stateDB := precompiletesting.NewMockStateDB(ctx) contract, err := precompiles.NewJSONUtilsPrecompile(stateDB) require.NoError(t, err) @@ -407,12 +409,12 @@ func Test_JSONUtilsPrecompile_UnmarshalToBool(t *testing.T) { require.NoError(t, err) // out of gas error - output, _, err := contract.ExtendedRun(nil, bz, precompiles.UNMARSHAL_JSON_GAS-1, false) + output, _, err := contract.ExtendedRun(common.Address{}, bz, precompiles.UNMARSHAL_JSON_GAS-1, false) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, string(output), "out of gas") // success - resBz, _, err := contract.ExtendedRun(nil, bz, precompiles.UNMARSHAL_JSON_GAS+uint64(len(bz)), false) + resBz, _, err := contract.ExtendedRun(common.Address{}, bz, precompiles.UNMARSHAL_JSON_GAS+uint64(len(bz)), false) if tc.expectedErr { require.Error(t, err) return @@ -470,7 +472,7 @@ func Test_JSONUtilsPrecompile_UnmarshalToArray(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { ctx, _, _ := setup() - stateDB := NewMockStateDB(ctx) + stateDB := precompiletesting.NewMockStateDB(ctx) contract, err := precompiles.NewJSONUtilsPrecompile(stateDB) require.NoError(t, err) @@ -481,12 +483,12 @@ func Test_JSONUtilsPrecompile_UnmarshalToArray(t *testing.T) { require.NoError(t, err) // out of gas error - output, _, err := contract.ExtendedRun(nil, bz, precompiles.UNMARSHAL_JSON_GAS-1, false) + output, _, err := contract.ExtendedRun(common.Address{}, bz, precompiles.UNMARSHAL_JSON_GAS-1, false) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, string(output), "out of gas") // success - resBz, _, err := contract.ExtendedRun(nil, bz, precompiles.UNMARSHAL_JSON_GAS+uint64(len(bz)), false) + resBz, _, err := contract.ExtendedRun(common.Address{}, bz, precompiles.UNMARSHAL_JSON_GAS+uint64(len(bz)), false) if tc.expectedErr { require.Error(t, err) return @@ -529,7 +531,7 @@ func Test_JSONUtilsPrecompile_UnmarshalISOToUnix(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { ctx, _, _ := setup() - stateDB := NewMockStateDB(ctx) + stateDB := precompiletesting.NewMockStateDB(ctx) contract, err := precompiles.NewJSONUtilsPrecompile(stateDB) require.NoError(t, err) @@ -540,12 +542,12 @@ func Test_JSONUtilsPrecompile_UnmarshalISOToUnix(t *testing.T) { require.NoError(t, err) // out of gas error - output, _, err := contract.ExtendedRun(nil, bz, precompiles.UNMARSHAL_JSON_GAS-1, false) + output, _, err := contract.ExtendedRun(common.Address{}, bz, precompiles.UNMARSHAL_JSON_GAS-1, false) require.ErrorIs(t, err, vm.ErrExecutionReverted) require.Contains(t, string(output), "out of gas") // success - resBz, _, err := contract.ExtendedRun(nil, bz, precompiles.UNMARSHAL_JSON_GAS+uint64(len(bz)), false) + resBz, _, err := contract.ExtendedRun(common.Address{}, bz, precompiles.UNMARSHAL_JSON_GAS+uint64(len(bz)), false) if tc.expectedErr { require.Error(t, err) return diff --git a/x/evm/precompiles/cosmos/common_test.go b/x/evm/precompiles/testing/mock.go similarity index 82% rename from x/evm/precompiles/cosmos/common_test.go rename to x/evm/precompiles/testing/mock.go index 34e10c1a..bad90f0d 100644 --- a/x/evm/precompiles/cosmos/common_test.go +++ b/x/evm/precompiles/testing/mock.go @@ -1,4 +1,4 @@ -package cosmosprecompile_test +package precompiletesting import ( "context" @@ -10,6 +10,7 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/ethereum/go-ethereum/common" + corestate "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/stateless" "github.com/ethereum/go-ethereum/core/tracing" "github.com/ethereum/go-ethereum/core/types" @@ -84,8 +85,6 @@ func (m *MockStateDB) EVM() *vm.EVM { return m.evm } -func (m *MockStateDB) SetTracer(tracer *tracing.Hooks) {} - //////////////////////// MOCKED METHODS //////////////////////// // AddAddressToAccessList implements types.StateDB. @@ -94,7 +93,7 @@ func (m *MockStateDB) AddAddressToAccessList(addr common.Address) { } // AddBalance implements types.StateDB. -func (m *MockStateDB) AddBalance(common.Address, *uint256.Int, tracing.BalanceChangeReason) { +func (m *MockStateDB) AddBalance(common.Address, *uint256.Int, tracing.BalanceChangeReason) uint256.Int { panic("unimplemented") } @@ -200,7 +199,7 @@ func (m *MockStateDB) HasSelfDestructed(common.Address) bool { // PointCache implements types.StateDB. func (m *MockStateDB) PointCache() *utils.PointCache { - panic("unimplemented") + return nil } // Prepare implements types.StateDB. @@ -209,27 +208,27 @@ func (m *MockStateDB) Prepare(rules params.Rules, sender common.Address, coinbas } // SelfDestruct implements types.StateDB. -func (m *MockStateDB) SelfDestruct(common.Address) { +func (m *MockStateDB) SelfDestruct(common.Address) uint256.Int { panic("unimplemented") } -// Selfdestruct6780 implements types.StateDB. -func (m *MockStateDB) Selfdestruct6780(common.Address) { +// SelfDestruct6780 implements types.StateDB. +func (m *MockStateDB) SelfDestruct6780(common.Address) (uint256.Int, bool) { panic("unimplemented") } // SetCode implements types.StateDB. -func (m *MockStateDB) SetCode(common.Address, []byte) { +func (m *MockStateDB) SetCode(common.Address, []byte) []byte { panic("unimplemented") } // SetNonce implements types.StateDB. -func (m *MockStateDB) SetNonce(common.Address, uint64) { +func (m *MockStateDB) SetNonce(common.Address, uint64, tracing.NonceChangeReason) { panic("unimplemented") } // SetState implements types.StateDB. -func (m *MockStateDB) SetState(common.Address, common.Hash, common.Hash) { +func (m *MockStateDB) SetState(common.Address, common.Hash, common.Hash) common.Hash { panic("unimplemented") } @@ -244,7 +243,7 @@ func (m *MockStateDB) SlotInAccessList(addr common.Address, slot common.Hash) (a } // SubBalance implements types.StateDB. -func (m *MockStateDB) SubBalance(common.Address, *uint256.Int, tracing.BalanceChangeReason) { +func (m *MockStateDB) SubBalance(common.Address, *uint256.Int, tracing.BalanceChangeReason) uint256.Int { panic("unimplemented") } @@ -258,89 +257,109 @@ func (m *MockStateDB) Witness() *stateless.Witness { panic("unimplemented") } +// AccessEvents implements types.StateDB. +func (m *MockStateDB) AccessEvents() *corestate.AccessEvents { + panic("unimplemented") +} + +func (m *MockStateDB) Finalise(_ bool) { + panic("unimplemented") +} + +func (m *MockStateDB) Commit() error { + panic("unimplemented") +} + +func (m *MockStateDB) Logs() evmtypes.Logs { + panic("unimplemented") +} + var _ evmtypes.AccountKeeper = &MockAccountKeeper{} // mock account keeper for testing type MockAccountKeeper struct { - ac address.Codec - accounts map[string]sdk.AccountI + Codec address.Codec + Accounts map[string]sdk.AccountI } // GetAccount implements types.AccountKeeper. func (k MockAccountKeeper) GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI { - str, _ := k.ac.BytesToString(addr.Bytes()) - return k.accounts[str] + str, _ := k.Codec.BytesToString(addr.Bytes()) + return k.Accounts[str] } // HasAccount implements types.AccountKeeper. func (k MockAccountKeeper) HasAccount(ctx context.Context, addr sdk.AccAddress) bool { - str, _ := k.ac.BytesToString(addr.Bytes()) - _, ok := k.accounts[str] + str, _ := k.Codec.BytesToString(addr.Bytes()) + _, ok := k.Accounts[str] return ok } // NewAccount implements types.AccountKeeper. func (k *MockAccountKeeper) NewAccount(ctx context.Context, acc sdk.AccountI) sdk.AccountI { - acc.SetAccountNumber(uint64(len(k.accounts))) + err := acc.SetAccountNumber(uint64(len(k.Accounts))) + if err != nil { + panic(err) + } return acc } // NewAccountWithAddress implements types.AccountKeeper. func (k MockAccountKeeper) NewAccountWithAddress(ctx context.Context, addr sdk.AccAddress) sdk.AccountI { - return authtypes.NewBaseAccount(addr, nil, uint64(len(k.accounts)), 0) + return authtypes.NewBaseAccount(addr, nil, uint64(len(k.Accounts)), 0) } // NextAccountNumber implements types.AccountKeeper. func (k MockAccountKeeper) NextAccountNumber(ctx context.Context) uint64 { - return uint64(len(k.accounts)) + return uint64(len(k.Accounts)) } // SetAccount implements types.AccountKeeper. func (k MockAccountKeeper) SetAccount(ctx context.Context, acc sdk.AccountI) { - str, _ := k.ac.BytesToString(acc.GetAddress().Bytes()) - k.accounts[str] = acc + str, _ := k.Codec.BytesToString(acc.GetAddress().Bytes()) + k.Accounts[str] = acc } // RemoveAccount implements types.AccountKeeper. func (k MockAccountKeeper) RemoveAccount(ctx context.Context, acc sdk.AccountI) { - str, _ := k.ac.BytesToString(acc.GetAddress().Bytes()) - delete(k.accounts, str) + str, _ := k.Codec.BytesToString(acc.GetAddress().Bytes()) + delete(k.Accounts, str) } var _ evmtypes.BankKeeper = &MockBankKeeper{} // mock bank keeper for testing type MockBankKeeper struct { - ac address.Codec - blockedAddresses map[string]bool + Codec address.Codec + BlockedAddresses map[string]bool } // BlockedAddr implements types.BankKeeper. func (k MockBankKeeper) BlockedAddr(addr sdk.AccAddress) bool { - str, _ := k.ac.BytesToString(addr.Bytes()) - return k.blockedAddresses[str] + str, _ := k.Codec.BytesToString(addr.Bytes()) + return k.BlockedAddresses[str] } var _ evmtypes.GRPCRouter = MockGRPCRouter{} type MockGRPCRouter struct { - routes map[string]baseapp.GRPCQueryHandler + Routes map[string]baseapp.GRPCQueryHandler } func (router MockGRPCRouter) Route(path string) baseapp.GRPCQueryHandler { - return router.routes[path] + return router.Routes[path] } var _ evmtypes.ERC20DenomKeeper = &MockERC20DenomKeeper{} type MockERC20DenomKeeper struct { - denomMap map[string]common.Address - addrMap map[common.Address]string + DenomMap map[string]common.Address + AddrMap map[common.Address]string } // GetContractAddrByDenom implements types.ERC20DenomKeeper. func (e *MockERC20DenomKeeper) GetContractAddrByDenom(_ context.Context, denom string) (common.Address, error) { - addr, found := e.denomMap[denom] + addr, found := e.DenomMap[denom] if !found { return common.Address{}, sdkerrors.ErrNotFound } @@ -350,7 +369,7 @@ func (e *MockERC20DenomKeeper) GetContractAddrByDenom(_ context.Context, denom s // GetDenomByContractAddr implements types.ERC20DenomKeeper. func (e *MockERC20DenomKeeper) GetDenomByContractAddr(_ context.Context, addr common.Address) (string, error) { - denom, found := e.addrMap[addr] + denom, found := e.AddrMap[addr] if !found { return "", sdkerrors.ErrNotFound } diff --git a/x/evm/state/statedb.go b/x/evm/state/statedb.go index da863492..9f8df18e 100644 --- a/x/evm/state/statedb.go +++ b/x/evm/state/statedb.go @@ -12,10 +12,13 @@ import ( corestoretypes "cosmossdk.io/core/store" "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/codec" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/stateless" "github.com/ethereum/go-ethereum/core/tracing" "github.com/ethereum/go-ethereum/core/types" @@ -28,6 +31,7 @@ import ( ) var _ vm.StateDB = &StateDB{} +var _ evmtypes.StateDB = &StateDB{} type StateDB struct { ctx Context @@ -50,7 +54,6 @@ type StateDB struct { evm *vm.EVM erc20ABI *abi.ABI feeContractAddr common.Address // feeDenom contract address - tracer *tracing.Hooks // Snapshot stack snaps []*Snapshot @@ -118,15 +121,12 @@ func NewStateDB( return s, nil } -// SetTracer sets the tracer for account update hooks. -func (s *StateDB) SetTracer(tracer *tracing.Hooks) { - s.tracer = tracer -} - -// AddBalance mint coins to the recipient -func (s *StateDB) AddBalance(addr common.Address, amount *uint256.Int, _ tracing.BalanceChangeReason) { +// AddBalance mints coins to the recipient's account by calling the ERC20 contract's sudoMint function. +// The previous balance is not returned since it's only used for tracing and is computed in statedb_hooked.go when needed. +// This function will panic if the mint operation fails. +func (s *StateDB) AddBalance(addr common.Address, amount *uint256.Int, _ tracing.BalanceChangeReason) uint256.Int { if amount.IsZero() { - return + return uint256.Int{} } inputBz, err := s.erc20ABI.Pack("sudoMint", addr, amount.ToBig()) @@ -138,17 +138,21 @@ func (s *StateDB) AddBalance(addr common.Address, amount *uint256.Int, _ tracing s.evm.IncreaseDepth() defer func() { s.evm.DecreaseDepth() }() - _, _, err = s.evm.Call(vm.AccountRef(evmtypes.StdAddress), s.feeContractAddr, inputBz, erc20OpGasLimit, uint256.NewInt(0)) + _, _, err = s.evm.Call(evmtypes.StdAddress, s.feeContractAddr, inputBz, erc20OpGasLimit, uint256.NewInt(0)) if err != nil { s.logger.Warn("failed to mint token", "error", err) panic(err) } + + return uint256.Int{} } -// SubBalance burn coins from the account with addr -func (s *StateDB) SubBalance(addr common.Address, amount *uint256.Int, _ tracing.BalanceChangeReason) { +// SubBalance burns coins from the account by calling the ERC20 contract's sudoBurn function. +// The previous balance is not returned since it's only used for tracing and is computed in statedb_hooked.go when needed. +// This function will panic if the burn operation fails. +func (s *StateDB) SubBalance(addr common.Address, amount *uint256.Int, _ tracing.BalanceChangeReason) uint256.Int { if amount.IsZero() { - return + return uint256.Int{} } inputBz, err := s.erc20ABI.Pack("sudoBurn", addr, amount.ToBig()) @@ -160,11 +164,13 @@ func (s *StateDB) SubBalance(addr common.Address, amount *uint256.Int, _ tracing s.evm.IncreaseDepth() defer func() { s.evm.DecreaseDepth() }() - _, _, err = s.evm.Call(vm.AccountRef(evmtypes.StdAddress), s.feeContractAddr, inputBz, erc20OpGasLimit, uint256.NewInt(0)) + _, _, err = s.evm.Call(evmtypes.StdAddress, s.feeContractAddr, inputBz, erc20OpGasLimit, uint256.NewInt(0)) if err != nil { s.logger.Warn("failed to burn token", "error", err) panic(err) } + + return uint256.Int{} } // GetBalance returns the erc20 balance of the account with addr @@ -178,7 +184,7 @@ func (s *StateDB) GetBalance(addr common.Address) *uint256.Int { s.evm.IncreaseDepth() defer func() { s.evm.DecreaseDepth() }() - retBz, _, err := s.evm.StaticCall(vm.AccountRef(evmtypes.NullAddress), s.feeContractAddr, inputBz, erc20OpGasLimit) + retBz, _, err := s.evm.StaticCall(evmtypes.NullAddress, s.feeContractAddr, inputBz, erc20OpGasLimit) if err != nil { s.logger.Warn("failed to check balance", "error", err) panic(err) @@ -373,18 +379,32 @@ func (s *StateDB) GetCode(addr common.Address) []byte { // SetCode store the code of the account with addr, and set the code hash to the account // It is always used in conjunction with CreateContract, so don't need to check account conversion. -func (s *StateDB) SetCode(addr common.Address, code []byte) { - ca := s.getOrNewAccount(addr) - if evmtypes.IsEmptyAccount(ca) { - an := ca.GetAccountNumber() - ca = evmtypes.NewContractAccountWithAddress(addr.Bytes()) - if err := ca.SetAccountNumber(an); err != nil { - panic(err) - } +func (s *StateDB) SetCode(addr common.Address, code []byte) []byte { + acc := s.getOrNewAccount(addr) + + // convert base account to contract account + if bacc, isBaseAccount := acc.(*authtypes.BaseAccount); isBaseAccount { + acc = evmtypes.NewContractAccountWithAddress(addr.Bytes()) + acc.(*evmtypes.ContractAccount).AccountNumber = bacc.AccountNumber + acc.(*evmtypes.ContractAccount).Sequence = bacc.Sequence + + // allow pubkey setting for contract accounts specifically for set code authorization. + acc.(*evmtypes.ContractAccount).PubKey = bacc.PubKey } + // cast to contract account + ca := acc.(*evmtypes.ContractAccount) + + // get the previous code hash and code + prevCodeHash := ca.CodeHash + var prevCode []byte + if len(prevCodeHash) != 0 { + prevCode = s.GetCode(addr) + } + + // set the code hash and code codeHash := crypto.Keccak256Hash(code).Bytes() - ca.(*evmtypes.ContractAccount).CodeHash = codeHash + ca.CodeHash = codeHash s.accountKeeper.SetAccount(s.ctx, ca) // set the code in the store @@ -396,6 +416,8 @@ func (s *StateDB) SetCode(addr common.Address, code []byte) { if err := s.vmStore.Set(s.ctx, codeSizeKey(addr, codeHash), uint64ToBytes(uint64(len(code)))); err != nil { panic(err) } + + return prevCode } // GetCodeHash returns the code hash of the account with addr @@ -457,7 +479,7 @@ func (s *StateDB) GetNonce(addr common.Address) uint64 { } // SetNonce sets the nonce of the account with addr -func (s *StateDB) SetNonce(addr common.Address, nonce uint64) { +func (s *StateDB) SetNonce(addr common.Address, nonce uint64, _ tracing.NonceChangeReason) { acc := s.getOrNewAccount(addr) if err := acc.SetSequence(nonce); err != nil { panic(err) @@ -465,6 +487,20 @@ func (s *StateDB) SetNonce(addr common.Address, nonce uint64) { s.accountKeeper.SetAccount(s.ctx, acc) } +// SetNonceAndPubKey sets the nonce and pubkey of the account with addr +func (s *StateDB) SetNonceAndPubKey(addr common.Address, nonce uint64, pubKey cryptotypes.PubKey, _ tracing.NonceChangeReason) { + acc := s.getOrNewAccount(addr) + if err := acc.SetSequence(nonce); err != nil { + panic(err) + } + if acc.GetPubKey() == nil { + if err := acc.SetPubKey(pubKey); err != nil { + panic(err) + } + } + s.accountKeeper.SetAccount(s.ctx, acc) +} + // GetRefund returns the refund func (s *StateDB) GetRefund() uint64 { refund, err := s.memStoreRefund.Get(s.ctx) @@ -512,10 +548,10 @@ func (s *StateDB) HasSelfDestructed(addr common.Address) bool { // // The account's state object is still available until the state is committed, // getStateObject will return a non-nil account after SelfDestruct. -func (s *StateDB) SelfDestruct(addr common.Address) { +func (s *StateDB) SelfDestruct(addr common.Address) uint256.Int { acc := s.getAccount(addr) if acc == nil { - return + return uint256.Int{} } // mark the account as self-destructed @@ -524,29 +560,38 @@ func (s *StateDB) SelfDestruct(addr common.Address) { } // clear the balance of the account - s.SubBalance(addr, s.GetBalance(addr), tracing.BalanceDecreaseSelfdestructBurn) + prevBalance := s.GetBalance(addr) + s.SubBalance(addr, prevBalance, tracing.BalanceDecreaseSelfdestructBurn) + return *prevBalance } // Selfdestruct6780 calls selfdestruct and clears the account balance if the account is created in the same transaction. -func (s *StateDB) Selfdestruct6780(addr common.Address) { +func (s *StateDB) SelfDestruct6780(addr common.Address) (uint256.Int, bool) { acc := s.getAccount(addr) if acc == nil { - return + return uint256.Int{}, false } ok, err := s.memStoreCreated.Has(s.ctx, addr.Bytes()) if err != nil { - panic(err) + if errors.Is(err, collections.ErrNotFound) { + return uint256.Int{}, false + } else { + panic(err) + } } else if ok { - s.SelfDestruct(addr) + return s.SelfDestruct(addr), true } + return *(s.GetBalance(addr)), false } // SetState implements vm.StateDB. -func (s *StateDB) SetState(addr common.Address, slot common.Hash, value common.Hash) { +func (s *StateDB) SetState(addr common.Address, slot common.Hash, value common.Hash) common.Hash { + prev := s.GetState(addr, slot) if err := s.vmStore.Set(s.ctx, stateKey(addr, slot), value[:]); err != nil { panic(err) } + return prev } // SetTransientState sets memStore storage for a given account. @@ -659,11 +704,6 @@ func (s *StateDB) Commit() error { // If ether was sent to account post-selfdestruct it is burnt. if bal := s.GetBalance(addr); bal.Sign() != 0 { s.SubBalance(addr, bal, tracing.BalanceDecreaseSelfdestructBurn) - - // emit log event to tracer - if s.tracer != nil && s.tracer.OnBalanceChange != nil { - s.tracer.OnBalanceChange(addr, bal.ToBig(), new(big.Int), tracing.BalanceDecreaseSelfdestructBurn) - } } err = s.vmStore.Clear(s.ctx, new(collections.Range[[]byte]).Prefix(addr.Bytes())) @@ -703,11 +743,6 @@ func (s *StateDB) AddLog(log *types.Log) { if err != nil { panic(err) } - - // emit log event to tracer - if s.tracer != nil && s.tracer.OnLog != nil { - s.tracer.OnLog(log) - } } func (s *StateDB) Logs() evmtypes.Logs { @@ -757,6 +792,7 @@ func (s *StateDB) GetStorageRoot(addr common.Address) common.Hash { return common.Hash{} } +// NO IMPLEMENTATION // unused in the current implementation func (s *StateDB) PointCache() *utils.PointCache { return nil @@ -771,3 +807,13 @@ func (s *StateDB) Witness() *stateless.Witness { func (s *StateDB) AddPreimage(common.Hash, []byte) { // no-op } + +// unused in the current implementation +func (s *StateDB) AccessEvents() *state.AccessEvents { + return nil +} + +// Finalise is called at the end of transaction processing to finalize any state changes. +// In minievm, this is a no-op since all state changes are handled in the Commit method. +// This matches the interface required by the EVM but does not need an implementation. +func (s *StateDB) Finalise(bool) {} diff --git a/x/evm/state/statedb_hooked.go b/x/evm/state/statedb_hooked.go new file mode 100644 index 00000000..0ad47ffc --- /dev/null +++ b/x/evm/state/statedb_hooked.go @@ -0,0 +1,159 @@ +package state + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/tracing" + evmtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/holiman/uint256" + "github.com/initia-labs/minievm/x/evm/types" +) + +var _ types.StateDB = &HookedStateDB{} + +// HookedStateDB represents a statedb which emits calls to tracing-hooks +// on state operations. +type HookedStateDB struct { + *StateDB + hooks *tracing.Hooks +} + +// NewHookedState wraps the given stateDb with the given hooks +func NewHookedState(stateDb *StateDB, hooks *tracing.Hooks) *HookedStateDB { + s := &HookedStateDB{stateDb, hooks} + return s +} + +// override to emit balance change events +func (s *HookedStateDB) SubBalance(addr common.Address, amount *uint256.Int, reason tracing.BalanceChangeReason) uint256.Int { + s.StateDB.SubBalance(addr, amount, reason) + if s.hooks != nil && s.hooks.OnBalanceChange != nil && !amount.IsZero() { + prev := s.StateDB.GetBalance(addr) + newBalance := new(uint256.Int).Sub(prev, amount) + s.hooks.OnBalanceChange(addr, prev.ToBig(), newBalance.ToBig(), reason) + } + return uint256.Int{} +} + +// override to emit balance change events +func (s *HookedStateDB) AddBalance(addr common.Address, amount *uint256.Int, reason tracing.BalanceChangeReason) uint256.Int { + s.StateDB.AddBalance(addr, amount, reason) + if s.hooks != nil && s.hooks.OnBalanceChange != nil && !amount.IsZero() { + prev := s.StateDB.GetBalance(addr) + newBalance := new(uint256.Int).Add(prev, amount) + s.hooks.OnBalanceChange(addr, prev.ToBig(), newBalance.ToBig(), reason) + } + return uint256.Int{} +} + +// override to emit nonce change events +func (s *HookedStateDB) SetNonce(address common.Address, nonce uint64, reason tracing.NonceChangeReason) { + prev := s.StateDB.GetNonce(address) + s.StateDB.SetNonce(address, nonce, reason) + if s.hooks != nil && s.hooks.OnNonceChangeV2 != nil { + s.hooks.OnNonceChangeV2(address, prev, nonce, reason) + } else if s.hooks != nil && s.hooks.OnNonceChange != nil { + s.hooks.OnNonceChange(address, prev, nonce) + } +} + +// override to emit code change events +func (s *HookedStateDB) SetCode(address common.Address, code []byte) []byte { + prev := s.StateDB.SetCode(address, code) + if s.hooks != nil && s.hooks.OnCodeChange != nil { + prevHash := evmtypes.EmptyCodeHash + if len(prev) != 0 { + prevHash = crypto.Keccak256Hash(prev) + } + s.hooks.OnCodeChange(address, prevHash, prev, crypto.Keccak256Hash(code), code) + } + return prev +} + +// override to emit storage change events +func (s *HookedStateDB) SetState(address common.Address, key common.Hash, value common.Hash) common.Hash { + prev := s.StateDB.SetState(address, key, value) + if s.hooks != nil && s.hooks.OnStorageChange != nil && prev != value { + s.hooks.OnStorageChange(address, key, prev, value) + } + return prev +} + +// override to emit balance change events +func (s *HookedStateDB) SelfDestruct(address common.Address) uint256.Int { + var prevCode []byte + var prevCodeHash common.Hash + + if s.hooks != nil && s.hooks.OnCodeChange != nil { + prevCode = s.StateDB.GetCode(address) + prevCodeHash = s.StateDB.GetCodeHash(address) + } + + prev := s.StateDB.SelfDestruct(address) + + if s.hooks != nil && s.hooks.OnBalanceChange != nil && !prev.IsZero() { + s.hooks.OnBalanceChange(address, prev.ToBig(), new(big.Int), tracing.BalanceDecreaseSelfdestruct) + } + + if s.hooks != nil && s.hooks.OnCodeChange != nil && len(prevCode) > 0 { + s.hooks.OnCodeChange(address, prevCodeHash, prevCode, evmtypes.EmptyCodeHash, nil) + } + + return prev +} + +// override to emit balance change events +func (s *HookedStateDB) SelfDestruct6780(address common.Address) (uint256.Int, bool) { + var prevCode []byte + var prevCodeHash common.Hash + + if s.hooks != nil && s.hooks.OnCodeChange != nil { + prevCodeHash = s.StateDB.GetCodeHash(address) + prevCode = s.StateDB.GetCode(address) + } + + prev, changed := s.StateDB.SelfDestruct6780(address) + + if s.hooks != nil && s.hooks.OnBalanceChange != nil && changed && !prev.IsZero() { + s.hooks.OnBalanceChange(address, prev.ToBig(), new(big.Int), tracing.BalanceDecreaseSelfdestruct) + } + + if s.hooks != nil && s.hooks.OnCodeChange != nil && changed && len(prevCode) > 0 { + s.hooks.OnCodeChange(address, prevCodeHash, prevCode, evmtypes.EmptyCodeHash, nil) + } + + return prev, changed +} + +// override to emit log events +func (s *HookedStateDB) AddLog(log *evmtypes.Log) { + // The StateDB will modify the log (add fields), so invoke that first + s.StateDB.AddLog(log) + if s.hooks != nil && s.hooks.OnLog != nil { + s.hooks.OnLog(log) + } +} + +// override to emit balance change events +func (s *HookedStateDB) Commit() (err error) { + defer func() { + err = s.StateDB.Commit() + }() + + if s.hooks != nil && s.hooks.OnBalanceChange != nil { + return s.memStoreSelfDestruct.Walk(s.ctx, nil, func(key []byte) (stop bool, err error) { + addr := common.BytesToAddress(key) + + // If ether was sent to account post-selfdestruct it is burnt. + if bal := s.GetBalance(addr); bal.Sign() != 0 { + s.hooks.OnBalanceChange(addr, bal.ToBig(), new(big.Int), tracing.BalanceDecreaseSelfdestructBurn) + } + + return false, err + }) + } + + return nil +} diff --git a/x/evm/state/statedb_test.go b/x/evm/state/statedb_test.go index 6503c93d..5f993297 100644 --- a/x/evm/state/statedb_test.go +++ b/x/evm/state/statedb_test.go @@ -193,12 +193,12 @@ func Test_SelfDestruct(t *testing.T) { require.NoError(t, err) // call with value - res, logs, err := input.EVMKeeper.EVMCall(sdkCtx, caller, contractAddr, inputBz, uint256.NewInt(100), nil) + res, logs, err := input.EVMKeeper.EVMCall(sdkCtx, caller, contractAddr, inputBz, uint256.NewInt(100), nil, nil) require.NoError(t, err) require.Empty(t, res) require.NotEmpty(t, logs) - res, logs, err = input.EVMKeeper.EVMCall(sdkCtx, caller, contractAddr2, inputBz, uint256.NewInt(100), nil) + res, logs, err = input.EVMKeeper.EVMCall(sdkCtx, caller, contractAddr2, inputBz, uint256.NewInt(100), nil, nil) require.NoError(t, err) require.Empty(t, res) require.NotEmpty(t, logs) @@ -255,7 +255,7 @@ func Test_Selfdestruct6780_InDifferentTx(t *testing.T) { require.NoError(t, err) // call with value - res, logs, err := input.EVMKeeper.EVMCall(sdkCtx, caller, contractAddr, inputBz, uint256.NewInt(100), nil) + res, logs, err := input.EVMKeeper.EVMCall(sdkCtx, caller, contractAddr, inputBz, uint256.NewInt(100), nil, nil) require.NoError(t, err) require.Empty(t, res) require.NotEmpty(t, logs) @@ -270,7 +270,7 @@ func Test_Selfdestruct6780_InDifferentTx(t *testing.T) { // self destruct require.False(t, stateDB.HasSelfDestructed(contractAddr)) - stateDB.Selfdestruct6780(contractAddr) + stateDB.SelfDestruct6780(contractAddr) require.False(t, stateDB.HasSelfDestructed(contractAddr)) // check balance @@ -303,7 +303,7 @@ func Test_Selfdestruct6780_InSameTx(t *testing.T) { counterBz, err := hexutil.Decode(counter.CounterBin) require.NoError(t, err) - _, contractAddr, _, err := evm.Create(vm.AccountRef(caller), counterBz, 1_000_000, uint256.NewInt(0)) + _, contractAddr, _, err := evm.Create(caller, counterBz, 1_000_000, uint256.NewInt(0)) require.NoError(t, err) // increase counter @@ -314,7 +314,7 @@ func Test_Selfdestruct6780_InSameTx(t *testing.T) { require.NoError(t, err) // call with value - res, logs, err := evm.Call(vm.AccountRef(caller), contractAddr, inputBz, 1_000_000, uint256.NewInt(100)) + res, logs, err := evm.Call(caller, contractAddr, inputBz, 1_000_000, uint256.NewInt(100)) require.NoError(t, err) require.Empty(t, res) require.NotEmpty(t, logs) @@ -324,7 +324,7 @@ func Test_Selfdestruct6780_InSameTx(t *testing.T) { // self destruct require.False(t, stateDB.HasSelfDestructed(contractAddr)) - stateDB.Selfdestruct6780(contractAddr) + stateDB.SelfDestruct6780(contractAddr) require.True(t, stateDB.HasSelfDestructed(contractAddr)) // check balance @@ -355,10 +355,10 @@ func Test_Empty(t *testing.T) { require.True(t, stateDB.Empty(common.BytesToAddress(addr.Bytes()))) - stateDB.SetNonce(common.BytesToAddress(addr.Bytes()), 1) + stateDB.SetNonce(common.BytesToAddress(addr.Bytes()), 1, tracing.NonceChangeReason(0)) require.False(t, stateDB.Empty(common.BytesToAddress(addr.Bytes()))) - stateDB.SetNonce(common.BytesToAddress(addr.Bytes()), 0) + stateDB.SetNonce(common.BytesToAddress(addr.Bytes()), 0, tracing.NonceChangeReason(0)) require.True(t, stateDB.Empty(common.BytesToAddress(addr.Bytes()))) stateDB.SetCode(common.BytesToAddress(addr.Bytes()), []byte{1, 2, 3}) diff --git a/x/evm/types/dispatch.go b/x/evm/types/dispatch.go index e9b6ded3..4028c7b5 100644 --- a/x/evm/types/dispatch.go +++ b/x/evm/types/dispatch.go @@ -3,13 +3,12 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/gogoproto/proto" - - "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/common" ) type ExecuteRequest struct { Msg sdk.Msg - Caller vm.ContractRef + Caller common.Address // options AllowFailure bool diff --git a/x/evm/types/expected_keeper.go b/x/evm/types/expected_keeper.go index cbd2f673..f56be963 100644 --- a/x/evm/types/expected_keeper.go +++ b/x/evm/types/expected_keeper.go @@ -11,7 +11,6 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/tracing" coretypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" ) @@ -93,7 +92,9 @@ type StateDB interface { vm.StateDB Context() sdk.Context EVM() *vm.EVM - SetTracer(tracer *tracing.Hooks) + + Commit() error + Logs() Logs } type GRPCRouter interface { diff --git a/x/evm/types/query.pb.go b/x/evm/types/query.pb.go index bf4fcad9..fa9cdc92 100644 --- a/x/evm/types/query.pb.go +++ b/x/evm/types/query.pb.go @@ -601,6 +601,8 @@ type QueryCallRequest struct { // whether to trace the call // `nil` means no trace TraceOptions *TraceOptions `protobuf:"bytes,6,opt,name=trace_options,json=traceOptions,proto3" json:"trace_options,omitempty"` + // AuthList is a list of authorizations that allow code deployment at specific addresses. + AuthList []SetCodeAuthorization `protobuf:"bytes,7,rep,name=auth_list,json=authList,proto3" json:"auth_list"` } func (m *QueryCallRequest) Reset() { *m = QueryCallRequest{} } @@ -1154,100 +1156,102 @@ func init() { func init() { proto.RegisterFile("minievm/evm/v1/query.proto", fileDescriptor_2bf9e0bee7cfd1a4) } var fileDescriptor_2bf9e0bee7cfd1a4 = []byte{ - // 1476 bytes of a gzipped FileDescriptorProto + // 1512 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x58, 0xcf, 0x6f, 0x13, 0xc7, - 0x17, 0xcf, 0x26, 0x76, 0x48, 0x9e, 0x03, 0x84, 0x21, 0xdf, 0xc8, 0x6c, 0xc0, 0x0e, 0xcb, 0x17, - 0x12, 0x5c, 0xe2, 0x4d, 0x0c, 0x92, 0x53, 0xfa, 0x4b, 0x38, 0xfc, 0x50, 0x5a, 0x5a, 0xe8, 0x82, - 0x54, 0xa9, 0xaa, 0x6a, 0x4d, 0x76, 0x07, 0xb3, 0x8a, 0xbd, 0x63, 0x76, 0xc6, 0xa1, 0x2e, 0xa2, - 0x87, 0xaa, 0x87, 0x9e, 0xaa, 0x4a, 0xed, 0xa1, 0x12, 0x17, 0x0e, 0x55, 0x45, 0xd5, 0x0b, 0xb7, - 0xde, 0x7b, 0xa2, 0x37, 0xa4, 0x5e, 0xaa, 0x1e, 0x50, 0x1b, 0x2a, 0xb5, 0x7f, 0x46, 0x35, 0xb3, - 0xb3, 0xce, 0x7a, 0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x60, 0x61, 0x40, 0x91, 0x42, 0xe5, 0x7e, 0x7b, 0x36, 0xa4, 0x4c, 0xea, - 0xeb, 0xfb, 0x0f, 0x54, 0xf4, 0xcb, 0x92, 0xfe, 0x1a, 0x32, 0xe3, 0xf4, 0x89, 0x6f, 0x97, 0x4b, - 0x6b, 0x66, 0xf8, 0x00, 0xf6, 0x5c, 0xdc, 0x5f, 0x34, 0x98, 0x4f, 0xae, 0x65, 0xa8, 0x34, 0x80, - 0x4d, 0x9f, 0xb2, 0xaa, 0x9f, 0xdf, 0x57, 0x8c, 0x22, 0xff, 0x96, 0x24, 0xff, 0x2a, 0x2a, 0xf7, - 0x21, 0x4f, 0x65, 0x60, 0x35, 0x52, 0x50, 0xcd, 0x07, 0xe1, 0x82, 0xde, 0x28, 0x14, 0x1e, 0xa2, - 0x47, 0x1a, 0xcc, 0xc6, 0xcb, 0x15, 0x3a, 0x37, 0x54, 0xcc, 0x28, 0xf1, 0x95, 0x11, 0xbd, 0x87, - 0x1d, 0x97, 0x6e, 0xbd, 0x25, 0x91, 0x1f, 0x34, 0x38, 0x1c, 0x4b, 0x84, 0x5e, 0x19, 0x05, 0x2e, - 0xe4, 0x76, 0x6e, 0x34, 0x67, 0x45, 0x6d, 0x5d, 0x52, 0x2b, 0xa1, 0xd5, 0xe1, 0xd4, 0x62, 0x32, - 0x7e, 0x06, 0xe9, 0xe0, 0xbe, 0x25, 0xbf, 0xe1, 0x5d, 0x37, 0xcc, 0x18, 0xe4, 0xa2, 0x98, 0x14, - 0x25, 0x93, 0x65, 0x74, 0x26, 0xce, 0x44, 0x5e, 0xa3, 0xde, 0x22, 0x52, 0x87, 0x94, 0x68, 0x82, - 0xfb, 0x15, 0xb0, 0xbd, 0xff, 0xeb, 0xf4, 0x2b, 0x60, 0x91, 0x0e, 0xda, 0xc8, 0x4b, 0xf0, 0x63, - 0x17, 0xb5, 0x82, 0x31, 0xd7, 0x73, 0xa7, 0x05, 0xca, 0x3d, 0x98, 0x0c, 0x0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0xa3, 0x4c, 0x64, 0x19, 0x75, 0x37, 0x91, + 0x1a, 0x24, 0xc4, 0x10, 0xdc, 0xab, 0x81, 0xed, 0xff, 0xa7, 0xa9, 0x57, 0x03, 0x0b, 0x4d, 0xd0, + 0x7a, 0x5e, 0x82, 0x9f, 0xb8, 0xa2, 0x15, 0xf4, 0xe9, 0xae, 0x9a, 0x16, 0x28, 0xf7, 0x60, 0xdc, + 0x6f, 0xa8, 0x28, 0xfe, 0x2c, 0x1d, 0x3d, 0x3b, 0x7b, 0xa6, 0xaf, 0x8e, 0xc2, 0xcc, 0x49, 0xcc, + 0x0c, 0x9a, 0x89, 0x02, 0xfa, 0xbd, 0xba, 0x7c, 0xe3, 0xf9, 0x9f, 0xb9, 0x91, 0xa7, 0x7b, 0xb9, + 0x91, 0xe7, 0x7b, 0x39, 0xed, 0xc5, 0x5e, 0x4e, 0xfb, 0x63, 0x2f, 0xa7, 0x7d, 0xfd, 0x2a, 0x37, + 0xf2, 0xe2, 0x55, 0x6e, 0xe4, 0xb7, 0x57, 0xb9, 0x91, 0x8f, 0x0a, 0x55, 0x87, 0x6f, 0x37, 0xb7, + 0x8a, 0x16, 0xad, 0x1b, 0x8e, 0xeb, 0x70, 0x07, 0x2f, 0xd6, 0xf0, 0x16, 0x6b, 0xfb, 0xfb, 0x54, + 0x7a, 0x94, 0x3f, 0x98, 0x6c, 0x8d, 0xcb, 0x5f, 0x4c, 0x2e, 0xfd, 0x17, 0x00, 0x00, 0xff, 0xff, + 0xc1, 0x44, 0x99, 0xda, 0xee, 0x11, 0x00, 0x00, } func (this *QueryCodeResponse) Equal(that interface{}) bool { @@ -2381,6 +2385,20 @@ func (m *QueryCallRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.AuthList) > 0 { + for iNdEx := len(m.AuthList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AuthList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + } if m.TraceOptions != nil { { size, err := m.TraceOptions.MarshalToSizedBuffer(dAtA[:i]) @@ -3123,6 +3141,12 @@ func (m *QueryCallRequest) Size() (n int) { l = m.TraceOptions.Size() n += 1 + l + sovQuery(uint64(l)) } + if len(m.AuthList) > 0 { + for _, e := range m.AuthList { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } return n } @@ -4634,6 +4658,40 @@ func (m *QueryCallRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AuthList = append(m.AuthList, SetCodeAuthorization{}) + if err := m.AuthList[len(m.AuthList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/evm/types/setcode_test.go b/x/evm/types/setcode_test.go new file mode 100644 index 00000000..a3b7f9e9 --- /dev/null +++ b/x/evm/types/setcode_test.go @@ -0,0 +1,408 @@ +package types + +import ( + "math/big" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" + coretypes "github.com/ethereum/go-ethereum/core/types" + "github.com/holiman/uint256" + "github.com/stretchr/testify/require" +) + +func TestConvertEthSetCodeAuthorizationsToCosmos(t *testing.T) { + tests := []struct { + name string + input []coretypes.SetCodeAuthorization + expected []SetCodeAuthorization + }{ + { + name: "empty list", + input: []coretypes.SetCodeAuthorization{}, + expected: nil, + }, + { + name: "single authorization", + input: []coretypes.SetCodeAuthorization{ + { + ChainID: *uint256.NewInt(1), + Address: common.HexToAddress("0x1234567890123456789012345678901234567890"), + Nonce: 42, + V: 27, + R: *uint256.MustFromBig(big.NewInt(12345)), + S: *uint256.MustFromBig(big.NewInt(67890)), + }, + }, + expected: []SetCodeAuthorization{ + { + ChainId: "1", + Address: "0x1234567890123456789012345678901234567890", + Nonce: 42, + Signature: createSignatureBytes(uint256.MustFromBig(big.NewInt(12345)), uint256.MustFromBig(big.NewInt(67890)), 27), + }, + }, + }, + { + name: "multiple authorizations", + input: []coretypes.SetCodeAuthorization{ + { + ChainID: *uint256.NewInt(1), + Address: common.HexToAddress("0x1111111111111111111111111111111111111111"), + Nonce: 1, + V: 27, + R: *uint256.MustFromBig(big.NewInt(111)), + S: *uint256.MustFromBig(big.NewInt(222)), + }, + { + ChainID: *uint256.NewInt(1), + Address: common.HexToAddress("0x2222222222222222222222222222222222222222"), + Nonce: 2, + V: 28, + R: *uint256.MustFromBig(big.NewInt(333)), + S: *uint256.MustFromBig(big.NewInt(444)), + }, + }, + expected: []SetCodeAuthorization{ + { + ChainId: "1", + Address: "0x1111111111111111111111111111111111111111", + Nonce: 1, + Signature: createSignatureBytes(uint256.MustFromBig(big.NewInt(111)), uint256.MustFromBig(big.NewInt(222)), 27), + }, + { + ChainId: "1", + Address: "0x2222222222222222222222222222222222222222", + Nonce: 2, + Signature: createSignatureBytes(uint256.MustFromBig(big.NewInt(333)), uint256.MustFromBig(big.NewInt(444)), 28), + }, + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result := ConvertEthSetCodeAuthorizationsToCosmos(tt.input) + require.Equal(t, tt.expected, result) + }) + } +} + +func TestConvertCosmosSetCodeAuthorizationsToEth(t *testing.T) { + tests := []struct { + name string + input []SetCodeAuthorization + expected []coretypes.SetCodeAuthorization + expectError bool + }{ + { + name: "empty list", + input: []SetCodeAuthorization{}, + expected: nil, + expectError: false, + }, + { + name: "single authorization", + input: []SetCodeAuthorization{ + { + ChainId: "1", + Address: "0x1234567890123456789012345678901234567890", + Nonce: 42, + Signature: createSignatureBytes(uint256.MustFromBig(big.NewInt(12345)), uint256.MustFromBig(big.NewInt(67890)), 27), + }, + }, + expected: []coretypes.SetCodeAuthorization{ + { + ChainID: *uint256.NewInt(1), + Address: common.HexToAddress("0x1234567890123456789012345678901234567890"), + Nonce: 42, + V: 27, + R: *uint256.MustFromBig(big.NewInt(12345)), + S: *uint256.MustFromBig(big.NewInt(67890)), + }, + }, + expectError: false, + }, + { + name: "invalid signature length", + input: []SetCodeAuthorization{ + { + ChainId: "1", + Address: "0x1234567890123456789012345678901234567890", + Nonce: 42, + Signature: []byte{1, 2, 3}, // Invalid length + }, + }, + expected: nil, + expectError: true, + }, + { + name: "invalid address format", + input: []SetCodeAuthorization{ + { + ChainId: "1", + Address: "invalid_address", + Nonce: 42, + Signature: make([]byte, 65), // Valid length but invalid content + }, + }, + expected: nil, + expectError: true, + }, + { + name: "invalid chain ID", + input: []SetCodeAuthorization{ + { + ChainId: "invalid_chain_id", + Address: "0x1234567890123456789012345678901234567890", + Nonce: 42, + Signature: make([]byte, 65), + }, + }, + expected: nil, + expectError: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result, err := ConvertCosmosSetCodeAuthorizationsToEth(tt.input) + if tt.expectError { + require.Error(t, err) + } else { + require.NoError(t, err) + require.Equal(t, tt.expected, result) + } + }) + } +} + +func TestSetCodeAuthorizationRoundTrip(t *testing.T) { + // Test that converting from Ethereum to Cosmos and back preserves the data + original := []coretypes.SetCodeAuthorization{ + { + ChainID: *uint256.NewInt(1), + Address: common.HexToAddress("0x1234567890123456789012345678901234567890"), + Nonce: 42, + V: 27, + R: *uint256.MustFromBig(big.NewInt(12345)), + S: *uint256.MustFromBig(big.NewInt(67890)), + }, + { + ChainID: *uint256.NewInt(1337), + Address: common.HexToAddress("0xabcdefabcdefabcdefabcdefabcdefabcdefabcd"), + Nonce: 100, + V: 28, + R: *uint256.MustFromBig(big.NewInt(999999)), + S: *uint256.MustFromBig(big.NewInt(888888)), + }, + } + + // Convert to Cosmos format + cosmosAuths := ConvertEthSetCodeAuthorizationsToCosmos(original) + require.Len(t, cosmosAuths, 2) + + // Convert back to Ethereum format + ethAuths, err := ConvertCosmosSetCodeAuthorizationsToEth(cosmosAuths) + require.NoError(t, err) + require.Len(t, ethAuths, 2) + + // Verify the data matches + for i, originalAuth := range original { + convertedAuth := ethAuths[i] + require.Equal(t, originalAuth.ChainID, convertedAuth.ChainID) + require.Equal(t, originalAuth.Address, convertedAuth.Address) + require.Equal(t, originalAuth.Nonce, convertedAuth.Nonce) + require.Equal(t, originalAuth.V, convertedAuth.V) + require.Equal(t, originalAuth.R, convertedAuth.R) + require.Equal(t, originalAuth.S, convertedAuth.S) + } +} + +func TestValidateAuthorization(t *testing.T) { + // Create valid signature values + validR, _ := new(big.Int).SetString("1234567890123456789012345678901234567890123456789012345678901", 10) + validS, _ := new(big.Int).SetString("1234567890123456789012345678901234567890123456789012345678901", 10) + + tests := []struct { + name string + auth coretypes.SetCodeAuthorization + chainID string + expectError bool + errorType error + }{ + { + name: "valid authorization with matching chain ID", + auth: coretypes.SetCodeAuthorization{ + ChainID: *uint256.MustFromBig(ConvertCosmosChainIDToEthereumChainID("minievm-1")), + Address: common.HexToAddress("0x1234567890123456789012345678901234567890"), + Nonce: 42, + V: 1, // Valid v value (0 or 1) + R: *uint256.MustFromBig(validR), + S: *uint256.MustFromBig(validS), + }, + chainID: "minievm-1", + expectError: false, + }, + { + name: "authorization with matching chain ID (signature validation will fail)", + auth: coretypes.SetCodeAuthorization{ + ChainID: *uint256.MustFromBig(ConvertCosmosChainIDToEthereumChainID("minievm-1")), + Address: common.HexToAddress("0x1234567890123456789012345678901234567890"), + Nonce: 42, + V: 27, + R: *uint256.MustFromBig(big.NewInt(12345)), + S: *uint256.MustFromBig(big.NewInt(67890)), + }, + chainID: "minievm-1", + expectError: true, // Signature validation will fail + }, + { + name: "authorization with zero chain ID (signature validation will fail)", + auth: coretypes.SetCodeAuthorization{ + ChainID: *uint256.NewInt(0), + Address: common.HexToAddress("0x1234567890123456789012345678901234567890"), + Nonce: 42, + V: 27, + R: *uint256.MustFromBig(big.NewInt(12345)), + S: *uint256.MustFromBig(big.NewInt(67890)), + }, + chainID: "minievm-1", + expectError: true, // Signature validation will fail + }, + { + name: "invalid authorization with wrong chain ID", + auth: coretypes.SetCodeAuthorization{ + ChainID: *uint256.MustFromBig(ConvertCosmosChainIDToEthereumChainID("minievm-999")), + Address: common.HexToAddress("0x1234567890123456789012345678901234567890"), + Nonce: 42, + V: 27, + R: *uint256.MustFromBig(big.NewInt(12345)), + S: *uint256.MustFromBig(big.NewInt(67890)), + }, + chainID: "minievm-1", + expectError: true, + errorType: core.ErrAuthorizationWrongChainID, + }, + { + name: "invalid authorization with nonce overflow", + auth: coretypes.SetCodeAuthorization{ + ChainID: *uint256.NewInt(0), // Use zero chain ID to avoid chain ID validation error + Address: common.HexToAddress("0x1234567890123456789012345678901234567890"), + Nonce: ^uint64(0), // Max uint64 + V: 27, + R: *uint256.MustFromBig(big.NewInt(12345)), + S: *uint256.MustFromBig(big.NewInt(67890)), + }, + chainID: "minievm-1", + expectError: true, + errorType: core.ErrAuthorizationNonceOverflow, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + // Create a mock context with the chain ID + ctx := createMockContext(tt.chainID) + + err := ValidateAuthorization(ctx, tt.auth) + if tt.expectError { + require.Error(t, err) + if tt.errorType != nil { + require.ErrorIs(t, err, tt.errorType) + } + } else { + require.NoError(t, err) + } + }) + } +} + +func TestSetCodeAuthorizationSignatureHandling(t *testing.T) { + t.Run("signature byte manipulation", func(t *testing.T) { + r := uint256.MustFromBig(big.NewInt(12345)) + s := uint256.MustFromBig(big.NewInt(67890)) + v := uint8(27) + + // Create signature bytes + sigBytes := createSignatureBytes(r, s, v) + require.Len(t, sigBytes, 65) + + // Verify we can extract the components back + extractedR := sigBytes[:32] + extractedS := sigBytes[32:64] + extractedV := sigBytes[64] + + rBytes := r.Bytes32() + sBytes := s.Bytes32() + require.Equal(t, rBytes[:], extractedR) + require.Equal(t, sBytes[:], extractedS) + require.Equal(t, v, extractedV) + }) + + t.Run("edge case signature values", func(t *testing.T) { + // Test with zero values + r := uint256.NewInt(0) + s := uint256.NewInt(0) + v := uint8(0) + + sigBytes := createSignatureBytes(r, s, v) + require.Len(t, sigBytes, 65) + + // Test with maximum values + r = uint256.MustFromBig(new(big.Int).Sub(new(big.Int).Lsh(big.NewInt(1), 256), big.NewInt(1))) // Max uint256 + s = uint256.MustFromBig(new(big.Int).Sub(new(big.Int).Lsh(big.NewInt(1), 256), big.NewInt(1))) // Max uint256 + v = uint8(255) + + sigBytes = createSignatureBytes(r, s, v) + require.Len(t, sigBytes, 65) + }) +} + +func TestSetCodeAuthorizationWithDifferentChainIDs(t *testing.T) { + chainIDs := []string{ + "minievm-1", + "minievm-1337", + "minievm-999999", + } + + for _, chainID := range chainIDs { + t.Run("chain_id_"+chainID, func(t *testing.T) { + ctx := createMockContext(chainID) + + auth := coretypes.SetCodeAuthorization{ + ChainID: *uint256.NewInt(0), // Zero chain ID should be valid for any chain + Address: common.HexToAddress("0x1234567890123456789012345678901234567890"), + Nonce: 42, + V: 27, + R: *uint256.MustFromBig(big.NewInt(12345)), + S: *uint256.MustFromBig(big.NewInt(67890)), + } + + err := ValidateAuthorization(ctx, auth) + // The signature validation will fail because we're using invalid signature values + // This is expected behavior - the test validates that signature validation is working + require.Error(t, err) + require.Contains(t, err.Error(), "invalid transaction v, r, s values") + }) + } +} + +// Helper function to create signature bytes from r, s, v components +func createSignatureBytes(r, s *uint256.Int, v uint8) []byte { + rBytes := r.Bytes32() + sBytes := s.Bytes32() + sigBytes := make([]byte, 65) + copy(sigBytes[:32], rBytes[:]) + copy(sigBytes[32:64], sBytes[:]) + sigBytes[64] = v + return sigBytes +} + +// Helper function to create a mock context for testing +func createMockContext(chainID string) sdk.Context { + // This is a simplified mock context creation + // In a real test environment, you might want to use a more sophisticated mock + return sdk.Context{}.WithChainID(chainID) +} diff --git a/x/evm/types/tracer.go b/x/evm/types/tracer.go index 4691a19f..de4c9d50 100644 --- a/x/evm/types/tracer.go +++ b/x/evm/types/tracer.go @@ -86,8 +86,7 @@ func tracingContext(evm *vm.EVM) *tracing.VMContext { BlockNumber: evm.Context.BlockNumber, Time: evm.Context.Time, Random: evm.Context.Random, - GasPrice: evm.TxContext.GasPrice, - ChainConfig: evm.ChainConfig(), + BaseFee: evm.Context.BaseFee, StateDB: evm.StateDB, } } diff --git a/x/evm/types/tracer_test.go b/x/evm/types/tracer_test.go index b751712f..cf5be9ae 100644 --- a/x/evm/types/tracer_test.go +++ b/x/evm/types/tracer_test.go @@ -19,9 +19,6 @@ func TestNewTracing(t *testing.T) { BlockNumber: big.NewInt(100), Time: 1234567890, }, - TxContext: vm.TxContext{ - GasPrice: big.NewInt(20000000000), // 20 gwei - }, } // Create a mock tracer @@ -39,7 +36,7 @@ func TestNewTracing(t *testing.T) { require.Equal(t, evm.Context.Coinbase, tracing.vmContext.Coinbase) require.Equal(t, evm.Context.BlockNumber, tracing.vmContext.BlockNumber) require.Equal(t, evm.Context.Time, tracing.vmContext.Time) - require.Equal(t, evm.TxContext.GasPrice, tracing.vmContext.GasPrice) + require.Equal(t, evm.Context.BaseFee, tracing.vmContext.BaseFee) }) t.Run("create_tracing_with_nil_tracer", func(t *testing.T) { @@ -93,9 +90,6 @@ func TestTracingContext(t *testing.T) { BlockNumber: big.NewInt(100), Time: 1234567890, }, - TxContext: vm.TxContext{ - GasPrice: big.NewInt(20000000000), - }, } vmContext := tracingContext(evm) @@ -104,7 +98,7 @@ func TestTracingContext(t *testing.T) { require.Equal(t, evm.Context.Coinbase, vmContext.Coinbase) require.Equal(t, evm.Context.BlockNumber, vmContext.BlockNumber) require.Equal(t, evm.Context.Time, vmContext.Time) - require.Equal(t, evm.TxContext.GasPrice, vmContext.GasPrice) + require.Equal(t, evm.Context.BaseFee, vmContext.BaseFee) }) } diff --git a/x/evm/types/tx.pb.go b/x/evm/types/tx.pb.go index 0e45f410..78fe76e2 100644 --- a/x/evm/types/tx.pb.go +++ b/x/evm/types/tx.pb.go @@ -305,6 +305,9 @@ type MsgCall struct { Value cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=value,proto3,customtype=cosmossdk.io/math.Int" json:"value"` // AccessList is a predefined list of Ethereum addresses and their corresponding storage slots that a transaction will interact with during its execution. can be none AccessList []AccessTuple `protobuf:"bytes,5,rep,name=access_list,json=accessList,proto3" json:"access_list"` + // AuthList is a list of authorizations that allow code deployment at specific addresses. + // Uses amino omitempty to seamlessly work with existing libraries. + AuthList []SetCodeAuthorization `protobuf:"bytes,6,rep,name=auth_list,json=authList,proto3" json:"auth_list"` } func (m *MsgCall) Reset() { *m = MsgCall{} } @@ -368,6 +371,13 @@ func (m *MsgCall) GetAccessList() []AccessTuple { return nil } +func (m *MsgCall) GetAuthList() []SetCodeAuthorization { + if m != nil { + return m.AuthList + } + return nil +} + // MsgCallResponse defines the Msg/Call response type. type MsgCallResponse struct { Result string `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` @@ -532,51 +542,53 @@ func init() { func init() { proto.RegisterFile("minievm/evm/v1/tx.proto", fileDescriptor_d925564029372f6a) } var fileDescriptor_d925564029372f6a = []byte{ - // 696 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x95, 0xcf, 0x4b, 0xdc, 0x5a, - 0x14, 0xc7, 0x27, 0xf3, 0x4b, 0xe6, 0x8c, 0xfa, 0x30, 0xfa, 0x9c, 0x31, 0xf2, 0xa2, 0x2f, 0x0f, - 0x5e, 0x65, 0xc0, 0x44, 0x53, 0x28, 0xd4, 0x55, 0xb5, 0x62, 0x11, 0x14, 0xca, 0xb4, 0x85, 0x52, - 0x28, 0x72, 0x4d, 0x2e, 0x31, 0x34, 0xc9, 0x0d, 0xb9, 0x77, 0x06, 0xdd, 0xb5, 0xa5, 0xdd, 0x74, - 0xd5, 0x3f, 0xa2, 0x8b, 0x2e, 0xba, 0x70, 0xe1, 0xae, 0xff, 0x80, 0xdd, 0x89, 0xab, 0xd2, 0x85, - 0x14, 0x5d, 0xf8, 0x6f, 0x94, 0xdc, 0xdc, 0x64, 0xc6, 0xe0, 0x60, 0x2b, 0x42, 0xbb, 0x98, 0xe1, - 0x9e, 0x7b, 0xce, 0xf9, 0xde, 0x6f, 0xce, 0x27, 0xe4, 0x42, 0xc3, 0x77, 0x03, 0x17, 0x77, 0x7d, - 0x23, 0xfe, 0x75, 0x17, 0x0d, 0xb6, 0xab, 0x87, 0x11, 0x61, 0x44, 0x1e, 0x15, 0x09, 0x3d, 0xfe, - 0x75, 0x17, 0x95, 0x31, 0xe4, 0xbb, 0x01, 0x31, 0xf8, 0x7f, 0x52, 0xa2, 0x34, 0x2c, 0x42, 0x7d, - 0x42, 0x0d, 0x9f, 0x3a, 0x71, 0xab, 0x4f, 0x1d, 0x91, 0x98, 0x4a, 0x12, 0x5b, 0x3c, 0x32, 0x92, - 0x40, 0xa4, 0x26, 0x1c, 0xe2, 0x90, 0x64, 0x3f, 0x5e, 0x89, 0x5d, 0x25, 0xef, 0x62, 0x2f, 0xc4, - 0xa2, 0x43, 0x7b, 0x55, 0x84, 0xda, 0x26, 0x75, 0xee, 0x47, 0x18, 0x31, 0x2c, 0x2f, 0x40, 0x95, - 0xe2, 0xc0, 0xc6, 0x51, 0x53, 0x9a, 0x95, 0xe6, 0x6a, 0x2b, 0xcd, 0xe3, 0x83, 0xf9, 0x09, 0x71, - 0xc2, 0xb2, 0x6d, 0x47, 0x98, 0xd2, 0x47, 0x2c, 0x72, 0x03, 0xa7, 0x2d, 0xea, 0x64, 0x19, 0xca, - 0x16, 0xb1, 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x75, 0x0f, 0xca, - 0xfc, 0x35, 0x6f, 0x5c, 0x56, 0x8b, 0x3c, 0x4f, 0x99, 0x19, 0x90, 0xc8, 0x14, 0x9e, 0xc2, 0xf0, - 0x05, 0x44, 0x97, 0x35, 0xf4, 0x17, 0x28, 0xb7, 0xae, 0x28, 0x48, 0x95, 0x95, 0xca, 0xcb, 0x18, - 0xc4, 0xca, 0xea, 0xe1, 0xa9, 0x2a, 0x1d, 0x9d, 0xaa, 0xd2, 0xf7, 0x53, 0x55, 0x7a, 0x7f, 0xa6, - 0x16, 0x8e, 0xce, 0xd4, 0xc2, 0xd7, 0x33, 0xb5, 0xf0, 0xac, 0xe5, 0xb8, 0x6c, 0xa7, 0xb3, 0xad, - 0x5b, 0xc4, 0x37, 0xdc, 0xc0, 0x65, 0x2e, 0x9a, 0xf7, 0xd0, 0x36, 0x35, 0xd2, 0x9b, 0x73, 0x97, - 0xdf, 0x9d, 0xfc, 0xe2, 0xdc, 0xae, 0xf2, 0x9b, 0xf3, 0xf6, 0x8f, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x1a, 0xd5, 0x11, 0x68, 0xdd, 0x07, 0x00, 0x00, + // 731 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x95, 0x4f, 0x4b, 0x1b, 0x4f, + 0x18, 0xc7, 0xb3, 0xf9, 0xe7, 0x2f, 0x13, 0xf5, 0x87, 0xa3, 0x35, 0x71, 0xa5, 0xd1, 0xa6, 0xa5, + 0x95, 0x80, 0x59, 0x4d, 0xa1, 0x50, 0x4f, 0x35, 0x8a, 0x22, 0x28, 0x94, 0xd8, 0x42, 0x29, 0x14, + 0x19, 0xb3, 0xc3, 0x66, 0xe8, 0xee, 0x4e, 0xd8, 0x99, 0x0d, 0xda, 0x53, 0x5b, 0xda, 0x4b, 0x4f, + 0x7d, 0x19, 0x3d, 0xf4, 0xe0, 0xc1, 0x5b, 0x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0xba, 0xa6, 0x97, 0xfb, 0xe7, 0x22, + 0xa9, 0x47, 0x20, 0x2d, 0xdf, 0x97, 0xc2, 0x45, 0xb5, 0xc8, 0xb6, 0xf5, 0xa9, 0x3e, 0x89, 0x48, + 0xe1, 0x19, 0x18, 0x3c, 0x87, 0xe8, 0xa2, 0x86, 0xde, 0x02, 0xfd, 0xde, 0x25, 0x05, 0xa1, 0xb2, + 0x9e, 0x79, 0x2d, 0x40, 0xd4, 0x97, 0x0f, 0x4e, 0x4a, 0xda, 0xe1, 0x49, 0x49, 0xfb, 0x71, 0x52, + 0xd2, 0x3e, 0x9e, 0x96, 0x12, 0x87, 0xa7, 0xa5, 0xc4, 0xb7, 0xd3, 0x52, 0xe2, 0x79, 0xc5, 0x22, + 0xbc, 0xe5, 0x6f, 0x57, 0x9b, 0xd4, 0x31, 0x88, 0x4b, 0x38, 0x41, 0xb3, 0x36, 0xda, 0x66, 0x46, + 0x78, 0x05, 0xef, 0xc8, 0x4b, 0x58, 0xde, 0xc0, 0xdb, 0x59, 0x79, 0x05, 0xdf, 0xff, 0x15, 0x00, + 0x00, 0xff, 0xff, 0xa9, 0x14, 0xba, 0xcf, 0x26, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1031,6 +1043,20 @@ func (m *MsgCall) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.AuthList) > 0 { + for iNdEx := len(m.AuthList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AuthList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } if len(m.AccessList) > 0 { for iNdEx := len(m.AccessList) - 1; iNdEx >= 0; iNdEx-- { { @@ -1321,6 +1347,12 @@ func (m *MsgCall) Size() (n int) { n += 1 + l + sovTx(uint64(l)) } } + if len(m.AuthList) > 0 { + for _, e := range m.AuthList { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } return n } @@ -2260,6 +2292,40 @@ func (m *MsgCall) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AuthList = append(m.AuthList, SetCodeAuthorization{}) + if err := m.AuthList[len(m.AuthList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/x/evm/types/txutils.go b/x/evm/types/txutils.go index e64febf9..40448525 100644 --- a/x/evm/types/txutils.go +++ b/x/evm/types/txutils.go @@ -7,6 +7,8 @@ import ( "math/big" "slices" + "github.com/holiman/uint256" + "cosmossdk.io/core/address" "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/codec" @@ -18,6 +20,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/core" coretypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" @@ -124,7 +127,7 @@ func ConvertEthereumTxToCosmosTx( switch ethTx.Type() { case coretypes.LegacyTxType: sigBytes[64] = byte(new(big.Int).Sub(v, new(big.Int).Add(new(big.Int).Add(ethChainID, ethChainID), big.NewInt(35))).Uint64()) - case coretypes.AccessListTxType, coretypes.DynamicFeeTxType: + case coretypes.AccessListTxType, coretypes.DynamicFeeTxType, coretypes.SetCodeTxType: sigBytes[64] = byte(v.Uint64()) default: return nil, sdkerrors.ErrorInvalidSigner.Wrapf("unsupported tx type: %d", ethTx.Type()) @@ -165,6 +168,15 @@ func ConvertEthereumTxToCosmosTx( // convert access list accessList := ConvertEthAccessListToCosmos(ethTx.AccessList()) + authList := ConvertEthSetCodeAuthorizationsToCosmos(ethTx.SetCodeAuthorizations()) + if ethTx.Type() == coretypes.SetCodeTxType { + if ethTx.To() == nil { + return nil, fmt.Errorf("%w (sender %v)", core.ErrSetCodeTxCreate, sender) + } + if len(authList) == 0 { + return nil, fmt.Errorf("%w (sender %v)", core.ErrEmptyAuthList, sender) + } + } sdkMsgs := []sdk.Msg{} if ethTx.To() == nil { @@ -181,6 +193,7 @@ func ConvertEthereumTxToCosmosTx( Input: hexutil.Encode(ethTx.Data()), Value: math.NewIntFromBigInt(value), AccessList: accessList, + AuthList: authList, }) } @@ -264,7 +277,8 @@ func ConvertCosmosTxToEthereumTx( } } // check for early return cases (0x02 is dynamic fee tx type) - if md.GasFeeCap == nil || md.GasTipCap == nil || md.Type > coretypes.DynamicFeeTxType { + supportedTypes := []uint8{coretypes.LegacyTxType, coretypes.AccessListTxType, coretypes.DynamicFeeTxType, coretypes.SetCodeTxType} + if md.GasFeeCap == nil || md.GasTipCap == nil || !slices.Contains(supportedTypes, md.Type) { return nil, nil, nil } @@ -332,6 +346,7 @@ func ConvertCosmosTxToEthereumTx( var input []byte var value *big.Int var accessList coretypes.AccessList + var authList []coretypes.SetCodeAuthorization switch typeUrl { case "/minievm.evm.v1.MsgCall": callMsg := msg.(*MsgCall) @@ -352,6 +367,10 @@ func ConvertCosmosTxToEthereumTx( // So we need to convert it back to wei to get original ethereum tx and verify signature. value = ToEthersUnit(feeDecimals, callMsg.Value.BigInt()) accessList = ConvertCosmosAccessListToEth(callMsg.AccessList) + authList, err = ConvertCosmosSetCodeAuthorizationsToEth(callMsg.AuthList) + if err != nil { + return nil, nil, err + } case "/minievm.evm.v1.MsgCreate": createMsg := msg.(*MsgCreate) @@ -397,7 +416,6 @@ func ConvertCosmosTxToEthereumTx( S: new(big.Int).SetBytes(s), V: new(big.Int).SetBytes(v), } - case coretypes.DynamicFeeTxType: txData = &coretypes.DynamicFeeTx{ ChainID: ethChainID, @@ -413,6 +431,31 @@ func ConvertCosmosTxToEthereumTx( S: new(big.Int).SetBytes(s), V: new(big.Int).SetBytes(v), } + case coretypes.SetCodeTxType: + // validate sender and auth list + if to == nil { + return nil, nil, fmt.Errorf("%w (sender %v)", core.ErrSetCodeTxCreate, sender) + } + if len(authList) == 0 { + return nil, nil, fmt.Errorf("%w (sender %v)", core.ErrEmptyAuthList, sender) + } + + // create set code tx + txData = &coretypes.SetCodeTx{ + ChainID: uint256.MustFromBig(ethChainID), + Nonce: sig.Sequence, + GasTipCap: uint256.MustFromBig(gasTipCap), + GasFeeCap: uint256.MustFromBig(gasFeeCap), + Gas: gasLimit, + To: *to, + Data: input, + Value: uint256.MustFromBig(value), + AccessList: accessList, + AuthList: authList, + R: uint256.MustFromBig(new(big.Int).SetBytes(r)), + S: uint256.MustFromBig(new(big.Int).SetBytes(s)), + V: uint256.MustFromBig(new(big.Int).SetBytes(v)), + } default: return nil, nil, fmt.Errorf("unsupported tx type: %d", md.Type) @@ -472,3 +515,80 @@ func ConvertEthAccessListToCosmos(ethAccessList coretypes.AccessList) []AccessTu } return accessList } + +// ConvertEthSetCodeAuthorizationsToCosmos converts an Ethereum set code authorizations to a Cosmos SDK set code authorizations. +func ConvertEthSetCodeAuthorizationsToCosmos(ethSetCodeAuthorizations []coretypes.SetCodeAuthorization) []SetCodeAuthorization { + if len(ethSetCodeAuthorizations) == 0 { + return nil + } + setCodeAuthorizations := make([]SetCodeAuthorization, len(ethSetCodeAuthorizations)) + for i, auth := range ethSetCodeAuthorizations { + r := auth.R.Bytes32() + s := auth.S.Bytes32() + v := auth.V + + setCodeAuthorizations[i] = SetCodeAuthorization{ + ChainId: auth.ChainID.String(), + Address: auth.Address.String(), + Nonce: auth.Nonce, + Signature: append(append(r[:], s[:]...), v), + } + } + + return setCodeAuthorizations +} + +// ConvertCosmosSetCodeAuthorizationsToEth converts a Cosmos SDK set code authorizations to an Ethereum set code authorizations. +func ConvertCosmosSetCodeAuthorizationsToEth(cosmosSetCodeAuthorizations []SetCodeAuthorization) ([]coretypes.SetCodeAuthorization, error) { + if len(cosmosSetCodeAuthorizations) == 0 { + return nil, nil + } + ethSetCodeAuthorizations := make([]coretypes.SetCodeAuthorization, len(cosmosSetCodeAuthorizations)) + for i, auth := range cosmosSetCodeAuthorizations { + chainID, err := uint256.FromDecimal(auth.ChainId) + if err != nil { + return nil, err + } + + addr, err := hexutil.Decode(auth.Address) + if err != nil { + return nil, err + } + if len(addr) != common.AddressLength { + return nil, fmt.Errorf("invalid address length in set code authorization") + } + + if len(auth.Signature) != 65 { + return nil, fmt.Errorf("invalid signature length in set code authorization") + } + + ethSetCodeAuthorizations[i] = coretypes.SetCodeAuthorization{ + ChainID: *chainID, + Address: common.BytesToAddress(addr), + Nonce: auth.Nonce, + V: auth.Signature[64], + R: *uint256.MustFromBig(new(big.Int).SetBytes(auth.Signature[:32])), + S: *uint256.MustFromBig(new(big.Int).SetBytes(auth.Signature[32:64])), + } + } + + return ethSetCodeAuthorizations, nil +} + +// ValidateAuthorization validates the given set code authorization. +func ValidateAuthorization(ctx sdk.Context, auth coretypes.SetCodeAuthorization) (err error) { + chainID := ConvertCosmosChainIDToEthereumChainID(ctx.ChainID()) + // Verify chain ID is null or equal to current chain ID. + if !auth.ChainID.IsZero() && auth.ChainID.CmpBig(chainID) != 0 { + return core.ErrAuthorizationWrongChainID + } + // Limit nonce to 2^64-1 per EIP-2681. + if auth.Nonce+1 < auth.Nonce { + return core.ErrAuthorizationNonceOverflow + } + _, err = auth.Authority() + if err != nil { + return err + } + return nil +} diff --git a/x/evm/types/txutils_test.go b/x/evm/types/txutils_test.go index d68f83cb..4911079f 100644 --- a/x/evm/types/txutils_test.go +++ b/x/evm/types/txutils_test.go @@ -6,7 +6,16 @@ import ( "testing" "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/std" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/signing" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + coretypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/holiman/uint256" "github.com/stretchr/testify/require" ) @@ -238,3 +247,968 @@ func Test_ConvertCosmosAccessListToEth_and_ConvertEthAccessListToCosmos(t *testi require.Nil(t, ConvertCosmosAccessListToEth(nil)) require.Nil(t, ConvertEthAccessListToCosmos(nil)) } + +// Helper function to create a mock address codec +type mockAddressCodec struct{} + +func (m *mockAddressCodec) StringToBytes(addrStr string) ([]byte, error) { + return common.HexToAddress(addrStr).Bytes(), nil +} + +func (m *mockAddressCodec) BytesToString(bz []byte) (string, error) { + return common.BytesToAddress(bz).Hex(), nil +} + +// Helper function to create a mock lazy args getter +func createMockLazyArgsGetter(params Params, feeDecimals uint8) LazyArgsGetterForConvertEthereumTxToCosmosTx { + return func() (Params, uint8, error) { + return params, feeDecimals, nil + } +} + +// Helper function to create a test Ethereum transaction with real signature +func createTestEthTx(txType uint8, to *common.Address, value *big.Int, data []byte, gasLimit uint64, gasPrice *big.Int, accessList coretypes.AccessList, authList []coretypes.SetCodeAuthorization) *coretypes.Transaction { + var txData coretypes.TxData + + ethChainID := big.NewInt(3068811972085126) // Correct chain ID for minievm-1 + + switch txType { + case coretypes.LegacyTxType: + txData = &coretypes.LegacyTx{ + Nonce: 0, + GasPrice: gasPrice, + Gas: gasLimit, + To: to, + Value: value, + Data: data, + } + case coretypes.AccessListTxType: + txData = &coretypes.AccessListTx{ + ChainID: ethChainID, + Nonce: 0, + GasPrice: gasPrice, + Gas: gasLimit, + To: to, + Value: value, + Data: data, + AccessList: accessList, + } + case coretypes.DynamicFeeTxType: + txData = &coretypes.DynamicFeeTx{ + ChainID: ethChainID, + Nonce: 0, + GasTipCap: gasPrice, + GasFeeCap: gasPrice, + Gas: gasLimit, + To: to, + Value: value, + Data: data, + AccessList: accessList, + } + case coretypes.SetCodeTxType: + txData = &coretypes.SetCodeTx{ + ChainID: uint256.NewInt(ethChainID.Uint64()), + Nonce: 0, + GasTipCap: uint256.MustFromBig(gasPrice), + GasFeeCap: uint256.MustFromBig(gasPrice), + Gas: gasLimit, + To: *to, + Value: uint256.MustFromBig(value), + Data: data, + AccessList: accessList, + AuthList: authList, + } + default: + // For unsupported transaction types, return a legacy transaction + // This is used for testing error cases + txData = &coretypes.LegacyTx{ + Nonce: 0, + GasPrice: gasPrice, + Gas: gasLimit, + To: to, + Value: value, + Data: data, + } + } + + ethTx := coretypes.NewTx(txData) + + // Generate a real private key and sign the transaction + privKey, _ := crypto.GenerateKey() + signer := coretypes.LatestSignerForChainID(ethChainID) + signedTx, _ := coretypes.SignTx(ethTx, signer, privKey) + return signedTx +} + +func TestTransactionConversion_RoundTrip(t *testing.T) { + // Create test parameters + params := Params{ + FeeDenom: "stake", + GasEnforcement: &GasEnforcement{ + MaxGasFeeCap: math.NewIntFromBigInt(big.NewInt(1000)), + MaxGasLimit: 1000000, + }, + } + feeDecimals := uint8(18) + + // Create mock codec + cdc := codec.NewLegacyAmino() + std.RegisterLegacyAminoCodec(cdc) + interfaceRegistry := types.NewInterfaceRegistry() + std.RegisterInterfaces(interfaceRegistry) + cdcWithInterfaces := codec.NewProtoCodec(interfaceRegistry) + + // Create mock address codec + ac := &mockAddressCodec{} + + // Create lazy args getter + lazyArgsGetter := createMockLazyArgsGetter(params, feeDecimals) + + tests := []struct { + name string + chainID string + ethTx *coretypes.Transaction + expectError bool + errorMsg string + }{ + { + name: "legacy transaction - call", + chainID: "minievm-1", + ethTx: createTestEthTx( + coretypes.LegacyTxType, + &[]common.Address{common.HexToAddress("0x1234567890123456789012345678901234567890")}[0], + big.NewInt(1000), + []byte{0x12, 0x34, 0x56}, + 21000, + big.NewInt(20000000000), // 20 gwei + coretypes.AccessList{}, // empty access list + nil, // no auth list for legacy + ), + expectError: false, + }, + { + name: "legacy transaction - create", + chainID: "minievm-1", + ethTx: createTestEthTx( + coretypes.LegacyTxType, + nil, // nil to indicates contract creation + big.NewInt(0), + []byte{0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60}, // simple contract bytecode + 100000, + big.NewInt(20000000000), + coretypes.AccessList{}, // empty access list + nil, // no auth list for legacy + ), + expectError: false, + }, + { + name: "access list transaction", + chainID: "minievm-1", + ethTx: createTestEthTx( + coretypes.AccessListTxType, + &[]common.Address{common.HexToAddress("0x1234567890123456789012345678901234567890")}[0], + big.NewInt(1000), + []byte{0x12, 0x34, 0x56}, + 21000, + big.NewInt(20000000000), + coretypes.AccessList{ // actual access list items + { + Address: common.HexToAddress("0xabcdefabcdefabcdefabcdefabcdefabcdefabcd"), + StorageKeys: []common.Hash{ + common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000001"), + common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000002"), + }, + }, + { + Address: common.HexToAddress("0x9876543210987654321098765432109876543210"), + StorageKeys: []common.Hash{ + common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000003"), + }, + }, + }, + nil, // no auth list for access list tx + ), + expectError: false, + }, + { + name: "dynamic fee transaction", + chainID: "minievm-1", + ethTx: createTestEthTx( + coretypes.DynamicFeeTxType, + &[]common.Address{common.HexToAddress("0x1234567890123456789012345678901234567890")}[0], + big.NewInt(1000), + []byte{0x12, 0x34, 0x56}, + 21000, + big.NewInt(20000000000), + coretypes.AccessList{ // actual access list items + { + Address: common.HexToAddress("0xfedcba9876543210fedcba9876543210fedcba98"), + StorageKeys: []common.Hash{ + common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000004"), + common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000005"), + common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000006"), + }, + }, + }, + nil, // no auth list for dynamic fee tx + ), + expectError: false, + }, + { + name: "set code transaction", + chainID: "minievm-1", + ethTx: createTestEthTx( + coretypes.SetCodeTxType, + &[]common.Address{common.HexToAddress("0x1234567890123456789012345678901234567890")}[0], + big.NewInt(1000), + []byte{0x12, 0x34, 0x56}, + 21000, + big.NewInt(20000000000), + coretypes.AccessList{}, // empty access list + []coretypes.SetCodeAuthorization{ // simple auth list for testing + { + ChainID: *uint256.NewInt(3068811972085126), // minievm-1 chain ID + Address: common.HexToAddress("0x1234567890123456789012345678901234567890"), + Nonce: 42, + V: 0, + R: *uint256.NewInt(1), + S: *uint256.NewInt(1), + }, + }, + ), + expectError: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result, err := ConvertEthereumTxToCosmosTx( + tt.chainID, + ac, + cdcWithInterfaces, + tt.ethTx, + lazyArgsGetter, + ) + + if tt.expectError { + require.Error(t, err) + if tt.errorMsg != "" { + require.Contains(t, err.Error(), tt.errorMsg) + } + } else { + require.NoError(t, err) + require.NotNil(t, result) + + // Verify the converted transaction has the expected structure + msgs := result.GetMsgs() + require.Len(t, msgs, 1) + + // Check if it's a call or create message + if tt.ethTx.To() == nil { + // Should be a create message + createMsg, ok := msgs[0].(*MsgCreate) + require.True(t, ok) + require.Equal(t, hexutil.Encode(tt.ethTx.Data()), createMsg.Code) + require.Equal(t, math.NewIntFromBigInt(tt.ethTx.Value()), createMsg.Value) + } else { + // Should be a call message + callMsg, ok := msgs[0].(*MsgCall) + require.True(t, ok) + require.Equal(t, tt.ethTx.To().String(), callMsg.ContractAddr) + require.Equal(t, hexutil.Encode(tt.ethTx.Data()), callMsg.Input) + require.Equal(t, math.NewIntFromBigInt(tt.ethTx.Value()), callMsg.Value) + } + + // Verify fee and gas limit + authTx := result.(signing.Tx) + fee := authTx.GetFee() + require.Len(t, fee, 1) + require.Equal(t, params.FeeDenom, fee[0].Denom) + require.True(t, fee[0].Amount.IsPositive()) + + // Verify memo contains metadata + memo := authTx.GetMemo() + require.NotEmpty(t, memo) + + var metadata txMetadata + err = json.Unmarshal([]byte(memo), &metadata) + require.NoError(t, err) + require.Equal(t, tt.ethTx.Type(), metadata.Type) + require.Equal(t, tt.ethTx.Gas(), metadata.GasLimit) + + // Test round-trip conversion: Cosmos → Ethereum + ethTx2, senderAddr, err := ConvertCosmosTxToEthereumTx( + true, // allowLegacy + tt.chainID, + ac, + result, + func() (Params, uint8, error) { + return params, feeDecimals, nil + }, + ) + require.NoError(t, err) + require.NotNil(t, ethTx2) + require.NotNil(t, senderAddr) + + // Verify the round-trip transaction matches the original + equalEthTransaction(t, tt.ethTx, ethTx2) + } + }) + } +} + +func equalEthTransaction(t *testing.T, expected, actual *coretypes.Transaction) { + require.Equal(t, expected.ChainId(), actual.ChainId()) + require.Equal(t, expected.Nonce(), actual.Nonce()) + require.Equal(t, expected.GasTipCap(), actual.GasTipCap()) + require.Equal(t, expected.GasFeeCap(), actual.GasFeeCap()) + require.Equal(t, expected.Gas(), actual.Gas()) + require.Equal(t, expected.To(), actual.To()) + require.Equal(t, expected.Data(), actual.Data()) + require.Equal(t, expected.Value(), actual.Value()) + require.Equal(t, expected.Type(), actual.Type()) + require.Equal(t, expected.AccessList(), actual.AccessList()) + require.Equal(t, expected.SetCodeAuthorizations(), actual.SetCodeAuthorizations()) +} + +func TestTransactionConversion_ErrorCases(t *testing.T) { + params := Params{FeeDenom: "stake"} + feeDecimals := uint8(18) + + // Create proper codec + cdc := codec.NewLegacyAmino() + std.RegisterLegacyAminoCodec(cdc) + interfaceRegistry := types.NewInterfaceRegistry() + std.RegisterInterfaces(interfaceRegistry) + cdcWithInterfaces := codec.NewProtoCodec(interfaceRegistry) + + ac := &mockAddressCodec{} + + // Test with invalid lazy args getter + t.Run("lazy args getter error", func(t *testing.T) { + invalidLazyArgsGetter := func() (Params, uint8, error) { + return params, feeDecimals, sdkerrors.ErrInvalidRequest.Wrap("test error") + } + + ethTx := createTestEthTx( + coretypes.LegacyTxType, + &[]common.Address{common.HexToAddress("0x1234567890123456789012345678901234567890")}[0], + big.NewInt(1000), + []byte{0x12, 0x34, 0x56}, + 21000, + big.NewInt(20000000000), + coretypes.AccessList{}, // empty access list + nil, // no auth list for legacy + ) + + _, err := ConvertEthereumTxToCosmosTx( + "minievm-1", + ac, + cdcWithInterfaces, + ethTx, + invalidLazyArgsGetter, + ) + + require.Error(t, err) + require.Contains(t, err.Error(), "test error") + }) + + // Test with invalid sender recovery + t.Run("invalid sender recovery", func(t *testing.T) { + lazyArgsGetter := createMockLazyArgsGetter(params, feeDecimals) + + // Create a transaction with invalid signature that will fail sender recovery + invalidTx := &coretypes.LegacyTx{ + Nonce: 0, + GasPrice: big.NewInt(20000000000), + Gas: 21000, + To: &[]common.Address{common.HexToAddress("0x1234567890123456789012345678901234567890")}[0], + Value: big.NewInt(1000), + Data: []byte{0x12, 0x34, 0x56}, + V: big.NewInt(999), // Invalid V value + R: big.NewInt(999), // Invalid R value + S: big.NewInt(999), // Invalid S value + } + ethTx := coretypes.NewTx(invalidTx) + + _, err := ConvertEthereumTxToCosmosTx( + "minievm-1", + ac, + cdcWithInterfaces, + ethTx, + lazyArgsGetter, + ) + + require.Error(t, err) + require.Contains(t, err.Error(), "invalid chain id for signer") + }) +} + +// TestTransactionConversion_ComprehensiveScenarios tests comprehensive scenarios with round-trip conversion similar to keeper tests +func TestTransactionConversion_ComprehensiveScenarios(t *testing.T) { + // Create test parameters with gas enforcement + params := Params{ + FeeDenom: "stake", + GasEnforcement: &GasEnforcement{ + MaxGasFeeCap: math.NewIntFromBigInt(big.NewInt(1000000000000000000)), // 1 ETH in wei + MaxGasLimit: 500000, // Half of test gas limit + }, + } + feeDecimals := uint8(18) + + // Create mock codec + cdc := codec.NewLegacyAmino() + std.RegisterLegacyAminoCodec(cdc) + interfaceRegistry := types.NewInterfaceRegistry() + std.RegisterInterfaces(interfaceRegistry) + cdcWithInterfaces := codec.NewProtoCodec(interfaceRegistry) + + // Create mock address codec + ac := &mockAddressCodec{} + + // Create lazy args getter + lazyArgsGetter := createMockLazyArgsGetter(params, feeDecimals) + + t.Run("dynamic fee transaction with access list", func(t *testing.T) { + // Create a dynamic fee transaction similar to the keeper test + gasLimit := uint64(1000000) + gasFeeCap := big.NewInt(20000000000) // 20 gwei + gasTipCap := big.NewInt(1000000000) // 1 gwei + value := big.NewInt(1000000000000000000) // 1 ETH + + // Create access list + accessList := coretypes.AccessList{ + coretypes.AccessTuple{ + Address: common.HexToAddress("0x1234567890123456789012345678901234567890"), + StorageKeys: []common.Hash{ + common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"), + common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000001"), + common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000002"), + }, + }, + } + + // Create dynamic fee transaction + dynTx := &coretypes.DynamicFeeTx{ + ChainID: big.NewInt(3068811972085126), // Correct chain ID for minievm-1 + Nonce: 100, + GasTipCap: gasTipCap, + GasFeeCap: gasFeeCap, + Gas: gasLimit, + To: &[]common.Address{common.HexToAddress("0x1234567890123456789012345678901234567890")}[0], + Data: []byte{0x12, 0x34, 0x56, 0x78}, + Value: value, + AccessList: accessList, + } + + ethTx := coretypes.NewTx(dynTx) + + // Generate a real private key and sign the transaction + privKey, err := crypto.GenerateKey() + require.NoError(t, err) + + ethChainID := big.NewInt(3068811972085126) + signer := coretypes.LatestSignerForChainID(ethChainID) + signedTx, err := coretypes.SignTx(ethTx, signer, privKey) + require.NoError(t, err) + + // Test conversion with real signature + result, err := ConvertEthereumTxToCosmosTx( + "minievm-1", + ac, + cdcWithInterfaces, + signedTx, + lazyArgsGetter, + ) + + // Should succeed with real signature + require.NoError(t, err) + require.NotNil(t, result) + + // Verify the converted transaction structure + msgs := result.GetMsgs() + require.Len(t, msgs, 1) + + callMsg, ok := msgs[0].(*MsgCall) + require.True(t, ok) + require.Equal(t, "0x1234567890123456789012345678901234567890", callMsg.ContractAddr) + require.Equal(t, hexutil.Encode([]byte{0x12, 0x34, 0x56, 0x78}), callMsg.Input) + require.Equal(t, math.NewIntFromBigInt(value), callMsg.Value) + + // Verify access list conversion + require.Len(t, callMsg.AccessList, 1) + require.Equal(t, "0x1234567890123456789012345678901234567890", callMsg.AccessList[0].Address) + require.Len(t, callMsg.AccessList[0].StorageKeys, 3) + + // Verify fee and gas limit + authTx := result.(signing.Tx) + fee := authTx.GetFee() + require.Len(t, fee, 1) + require.Equal(t, params.FeeDenom, fee[0].Denom) + require.True(t, fee[0].Amount.IsPositive()) + + // Verify memo contains metadata + memo := authTx.GetMemo() + require.NotEmpty(t, memo) + + var metadata txMetadata + err = json.Unmarshal([]byte(memo), &metadata) + require.NoError(t, err) + require.Equal(t, signedTx.Type(), metadata.Type) + require.Equal(t, signedTx.Gas(), metadata.GasLimit) + + // Test round-trip conversion: Cosmos → Ethereum + ethTx2, senderAddr, err := ConvertCosmosTxToEthereumTx( + true, // allowLegacy + "minievm-1", + ac, + result, + func() (Params, uint8, error) { + return params, feeDecimals, nil + }, + ) + require.NoError(t, err) + require.NotNil(t, ethTx2) + require.NotNil(t, senderAddr) + + // Verify the round-trip transaction matches the original + equalEthTransaction(t, signedTx, ethTx2) + }) + + t.Run("access list transaction with empty access list", func(t *testing.T) { + // Create access list transaction with empty access list + gasLimit := uint64(1000000) + gasPrice := big.NewInt(20000000000) // 20 gwei + value := big.NewInt(1000000000000000000) // 1 ETH + + accessTx := &coretypes.AccessListTx{ + ChainID: big.NewInt(3068811972085126), // Correct chain ID for minievm-1 + Nonce: 100, + GasPrice: gasPrice, + Gas: gasLimit, + To: &[]common.Address{common.HexToAddress("0x1234567890123456789012345678901234567890")}[0], + Data: []byte{0x12, 0x34, 0x56, 0x78}, + Value: value, + AccessList: coretypes.AccessList{}, // Empty access list + } + + ethTx := coretypes.NewTx(accessTx) + + // Generate a real private key and sign the transaction + privKey, err := crypto.GenerateKey() + require.NoError(t, err) + + ethChainID := big.NewInt(3068811972085126) + signer := coretypes.LatestSignerForChainID(ethChainID) + signedTx, err := coretypes.SignTx(ethTx, signer, privKey) + require.NoError(t, err) + + // Test conversion with real signature + result, err := ConvertEthereumTxToCosmosTx( + "minievm-1", + ac, + cdcWithInterfaces, + signedTx, + lazyArgsGetter, + ) + + // Should succeed with real signature + require.NoError(t, err) + require.NotNil(t, result) + + // Verify the converted transaction structure + msgs := result.GetMsgs() + require.Len(t, msgs, 1) + + callMsg, ok := msgs[0].(*MsgCall) + require.True(t, ok) + require.Equal(t, "0x1234567890123456789012345678901234567890", callMsg.ContractAddr) + require.Equal(t, hexutil.Encode([]byte{0x12, 0x34, 0x56, 0x78}), callMsg.Input) + require.Equal(t, math.NewIntFromBigInt(value), callMsg.Value) + + // Verify empty access list + require.Len(t, callMsg.AccessList, 0) + + // Test round-trip conversion: Cosmos → Ethereum + ethTx2, senderAddr, err := ConvertCosmosTxToEthereumTx( + true, // allowLegacy + "minievm-1", + ac, + result, + func() (Params, uint8, error) { + return params, feeDecimals, nil + }, + ) + require.NoError(t, err) + require.NotNil(t, ethTx2) + require.NotNil(t, senderAddr) + + // Verify the round-trip transaction matches the original + equalEthTransaction(t, signedTx, ethTx2) + }) + + t.Run("legacy transaction with gas enforcement", func(t *testing.T) { + // Create legacy transaction + gasLimit := uint64(1000000) + gasPrice := big.NewInt(20000000000) // 20 gwei + value := big.NewInt(1000000000000000000) // 1 ETH + + signedTx := createTestEthTx( + coretypes.LegacyTxType, + &[]common.Address{common.HexToAddress("0x1234567890123456789012345678901234567890")}[0], + value, + []byte{0x12, 0x34, 0x56, 0x78}, + gasLimit, + gasPrice, + coretypes.AccessList{}, // empty access list + nil, // no auth list for legacy + ) + + // Test conversion with real signature + result, err := ConvertEthereumTxToCosmosTx( + "minievm-1", + ac, + cdcWithInterfaces, + signedTx, + lazyArgsGetter, + ) + + // Should succeed with real signature + require.NoError(t, err) + require.NotNil(t, result) + + // Verify the converted transaction structure + msgs := result.GetMsgs() + require.Len(t, msgs, 1) + + callMsg, ok := msgs[0].(*MsgCall) + require.True(t, ok) + require.Equal(t, "0x1234567890123456789012345678901234567890", callMsg.ContractAddr) + require.Equal(t, hexutil.Encode([]byte{0x12, 0x34, 0x56, 0x78}), callMsg.Input) + require.Equal(t, math.NewIntFromBigInt(value), callMsg.Value) + + // Verify fee and gas limit + authTx := result.(signing.Tx) + fee := authTx.GetFee() + require.Len(t, fee, 1) + require.Equal(t, params.FeeDenom, fee[0].Denom) + require.True(t, fee[0].Amount.IsPositive()) + + // Test round-trip conversion: Cosmos → Ethereum + ethTx2, senderAddr, err := ConvertCosmosTxToEthereumTx( + true, // allowLegacy + "minievm-1", + ac, + result, + func() (Params, uint8, error) { + return params, feeDecimals, nil + }, + ) + require.NoError(t, err) + require.NotNil(t, ethTx2) + require.NotNil(t, senderAddr) + + // Verify the round-trip transaction matches the original + equalEthTransaction(t, signedTx, ethTx2) + }) + + t.Run("set code transaction with authorization list", func(t *testing.T) { + // Create set code transaction with authorization list + gasLimit := uint64(1000000) + gasFeeCap := big.NewInt(20000000000) // 20 gwei + gasTipCap := big.NewInt(1000000000) // 1 gwei + value := big.NewInt(1000000000000000000) // 1 ETH + + // Create authorization list with real signature + authList := []coretypes.SetCodeAuthorization{ + { + ChainID: *uint256.NewInt(3068811972085126), // Correct chain ID for minievm-1 + Address: common.HexToAddress("0x1234567890123456789012345678901234567890"), + Nonce: 42, + V: 0, // Will be set by signing + R: *uint256.NewInt(0), // Will be set by signing + S: *uint256.NewInt(0), // Will be set by signing + }, + } + + setCodeTx := &coretypes.SetCodeTx{ + ChainID: uint256.NewInt(3068811972085126), // Correct chain ID for minievm-1 + Nonce: 100, + GasTipCap: uint256.MustFromBig(gasTipCap), + GasFeeCap: uint256.MustFromBig(gasFeeCap), + Gas: gasLimit, + To: common.HexToAddress("0x1234567890123456789012345678901234567890"), + Data: []byte{0x12, 0x34, 0x56, 0x78}, + Value: uint256.MustFromBig(value), + AccessList: coretypes.AccessList{}, + AuthList: authList, + V: uint256.NewInt(0), // Will be set by signing + R: uint256.NewInt(0), // Will be set by signing + S: uint256.NewInt(0), // Will be set by signing + } + + ethTx := coretypes.NewTx(setCodeTx) + + // Generate a real private key and sign the transaction + privKey, err := crypto.GenerateKey() + require.NoError(t, err) + + ethChainID := big.NewInt(3068811972085126) + signer := coretypes.LatestSignerForChainID(ethChainID) + signedTx, err := coretypes.SignTx(ethTx, signer, privKey) + require.NoError(t, err) + + // Test conversion with real signature + result, err := ConvertEthereumTxToCosmosTx( + "minievm-1", + ac, + cdcWithInterfaces, + signedTx, + lazyArgsGetter, + ) + + // Should succeed with real signature + require.NoError(t, err) + require.NotNil(t, result) + + // Verify the converted transaction structure + msgs := result.GetMsgs() + require.Len(t, msgs, 1) + + callMsg, ok := msgs[0].(*MsgCall) + require.True(t, ok) + require.Equal(t, "0x1234567890123456789012345678901234567890", callMsg.ContractAddr) + require.Equal(t, hexutil.Encode([]byte{0x12, 0x34, 0x56, 0x78}), callMsg.Input) + require.Equal(t, math.NewIntFromBigInt(value), callMsg.Value) + + // Verify fee and gas limit + authTx := result.(signing.Tx) + fee := authTx.GetFee() + require.Len(t, fee, 1) + require.Equal(t, params.FeeDenom, fee[0].Denom) + require.True(t, fee[0].Amount.IsPositive()) + + // Test round-trip conversion: Cosmos → Ethereum + ethTx2, senderAddr, err := ConvertCosmosTxToEthereumTx( + true, // allowLegacy + "minievm-1", + ac, + result, + func() (Params, uint8, error) { + return params, feeDecimals, nil + }, + ) + require.NoError(t, err) + require.NotNil(t, ethTx2) + require.NotNil(t, senderAddr) + + // Verify the round-trip transaction matches the original + equalEthTransaction(t, signedTx, ethTx2) + }) + + t.Run("contract creation transaction", func(t *testing.T) { + // Create contract creation transaction (To is nil) + gasLimit := uint64(1000000) + gasPrice := big.NewInt(20000000000) // 20 gwei + value := big.NewInt(0) // No value for contract creation + + // Contract bytecode + contractCode := []byte{ + 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, // PUSH1 0x60 (8 times) + 0x60, 0x00, 0x52, 0x60, 0x20, 0x60, 0x00, 0xf3, // MSTORE, RETURN + } + + signedTx := createTestEthTx( + coretypes.LegacyTxType, + nil, // Contract creation + value, + contractCode, + gasLimit, + gasPrice, + coretypes.AccessList{}, // empty access list + nil, // no auth list for legacy + ) + + // Test conversion with real signature + result, err := ConvertEthereumTxToCosmosTx( + "minievm-1", + ac, + cdcWithInterfaces, + signedTx, + lazyArgsGetter, + ) + + // Should succeed with real signature + require.NoError(t, err) + require.NotNil(t, result) + + // Verify the converted transaction structure + msgs := result.GetMsgs() + require.Len(t, msgs, 1) + + deployMsg, ok := msgs[0].(*MsgCreate) + require.True(t, ok) + require.Equal(t, hexutil.Encode(contractCode), deployMsg.Code) + require.Equal(t, math.NewIntFromBigInt(value), deployMsg.Value) + + // Verify fee and gas limit + authTx := result.(signing.Tx) + fee := authTx.GetFee() + require.Len(t, fee, 1) + require.Equal(t, params.FeeDenom, fee[0].Denom) + require.True(t, fee[0].Amount.IsPositive()) + + // Test round-trip conversion: Cosmos → Ethereum + ethTx2, senderAddr, err := ConvertCosmosTxToEthereumTx( + true, // allowLegacy + "minievm-1", + ac, + result, + func() (Params, uint8, error) { + return params, feeDecimals, nil + }, + ) + require.NoError(t, err) + require.NotNil(t, ethTx2) + require.NotNil(t, senderAddr) + + // Verify the round-trip transaction matches the original + equalEthTransaction(t, signedTx, ethTx2) + }) + + t.Run("transaction with zero gas price", func(t *testing.T) { + // Create transaction with zero gas price + gasLimit := uint64(1000000) + gasPrice := big.NewInt(0) // Zero gas price + value := big.NewInt(1000000000000000000) // 1 ETH + + signedTx := createTestEthTx( + coretypes.LegacyTxType, + &[]common.Address{common.HexToAddress("0x1234567890123456789012345678901234567890")}[0], + value, + []byte{0x12, 0x34, 0x56, 0x78}, + gasLimit, + gasPrice, + coretypes.AccessList{}, // empty access list + nil, // no auth list for legacy + ) + + // Test conversion with real signature + result, err := ConvertEthereumTxToCosmosTx( + "minievm-1", + ac, + cdcWithInterfaces, + signedTx, + lazyArgsGetter, + ) + + // Should succeed with real signature + require.NoError(t, err) + require.NotNil(t, result) + + // Verify the converted transaction structure + msgs := result.GetMsgs() + require.Len(t, msgs, 1) + + callMsg, ok := msgs[0].(*MsgCall) + require.True(t, ok) + require.Equal(t, "0x1234567890123456789012345678901234567890", callMsg.ContractAddr) + require.Equal(t, hexutil.Encode([]byte{0x12, 0x34, 0x56, 0x78}), callMsg.Input) + require.Equal(t, math.NewIntFromBigInt(value), callMsg.Value) + + // Verify fee is zero due to zero gas price + authTx := result.(signing.Tx) + fee := authTx.GetFee() + // When gas price is zero, fee might be empty or contain zero amount + if len(fee) == 0 { + // Fee array is empty when gas price is zero + require.Len(t, fee, 0) + } else { + require.Len(t, fee, 1) + require.Equal(t, params.FeeDenom, fee[0].Denom) + require.True(t, fee[0].Amount.IsZero()) + } + + // Test round-trip conversion: Cosmos → Ethereum + ethTx2, senderAddr, err := ConvertCosmosTxToEthereumTx( + true, // allowLegacy + "minievm-1", + ac, + result, + func() (Params, uint8, error) { + return params, feeDecimals, nil + }, + ) + require.NoError(t, err) + require.NotNil(t, ethTx2) + require.NotNil(t, senderAddr) + + // Verify the round-trip transaction matches the original + equalEthTransaction(t, signedTx, ethTx2) + }) + + t.Run("transaction with very large gas limit", func(t *testing.T) { + // Create transaction with gas limit exceeding max + gasLimit := uint64(2000000) // Exceeds MaxGasLimit of 1000000 + gasPrice := big.NewInt(20000000000) // 20 gwei + value := big.NewInt(1000000000000000000) // 1 ETH + + signedTx := createTestEthTx( + coretypes.LegacyTxType, + &[]common.Address{common.HexToAddress("0x1234567890123456789012345678901234567890")}[0], + value, + []byte{0x12, 0x34, 0x56, 0x78}, + gasLimit, + gasPrice, + coretypes.AccessList{}, // empty access list + nil, // no auth list for legacy + ) + + // Test conversion with real signature + result, err := ConvertEthereumTxToCosmosTx( + "minievm-1", + ac, + cdcWithInterfaces, + signedTx, + lazyArgsGetter, + ) + + // Should succeed with real signature (gas enforcement happens in keeper layer) + require.NoError(t, err) + require.NotNil(t, result) + + // Verify the converted transaction structure + msgs := result.GetMsgs() + require.Len(t, msgs, 1) + + callMsg, ok := msgs[0].(*MsgCall) + require.True(t, ok) + require.Equal(t, "0x1234567890123456789012345678901234567890", callMsg.ContractAddr) + require.Equal(t, hexutil.Encode([]byte{0x12, 0x34, 0x56, 0x78}), callMsg.Input) + require.Equal(t, math.NewIntFromBigInt(value), callMsg.Value) + + // Verify fee calculation with large gas limit + authTx := result.(signing.Tx) + fee := authTx.GetFee() + require.Len(t, fee, 1) + require.Equal(t, params.FeeDenom, fee[0].Denom) + require.True(t, fee[0].Amount.IsPositive()) + + // Test round-trip conversion: Cosmos → Ethereum + ethTx2, senderAddr, err := ConvertCosmosTxToEthereumTx( + true, // allowLegacy + "minievm-1", + ac, + result, + func() (Params, uint8, error) { + return params, feeDecimals, nil + }, + ) + require.NoError(t, err) + require.NotNil(t, ethTx2) + require.NotNil(t, senderAddr) + + // Verify the round-trip transaction matches the original + equalEthTransaction(t, signedTx, ethTx2) + }) +} diff --git a/x/evm/types/types.pb.go b/x/evm/types/types.pb.go index c4c11a28..5537481e 100644 --- a/x/evm/types/types.pb.go +++ b/x/evm/types/types.pb.go @@ -4,6 +4,7 @@ package types import ( + bytes "bytes" cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" @@ -172,6 +173,7 @@ func (m *Log) XXX_DiscardUnknown() { var xxx_messageInfo_Log proto.InternalMessageInfo +// AccessTuple is the element type of an access list. type AccessTuple struct { // Address of the contract that will be accessed during the transaction execution. Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` @@ -291,6 +293,47 @@ func (m *ERC721ClassInfo) XXX_DiscardUnknown() { var xxx_messageInfo_ERC721ClassInfo proto.InternalMessageInfo +// SetCodeAuthorization is an authorization from an account to deploy code at its address. +type SetCodeAuthorization struct { + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + Nonce uint64 `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"` + Signature []byte `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (m *SetCodeAuthorization) Reset() { *m = SetCodeAuthorization{} } +func (m *SetCodeAuthorization) String() string { return proto.CompactTextString(m) } +func (*SetCodeAuthorization) ProtoMessage() {} +func (*SetCodeAuthorization) Descriptor() ([]byte, []int) { + return fileDescriptor_98c9eab1c4bf0154, []int{6} +} +func (m *SetCodeAuthorization) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SetCodeAuthorization) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SetCodeAuthorization.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SetCodeAuthorization) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetCodeAuthorization.Merge(m, src) +} +func (m *SetCodeAuthorization) XXX_Size() int { + return m.Size() +} +func (m *SetCodeAuthorization) XXX_DiscardUnknown() { + xxx_messageInfo_SetCodeAuthorization.DiscardUnknown(m) +} + +var xxx_messageInfo_SetCodeAuthorization proto.InternalMessageInfo + func init() { proto.RegisterType((*Params)(nil), "minievm.evm.v1.Params") proto.RegisterType((*GasEnforcement)(nil), "minievm.evm.v1.GasEnforcement") @@ -298,70 +341,74 @@ func init() { proto.RegisterType((*AccessTuple)(nil), "minievm.evm.v1.AccessTuple") proto.RegisterType((*ERC721OriginTokenInfo)(nil), "minievm.evm.v1.ERC721OriginTokenInfo") proto.RegisterType((*ERC721ClassInfo)(nil), "minievm.evm.v1.ERC721ClassInfo") + proto.RegisterType((*SetCodeAuthorization)(nil), "minievm.evm.v1.SetCodeAuthorization") } func init() { proto.RegisterFile("minievm/evm/v1/types.proto", fileDescriptor_98c9eab1c4bf0154) } var fileDescriptor_98c9eab1c4bf0154 = []byte{ - // 915 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x55, 0xcf, 0x6f, 0xdb, 0x36, - 0x14, 0xb6, 0xe2, 0x34, 0x89, 0xe9, 0x36, 0x3f, 0x58, 0xa7, 0x51, 0xd2, 0x55, 0xf2, 0x04, 0x6c, - 0x33, 0x02, 0xd4, 0x6e, 0xb2, 0xc3, 0x80, 0xa2, 0x17, 0xcb, 0xf1, 0x32, 0xaf, 0xc1, 0x96, 0x6a, - 0xed, 0x61, 0xc3, 0x30, 0x81, 0x96, 0x68, 0x99, 0x88, 0x28, 0x0a, 0xa2, 0x94, 0xc5, 0xd8, 0x5f, - 0xb0, 0x9d, 0x06, 0xec, 0xb2, 0x63, 0x8f, 0x3d, 0xf6, 0xb0, 0x3f, 0x22, 0xc7, 0x62, 0xa7, 0x61, - 0x07, 0x61, 0x73, 0x80, 0x75, 0x67, 0xff, 0x05, 0x03, 0x49, 0x39, 0xb6, 0xdb, 0x6d, 0x07, 0x09, - 0x7c, 0xdf, 0xf7, 0xf1, 0xe3, 0xe3, 0xd3, 0xa3, 0x08, 0xf6, 0x28, 0x89, 0x08, 0x3e, 0xa7, 0x2d, - 0xf1, 0x9c, 0x1f, 0xb4, 0xd2, 0x51, 0x8c, 0x79, 0x33, 0x4e, 0x58, 0xca, 0xe0, 0x7a, 0xc1, 0x35, - 0xc5, 0x73, 0x7e, 0xb0, 0xb7, 0x85, 0x28, 0x89, 0x58, 0x4b, 0xbe, 0x95, 0x64, 0x6f, 0xd7, 0x63, - 0x9c, 0x32, 0xee, 0xca, 0xa8, 0xa5, 0x82, 0x82, 0xaa, 0x05, 0x2c, 0x60, 0x0a, 0x17, 0x23, 0x85, - 0x5a, 0x7f, 0xdd, 0x00, 0x2b, 0xa7, 0x28, 0x41, 0x94, 0xc3, 0x36, 0x00, 0xf8, 0x22, 0x4d, 0x90, - 0x8b, 0x49, 0xcc, 0x75, 0xad, 0x5e, 0x6e, 0x94, 0x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 0x27, 0x24, 0x20, 0xd1, 0x53, 0x76, - 0x86, 0xa3, 0x5e, 0x34, 0x60, 0xf0, 0x7d, 0xb0, 0x91, 0x8a, 0xc0, 0x65, 0x92, 0x70, 0x89, 0x5f, - 0xb8, 0xdf, 0x92, 0xb0, 0x92, 0xf7, 0x7c, 0x78, 0x17, 0x54, 0x94, 0x2e, 0x4b, 0x88, 0xac, 0x79, - 0xc5, 0x59, 0x93, 0xc0, 0xb3, 0x84, 0x58, 0xdf, 0x6b, 0x60, 0x43, 0xd9, 0x77, 0x42, 0xc4, 0xb9, - 0x34, 0xde, 0x05, 0x6b, 0x9e, 0x08, 0x66, 0x8e, 0xab, 0x32, 0xee, 0xf9, 0xf0, 0x1e, 0x00, 0x8a, - 0x8a, 0x10, 0xc5, 0x85, 0x59, 0x45, 0x22, 0x9f, 0x21, 0x8a, 0xc5, 0x52, 0x8a, 0x16, 0x4b, 0xa9, - 0x82, 0x28, 0xab, 0x67, 0x09, 0x81, 0x26, 0xa8, 0x2a, 0xd2, 0xc7, 0xdc, 0x13, 0x7f, 0x1c, 0x41, - 0x2b, 0xbb, 0x23, 0x81, 0xd8, 0x27, 0x97, 0x7f, 0x1a, 0xa5, 0x17, 0x63, 0x43, 0xbb, 0x1c, 0x1b, - 0xda, 0xab, 0xb1, 0xa1, 0xfd, 0x31, 0x36, 0xb4, 0x1f, 0xaf, 0x8c, 0xd2, 0xab, 0x2b, 0xa3, 0xf4, - 0xdb, 0x95, 0x51, 0xfa, 0x6a, 0x3f, 0x20, 0xe9, 0x30, 0xeb, 0x37, 0x3d, 0x46, 0x5b, 0x24, 0x22, - 0x29, 0x41, 0xf7, 0x43, 0xd4, 0xe7, 0xad, 0xe9, 0x55, 0x71, 0x21, 0x2f, 0x0b, 0x79, 0x53, 0xf4, - 0x57, 0xe4, 0x6f, 0xfd, 0xc3, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x83, 0xec, 0xc2, 0xfe, 0x48, - 0x06, 0x00, 0x00, + // 974 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x55, 0x4f, 0x6f, 0xdb, 0x36, + 0x1c, 0xb5, 0xe2, 0xfc, 0x13, 0x9d, 0xe6, 0x0f, 0xeb, 0x34, 0x4a, 0xda, 0x4a, 0x9e, 0x80, 0x6d, + 0x46, 0x80, 0xda, 0x4d, 0x76, 0x18, 0x50, 0xf4, 0x62, 0x3b, 0x5e, 0xe6, 0x35, 0xd8, 0x52, 0xb5, + 0x3d, 0x6c, 0x18, 0x26, 0xd0, 0x12, 0x2d, 0x13, 0xb1, 0x48, 0x41, 0x94, 0xb2, 0x78, 0x3b, 0xec, + 0xbc, 0x9d, 0x06, 0xec, 0xb2, 0x63, 0x8f, 0x3d, 0xf6, 0xb0, 0x0f, 0x91, 0x63, 0xb1, 0xd3, 0xb0, + 0x83, 0xb0, 0x39, 0xc0, 0xba, 0xb3, 0x3f, 0xc1, 0x40, 0x52, 0x8e, 0xed, 0x76, 0xdb, 0x41, 0x86, + 0x7e, 0xef, 0x3d, 0x3e, 0xfe, 0xf8, 0x44, 0x9a, 0x60, 0x2f, 0x24, 0x94, 0xe0, 0xf3, 0xb0, 0x2e, + 0x9e, 0xf3, 0x83, 0x7a, 0x32, 0x8c, 0x30, 0xaf, 0x45, 0x31, 0x4b, 0x18, 0x5c, 0xcf, 0xb9, 0x9a, + 0x78, 0xce, 0x0f, 0xf6, 0xb6, 0x50, 0x48, 0x28, 0xab, 0xcb, 0x5f, 0x25, 0xd9, 0xdb, 0xf5, 0x18, + 0x0f, 0x19, 0x77, 0x65, 0x55, 0x57, 0x45, 0x4e, 0x95, 0x03, 0x16, 0x30, 0x85, 0x8b, 0x37, 0x85, + 0xda, 0x7f, 0x2d, 0x81, 0xe5, 0x53, 0x14, 0xa3, 0x90, 0xc3, 0x06, 0x00, 0xf8, 0x22, 0x89, 0x91, + 0x8b, 0x49, 0xc4, 0x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, 0xd4, 0xfe, + 0x18, 0x99, 0xda, 0x8f, 0x57, 0x66, 0xe1, 0xd5, 0x95, 0x59, 0xf8, 0xed, 0xca, 0x2c, 0x7c, 0xb1, + 0x1f, 0x90, 0xa4, 0x9f, 0x76, 0x6b, 0x1e, 0x0b, 0xeb, 0x84, 0x92, 0x84, 0xa0, 0x7b, 0x03, 0xd4, + 0xe5, 0xf5, 0xc9, 0x5d, 0x75, 0x21, 0x6f, 0x2b, 0x79, 0x55, 0x75, 0x97, 0xe5, 0xbd, 0xf2, 0xc1, + 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x91, 0x96, 0xc8, 0x80, 0xc9, 0x06, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -586,6 +633,39 @@ func (this *ERC721ClassInfo) Equal(that interface{}) bool { } return true } +func (this *SetCodeAuthorization) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*SetCodeAuthorization) + if !ok { + that2, ok := that.(SetCodeAuthorization) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ChainId != that1.ChainId { + return false + } + if this.Address != that1.Address { + return false + } + if this.Nonce != that1.Nonce { + return false + } + if !bytes.Equal(this.Signature, that1.Signature) { + return false + } + return true +} func (m *Params) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -910,6 +990,55 @@ func (m *ERC721ClassInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *SetCodeAuthorization) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SetCodeAuthorization) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SetCodeAuthorization) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x22 + } + if m.Nonce != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Nonce)) + i-- + dAtA[i] = 0x18 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0x12 + } + if len(m.ChainId) > 0 { + i -= len(m.ChainId) + copy(dAtA[i:], m.ChainId) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ChainId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { offset -= sovTypes(v) base := offset @@ -1069,6 +1198,30 @@ func (m *ERC721ClassInfo) Size() (n int) { return n } +func (m *SetCodeAuthorization) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.Nonce != 0 { + n += 1 + sovTypes(uint64(m.Nonce)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + func sovTypes(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2093,6 +2246,173 @@ func (m *ERC721ClassInfo) Unmarshal(dAtA []byte) error { } return nil } +func (m *SetCodeAuthorization) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SetCodeAuthorization: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SetCodeAuthorization: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) + } + m.Nonce = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Nonce |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTypes(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0