mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 23:18:15 -05:00
Use time.Time instead of uint64 for genesis time (#15419)
* Convert genesis times from seconds to time.Time * Fixing failed forkchoice tests in a new commit so it doesn't get worse Fixing failed spectest tests in a new commit so it doesn't get worse Fixing forkchoice tests, then spectests * Fixing forkchoice tests, then spectests. Now asking for help... * Fix TestForkChoice_GetProposerHead * Fix broken build * Resolve TODO(preston) items * Changelog fragment * Resolve TODO(preston) items again * Resolve lint issues * Use consistant field names for sinceSlotStart (no spaces) * Manu's feedback * Renamed StartTime -> UnsafeStartTime, marked as deprecated because it doesn't handle overflow scenarios. Renamed SlotTime -> StartTime Renamed SlotAt -> At Handled the error in cases where StartTime was used. @james-prysm feedback * Revert beacon-chain/blockchain/receive_block_test.go from 1b7844de * Fixing issues after rebase * Accepted suggestions from @potuz * Remove CanonicalHeadSlot from merge conflicts --------- Co-authored-by: potuz <potuz@prysmaticlabs.com>
This commit is contained in:
@@ -737,7 +737,10 @@ func (s *Service) areDataColumnsAvailable(
|
||||
}
|
||||
|
||||
// Log for DA checks that cross over into the next slot; helpful for debugging.
|
||||
nextSlot := slots.BeginsAt(block.Slot()+1, s.genesisTime)
|
||||
nextSlot, err := slots.StartTime(s.genesisTime, block.Slot()+1)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to determine slot start time: %w", err)
|
||||
}
|
||||
|
||||
// Avoid logging if DA check is called after next slot start.
|
||||
if nextSlot.After(time.Now()) {
|
||||
@@ -855,7 +858,10 @@ func (s *Service) areBlobsAvailable(ctx context.Context, root [fieldparams.RootL
|
||||
nc := s.blobNotifiers.forRoot(root, block.Slot())
|
||||
|
||||
// Log for DA checks that cross over into the next slot; helpful for debugging.
|
||||
nextSlot := slots.BeginsAt(block.Slot()+1, s.genesisTime)
|
||||
nextSlot, err := slots.StartTime(s.genesisTime, block.Slot()+1)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to determine slot start time: %w", err)
|
||||
}
|
||||
// Avoid logging if DA check is called after next slot start.
|
||||
if nextSlot.After(time.Now()) {
|
||||
nst := time.AfterFunc(time.Until(nextSlot), func() {
|
||||
@@ -906,7 +912,7 @@ func uint64MapToSortedSlice(input map[uint64]bool) []uint64 {
|
||||
// it also updates the next slot cache and the proposer index cache to deal with skipped slots.
|
||||
func (s *Service) lateBlockTasks(ctx context.Context) {
|
||||
currentSlot := s.CurrentSlot()
|
||||
if s.CurrentSlot() == s.HeadSlot() {
|
||||
if currentSlot == s.HeadSlot() {
|
||||
return
|
||||
}
|
||||
s.cfg.ForkChoiceStore.RLock()
|
||||
|
||||
Reference in New Issue
Block a user