mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 07:58:22 -05:00
* overhaul fork schedule management for bpos * Unify log * Radek's comments * Use arg config to determine previous epoch, with regression test * Remove unnecessary NewClock. @potuz feedback * Continuation of previous commit: Remove unnecessary NewClock. @potuz feedback * Remove VerifyBlockHeaderSignatureUsingCurrentFork * cosmetic changes * Remove unnecessary copy. entryWithForkDigest passes by value, not by pointer so it shold be fine * Reuse ErrInvalidTopic from p2p package * Unskip TestServer_GetBeaconConfig * Resolve TODO about forkwatcher in local mode * remove Copy() --------- Co-authored-by: Kasey <kasey@users.noreply.github.com> Co-authored-by: terence tsao <terence@prysmaticlabs.com> Co-authored-by: rkapka <radoslaw.kapka@gmail.com> Co-authored-by: Preston Van Loon <preston@pvl.dev>
34 lines
759 B
Go
34 lines
759 B
Go
package startup
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/OffchainLabs/prysm/v6/consensus-types/primitives"
|
|
"github.com/OffchainLabs/prysm/v6/time/slots"
|
|
)
|
|
|
|
// MockNower is a mock implementation of the Nower interface for use in tests.
|
|
type MockNower struct {
|
|
t time.Time
|
|
}
|
|
|
|
// Now satisfies the Nower interface using a mocked time value
|
|
func (m *MockNower) Now() time.Time {
|
|
return m.t
|
|
}
|
|
|
|
// SetSlot sets the current time to the start of the given slot.
|
|
func (m *MockNower) SetSlot(t *testing.T, c *Clock, s primitives.Slot) {
|
|
now, err := slots.StartTime(c.GenesisTime(), s)
|
|
if err != nil {
|
|
t.Fatalf("failed to set slot: %v", err)
|
|
}
|
|
m.t = now
|
|
}
|
|
|
|
// Set sets the current time to the given time.
|
|
func (m *MockNower) Set(now time.Time) {
|
|
m.t = now
|
|
}
|