fix: default base fee state in genesis (#919)
* fix defualt base fee state in genesis Closes: #918 Solution: - initialise the default base fee value in genesis * changelog
This commit is contained in:
parent
fd3c803b44
commit
e39a74998e
@ -65,6 +65,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
* (app) [tharsis#873](https://github.com/tharsis/ethermint/pull/873) Validate code hash in GenesisAccount
|
||||
* (evm) [tharsis#901](https://github.com/tharsis/ethermint/pull/901) Support multiple MsgEthereumTx in single tx.
|
||||
* (config) [tharsis#908](https://github.com/tharsis/ethermint/pull/908) Add api.enable flag for Cosmos SDK Rest server
|
||||
* (feemarket) [tharsis#919](https://github.com/tharsis/ethermint/pull/919) Initialize baseFee in default genesis state.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
@ -87,13 +87,16 @@ func (suite *KeeperTestSuite) DoSetupTest(t require.TestingT) {
|
||||
suite.consAddress = sdk.ConsAddress(priv.PubKey().Address())
|
||||
|
||||
suite.app = app.Setup(checkTx, func(app *app.EthermintApp, genesis simapp.GenesisState) simapp.GenesisState {
|
||||
if suite.enableFeemarket {
|
||||
feemarketGenesis := feemarkettypes.DefaultGenesisState()
|
||||
if suite.enableFeemarket {
|
||||
feemarketGenesis.Params.EnableHeight = 1
|
||||
feemarketGenesis.Params.NoBaseFee = false
|
||||
feemarketGenesis.BaseFee = sdk.NewInt(feemarketGenesis.Params.InitialBaseFee)
|
||||
genesis[feemarkettypes.ModuleName] = app.AppCodec().MustMarshalJSON(feemarketGenesis)
|
||||
} else {
|
||||
feemarketGenesis.Params.NoBaseFee = true
|
||||
feemarketGenesis.BaseFee = sdk.NewInt(0)
|
||||
}
|
||||
genesis[feemarkettypes.ModuleName] = app.AppCodec().MustMarshalJSON(feemarketGenesis)
|
||||
if !suite.enableLondonHF {
|
||||
evmGenesis := types.DefaultGenesisState()
|
||||
maxInt := sdk.NewInt(math.MaxInt64)
|
||||
|
@ -501,7 +501,7 @@ func (suite *KeeperTestSuite) TestEVMConfig() {
|
||||
suite.Require().NoError(err)
|
||||
suite.Require().Equal(types.DefaultParams(), cfg.Params)
|
||||
// london hardfork is enabled by default
|
||||
suite.Require().Equal(new(big.Int), cfg.BaseFee)
|
||||
suite.Require().Equal(big.NewInt(0), cfg.BaseFee)
|
||||
suite.Require().Equal(suite.address, cfg.CoinBase)
|
||||
suite.Require().Equal(types.DefaultParams().ChainConfig.EthereumConfig(big.NewInt(9000)), cfg.ChainConfig)
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package keeper_test
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
ethparams "github.com/ethereum/go-ethereum/params"
|
||||
"github.com/tharsis/ethermint/x/feemarket/types"
|
||||
)
|
||||
|
||||
@ -41,9 +42,10 @@ func (suite *KeeperTestSuite) TestQueryBaseFee() {
|
||||
expPass bool
|
||||
}{
|
||||
{
|
||||
"pass - nil Base Fee",
|
||||
"pass - default Base Fee",
|
||||
func() {
|
||||
expRes = &types.QueryBaseFeeResponse{}
|
||||
initialBaseFee := sdk.NewInt(ethparams.InitialBaseFee)
|
||||
expRes = &types.QueryBaseFeeResponse{BaseFee: &initialBaseFee}
|
||||
},
|
||||
true,
|
||||
},
|
||||
|
@ -4,13 +4,15 @@ import (
|
||||
"fmt"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
)
|
||||
|
||||
// DefaultGenesisState sets default fee market genesis state.
|
||||
func DefaultGenesisState() *GenesisState {
|
||||
return &GenesisState{
|
||||
Params: DefaultParams(),
|
||||
BaseFee: sdk.ZeroInt(),
|
||||
// the default base fee should be initialized because the default enable height is zero.
|
||||
BaseFee: sdk.NewIntFromUint64(params.InitialBaseFee),
|
||||
BlockGas: 0,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user