From b2b9f038d24540f43f3c688a422c331749c4e390 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Mon, 8 Apr 2024 09:19:04 +0800 Subject: [PATCH 01/15] Problem: go-block-stm is not integrated for parallel tx execution - integrate go-block-stm as tx executor - small optimiations fix --- CHANGELOG.md | 16 ++- app/app.go | 30 +++- app/executor.go | 132 ++++++++++++++++++ go.mod | 4 +- go.sum | 12 +- gomod2nix.toml | 14 +- server/config/config.go | 5 + server/config/toml.go | 5 + server/flags/flags.go | 6 +- tests/importer/importer_test.go | 3 +- .../integration_tests/configs/default.jsonnet | 3 + x/evm/keeper/abci.go | 6 +- x/evm/keeper/gas.go | 1 - x/evm/types/chain_config.go | 4 +- x/evm/types/interfaces.go | 1 + x/evm/types/logs.go | 2 +- x/evm/types/msg.go | 2 +- x/evm/types/utils.go | 8 ++ x/evm/types/utils_test.go | 8 +- 19 files changed, 226 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 269d4c3597..27870e0055 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,15 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## Unreleased +### Features + +* (evm) [#414](https://github.com/crypto-org-chain/ethermint/pull/414) Integrate go-block-stm for parallel tx execution. + +### State Machine Breaking + +* (rpc) [#443](https://github.com/crypto-org-chain/ethermint/pull/443) Keep behavior of random opcode as before. +* (app) [#451](https://github.com/crypto-org-chain/ethermint/pull/451) Disable block gas meter, it's not compatible with parallel tx execution. It's safe to do as long as we checks total gas-wanted against block gas limit in process proposal, which we do in default handler. + ### Bug Fixes - (ante) [#422](https://github.com/crypto-org-chain/ethermint/pull/422) vendor `NewDeductFeeDecorator` to re-use the custom `checkTxFeeWithValidatorMinGasPrices` method, so it'll repsect the `DefaultPriorityReduction` config. @@ -52,13 +61,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (evm) [#450](https://github.com/crypto-org-chain/ethermint/pull/450) Refactor transient stores to be compatible with parallel tx execution. * (evm) [#454](https://github.com/crypto-org-chain/ethermint/pull/454) Migrate transient stores to object stores. -### State Machine Breaking - -* (rpc) [#443](https://github.com/crypto-org-chain/ethermint/pull/443) Keep behavior of random opcode as before. -* (app) [#451](https://github.com/crypto-org-chain/ethermint/pull/451) Disable block gas meter, it's not compatible with parallel tx execution. It's safe to do as long as we checks total gas-wanted against block gas limit in process proposal, which we do in default handler. - -### Features - ## v0.21.x-cronos ### Features diff --git a/app/app.go b/app/app.go index 872310ec48..e21ea27108 100644 --- a/app/app.go +++ b/app/app.go @@ -23,6 +23,7 @@ import ( "net/http" "os" "path/filepath" + "sort" autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" @@ -314,7 +315,6 @@ func NewEthermintApp( bApp.SetVersion(version.Version) bApp.SetInterfaceRegistry(interfaceRegistry) bApp.SetTxEncoder(txConfig.TxEncoder()) - bApp.SetTxExecutor(DefaultTxExecutor) bApp.SetDisableBlockGasMeter(true) keys := storetypes.NewKVStoreKeys( @@ -354,6 +354,15 @@ func NewEthermintApp( okeys: okeys, } + executor := cast.ToString(appOpts.Get(srvflags.EVMBlockExecutor)) + if executor == "block-stm" { + sdk.SetAddrCacheEnabled(false) + workers := cast.ToInt(appOpts.Get(srvflags.EVMBlockSTMWorkers)) + app.SetTxExecutor(STMTxExecutor(app.GetStoreKeys(), workers)) + } else { + app.SetTxExecutor(DefaultTxExecutor) + } + // init params keeper and subspaces app.ParamsKeeper = initParamsKeeper(appCodec, cdc, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey]) @@ -981,6 +990,25 @@ func (app *EthermintApp) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { return app.memKeys[storeKey] } +// GetStoreKeys returns all the stored store keys. +func (app *EthermintApp) GetStoreKeys() []storetypes.StoreKey { + keys := make([]storetypes.StoreKey, 0, len(app.keys)) + for _, key := range app.keys { + keys = append(keys, key) + } + for _, key := range app.tkeys { + keys = append(keys, key) + } + for _, key := range app.memKeys { + keys = append(keys, key) + } + for _, key := range app.okeys { + keys = append(keys, key) + } + sort.SliceStable(keys, func(i, j int) bool { return keys[i].Name() < keys[j].Name() }) + return keys +} + // GetSubspace returns a param subspace for a given module name. // // NOTE: This is solely to be used for testing purposes. diff --git a/app/executor.go b/app/executor.go index 54a49f587f..8448342b1e 100644 --- a/app/executor.go +++ b/app/executor.go @@ -2,10 +2,16 @@ package app import ( "context" + "io" + "cosmossdk.io/store/cachemulti" storetypes "cosmossdk.io/store/types" abci "github.com/cometbft/cometbft/abci/types" evmtypes "github.com/evmos/ethermint/x/evm/types" + + "github.com/cosmos/cosmos-sdk/baseapp" + + block_stm "github.com/yihuang/go-block-stm" ) func DefaultTxExecutor(_ context.Context, @@ -19,3 +25,129 @@ func DefaultTxExecutor(_ context.Context, } return evmtypes.PatchTxResponses(results), nil } + +func STMTxExecutor(stores []storetypes.StoreKey, workers int) baseapp.TxExecutor { + index := make(map[storetypes.StoreKey]int, len(stores)) + for i, k := range stores { + index[k] = i + } + return func( + ctx context.Context, + blockSize int, + ms storetypes.MultiStore, + deliverTxWithMultiStore func(int, storetypes.MultiStore) *abci.ExecTxResult, + ) ([]*abci.ExecTxResult, error) { + if blockSize == 0 { + return nil, nil + } + results := make([]*abci.ExecTxResult, blockSize) + if err := block_stm.ExecuteBlock( + ctx, + blockSize, + index, + stmMultiStoreWrapper{ms}, + workers, + func(txn block_stm.TxnIndex, ms block_stm.MultiStore) { + result := deliverTxWithMultiStore(int(txn), newMultiStoreWrapper(ms, stores)) + results[txn] = result + }, + ); err != nil { + return nil, err + } + + return evmtypes.PatchTxResponses(results), nil + } +} + +type msWrapper struct { + block_stm.MultiStore + stores []storetypes.StoreKey + keysByName map[string]storetypes.StoreKey +} + +var _ storetypes.MultiStore = msWrapper{} + +func newMultiStoreWrapper(ms block_stm.MultiStore, stores []storetypes.StoreKey) msWrapper { + keysByName := make(map[string]storetypes.StoreKey, len(stores)) + for _, k := range stores { + keysByName[k.Name()] = k + } + return msWrapper{ms, stores, keysByName} +} + +func (ms msWrapper) getCacheWrapper(key storetypes.StoreKey) storetypes.CacheWrapper { + return ms.GetStore(key) +} + +func (ms msWrapper) GetStore(key storetypes.StoreKey) storetypes.Store { + return ms.MultiStore.GetStore(key) +} + +func (ms msWrapper) GetKVStore(key storetypes.StoreKey) storetypes.KVStore { + return ms.MultiStore.GetKVStore(key) +} + +func (ms msWrapper) GetObjKVStore(key storetypes.StoreKey) storetypes.ObjKVStore { + return ms.MultiStore.GetObjKVStore(key) +} + +func (ms msWrapper) CacheMultiStore() storetypes.CacheMultiStore { + return cachemulti.NewFromParent(ms.getCacheWrapper, nil, nil) +} + +func (ms msWrapper) CacheMultiStoreWithVersion(_ int64) (storetypes.CacheMultiStore, error) { + panic("cannot branch cached multi-store with a version") +} + +// Implements CacheWrapper. +func (ms msWrapper) CacheWrap() storetypes.CacheWrap { + return ms.CacheMultiStore().(storetypes.CacheWrap) +} + +// CacheWrapWithTrace implements the CacheWrapper interface. +func (ms msWrapper) CacheWrapWithTrace(_ io.Writer, _ storetypes.TraceContext) storetypes.CacheWrap { + return ms.CacheWrap() +} + +// GetStoreType returns the type of the store. +func (ms msWrapper) GetStoreType() storetypes.StoreType { + return storetypes.StoreTypeMulti +} + +// LatestVersion returns the branch version of the store +func (ms msWrapper) LatestVersion() int64 { + panic("cannot get latest version from branch cached multi-store") +} + +// Implements interface MultiStore +func (ms msWrapper) SetTracer(io.Writer) storetypes.MultiStore { + return nil +} + +// Implements interface MultiStore +func (ms msWrapper) SetTracingContext(storetypes.TraceContext) storetypes.MultiStore { + return nil +} + +// Implements interface MultiStore +func (ms msWrapper) TracingEnabled() bool { + return false +} + +type stmMultiStoreWrapper struct { + inner storetypes.MultiStore +} + +var _ block_stm.MultiStore = stmMultiStoreWrapper{} + +func (ms stmMultiStoreWrapper) GetStore(key storetypes.StoreKey) storetypes.Store { + return ms.inner.GetStore(key) +} + +func (ms stmMultiStoreWrapper) GetKVStore(key storetypes.StoreKey) storetypes.KVStore { + return ms.inner.GetKVStore(key) +} + +func (ms stmMultiStoreWrapper) GetObjKVStore(key storetypes.StoreKey) storetypes.ObjKVStore { + return ms.inner.GetObjKVStore(key) +} diff --git a/go.mod b/go.mod index 95549a667a..0eab8cda5b 100644 --- a/go.mod +++ b/go.mod @@ -49,6 +49,7 @@ require ( github.com/tidwall/gjson v1.14.4 github.com/tidwall/sjson v1.2.5 github.com/tyler-smith/go-bip39 v1.1.0 + github.com/yihuang/go-block-stm v0.0.0-20240404183025-a4e4c8046423 golang.org/x/net v0.21.0 golang.org/x/sync v0.6.0 golang.org/x/text v0.14.0 @@ -242,7 +243,7 @@ require ( replace ( // release/v0.50.x - cosmossdk.io/store => github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20240403085742-29d3142f7596 + cosmossdk.io/store => github.com/yihuang/cosmos-sdk/store v0.0.0-20240404193924-d4f38fd057d6 // use cosmos keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 github.com/cockroachdb/pebble => github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 @@ -253,4 +254,5 @@ replace ( // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0 github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 + github.com/tidwall/btree => github.com/yihuang/btree v0.0.0-20240215071918-6726a9b22e40 ) diff --git a/go.sum b/go.sum index 4d4fdd9f83..ef949fbba6 100644 --- a/go.sum +++ b/go.sum @@ -415,8 +415,6 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240403085742-29d3142f7596 h1:0GboNOKFdX+T9VmuMa/qW+s/XCjwgcqjomQ9Si6bm28= github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240403085742-29d3142f7596/go.mod h1:nRk8EA8/fEG4zSme2i/Rq5z3k7TrlsHkOYhrY79hhD8= -github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20240403085742-29d3142f7596 h1:NUjIepL9YhwwhpyefOiJIU2lm5dI+qhsJ9sPyTrMFCY= -github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20240403085742-29d3142f7596/go.mod h1:lfuLI1f4o+0SGtlHQS4x5qsjRcZZfYqG8bp3k8hM0M8= github.com/crypto-org-chain/go-ethereum v1.10.20-0.20231207063621-43cf32d91c3e h1:vnyepPQ/m25+19xcTuBUdRxmltZ/EjVWNqEjhg7Ummk= github.com/crypto-org-chain/go-ethereum v1.10.20-0.20231207063621-43cf32d91c3e/go.mod h1:+a8pUj1tOyJ2RinsNQD4326YS+leSoKGiG/uVVb0x6Y= github.com/danieljoos/wincred v1.2.0 h1:ozqKHaLK0W/ii4KVbbvluM91W2H3Sh0BncbUNPS7jLE= @@ -1093,8 +1091,8 @@ github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70 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= github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= -github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= +github.com/test-go/testify v1.1.4 h1:Tf9lntrKUMHiXQ07qBScBTSA0dhYQlu83hswqelv1iE= +github.com/test-go/testify v1.1.4/go.mod h1:rH7cfJo/47vWGdi4GPj16x3/t1xGOj2YxzmNQzk2ghU= github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM= github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= @@ -1127,6 +1125,12 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +github.com/yihuang/btree v0.0.0-20240215071918-6726a9b22e40 h1:FPcNbZSQgK2d/Oj5tD4TwJM8ealdG4DLYvETLV9D5EE= +github.com/yihuang/btree v0.0.0-20240215071918-6726a9b22e40/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= +github.com/yihuang/cosmos-sdk/store v0.0.0-20240404193924-d4f38fd057d6 h1:7z30s8j7xhOoGs6Y3Zlt751JkwzTYGES21efEU8Jh9c= +github.com/yihuang/cosmos-sdk/store v0.0.0-20240404193924-d4f38fd057d6/go.mod h1:lfuLI1f4o+0SGtlHQS4x5qsjRcZZfYqG8bp3k8hM0M8= +github.com/yihuang/go-block-stm v0.0.0-20240404183025-a4e4c8046423 h1:3fiPoGYWkXgUa22WHCKbrjWgX1/kixGFqVPx0dmYsW4= +github.com/yihuang/go-block-stm v0.0.0-20240404183025-a4e4c8046423/go.mod h1:U56qBapBYN86mr25QoPfL3pJyF/9a+AzL5TMlo7agWs= 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= diff --git a/gomod2nix.toml b/gomod2nix.toml index b0e4e2166f..9a5f3788ca 100644 --- a/gomod2nix.toml +++ b/gomod2nix.toml @@ -41,9 +41,9 @@ schema = 3 version = "v1.3.0" hash = "sha256-EEFK43Cr0g0ndhQhkIKher0FqV3mvkmE9z0sP7uVSHg=" [mod."cosmossdk.io/store"] - version = "v0.0.0-20240403085742-29d3142f7596" - hash = "sha256-wV4pdty1onr51ZtRWS1MSR4sH3rptsLL+Zc3dPuvlIA=" - replaced = "github.com/crypto-org-chain/cosmos-sdk/store" + version = "v0.0.0-20240404193924-d4f38fd057d6" + hash = "sha256-UF7viH+TYLp4eqXub4DHzQn43G34RwRAgcG7Xepsugg=" + replaced = "github.com/yihuang/cosmos-sdk/store" [mod."cosmossdk.io/tools/confix"] version = "v0.1.1" hash = "sha256-/Et2FFhb4XfakbLFvGQK3QxN5Y7alzO+DGfi2/EWbxo=" @@ -566,8 +566,9 @@ schema = 3 version = "v0.16.0" hash = "sha256-JW4zO/0vMzf1dXLePOqaMtiLUZgNbuIseh9GV+jQlf0=" [mod."github.com/tidwall/btree"] - version = "v1.7.0" - hash = "sha256-bnr6c7a0nqo2HyGqxHk0kEZCEsjLYkPbAVY9WzaZ30o=" + version = "v0.0.0-20240215071918-6726a9b22e40" + hash = "sha256-s0olXV7w23o3UHCxlndyXFilL0tzbibxVecylN5a+LQ=" + replaced = "github.com/yihuang/btree" [mod."github.com/tidwall/gjson"] version = "v1.14.4" hash = "sha256-3DS2YNL95wG0qSajgRtIABD32J+oblaKVk8LIw+KSOc=" @@ -592,6 +593,9 @@ schema = 3 [mod."github.com/ulikunitz/xz"] version = "v0.5.11" hash = "sha256-SUyrjc2wyN3cTGKe5JdBEXjtZC1rJySRxJHVUZ59row=" + [mod."github.com/yihuang/go-block-stm"] + version = "v0.0.0-20240404183025-a4e4c8046423" + hash = "sha256-WrtgRKXasiWUh+fSX2FHcYMDpjoArKwGxLoMJ35GOEU=" [mod."github.com/zondax/hid"] version = "v0.9.2" hash = "sha256-9h1gEJ/loyaJvu9AsmslztiA8U9ixDTC6TBw9lCU2BE=" diff --git a/server/config/config.go b/server/config/config.go index b7d78f7091..986bda5b51 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -124,6 +124,10 @@ type EVMConfig struct { Tracer string `mapstructure:"tracer"` // MaxTxGasWanted defines the gas wanted for each eth tx returned in ante handler in check tx mode. MaxTxGasWanted uint64 `mapstructure:"max-tx-gas-wanted"` + // BlockExecutor set block executor type, "block-stm" for parallel execution, "default" for sequential execution. + BlockExecutor string `mapstructure:"block-executor"` + // BlockSTMWorkers is the number of workers for block-stm execution, `0` means using all available CPUs. + BlockSTMWorkers int `mapstructure:"block-stm-workers"` } // JSONRPCConfig defines configuration for the EVM RPC server. @@ -238,6 +242,7 @@ func DefaultEVMConfig() *EVMConfig { return &EVMConfig{ Tracer: DefaultEVMTracer, MaxTxGasWanted: DefaultMaxTxGasWanted, + BlockExecutor: "sequential", } } diff --git a/server/config/toml.go b/server/config/toml.go index 84295be973..709d6d1461 100644 --- a/server/config/toml.go +++ b/server/config/toml.go @@ -31,6 +31,11 @@ tracer = "{{ .EVM.Tracer }}" # MaxTxGasWanted defines the gas wanted for each eth tx returned in ante handler in check tx mode. max-tx-gas-wanted = {{ .EVM.MaxTxGasWanted }} +# BlockExecutor set block executor type, "block-stm" for parallel execution, "default" for sequential execution. +block-executor = "{{ .EVM.BlockExecutor }}" +# BlockSTMWorkers is the number of workers for block-stm execution, 0 means using all available CPUs. +block-stm-workers = {{ .EVM.BlockSTMWorkers }} + ############################################################################### ### JSON RPC Configuration ### ############################################################################### diff --git a/server/flags/flags.go b/server/flags/flags.go index 502cc7f4f6..1cf5916782 100644 --- a/server/flags/flags.go +++ b/server/flags/flags.go @@ -76,8 +76,10 @@ const ( // EVM flags const ( - EVMTracer = "evm.tracer" - EVMMaxTxGasWanted = "evm.max-tx-gas-wanted" + EVMTracer = "evm.tracer" + EVMMaxTxGasWanted = "evm.max-tx-gas-wanted" + EVMBlockExecutor = "evm.block-executor" + EVMBlockSTMWorkers = "evm.block-stm-workers" ) // TLS flags diff --git a/tests/importer/importer_test.go b/tests/importer/importer_test.go index 48fb430ef4..e029920bcd 100644 --- a/tests/importer/importer_test.go +++ b/tests/importer/importer_test.go @@ -145,7 +145,6 @@ func (suite *ImporterTestSuite) TestImportBlocks() { } for i, tx := range block.Transactions() { - receipt, gas, err := applyTransaction( ctx, chainConfig, chainContext, nil, gp, suite.app.EvmKeeper, vmdb, header, tx, usedGas, vmConfig, uint(i), ) @@ -263,7 +262,7 @@ func applyTransaction( // if the transaction created a contract, store the creation address in the receipt. if msg.To == nil { - receipt.ContractAddress = crypto.CreateAddress(vmenv.TxContext.Origin, tx.Nonce()) + receipt.ContractAddress = crypto.CreateAddress(vmenv.Origin, tx.Nonce()) } // Set the receipt logs and create a bloom for filtering diff --git a/tests/integration_tests/configs/default.jsonnet b/tests/integration_tests/configs/default.jsonnet index bb67f3b7c1..fba86f6d22 100644 --- a/tests/integration_tests/configs/default.jsonnet +++ b/tests/integration_tests/configs/default.jsonnet @@ -6,6 +6,9 @@ 'app-config': { 'minimum-gas-prices': '0aphoton', 'index-events': ['ethereum_tx.ethereumTxHash'], + evm: { + 'block-executor': 'block-stm', + }, 'json-rpc': { address: '127.0.0.1:{EVMRPC_PORT}', 'ws-address': '127.0.0.1:{EVMRPC_PORT_WS}', diff --git a/x/evm/keeper/abci.go b/x/evm/keeper/abci.go index 9b04f0f1b4..0f64bf25cb 100644 --- a/x/evm/keeper/abci.go +++ b/x/evm/keeper/abci.go @@ -16,8 +16,6 @@ package keeper import ( - "cosmossdk.io/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -35,8 +33,6 @@ func (k *Keeper) BeginBlock(ctx sdk.Context) error { // KVStore. The EVM end block logic doesn't update the validator set, thus it returns // an empty slice. func (k *Keeper) EndBlock(ctx sdk.Context) error { - // Gas costs are handled within msg handler so costs should be ignored - infCtx := ctx.WithGasMeter(types.NewInfiniteGasMeter()) - k.CollectTxBloom(infCtx) + k.CollectTxBloom(ctx) return nil } diff --git a/x/evm/keeper/gas.go b/x/evm/keeper/gas.go index fca0a664dd..66042d7f98 100644 --- a/x/evm/keeper/gas.go +++ b/x/evm/keeper/gas.go @@ -57,7 +57,6 @@ func (k *Keeper) RefundGas(ctx sdk.Context, msg core.Message, leftoverGas uint64 refundedCoins := sdk.Coins{sdk.NewCoin(denom, sdkmath.NewIntFromBigInt(remaining))} // refund to sender from the fee collector module account, which is the escrow account in charge of collecting tx fees - err := k.bankKeeper.SendCoinsFromModuleToAccountVirtual(ctx, authtypes.FeeCollectorName, msg.From.Bytes(), refundedCoins) if err != nil { err = errorsmod.Wrapf(errortypes.ErrInsufficientFunds, "fee collector account failed to refund fees: %s", err.Error()) diff --git a/x/evm/types/chain_config.go b/x/evm/types/chain_config.go index cdbee60aec..8d55bcfe5b 100644 --- a/x/evm/types/chain_config.go +++ b/x/evm/types/chain_config.go @@ -102,14 +102,14 @@ func getBlockValue(block *sdkmath.Int) *big.Int { return nil } - return block.BigInt() + return block.BigIntMut() } func getTimeValue(time *sdkmath.Int) *uint64 { if time == nil || time.IsNegative() { return nil } - t := time.BigInt().Uint64() + t := time.BigIntMut().Uint64() return &t } diff --git a/x/evm/types/interfaces.go b/x/evm/types/interfaces.go index 4ee211f5d5..ed31e6c100 100644 --- a/x/evm/types/interfaces.go +++ b/x/evm/types/interfaces.go @@ -46,6 +46,7 @@ type AccountKeeper interface { type BankKeeper interface { authtypes.BankKeeper GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error SendCoinsFromModuleToAccountVirtual(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error SendCoinsFromAccountToModuleVirtual(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error diff --git a/x/evm/types/logs.go b/x/evm/types/logs.go index fece366e9b..0289d88bdc 100644 --- a/x/evm/types/logs.go +++ b/x/evm/types/logs.go @@ -129,7 +129,7 @@ func NewLogFromEth(log *ethtypes.Log) *Log { } return &Log{ - Address: log.Address.String(), + Address: HexAddress(log.Address.Bytes()), Topics: topics, Data: log.Data, BlockNumber: log.BlockNumber, diff --git a/x/evm/types/msg.go b/x/evm/types/msg.go index 7df29ed13e..27dbd6f246 100644 --- a/x/evm/types/msg.go +++ b/x/evm/types/msg.go @@ -381,7 +381,7 @@ func (msg *MsgEthereumTx) VerifySender(chainID *big.Int) error { } if !bytes.Equal(msg.From, from.Bytes()) { - return fmt.Errorf("sender verification failed. got %s, expected %s", from.String(), HexAddress(msg.From)) + return fmt.Errorf("sender verification failed. got %s, expected %s", HexAddress(from.Bytes()), HexAddress(msg.From)) } return nil } diff --git a/x/evm/types/utils.go b/x/evm/types/utils.go index 145077146c..487ac0a0c0 100644 --- a/x/evm/types/utils.go +++ b/x/evm/types/utils.go @@ -204,3 +204,11 @@ func GetBaseFee(height int64, ethCfg *params.ChainConfig, feemarketParams *feema } return baseFee } + +// CopyAppend returns a new slice with all the elements of a followed by all the elements of b. +func CopyAppend(a, b []byte) []byte { + dst := make([]byte, len(a)+len(b)) + copy(dst, a) + copy(dst[len(a):], b) + return dst +} diff --git a/x/evm/types/utils_test.go b/x/evm/types/utils_test.go index 981c742cb5..4cc70aca18 100644 --- a/x/evm/types/utils_test.go +++ b/x/evm/types/utils_test.go @@ -40,11 +40,11 @@ func TestEvmDataEncoding(t *testing.T) { txDataBz, err := proto.Marshal(txData) require.NoError(t, err) - res, err := evmtypes.DecodeTxResponse(txDataBz) + rsps, err := evmtypes.DecodeTxResponses(txDataBz) require.NoError(t, err) - require.NotNil(t, res) - require.Equal(t, data.Logs, res.Logs) - require.Equal(t, ret, res.Ret) + require.NotEmpty(t, rsps) + require.Equal(t, data.Logs, rsps[0].Logs) + require.Equal(t, ret, rsps[0].Ret) } func TestUnwrapEthererumMsg(t *testing.T) { From b0802fb9235e6e303c1e0fdcbd9e92fd8bdaec73 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Mon, 8 Apr 2024 09:27:24 +0800 Subject: [PATCH 02/15] package deps --- app/executor.go | 12 ++++++------ go.mod | 4 ++-- go.sum | 8 ++++---- gomod2nix.toml | 12 ++++++------ 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/executor.go b/app/executor.go index 8448342b1e..91752ba6f1 100644 --- a/app/executor.go +++ b/app/executor.go @@ -11,7 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" - block_stm "github.com/yihuang/go-block-stm" + blockstm "github.com/crypto-org-chain/go-block-stm" ) func DefaultTxExecutor(_ context.Context, @@ -41,13 +41,13 @@ func STMTxExecutor(stores []storetypes.StoreKey, workers int) baseapp.TxExecutor return nil, nil } results := make([]*abci.ExecTxResult, blockSize) - if err := block_stm.ExecuteBlock( + if err := blockstm.ExecuteBlock( ctx, blockSize, index, stmMultiStoreWrapper{ms}, workers, - func(txn block_stm.TxnIndex, ms block_stm.MultiStore) { + func(txn blockstm.TxnIndex, ms blockstm.MultiStore) { result := deliverTxWithMultiStore(int(txn), newMultiStoreWrapper(ms, stores)) results[txn] = result }, @@ -60,14 +60,14 @@ func STMTxExecutor(stores []storetypes.StoreKey, workers int) baseapp.TxExecutor } type msWrapper struct { - block_stm.MultiStore + blockstm.MultiStore stores []storetypes.StoreKey keysByName map[string]storetypes.StoreKey } var _ storetypes.MultiStore = msWrapper{} -func newMultiStoreWrapper(ms block_stm.MultiStore, stores []storetypes.StoreKey) msWrapper { +func newMultiStoreWrapper(ms blockstm.MultiStore, stores []storetypes.StoreKey) msWrapper { keysByName := make(map[string]storetypes.StoreKey, len(stores)) for _, k := range stores { keysByName[k.Name()] = k @@ -138,7 +138,7 @@ type stmMultiStoreWrapper struct { inner storetypes.MultiStore } -var _ block_stm.MultiStore = stmMultiStoreWrapper{} +var _ blockstm.MultiStore = stmMultiStoreWrapper{} func (ms stmMultiStoreWrapper) GetStore(key storetypes.StoreKey) storetypes.Store { return ms.inner.GetStore(key) diff --git a/go.mod b/go.mod index 0eab8cda5b..ea676f9546 100644 --- a/go.mod +++ b/go.mod @@ -28,6 +28,7 @@ require ( github.com/cosmos/ibc-go/modules/capability v1.0.0 github.com/cosmos/ibc-go/v8 v8.1.0 github.com/cosmos/rosetta v0.50.3-1 + github.com/crypto-org-chain/go-block-stm v0.0.0-20240408011717-9f11af197bde github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc github.com/ethereum/go-ethereum v1.10.26 github.com/gogo/protobuf v1.3.2 @@ -49,7 +50,6 @@ require ( github.com/tidwall/gjson v1.14.4 github.com/tidwall/sjson v1.2.5 github.com/tyler-smith/go-bip39 v1.1.0 - github.com/yihuang/go-block-stm v0.0.0-20240404183025-a4e4c8046423 golang.org/x/net v0.21.0 golang.org/x/sync v0.6.0 golang.org/x/text v0.14.0 @@ -254,5 +254,5 @@ replace ( // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0 github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 - github.com/tidwall/btree => github.com/yihuang/btree v0.0.0-20240215071918-6726a9b22e40 + github.com/tidwall/btree => github.com/crypto-org-chain/btree v0.0.0-20240406140148-2687063b042c ) diff --git a/go.sum b/go.sum index ef949fbba6..4f3c69748c 100644 --- a/go.sum +++ b/go.sum @@ -413,8 +413,12 @@ github.com/creachadair/tomledit v0.0.24 h1:5Xjr25R2esu1rKCbQEmjZYlrhFkDspoAbAKb6 github.com/creachadair/tomledit v0.0.24/go.mod h1:9qHbShRWQzSCcn617cMzg4eab1vbLCOjOshAWSzWr8U= 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/crypto-org-chain/btree v0.0.0-20240406140148-2687063b042c h1:MOgfS4+FBB8cMkDE2j2VBVsbY+HCkPIu0YsJ/9bbGeQ= +github.com/crypto-org-chain/btree v0.0.0-20240406140148-2687063b042c/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240403085742-29d3142f7596 h1:0GboNOKFdX+T9VmuMa/qW+s/XCjwgcqjomQ9Si6bm28= github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240403085742-29d3142f7596/go.mod h1:nRk8EA8/fEG4zSme2i/Rq5z3k7TrlsHkOYhrY79hhD8= +github.com/crypto-org-chain/go-block-stm v0.0.0-20240408011717-9f11af197bde h1:sQIHTJfVt5VTrF7po9eZiFkZiPjlHbFvnXtGCOoBjNM= +github.com/crypto-org-chain/go-block-stm v0.0.0-20240408011717-9f11af197bde/go.mod h1:iwQTX9xMX8NV9k3o2BiWXA0SswpsZrDk5q3gA7nWYiE= github.com/crypto-org-chain/go-ethereum v1.10.20-0.20231207063621-43cf32d91c3e h1:vnyepPQ/m25+19xcTuBUdRxmltZ/EjVWNqEjhg7Ummk= github.com/crypto-org-chain/go-ethereum v1.10.20-0.20231207063621-43cf32d91c3e/go.mod h1:+a8pUj1tOyJ2RinsNQD4326YS+leSoKGiG/uVVb0x6Y= github.com/danieljoos/wincred v1.2.0 h1:ozqKHaLK0W/ii4KVbbvluM91W2H3Sh0BncbUNPS7jLE= @@ -1125,12 +1129,8 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= -github.com/yihuang/btree v0.0.0-20240215071918-6726a9b22e40 h1:FPcNbZSQgK2d/Oj5tD4TwJM8ealdG4DLYvETLV9D5EE= -github.com/yihuang/btree v0.0.0-20240215071918-6726a9b22e40/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= github.com/yihuang/cosmos-sdk/store v0.0.0-20240404193924-d4f38fd057d6 h1:7z30s8j7xhOoGs6Y3Zlt751JkwzTYGES21efEU8Jh9c= github.com/yihuang/cosmos-sdk/store v0.0.0-20240404193924-d4f38fd057d6/go.mod h1:lfuLI1f4o+0SGtlHQS4x5qsjRcZZfYqG8bp3k8hM0M8= -github.com/yihuang/go-block-stm v0.0.0-20240404183025-a4e4c8046423 h1:3fiPoGYWkXgUa22WHCKbrjWgX1/kixGFqVPx0dmYsW4= -github.com/yihuang/go-block-stm v0.0.0-20240404183025-a4e4c8046423/go.mod h1:U56qBapBYN86mr25QoPfL3pJyF/9a+AzL5TMlo7agWs= 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= diff --git a/gomod2nix.toml b/gomod2nix.toml index 9a5f3788ca..dd3817e4d3 100644 --- a/gomod2nix.toml +++ b/gomod2nix.toml @@ -200,6 +200,9 @@ schema = 3 [mod."github.com/creachadair/tomledit"] version = "v0.0.24" hash = "sha256-4vUukHONOjNn0qfQr4esK6TWfPWsIp+rbdz65og84lw=" + [mod."github.com/crypto-org-chain/go-block-stm"] + version = "v0.0.0-20240408011717-9f11af197bde" + hash = "sha256-+UTSUoh4DxkWPQEc/j0atak1Oxq3tdP8r6ZMmB0k5KE=" [mod."github.com/danieljoos/wincred"] version = "v1.2.0" hash = "sha256-LHcvTJCc8++bFndbd8ZgMSTe4L5h2C4rN+cSWHCz54Y=" @@ -566,9 +569,9 @@ schema = 3 version = "v0.16.0" hash = "sha256-JW4zO/0vMzf1dXLePOqaMtiLUZgNbuIseh9GV+jQlf0=" [mod."github.com/tidwall/btree"] - version = "v0.0.0-20240215071918-6726a9b22e40" - hash = "sha256-s0olXV7w23o3UHCxlndyXFilL0tzbibxVecylN5a+LQ=" - replaced = "github.com/yihuang/btree" + version = "v0.0.0-20240406140148-2687063b042c" + hash = "sha256-8eDLGHhw4qXG6MEa7w5Q9KLwOobXr8Vn5qqyQhuipQw=" + replaced = "github.com/crypto-org-chain/btree" [mod."github.com/tidwall/gjson"] version = "v1.14.4" hash = "sha256-3DS2YNL95wG0qSajgRtIABD32J+oblaKVk8LIw+KSOc=" @@ -593,9 +596,6 @@ schema = 3 [mod."github.com/ulikunitz/xz"] version = "v0.5.11" hash = "sha256-SUyrjc2wyN3cTGKe5JdBEXjtZC1rJySRxJHVUZ59row=" - [mod."github.com/yihuang/go-block-stm"] - version = "v0.0.0-20240404183025-a4e4c8046423" - hash = "sha256-WrtgRKXasiWUh+fSX2FHcYMDpjoArKwGxLoMJ35GOEU=" [mod."github.com/zondax/hid"] version = "v0.9.2" hash = "sha256-9h1gEJ/loyaJvu9AsmslztiA8U9ixDTC6TBw9lCU2BE=" From a5b1f1c44016976bb14da255ac7424d3f1199323 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Mon, 8 Apr 2024 09:30:05 +0800 Subject: [PATCH 03/15] cleanup --- app/executor.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/executor.go b/app/executor.go index 91752ba6f1..531993addf 100644 --- a/app/executor.go +++ b/app/executor.go @@ -104,11 +104,6 @@ func (ms msWrapper) CacheWrap() storetypes.CacheWrap { return ms.CacheMultiStore().(storetypes.CacheWrap) } -// CacheWrapWithTrace implements the CacheWrapper interface. -func (ms msWrapper) CacheWrapWithTrace(_ io.Writer, _ storetypes.TraceContext) storetypes.CacheWrap { - return ms.CacheWrap() -} - // GetStoreType returns the type of the store. func (ms msWrapper) GetStoreType() storetypes.StoreType { return storetypes.StoreTypeMulti From 3e1a59a1dac62e5b3f55b0732ae65eb5eee1807e Mon Sep 17 00:00:00 2001 From: HuangYi Date: Mon, 8 Apr 2024 09:38:54 +0800 Subject: [PATCH 04/15] update sdk deps --- go.mod | 4 ++-- go.sum | 8 ++++---- gomod2nix.toml | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index ea676f9546..70563c462c 100644 --- a/go.mod +++ b/go.mod @@ -243,12 +243,12 @@ require ( replace ( // release/v0.50.x - cosmossdk.io/store => github.com/yihuang/cosmos-sdk/store v0.0.0-20240404193924-d4f38fd057d6 + cosmossdk.io/store => github.com/yihuang/cosmos-sdk/store v0.0.0-20240405031953-0bb12ec2d092 // use cosmos keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 github.com/cockroachdb/pebble => github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 // release/v0.50.x - github.com/cosmos/cosmos-sdk => github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240403085742-29d3142f7596 + github.com/cosmos/cosmos-sdk => github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240405031953-0bb12ec2d092 github.com/ethereum/go-ethereum => github.com/crypto-org-chain/go-ethereum v1.10.20-0.20231207063621-43cf32d91c3e // Fix upstream GHSA-h395-qcrw-5vmq vulnerability. // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 diff --git a/go.sum b/go.sum index 4f3c69748c..2de6b960fc 100644 --- a/go.sum +++ b/go.sum @@ -415,8 +415,8 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/crypto-org-chain/btree v0.0.0-20240406140148-2687063b042c h1:MOgfS4+FBB8cMkDE2j2VBVsbY+HCkPIu0YsJ/9bbGeQ= github.com/crypto-org-chain/btree v0.0.0-20240406140148-2687063b042c/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= -github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240403085742-29d3142f7596 h1:0GboNOKFdX+T9VmuMa/qW+s/XCjwgcqjomQ9Si6bm28= -github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240403085742-29d3142f7596/go.mod h1:nRk8EA8/fEG4zSme2i/Rq5z3k7TrlsHkOYhrY79hhD8= +github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240405031953-0bb12ec2d092 h1:u7edSCWAXYD1VgO1OdBFDD5X93dxhoZzP8Z/75S4D1o= +github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240405031953-0bb12ec2d092/go.mod h1:nRk8EA8/fEG4zSme2i/Rq5z3k7TrlsHkOYhrY79hhD8= github.com/crypto-org-chain/go-block-stm v0.0.0-20240408011717-9f11af197bde h1:sQIHTJfVt5VTrF7po9eZiFkZiPjlHbFvnXtGCOoBjNM= github.com/crypto-org-chain/go-block-stm v0.0.0-20240408011717-9f11af197bde/go.mod h1:iwQTX9xMX8NV9k3o2BiWXA0SswpsZrDk5q3gA7nWYiE= github.com/crypto-org-chain/go-ethereum v1.10.20-0.20231207063621-43cf32d91c3e h1:vnyepPQ/m25+19xcTuBUdRxmltZ/EjVWNqEjhg7Ummk= @@ -1129,8 +1129,8 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= -github.com/yihuang/cosmos-sdk/store v0.0.0-20240404193924-d4f38fd057d6 h1:7z30s8j7xhOoGs6Y3Zlt751JkwzTYGES21efEU8Jh9c= -github.com/yihuang/cosmos-sdk/store v0.0.0-20240404193924-d4f38fd057d6/go.mod h1:lfuLI1f4o+0SGtlHQS4x5qsjRcZZfYqG8bp3k8hM0M8= +github.com/yihuang/cosmos-sdk/store v0.0.0-20240405031953-0bb12ec2d092 h1:h4idM/vbgTwHkNt8X662RZUYb3znEhJqTWuD77gM4kY= +github.com/yihuang/cosmos-sdk/store v0.0.0-20240405031953-0bb12ec2d092/go.mod h1:lfuLI1f4o+0SGtlHQS4x5qsjRcZZfYqG8bp3k8hM0M8= 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= diff --git a/gomod2nix.toml b/gomod2nix.toml index dd3817e4d3..a0f258b24b 100644 --- a/gomod2nix.toml +++ b/gomod2nix.toml @@ -41,8 +41,8 @@ schema = 3 version = "v1.3.0" hash = "sha256-EEFK43Cr0g0ndhQhkIKher0FqV3mvkmE9z0sP7uVSHg=" [mod."cosmossdk.io/store"] - version = "v0.0.0-20240404193924-d4f38fd057d6" - hash = "sha256-UF7viH+TYLp4eqXub4DHzQn43G34RwRAgcG7Xepsugg=" + version = "v0.0.0-20240405031953-0bb12ec2d092" + hash = "sha256-5fFhveNdA4rEwtTVNE4MIzK7udgNF80q9fkiDcw7T/Q=" replaced = "github.com/yihuang/cosmos-sdk/store" [mod."cosmossdk.io/tools/confix"] version = "v0.1.1" @@ -161,7 +161,7 @@ schema = 3 version = "v1.0.0-beta.4" hash = "sha256-5Kn82nsZfiEtuwhhLZqmMxdAY1tX/Fi3HJ0/MEaRohw=" [mod."github.com/cosmos/cosmos-sdk"] - version = "v0.46.0-beta2.0.20240403085742-29d3142f7596" + version = "v0.46.0-beta2.0.20240405031953-0bb12ec2d092" hash = "sha256-qIvDAFwGrFIOxPGUazpfR3mu9X3eJqkbBJWQUwhP2hY=" replaced = "github.com/crypto-org-chain/cosmos-sdk" [mod."github.com/cosmos/go-bip39"] From 82336f209f6c7b984a7752bcf3489979f758c9e9 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Mon, 8 Apr 2024 09:40:29 +0800 Subject: [PATCH 05/15] cleanup --- app/executor.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/app/executor.go b/app/executor.go index 531993addf..395b9f7eb7 100644 --- a/app/executor.go +++ b/app/executor.go @@ -95,10 +95,6 @@ func (ms msWrapper) CacheMultiStore() storetypes.CacheMultiStore { return cachemulti.NewFromParent(ms.getCacheWrapper, nil, nil) } -func (ms msWrapper) CacheMultiStoreWithVersion(_ int64) (storetypes.CacheMultiStore, error) { - panic("cannot branch cached multi-store with a version") -} - // Implements CacheWrapper. func (ms msWrapper) CacheWrap() storetypes.CacheWrap { return ms.CacheMultiStore().(storetypes.CacheWrap) @@ -109,11 +105,6 @@ func (ms msWrapper) GetStoreType() storetypes.StoreType { return storetypes.StoreTypeMulti } -// LatestVersion returns the branch version of the store -func (ms msWrapper) LatestVersion() int64 { - panic("cannot get latest version from branch cached multi-store") -} - // Implements interface MultiStore func (ms msWrapper) SetTracer(io.Writer) storetypes.MultiStore { return nil From 67d0384eff5c482115974be355e297fa3aa999ba Mon Sep 17 00:00:00 2001 From: HuangYi Date: Mon, 8 Apr 2024 09:44:56 +0800 Subject: [PATCH 06/15] cleanup --- app/executor.go | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/app/executor.go b/app/executor.go index 395b9f7eb7..8086e49327 100644 --- a/app/executor.go +++ b/app/executor.go @@ -48,7 +48,7 @@ func STMTxExecutor(stores []storetypes.StoreKey, workers int) baseapp.TxExecutor stmMultiStoreWrapper{ms}, workers, func(txn blockstm.TxnIndex, ms blockstm.MultiStore) { - result := deliverTxWithMultiStore(int(txn), newMultiStoreWrapper(ms, stores)) + result := deliverTxWithMultiStore(int(txn), msWrapper{ms}) results[txn] = result }, ); err != nil { @@ -61,20 +61,10 @@ func STMTxExecutor(stores []storetypes.StoreKey, workers int) baseapp.TxExecutor type msWrapper struct { blockstm.MultiStore - stores []storetypes.StoreKey - keysByName map[string]storetypes.StoreKey } var _ storetypes.MultiStore = msWrapper{} -func newMultiStoreWrapper(ms blockstm.MultiStore, stores []storetypes.StoreKey) msWrapper { - keysByName := make(map[string]storetypes.StoreKey, len(stores)) - for _, k := range stores { - keysByName[k.Name()] = k - } - return msWrapper{ms, stores, keysByName} -} - func (ms msWrapper) getCacheWrapper(key storetypes.StoreKey) storetypes.CacheWrapper { return ms.GetStore(key) } @@ -121,19 +111,19 @@ func (ms msWrapper) TracingEnabled() bool { } type stmMultiStoreWrapper struct { - inner storetypes.MultiStore + storetypes.MultiStore } var _ blockstm.MultiStore = stmMultiStoreWrapper{} func (ms stmMultiStoreWrapper) GetStore(key storetypes.StoreKey) storetypes.Store { - return ms.inner.GetStore(key) + return ms.MultiStore.GetStore(key) } func (ms stmMultiStoreWrapper) GetKVStore(key storetypes.StoreKey) storetypes.KVStore { - return ms.inner.GetKVStore(key) + return ms.MultiStore.GetKVStore(key) } func (ms stmMultiStoreWrapper) GetObjKVStore(key storetypes.StoreKey) storetypes.ObjKVStore { - return ms.inner.GetObjKVStore(key) + return ms.MultiStore.GetObjKVStore(key) } From 8671ed47fb9ce0e6b7203b7e622fc080f8c458c1 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Mon, 8 Apr 2024 09:47:45 +0800 Subject: [PATCH 07/15] cleanup --- go.mod | 4 ++-- go.sum | 8 ++++---- gomod2nix.toml | 8 ++++---- x/evm/types/interfaces.go | 1 - x/evm/types/utils.go | 8 -------- 5 files changed, 10 insertions(+), 19 deletions(-) diff --git a/go.mod b/go.mod index 70563c462c..c6e4223776 100644 --- a/go.mod +++ b/go.mod @@ -243,12 +243,12 @@ require ( replace ( // release/v0.50.x - cosmossdk.io/store => github.com/yihuang/cosmos-sdk/store v0.0.0-20240405031953-0bb12ec2d092 + cosmossdk.io/store => github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20240408014408-56c165536d0a // use cosmos keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 github.com/cockroachdb/pebble => github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 // release/v0.50.x - github.com/cosmos/cosmos-sdk => github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240405031953-0bb12ec2d092 + github.com/cosmos/cosmos-sdk => github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240408014408-56c165536d0a github.com/ethereum/go-ethereum => github.com/crypto-org-chain/go-ethereum v1.10.20-0.20231207063621-43cf32d91c3e // Fix upstream GHSA-h395-qcrw-5vmq vulnerability. // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 diff --git a/go.sum b/go.sum index 2de6b960fc..941cb8ddfc 100644 --- a/go.sum +++ b/go.sum @@ -415,8 +415,10 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/crypto-org-chain/btree v0.0.0-20240406140148-2687063b042c h1:MOgfS4+FBB8cMkDE2j2VBVsbY+HCkPIu0YsJ/9bbGeQ= github.com/crypto-org-chain/btree v0.0.0-20240406140148-2687063b042c/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= -github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240405031953-0bb12ec2d092 h1:u7edSCWAXYD1VgO1OdBFDD5X93dxhoZzP8Z/75S4D1o= -github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240405031953-0bb12ec2d092/go.mod h1:nRk8EA8/fEG4zSme2i/Rq5z3k7TrlsHkOYhrY79hhD8= +github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240408014408-56c165536d0a h1:3IiFpiRRiF0lFCJcKGEu6UafcqzRUwUUl75aXan9pJI= +github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240408014408-56c165536d0a/go.mod h1:nRk8EA8/fEG4zSme2i/Rq5z3k7TrlsHkOYhrY79hhD8= +github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20240408014408-56c165536d0a h1:YHeIe/VPKf7xK7xxLWUzvspFZJY6fDT6Epj+MH9dLOc= +github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20240408014408-56c165536d0a/go.mod h1:lfuLI1f4o+0SGtlHQS4x5qsjRcZZfYqG8bp3k8hM0M8= github.com/crypto-org-chain/go-block-stm v0.0.0-20240408011717-9f11af197bde h1:sQIHTJfVt5VTrF7po9eZiFkZiPjlHbFvnXtGCOoBjNM= github.com/crypto-org-chain/go-block-stm v0.0.0-20240408011717-9f11af197bde/go.mod h1:iwQTX9xMX8NV9k3o2BiWXA0SswpsZrDk5q3gA7nWYiE= github.com/crypto-org-chain/go-ethereum v1.10.20-0.20231207063621-43cf32d91c3e h1:vnyepPQ/m25+19xcTuBUdRxmltZ/EjVWNqEjhg7Ummk= @@ -1129,8 +1131,6 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= -github.com/yihuang/cosmos-sdk/store v0.0.0-20240405031953-0bb12ec2d092 h1:h4idM/vbgTwHkNt8X662RZUYb3znEhJqTWuD77gM4kY= -github.com/yihuang/cosmos-sdk/store v0.0.0-20240405031953-0bb12ec2d092/go.mod h1:lfuLI1f4o+0SGtlHQS4x5qsjRcZZfYqG8bp3k8hM0M8= 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= diff --git a/gomod2nix.toml b/gomod2nix.toml index a0f258b24b..7e394e19c9 100644 --- a/gomod2nix.toml +++ b/gomod2nix.toml @@ -41,9 +41,9 @@ schema = 3 version = "v1.3.0" hash = "sha256-EEFK43Cr0g0ndhQhkIKher0FqV3mvkmE9z0sP7uVSHg=" [mod."cosmossdk.io/store"] - version = "v0.0.0-20240405031953-0bb12ec2d092" + version = "v0.0.0-20240408014408-56c165536d0a" hash = "sha256-5fFhveNdA4rEwtTVNE4MIzK7udgNF80q9fkiDcw7T/Q=" - replaced = "github.com/yihuang/cosmos-sdk/store" + replaced = "github.com/crypto-org-chain/cosmos-sdk/store" [mod."cosmossdk.io/tools/confix"] version = "v0.1.1" hash = "sha256-/Et2FFhb4XfakbLFvGQK3QxN5Y7alzO+DGfi2/EWbxo=" @@ -161,8 +161,8 @@ schema = 3 version = "v1.0.0-beta.4" hash = "sha256-5Kn82nsZfiEtuwhhLZqmMxdAY1tX/Fi3HJ0/MEaRohw=" [mod."github.com/cosmos/cosmos-sdk"] - version = "v0.46.0-beta2.0.20240405031953-0bb12ec2d092" - hash = "sha256-qIvDAFwGrFIOxPGUazpfR3mu9X3eJqkbBJWQUwhP2hY=" + version = "v0.46.0-beta2.0.20240408014408-56c165536d0a" + hash = "sha256-xjZvl0pxsEkSW2X8Q37mPHXAHnMeHiwCtX2FmDZVUHQ=" replaced = "github.com/crypto-org-chain/cosmos-sdk" [mod."github.com/cosmos/go-bip39"] version = "v1.0.0" diff --git a/x/evm/types/interfaces.go b/x/evm/types/interfaces.go index ed31e6c100..4ee211f5d5 100644 --- a/x/evm/types/interfaces.go +++ b/x/evm/types/interfaces.go @@ -46,7 +46,6 @@ type AccountKeeper interface { type BankKeeper interface { authtypes.BankKeeper GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin - GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error SendCoinsFromModuleToAccountVirtual(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error SendCoinsFromAccountToModuleVirtual(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error diff --git a/x/evm/types/utils.go b/x/evm/types/utils.go index 487ac0a0c0..145077146c 100644 --- a/x/evm/types/utils.go +++ b/x/evm/types/utils.go @@ -204,11 +204,3 @@ func GetBaseFee(height int64, ethCfg *params.ChainConfig, feemarketParams *feema } return baseFee } - -// CopyAppend returns a new slice with all the elements of a followed by all the elements of b. -func CopyAppend(a, b []byte) []byte { - dst := make([]byte, len(a)+len(b)) - copy(dst, a) - copy(dst[len(a):], b) - return dst -} From 09cfe39ea2a20ef4a28348bc8e73a119f71d519a Mon Sep 17 00:00:00 2001 From: yihuang Date: Mon, 8 Apr 2024 09:49:09 +0800 Subject: [PATCH 08/15] Update server/config/config.go Signed-off-by: yihuang --- server/config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/config/config.go b/server/config/config.go index 986bda5b51..eb5f6d3a29 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -124,7 +124,7 @@ type EVMConfig struct { Tracer string `mapstructure:"tracer"` // MaxTxGasWanted defines the gas wanted for each eth tx returned in ante handler in check tx mode. MaxTxGasWanted uint64 `mapstructure:"max-tx-gas-wanted"` - // BlockExecutor set block executor type, "block-stm" for parallel execution, "default" for sequential execution. + // BlockExecutor set block executor type, "block-stm" for parallel execution, "sequential" for sequential execution. BlockExecutor string `mapstructure:"block-executor"` // BlockSTMWorkers is the number of workers for block-stm execution, `0` means using all available CPUs. BlockSTMWorkers int `mapstructure:"block-stm-workers"` From 069eff523b7aa41f63f591ccbe9526bcaf5f3486 Mon Sep 17 00:00:00 2001 From: yihuang Date: Mon, 8 Apr 2024 09:54:31 +0800 Subject: [PATCH 09/15] Update server/config/toml.go Signed-off-by: yihuang --- server/config/toml.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/config/toml.go b/server/config/toml.go index 709d6d1461..b82d492c7f 100644 --- a/server/config/toml.go +++ b/server/config/toml.go @@ -31,7 +31,7 @@ tracer = "{{ .EVM.Tracer }}" # MaxTxGasWanted defines the gas wanted for each eth tx returned in ante handler in check tx mode. max-tx-gas-wanted = {{ .EVM.MaxTxGasWanted }} -# BlockExecutor set block executor type, "block-stm" for parallel execution, "default" for sequential execution. +# BlockExecutor set block executor type, "block-stm" for parallel execution, "sequential" for sequential execution. block-executor = "{{ .EVM.BlockExecutor }}" # BlockSTMWorkers is the number of workers for block-stm execution, 0 means using all available CPUs. block-stm-workers = {{ .EVM.BlockSTMWorkers }} From 2f44dde49c9ef963322ce30f4421e5e399cd5467 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Mon, 8 Apr 2024 09:55:02 +0800 Subject: [PATCH 10/15] cleanup --- app/app.go | 8 ++++++-- server/config/config.go | 9 +++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/app.go b/app/app.go index e21ea27108..a8c30d666e 100644 --- a/app/app.go +++ b/app/app.go @@ -132,6 +132,7 @@ import ( "github.com/evmos/ethermint/app/ante" "github.com/evmos/ethermint/encoding" "github.com/evmos/ethermint/ethereum/eip712" + srvconfig "github.com/evmos/ethermint/server/config" srvflags "github.com/evmos/ethermint/server/flags" ethermint "github.com/evmos/ethermint/types" "github.com/evmos/ethermint/x/evm" @@ -355,12 +356,15 @@ func NewEthermintApp( } executor := cast.ToString(appOpts.Get(srvflags.EVMBlockExecutor)) - if executor == "block-stm" { + switch executor { + case srvconfig.BlockExecutorBlockSTM: sdk.SetAddrCacheEnabled(false) workers := cast.ToInt(appOpts.Get(srvflags.EVMBlockSTMWorkers)) app.SetTxExecutor(STMTxExecutor(app.GetStoreKeys(), workers)) - } else { + case srvconfig.BlockExecutorSequential: app.SetTxExecutor(DefaultTxExecutor) + default: + panic(fmt.Errorf("unknown EVM block executor: %s", executor)) } // init params keeper and subspaces diff --git a/server/config/config.go b/server/config/config.go index eb5f6d3a29..926d45fb9b 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -97,6 +97,9 @@ const ( // DefaultRosettaDenomToSuggest defines the default denom for fee suggestion DefaultRosettaDenomToSuggest = "basecro" + + BlockExecutorSequential = "sequential" + BlockExecutorBlockSTM = "block-stm" ) var ( @@ -104,6 +107,8 @@ var ( DefaultRosettaGasPrices = sdk.NewDecCoins(sdk.NewDecCoin(DefaultRosettaDenomToSuggest, sdkmath.NewInt(4_000_000))) evmTracers = []string{"json", "markdown", "struct", "access_list"} + + blockExecutors = []string{"sequential", "block-stm"} ) // Config defines the server's top level configuration. It includes the default app config @@ -252,6 +257,10 @@ func (c EVMConfig) Validate() error { return fmt.Errorf("invalid tracer type %s, available types: %v", c.Tracer, evmTracers) } + if !strings.StringInSlice(c.BlockExecutor, blockExecutors) { + return fmt.Errorf("invalid block executor type %s, available types: %v", c.BlockExecutor, blockExecutors) + } + return nil } From dac706a9db5fb5c1e9893808620e7d7acb765641 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Mon, 8 Apr 2024 09:56:21 +0800 Subject: [PATCH 11/15] cleanup --- server/config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/config/config.go b/server/config/config.go index 926d45fb9b..578c5b8ae4 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -108,7 +108,7 @@ var ( evmTracers = []string{"json", "markdown", "struct", "access_list"} - blockExecutors = []string{"sequential", "block-stm"} + blockExecutors = []string{BlockExecutorSequential, BlockExecutorBlockSTM} ) // Config defines the server's top level configuration. It includes the default app config From 49a93b2b2c2c7e817fc9f6afebb453ccc0ab49f7 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Mon, 8 Apr 2024 09:57:26 +0800 Subject: [PATCH 12/15] cleanup --- server/config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/config/config.go b/server/config/config.go index 578c5b8ae4..cf2fb3fb06 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -247,7 +247,7 @@ func DefaultEVMConfig() *EVMConfig { return &EVMConfig{ Tracer: DefaultEVMTracer, MaxTxGasWanted: DefaultMaxTxGasWanted, - BlockExecutor: "sequential", + BlockExecutor: BlockExecutorSequential, } } From 60dde5e985c90dde82117b2a98d0732ec80af38d Mon Sep 17 00:00:00 2001 From: HuangYi Date: Mon, 8 Apr 2024 13:37:59 +0800 Subject: [PATCH 13/15] fix default executor --- app/app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index a8c30d666e..8ab1a57408 100644 --- a/app/app.go +++ b/app/app.go @@ -361,7 +361,7 @@ func NewEthermintApp( sdk.SetAddrCacheEnabled(false) workers := cast.ToInt(appOpts.Get(srvflags.EVMBlockSTMWorkers)) app.SetTxExecutor(STMTxExecutor(app.GetStoreKeys(), workers)) - case srvconfig.BlockExecutorSequential: + case "", srvconfig.BlockExecutorSequential: app.SetTxExecutor(DefaultTxExecutor) default: panic(fmt.Errorf("unknown EVM block executor: %s", executor)) From 12caed9f38862730c35c81608ccf060d725eb086 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Mon, 8 Apr 2024 10:47:36 +0800 Subject: [PATCH 14/15] Problem: codecov action v3 is pinging v4 (#458) --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 28b216458b..ab418bf56a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,7 +38,7 @@ jobs: run: | make test-unit-cover if: env.GIT_DIFF - - uses: codecov/codecov-action@v3 + - uses: codecov/codecov-action@v4 with: file: ./coverage.txt fail_ci_if_error: true From b641c58c438d0f7464184ae15a3e908d8d89c334 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Mon, 8 Apr 2024 11:50:05 +0800 Subject: [PATCH 15/15] fix test fix config --- server/config/config.go | 6 ++++-- x/evm/keeper/grpc_query_test.go | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/server/config/config.go b/server/config/config.go index cf2fb3fb06..8e9167719b 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -406,8 +406,10 @@ func GetConfig(v *viper.Viper) (Config, error) { return Config{ Config: cfg, EVM: EVMConfig{ - Tracer: v.GetString("evm.tracer"), - MaxTxGasWanted: v.GetUint64("evm.max-tx-gas-wanted"), + Tracer: v.GetString("evm.tracer"), + MaxTxGasWanted: v.GetUint64("evm.max-tx-gas-wanted"), + BlockExecutor: v.GetString("evm.block-executor"), + BlockSTMWorkers: v.GetInt("evm.block-stm-workers"), }, JSONRPC: JSONRPCConfig{ Enable: v.GetBool("json-rpc.enable"), diff --git a/x/evm/keeper/grpc_query_test.go b/x/evm/keeper/grpc_query_test.go index f61ce20c75..5ce91aa026 100644 --- a/x/evm/keeper/grpc_query_test.go +++ b/x/evm/keeper/grpc_query_test.go @@ -23,6 +23,7 @@ import ( ethermint "github.com/evmos/ethermint/types" "github.com/evmos/ethermint/x/evm/statedb" "github.com/evmos/ethermint/x/evm/types" + evmtypes "github.com/evmos/ethermint/x/evm/types" feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" @@ -460,7 +461,7 @@ func (suite *GRPCServerTestSuiteSuite) TestQueryTxLogs() { func(vmdb vm.StateDB) { expLogs = []*types.Log{ { - Address: suite.Address.String(), + Address: evmtypes.HexAddress(suite.Address.Bytes()), Topics: []string{common.BytesToHash([]byte("topic")).String()}, Data: []byte("data"), BlockNumber: 1,