Skip to content

Commit bebba5f

Browse files
authored
chore: move relevant hardcoded configs back to evmd as an example (#751)
* move relevant hardcoded configs back to evmd as an example * undo makefile * lints
1 parent 0bc9eb3 commit bebba5f

File tree

33 files changed

+244
-360
lines changed

33 files changed

+244
-360
lines changed

ante/evm/fee_checker_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010

1111
"github.com/cosmos/evm/ante/evm"
1212
"github.com/cosmos/evm/ante/types"
13-
"github.com/cosmos/evm/config"
1413
"github.com/cosmos/evm/encoding"
1514
testconstants "github.com/cosmos/evm/testutil/constants"
1615
feemarkettypes "github.com/cosmos/evm/x/feemarket/types"
@@ -34,7 +33,7 @@ func TestSDKTxFeeChecker(t *testing.T) {
3433
// with extension option
3534
// without extension option
3635
// london hardfork enableness
37-
chainID := uint64(config.EighteenDecimalsChainID)
36+
chainID := uint64(testconstants.EighteenDecimalsChainID)
3837
encodingConfig := encoding.MakeConfig(chainID) //nolint:staticcheck // this is used
3938

4039
configurator := evmtypes.NewEVMConfigurator()
@@ -47,7 +46,7 @@ func TestSDKTxFeeChecker(t *testing.T) {
4746
err := configurator.
4847
WithExtendedEips(evmtypes.DefaultCosmosEVMActivators).
4948
// NOTE: we're using the 18 decimals default for the example chain
50-
WithEVMCoinInfo(config.ChainsCoinInfo[chainID]).
49+
WithEVMCoinInfo(testconstants.ChainsCoinInfo[chainID]).
5150
Configure()
5251
require.NoError(t, err)
5352
if err != nil {

ante/evm/mono_decorator_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ import (
1717
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
1818

1919
"github.com/cosmos/evm/ante/evm"
20-
"github.com/cosmos/evm/config"
2120
"github.com/cosmos/evm/crypto/ethsecp256k1"
2221
"github.com/cosmos/evm/encoding"
22+
"github.com/cosmos/evm/testutil/constants"
2323
utiltx "github.com/cosmos/evm/testutil/tx"
2424
feemarkettypes "github.com/cosmos/evm/x/feemarket/types"
2525
"github.com/cosmos/evm/x/vm/statedb"
@@ -146,7 +146,7 @@ func toMsgSlice(msgs []*evmsdktypes.MsgEthereumTx) []sdk.Msg {
146146
}
147147

148148
func TestMonoDecorator(t *testing.T) {
149-
chainID := uint64(config.EighteenDecimalsChainID)
149+
chainID := uint64(constants.EighteenDecimalsChainID)
150150
cfg := encoding.MakeConfig(chainID)
151151

152152
testCases := []struct {

config/chain_id.go

Lines changed: 0 additions & 29 deletions
This file was deleted.

config/constants.go

Lines changed: 0 additions & 29 deletions
This file was deleted.

config/evmd_config.go

Lines changed: 0 additions & 130 deletions
This file was deleted.

ethereum/eip712/preprocess_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
// Testing Constants
3030
var (
3131
// chainID is used in EIP-712 tests.
32-
chainID = uint64(constants.ExampleEIP155ChainID)
32+
chainID = uint64(constants.EighteenDecimalsChainID)
3333

3434
ctx = client.Context{}.WithTxConfig(
3535
encoding.MakeConfig(chainID).TxConfig,

evmd/app.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import (
2121
dbm "github.com/cosmos/cosmos-db"
2222
evmante "github.com/cosmos/evm/ante"
2323
antetypes "github.com/cosmos/evm/ante/types"
24-
evmconfig "github.com/cosmos/evm/config"
2524
evmencoding "github.com/cosmos/evm/encoding"
2625
evmaddress "github.com/cosmos/evm/encoding/address"
26+
evmconfig "github.com/cosmos/evm/evmd/config"
2727
evmmempool "github.com/cosmos/evm/mempool"
2828
precompiletypes "github.com/cosmos/evm/precompiles/types"
2929
srvflags "github.com/cosmos/evm/server/flags"
@@ -405,7 +405,7 @@ func NewExampleApp(
405405

406406
app.GovKeeper = *govKeeper.SetHooks(
407407
govtypes.NewMultiGovHooks(
408-
// register the governance hooks
408+
// register the governance hooks
409409
),
410410
)
411411

evmd/cmd/evmd/cmd/root.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cmd
22

33
import (
44
"errors"
5+
"github.com/cosmos/evm/utils"
56
"github.com/cosmos/evm/x/vm/types"
67
"io"
78
"os"
@@ -17,9 +18,9 @@ import (
1718
dbm "github.com/cosmos/cosmos-db"
1819
cosmosevmcmd "github.com/cosmos/evm/client"
1920
evmdebug "github.com/cosmos/evm/client/debug"
20-
"github.com/cosmos/evm/config"
2121
cosmosevmkeyring "github.com/cosmos/evm/crypto/keyring"
2222
"github.com/cosmos/evm/evmd"
23+
"github.com/cosmos/evm/evmd/config"
2324
cosmosevmserver "github.com/cosmos/evm/server"
2425
srvflags "github.com/cosmos/evm/server/flags"
2526

@@ -126,7 +127,7 @@ func NewRootCmd() *cobra.Command {
126127
return err
127128
}
128129

129-
customAppTemplate, customAppConfig := config.InitAppConfig(types.DefaultEVMExtendedDenom, config.EVMChainID) // TODO:VLAD - Remove this
130+
customAppTemplate, customAppConfig := config.InitAppConfig(types.DefaultEVMExtendedDenom, types.DefaultEVMChainID) // TODO:VLAD - Remove this
130131
customTMConfig := initCometConfig()
131132

132133
return sdkserver.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, customTMConfig)
@@ -371,7 +372,7 @@ func getChainIDFromOpts(appOpts servertypes.AppOptions) (chainID string, err err
371372
if chainID == "" {
372373
// If not available load from home
373374
homeDir := cast.ToString(appOpts.Get(flags.FlagHome))
374-
chainID, err = config.GetChainIDFromHome(homeDir)
375+
chainID, err = utils.GetChainIDFromHome(homeDir)
375376
if err != nil {
376377
return "", err
377378
}

evmd/cmd/evmd/cmd/testnet.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"path/filepath"
1010
"time"
1111

12-
"github.com/cosmos/evm/config"
12+
"github.com/cosmos/evm/evmd/config"
1313

1414
cosmosevmhd "github.com/cosmos/evm/crypto/hd"
1515
cosmosevmkeyring "github.com/cosmos/evm/crypto/keyring"
@@ -324,7 +324,7 @@ func initTestnetFiles(
324324
appConfig.Telemetry.EnableHostnameLabel = false
325325
appConfig.Telemetry.GlobalLabels = [][]string{{"chain_id", args.chainID}}
326326
evm := cosmosevmserverconfig.DefaultEVMConfig()
327-
evm.EVMChainID = config.EVMChainID
327+
evm.EVMChainID = evmtypes.DefaultEVMChainID
328328
evmCfg := config.EVMAppConfig{
329329
Config: *appConfig,
330330
EVM: *evm,
@@ -572,7 +572,7 @@ func initGenFiles(
572572
var bankGenState banktypes.GenesisState
573573
clientCtx.Codec.MustUnmarshalJSON(appGenState[banktypes.ModuleName], &bankGenState)
574574

575-
bankGenState.DenomMetadata = append(bankGenState.DenomMetadata, evmnetwork.GenerateBankGenesisMetadata(config.EVMChainID)...)
575+
bankGenState.DenomMetadata = append(bankGenState.DenomMetadata, evmnetwork.GenerateBankGenesisMetadata(evmtypes.DefaultEVMChainID)...)
576576

577577
bankGenState.Balances = banktypes.SanitizeGenesisBalances(genBalances)
578578
for _, bal := range bankGenState.Balances {

evmd/cmd/evmd/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66

77
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
88
sdk "github.com/cosmos/cosmos-sdk/types"
9-
"github.com/cosmos/evm/config"
109
"github.com/cosmos/evm/evmd/cmd/evmd/cmd"
10+
"github.com/cosmos/evm/evmd/config"
1111
)
1212

1313
func main() {

0 commit comments

Comments
 (0)