checks for empty non empty requests scenario

This commit is contained in:
Lucca Martins 2025-02-20 03:49:00 -03:00
parent f30ef31c25
commit 133b5bd7bb
No known key found for this signature in database
GPG key ID: DC3D7F76BDAE23BF
2 changed files with 13 additions and 0 deletions

View file

@ -391,6 +391,10 @@ func (c *Bor) verifyHeader(chain consensus.ChainHeaderReader, header *types.Head
return consensus.ErrUnexpectedWithdrawals return consensus.ErrUnexpectedWithdrawals
} }
if header.RequestsHash != nil {
return consensus.ErrUnexpectedRequests
}
// All basic checks passed, verify cascading fields // All basic checks passed, verify cascading fields
return c.verifyCascadingFields(chain, header, parents) return c.verifyCascadingFields(chain, header, parents)
} }
@ -820,6 +824,9 @@ func (c *Bor) Finalize(chain consensus.ChainHeaderReader, header *types.Header,
if body.Withdrawals != nil || header.WithdrawalsHash != nil { if body.Withdrawals != nil || header.WithdrawalsHash != nil {
return return
} }
if body.Requests != nil || header.RequestsHash != nil {
return
}
var ( var (
stateSyncData []*types.StateSyncData stateSyncData []*types.StateSyncData
@ -906,6 +913,9 @@ func (c *Bor) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *typ
if body.Withdrawals != nil || header.WithdrawalsHash != nil { if body.Withdrawals != nil || header.WithdrawalsHash != nil {
return nil, consensus.ErrUnexpectedWithdrawals return nil, consensus.ErrUnexpectedWithdrawals
} }
if body.Requests != nil || header.RequestsHash != nil {
return nil, consensus.ErrUnexpectedRequests
}
var ( var (
stateSyncData []*types.StateSyncData stateSyncData []*types.StateSyncData

View file

@ -41,4 +41,7 @@ var (
// ErrUnexpectedWithdrawals is returned if a pre-Shanghai block has withdrawals. // ErrUnexpectedWithdrawals is returned if a pre-Shanghai block has withdrawals.
ErrUnexpectedWithdrawals = errors.New("unexpected withdrawals") ErrUnexpectedWithdrawals = errors.New("unexpected withdrawals")
// ErrUnexpectedRequests is returned if a pre-Shanghai block has requests.
ErrUnexpectedRequests = errors.New("unexpected requests")
) )