diff --git a/app/app.go b/app/app.go index 19f459b9..2d0d904d 100644 --- a/app/app.go +++ b/app/app.go @@ -118,8 +118,6 @@ import ( "github.com/cosmos/evm/x/feemarket" feemarketkeeper "github.com/cosmos/evm/x/feemarket/keeper" feemarkettypes "github.com/cosmos/evm/x/feemarket/types" - transfer "github.com/cosmos/evm/x/ibc/transfer" - ibctransferkeeper "github.com/cosmos/evm/x/ibc/transfer/keeper" "github.com/cosmos/evm/x/vm" // _ "github.com/ethereum/go-ethereum/core/tracers/js" @@ -145,6 +143,8 @@ import ( icahostkeeper "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/host/keeper" icahosttypes "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/host/types" icatypes "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/types" + transfer "github.com/cosmos/ibc-go/v10/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v10/modules/apps/transfer/keeper" ibctransfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types" ibc "github.com/cosmos/ibc-go/v10/modules/core" ibcclienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types" //nolint:staticcheck @@ -850,17 +850,21 @@ func NewChainApp( app.IBCKeeper.ChannelKeeper, // Use ChannelKeeper as ICS4Wrapper ) - // Create Transfer Keepers : upgraded for ibc-go v10 + // Create Transfer Keepers : upgraded for ibc-go v10. + // cosmos/evm v0.6.0 removed its custom x/ibc/transfer wrapper, so this now uses + // the standard ibc-go transfer keeper. ERC-20<>IBC conversion that the custom + // keeper used to perform (it took an Erc20Keeper arg) is now done by the + // erc20 IBC middleware wrapped around the transfer stack below. app.TransferKeeper = ibctransferkeeper.NewKeeper( appCodec, runtime.NewKVStoreService(keys[ibctransfertypes.StoreKey]), + nil, // legacySubspace (no params subspace) app.RatelimitKeeper, // ICS4Wrapper //app.IBCFeeKeeper, app.IBCKeeper.ChannelKeeper, app.MsgServiceRouter(), app.AccountKeeper, app.BankKeeper, - app.Erc20Keeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -961,6 +965,10 @@ func NewChainApp( // Create Transfer Stack var transferStack porttypes.IBCModule transferStack = transfer.NewIBCModule(app.TransferKeeper) + // ERC-20 middleware converts IBC vouchers to/from ERC-20 tokens. In cosmos/evm + // v0.6.0 this replaced the ERC-20 conversion that the removed custom + // x/ibc/transfer keeper performed in its OnRecvPacket/msg-server override. + transferStack = erc20.NewIBCMiddleware(app.Erc20Keeper, transferStack) // callbacks wraps the transfer stack as its base app, and uses PacketForwardKeeper as the ICS4Wrapper // i.e. packet-forward-middleware is higher on the stack and sits between callbacks and the ibc channel keeper // Since this is the lowest level middleware of the transfer stack, it should be the first entrypoint for transfer keeper's diff --git a/app/precompiles.go b/app/precompiles.go index 58bc4c55..0cffa26a 100644 --- a/app/precompiles.go +++ b/app/precompiles.go @@ -20,7 +20,7 @@ import ( slashingprecompile "github.com/cosmos/evm/precompiles/slashing" stakingprecompile "github.com/cosmos/evm/precompiles/staking" erc20Keeper "github.com/cosmos/evm/x/erc20/keeper" - transferkeeper "github.com/cosmos/evm/x/ibc/transfer/keeper" + transferkeeper "github.com/cosmos/ibc-go/v10/modules/apps/transfer/keeper" channelkeeper "github.com/cosmos/ibc-go/v10/modules/core/04-channel/keeper" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/vm" @@ -113,6 +113,7 @@ func NewAvailableStaticPrecompiles( stakingKeeper, transferKeeper, channelKeeper, + erc20Kpr, ) bankPrecompile := bankprecompile.NewPrecompile(bankKeeper, erc20Kpr) diff --git a/go.mod b/go.mod index 62f7b78a..8100fc23 100755 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ replace ( cosmossdk.io/x/upgrade => cosmossdk.io/x/upgrade v0.1.4 github.com/CosmWasm/wasmd => github.com/CosmWasm/wasmd v0.55.0 // Keep v0.55.0 github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.50.10 // Use stable v0.50.10 - github.com/cosmos/evm => github.com/pushchain/evm v1.0.0-rc2.0.20260616081105-96231e7a76c0 + github.com/cosmos/evm => github.com/pushchain/evm v1.0.0-rc2.0.20260627105801-6c22ba0b1e9e github.com/ethereum/go-ethereum => github.com/cosmos/go-ethereum v0.0.0-20250806193535-2fc7571efa91 github.com/spf13/viper => github.com/spf13/viper v1.17.0 github.com/strangelove-ventures/tokenfactory => github.com/strangelove-ventures/tokenfactory v0.50.7-wasmvm2 @@ -56,7 +56,7 @@ require ( cosmossdk.io/x/tx v1.2.0-alpha.1 cosmossdk.io/x/upgrade v0.2.0 github.com/CosmWasm/wasmd v0.51.0 - github.com/cometbft/cometbft v0.38.19 + github.com/cometbft/cometbft v0.38.21 github.com/cosmos/cosmos-db v1.1.3 github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.54.0-alpha.0.0.20250611155041-9fa93c9afe32 @@ -79,7 +79,7 @@ require ( github.com/rs/zerolog v1.34.0 github.com/spf13/cast v1.10.0 github.com/spf13/cobra v1.10.1 - github.com/spf13/viper v1.20.1 + github.com/spf13/viper v1.21.0 github.com/strangelove-ventures/tokenfactory v0.50.7-wasmvm2 github.com/stretchr/testify v1.11.1 google.golang.org/genproto/googleapis/api v0.0.0-20250707201910-8d1bb00bc6a7 @@ -238,7 +238,7 @@ require ( github.com/cosmos/iavl v1.2.6 // indirect github.com/cosmos/ibc-go/modules/light-clients/08-wasm/v10 v10.4.0 github.com/cosmos/ics23/go v0.11.0 // indirect - github.com/cosmos/ledger-cosmos-go v0.16.0 // indirect + github.com/cosmos/ledger-cosmos-go v1.0.0 // indirect github.com/creachadair/atomicfile v0.3.7 // indirect github.com/creachadair/tomledit v0.0.28 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -294,7 +294,7 @@ require ( github.com/hashicorp/yamux v0.1.2 // indirect github.com/hdevalence/ed25519consensus v0.2.0 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect - github.com/holiman/uint256 v1.3.2 // indirect + github.com/holiman/uint256 v1.3.2 github.com/huandu/skiplist v1.2.1 // indirect github.com/huin/goupnp v1.3.0 // indirect github.com/iancoleman/orderedmap v0.3.0 // indirect @@ -343,12 +343,12 @@ require ( github.com/rivo/uniseg v0.2.0 // indirect github.com/rogpeppe/go-internal v1.14.1 // indirect github.com/rs/cors v1.11.1 // indirect - github.com/sagikazarmark/locafero v0.9.0 // indirect + github.com/sagikazarmark/locafero v0.11.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sasha-s/go-deadlock v0.3.5 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect - github.com/sourcegraph/conc v0.3.0 // indirect - github.com/spf13/afero v1.14.0 // indirect + github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect + github.com/spf13/afero v1.15.0 // indirect github.com/spf13/pflag v1.0.10 // indirect github.com/streamingfast/logging v0.0.0-20230608130331-f22c91403091 // indirect github.com/stretchr/objx v0.5.2 // indirect diff --git a/go.sum b/go.sum index 8aab2047..a9066fc1 100755 --- a/go.sum +++ b/go.sum @@ -862,8 +862,8 @@ github.com/cockroachdb/redact v1.1.6/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ github.com/cockroachdb/tokenbucket v0.0.0-20250429170803-42689b6311bb h1:3bCgBvB8PbJVMX1ouCcSIxvsqKPYM7gs72o0zC76n9g= github.com/cockroachdb/tokenbucket v0.0.0-20250429170803-42689b6311bb/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/cometbft/cometbft v0.38.19 h1:vNdtCkvhuwUlrcLPAyigV7lQpmmo+tAq8CsB8gZjEYw= -github.com/cometbft/cometbft v0.38.19/go.mod h1:UCu8dlHqvkAsmAFmWDRWNZJPlu6ya2fTWZlDrWsivwo= +github.com/cometbft/cometbft v0.38.21 h1:qcIJSH9LiwU5s6ZgKR5eRbsLNucbubfraDs5bzgjtOI= +github.com/cometbft/cometbft v0.38.21/go.mod h1:UCu8dlHqvkAsmAFmWDRWNZJPlu6ya2fTWZlDrWsivwo= github.com/cometbft/cometbft-db v1.0.4 h1:cezb8yx/ZWcF124wqUtAFjAuDksS1y1yXedvtprUFxs= github.com/cometbft/cometbft-db v1.0.4/go.mod h1:M+BtHAGU2XLrpUxo3Nn1nOCcnVCiLM9yx5OuT0u5SCA= github.com/consensys/gnark-crypto v0.18.0 h1:vIye/FqI50VeAr0B3dx+YjeIvmc3LWz4yEfbWBpTUf0= @@ -915,8 +915,8 @@ github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5Rtn github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= -github.com/cosmos/ledger-cosmos-go v0.16.0 h1:YKlWPG9NnGZIEUb2bEfZ6zhON1CHlNTg0QKRRGcNEd0= -github.com/cosmos/ledger-cosmos-go v0.16.0/go.mod h1:WrM2xEa8koYoH2DgeIuZXNarF7FGuZl3mrIOnp3Dp0o= +github.com/cosmos/ledger-cosmos-go v1.0.0 h1:jNKW89nPf0vR0EkjHG8Zz16h6p3zqwYEOxlHArwgYtw= +github.com/cosmos/ledger-cosmos-go v1.0.0/go.mod h1:mGaw2wDOf+Z6SfRJsMGxU9DIrBa4du0MAiPlpPhLAOE= 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.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0= @@ -1765,8 +1765,8 @@ github.com/prysmaticlabs/gohashtree v0.0.4-beta.0.20240624100937-73632381301b h1 github.com/prysmaticlabs/gohashtree v0.0.4-beta.0.20240624100937-73632381301b/go.mod h1:HRuvtXLZ4WkaB1MItToVH2e8ZwKwZPY5/Rcby+CvvLY= github.com/prysmaticlabs/prysm/v5 v5.3.0 h1:7Lr8ndapBTZg00YE+MgujN6+yvJR6Bdfn28ZDSJ00II= github.com/prysmaticlabs/prysm/v5 v5.3.0/go.mod h1:r1KhlduqDMIGZ1GhR5pjZ2Ko8Q89noTDYTRoPKwf1+c= -github.com/pushchain/evm v1.0.0-rc2.0.20260616081105-96231e7a76c0 h1:y4oaq20SC2hFSg2/AyLc4iSLu9i6z/mCgyKcsrVyVhg= -github.com/pushchain/evm v1.0.0-rc2.0.20260616081105-96231e7a76c0/go.mod h1:BjKknQX/cnH/v/i2AgtfsJY4g/gihm9n6ilXk2SExUo= +github.com/pushchain/evm v1.0.0-rc2.0.20260627105801-6c22ba0b1e9e h1:KL2DPaFKZ7t7SkXnFQ/V5QEjvPE45Il5AyQvoVWFoMI= +github.com/pushchain/evm v1.0.0-rc2.0.20260627105801-6c22ba0b1e9e/go.mod h1:QuenX5DgRhWeYdIg0J/p65cyS/ntpgnzpZOIajZ/SHk= github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= github.com/quic-go/qtls-go1-20 v0.3.4 h1:MfFAPULvst4yoMgY9QmtpYmfij/em7O8UUi+bNVm7Cg= @@ -1809,8 +1809,8 @@ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245/go.mod h1:pQAZKsJ8yyVxGRWYNEm9oFB8ieLgKFnamEyDmSA0BRk= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/sagikazarmark/locafero v0.9.0 h1:GbgQGNtTrEmddYDSAH9QLRyfAHY12md+8YFTqyMTC9k= -github.com/sagikazarmark/locafero v0.9.0/go.mod h1:UBUyz37V+EdMS3hDF3QWIiVr/2dPrx49OMO0Bn0hJqk= +github.com/sagikazarmark/locafero v0.11.0 h1:1iurJgmM9G3PA/I+wWYIOw/5SyBtxapeHDcg+AAIFXc= +github.com/sagikazarmark/locafero v0.11.0/go.mod h1:nVIGvgyzw595SUSUE6tvCp3YYTeHs15MvlmU87WwIik= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= @@ -1859,8 +1859,8 @@ github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9 github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= -github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= -github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw= +github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U= github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= @@ -1868,8 +1868,8 @@ github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2 github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= -github.com/spf13/afero v1.14.0 h1:9tH6MapGnn/j0eb0yIXiLjERO8RB6xIVZRDCX7PtqWA= -github.com/spf13/afero v1.14.0/go.mod h1:acJQ8t0ohCGuMN3O+Pv0V0hgMxNYDlvdk+VTfyZmbYo= +github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I= +github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg= github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY= github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= @@ -2061,8 +2061,8 @@ go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= -go.yaml.in/yaml/v3 v3.0.3 h1:bXOww4E/J3f66rav3pX3m8w6jDE4knZjGOw8b5Y6iNE= -go.yaml.in/yaml/v3 v3.0.3/go.mod h1:tBHosrYAkRZjRAOREWbDnBXUf08JOwYq++0QNwQiWzI= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= golang.org/x/arch v0.17.0 h1:4O3dfLzd+lQewptAHqjewQZQDyEdejz3VwgeYwkZneU= golang.org/x/arch v0.17.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk= diff --git a/test/integration/uexecutor/inbound_cea_gas_and_payload_test.go b/test/integration/uexecutor/inbound_cea_gas_and_payload_test.go index a1df82cf..c0f6f3c9 100644 --- a/test/integration/uexecutor/inbound_cea_gas_and_payload_test.go +++ b/test/integration/uexecutor/inbound_cea_gas_and_payload_test.go @@ -468,10 +468,12 @@ func TestInboundCEAGasAndPayload(t *testing.T) { // Check that PRC20 was deposited into the UEA (recipient) res, err := chainApp.EVMKeeper.CallEVM( ctx, + chainApp.EVMKeeper.NewStateDB(ctx), prc20ABI, ueModuleAccAddress, prc20Address, false, + false, nil, "balanceOf", ueaAddrHex, @@ -497,7 +499,7 @@ func TestInboundCEAGasAndPayload(t *testing.T) { chainApp.UregistryKeeper.AddChainConfig(ctx, &uregistrytypes.ChainConfig{ Chain: "eip155:97", VmType: uregistrytypes.VmType_EVM, - PublicRpcUrl: "https://data-seed-prebsc-1-s1.binance.org:8545", + PublicRpcUrl: "https://data-seed-prebsc-1-s1.binance.org:8545", GatewayAddress: "0x0000000000000000000000000000000000000000", BlockConfirmation: &uregistrytypes.BlockConfirmation{ FastInbound: 5, diff --git a/test/integration/uexecutor/inbound_cea_payload_test.go b/test/integration/uexecutor/inbound_cea_payload_test.go index 1cb993af..d69d6900 100644 --- a/test/integration/uexecutor/inbound_cea_payload_test.go +++ b/test/integration/uexecutor/inbound_cea_payload_test.go @@ -27,9 +27,9 @@ func setupInboundCEAPayloadTest(t *testing.T, numVals int) (*app.ChainApp, sdk.C chainApp, ctx, _, validators := utils.SetAppWithMultipleValidators(t, numVals) chainConfigTest := uregistrytypes.ChainConfig{ - Chain: "eip155:11155111", - VmType: uregistrytypes.VmType_EVM, - PublicRpcUrl: "https://sepolia.drpc.org", + Chain: "eip155:11155111", + VmType: uregistrytypes.VmType_EVM, + PublicRpcUrl: "https://sepolia.drpc.org", GatewayAddress: "0x28E0F09bE2321c1420Dc60Ee146aACbD68B335Fe", BlockConfirmation: &uregistrytypes.BlockConfirmation{ FastInbound: 5, @@ -227,10 +227,12 @@ func TestInboundCEAFundsAndPayload(t *testing.T) { // Check that PRC20 was deposited into the UEA (recipient) res, err := chainApp.EVMKeeper.CallEVM( ctx, + chainApp.EVMKeeper.NewStateDB(ctx), prc20ABI, ueModuleAccAddress, prc20Address, false, + false, nil, "balanceOf", ueaAddrHex, @@ -597,7 +599,7 @@ func TestInboundCEAFundsAndPayload(t *testing.T) { ceaInbound := &uexecutortypes.Inbound{ SourceChain: "eip155:11155111", TxHash: "0xcea07", - Sender: personBSender, // person B — no UEA + Sender: personBSender, // person B — no UEA Recipient: ueaAddrHex.String(), // person A's UEA Amount: "1000000", AssetAddr: usdcAddress.String(), @@ -633,10 +635,12 @@ func TestInboundCEAFundsAndPayload(t *testing.T) { // Confirm the PRC20 balance landed at the explicitly passed recipient (person A's UEA) res, err := chainApp.EVMKeeper.CallEVM( ctx, + chainApp.EVMKeeper.NewStateDB(ctx), prc20ABI, ueModuleAccAddress, prc20Address, false, + false, nil, "balanceOf", ueaAddrHex, @@ -726,7 +730,7 @@ func TestInboundCEAFundsAndPayload(t *testing.T) { chainApp.UregistryKeeper.AddChainConfig(ctx, &uregistrytypes.ChainConfig{ Chain: "eip155:97", VmType: uregistrytypes.VmType_EVM, - PublicRpcUrl: "https://data-seed-prebsc-1-s1.binance.org:8545", + PublicRpcUrl: "https://data-seed-prebsc-1-s1.binance.org:8545", GatewayAddress: "0x0000000000000000000000000000000000000000", BlockConfirmation: &uregistrytypes.BlockConfirmation{ FastInbound: 5, diff --git a/test/integration/uexecutor/inbound_cea_smart_contract_test.go b/test/integration/uexecutor/inbound_cea_smart_contract_test.go index b31dc182..dfea7d68 100644 --- a/test/integration/uexecutor/inbound_cea_smart_contract_test.go +++ b/test/integration/uexecutor/inbound_cea_smart_contract_test.go @@ -239,10 +239,12 @@ func TestInboundCEASmartContractRecipient(t *testing.T) { res, err := chainApp.EVMKeeper.CallEVM( ctx, + chainApp.EVMKeeper.NewStateDB(ctx), prc20ABI, ueModuleAccAddress, prc20Address, false, + false, nil, "balanceOf", contractAddr, @@ -455,7 +457,7 @@ func TestInboundCEASmartContractRecipient(t *testing.T) { ueModuleAccAddress, _ := chainApp.UexecutorKeeper.GetUeModuleAddress(ctx) res, err := chainApp.EVMKeeper.CallEVM( - ctx, prc20ABI, ueModuleAccAddress, prc20Address, false, nil, "balanceOf", recipientAddr, + ctx, chainApp.EVMKeeper.NewStateDB(ctx), prc20ABI, ueModuleAccAddress, prc20Address, false, false, nil, "balanceOf", recipientAddr, ) require.NoError(t, err) balances, err := prc20ABI.Unpack("balanceOf", res.Ret) diff --git a/test/integration/uexecutor/inbound_solana_test.go b/test/integration/uexecutor/inbound_solana_test.go index 4fdd8d78..ca9d75ae 100644 --- a/test/integration/uexecutor/inbound_solana_test.go +++ b/test/integration/uexecutor/inbound_solana_test.go @@ -142,7 +142,7 @@ func TestSolanaInboundFunds(t *testing.T) { recipient := common.HexToAddress(inbound.Recipient) // Check initial balance is 0 - res, err := app.EVMKeeper.CallEVM(ctx, prc20ABI, ueModuleAccAddress, prc20Address, false, nil, "balanceOf", recipient) + res, err := app.EVMKeeper.CallEVM(ctx, app.EVMKeeper.NewStateDB(ctx), prc20ABI, ueModuleAccAddress, prc20Address, false, false, nil, "balanceOf", recipient) require.NoError(t, err) balances, _ := prc20ABI.Unpack("balanceOf", res.Ret) require.Equal(t, int64(0), balances[0].(*big.Int).Int64()) @@ -156,7 +156,7 @@ func TestSolanaInboundFunds(t *testing.T) { require.False(t, isPending) // PRC20 balance should equal inbound amount - res, err = app.EVMKeeper.CallEVM(ctx, prc20ABI, ueModuleAccAddress, prc20Address, false, nil, "balanceOf", recipient) + res, err = app.EVMKeeper.CallEVM(ctx, app.EVMKeeper.NewStateDB(ctx), prc20ABI, ueModuleAccAddress, prc20Address, false, false, nil, "balanceOf", recipient) require.NoError(t, err) balances, _ = prc20ABI.Unpack("balanceOf", res.Ret) expected := new(big.Int) @@ -179,7 +179,7 @@ func TestSolanaInboundFunds(t *testing.T) { voteToQuorum(t, ctx, app, vals, coreVals, &inbound2) // Balance should be 2x - res, err := app.EVMKeeper.CallEVM(ctx, prc20ABI, ueModuleAccAddress, prc20Address, false, nil, "balanceOf", recipient) + res, err := app.EVMKeeper.CallEVM(ctx, app.EVMKeeper.NewStateDB(ctx), prc20ABI, ueModuleAccAddress, prc20Address, false, false, nil, "balanceOf", recipient) require.NoError(t, err) balances, _ := prc20ABI.Unpack("balanceOf", res.Ret) expected := new(big.Int) diff --git a/test/integration/uexecutor/inbound_synthetic_bridge_test.go b/test/integration/uexecutor/inbound_synthetic_bridge_test.go index 50fbeea3..c5263c25 100644 --- a/test/integration/uexecutor/inbound_synthetic_bridge_test.go +++ b/test/integration/uexecutor/inbound_synthetic_bridge_test.go @@ -179,10 +179,12 @@ func TestInboundSyntheticBridge(t *testing.T) { // --- Query PRC20 balanceOf(recipient) --- res, err := app.EVMKeeper.CallEVM( ctx, + app.EVMKeeper.NewStateDB(ctx), prc20ABI, ueModuleAccAddress, // "from" (doesn't matter for view) prc20Address, // contract address - false, // commit = false (read-only) + false, + false, // commit = false (read-only) nil, "balanceOf", recipient, @@ -261,7 +263,7 @@ func TestInboundSyntheticBridge(t *testing.T) { recipient := common.HexToAddress(inbound.Recipient) // check initial balance == 0 - res, err := app.EVMKeeper.CallEVM(ctx, prc20ABI, ueModuleAccAddress, prc20Address, false, nil, "balanceOf", recipient) + res, err := app.EVMKeeper.CallEVM(ctx, app.EVMKeeper.NewStateDB(ctx), prc20ABI, ueModuleAccAddress, prc20Address, false, false, nil, "balanceOf", recipient) require.NoError(t, err) balances, _ := prc20ABI.Unpack("balanceOf", res.Ret) balance := balances[0].(*big.Int) @@ -278,7 +280,7 @@ func TestInboundSyntheticBridge(t *testing.T) { } // balance should equal inbound amount - res, err = app.EVMKeeper.CallEVM(ctx, prc20ABI, ueModuleAccAddress, prc20Address, false, nil, "balanceOf", recipient) + res, err = app.EVMKeeper.CallEVM(ctx, app.EVMKeeper.NewStateDB(ctx), prc20ABI, ueModuleAccAddress, prc20Address, false, false, nil, "balanceOf", recipient) require.NoError(t, err) balances, _ = prc20ABI.Unpack("balanceOf", res.Ret) expected := new(big.Int) @@ -315,7 +317,7 @@ func TestInboundSyntheticBridge(t *testing.T) { } // balance should equal 2 * inbound.Amount - res, err := app.EVMKeeper.CallEVM(ctx, prc20ABI, ueModuleAccAddress, prc20Address, false, nil, "balanceOf", recipient) + res, err := app.EVMKeeper.CallEVM(ctx, app.EVMKeeper.NewStateDB(ctx), prc20ABI, ueModuleAccAddress, prc20Address, false, false, nil, "balanceOf", recipient) require.NoError(t, err) balances, _ := prc20ABI.Unpack("balanceOf", res.Ret) diff --git a/test/integration/uexecutor/vote_chain_meta_test.go b/test/integration/uexecutor/vote_chain_meta_test.go index 9bc81a9b..b75fe4da 100644 --- a/test/integration/uexecutor/vote_chain_meta_test.go +++ b/test/integration/uexecutor/vote_chain_meta_test.go @@ -256,7 +256,7 @@ func TestVoteChainMetaIntegration(t *testing.T) { ucABI, err := uexecutortypes.ParseUniversalCoreABI() require.NoError(t, err) caller, _ := testApp.UexecutorKeeper.GetUeModuleAddress(ctx) - res, err := testApp.EVMKeeper.CallEVM(ctx, ucABI, caller, universalCoreAddr, false, nil, "gasPriceByChainNamespace", chainId) + res, err := testApp.EVMKeeper.CallEVM(ctx, testApp.EVMKeeper.NewStateDB(ctx), ucABI, caller, universalCoreAddr, false, false, nil, "gasPriceByChainNamespace", chainId) require.NoError(t, err) appliedPrice := new(big.Int).SetBytes(res.Ret) require.Equal(t, new(big.Int).SetUint64(900), appliedPrice, "stale votes must not influence the applied median price") @@ -392,14 +392,14 @@ func TestVoteChainMetaContractState(t *testing.T) { caller, _ := testApp.UexecutorKeeper.GetUeModuleAddress(ctx) t.Run("gasPriceByChainNamespace matches voted price", func(t *testing.T) { - res, err := testApp.EVMKeeper.CallEVM(ctx, ucABI, caller, universalCoreAddr, false, nil, "gasPriceByChainNamespace", chainId) + res, err := testApp.EVMKeeper.CallEVM(ctx, testApp.EVMKeeper.NewStateDB(ctx), ucABI, caller, universalCoreAddr, false, false, nil, "gasPriceByChainNamespace", chainId) require.NoError(t, err) got := new(big.Int).SetBytes(res.Ret) require.Equal(t, new(big.Int).SetUint64(price), got) }) t.Run("chainHeightByChainNamespace matches voted height", func(t *testing.T) { - res, err := testApp.EVMKeeper.CallEVM(ctx, ucABI, caller, universalCoreAddr, false, nil, "chainHeightByChainNamespace", chainId) + res, err := testApp.EVMKeeper.CallEVM(ctx, testApp.EVMKeeper.NewStateDB(ctx), ucABI, caller, universalCoreAddr, false, false, nil, "chainHeightByChainNamespace", chainId) require.NoError(t, err) got := new(big.Int).SetBytes(res.Ret) require.Equal(t, new(big.Int).SetUint64(height), got) diff --git a/test/integration/utss/fund_migration_test.go b/test/integration/utss/fund_migration_test.go index b6564ce9..13595e64 100644 --- a/test/integration/utss/fund_migration_test.go +++ b/test/integration/utss/fund_migration_test.go @@ -82,13 +82,13 @@ func seedFundMigrationChainValues( var roleArg [32]byte copy(roleArg[:], managerRole.Bytes()) - _, err = chainApp.EVMKeeper.CallEVM(ctx, setupABI, admin, handlerAddr, true, nil, "grantRole", roleArg, admin) + _, err = chainApp.EVMKeeper.CallEVM(ctx, chainApp.EVMKeeper.NewStateDB(ctx), setupABI, admin, handlerAddr, true, false, nil, "grantRole", roleArg, admin) require.NoError(t, err, "grant MANAGER_ROLE") - _, err = chainApp.EVMKeeper.CallEVM(ctx, setupABI, admin, handlerAddr, true, nil, "setTssFundMigrationGasLimitByChain", chain, gasLimit) + _, err = chainApp.EVMKeeper.CallEVM(ctx, chainApp.EVMKeeper.NewStateDB(ctx), setupABI, admin, handlerAddr, true, false, nil, "setTssFundMigrationGasLimitByChain", chain, gasLimit) require.NoError(t, err, "seed tss fund migration gas limit") - _, err = chainApp.EVMKeeper.CallEVM(ctx, setupABI, admin, handlerAddr, true, nil, "setL1GasFeeByChain", chain, l1GasFee) + _, err = chainApp.EVMKeeper.CallEVM(ctx, chainApp.EVMKeeper.NewStateDB(ctx), setupABI, admin, handlerAddr, true, false, nil, "setL1GasFeeByChain", chain, l1GasFee) require.NoError(t, err, "seed l1 gas fee") } diff --git a/test/utils/contracts_setup.go b/test/utils/contracts_setup.go index edaca4cc..dc588b29 100644 --- a/test/utils/contracts_setup.go +++ b/test/utils/contracts_setup.go @@ -89,10 +89,12 @@ func setupHandlerContract( // Set UEA proxy implementation _, err := app.EVMKeeper.CallEVM( ctx, + app.EVMKeeper.NewStateDB(ctx), handlerABI, owner, handlerAddr, true, + false, nil, "initialize", common.HexToAddress(WPCAddress), @@ -116,16 +118,16 @@ func setupFactoryContract( owner := common.BytesToAddress(accounts.DefaultAccount.GetAddress().Bytes()) // Check initial factory owner - ownerResult, err := app.EVMKeeper.CallEVM(ctx, factoryABI, owner, factoryAddr, true, nil, "owner") + ownerResult, err := app.EVMKeeper.CallEVM(ctx, app.EVMKeeper.NewStateDB(ctx), factoryABI, owner, factoryAddr, true, false, nil, "owner") require.NoError(t, err) t.Logf("Factory owner after genesis: %s", common.BytesToAddress(ownerResult.Ret).Hex()) // Initialize factory with owner - _, err = app.EVMKeeper.CallEVM(ctx, factoryABI, owner, factoryAddr, true, nil, "initialize", owner) + _, err = app.EVMKeeper.CallEVM(ctx, app.EVMKeeper.NewStateDB(ctx), factoryABI, owner, factoryAddr, true, false, nil, "initialize", owner) require.NoError(t, err) // Verify owner is set - ownerResult, err = app.EVMKeeper.CallEVM(ctx, factoryABI, owner, factoryAddr, true, nil, "owner") + ownerResult, err = app.EVMKeeper.CallEVM(ctx, app.EVMKeeper.NewStateDB(ctx), factoryABI, owner, factoryAddr, true, false, nil, "owner") require.NoError(t, err) t.Logf("Factory owner after initialization: %s", common.BytesToAddress(ownerResult.Ret).Hex()) @@ -141,10 +143,12 @@ func setupFactoryContract( // Set UEA proxy implementation receipt, err := app.EVMKeeper.CallEVM( ctx, + app.EVMKeeper.NewStateDB(ctx), factoryABI, owner, factoryAddr, true, + false, nil, "setUEAProxyImplementation", ProxyAddress, @@ -178,10 +182,12 @@ func setupPrc20Contract( // Set UEA proxy implementation _, err := app.EVMKeeper.CallEVM( ctx, + app.EVMKeeper.NewStateDB(ctx), prc20ABI, ueModuleAccAddress, prc20Addr, true, + false, nil, "updateHandlerContract", opts.Addresses.HandlerAddr, @@ -218,10 +224,12 @@ func registerEVMChainAndUEA( // Register new EVM chain _, err = chainApp.EVMKeeper.CallEVM( ctx, + chainApp.EVMKeeper.NewStateDB(ctx), factoryABI, owner, factoryAddr, true, + false, nil, "registerNewChain", ChainHashEVM, @@ -249,10 +257,12 @@ func registerEVMChainAndUEA( // Register UEA : EVM _, err = chainApp.EVMKeeper.CallEVM( ctx, + chainApp.EVMKeeper.NewStateDB(ctx), factoryABI, owner, factoryAddr, true, + false, nil, "registerUEA", ChainHashEVM, @@ -264,10 +274,12 @@ func registerEVMChainAndUEA( // Get UEA (EVM) address ueaAddrResultEVM, err := chainApp.EVMKeeper.CallEVM( ctx, + chainApp.EVMKeeper.NewStateDB(ctx), factoryABI, owner, factoryAddr, true, + false, nil, "getUEA", ChainHashEVM, diff --git a/x/uexecutor/keeper/evm.go b/x/uexecutor/keeper/evm.go index 98cce158..b210e051 100644 --- a/x/uexecutor/keeper/evm.go +++ b/x/uexecutor/keeper/evm.go @@ -30,10 +30,12 @@ func (k Keeper) CallFactoryToGetUEAAddressForOrigin( receipt, err := k.evmKeeper.CallEVM( ctx, + k.evmKeeper.NewStateDB(ctx), abi, from, factoryAddr, false, // commit + false, // callFromPrecompile nil, "getUEAForOrigin", abiUniversalAccount, @@ -66,10 +68,12 @@ func (k Keeper) CallFactoryGetOriginForUEA( receipt, err := k.evmKeeper.CallEVM( ctx, + k.evmKeeper.NewStateDB(ctx), abi, from, factoryAddr, false, // commit + false, // callFromPrecompile nil, "getOriginForUEA", ueaAddr, @@ -238,10 +242,12 @@ func (k Keeper) CallUEADomainSeparator( // Call the view function domainSeparator() res, err := k.evmKeeper.CallEVM( ctx, + k.evmKeeper.NewStateDB(ctx), abi, from, ueaAddr, false, // commit = false (static call) + false, // callFromPrecompile nil, "domainSeparator", ) @@ -357,7 +363,7 @@ func (k Keeper) GetGasPriceByChain(ctx sdk.Context, chainNamespace string) (*big ueModuleAccAddress, _ := k.GetUeModuleAddress(ctx) - receipt, err := k.evmKeeper.CallEVM(ctx, abi, ueModuleAccAddress, handlerAddr, false, nil, "gasPriceByChainNamespace", chainNamespace) + receipt, err := k.evmKeeper.CallEVM(ctx, k.evmKeeper.NewStateDB(ctx), abi, ueModuleAccAddress, handlerAddr, false, false, nil,"gasPriceByChainNamespace", chainNamespace) if err != nil { return nil, errors.Wrap(err, "failed to call gasPriceByChainNamespace") } @@ -382,7 +388,7 @@ func (k Keeper) GetL1GasFeeByChain(ctx sdk.Context, chainNamespace string) (*big ueModuleAccAddress, _ := k.GetUeModuleAddress(ctx) - receipt, err := k.evmKeeper.CallEVM(ctx, abi, ueModuleAccAddress, handlerAddr, false, nil, "l1GasFeeByChainNamespace", chainNamespace) + receipt, err := k.evmKeeper.CallEVM(ctx, k.evmKeeper.NewStateDB(ctx), abi, ueModuleAccAddress, handlerAddr, false, false, nil,"l1GasFeeByChainNamespace", chainNamespace) if err != nil { return nil, errors.Wrap(err, "failed to call l1GasFeeByChainNamespace") } @@ -406,7 +412,7 @@ func (k Keeper) GetTssFundMigrationGasLimitByChain(ctx sdk.Context, chainNamespa ueModuleAccAddress, _ := k.GetUeModuleAddress(ctx) - receipt, err := k.evmKeeper.CallEVM(ctx, abi, ueModuleAccAddress, handlerAddr, false, nil, "tssFundMigrationGasLimitByChainNamespace", chainNamespace) + receipt, err := k.evmKeeper.CallEVM(ctx, k.evmKeeper.NewStateDB(ctx), abi, ueModuleAccAddress, handlerAddr, false, false, nil,"tssFundMigrationGasLimitByChainNamespace", chainNamespace) if err != nil { return nil, errors.Wrap(err, "failed to call tssFundMigrationGasLimitByChainNamespace") } @@ -430,7 +436,7 @@ func (k Keeper) GetUniversalCoreQuoterAddress(ctx sdk.Context) (common.Address, ueModuleAccAddress, _ := k.GetUeModuleAddress(ctx) - receipt, err := k.evmKeeper.CallEVM(ctx, abi, ueModuleAccAddress, handlerAddr, false, nil, "uniswapV3Quoter") + receipt, err := k.evmKeeper.CallEVM(ctx, k.evmKeeper.NewStateDB(ctx), abi, ueModuleAccAddress, handlerAddr, false, false, nil,"uniswapV3Quoter") if err != nil { return common.Address{}, errors.Wrap(err, "failed to call uniswapV3Quoter") } @@ -454,7 +460,7 @@ func (k Keeper) GetUniversalCoreWPCAddress(ctx sdk.Context) (common.Address, err ueModuleAccAddress, _ := k.GetUeModuleAddress(ctx) - receipt, err := k.evmKeeper.CallEVM(ctx, abi, ueModuleAccAddress, handlerAddr, false, nil, "WPC") + receipt, err := k.evmKeeper.CallEVM(ctx, k.evmKeeper.NewStateDB(ctx), abi, ueModuleAccAddress, handlerAddr, false, false, nil,"WPC") if err != nil { return common.Address{}, errors.Wrap(err, "failed to call WPC") } @@ -478,7 +484,7 @@ func (k Keeper) GetDefaultFeeTierForToken(ctx sdk.Context, prc20Address common.A ueModuleAccAddress, _ := k.GetUeModuleAddress(ctx) - receipt, err := k.evmKeeper.CallEVM(ctx, abi, ueModuleAccAddress, handlerAddr, false, nil, "defaultFeeTier", prc20Address) + receipt, err := k.evmKeeper.CallEVM(ctx, k.evmKeeper.NewStateDB(ctx), abi, ueModuleAccAddress, handlerAddr, false, false, nil,"defaultFeeTier", prc20Address) if err != nil { return nil, errors.Wrap(err, "failed to call defaultFeeTier") } @@ -519,7 +525,7 @@ func (k Keeper) GetSwapQuote( SqrtPriceLimitX96: big.NewInt(0), } - receipt, err := k.evmKeeper.CallEVM(ctx, quoterABI, ueModuleAccAddress, quoterAddr, false, nil, "quoteExactInputSingle", params) + receipt, err := k.evmKeeper.CallEVM(ctx, k.evmKeeper.NewStateDB(ctx), quoterABI, ueModuleAccAddress, quoterAddr, false, false, nil, "quoteExactInputSingle", params) if err != nil { return nil, errors.Wrap(err, "QuoterV2 quoteExactInputSingle failed") } diff --git a/x/uexecutor/keeper/gas_fee.go b/x/uexecutor/keeper/gas_fee.go index 183ba9ce..3f8c249e 100644 --- a/x/uexecutor/keeper/gas_fee.go +++ b/x/uexecutor/keeper/gas_fee.go @@ -33,7 +33,7 @@ func (k Keeper) GetOutboundTxGasAndFees(ctx sdk.Context, prc20 common.Address, g ueModuleAccAddress, _ := k.GetUeModuleAddress(ctx) - receipt, err := k.evmKeeper.CallEVM(ctx, ucABI, ueModuleAccAddress, handlerAddr, false, nil, + receipt, err := k.evmKeeper.CallEVM(ctx, k.evmKeeper.NewStateDB(ctx), ucABI, ueModuleAccAddress, handlerAddr, false, false, nil, "getOutboundTxGasAndFees", prc20, gasLimitWithBaseLimit) if err != nil { return nil, errors.Wrap(err, "failed to call getOutboundTxGasAndFees") diff --git a/x/uexecutor/keeper/msg_server_test.go b/x/uexecutor/keeper/msg_server_test.go index 6a63dc3f..4465e1e4 100755 --- a/x/uexecutor/keeper/msg_server_test.go +++ b/x/uexecutor/keeper/msg_server_test.go @@ -143,7 +143,8 @@ func TestMsgServer_ExecutePayload(t *testing.T) { f.mockUregistryKeeper.EXPECT().GetChainConfig(gomock.Any(), "eip155:11155111").Return(chainConfigTest, nil) - f.mockEVMKeeper.EXPECT().CallEVM(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, errors.New("CallFactoryToComputeUEAAddress Failed")) + f.mockEVMKeeper.EXPECT().NewStateDB(gomock.Any()).Return(nil).AnyTimes() + f.mockEVMKeeper.EXPECT().CallEVM(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, errors.New("CallFactoryToComputeUEAAddress Failed")) _, err := f.msgServer.ExecutePayload(f.ctx, msg) require.ErrorContains(t, err, "CallFactoryToComputeUEAAddress Failed") @@ -257,7 +258,8 @@ func TestMsgServer_MigrateUEA(t *testing.T) { f.mockUregistryKeeper.EXPECT().GetChainConfig(gomock.Any(), "eip155:11155111").Return(chainConfigTest, nil) - f.mockEVMKeeper.EXPECT().CallEVM(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, errors.New("CallFactoryToComputeUEAAddress Failed")).AnyTimes() + f.mockEVMKeeper.EXPECT().NewStateDB(gomock.Any()).Return(nil).AnyTimes() + f.mockEVMKeeper.EXPECT().CallEVM(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, errors.New("CallFactoryToComputeUEAAddress Failed")).AnyTimes() _, err := f.msgServer.MigrateUEA(f.ctx, msg) require.ErrorContains(t, err, "CallFactoryToComputeUEAAddress Failed") diff --git a/x/uexecutor/mocks/mock_evmkeeper.go b/x/uexecutor/mocks/mock_evmkeeper.go index 0c1f0487..f5cd1d64 100644 --- a/x/uexecutor/mocks/mock_evmkeeper.go +++ b/x/uexecutor/mocks/mock_evmkeeper.go @@ -40,9 +40,9 @@ func (m *MockEVMKeeper) EXPECT() *MockEVMKeeperMockRecorder { } // CallEVM mocks base method. -func (m *MockEVMKeeper) CallEVM(ctx types.Context, abi abi.ABI, from, contract common.Address, commit bool, gasCap *big.Int, method string, args ...interface{}) (*types0.MsgEthereumTxResponse, error) { +func (m *MockEVMKeeper) CallEVM(ctx types.Context, stateDB *statedb.StateDB, abi abi.ABI, from, contract common.Address, commit, callFromPrecompile bool, gasCap *big.Int, method string, args ...interface{}) (*types0.MsgEthereumTxResponse, error) { m.ctrl.T.Helper() - varargs := []interface{}{ctx, abi, from, contract, commit, gasCap, method} + varargs := []interface{}{ctx, stateDB, abi, from, contract, commit, callFromPrecompile, gasCap, method} for _, a := range args { varargs = append(varargs, a) } @@ -53,12 +53,26 @@ func (m *MockEVMKeeper) CallEVM(ctx types.Context, abi abi.ABI, from, contract c } // CallEVM indicates an expected call of CallEVM. -func (mr *MockEVMKeeperMockRecorder) CallEVM(ctx, abi, from, contract, commit, gasCap, method interface{}, args ...interface{}) *gomock.Call { +func (mr *MockEVMKeeperMockRecorder) CallEVM(ctx, stateDB, abi, from, contract, commit, callFromPrecompile, gasCap, method interface{}, args ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, abi, from, contract, commit, gasCap, method}, args...) + varargs := append([]interface{}{ctx, stateDB, abi, from, contract, commit, callFromPrecompile, gasCap, method}, args...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CallEVM", reflect.TypeOf((*MockEVMKeeper)(nil).CallEVM), varargs...) } +// NewStateDB mocks base method. +func (m *MockEVMKeeper) NewStateDB(ctx types.Context) *statedb.StateDB { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NewStateDB", ctx) + ret0, _ := ret[0].(*statedb.StateDB) + return ret0 +} + +// NewStateDB indicates an expected call of NewStateDB. +func (mr *MockEVMKeeperMockRecorder) NewStateDB(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewStateDB", reflect.TypeOf((*MockEVMKeeper)(nil).NewStateDB), ctx) +} + // GetCodeHash mocks base method. func (m *MockEVMKeeper) GetCodeHash(ctx types.Context, addr common.Address) common.Hash { m.ctrl.T.Helper() diff --git a/x/uexecutor/types/expected_keepers.go b/x/uexecutor/types/expected_keepers.go index 788d3e5f..f08a6dff 100644 --- a/x/uexecutor/types/expected_keepers.go +++ b/x/uexecutor/types/expected_keepers.go @@ -30,11 +30,15 @@ type UregistryKeeper interface { // EVMKeeper defines the expected interface for the EVM module. type EVMKeeper interface { + // NewStateDB returns a fresh StateDB (empty TxConfig) to pass into CallEVM, + // which since cosmos/evm v0.6.0 requires a non-nil StateDB. + NewStateDB(ctx sdk.Context) *statedb.StateDB CallEVM( ctx sdk.Context, + stateDB *statedb.StateDB, abi abi.ABI, from, contract common.Address, - commit bool, + commit, callFromPrecompile bool, gasCap *big.Int, method string, args ...interface{},