Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export GO111MODULE = on

# evmd is a separate module under ./evmd
EVMD_DIR := evmd
EVMD_MAIN_PKG := ./cmd/evmd

###############################################################################
### Build & Install evmd ###
Expand Down Expand Up @@ -91,7 +90,7 @@ endif
build: go.sum $(BUILDDIR)/
@echo "🏗️ Building evmd to $(BUILDDIR)/$(EXAMPLE_BINARY) ..."
@cd $(EVMD_DIR) && CGO_ENABLED="1" \
go build $(BUILD_FLAGS) -o $(BUILDDIR)/$(EXAMPLE_BINARY) $(EVMD_MAIN_PKG)
go build $(BUILD_FLAGS) -o $(BUILDDIR)/$(EXAMPLE_BINARY)

# Cross-compile for Linux AMD64
build-linux:
Expand All @@ -101,7 +100,7 @@ build-linux:
install: go.sum
@echo "🚚 Installing evmd to $(BINDIR) ..."
@cd $(EVMD_DIR) && CGO_ENABLED="1" \
go install $(BUILD_FLAGS) $(EVMD_MAIN_PKG)
go install $(BUILD_FLAGS)

$(BUILDDIR)/:
mkdir -p $(BUILDDIR)/
Expand Down
10 changes: 5 additions & 5 deletions ante/cosmos/authz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/cosmos/evm/ante/cosmos"
"github.com/cosmos/evm/encoding"
"github.com/cosmos/evm/testutil"
"github.com/cosmos/evm/testutil/constants"
testconfig "github.com/cosmos/evm/testutil/config"
evmtypes "github.com/cosmos/evm/x/vm/types"

sdk "github.com/cosmos/cosmos-sdk/types"
Expand All @@ -21,12 +21,12 @@ import (
)

func TestAuthzLimiterDecorator(t *testing.T) {
evmConfigurator := evmtypes.NewEVMConfigurator().
WithEVMCoinInfo(constants.ExampleChainCoinInfo[constants.ExampleChainID])
err := evmConfigurator.Configure()
evmConfigurator := evmtypes.NewEvmConfig().
WithEVMCoinInfo(testconfig.ExampleChainCoinInfo[testconfig.ExampleChainID])
err := evmConfigurator.Apply()
require.NoError(t, err)

encodingCfg := encoding.MakeConfig(constants.ExampleChainID.EVMChainID)
encodingCfg := encoding.MakeConfig(testconfig.ExampleChainID.EVMChainID)
txCfg := encodingCfg.TxConfig
testPrivKeys, testAddresses, err := testutil.GeneratePrivKeyAddressPairs(5)
require.NoError(t, err)
Expand Down
23 changes: 12 additions & 11 deletions ante/evm/fee_checker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (

"github.com/cosmos/evm/ante/evm"
anteinterfaces "github.com/cosmos/evm/ante/interfaces"
evmconfig "github.com/cosmos/evm/config"
"github.com/cosmos/evm/encoding"
"github.com/cosmos/evm/testutil/config"
testconstants "github.com/cosmos/evm/testutil/constants"
testconfig "github.com/cosmos/evm/testutil/config"
"github.com/cosmos/evm/types"
feemarkettypes "github.com/cosmos/evm/x/feemarket/types"
evmtypes "github.com/cosmos/evm/x/vm/types"
Expand Down Expand Up @@ -57,9 +57,10 @@ func TestSDKTxFeeChecker(t *testing.T) {
// with extension option
// without extension option
// london hardfork enableness
chainID := uint64(config.EighteenDecimalsChainID)
encodingConfig := encoding.MakeConfig(chainID)
err := config.EvmAppOptions(chainID)

chainConfig := evmconfig.NewTestChainConfig(evmconfig.DefaultEvmChainID)
encodingConfig := encoding.MakeConfig(chainConfig.EvmChainID)
err := chainConfig.ApplyChainConfig()
require.NoError(t, err)

evmDenom := evmtypes.GetEVMCoinDenom()
Expand Down Expand Up @@ -110,7 +111,7 @@ func TestSDKTxFeeChecker(t *testing.T) {
func() sdk.FeeTx {
txBuilder := encodingConfig.TxConfig.NewTxBuilder()
txBuilder.SetGasLimit(1)
txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin(testconstants.ExampleAttoDenom, math.NewInt(10))))
txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin(testconfig.ExampleAttoDenom, math.NewInt(10))))
return txBuilder.GetTx()
},
false,
Expand Down Expand Up @@ -155,7 +156,7 @@ func TestSDKTxFeeChecker(t *testing.T) {
func() sdk.FeeTx {
txBuilder := encodingConfig.TxConfig.NewTxBuilder()
txBuilder.SetGasLimit(1)
txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin(testconstants.ExampleAttoDenom, math.NewInt(10))))
txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin(testconfig.ExampleAttoDenom, math.NewInt(10))))
return txBuilder.GetTx()
},
true,
Expand All @@ -172,7 +173,7 @@ func TestSDKTxFeeChecker(t *testing.T) {
func() sdk.FeeTx {
txBuilder := encodingConfig.TxConfig.NewTxBuilder()
txBuilder.SetGasLimit(1)
txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin(testconstants.ExampleAttoDenom, math.NewInt(10).Mul(evmtypes.DefaultPriorityReduction).Add(math.NewInt(10)))))
txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin(testconfig.ExampleAttoDenom, math.NewInt(10).Mul(evmtypes.DefaultPriorityReduction).Add(math.NewInt(10)))))
return txBuilder.GetTx()
},
true,
Expand All @@ -189,7 +190,7 @@ func TestSDKTxFeeChecker(t *testing.T) {
func() sdk.FeeTx {
txBuilder := encodingConfig.TxConfig.NewTxBuilder().(authtx.ExtensionOptionsTxBuilder)
txBuilder.SetGasLimit(1)
txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin(testconstants.ExampleAttoDenom, math.NewInt(10).Mul(evmtypes.DefaultPriorityReduction))))
txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin(testconfig.ExampleAttoDenom, math.NewInt(10).Mul(evmtypes.DefaultPriorityReduction))))

