Skip to content

Commit

Permalink
Merge pull request #577 from node-real/bep-466
Browse files Browse the repository at this point in the history
BEP-466: implement support of RequestsHash for parlia
  • Loading branch information
blxdyx authored Dec 20, 2024
2 parents 08d28b2 + 77111ad commit 1afea87
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
11 changes: 11 additions & 0 deletions consensus/parlia/parlia.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,17 @@ func (p *Parlia) verifyHeader(chain consensus.ChainHeaderReader, header *types.H
}
}

prague := chain.Config().IsPrague(header.Time)
if !prague {
if header.RequestsHash != nil {
return fmt.Errorf("invalid RequestsHash, have %#x, expected nil", header.RequestsHash)
}
} else {
if header.RequestsHash == nil {
return errors.New("header has nil RequestsHash after Prague")
}
}

// All basic checks passed, verify cascading fields
return p.verifyCascadingFields(chain, header, parents)
}
Expand Down
14 changes: 10 additions & 4 deletions core/chain_makers.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,11 +610,17 @@ func MakeEmptyHeader(parent *types.Header, chainConfig *chain.Config, timestamp
excessBlobGas := misc.CalcExcessBlobGas(chainConfig, parent)
header.ExcessBlobGas = &excessBlobGas
header.BlobGasUsed = new(uint64)
if chainConfig.Parlia != nil {
header.WithdrawalsHash = &types.EmptyRootHash
}
if chainConfig.Parlia == nil || chainConfig.IsBohr(header.Number.Uint64(), header.Time) {
if chainConfig.Parlia == nil {
header.ParentBeaconBlockRoot = new(libcommon.Hash)
} else {
header.WithdrawalsHash = &types.EmptyRootHash

if chainConfig.IsBohr(header.Number.Uint64(), header.Time) {
header.ParentBeaconBlockRoot = new(libcommon.Hash)
}
if chainConfig.IsPrague(header.Time) {
header.RequestsHash = &types.EmptyRequestsHash
}
}
}

Expand Down

0 comments on commit 1afea87

Please sign in to comment.