Skip to content

Commit 6d34456

Browse files
authored
Merge pull request #3520 from OffchainLabs/nit-3549-globalstate-not-in-chain-should-be-a-fatal-error-for
Return a fatal error instead of stopping the StopWaiter in case of Er…
2 parents 90570c4 + 0177eb8 commit 6d34456

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

staker/bold/bold_staker.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ type BOLDStaker struct {
210210
confirmedNotifiers []legacystaker.LatestConfirmedNotifier
211211
inboxTracker staker.InboxTrackerInterface
212212
inboxStreamer staker.TransactionStreamerInterface
213+
fatalErr chan<- error
213214
}
214215

215216
func NewBOLDStaker(
@@ -229,6 +230,7 @@ func NewBOLDStaker(
229230
inboxTracker staker.InboxTrackerInterface,
230231
inboxStreamer staker.TransactionStreamerInterface,
231232
inboxReader staker.InboxReaderInterface,
233+
fatalErr chan<- error,
232234
) (*BOLDStaker, error) {
233235
if err := config.Validate(); err != nil {
234236
return nil, err
@@ -251,6 +253,7 @@ func NewBOLDStaker(
251253
confirmedNotifiers: confirmedNotifiers,
252254
inboxTracker: inboxTracker,
253255
inboxStreamer: inboxStreamer,
256+
fatalErr: fatalErr,
254257
}, nil
255258
}
256259

@@ -311,8 +314,10 @@ func (b *BOLDStaker) Start(ctxIn context.Context) {
311314
confirmedMsgCount, confirmedGlobalState, err := b.getLatestState(ctx, true)
312315
if err != nil {
313316
log.Error("staker: error checking latest confirmed", "err", err)
314-
b.StopWaiter.StopAndWait()
315-
return time.Duration(0)
317+
if errors.Is(err, staker.ErrGlobalStateNotInChain) {
318+
b.fatalErr <- err
319+
}
320+
return b.config.AssertionPostingInterval
316321
}
317322

318323
agreedMsgCount, agreedGlobalState, err := b.getLatestState(ctx, false)

staker/multi_protocol/multi_protocol_staker.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ type MultiProtocolStaker struct {
5252
inboxTracker staker.InboxTrackerInterface
5353
inboxStreamer staker.TransactionStreamerInterface
5454
inboxReader staker.InboxReaderInterface
55+
fatalErr chan<- error
5556
}
5657

5758
func NewMultiProtocolStaker(
@@ -121,6 +122,7 @@ func NewMultiProtocolStaker(
121122
inboxTracker: inboxTracker,
122123
inboxStreamer: inboxStreamer,
123124
inboxReader: inboxReader,
125+
fatalErr: fatalErr,
124126
}, nil
125127
}
126128

@@ -262,6 +264,7 @@ func (m *MultiProtocolStaker) setupBoldStaker(
262264
m.inboxTracker,
263265
m.inboxStreamer,
264266
m.inboxReader,
267+
m.fatalErr,
265268
)
266269
if err != nil {
267270
return err

0 commit comments

Comments
 (0)