Skip to content

Commit 2b1683f

Browse files
authored
Merge branch 'main' into marko/reduce_max
2 parents bd52066 + a3b4b0d commit 2b1683f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

block/internal/executing/executor.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ func (e *Executor) produceBlock() error {
362362
header.Signature = signature
363363

364364
if err := e.validateBlock(currentState, header, data); err != nil {
365+
e.sendCriticalError(fmt.Errorf("failed to validate block: %w", err))
365366
return fmt.Errorf("failed to validate block: %w", err)
366367
}
367368

block/internal/syncing/syncer.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,12 @@ type p2pHandler interface {
3030
ProcessDataRange(ctx context.Context, fromHeight, toHeight uint64) []common.DAHeightEvent
3131
}
3232

33-
// maxRetriesBeforeHalt is the maximum number of retries against the execution client before halting the syncer.
34-
const maxRetriesBeforeHalt = 3
33+
const (
34+
// maxRetriesBeforeHalt is the maximum number of retries against the execution client before halting the syncer.
35+
maxRetriesBeforeHalt = 3
36+
// maxRetriesTimeout is the maximum time to wait for a retry before halting the syncer.
37+
maxRetriesTimeout = time.Second * 10
38+
)
3539

3640
// Syncer handles block synchronization from DA and P2P sources.
3741
type Syncer struct {
@@ -494,6 +498,7 @@ func (s *Syncer) applyBlock(header types.Header, data *types.Data, currentState
494498
return types.State{}, fmt.Errorf("failed to execute transactions: %w", err)
495499
}
496500

501+
time.Sleep(maxRetriesTimeout) // sleep before retrying
497502
return types.State{}, fmt.Errorf("failed to execute transactions (retry %d / %d): %w", s.retriesBeforeHalt[header.Height()], maxRetriesBeforeHalt, err)
498503
}
499504
delete(s.retriesBeforeHalt, header.Height())

0 commit comments

Comments
 (0)