diff --git a/blockchain/blockchain.go b/blockchain/blockchain.go index ff4803966d..cd7abdf321 100644 --- a/blockchain/blockchain.go +++ b/blockchain/blockchain.go @@ -12,7 +12,6 @@ import ( "github.com/0xPolygon/polygon-edge/blockchain/storage" "github.com/0xPolygon/polygon-edge/chain" - "github.com/0xPolygon/polygon-edge/forkmanager" "github.com/0xPolygon/polygon-edge/helper/common" "github.com/0xPolygon/polygon-edge/state" "github.com/0xPolygon/polygon-edge/types" @@ -1393,7 +1392,7 @@ func (b *Blockchain) CalculateBaseFee(parent *types.Header) uint64 { func (b *Blockchain) calcBaseFeeDelta(gasUsedDelta, parentGasTarget, baseFee uint64) uint64 { baseFeeChangeDenom := chain.BaseFeeChangeDenom - if forkmanager.GetInstance().IsForkEnabled(chain.Governance, b.Header().Number) { + if b.config.Params.Forks.IsActive(chain.Governance, b.Header().Number) { baseFeeChangeDenom = b.Config().BaseFeeChangeDenom } diff --git a/blockchain/blockchain_test.go b/blockchain/blockchain_test.go index 94b1079f87..5fca0476ae 100644 --- a/blockchain/blockchain_test.go +++ b/blockchain/blockchain_test.go @@ -1403,6 +1403,13 @@ func TestBlockchain_CalculateBaseFee(t *testing.T) { }, } + blockchain.setCurrentHeader(&types.Header{ + Number: test.blockNumber + 1, + GasLimit: test.parentGasLimit, + GasUsed: test.parentGasUsed, + BaseFee: test.parentBaseFee, + }, big.NewInt(1)) + parent := &types.Header{ Number: test.blockNumber, GasLimit: test.parentGasLimit, diff --git a/consensus/polybft/consensus_runtime_test.go b/consensus/polybft/consensus_runtime_test.go index 0aa25adf8b..7189909f0d 100644 --- a/consensus/polybft/consensus_runtime_test.go +++ b/consensus/polybft/consensus_runtime_test.go @@ -490,6 +490,7 @@ func Test_NewConsensusRuntime(t *testing.T) { config := &runtimeConfig{ polybftBackend: polybftBackendMock, State: newTestState(t), + genesisParams: &chain.Params{Engine: map[string]interface{}{polyCommon.ConsensusName: polyBftConfig}}, GenesisConfig: polyBftConfig, DataDir: tmpDir, Key: createTestKey(t),