prysm-pulse/validator/client/fake_validator_test.go
Ivan Martinez 25102e0978
Use WaitForSynced in validator client for startup (#5465)
* Add WaitForSynced to beacon-chain
* Fix build issues
* Fix comment
* Merge branch 'master' of https://github.com/prysmaticlabs/prysm into simplify-validator
* Fix tests
* Merge branch 'master' of https://github.com/prysmaticlabs/prysm into simplify-validator
* Merge branch 'master' of https://github.com/prysmaticlabs/prysm into simplify-validator
* Change validator client to use WaitForSynced
* Change prysm script to support windows
* Update prysm.sh
* Merge branch '0xKiwi-patch-1' of https://github.com/prysmaticlabs/prysm into simplify-val-client
* Merge branch 'master' into simplify-val-client
* Merge branch 'master' of https://github.com/prysmaticlabs/prysm into simplify-val-client
* Merge branch 'master' of https://github.com/prysmaticlabs/prysm into simplify-val-client
* Add to mock
* Merge branch 'simplify-val-client' of https://github.com/0xKiwi/Prysm into simplify-val-client
* Fix mocks
* Add feature flag for WaitForSynced
* Merge branch 'master' of https://github.com/prysmaticlabs/prysm into simplify-val-client
* Fix flag
* Merge branch 'master' of https://github.com/prysmaticlabs/prysm into simplify-val-client
* Merge branch 'master' of https://github.com/prysmaticlabs/prysm into simplify-val-client
* Remove comment
* Merge branch 'master' into simplify-val-client
* Merge branch 'master' into simplify-val-client
* Merge branch 'master' into simplify-val-client
* Merge branch 'master' into simplify-val-client
2020-04-20 23:16:53 +00:00

107 lines
2.9 KiB
Go

package client
import (
"context"
"time"
)
var _ = Validator(&fakeValidator{})
type fakeValidator struct {
DoneCalled bool
WaitForActivationCalled bool
WaitForChainStartCalled bool
WaitForSyncCalled bool
WaitForSyncedCalled bool
NextSlotCalled bool
CanonicalHeadSlotCalled bool
UpdateDutiesCalled bool
RoleAtCalled bool
AttestToBlockHeadCalled bool
ProposeBlockCalled bool
LogValidatorGainsAndLossesCalled bool
SlotDeadlineCalled bool
ProposeBlockArg1 uint64
AttestToBlockHeadArg1 uint64
RoleAtArg1 uint64
UpdateDutiesArg1 uint64
NextSlotRet <-chan uint64
PublicKey string
UpdateDutiesRet error
RolesAtRet []validatorRole
}
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) WaitForSync(_ context.Context) error {
fv.WaitForSyncCalled = true
return nil
}
func (fv *fakeValidator) WaitForSynced(_ context.Context) error {
fv.WaitForSyncedCalled = true
return nil
}
func (fv *fakeValidator) CanonicalHeadSlot(_ context.Context) (uint64, error) {
fv.CanonicalHeadSlotCalled = true
return 0, 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) UpdateDuties(_ context.Context, slot uint64) error {
fv.UpdateDutiesCalled = true
fv.UpdateDutiesArg1 = slot
return fv.UpdateDutiesRet
}
func (fv *fakeValidator) LogValidatorGainsAndLosses(_ context.Context, slot uint64) error {
fv.LogValidatorGainsAndLossesCalled = true
return nil
}
func (fv *fakeValidator) RolesAt(_ context.Context, slot uint64) (map[[48]byte][]validatorRole, error) {
fv.RoleAtCalled = true
fv.RoleAtArg1 = slot
vr := make(map[[48]byte][]validatorRole)
vr[[48]byte{1}] = fv.RolesAtRet
return vr, nil
}
func (fv *fakeValidator) SubmitAttestation(_ context.Context, slot uint64, pubKey [48]byte) {
fv.AttestToBlockHeadCalled = true
fv.AttestToBlockHeadArg1 = slot
}
func (fv *fakeValidator) ProposeBlock(_ context.Context, slot uint64, pubKey [48]byte) {
fv.ProposeBlockCalled = true
fv.ProposeBlockArg1 = slot
}
func (fv *fakeValidator) SubmitAggregateAndProof(_ context.Context, slot uint64, pubKey [48]byte) {}
func (fv *fakeValidator) LogAttestationsSubmitted() {}
func (fv *fakeValidator) UpdateDomainDataCaches(context.Context, uint64) {}