Skip to content

Commit

Permalink
fix: back to start only insufficient confirmation blocks (#374)
Browse files Browse the repository at this point in the history
Co-authored-by: Raul Jordan <[email protected]>
  • Loading branch information
terencechain and rauljordan authored Jul 24, 2023
1 parent fa67faf commit ff3a977
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions challenge-manager/edge-tracker/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
var (
srvlog = log.New("service", "edge-tracker")
errBadOneStepProof = errors.New("bad one step proof data")
errNotYetConfirmable = errors.New("edge is not yet confirmable")
spawnedCounter = metrics.NewRegisteredCounter("arb/validator/tracker/spawned", nil)
bisectedCounter = metrics.NewRegisteredCounter("arb/validator/tracker/bisected", nil)
confirmedCounter = metrics.NewRegisteredCounter("arb/validator/tracker/confirmed", nil)
Expand Down Expand Up @@ -215,8 +216,12 @@ func (et *Tracker) Act(ctx context.Context) error {
}
wasConfirmed, err := et.tryToConfirm(ctx)
if err != nil {
srvlog.Debug("Could not confirm edge yet", err, fields)
return et.fsm.Do(edgeBackToStart{})
fields["err"] = err
if errors.Is(err, errNotYetConfirmable) {
srvlog.Debug("Edge not yet confirmable", fields)
} else {
srvlog.Error("Could not check if edge can be confirmed", fields)
}
}
if wasConfirmed {
return et.fsm.Do(edgeConfirm{})
Expand Down Expand Up @@ -437,7 +442,7 @@ func (et *Tracker) tryToConfirm(ctx context.Context) (bool, error) {
confirmedCounter.Inc(1)
return true, nil
}
return false, nil
return false, errNotYetConfirmable
}

// Determines the bisection point from parentHeight to toHeight and returns a history
Expand Down

0 comments on commit ff3a977

Please sign in to comment.