Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions block/factory/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
v1 "github.com/harmony-one/harmony/block/v1"
v2 "github.com/harmony-one/harmony/block/v2"
v3 "github.com/harmony-one/harmony/block/v3"
v4 "github.com/harmony-one/harmony/block/v4"
"github.com/harmony-one/harmony/internal/params"
)

Expand All @@ -30,6 +31,8 @@ func NewFactory(chainConfig *params.ChainConfig) Factory {
func (f *factory) NewHeader(epoch *big.Int) *block.Header {
var impl blockif.Header
switch {
case f.chainConfig.IsLondon(epoch):
impl = v4.NewHeader()
case f.chainConfig.IsPreStaking(epoch) || f.chainConfig.IsStaking(epoch):
impl = v3.NewHeader()
case f.chainConfig.IsCrossLink(epoch):
Expand Down
4 changes: 4 additions & 0 deletions block/interface/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,8 @@ type Header interface {
// SetSlashes sets the RLP-encoded form of slashes
// It stores a copy; the caller may freely modify the original.
SetSlashes(newSlashes []byte)

BaseFee() *big.Int

SetBaseFee(newBaseFee *big.Int)
}
12 changes: 12 additions & 0 deletions block/v0/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,3 +445,15 @@ func (h *Header) Copy() blockif.Header {
cpy := *h
return &cpy
}

// BaseFee returns the base fee of the block.
func (h *Header) BaseFee() *big.Int {
return nil
}

// SetBaseFee sets the base fee of the block.
func (h *Header) SetBaseFee(newBaseFee *big.Int) {
h.Logger(utils.Logger()).Warn().
Str("baseFee", newBaseFee.String()).
Msg("cannot store base fee in V0 header")
}
11 changes: 11 additions & 0 deletions block/v1/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,3 +429,14 @@ func (h *Header) Copy() blockif.Header {
cpy := *h
return &cpy
}

// BaseFee returns the base fee of the header.
func (h *Header) BaseFee() *big.Int {
return nil
}

// SetBaseFee sets the base fee of the header.
func (h *Header) SetBaseFee(newBaseFee *big.Int) {
h.Logger(utils.Logger()).Error().
Msg("cannot store base fee in V1 header")
}
11 changes: 11 additions & 0 deletions block/v2/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,3 +428,14 @@ func (h *Header) Copy() blockif.Header {
cpy := *h
return &cpy
}

// BaseFee returns the base fee of the block.
func (h *Header) BaseFee() *big.Int {
return nil
}

// SetBaseFee sets the base fee of the block.
func (h *Header) SetBaseFee(newBaseFee *big.Int) {
h.Logger(utils.Logger()).Error().
Msg("cannot store base fee in V2 header")
}
12 changes: 12 additions & 0 deletions block/v3/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,3 +422,15 @@ func (h *Header) Copy() blockif.Header {
cpy := *h
return &cpy
}

// BaseFee returns the base fee of the header.
func (h *Header) BaseFee() *big.Int {
return nil
}

// SetBaseFee sets the base fee of the header.
func (h *Header) SetBaseFee(newBaseFee *big.Int) {
h.Logger(utils.Logger()).Warn().
Str("baseFee", newBaseFee.String()).
Msg("cannot store BaseFee in V3 header")
}
Loading