imp(evm): define minimum GasUsed proportional to GasLimit (#1087)

* min gas denominator implementation

* update changelog

* modify MinGasDenominator type to sdk.Dec

* fix typo in comments

* add comments

* update comment

* refactor logic

* remove unnecesary test

* fix typo on proto

* rename param

* fix tests

* use truncate and run mod tidy

* comment to default value

* update changelog

* rename temporary gas used

* integration tests

* add migrations

* add default as var

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
crypto-facs
2022-05-25 13:52:34 +00:00
committed by GitHub
co-authored by Federico Kunze Küllmer
parent f06df8c265
commit c4417713fa
15 changed files with 364 additions and 129 deletions
+10
View File
@@ -1,5 +1,10 @@
package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
v2 "github.com/tharsis/ethermint/x/evm/migrations/v2"
)
// Migrator is a struct for handling in-place store migrations.
type Migrator struct {
keeper Keeper
@@ -11,3 +16,8 @@ func NewMigrator(keeper Keeper) Migrator {
keeper: keeper,
}
}
// Migrate1to2 migrates the store from consensus version v1 to v2
func (m Migrator) Migrate1to2(ctx sdk.Context) error {
return v2.AddMinGasMultiplierParam(ctx, &m.keeper.paramSpace)
}
+12 -4
View File
@@ -398,12 +398,12 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, msg core.Message, trace
if msg.Gas() < leftoverGas {
return nil, sdkerrors.Wrap(types.ErrGasOverflow, "apply message")
}
gasUsed := msg.Gas() - leftoverGas
refund := GasToRefund(stateDB.GetRefund(), gasUsed, refundQuotient)
if refund > gasUsed {
temporaryGasUsed := msg.Gas() - leftoverGas
refund := GasToRefund(stateDB.GetRefund(), temporaryGasUsed, refundQuotient)
if refund > temporaryGasUsed {
return nil, sdkerrors.Wrap(types.ErrGasOverflow, "apply message")
}
gasUsed -= refund
temporaryGasUsed -= refund
// EVM execution error needs to be available for the JSON-RPC client
var vmError string
@@ -418,6 +418,14 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, msg core.Message, trace
}
}
// calculate a minimum amount of gas to be charged to sender if GasLimit
// is considerably higher than GasUsed to stay more aligned with Tendermint gas mechanics
// for more info https://github.com/tharsis/ethermint/issues/1085
// NOTE: MinGasDenominator can not be negative as it is validated on ValidateParams
gasLimit := sdk.NewDec(int64(msg.Gas()))
minimumGasUsed := gasLimit.Mul(cfg.Params.MinGasMultiplier)
gasUsed := sdk.MaxDec(minimumGasUsed, sdk.NewDec(int64(temporaryGasUsed))).TruncateInt().Uint64()
return &types.MsgEthereumTxResponse{
GasUsed: gasUsed,
VmError: vmError,
+18
View File
@@ -0,0 +1,18 @@
package v2
import (
sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/tharsis/ethermint/x/evm/types"
)
// AddMinGasMultiplierParam updates the module parameter MinGasMultiplier to 0.5
func AddMinGasMultiplierParam(ctx sdk.Context, paramStore *paramtypes.Subspace) error {
if !paramStore.HasKeyTable() {
ps := paramStore.WithKeyTable(types.ParamKeyTable())
paramStore = &ps
}
paramStore.Set(ctx, types.ParamStoreKeyMinGasMultiplier, types.DefaultMinGasMultiplier)
return nil
}
+46
View File
@@ -0,0 +1,46 @@
package v2_test
import (
"fmt"
"github.com/cosmos/cosmos-sdk/testutil"
sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/stretchr/testify/require"
"github.com/tharsis/ethermint/app"
"github.com/tharsis/ethermint/encoding"
v2 "github.com/tharsis/ethermint/x/evm/migrations/v2"
"github.com/tharsis/ethermint/x/evm/types"
"testing"
)
func TestAddMinGasMultiplierParam(t *testing.T) {
encCfg := encoding.MakeConfig(app.ModuleBasics)
erc20Key := sdk.NewKVStoreKey(types.StoreKey)
tErc20Key := sdk.NewTransientStoreKey(fmt.Sprintf("%s_test", types.StoreKey))
ctx := testutil.DefaultContext(erc20Key, tErc20Key)
paramStore := paramtypes.NewSubspace(
encCfg.Marshaler, encCfg.Amino, erc20Key, tErc20Key, "erc20",
)
paramStore = paramStore.WithKeyTable(types.ParamKeyTable())
require.True(t, paramStore.HasKeyTable())
// check no param
require.False(t, paramStore.Has(ctx, types.ParamStoreKeyMinGasMultiplier))
// Run migrations
err := v2.AddMinGasMultiplierParam(ctx, &paramStore)
require.NoError(t, err)
// Make sure the params are set
require.True(t, paramStore.Has(ctx, types.ParamStoreKeyMinGasMultiplier))
var minGasMultiplier sdk.Dec
// Make sure the new params are set
require.NotPanics(t, func() {
paramStore.Get(ctx, types.ParamStoreKeyMinGasMultiplier, &minGasMultiplier)
})
// check the params is up
require.Equal(t, minGasMultiplier, types.DefaultMinGasMultiplier)
}
+8 -4
View File
@@ -44,7 +44,7 @@ func (AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) {
// ConsensusVersion returns the consensus state-breaking version for the module.
func (AppModuleBasic) ConsensusVersion() uint64 {
return 1
return 2
}
// DefaultGenesis returns default genesis state as raw bytes for the evm
@@ -117,13 +117,17 @@ func (AppModule) Name() string {
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {
}
// RegisterQueryService registers a GRPC query service to respond to the
// module-specific GRPC queries.
// RegisterServices registers a GRPC query service to respond to the
// module-specific GRPC queries and runs necessary migrations.
func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterMsgServer(cfg.MsgServer(), am.keeper)
types.RegisterQueryServer(cfg.QueryServer(), am.keeper)
_ = keeper.NewMigrator(*am.keeper)
migrator := keeper.NewMigrator(*am.keeper)
// register v1 -> v2 migration for MinGasMultiplierParam
if err := cfg.RegisterMigration(types.ModuleName, 1, migrator.Migrate1to2); err != nil {
panic(fmt.Errorf("failed to migrate %s to v2: %w", types.ModuleName, err))
}
}
// Route returns the message routing key for the evm module.
+1 -1
View File
@@ -48,7 +48,7 @@ func RandomizedGenState(simState *module.SimulationState) {
func(r *rand.Rand) { extraEIPs = GenExtraEIPs(r) },
)
params := types.NewParams(types.DefaultEVMDenom, true, true, types.DefaultChainConfig(), extraEIPs...)
params := types.NewParams(types.DefaultEVMDenom, true, true, types.DefaultChainConfig(), types.DefaultMinGasMultiplier, extraEIPs...)
evmGenesis := types.NewGenesisState(params, []types.GenesisAccount{})
bz, err := json.MarshalIndent(evmGenesis, "", " ")
+145 -94
View File
@@ -37,6 +37,9 @@ type Params struct {
ExtraEIPs []int64 `protobuf:"varint,4,rep,packed,name=extra_eips,json=extraEips,proto3" json:"extra_eips,omitempty" yaml:"extra_eips"`
// chain config defines the EVM chain configuration parameters
ChainConfig ChainConfig `protobuf:"bytes,5,opt,name=chain_config,json=chainConfig,proto3" json:"chain_config" yaml:"chain_config"`
// min gas denominator bounds the minimum gasUsed to be charged
// to senders based on GasLimit
MinGasMultiplier github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=min_gas_multiplier,json=minGasMultiplier,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_gas_multiplier"`
}
func (m *Params) Reset() { *m = Params{} }
@@ -657,100 +660,102 @@ func init() {
func init() { proto.RegisterFile("ethermint/evm/v1/evm.proto", fileDescriptor_d21ecc92c8c8583e) }
var fileDescriptor_d21ecc92c8c8583e = []byte{
// 1475 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xdf, 0x6e, 0xdb, 0xb6,
0x1a, 0x4f, 0x62, 0x27, 0x91, 0x69, 0xc7, 0x56, 0x98, 0x34, 0xc7, 0x4d, 0x71, 0xa2, 0x1c, 0x5d,
0x1c, 0xe4, 0x00, 0x6d, 0xdc, 0xa4, 0x08, 0x4e, 0xd1, 0x62, 0x17, 0x51, 0x92, 0xb6, 0xc9, 0xba,
0x2d, 0x60, 0x32, 0x0c, 0x18, 0x30, 0x08, 0xb4, 0xc4, 0xca, 0x5a, 0x24, 0xd1, 0x20, 0x29, 0xd7,
0x1e, 0xf6, 0x00, 0x03, 0x76, 0xb3, 0x47, 0xd8, 0x2b, 0xec, 0x2d, 0x8a, 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x59, 0xe2, 0xca, 0xf3, 0x5f, 0x91,
0xb9, 0xf2, 0x14, 0x2a, 0x2f, 0x92, 0xce, 0x43, 0x2c, 0x30, 0xba, 0x66, 0x39, 0x29, 0x1a, 0x45,
0x73, 0xfe, 0xa4, 0x68, 0x2c, 0x9a, 0xc6, 0x70, 0xfd, 0x7a, 0x16, 0x68, 0x65, 0x80, 0xc7, 0xe8,
0x1d, 0xe7, 0xdd, 0xe5, 0xc6, 0xec, 0xfb, 0xcb, 0x8d, 0xd9, 0x0f, 0x97, 0x1b, 0xb3, 0x3f, 0x7d,
0xdc, 0x98, 0x79, 0xff, 0x71, 0x63, 0xe6, 0xf7, 0x8f, 0x1b, 0x33, 0x5f, 0x6f, 0x8d, 0x7d, 0xce,
0x45, 0x0b, 0x33, 0x1e, 0xf2, 0xc6, 0xe8, 0x0f, 0x62, 0x57, 0xfe, 0x45, 0x94, 0x1f, 0xf5, 0xe6,
0x82, 0xfc, 0xeb, 0xf7, 0xe4, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x69, 0xef, 0x82, 0x39, 0x40,
0x0e, 0x00, 0x00,
// 1514 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xcf, 0x6e, 0xdb, 0x46,
0x1a, 0xb7, 0x2d, 0xd9, 0xa6, 0x46, 0xb2, 0x44, 0x8f, 0x1d, 0xaf, 0xe2, 0x60, 0x4d, 0x2f, 0x0f,
0x0b, 0x2f, 0x90, 0x58, 0xb1, 0x03, 0x63, 0x83, 0x04, 0x7b, 0xb0, 0x6c, 0x27, 0xb1, 0x37, 0xd9,
0x35, 0xc6, 0x5e, 0x2c, 0x50, 0xb4, 0x20, 0x46, 0xe4, 0x84, 0x62, 0x4d, 0x72, 0x84, 0x99, 0xa1,
0x22, 0x15, 0x7d, 0x80, 0x02, 0xbd, 0xf4, 0x11, 0xfa, 0x0a, 0x45, 0x5f,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93,
0xf1, 0x73, 0x60, 0xe5, 0xee, 0xad, 0x39, 0xcd, 0x65, 0xa3, 0xaa, 0x34, 0xe5, 0xdf, 0xfe, 0x93,
0xa2, 0x51, 0x35, 0x6b, 0x27, 0x45, 0xa3, 0x66, 0x9a, 0x27, 0x45, 0xc3, 0x34, 0x97, 0xd1, 0x52,
0x9f, 0x86, 0xd4, 0xe9, 0x3e, 0x51, 0x19, 0xa8, 0x4c, 0xde, 0x61, 0xae, 0x5f, 0x64, 0x54, 0x75,
0xb1, 0xc0, 0x61, 0x9f, 0x0b, 0x4d, 0xd7, 0x00, 0xf3, 0x67, 0x22, 0xbb, 0x75, 0x98, 0xa0, 0x70,
0x41, 0xfa, 0xea, 0x80, 0x44, 0xd9, 0x10, 0xae, 0x82, 0xf9, 0x2e, 0x0e, 0x13, 0x75, 0x7d, 0x29,
0x21, 0x05, 0xec, 0x53, 0x50, 0x3b, 0x67, 0x38, 0xe6, 0xd8, 0x15, 0x01, 0x8d, 0x5f, 0x53, 0x9f,
0x43, 0x08, 0x8a, 0xf2, 0x43, 0xad, 0x72, 0xe5, 0x18, 0xfe, 0x03, 0x14, 0x43, 0xea, 0xf3, 0xfa,
0xdc, 0x66, 0x61, 0xab, 0xbc, 0x7b, 0xef, 0xfa, 0x05, 0xe2, 0x35, 0xf5, 0x91, 0x0c, 0xb1, 0x7f,
0x99, 0x03, 0x85, 0xd7, 0xd4, 0x87, 0x75, 0xb0, 0x88, 0x3d, 0x8f, 0x11, 0xce, 0x35, 0xd3, 0x10,
0xc2, 0x35, 0xb0, 0x20, 0x68, 0x27, 0x70, 0x15, 0x5d, 0x09, 0x69, 0x94, 0x09, 0x7b, 0x58, 0x60,
0x79, 0xd4, 0x55, 0x90, 0x1c, 0xc3, 0x5d, 0x50, 0x91, 0x2b, 0x73, 0xe2, 0x24, 0x6a, 0x11, 0x26,
0x4f, 0xac, 0x62, 0xb3, 0x76, 0x95, 0x5a, 0x65, 0x69, 0xff, 0x8f, 0x34, 0xa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
0x7d, 0xff, 0xec, 0x47, 0x01, 0x8d, 0xe2, 0xb3, 0xc5, 0xe9, 0xff, 0x98, 0x88, 0x44, 0x94, 0xf5,
0xe5, 0x71, 0xaa, 0x17, 0xa7, 0x1c, 0x6f, 0xa4, 0x1d, 0x4d, 0x20, 0xd8, 0x04, 0x50, 0xa7, 0x31,
0x22, 0x12, 0x16, 0x3b, 0xf2, 0xfd, 0xaf, 0xc8, 0x5c, 0xf9, 0x16, 0x2a, 0x2f, 0x92, 0xce, 0x43,
0x2c, 0x30, 0xba, 0x66, 0x39, 0x29, 0x1a, 0x45, 0x73, 0xfe, 0xa4, 0x68, 0x2c, 0x9a, 0x46, 0xbe,
0x7e, 0x3d, 0x0b, 0xb4, 0x32, 0xc4, 0x63, 0xf4, 0xcd, 0xe6, 0xfb, 0xcb, 0x8d, 0xd9, 0x0f, 0x97,
0x1b, 0xb3, 0x1f, 0x2f, 0x37, 0x66, 0x7f, 0xf8, 0xb4, 0x31, 0xf3, 0xe1, 0xd3, 0xc6, 0xcc, 0xaf,
0x9f, 0x36, 0x66, 0xbe, 0xd8, 0x1a, 0xfb, 0x9c, 0x8b, 0x36, 0x66, 0x3c, 0xe0, 0x8d, 0xd1, 0xef,
0x67, 0x4f, 0xfe, 0x80, 0xca, 0x8f, 0x7a, 0x6b, 0x41, 0xfe, 0x58, 0x3e, 0xf9, 0x3d, 0x00, 0x00,
0xff, 0xff, 0xc9, 0xc5, 0x98, 0x42, 0x9e, 0x0e, 0x00, 0x00,
}
func (m *Params) Marshal() (dAtA []byte, err error) {
@@ -773,6 +778,16 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
{
size := m.MinGasMultiplier.Size()
i -= size
if _, err := m.MinGasMultiplier.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintEvm(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x32
{
size, err := m.ChainConfig.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
@@ -1465,6 +1480,8 @@ func (m *Params) Size() (n int) {
}
l = m.ChainConfig.Size()
n += 1 + l + sovEvm(uint64(l))
l = m.MinGasMultiplier.Size()
n += 1 + l + sovEvm(uint64(l))
return n
}
@@ -1925,6 +1942,40 @@ func (m *Params) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MinGasMultiplier", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvm
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvm
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvm
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.MinGasMultiplier.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipEvm(dAtA[iNdEx:])
+48 -16
View File
@@ -18,13 +18,17 @@ const (
DefaultEVMDenom = types.AttoPhoton
)
// DefaultMinGasMultiplier is 0.5 or 50%
var DefaultMinGasMultiplier = sdk.NewDecWithPrec(50, 2)
// Parameter keys
var (
ParamStoreKeyEVMDenom = []byte("EVMDenom")
ParamStoreKeyEnableCreate = []byte("EnableCreate")
ParamStoreKeyEnableCall = []byte("EnableCall")
ParamStoreKeyExtraEIPs = []byte("EnableExtraEIPs")
ParamStoreKeyChainConfig = []byte("ChainConfig")
ParamStoreKeyEVMDenom = []byte("EVMDenom")
ParamStoreKeyEnableCreate = []byte("EnableCreate")
ParamStoreKeyEnableCall = []byte("EnableCall")
ParamStoreKeyExtraEIPs = []byte("EnableExtraEIPs")
ParamStoreKeyChainConfig = []byte("ChainConfig")
ParamStoreKeyMinGasMultiplier = []byte("MinGasMultiplier")
// AvailableExtraEIPs define the list of all EIPs that can be enabled by the
// EVM interpreter. These EIPs are applied in order and can override the
@@ -40,13 +44,14 @@ func ParamKeyTable() paramtypes.KeyTable {
}
// NewParams creates a new Params instance
func NewParams(evmDenom string, enableCreate, enableCall bool, config ChainConfig, extraEIPs ...int64) Params {
func NewParams(evmDenom string, enableCreate, enableCall bool, config ChainConfig, minGasMultiplier sdk.Dec, extraEIPs ...int64) Params {
return Params{
EvmDenom: evmDenom,
EnableCreate: enableCreate,
EnableCall: enableCall,
ExtraEIPs: extraEIPs,
ChainConfig: config,
EvmDenom: evmDenom,
EnableCreate: enableCreate,
EnableCall: enableCall,
ExtraEIPs: extraEIPs,
ChainConfig: config,
MinGasMultiplier: minGasMultiplier,
}
}
@@ -54,11 +59,12 @@ func NewParams(evmDenom string, enableCreate, enableCall bool, config ChainConfi
// ExtraEIPs is empty to prevent overriding the latest hard fork instruction set
func DefaultParams() Params {
return Params{
EvmDenom: DefaultEVMDenom,
EnableCreate: true,
EnableCall: true,
ChainConfig: DefaultChainConfig(),
ExtraEIPs: nil,
EvmDenom: DefaultEVMDenom,
EnableCreate: true,
EnableCall: true,
ChainConfig: DefaultChainConfig(),
ExtraEIPs: nil,
MinGasMultiplier: DefaultMinGasMultiplier,
}
}
@@ -70,6 +76,7 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
paramtypes.NewParamSetPair(ParamStoreKeyEnableCall, &p.EnableCall, validateBool),
paramtypes.NewParamSetPair(ParamStoreKeyExtraEIPs, &p.ExtraEIPs, validateEIPs),
paramtypes.NewParamSetPair(ParamStoreKeyChainConfig, &p.ChainConfig, validateChainConfig),
paramtypes.NewParamSetPair(ParamStoreKeyMinGasMultiplier, &p.MinGasMultiplier, validateMinGasMultiplier),
}
}
@@ -83,6 +90,10 @@ func (p Params) Validate() error {
return err
}
if err := validateMinGasMultiplier(p.MinGasMultiplier); err != nil {
return err
}
return p.ChainConfig.Validate()
}
@@ -127,6 +138,27 @@ func validateEIPs(i interface{}) error {
return nil
}
func validateMinGasMultiplier(i interface{}) error {
v, ok := i.(sdk.Dec)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
if v.IsNil() {
return fmt.Errorf("invalid parameter: nil")
}
if v.IsNegative() {
return fmt.Errorf("value cannot be negative: %T", i)
}
if v.GT(sdk.OneDec()) {
return fmt.Errorf("value cannot be greater than 1: %T", i)
}
return nil
}
func validateChainConfig(i interface{}) error {
cfg, ok := i.(ChainConfig)
if !ok {
+7 -5
View File
@@ -1,6 +1,7 @@
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"testing"
"github.com/ethereum/go-ethereum/params"
@@ -22,7 +23,7 @@ func TestParamsValidate(t *testing.T) {
{"default", DefaultParams(), false},
{
"valid",
NewParams("ara", true, true, DefaultChainConfig(), 2929, 1884, 1344),
NewParams("ara", true, true, DefaultChainConfig(), DefaultMinGasMultiplier, 2929, 1884, 1344),
false,
},
{
@@ -46,9 +47,9 @@ func TestParamsValidate(t *testing.T) {
true,
},
{
"invalid chain config",
NewParams("ara", true, true, ChainConfig{}, 2929, 1884, 1344),
false,
"invalid min gas multplier",
NewParams("ara", true, true, DefaultChainConfig(), sdk.NewDec(2), 2929, 1884, 1344),
true,
},
}
@@ -64,7 +65,7 @@ func TestParamsValidate(t *testing.T) {
}
func TestParamsEIPs(t *testing.T) {
params := NewParams("ara", true, true, DefaultChainConfig(), 2929, 1884, 1344)
params := NewParams("ara", true, true, DefaultChainConfig(), DefaultMinGasMultiplier, 2929, 1884, 1344)
actual := params.EIPs()
require.Equal(t, []int([]int{2929, 1884, 1344}), actual)
@@ -77,6 +78,7 @@ func TestParamsValidatePriv(t *testing.T) {
require.NoError(t, validateBool(true))
require.Error(t, validateEIPs(""))
require.NoError(t, validateEIPs([]int64{1884}))
require.Error(t, validateMinGasMultiplier(sdk.NewDec(-5)))
}
func TestValidateChainConfig(t *testing.T) {