mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-11 20:20:05 +00:00
7067c84c69
* include validator client stream * Update validator/client/validator_attest.go * gazelle * rem extraneous logs * fixing tests * resolve most tests * gaz * add lock * ivan feedback * pass tests for update protect * gaz * duties gaz * no need for canonical head slot * fix ctx leak * fmt * add in feature flag * add streaming subpackage * add polling/streaming separation * able to build * fix duplicate package names * fix polling * imports * confirm it works * fixed up comment * go lint comments * gaz * build * Update validator/client/streaming/service_test.go Co-authored-by: terence tsao <terence@prysmaticlabs.com> * tidy * fmt * add stream duties to e2e * add stream duties to e2e flags Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> Co-authored-by: terence tsao <terence@prysmaticlabs.com>
113 lines
3.0 KiB
Go
113 lines
3.0 KiB
Go
package streaming
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
var _ = Validator(&fakeValidator{})
|
|
|
|
type fakeValidator struct {
|
|
DoneCalled bool
|
|
WaitForActivationCalled bool
|
|
WaitForChainStartCalled bool
|
|
WaitForSyncCalled bool
|
|
WaitForSyncedCalled bool
|
|
NextSlotCalled bool
|
|
StreamDutiesCalled bool
|
|
UpdateProtectionsCalled bool
|
|
RoleAtCalled bool
|
|
AttestToBlockHeadCalled bool
|
|
ProposeBlockCalled bool
|
|
LogValidatorGainsAndLossesCalled bool
|
|
SaveProtectionsCalled bool
|
|
SlotDeadlineCalled bool
|
|
ProposeBlockArg1 uint64
|
|
AttestToBlockHeadArg1 uint64
|
|
RoleAtArg1 uint64
|
|
NextSlotRet <-chan uint64
|
|
PublicKey string
|
|
StreamDutiesRet 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) 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) StreamDuties(_ context.Context) error {
|
|
fv.StreamDutiesCalled = true
|
|
return fv.StreamDutiesRet
|
|
}
|
|
|
|
func (fv *fakeValidator) UpdateProtections(_ context.Context, slot uint64) error {
|
|
fv.UpdateProtectionsCalled = true
|
|
return nil
|
|
}
|
|
|
|
func (fv *fakeValidator) LogValidatorGainsAndLosses(_ context.Context, slot uint64) error {
|
|
fv.LogValidatorGainsAndLossesCalled = true
|
|
return nil
|
|
}
|
|
|
|
func (fv *fakeValidator) SaveProtections(_ context.Context) error {
|
|
fv.SaveProtectionsCalled = 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) {}
|
|
|
|
func (fv *fakeValidator) CurrentSlot() uint64 { return 0 }
|