upgrade to ethermint v0.21.0 #99

Closed
0xmuralik wants to merge 384 commits from murali/update-fork into main
15 changed files with 364 additions and 129 deletions
Showing only changes of commit c4417713fa - Show all commits

View File

@ -57,6 +57,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### State Machine Breaking ### State Machine Breaking
* (ante) [tharsis#1060](https://github.com/tharsis/ethermint/pull/1060) Check `EnableCreate`/`EnableCall` in `AnteHandler` to short-circuit EVM transactions. * (ante) [tharsis#1060](https://github.com/tharsis/ethermint/pull/1060) Check `EnableCreate`/`EnableCall` in `AnteHandler` to short-circuit EVM transactions.
* (evm) [tharsis#1087](https://github.com/tharsis/ethermint/pull/1087) Minimum GasUsed proportional to GasLimit and `MinGasDenominator` EVM module param.
### API Breaking ### API Breaking

View File

@ -227,6 +227,7 @@ Params defines the EVM module parameters
| `enable_call` | [bool](#bool) | | enable call toggles state transitions that use the vm.Call function | | `enable_call` | [bool](#bool) | | enable call toggles state transitions that use the vm.Call function |
| `extra_eips` | [int64](#int64) | repeated | extra eips defines the additional EIPs for the vm.Config | | `extra_eips` | [int64](#int64) | repeated | extra eips defines the additional EIPs for the vm.Config |
| `chain_config` | [ChainConfig](#ethermint.evm.v1.ChainConfig) | | chain config defines the EVM chain configuration parameters | | `chain_config` | [ChainConfig](#ethermint.evm.v1.ChainConfig) | | chain config defines the EVM chain configuration parameters |
| `min_gas_multiplier` | [string](#string) | | min gas denominator bounds the minimum gasUsed to be charged to senders based on GasLimit |

4
go.mod
View File

@ -31,7 +31,7 @@ require (
github.com/tendermint/tendermint v0.34.20-0.20220517115723-e6f071164839 github.com/tendermint/tendermint v0.34.20-0.20220517115723-e6f071164839
github.com/tendermint/tm-db v0.6.7 github.com/tendermint/tm-db v0.6.7
github.com/tyler-smith/go-bip39 v1.1.0 github.com/tyler-smith/go-bip39 v1.1.0
google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4 google.golang.org/genproto v0.0.0-20220518221133-4f43b3371335
google.golang.org/grpc v1.46.2 google.golang.org/grpc v1.46.2
google.golang.org/protobuf v1.28.0 google.golang.org/protobuf v1.28.0
gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v2 v2.4.0
@ -138,7 +138,7 @@ require (
github.com/tklauser/numcpus v0.2.2 // indirect github.com/tklauser/numcpus v0.2.2 // indirect
github.com/zondax/hid v0.9.0 // indirect github.com/zondax/hid v0.9.0 // indirect
go.etcd.io/bbolt v1.3.6 // indirect go.etcd.io/bbolt v1.3.6 // indirect
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect golang.org/x/crypto v0.0.0-20220518034528-6f7dac969898 // indirect
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect

7
go.sum
View File

@ -1241,8 +1241,9 @@ golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5y
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210915214749-c084706c2272/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210915214749-c084706c2272/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA=
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220518034528-6f7dac969898 h1:SLP7Q4Di66FONjDJbCYrCRrh97focO6sLogHO7/g8F0=
golang.org/x/crypto v0.0.0-20220518034528-6f7dac969898/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@ -1731,8 +1732,8 @@ google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2
google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI=
google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E=
google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=
google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4 h1:myaecH64R0bIEDjNORIel4iXubqzaHU1K2z8ajBwWcM= google.golang.org/genproto v0.0.0-20220518221133-4f43b3371335 h1:2D0OT6tPVdrQTOnVe1VQjfJPTED6EZ7fdJ/f6Db6OsY=
google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/genproto v0.0.0-20220518221133-4f43b3371335/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4=
google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o= google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o=
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=

View File

@ -24,6 +24,12 @@ message Params {
(gogoproto.moretags) = "yaml:\"chain_config\"", (gogoproto.moretags) = "yaml:\"chain_config\"",
(gogoproto.nullable) = false (gogoproto.nullable) = false
]; ];
// min gas denominator bounds the minimum gasUsed to be charged
// to senders based on GasLimit
string min_gas_multiplier = 6 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
} }
// ChainConfig defines the Ethereum ChainConfig parameters using *sdk.Int values // ChainConfig defines the Ethereum ChainConfig parameters using *sdk.Int values

View File

@ -837,3 +837,58 @@ func (s *IntegrationTestSuite) TestBatchETHTransactions() {
s.Require().Equal(accountNonce+uint64(i)+1, tx.Nonce()) s.Require().Equal(accountNonce+uint64(i)+1, tx.Nonce())
} }
} }
func (s *IntegrationTestSuite) TestGasConsumptionOnNormalTransfer() {
testCases := []struct {
name string
gasLimit uint64
expectedGasUsed uint64
}{
{
"gas used is the same as gas limit",
21000,
21000,
},
{
"gas used is half of Gas limit",
70000,
35000,
},
{
"gas used is less than half of gasLimit",
30000,
21000,
},
}
recipient := common.HexToAddress("0x378c50D9264C63F3F92B806d4ee56E9D86FfB3Ec")
chainID, err := s.network.Validators[0].JSONRPCClient.ChainID(s.ctx)
s.Require().NoError(err)
from := common.BytesToAddress(s.network.Validators[0].Address)
for _, tc := range testCases {
s.Run(tc.name, func() {
nonce := s.getAccountNonce(from)
s.Require().NoError(err)
gasPrice := s.getGasPrice()
msgTx := evmtypes.NewTx(
chainID,
nonce,
&recipient,
nil,
tc.gasLimit,
gasPrice,
nil, nil,
nil,
nil,
)
msgTx.From = from.Hex()
err = msgTx.Sign(s.ethSigner, s.network.Validators[0].ClientCtx.Keyring)
s.Require().NoError(err)
err := s.network.Validators[0].JSONRPCClient.SendTransaction(s.ctx, msgTx.AsTransaction())
s.Require().NoError(err)
s.waitForTransaction()
receipt := s.expectSuccessReceipt(msgTx.AsTransaction().Hash())
s.Equal(receipt.GasUsed, tc.expectedGasUsed)
})
}
}

View File

@ -1,5 +1,10 @@
package keeper 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. // Migrator is a struct for handling in-place store migrations.
type Migrator struct { type Migrator struct {
keeper Keeper keeper Keeper
@ -11,3 +16,8 @@ func NewMigrator(keeper Keeper) Migrator {
keeper: keeper, 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)
}

View File

@ -398,12 +398,12 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, msg core.Message, trace
if msg.Gas() < leftoverGas { if msg.Gas() < leftoverGas {
return nil, sdkerrors.Wrap(types.ErrGasOverflow, "apply message") return nil, sdkerrors.Wrap(types.ErrGasOverflow, "apply message")
} }
gasUsed := msg.Gas() - leftoverGas temporaryGasUsed := msg.Gas() - leftoverGas
refund := GasToRefund(stateDB.GetRefund(), gasUsed, refundQuotient) refund := GasToRefund(stateDB.GetRefund(), temporaryGasUsed, refundQuotient)
if refund > gasUsed { if refund > temporaryGasUsed {
return nil, sdkerrors.Wrap(types.ErrGasOverflow, "apply message") return nil, sdkerrors.Wrap(types.ErrGasOverflow, "apply message")
} }
gasUsed -= refund temporaryGasUsed -= refund
// EVM execution error needs to be available for the JSON-RPC client // EVM execution error needs to be available for the JSON-RPC client
var vmError string 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{ return &types.MsgEthereumTxResponse{
GasUsed: gasUsed, GasUsed: gasUsed,
VmError: vmError, VmError: vmError,

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
}

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)
}

View File

@ -44,7 +44,7 @@ func (AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) {
// ConsensusVersion returns the consensus state-breaking version for the module. // ConsensusVersion returns the consensus state-breaking version for the module.
func (AppModuleBasic) ConsensusVersion() uint64 { func (AppModuleBasic) ConsensusVersion() uint64 {
return 1 return 2
} }
// DefaultGenesis returns default genesis state as raw bytes for the evm // 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) { func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {
} }
// RegisterQueryService registers a GRPC query service to respond to the // RegisterServices registers a GRPC query service to respond to the
// module-specific GRPC queries. // module-specific GRPC queries and runs necessary migrations.
func (am AppModule) RegisterServices(cfg module.Configurator) { func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterMsgServer(cfg.MsgServer(), am.keeper) types.RegisterMsgServer(cfg.MsgServer(), am.keeper)
types.RegisterQueryServer(cfg.QueryServer(), 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. // Route returns the message routing key for the evm module.

View File

@ -48,7 +48,7 @@ func RandomizedGenState(simState *module.SimulationState) {
func(r *rand.Rand) { extraEIPs = GenExtraEIPs(r) }, 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{}) evmGenesis := types.NewGenesisState(params, []types.GenesisAccount{})
bz, err := json.MarshalIndent(evmGenesis, "", " ") bz, err := json.MarshalIndent(evmGenesis, "", " ")

239
x/evm/types/evm.pb.go generated
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"` 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 // 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"` 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{} } func (m *Params) Reset() { *m = Params{} }
@ -657,100 +660,102 @@ func init() {
func init() { proto.RegisterFile("ethermint/evm/v1/evm.proto", fileDescriptor_d21ecc92c8c8583e) } func init() { proto.RegisterFile("ethermint/evm/v1/evm.proto", fileDescriptor_d21ecc92c8c8583e) }
var fileDescriptor_d21ecc92c8c8583e = []byte{ var fileDescriptor_d21ecc92c8c8583e = []byte{
// 1475 bytes of a gzipped FileDescriptorProto // 1514 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xdf, 0x6e, 0xdb, 0xb6, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xcf, 0x6e, 0xdb, 0x46,
0x1a, 0x4f, 0x62, 0x27, 0x91, 0x69, 0xc7, 0x56, 0x98, 0x34, 0xc7, 0x4d, 0x71, 0xa2, 0x1c, 0x5d, 0x1a, 0xb7, 0x2d, 0xd9, 0xa6, 0x46, 0xb2, 0x44, 0x8f, 0x1d, 0xaf, 0xe2, 0x60, 0x4d, 0x2f, 0x0f,
0x1c, 0xe4, 0x00, 0x6d, 0xdc, 0xa4, 0x08, 0x4e, 0xd1, 0x62, 0x17, 0x51, 0x92, 0xb6, 0xc9, 0xba, 0x0b, 0x2f, 0x90, 0x58, 0xb1, 0x03, 0x63, 0x83, 0x04, 0x7b, 0xb0, 0x6c, 0x27, 0xb1, 0x37, 0xd9,
0x2d, 0x60, 0x32, 0x0c, 0x18, 0x30, 0x08, 0xb4, 0xc4, 0xca, 0x5a, 0x24, 0xd1, 0x20, 0x29, 0xd7, 0x35, 0xc6, 0x5e, 0x2c, 0x50, 0xb4, 0x20, 0x46, 0xe4, 0x84, 0x62, 0x4d, 0x72, 0x84, 0x99, 0xa1,
0x1e, 0xf6, 0x00, 0x03, 0x76, 0xb3, 0x47, 0xd8, 0x2b, 0xec, 0x2d, 0x8a, 0x5d, 0xf5, 0x66, 0xc0, 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x69, 0x00, 0xeb, 0x21, 0x05, 0xec, 0x53, 0x50, 0x3b, 0x67, 0x38, 0xe6, 0xd8, 0x15, 0x01, 0x8d, 0x5f, 0x53, 0x9f,
0x60, 0x11, 0xfb, 0x3e, 0x23, 0x9c, 0x6b, 0xa6, 0x01, 0x84, 0x6b, 0x60, 0x41, 0xd0, 0x76, 0xe8, 0x43, 0x08, 0x8a, 0xf2, 0x43, 0xad, 0x72, 0xe5, 0x18, 0xfe, 0x03, 0x14, 0x43, 0xea, 0xf3, 0xfa,
0x29, 0xba, 0x12, 0xd2, 0x28, 0x17, 0xf6, 0xb1, 0xc0, 0xf2, 0xaa, 0xab, 0x20, 0x39, 0x86, 0xbb, 0xdc, 0x66, 0x61, 0xab, 0xbc, 0x7b, 0xef, 0xfa, 0x05, 0xe2, 0x35, 0xf5, 0x91, 0x0c, 0xb1, 0x7f,
0xa0, 0x22, 0x57, 0xe6, 0x26, 0x69, 0xdc, 0x24, 0x4c, 0xde, 0x58, 0x45, 0xa7, 0x76, 0x95, 0x59, 0x99, 0x03, 0x85, 0xd7, 0xd4, 0x87, 0x75, 0xb0, 0x88, 0x3d, 0x8f, 0x11, 0xce, 0x35, 0xd3, 0x10,
0x65, 0x69, 0xff, 0x5c, 0x9a, 0xd1, 0x38, 0x80, 0x0f, 0xc1, 0xa2, 0xe8, 0x8e, 0x5f, 0x36, 0x2b, 0xc2, 0x35, 0xb0, 0x20, 0x68, 0x27, 0x70, 0x15, 0x5d, 0x09, 0x69, 0x94, 0x09, 0x7b, 0x58, 0x60,
0x57, 0x99, 0x55, 0x13, 0xa3, 0x65, 0xe6, 0x77, 0x09, 0x5a, 0x10, 0x5d, 0x79, 0xa7, 0x34, 0x80, 0x79, 0xd4, 0x55, 0x90, 0x1c, 0xc3, 0x5d, 0x50, 0x91, 0x2b, 0x73, 0xe2, 0x24, 0x6a, 0x11, 0x26,
0x21, 0xba, 0x6e, 0x98, 0xf8, 0xa4, 0x2b, 0xef, 0x93, 0xa2, 0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0xff, 0x69, 0xef, 0x82, 0x39, 0x40, 0x1b, 0xb3, 0x1f, 0x2f, 0x37, 0x66, 0x7f, 0xf8, 0xb4, 0x31, 0xf3, 0xe1, 0xd3, 0xc6, 0xcc, 0xaf,
0x0e, 0x00, 0x00, 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) { func (m *Params) Marshal() (dAtA []byte, err error) {
@ -773,6 +778,16 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = 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]) size, err := m.ChainConfig.MarshalToSizedBuffer(dAtA[:i])
if err != nil { if err != nil {
@ -1465,6 +1480,8 @@ func (m *Params) Size() (n int) {
} }
l = m.ChainConfig.Size() l = m.ChainConfig.Size()
n += 1 + l + sovEvm(uint64(l)) n += 1 + l + sovEvm(uint64(l))
l = m.MinGasMultiplier.Size()
n += 1 + l + sovEvm(uint64(l))
return n return n
} }
@ -1925,6 +1942,40 @@ func (m *Params) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex 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: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipEvm(dAtA[iNdEx:]) skippy, err := skipEvm(dAtA[iNdEx:])

View File

@ -18,13 +18,17 @@ const (
DefaultEVMDenom = types.AttoPhoton DefaultEVMDenom = types.AttoPhoton
) )
// DefaultMinGasMultiplier is 0.5 or 50%
var DefaultMinGasMultiplier = sdk.NewDecWithPrec(50, 2)
// Parameter keys // Parameter keys
var ( var (
ParamStoreKeyEVMDenom = []byte("EVMDenom") ParamStoreKeyEVMDenom = []byte("EVMDenom")
ParamStoreKeyEnableCreate = []byte("EnableCreate") ParamStoreKeyEnableCreate = []byte("EnableCreate")
ParamStoreKeyEnableCall = []byte("EnableCall") ParamStoreKeyEnableCall = []byte("EnableCall")
ParamStoreKeyExtraEIPs = []byte("EnableExtraEIPs") ParamStoreKeyExtraEIPs = []byte("EnableExtraEIPs")
ParamStoreKeyChainConfig = []byte("ChainConfig") ParamStoreKeyChainConfig = []byte("ChainConfig")
ParamStoreKeyMinGasMultiplier = []byte("MinGasMultiplier")
// AvailableExtraEIPs define the list of all EIPs that can be enabled by the // 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 // 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 // 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{ return Params{
EvmDenom: evmDenom, EvmDenom: evmDenom,
EnableCreate: enableCreate, EnableCreate: enableCreate,
EnableCall: enableCall, EnableCall: enableCall,
ExtraEIPs: extraEIPs, ExtraEIPs: extraEIPs,
ChainConfig: config, 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 // ExtraEIPs is empty to prevent overriding the latest hard fork instruction set
func DefaultParams() Params { func DefaultParams() Params {
return Params{ return Params{
EvmDenom: DefaultEVMDenom, EvmDenom: DefaultEVMDenom,
EnableCreate: true, EnableCreate: true,
EnableCall: true, EnableCall: true,
ChainConfig: DefaultChainConfig(), ChainConfig: DefaultChainConfig(),
ExtraEIPs: nil, ExtraEIPs: nil,
MinGasMultiplier: DefaultMinGasMultiplier,
} }
} }
@ -70,6 +76,7 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
paramtypes.NewParamSetPair(ParamStoreKeyEnableCall, &p.EnableCall, validateBool), paramtypes.NewParamSetPair(ParamStoreKeyEnableCall, &p.EnableCall, validateBool),
paramtypes.NewParamSetPair(ParamStoreKeyExtraEIPs, &p.ExtraEIPs, validateEIPs), paramtypes.NewParamSetPair(ParamStoreKeyExtraEIPs, &p.ExtraEIPs, validateEIPs),
paramtypes.NewParamSetPair(ParamStoreKeyChainConfig, &p.ChainConfig, validateChainConfig), paramtypes.NewParamSetPair(ParamStoreKeyChainConfig, &p.ChainConfig, validateChainConfig),
paramtypes.NewParamSetPair(ParamStoreKeyMinGasMultiplier, &p.MinGasMultiplier, validateMinGasMultiplier),
} }
} }
@ -83,6 +90,10 @@ func (p Params) Validate() error {
return err return err
} }
if err := validateMinGasMultiplier(p.MinGasMultiplier); err != nil {
return err
}
return p.ChainConfig.Validate() return p.ChainConfig.Validate()
} }
@ -127,6 +138,27 @@ func validateEIPs(i interface{}) error {
return nil 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 { func validateChainConfig(i interface{}) error {
cfg, ok := i.(ChainConfig) cfg, ok := i.(ChainConfig)
if !ok { if !ok {

View File

@ -1,6 +1,7 @@
package types package types
import ( import (
sdk "github.com/cosmos/cosmos-sdk/types"
"testing" "testing"
"github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/params"
@ -22,7 +23,7 @@ func TestParamsValidate(t *testing.T) {
{"default", DefaultParams(), false}, {"default", DefaultParams(), false},
{ {
"valid", "valid",
NewParams("ara", true, true, DefaultChainConfig(), 2929, 1884, 1344), NewParams("ara", true, true, DefaultChainConfig(), DefaultMinGasMultiplier, 2929, 1884, 1344),
false, false,
}, },
{ {
@ -46,9 +47,9 @@ func TestParamsValidate(t *testing.T) {
true, true,
}, },
{ {
"invalid chain config", "invalid min gas multplier",
NewParams("ara", true, true, ChainConfig{}, 2929, 1884, 1344), NewParams("ara", true, true, DefaultChainConfig(), sdk.NewDec(2), 2929, 1884, 1344),
false, true,
}, },
} }
@ -64,7 +65,7 @@ func TestParamsValidate(t *testing.T) {
} }
func TestParamsEIPs(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() actual := params.EIPs()
require.Equal(t, []int([]int{2929, 1884, 1344}), actual) require.Equal(t, []int([]int{2929, 1884, 1344}), actual)
@ -77,6 +78,7 @@ func TestParamsValidatePriv(t *testing.T) {
require.NoError(t, validateBool(true)) require.NoError(t, validateBool(true))
require.Error(t, validateEIPs("")) require.Error(t, validateEIPs(""))
require.NoError(t, validateEIPs([]int64{1884})) require.NoError(t, validateEIPs([]int64{1884}))
require.Error(t, validateMinGasMultiplier(sdk.NewDec(-5)))
} }
func TestValidateChainConfig(t *testing.T) { func TestValidateChainConfig(t *testing.T) {