Skip to content

Commit

Permalink
checks for empty non empty requests scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
lucca30 committed Feb 20, 2025
1 parent f30ef31 commit 133b5bd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions consensus/bor/bor.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,10 @@ func (c *Bor) verifyHeader(chain consensus.ChainHeaderReader, header *types.Head
return consensus.ErrUnexpectedWithdrawals
}

if header.RequestsHash != nil {
return consensus.ErrUnexpectedRequests
}

// All basic checks passed, verify cascading fields
return c.verifyCascadingFields(chain, header, parents)
}
Expand Down Expand Up @@ -820,6 +824,9 @@ func (c *Bor) Finalize(chain consensus.ChainHeaderReader, header *types.Header,
if body.Withdrawals != nil || header.WithdrawalsHash != nil {
return
}
if body.Requests != nil || header.RequestsHash != nil {
return
}

var (
stateSyncData []*types.StateSyncData
Expand Down Expand Up @@ -906,6 +913,9 @@ func (c *Bor) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *typ
if body.Withdrawals != nil || header.WithdrawalsHash != nil {
return nil, consensus.ErrUnexpectedWithdrawals
}
if body.Requests != nil || header.RequestsHash != nil {
return nil, consensus.ErrUnexpectedRequests
}

var (
stateSyncData []*types.StateSyncData
Expand Down
3 changes: 3 additions & 0 deletions consensus/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,7 @@ var (

// ErrUnexpectedWithdrawals is returned if a pre-Shanghai block has withdrawals.
ErrUnexpectedWithdrawals = errors.New("unexpected withdrawals")

// ErrUnexpectedRequests is returned if a pre-Shanghai block has requests.
ErrUnexpectedRequests = errors.New("unexpected requests")
)

0 comments on commit 133b5bd

Please sign in to comment.