mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 23:18:15 -05:00
Block backfilling (#12968)
* backfill service * fix bug where origin state is never unlocked * support mvslice states * use renamed interface * refactor db code to skip block cache for backfill * lint * add test for verifier.verify * enable service in service init test * cancellation cleanup * adding nil checks to configset juggling * assume blocks are available by default As long as we're sure the AvailableBlocker is initialized correctly during node startup, defaulting to assuming we aren't in a checkpoint sync simplifies things greatly for tests. * block saving path refactor and bugfix * fix fillback test * fix BackfillStatus init tests --------- Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
This commit is contained in:
@@ -98,6 +98,16 @@ func EpochStart(epoch primitives.Epoch) (primitives.Slot, error) {
|
||||
return slot, nil
|
||||
}
|
||||
|
||||
// UnsafeEpochStart is a version of EpochStart that panics if there is an overflow. It can be safely used by code
|
||||
// that first guarantees epoch <= MaxSafeEpoch.
|
||||
func UnsafeEpochStart(epoch primitives.Epoch) primitives.Slot {
|
||||
es, err := EpochStart(epoch)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return es
|
||||
}
|
||||
|
||||
// EpochEnd returns the last slot number of the
|
||||
// current epoch.
|
||||
func EpochEnd(epoch primitives.Epoch) (primitives.Slot, error) {
|
||||
@@ -271,3 +281,8 @@ func WithinVotingWindow(genesisTime uint64, slot primitives.Slot) bool {
|
||||
votingWindow := params.BeaconConfig().SecondsPerSlot / params.BeaconConfig().IntervalsPerSlot
|
||||
return time.Since(StartTime(genesisTime, slot)) < time.Duration(votingWindow)*time.Second
|
||||
}
|
||||
|
||||
// MaxSafeEpoch gives the largest epoch value that can be safely converted to a slot.
|
||||
func MaxSafeEpoch() primitives.Epoch {
|
||||
return primitives.Epoch(math.MaxUint64 / uint64(params.BeaconConfig().SlotsPerEpoch))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user