mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-28 14:17:17 +00:00
839845645c
* request assignments from the canonical head slot at first * imports
89 lines
2.3 KiB
Go
89 lines
2.3 KiB
Go
package client
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
pb "github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1"
|
|
"github.com/prysmaticlabs/prysm/shared/params"
|
|
)
|
|
|
|
var _ = Validator(&fakeValidator{})
|
|
|
|
type fakeValidator struct {
|
|
DoneCalled bool
|
|
WaitForActivationCalled bool
|
|
WaitForChainStartCalled bool
|
|
NextSlotRet <-chan uint64
|
|
NextSlotCalled bool
|
|
CanonicalHeadSlotCalled bool
|
|
UpdateAssignmentsCalled bool
|
|
UpdateAssignmentsArg1 uint64
|
|
UpdateAssignmentsRet error
|
|
RoleAtCalled bool
|
|
RoleAtArg1 uint64
|
|
RoleAtRet pb.ValidatorRole
|
|
AttestToBlockHeadCalled bool
|
|
AttestToBlockHeadArg1 uint64
|
|
ProposeBlockCalled bool
|
|
ProposeBlockArg1 uint64
|
|
LogValidatorGainsAndLossesCalled bool
|
|
SlotDeadlineCalled bool
|
|
}
|
|
|
|
func (fv *fakeValidator) Done() {
|
|
fv.DoneCalled = true
|
|
}
|
|
|
|
func (fv *fakeValidator) WaitForChainStart(_ context.Context) error {
|
|
fv.WaitForChainStartCalled = true
|
|
return nil
|
|
}
|
|
|
|
func (fv *fakeValidator) WaitForActivation(_ context.Context) error {
|
|
fv.WaitForActivationCalled = true
|
|
return nil
|
|
}
|
|
|
|
func (fv *fakeValidator) CanonicalHeadSlot(_ context.Context) (uint64, error) {
|
|
fv.CanonicalHeadSlotCalled = true
|
|
return params.BeaconConfig().GenesisSlot, nil
|
|
}
|
|
|
|
func (fv *fakeValidator) SlotDeadline(_ uint64) time.Time {
|
|
fv.SlotDeadlineCalled = true
|
|
return time.Now()
|
|
}
|
|
|
|
func (fv *fakeValidator) NextSlot() <-chan uint64 {
|
|
fv.NextSlotCalled = true
|
|
return fv.NextSlotRet
|
|
}
|
|
|
|
func (fv *fakeValidator) UpdateAssignments(_ context.Context, slot uint64) error {
|
|
fv.UpdateAssignmentsCalled = true
|
|
fv.UpdateAssignmentsArg1 = slot
|
|
return fv.UpdateAssignmentsRet
|
|
}
|
|
|
|
func (fv *fakeValidator) LogValidatorGainsAndLosses(_ context.Context, slot uint64) error {
|
|
fv.LogValidatorGainsAndLossesCalled = true
|
|
return nil
|
|
}
|
|
|
|
func (fv *fakeValidator) RoleAt(slot uint64) pb.ValidatorRole {
|
|
fv.RoleAtCalled = true
|
|
fv.RoleAtArg1 = slot
|
|
return fv.RoleAtRet
|
|
}
|
|
|
|
func (fv *fakeValidator) AttestToBlockHead(_ context.Context, slot uint64) {
|
|
fv.AttestToBlockHeadCalled = true
|
|
fv.AttestToBlockHeadArg1 = slot
|
|
}
|
|
|
|
func (fv *fakeValidator) ProposeBlock(_ context.Context, slot uint64) {
|
|
fv.ProposeBlockCalled = true
|
|
fv.ProposeBlockArg1 = slot
|
|
}
|