diff --git a/consensus/misc/eip1559/eip1559.go b/consensus/misc/eip1559/eip1559.go index 3ab18cfa93..ceb5404a0b 100644 --- a/consensus/misc/eip1559/eip1559.go +++ b/consensus/misc/eip1559/eip1559.go @@ -73,6 +73,7 @@ func CalcBaseFee(config *params.ChainConfig, parent *types.Header) *big.Int { num = new(big.Int) denom = new(big.Int) baseFeeChangeDenominatorUint64 = params.BaseFeeChangeDenominator(config.Bor, parent.Number) + minBaseFee = params.GetMinBaseFee(config.Bor, parent.Number) ) if parent.GasUsed > parentGasTarget { @@ -94,7 +95,13 @@ func CalcBaseFee(config *params.ChainConfig, parent *types.Header) *big.Int { num.Div(num, denom.SetUint64(baseFeeChangeDenominatorUint64)) baseFee := num.Sub(parent.BaseFee, num) - return math.BigMax(baseFee, common.Big0) + // Because the min base fee is enforced on polygon pos, use that as the minimum + if config.Bor != nil { + return math.BigMax(baseFee, minBaseFee) + } else { + return math.BigMax(baseFee, common.Big0) + } + } } diff --git a/params/protocol_params.go b/params/protocol_params.go index ac973a024b..fa59f58877 100644 --- a/params/protocol_params.go +++ b/params/protocol_params.go @@ -128,8 +128,9 @@ const ( BaseFeeChangeDenominatorPreDelhi = 8 // Bounds the amount the base fee can change between blocks before Delhi Hard Fork. BaseFeeChangeDenominatorPostDelhi = 16 // Bounds the amount the base fee can change between blocks after Delhi Hard Fork. - ElasticityMultiplier = 2 // Bounds the maximum gas limit an EIP-1559 block may have. - InitialBaseFee = 1000000000 // Initial base fee for EIP-1559 blocks. + ElasticityMultiplier = 2 // Bounds the maximum gas limit an EIP-1559 block may have. + InitialBaseFee = 25000000000 // Initial base fee for EIP-1559 blocks. + MinBaseFee = 25000000000 // Mininum enforced base fee for EIP-1559 blocks (for polygon) DefaultBaseFeeChangeDenominator = 8 // Bounds the amount the base fee can change between blocks. DefaultElasticityMultiplier = 2 // Bounds the maximum gas limit an EIP-1559 block may have. @@ -219,3 +220,8 @@ func BaseFeeChangeDenominator(borConfig *BorConfig, number *big.Int) uint64 { return BaseFeeChangeDenominatorPreDelhi } } + +func GetMinBaseFee(borConfig *BorConfig, number *big.Int) *big.Int { + // TODO: Check for HF here + return big.NewInt(MinBaseFee) +}