Skip to content

Commit 357ceb9

Browse files
authored
Skip BAL validation when not available (#19486)
Temporarily skip BALs when not available. This is due to a missing P2P spec in devnet-2, so BALs are available only when provided via the CL. This should be removed once the [BAL P2P spec](https://eips.ethereum.org/EIPS/eip-8159) has been implemented.
1 parent 8a0966d commit 357ceb9

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

execution/stagedsync/exec3_parallel.go

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ func (pe *parallelExecutor) exec(ctx context.Context, execStage *StageState, u U
200200
if err != nil {
201201
return fmt.Errorf("can't retrieve block %d: for post validation: %w", applyResult.BlockNum, err)
202202
}
203+
if b == nil {
204+
return fmt.Errorf("nil block %d (hash %x)", applyResult.BlockNum, applyResult.BlockHash)
205+
}
203206

204207
lastHeader = b.HeaderNoCopy()
205208

@@ -232,17 +235,22 @@ func (pe *parallelExecutor) exec(ctx context.Context, execStage *StageState, u U
232235
if err != nil {
233236
return fmt.Errorf("block %d: read stored block access list: %w", applyResult.BlockNum, err)
234237
}
235-
dbBAL, err := types.DecodeBlockAccessListBytes(dbBALBytes)
236-
if err != nil {
237-
return fmt.Errorf("block %d: read stored block access list: %w", applyResult.BlockNum, err)
238-
}
239-
if err = dbBAL.Validate(); err != nil {
240-
return fmt.Errorf("block %d: db block access list is invalid: %w", applyResult.BlockNum, err)
241-
}
238+
// BAL data may not be stored for blocks downloaded via backward
239+
// block downloader (p2p sync) since it does not carry BAL sidecars.
240+
// Remove after eth/71 has been implemented.
241+
if dbBALBytes != nil {
242+
dbBAL, err := types.DecodeBlockAccessListBytes(dbBALBytes)
243+
if err != nil {
244+
return fmt.Errorf("block %d: read stored block access list: %w", applyResult.BlockNum, err)
245+
}
246+
if err = dbBAL.Validate(); err != nil {
247+
return fmt.Errorf("block %d: db block access list is invalid: %w", applyResult.BlockNum, err)
248+
}
242249

243-
if headerBALHash != dbBAL.Hash() {
244-
log.Info(fmt.Sprintf("bal from block: %s", dbBAL.DebugString()))
245-
return fmt.Errorf("block %d: invalid block access list, hash mismatch: got %s expected %s", applyResult.BlockNum, dbBAL.Hash(), headerBALHash)
250+
if headerBALHash != dbBAL.Hash() {
251+
log.Info(fmt.Sprintf("bal from block: %s", dbBAL.DebugString()))
252+
return fmt.Errorf("block %d: invalid block access list, hash mismatch: got %s expected %s", applyResult.BlockNum, dbBAL.Hash(), headerBALHash)
253+
}
246254
}
247255
if headerBALHash != bal.Hash() {
248256
log.Info(fmt.Sprintf("computed bal: %s", bal.DebugString()))

0 commit comments

Comments
 (0)