PIP-58: Increase BaseFeeChangeDenominator to 64 (#1547)

* Bhilai HF: added BhilaiBlock and IsBhilai function

* Bhilai HF/PIP-58: Increase BaseFeeChangeDenominator to 64
This commit is contained in:
Pratik Patil 2025-05-16 12:42:20 +05:30 committed by GitHub
parent 5a4c85922d
commit c020756588
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 3 deletions

View file

@ -797,6 +797,7 @@ type BorConfig struct {
IndoreBlock *big.Int `json:"indoreBlock"` // Indore switch block (nil = no fork, 0 = already on indore)
StateSyncConfirmationDelay map[string]uint64 `json:"stateSyncConfirmationDelay"` // StateSync Confirmation Delay, in seconds, to calculate `to`
AhmedabadBlock *big.Int `json:"ahmedabadBlock"` // Ahmedabad switch block (nil = no fork, 0 = already on ahmedabad)
BhilaiBlock *big.Int `json:"bhilaiBlock"` // Bhilai switch block (nil = no fork, 0 = already on bhilai)
}
// String implements the stringer interface, returning the consensus engine details.
@ -840,6 +841,10 @@ func (c *BorConfig) IsAhmedabad(number *big.Int) bool {
return isBlockForked(c.AhmedabadBlock, number)
}
func (c *BorConfig) IsBhilai(number *big.Int) bool {
return isBlockForked(c.BhilaiBlock, number)
}
// // TODO: modify this function once the block number is finalized
// func (c *BorConfig) IsNapoli(number *big.Int) bool {
// if c.NapoliBlock != nil {

View file

@ -130,6 +130,7 @@ 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.
BaseFeeChangeDenominatorPostBhilai = 64 // Bounds the amount the base fee can change between blocks after Bhilai Hard Fork.
ElasticityMultiplier = 2 // Bounds the maximum gas limit an EIP-1559 block may have.
InitialBaseFee = 1000000000 // Initial base fee for EIP-1559 blocks.
@ -230,12 +231,20 @@ var (
ConsolidationQueueCode = common.FromHex("3373fffffffffffffffffffffffffffffffffffffffe1460d35760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461019a57600182026001905f5b5f82111560685781019083028483029004916001019190604d565b9093900492505050366060146088573661019a573461019a575f5260205ff35b341061019a57600154600101600155600354806004026004013381556001015f358155600101602035815560010160403590553360601b5f5260605f60143760745fa0600101600355005b6003546002548082038060021160e7575060025b5f5b8181146101295782810160040260040181607402815460601b815260140181600101548152602001816002015481526020019060030154905260010160e9565b910180921461013b5790600255610146565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141561017357505f5b6001546001828201116101885750505f61018e565b01600190035b5f555f6001556074025ff35b5f5ffd")
)
// BaseFeeChangeDenominator returns the denominator used to bound the amount the base fee can change between blocks.
// The value varies based on the hard fork:
// - Pre-Delhi: 8 (default)
// - Post-Delhi: 16
// - Post-Bhilai: 64
// If borConfig is nil, returns the default value of 8.
func BaseFeeChangeDenominator(borConfig *BorConfig, number *big.Int) uint64 {
// Handle cases where bor consensus isn't available to avoid panic
if borConfig == nil {
return DefaultBaseFeeChangeDenominator
}
if borConfig.IsDelhi(number) {
if borConfig.IsBhilai(number) {
return BaseFeeChangeDenominatorPostBhilai
} else if borConfig.IsDelhi(number) {
return BaseFeeChangeDenominatorPostDelhi
} else {
return BaseFeeChangeDenominatorPreDelhi