option, err := codectypes.NewAnyWithValue(&types.ExtensionOptionDynamicFeeTx{})
require.NoError(t, err)
Expand All @@ -210,7 +211,7 @@ func TestSDKTxFeeChecker(t *testing.T) {
func() sdk.FeeTx {
txBuilder := encodingConfig.TxConfig.NewTxBuilder().(authtx.ExtensionOptionsTxBuilder)
txBuilder.SetGasLimit(1)
txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin(testconstants.ExampleAttoDenom, math.NewInt(10).Mul(evmtypes.DefaultPriorityReduction).Add(math.NewInt(10)))))
txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin(testconfig.ExampleAttoDenom, math.NewInt(10).Mul(evmtypes.DefaultPriorityReduction).Add(math.NewInt(10)))))

option, err := codectypes.NewAnyWithValue(&types.ExtensionOptionDynamicFeeTx{
MaxPriorityPrice: math.LegacyNewDec(5).MulInt(evmtypes.DefaultPriorityReduction),
Expand All @@ -233,7 +234,7 @@ func TestSDKTxFeeChecker(t *testing.T) {
func() sdk.FeeTx {
txBuilder := encodingConfig.TxConfig.NewTxBuilder().(authtx.ExtensionOptionsTxBuilder)
txBuilder.SetGasLimit(1)
txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin(testconstants.ExampleAttoDenom, math.NewInt(10).Mul(evmtypes.DefaultPriorityReduction).Add(math.NewInt(10)))))
txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin(testconfig.ExampleAttoDenom, math.NewInt(10).Mul(evmtypes.DefaultPriorityReduction).Add(math.NewInt(10)))))

// set negative priority fee
option, err := codectypes.NewAnyWithValue(&types.ExtensionOptionDynamicFeeTx{
Expand Down
8 changes: 4 additions & 4 deletions ante/evm/mono_decorator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"

"github.com/cosmos/evm/ante/evm"
evmconfig "github.com/cosmos/evm/config"
"github.com/cosmos/evm/crypto/ethsecp256k1"
"github.com/cosmos/evm/encoding"
"github.com/cosmos/evm/testutil/config"
utiltx "github.com/cosmos/evm/testutil/tx"
feemarkettypes "github.com/cosmos/evm/x/feemarket/types"
"github.com/cosmos/evm/x/vm/statedb"
Expand Down Expand Up @@ -144,9 +144,9 @@ func toMsgSlice(msgs []*evmsdktypes.MsgEthereumTx) []sdk.Msg {
}

func TestMonoDecorator(t *testing.T) {
chainID := uint64(config.EighteenDecimalsChainID)
require.NoError(t, config.EvmAppOptions(chainID))
cfg := encoding.MakeConfig(chainID)
chainConfig := evmconfig.NewTestChainConfig(evmconfig.DefaultEvmChainID)
require.NoError(t, chainConfig.ApplyChainConfig())
cfg := encoding.MakeConfig(chainConfig.EvmChainID)

testCases := []struct {
name string
Expand Down
46 changes: 0 additions & 46 deletions client/config.go

This file was deleted.

28 changes: 0 additions & 28 deletions client/config_test.go

This file was deleted.

18 changes: 0 additions & 18 deletions client/context.go

This file was deleted.

42 changes: 42 additions & 0 deletions client/flags/flags.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package flags

import (
"github.com/cosmos/evm/config"

Check failure on line 4 in client/flags/flags.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

File is not properly formatted (gci)
"github.com/spf13/cobra"
"github.com/spf13/viper"
)

// Client configuration flags
const (
// Custom client flags that will be added to client.toml
DisplayDenom = "coin-info.display-denom"
Decimals = "coin-info.decimals"
ExtendedDecimals = "coin-info.extended-decimals"
)

// Default values for client flags
const (
DefaultDisplayDenom = config.DisplayDenom
DefaultDecimals = config.Decimals
DefaultExtendedDecimals = config.ExtendedDecimals
)

// AddClientFlags adds custom client flags to the command
func AddClientFlags(cmd *cobra.Command) error {
cmd.PersistentFlags().String(DisplayDenom, DefaultDisplayDenom, "the display denom used to derive the denom and extended denom")
cmd.PersistentFlags().Uint8(Decimals, uint8(DefaultDecimals), "the decimals for the base denomination")
cmd.PersistentFlags().Uint8(ExtendedDecimals, uint8(DefaultExtendedDecimals), "the decimals for the extended denomination")

// Bind flags to viper for client.toml precedence
if err := viper.BindPFlag(DisplayDenom, cmd.PersistentFlags().Lookup(DisplayDenom)); err != nil {
return err
}
if err := viper.BindPFlag(Decimals, cmd.PersistentFlags().Lookup(Decimals)); err != nil {
return err
}
if err := viper.BindPFlag(ExtendedDecimals, cmd.PersistentFlags().Lookup(ExtendedDecimals)); err != nil {

Check failure on line 37 in client/flags/flags.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

if-return: redundant if ...; err != nil check, just return error instead. (revive)
return err
}

return nil
}
101 changes: 0 additions & 101 deletions client/keys.go

This file was deleted.

Loading
Loading