2020-06-18 18:30:05 +00:00
|
|
|
package streaming
|
2019-01-23 02:52:39 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2019-03-25 15:21:21 +00:00
|
|
|
"time"
|
2019-01-23 02:52:39 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var _ = Validator(&fakeValidator{})
|
|
|
|
|
|
|
|
type fakeValidator struct {
|
2019-03-18 15:45:28 +00:00
|
|
|
DoneCalled bool
|
2019-03-27 03:30:22 +00:00
|
|
|
WaitForActivationCalled bool
|
2019-03-18 15:45:28 +00:00
|
|
|
WaitForChainStartCalled bool
|
2019-11-08 01:59:11 +00:00
|
|
|
WaitForSyncCalled bool
|
2020-04-20 23:16:53 +00:00
|
|
|
WaitForSyncedCalled bool
|
2019-03-18 15:45:28 +00:00
|
|
|
NextSlotCalled bool
|
2020-06-18 18:30:05 +00:00
|
|
|
StreamDutiesCalled bool
|
2020-05-08 15:16:53 +00:00
|
|
|
UpdateProtectionsCalled bool
|
2019-03-18 15:45:28 +00:00
|
|
|
RoleAtCalled bool
|
|
|
|
AttestToBlockHeadCalled bool
|
|
|
|
ProposeBlockCalled bool
|
|
|
|
LogValidatorGainsAndLossesCalled bool
|
2020-05-08 15:16:53 +00:00
|
|
|
SaveProtectionsCalled bool
|
2019-03-25 15:21:21 +00:00
|
|
|
SlotDeadlineCalled bool
|
2020-04-03 05:09:15 +00:00
|
|
|
ProposeBlockArg1 uint64
|
|
|
|
AttestToBlockHeadArg1 uint64
|
|
|
|
RoleAtArg1 uint64
|
|
|
|
NextSlotRet <-chan uint64
|
2019-04-18 17:23:38 +00:00
|
|
|
PublicKey string
|
2020-06-18 18:30:05 +00:00
|
|
|
StreamDutiesRet error
|
2020-04-06 03:24:24 +00:00
|
|
|
RolesAtRet []validatorRole
|
2019-01-23 02:52:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (fv *fakeValidator) Done() {
|
|
|
|
fv.DoneCalled = true
|
|
|
|
}
|
|
|
|
|
2019-02-20 21:58:23 +00:00
|
|
|
func (fv *fakeValidator) WaitForChainStart(_ context.Context) error {
|
2019-01-30 12:28:53 +00:00
|
|
|
fv.WaitForChainStartCalled = true
|
2019-02-20 21:58:23 +00:00
|
|
|
return nil
|
2019-01-30 12:28:53 +00:00
|
|
|
}
|
|
|
|
|
2019-03-27 03:30:22 +00:00
|
|
|
func (fv *fakeValidator) WaitForActivation(_ context.Context) error {
|
|
|
|
fv.WaitForActivationCalled = true
|
|
|
|
return nil
|
2019-01-23 02:52:39 +00:00
|
|
|
}
|
|
|
|
|
2019-11-08 01:59:11 +00:00
|
|
|
func (fv *fakeValidator) WaitForSync(_ context.Context) error {
|
|
|
|
fv.WaitForSyncCalled = true
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-04-20 23:16:53 +00:00
|
|
|
func (fv *fakeValidator) WaitForSynced(_ context.Context) error {
|
|
|
|
fv.WaitForSyncedCalled = true
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2019-03-25 15:21:21 +00:00
|
|
|
func (fv *fakeValidator) SlotDeadline(_ uint64) time.Time {
|
|
|
|
fv.SlotDeadlineCalled = true
|
|
|
|
return time.Now()
|
|
|
|
}
|
|
|
|
|
2019-01-23 02:52:39 +00:00
|
|
|
func (fv *fakeValidator) NextSlot() <-chan uint64 {
|
|
|
|
fv.NextSlotCalled = true
|
|
|
|
return fv.NextSlotRet
|
|
|
|
}
|
|
|
|
|
2020-06-18 18:30:05 +00:00
|
|
|
func (fv *fakeValidator) StreamDuties(_ context.Context) error {
|
|
|
|
fv.StreamDutiesCalled = true
|
|
|
|
return fv.StreamDutiesRet
|
2019-01-23 02:52:39 +00:00
|
|
|
}
|
|
|
|
|
2020-05-08 15:16:53 +00:00
|
|
|
func (fv *fakeValidator) UpdateProtections(_ context.Context, slot uint64) error {
|
|
|
|
fv.UpdateProtectionsCalled = true
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2019-03-18 15:45:28 +00:00
|
|
|
func (fv *fakeValidator) LogValidatorGainsAndLosses(_ context.Context, slot uint64) error {
|
|
|
|
fv.LogValidatorGainsAndLossesCalled = true
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-05-08 15:16:53 +00:00
|
|
|
func (fv *fakeValidator) SaveProtections(_ context.Context) error {
|
|
|
|
fv.SaveProtectionsCalled = true
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-04-06 03:24:24 +00:00
|
|
|
func (fv *fakeValidator) RolesAt(_ context.Context, slot uint64) (map[[48]byte][]validatorRole, error) {
|
2019-01-23 02:52:39 +00:00
|
|
|
fv.RoleAtCalled = true
|
|
|
|
fv.RoleAtArg1 = slot
|
2020-04-06 03:24:24 +00:00
|
|
|
vr := make(map[[48]byte][]validatorRole)
|
2019-11-21 22:35:20 +00:00
|
|
|
vr[[48]byte{1}] = fv.RolesAtRet
|
2019-11-22 05:11:38 +00:00
|
|
|
return vr, nil
|
2019-01-23 02:52:39 +00:00
|
|
|
}
|
|
|
|
|
2019-11-12 17:14:03 +00:00
|
|
|
func (fv *fakeValidator) SubmitAttestation(_ context.Context, slot uint64, pubKey [48]byte) {
|
2019-01-23 02:52:39 +00:00
|
|
|
fv.AttestToBlockHeadCalled = true
|
|
|
|
fv.AttestToBlockHeadArg1 = slot
|
|
|
|
}
|
|
|
|
|
2019-10-12 02:22:51 +00:00
|
|
|
func (fv *fakeValidator) ProposeBlock(_ context.Context, slot uint64, pubKey [48]byte) {
|
2019-01-23 02:52:39 +00:00
|
|
|
fv.ProposeBlockCalled = true
|
|
|
|
fv.ProposeBlockArg1 = slot
|
|
|
|
}
|
2019-11-22 05:11:38 +00:00
|
|
|
|
|
|
|
func (fv *fakeValidator) SubmitAggregateAndProof(_ context.Context, slot uint64, pubKey [48]byte) {}
|
2020-01-02 17:04:07 +00:00
|
|
|
|
|
|
|
func (fv *fakeValidator) LogAttestationsSubmitted() {}
|
2020-02-24 21:02:45 +00:00
|
|
|
|
|
|
|
func (fv *fakeValidator) UpdateDomainDataCaches(context.Context, uint64) {}
|
2020-06-18 18:30:05 +00:00
|
|
|
|
|
|
|
func (fv *fakeValidator) CurrentSlot() uint64 { return 0 }
|