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:
yihuang
2022-01-26 11:36:07 +01:00
committed by GitHub
parent fd3c803b44
commit e39a74998e
5 changed files with 15 additions and 7 deletions
+4 -2
View File
@@ -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 -2
View File
@@ -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(),
Params: DefaultParams(),
// the default base fee should be initialized because the default enable height is zero.
BaseFee: sdk.NewIntFromUint64(params.InitialBaseFee),
BlockGas: 0,
}
}