Skip to content

E3: Fix sync from scratch on pectra chain #14101

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

Closed
wants to merge 4 commits into from
Closed
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
16 changes: 15 additions & 1 deletion consensus/merge/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,23 @@ func (s *Merge) Finalize(config *chain.Config, header *types.Header, state *stat
if config.IsPrague(header.Time) {
rs = make(types.FlatRequests, 0)
allLogs := make(types.Logs, 0)
skipEvaluation := false

for _, rec := range receipts {
// VERY UGLY HACK: We need to skip evaluation if we have a nil receipt

// Check for nil receipt to handle a special corner case:
// This scenario occurs when a transaction is part of an incomplete or partially executed block,
// causing some transaction receipts to be unavailable (nil). In such cases,
// evaluation must be skipped to prevent accessing logs from an invalid receipt.
if rec == nil {
skipEvaluation = true
logger.Info("nil receipt found in block receipts, skipping evaluation of receiptsHash")
break
}
allLogs = append(allLogs, rec.Logs...)
}

depositReqs, err := misc.ParseDepositLogs(allLogs, config.DepositContract)
if err != nil {
return nil, nil, nil, fmt.Errorf("error: could not parse requests logs: %v", err)
Expand All @@ -207,7 +221,7 @@ func (s *Merge) Finalize(config *chain.Config, header *types.Header, state *stat
if consolidations != nil {
rs = append(rs, *consolidations)
}
if header.RequestsHash != nil {
if header.RequestsHash != nil && !skipEvaluation {
rh := rs.Hash()
if *header.RequestsHash != *rh {
return nil, nil, nil, fmt.Errorf("error: invalid requests root hash in header, expected: %v, got :%v", header.RequestsHash, rh)
Expand Down
Loading