feemarket: change basefee to be a module param (#943)

* change basefee to a module params

* add changelog and fix linter

* change params type of basefee and remove default base fee

* restaure event

* clean code

* fix proto

* fix protos

* fix logic

* update rpc tests

* fix comment

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
Thomas Nguy
2022-02-23 19:48:44 +01:00
committed by GitHub
co-authored by Federico Kunze Küllmer
parent f21592ebfe
commit bf54193669
20 changed files with 160 additions and 242 deletions
+4 -4
View File
@@ -25,13 +25,13 @@ func (k Keeper) CalculateBaseFee(ctx sdk.Context) *big.Int {
// If the current block is the first EIP-1559 block, return the InitialBaseFee.
if ctx.BlockHeight() == params.EnableHeight {
return new(big.Int).SetInt64(params.InitialBaseFee)
return params.BaseFee.BigInt()
}
// get the block gas used and the base fee values for the parent block.
parentBaseFee := k.GetBaseFee(ctx)
parentBaseFee := params.BaseFee.BigInt()
if parentBaseFee == nil {
parentBaseFee = new(big.Int).SetInt64(params.InitialBaseFee)
return nil
}
parentGasUsed := k.GetBlockGasUsed(ctx)
@@ -43,7 +43,7 @@ func (k Keeper) CalculateBaseFee(ctx sdk.Context) *big.Int {
parentGasTargetBig := new(big.Int).Div(gasLimit, new(big.Int).SetUint64(uint64(params.ElasticityMultiplier)))
if !parentGasTargetBig.IsUint64() {
return new(big.Int).SetInt64(params.InitialBaseFee)
return nil
}
parentGasTarget := parentGasTargetBig.Uint64()