Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan-Ethernal committed Sep 8, 2023
1 parent 3160d04 commit caea32b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 1 addition & 2 deletions blockchain/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}

Expand Down
7 changes: 7 additions & 0 deletions blockchain/blockchain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions consensus/polybft/consensus_runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit caea32b

Please sign in to comment.