Skip to content

Commit 133b5bd

Browse files
committed
checks for empty non empty requests scenario
1 parent f30ef31 commit 133b5bd

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

consensus/bor/bor.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,10 @@ func (c *Bor) verifyHeader(chain consensus.ChainHeaderReader, header *types.Head
391391
return consensus.ErrUnexpectedWithdrawals
392392
}
393393

394+
if header.RequestsHash != nil {
395+
return consensus.ErrUnexpectedRequests
396+
}
397+
394398
// All basic checks passed, verify cascading fields
395399
return c.verifyCascadingFields(chain, header, parents)
396400
}
@@ -820,6 +824,9 @@ func (c *Bor) Finalize(chain consensus.ChainHeaderReader, header *types.Header,
820824
if body.Withdrawals != nil || header.WithdrawalsHash != nil {
821825
return
822826
}
827+
if body.Requests != nil || header.RequestsHash != nil {
828+
return
829+
}
823830

824831
var (
825832
stateSyncData []*types.StateSyncData
@@ -906,6 +913,9 @@ func (c *Bor) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *typ
906913
if body.Withdrawals != nil || header.WithdrawalsHash != nil {
907914
return nil, consensus.ErrUnexpectedWithdrawals
908915
}
916+
if body.Requests != nil || header.RequestsHash != nil {
917+
return nil, consensus.ErrUnexpectedRequests
918+
}
909919

910920
var (
911921
stateSyncData []*types.StateSyncData

consensus/errors.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,7 @@ var (
4141

4242
// ErrUnexpectedWithdrawals is returned if a pre-Shanghai block has withdrawals.
4343
ErrUnexpectedWithdrawals = errors.New("unexpected withdrawals")
44+
45+
// ErrUnexpectedRequests is returned if a pre-Shanghai block has requests.
46+
ErrUnexpectedRequests = errors.New("unexpected requests")
4447
)

0 commit comments

Comments
 (0)