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:
@@ -242,7 +242,7 @@ func TestService_waitForStateInitialization(t *testing.T) {
|
||||
|
||||
st, err := util.NewBeaconState()
|
||||
require.NoError(t, err)
|
||||
gt := time.Unix(int64(st.GenesisTime()), 0)
|
||||
gt := st.GenesisTime()
|
||||
s, gs := newService(ctx, &mock.ChainService{State: st, Genesis: gt, ValidatorsRoot: [32]byte{}})
|
||||
|
||||
expectedGenesisTime := gt
|
||||
@@ -356,7 +356,8 @@ func TestService_Resync(t *testing.T) {
|
||||
st, err := util.NewBeaconState()
|
||||
require.NoError(t, err)
|
||||
futureSlot := primitives.Slot(160)
|
||||
require.NoError(t, st.SetGenesisTime(uint64(makeGenesisTime(futureSlot).Unix())))
|
||||
genesis := makeGenesisTime(futureSlot)
|
||||
require.NoError(t, st.SetGenesisTime(genesis))
|
||||
return &mock.ChainService{
|
||||
State: st,
|
||||
Root: genesisRoot[:],
|
||||
@@ -364,7 +365,7 @@ func TestService_Resync(t *testing.T) {
|
||||
FinalizedCheckPoint: ð.Checkpoint{
|
||||
Epoch: slots.ToEpoch(futureSlot),
|
||||
},
|
||||
Genesis: time.Now(),
|
||||
Genesis: genesis,
|
||||
ValidatorsRoot: [32]byte{},
|
||||
}
|
||||
},
|
||||
@@ -392,6 +393,7 @@ func TestService_Resync(t *testing.T) {
|
||||
BlobStorage: filesystem.NewEphemeralBlobStorage(t),
|
||||
})
|
||||
assert.NotNil(t, s)
|
||||
s.genesisTime = mc.Genesis
|
||||
assert.Equal(t, primitives.Slot(0), s.cfg.Chain.HeadSlot())
|
||||
err := s.Resync()
|
||||
if tt.wantedErr != "" {
|
||||
|
||||
Reference in New Issue
Block a user