Skip to content

Commit

Permalink
Migration should not fail process block routine (#5557)
Browse files Browse the repository at this point in the history
* Continue rather than fail
* Merge branch 'master' into migrate-should-not-fail-block
* Merge refs/heads/master into migrate-should-not-fail-block
  • Loading branch information
terencechain committed Apr 21, 2020
1 parent c69f561 commit 199c50b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion beacon-chain/state/stategen/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ func (s *State) MigrateToCold(ctx context.Context, finalizedSlot uint64, finaliz
if !s.beaconDB.HasState(ctx, r) {
recoveredArchivedState, err := s.ComputeStateUpToSlot(ctx, stateSummary.Slot)
if err != nil {
return err
// For whatever reason if node fails to generate archived state of a certain slot,
// a node should just skip that slot rather than fail to whole process block routine.
// Missing an archived point of a certain slot is less of a deal than failing process block.
log.Warnf("Unable to generate archived state: %v", err)
continue
}
if err := s.beaconDB.SaveState(ctx, recoveredArchivedState.Copy(), r); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/state/stategen/replay.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func (s *State) lastSavedState(ctx context.Context, slot uint64) (*state.BeaconS

lastSaved, err := s.beaconDB.HighestSlotStatesBelow(ctx, slot+1)
if err != nil {
return nil, errUnknownState
return nil, err
}

// Given this is used to query canonical state. There should only be one saved canonical block of a given slot.
Expand Down

0 comments on commit 199c50b

Please sign in to comment.