Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shanghai fixes #1056

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 6 additions & 15 deletions consensus/bor/bor.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,6 @@ func encodeSigHeader(w io.Writer, header *types.Header, c *params.BorConfig) {
}
}

if header.WithdrawalsHash != nil {
header.WithdrawalsHash = nil

log.Warn("Bor does not support withdrawals", "number", header.Number)
}

if err := rlp.Encode(w, enc); err != nil {
panic("can't encode: " + err.Error())
}
Expand Down Expand Up @@ -387,11 +381,14 @@ func (c *Bor) verifyHeader(chain consensus.ChainHeaderReader, header *types.Head

// Verify that the gas limit is <= 2^63-1
gasCap := uint64(0x7fffffffffffffff)

if header.GasLimit > gasCap {
return fmt.Errorf("invalid gasLimit: have %v, max %v", header.GasLimit, gasCap)
}

if header.WithdrawalsHash != nil {
return consensus.ErrUnexpectedWithdrawals
}

// All basic checks passed, verify cascading fields
return c.verifyCascadingFields(chain, header, parents)
}
Expand Down Expand Up @@ -823,10 +820,7 @@ func (c *Bor) Finalize(chain consensus.ChainHeaderReader, header *types.Header,
headerNumber := header.Number.Uint64()

if withdrawals != nil || header.WithdrawalsHash != nil {
// withdrawals = nil is not required because withdrawals are not used
header.WithdrawalsHash = nil

log.Warn("Bor does not support withdrawals", "number", headerNumber)
return
}

if IsSprintStart(headerNumber, c.config.CalculateSprint(headerNumber)) {
Expand Down Expand Up @@ -904,10 +898,7 @@ func (c *Bor) FinalizeAndAssemble(ctx context.Context, chain consensus.ChainHead
headerNumber := header.Number.Uint64()

if withdrawals != nil || header.WithdrawalsHash != nil {
// withdrawals != nil not required because withdrawals are not used
header.WithdrawalsHash = nil

log.Warn("Bor does not support withdrawals", "number", headerNumber)
return nil, consensus.ErrUnexpectedWithdrawals
}

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 @@ -38,4 +38,7 @@ var (
// ErrInvalidTerminalBlock is returned if a block is invalid wrt. the terminal
// total difficulty.
ErrInvalidTerminalBlock = errors.New("invalid terminal block")

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