diff --git a/WORKSPACE b/WORKSPACE index 07a92f81c9e7..1ee3495269aa 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1333,7 +1333,7 @@ go_repository( go_repository( name = "com_github_prysmaticlabs_ethereumapis", - commit = "ba9042096e9fc49606279513d3e24e5e8cdbd5a0", + commit = "df460bd3d84be4ff3df0658395c7dc9d2a7e7b3d", importpath = "github.com/prysmaticlabs/ethereumapis", ) diff --git a/beacon-chain/blockchain/head.go b/beacon-chain/blockchain/head.go index 97926bc54b12..4186786aad67 100644 --- a/beacon-chain/blockchain/head.go +++ b/beacon-chain/blockchain/head.go @@ -2,14 +2,18 @@ package blockchain import ( "context" + "fmt" "github.com/pkg/errors" ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" + "github.com/prysmaticlabs/prysm/beacon-chain/core/feed" + statefeed "github.com/prysmaticlabs/prysm/beacon-chain/core/feed/state" "github.com/prysmaticlabs/prysm/beacon-chain/state" stateTrie "github.com/prysmaticlabs/prysm/beacon-chain/state" "github.com/prysmaticlabs/prysm/shared/bytesutil" "github.com/prysmaticlabs/prysm/shared/featureconfig" "github.com/prysmaticlabs/prysm/shared/params" + "github.com/sirupsen/logrus" "go.opencensus.io/trace" ) @@ -100,6 +104,21 @@ func (s *Service) saveHead(ctx context.Context, headRoot [32]byte) error { return errors.New("cannot save nil head state") } + // A chain re-org occurred, so we fire an event notifying the rest of the services. + if bytesutil.ToBytes32(newHeadBlock.Block.ParentRoot) != s.headRoot() { + log.WithFields(logrus.Fields{ + "newSlot": fmt.Sprintf("%d", newHeadBlock.Block.Slot), + "oldSlot": fmt.Sprintf("%d", s.headSlot()), + }).Debug("Chain reorg occurred") + s.stateNotifier.StateFeed().Send(&feed.Event{ + Type: statefeed.Reorg, + Data: &statefeed.ReorgData{ + NewSlot: newHeadBlock.Block.Slot, + OldSlot: s.headSlot(), + }, + }) + } + // Cache the new head info. s.setHead(headRoot, newHeadBlock, newHeadState) diff --git a/beacon-chain/blockchain/head_test.go b/beacon-chain/blockchain/head_test.go index a9028cf15abe..edf058fb97db 100644 --- a/beacon-chain/blockchain/head_test.go +++ b/beacon-chain/blockchain/head_test.go @@ -11,6 +11,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/state/stateutil" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/prysmaticlabs/prysm/shared/testutil" + logTest "github.com/sirupsen/logrus/hooks/test" ) func TestSaveHead_Same(t *testing.T) { @@ -82,3 +83,59 @@ func TestSaveHead_Different(t *testing.T) { t.Error("Head did not change") } } + +func TestSaveHead_Different_Reorg(t *testing.T) { + hook := logTest.NewGlobal() + db := testDB.SetupDB(t) + service := setupBeaconChain(t, db) + + oldRoot := [32]byte{'A'} + service.head = &head{slot: 0, root: oldRoot} + + reorgChainParent := [32]byte{'B'} + newHeadBlock := ðpb.BeaconBlock{ + Slot: 1, + ParentRoot: reorgChainParent[:], + } + newHeadSignedBlock := ðpb.SignedBeaconBlock{Block: newHeadBlock} + + if err := service.beaconDB.SaveBlock(context.Background(), newHeadSignedBlock); err != nil { + t.Fatal(err) + } + newRoot, err := stateutil.BlockRoot(newHeadBlock) + if err != nil { + t.Fatal(err) + } + headState := testutil.NewBeaconState() + if err := headState.SetSlot(1); err != nil { + t.Fatal(err) + } + if err := service.beaconDB.SaveStateSummary(context.Background(), &pb.StateSummary{Slot: 1, Root: newRoot[:]}); err != nil { + t.Fatal(err) + } + if err := service.beaconDB.SaveState(context.Background(), headState, newRoot); err != nil { + t.Fatal(err) + } + if err := service.saveHead(context.Background(), newRoot); err != nil { + t.Fatal(err) + } + + if service.HeadSlot() != 1 { + t.Error("Head did not change") + } + + cachedRoot, err := service.HeadRoot(context.Background()) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(cachedRoot, newRoot[:]) { + t.Error("Head did not change") + } + if !reflect.DeepEqual(service.headBlock(), newHeadSignedBlock) { + t.Error("Head did not change") + } + if !reflect.DeepEqual(service.headState().CloneInnerState(), headState.CloneInnerState()) { + t.Error("Head did not change") + } + testutil.AssertLogsContain(t, hook, "Chain reorg occurred") +} diff --git a/beacon-chain/core/feed/state/events.go b/beacon-chain/core/feed/state/events.go index 1aeef5239ac2..06021369f5d6 100644 --- a/beacon-chain/core/feed/state/events.go +++ b/beacon-chain/core/feed/state/events.go @@ -14,13 +14,16 @@ const ( Initialized // Synced is sent when the beacon node has completed syncing and is ready to participate in the network. Synced + // Reorg is an event sent when the new head state's slot after a block + // transition is lower than its previous head state slot value. + Reorg ) // BlockProcessedData is the data sent with BlockProcessed events. type BlockProcessedData struct { // Slot is the slot of the processed block. Slot uint64 - // BlockRoot is the hash of the processed block. + // BlockRoot of the processed block. BlockRoot [32]byte // Verified is true if the block's BLS contents have been verified. Verified bool @@ -45,3 +48,11 @@ type InitializedData struct { // GenesisValidatorsRoot represents ssz.HashTreeRoot(state.validators). GenesisValidatorsRoot []byte } + +// ReorgData is the data alongside a reorg event. +type ReorgData struct { + // NewSlot is the slot of new state after the reorg. + NewSlot uint64 + // OldSlot is the slot of the head state before the reorg. + OldSlot uint64 +} diff --git a/beacon-chain/rpc/testing/BUILD.bazel b/beacon-chain/rpc/testing/BUILD.bazel index b9600f85320a..9c787b9561c1 100644 --- a/beacon-chain/rpc/testing/BUILD.bazel +++ b/beacon-chain/rpc/testing/BUILD.bazel @@ -11,6 +11,7 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/beacon-chain/rpc/testing", visibility = ["//beacon-chain:__subpackages__"], deps = [ + "@com_github_gogo_protobuf//types:go_default_library", "@com_github_golang_mock//gomock:go_default_library", "@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library", "@org_golang_google_grpc//metadata:go_default_library", diff --git a/beacon-chain/rpc/testing/beacon_node_validator_service_mock.go b/beacon-chain/rpc/testing/beacon_node_validator_service_mock.go index a19ffbfae9b8..b0b9f91d27f3 100644 --- a/beacon-chain/rpc/testing/beacon_node_validator_service_mock.go +++ b/beacon-chain/rpc/testing/beacon_node_validator_service_mock.go @@ -1,42 +1,301 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/prysmaticlabs/ethereumapis/eth/v1alpha1 (interfaces: BeaconNodeValidator_WaitForSyncedServer,BeaconNodeValidator_WaitForActivationServer,BeaconNodeValidator_WaitForChainStartServer) +// Source: github.com/prysmaticlabs/ethereumapis/eth/v1alpha1 (interfaces: BeaconNodeValidatorServer,BeaconNodeValidator_WaitForSyncedServer,BeaconNodeValidator_WaitForActivationServer,BeaconNodeValidator_WaitForChainStartServer,BeaconNodeValidator_StreamDutiesServer) -// Package mock is a generated GoMock package. +// Package testing is a generated GoMock package. package testing import ( context "context" - reflect "reflect" - + types "github.com/gogo/protobuf/types" gomock "github.com/golang/mock/gomock" eth "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" metadata "google.golang.org/grpc/metadata" + reflect "reflect" ) -// MockBeaconNodeValidator_WaitForSyncedServer is a mock of BeaconNodeValidator_WaitForSyncedServer interface. +// MockBeaconNodeValidatorServer is a mock of BeaconNodeValidatorServer interface +type MockBeaconNodeValidatorServer struct { + ctrl *gomock.Controller + recorder *MockBeaconNodeValidatorServerMockRecorder +} + +// MockBeaconNodeValidatorServerMockRecorder is the mock recorder for MockBeaconNodeValidatorServer +type MockBeaconNodeValidatorServerMockRecorder struct { + mock *MockBeaconNodeValidatorServer +} + +// NewMockBeaconNodeValidatorServer creates a new mock instance +func NewMockBeaconNodeValidatorServer(ctrl *gomock.Controller) *MockBeaconNodeValidatorServer { + mock := &MockBeaconNodeValidatorServer{ctrl: ctrl} + mock.recorder = &MockBeaconNodeValidatorServerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockBeaconNodeValidatorServer) EXPECT() *MockBeaconNodeValidatorServerMockRecorder { + return m.recorder +} + +// DomainData mocks base method +func (m *MockBeaconNodeValidatorServer) DomainData(arg0 context.Context, arg1 *eth.DomainRequest) (*eth.DomainResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DomainData", arg0, arg1) + ret0, _ := ret[0].(*eth.DomainResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DomainData indicates an expected call of DomainData +func (mr *MockBeaconNodeValidatorServerMockRecorder) DomainData(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainData", reflect.TypeOf((*MockBeaconNodeValidatorServer)(nil).DomainData), arg0, arg1) +} + +// GetAttestationData mocks base method +func (m *MockBeaconNodeValidatorServer) GetAttestationData(arg0 context.Context, arg1 *eth.AttestationDataRequest) (*eth.AttestationData, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAttestationData", arg0, arg1) + ret0, _ := ret[0].(*eth.AttestationData) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetAttestationData indicates an expected call of GetAttestationData +func (mr *MockBeaconNodeValidatorServerMockRecorder) GetAttestationData(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAttestationData", reflect.TypeOf((*MockBeaconNodeValidatorServer)(nil).GetAttestationData), arg0, arg1) +} + +// GetBlock mocks base method +func (m *MockBeaconNodeValidatorServer) GetBlock(arg0 context.Context, arg1 *eth.BlockRequest) (*eth.BeaconBlock, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetBlock", arg0, arg1) + ret0, _ := ret[0].(*eth.BeaconBlock) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetBlock indicates an expected call of GetBlock +func (mr *MockBeaconNodeValidatorServerMockRecorder) GetBlock(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlock", reflect.TypeOf((*MockBeaconNodeValidatorServer)(nil).GetBlock), arg0, arg1) +} + +// GetDuties mocks base method +func (m *MockBeaconNodeValidatorServer) GetDuties(arg0 context.Context, arg1 *eth.DutiesRequest) (*eth.DutiesResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDuties", arg0, arg1) + ret0, _ := ret[0].(*eth.DutiesResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetDuties indicates an expected call of GetDuties +func (mr *MockBeaconNodeValidatorServerMockRecorder) GetDuties(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDuties", reflect.TypeOf((*MockBeaconNodeValidatorServer)(nil).GetDuties), arg0, arg1) +} + +// ProposeAttestation mocks base method +func (m *MockBeaconNodeValidatorServer) ProposeAttestation(arg0 context.Context, arg1 *eth.Attestation) (*eth.AttestResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ProposeAttestation", arg0, arg1) + ret0, _ := ret[0].(*eth.AttestResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ProposeAttestation indicates an expected call of ProposeAttestation +func (mr *MockBeaconNodeValidatorServerMockRecorder) ProposeAttestation(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProposeAttestation", reflect.TypeOf((*MockBeaconNodeValidatorServer)(nil).ProposeAttestation), arg0, arg1) +} + +// ProposeBlock mocks base method +func (m *MockBeaconNodeValidatorServer) ProposeBlock(arg0 context.Context, arg1 *eth.SignedBeaconBlock) (*eth.ProposeResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ProposeBlock", arg0, arg1) + ret0, _ := ret[0].(*eth.ProposeResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ProposeBlock indicates an expected call of ProposeBlock +func (mr *MockBeaconNodeValidatorServerMockRecorder) ProposeBlock(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProposeBlock", reflect.TypeOf((*MockBeaconNodeValidatorServer)(nil).ProposeBlock), arg0, arg1) +} + +// ProposeExit mocks base method +func (m *MockBeaconNodeValidatorServer) ProposeExit(arg0 context.Context, arg1 *eth.SignedVoluntaryExit) (*types.Empty, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ProposeExit", arg0, arg1) + ret0, _ := ret[0].(*types.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ProposeExit indicates an expected call of ProposeExit +func (mr *MockBeaconNodeValidatorServerMockRecorder) ProposeExit(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProposeExit", reflect.TypeOf((*MockBeaconNodeValidatorServer)(nil).ProposeExit), arg0, arg1) +} + +// StreamDuties mocks base method +func (m *MockBeaconNodeValidatorServer) StreamDuties(arg0 *eth.DutiesRequest, arg1 eth.BeaconNodeValidator_StreamDutiesServer) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "StreamDuties", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// StreamDuties indicates an expected call of StreamDuties +func (mr *MockBeaconNodeValidatorServerMockRecorder) StreamDuties(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StreamDuties", reflect.TypeOf((*MockBeaconNodeValidatorServer)(nil).StreamDuties), arg0, arg1) +} + +// SubmitAggregateSelectionProof mocks base method +func (m *MockBeaconNodeValidatorServer) SubmitAggregateSelectionProof(arg0 context.Context, arg1 *eth.AggregateSelectionRequest) (*eth.AggregateSelectionResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SubmitAggregateSelectionProof", arg0, arg1) + ret0, _ := ret[0].(*eth.AggregateSelectionResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SubmitAggregateSelectionProof indicates an expected call of SubmitAggregateSelectionProof +func (mr *MockBeaconNodeValidatorServerMockRecorder) SubmitAggregateSelectionProof(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubmitAggregateSelectionProof", reflect.TypeOf((*MockBeaconNodeValidatorServer)(nil).SubmitAggregateSelectionProof), arg0, arg1) +} + +// SubmitSignedAggregateSelectionProof mocks base method +func (m *MockBeaconNodeValidatorServer) SubmitSignedAggregateSelectionProof(arg0 context.Context, arg1 *eth.SignedAggregateSubmitRequest) (*eth.SignedAggregateSubmitResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SubmitSignedAggregateSelectionProof", arg0, arg1) + ret0, _ := ret[0].(*eth.SignedAggregateSubmitResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SubmitSignedAggregateSelectionProof indicates an expected call of SubmitSignedAggregateSelectionProof +func (mr *MockBeaconNodeValidatorServerMockRecorder) SubmitSignedAggregateSelectionProof(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubmitSignedAggregateSelectionProof", reflect.TypeOf((*MockBeaconNodeValidatorServer)(nil).SubmitSignedAggregateSelectionProof), arg0, arg1) +} + +// SubscribeCommitteeSubnets mocks base method +func (m *MockBeaconNodeValidatorServer) SubscribeCommitteeSubnets(arg0 context.Context, arg1 *eth.CommitteeSubnetsSubscribeRequest) (*types.Empty, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SubscribeCommitteeSubnets", arg0, arg1) + ret0, _ := ret[0].(*types.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SubscribeCommitteeSubnets indicates an expected call of SubscribeCommitteeSubnets +func (mr *MockBeaconNodeValidatorServerMockRecorder) SubscribeCommitteeSubnets(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubscribeCommitteeSubnets", reflect.TypeOf((*MockBeaconNodeValidatorServer)(nil).SubscribeCommitteeSubnets), arg0, arg1) +} + +// ValidatorIndex mocks base method +func (m *MockBeaconNodeValidatorServer) ValidatorIndex(arg0 context.Context, arg1 *eth.ValidatorIndexRequest) (*eth.ValidatorIndexResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidatorIndex", arg0, arg1) + ret0, _ := ret[0].(*eth.ValidatorIndexResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ValidatorIndex indicates an expected call of ValidatorIndex +func (mr *MockBeaconNodeValidatorServerMockRecorder) ValidatorIndex(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorIndex", reflect.TypeOf((*MockBeaconNodeValidatorServer)(nil).ValidatorIndex), arg0, arg1) +} + +// ValidatorStatus mocks base method +func (m *MockBeaconNodeValidatorServer) ValidatorStatus(arg0 context.Context, arg1 *eth.ValidatorStatusRequest) (*eth.ValidatorStatusResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidatorStatus", arg0, arg1) + ret0, _ := ret[0].(*eth.ValidatorStatusResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ValidatorStatus indicates an expected call of ValidatorStatus +func (mr *MockBeaconNodeValidatorServerMockRecorder) ValidatorStatus(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorStatus", reflect.TypeOf((*MockBeaconNodeValidatorServer)(nil).ValidatorStatus), arg0, arg1) +} + +// WaitForActivation mocks base method +func (m *MockBeaconNodeValidatorServer) WaitForActivation(arg0 *eth.ValidatorActivationRequest, arg1 eth.BeaconNodeValidator_WaitForActivationServer) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "WaitForActivation", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitForActivation indicates an expected call of WaitForActivation +func (mr *MockBeaconNodeValidatorServerMockRecorder) WaitForActivation(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitForActivation", reflect.TypeOf((*MockBeaconNodeValidatorServer)(nil).WaitForActivation), arg0, arg1) +} + +// WaitForChainStart mocks base method +func (m *MockBeaconNodeValidatorServer) WaitForChainStart(arg0 *types.Empty, arg1 eth.BeaconNodeValidator_WaitForChainStartServer) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "WaitForChainStart", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitForChainStart indicates an expected call of WaitForChainStart +func (mr *MockBeaconNodeValidatorServerMockRecorder) WaitForChainStart(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitForChainStart", reflect.TypeOf((*MockBeaconNodeValidatorServer)(nil).WaitForChainStart), arg0, arg1) +} + +// WaitForSynced mocks base method +func (m *MockBeaconNodeValidatorServer) WaitForSynced(arg0 *types.Empty, arg1 eth.BeaconNodeValidator_WaitForSyncedServer) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "WaitForSynced", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitForSynced indicates an expected call of WaitForSynced +func (mr *MockBeaconNodeValidatorServerMockRecorder) WaitForSynced(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitForSynced", reflect.TypeOf((*MockBeaconNodeValidatorServer)(nil).WaitForSynced), arg0, arg1) +} + +// MockBeaconNodeValidator_WaitForSyncedServer is a mock of BeaconNodeValidator_WaitForSyncedServer interface type MockBeaconNodeValidator_WaitForSyncedServer struct { ctrl *gomock.Controller recorder *MockBeaconNodeValidator_WaitForSyncedServerMockRecorder } -// MockBeaconNodeValidator_WaitForSyncedServerMockRecorder is the mock recorder for MockBeaconNodeValidator_WaitForSyncedServer. +// MockBeaconNodeValidator_WaitForSyncedServerMockRecorder is the mock recorder for MockBeaconNodeValidator_WaitForSyncedServer type MockBeaconNodeValidator_WaitForSyncedServerMockRecorder struct { mock *MockBeaconNodeValidator_WaitForSyncedServer } -// NewMockBeaconNodeValidator_WaitForSyncedServer creates a new mock instance. +// NewMockBeaconNodeValidator_WaitForSyncedServer creates a new mock instance func NewMockBeaconNodeValidator_WaitForSyncedServer(ctrl *gomock.Controller) *MockBeaconNodeValidator_WaitForSyncedServer { mock := &MockBeaconNodeValidator_WaitForSyncedServer{ctrl: ctrl} mock.recorder = &MockBeaconNodeValidator_WaitForSyncedServerMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use. +// EXPECT returns an object that allows the caller to indicate expected use func (m *MockBeaconNodeValidator_WaitForSyncedServer) EXPECT() *MockBeaconNodeValidator_WaitForSyncedServerMockRecorder { return m.recorder } -// Context mocks base method. +// Context mocks base method func (m *MockBeaconNodeValidator_WaitForSyncedServer) Context() context.Context { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Context") @@ -44,13 +303,13 @@ func (m *MockBeaconNodeValidator_WaitForSyncedServer) Context() context.Context return ret0 } -// Context indicates an expected call of Context. +// Context indicates an expected call of Context func (mr *MockBeaconNodeValidator_WaitForSyncedServerMockRecorder) Context() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockBeaconNodeValidator_WaitForSyncedServer)(nil).Context)) } -// RecvMsg mocks base method. +// RecvMsg mocks base method func (m *MockBeaconNodeValidator_WaitForSyncedServer) RecvMsg(arg0 interface{}) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "RecvMsg", arg0) @@ -58,13 +317,13 @@ func (m *MockBeaconNodeValidator_WaitForSyncedServer) RecvMsg(arg0 interface{}) return ret0 } -// RecvMsg indicates an expected call of RecvMsg. +// RecvMsg indicates an expected call of RecvMsg func (mr *MockBeaconNodeValidator_WaitForSyncedServerMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockBeaconNodeValidator_WaitForSyncedServer)(nil).RecvMsg), arg0) } -// Send mocks base method. +// Send mocks base method func (m *MockBeaconNodeValidator_WaitForSyncedServer) Send(arg0 *eth.SyncedResponse) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Send", arg0) @@ -72,13 +331,13 @@ func (m *MockBeaconNodeValidator_WaitForSyncedServer) Send(arg0 *eth.SyncedRespo return ret0 } -// Send indicates an expected call of Send. +// Send indicates an expected call of Send func (mr *MockBeaconNodeValidator_WaitForSyncedServerMockRecorder) Send(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockBeaconNodeValidator_WaitForSyncedServer)(nil).Send), arg0) } -// SendHeader mocks base method. +// SendHeader mocks base method func (m *MockBeaconNodeValidator_WaitForSyncedServer) SendHeader(arg0 metadata.MD) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SendHeader", arg0) @@ -86,13 +345,13 @@ func (m *MockBeaconNodeValidator_WaitForSyncedServer) SendHeader(arg0 metadata.M return ret0 } -// SendHeader indicates an expected call of SendHeader. +// SendHeader indicates an expected call of SendHeader func (mr *MockBeaconNodeValidator_WaitForSyncedServerMockRecorder) SendHeader(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendHeader", reflect.TypeOf((*MockBeaconNodeValidator_WaitForSyncedServer)(nil).SendHeader), arg0) } -// SendMsg mocks base method. +// SendMsg mocks base method func (m *MockBeaconNodeValidator_WaitForSyncedServer) SendMsg(arg0 interface{}) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SendMsg", arg0) @@ -100,13 +359,13 @@ func (m *MockBeaconNodeValidator_WaitForSyncedServer) SendMsg(arg0 interface{}) return ret0 } -// SendMsg indicates an expected call of SendMsg. +// SendMsg indicates an expected call of SendMsg func (mr *MockBeaconNodeValidator_WaitForSyncedServerMockRecorder) SendMsg(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockBeaconNodeValidator_WaitForSyncedServer)(nil).SendMsg), arg0) } -// SetHeader mocks base method. +// SetHeader mocks base method func (m *MockBeaconNodeValidator_WaitForSyncedServer) SetHeader(arg0 metadata.MD) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SetHeader", arg0) @@ -114,48 +373,48 @@ func (m *MockBeaconNodeValidator_WaitForSyncedServer) SetHeader(arg0 metadata.MD return ret0 } -// SetHeader indicates an expected call of SetHeader. +// SetHeader indicates an expected call of SetHeader func (mr *MockBeaconNodeValidator_WaitForSyncedServerMockRecorder) SetHeader(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetHeader", reflect.TypeOf((*MockBeaconNodeValidator_WaitForSyncedServer)(nil).SetHeader), arg0) } -// SetTrailer mocks base method. +// SetTrailer mocks base method func (m *MockBeaconNodeValidator_WaitForSyncedServer) SetTrailer(arg0 metadata.MD) { m.ctrl.T.Helper() m.ctrl.Call(m, "SetTrailer", arg0) } -// SetTrailer indicates an expected call of SetTrailer. +// SetTrailer indicates an expected call of SetTrailer func (mr *MockBeaconNodeValidator_WaitForSyncedServerMockRecorder) SetTrailer(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTrailer", reflect.TypeOf((*MockBeaconNodeValidator_WaitForSyncedServer)(nil).SetTrailer), arg0) } -// MockBeaconNodeValidator_WaitForActivationServer is a mock of BeaconNodeValidator_WaitForActivationServer interface. +// MockBeaconNodeValidator_WaitForActivationServer is a mock of BeaconNodeValidator_WaitForActivationServer interface type MockBeaconNodeValidator_WaitForActivationServer struct { ctrl *gomock.Controller recorder *MockBeaconNodeValidator_WaitForActivationServerMockRecorder } -// MockBeaconNodeValidator_WaitForActivationServerMockRecorder is the mock recorder for MockBeaconNodeValidator_WaitForActivationServer. +// MockBeaconNodeValidator_WaitForActivationServerMockRecorder is the mock recorder for MockBeaconNodeValidator_WaitForActivationServer type MockBeaconNodeValidator_WaitForActivationServerMockRecorder struct { mock *MockBeaconNodeValidator_WaitForActivationServer } -// NewMockBeaconNodeValidator_WaitForActivationServer creates a new mock instance. +// NewMockBeaconNodeValidator_WaitForActivationServer creates a new mock instance func NewMockBeaconNodeValidator_WaitForActivationServer(ctrl *gomock.Controller) *MockBeaconNodeValidator_WaitForActivationServer { mock := &MockBeaconNodeValidator_WaitForActivationServer{ctrl: ctrl} mock.recorder = &MockBeaconNodeValidator_WaitForActivationServerMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use. +// EXPECT returns an object that allows the caller to indicate expected use func (m *MockBeaconNodeValidator_WaitForActivationServer) EXPECT() *MockBeaconNodeValidator_WaitForActivationServerMockRecorder { return m.recorder } -// Context mocks base method. +// Context mocks base method func (m *MockBeaconNodeValidator_WaitForActivationServer) Context() context.Context { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Context") @@ -163,13 +422,13 @@ func (m *MockBeaconNodeValidator_WaitForActivationServer) Context() context.Cont return ret0 } -// Context indicates an expected call of Context. +// Context indicates an expected call of Context func (mr *MockBeaconNodeValidator_WaitForActivationServerMockRecorder) Context() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockBeaconNodeValidator_WaitForActivationServer)(nil).Context)) } -// RecvMsg mocks base method. +// RecvMsg mocks base method func (m *MockBeaconNodeValidator_WaitForActivationServer) RecvMsg(arg0 interface{}) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "RecvMsg", arg0) @@ -177,13 +436,13 @@ func (m *MockBeaconNodeValidator_WaitForActivationServer) RecvMsg(arg0 interface return ret0 } -// RecvMsg indicates an expected call of RecvMsg. +// RecvMsg indicates an expected call of RecvMsg func (mr *MockBeaconNodeValidator_WaitForActivationServerMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockBeaconNodeValidator_WaitForActivationServer)(nil).RecvMsg), arg0) } -// Send mocks base method. +// Send mocks base method func (m *MockBeaconNodeValidator_WaitForActivationServer) Send(arg0 *eth.ValidatorActivationResponse) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Send", arg0) @@ -191,13 +450,13 @@ func (m *MockBeaconNodeValidator_WaitForActivationServer) Send(arg0 *eth.Validat return ret0 } -// Send indicates an expected call of Send. +// Send indicates an expected call of Send func (mr *MockBeaconNodeValidator_WaitForActivationServerMockRecorder) Send(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockBeaconNodeValidator_WaitForActivationServer)(nil).Send), arg0) } -// SendHeader mocks base method. +// SendHeader mocks base method func (m *MockBeaconNodeValidator_WaitForActivationServer) SendHeader(arg0 metadata.MD) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SendHeader", arg0) @@ -205,13 +464,13 @@ func (m *MockBeaconNodeValidator_WaitForActivationServer) SendHeader(arg0 metada return ret0 } -// SendHeader indicates an expected call of SendHeader. +// SendHeader indicates an expected call of SendHeader func (mr *MockBeaconNodeValidator_WaitForActivationServerMockRecorder) SendHeader(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendHeader", reflect.TypeOf((*MockBeaconNodeValidator_WaitForActivationServer)(nil).SendHeader), arg0) } -// SendMsg mocks base method. +// SendMsg mocks base method func (m *MockBeaconNodeValidator_WaitForActivationServer) SendMsg(arg0 interface{}) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SendMsg", arg0) @@ -219,13 +478,13 @@ func (m *MockBeaconNodeValidator_WaitForActivationServer) SendMsg(arg0 interface return ret0 } -// SendMsg indicates an expected call of SendMsg. +// SendMsg indicates an expected call of SendMsg func (mr *MockBeaconNodeValidator_WaitForActivationServerMockRecorder) SendMsg(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockBeaconNodeValidator_WaitForActivationServer)(nil).SendMsg), arg0) } -// SetHeader mocks base method. +// SetHeader mocks base method func (m *MockBeaconNodeValidator_WaitForActivationServer) SetHeader(arg0 metadata.MD) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SetHeader", arg0) @@ -233,48 +492,48 @@ func (m *MockBeaconNodeValidator_WaitForActivationServer) SetHeader(arg0 metadat return ret0 } -// SetHeader indicates an expected call of SetHeader. +// SetHeader indicates an expected call of SetHeader func (mr *MockBeaconNodeValidator_WaitForActivationServerMockRecorder) SetHeader(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetHeader", reflect.TypeOf((*MockBeaconNodeValidator_WaitForActivationServer)(nil).SetHeader), arg0) } -// SetTrailer mocks base method. +// SetTrailer mocks base method func (m *MockBeaconNodeValidator_WaitForActivationServer) SetTrailer(arg0 metadata.MD) { m.ctrl.T.Helper() m.ctrl.Call(m, "SetTrailer", arg0) } -// SetTrailer indicates an expected call of SetTrailer. +// SetTrailer indicates an expected call of SetTrailer func (mr *MockBeaconNodeValidator_WaitForActivationServerMockRecorder) SetTrailer(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTrailer", reflect.TypeOf((*MockBeaconNodeValidator_WaitForActivationServer)(nil).SetTrailer), arg0) } -// MockBeaconNodeValidator_WaitForChainStartServer is a mock of BeaconNodeValidator_WaitForChainStartServer interface. +// MockBeaconNodeValidator_WaitForChainStartServer is a mock of BeaconNodeValidator_WaitForChainStartServer interface type MockBeaconNodeValidator_WaitForChainStartServer struct { ctrl *gomock.Controller recorder *MockBeaconNodeValidator_WaitForChainStartServerMockRecorder } -// MockBeaconNodeValidator_WaitForChainStartServerMockRecorder is the mock recorder for MockBeaconNodeValidator_WaitForChainStartServer. +// MockBeaconNodeValidator_WaitForChainStartServerMockRecorder is the mock recorder for MockBeaconNodeValidator_WaitForChainStartServer type MockBeaconNodeValidator_WaitForChainStartServerMockRecorder struct { mock *MockBeaconNodeValidator_WaitForChainStartServer } -// NewMockBeaconNodeValidator_WaitForChainStartServer creates a new mock instance. +// NewMockBeaconNodeValidator_WaitForChainStartServer creates a new mock instance func NewMockBeaconNodeValidator_WaitForChainStartServer(ctrl *gomock.Controller) *MockBeaconNodeValidator_WaitForChainStartServer { mock := &MockBeaconNodeValidator_WaitForChainStartServer{ctrl: ctrl} mock.recorder = &MockBeaconNodeValidator_WaitForChainStartServerMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use. +// EXPECT returns an object that allows the caller to indicate expected use func (m *MockBeaconNodeValidator_WaitForChainStartServer) EXPECT() *MockBeaconNodeValidator_WaitForChainStartServerMockRecorder { return m.recorder } -// Context mocks base method. +// Context mocks base method func (m *MockBeaconNodeValidator_WaitForChainStartServer) Context() context.Context { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Context") @@ -282,13 +541,13 @@ func (m *MockBeaconNodeValidator_WaitForChainStartServer) Context() context.Cont return ret0 } -// Context indicates an expected call of Context. +// Context indicates an expected call of Context func (mr *MockBeaconNodeValidator_WaitForChainStartServerMockRecorder) Context() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockBeaconNodeValidator_WaitForChainStartServer)(nil).Context)) } -// RecvMsg mocks base method. +// RecvMsg mocks base method func (m *MockBeaconNodeValidator_WaitForChainStartServer) RecvMsg(arg0 interface{}) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "RecvMsg", arg0) @@ -296,13 +555,13 @@ func (m *MockBeaconNodeValidator_WaitForChainStartServer) RecvMsg(arg0 interface return ret0 } -// RecvMsg indicates an expected call of RecvMsg. +// RecvMsg indicates an expected call of RecvMsg func (mr *MockBeaconNodeValidator_WaitForChainStartServerMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockBeaconNodeValidator_WaitForChainStartServer)(nil).RecvMsg), arg0) } -// Send mocks base method. +// Send mocks base method func (m *MockBeaconNodeValidator_WaitForChainStartServer) Send(arg0 *eth.ChainStartResponse) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Send", arg0) @@ -310,13 +569,13 @@ func (m *MockBeaconNodeValidator_WaitForChainStartServer) Send(arg0 *eth.ChainSt return ret0 } -// Send indicates an expected call of Send. +// Send indicates an expected call of Send func (mr *MockBeaconNodeValidator_WaitForChainStartServerMockRecorder) Send(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockBeaconNodeValidator_WaitForChainStartServer)(nil).Send), arg0) } -// SendHeader mocks base method. +// SendHeader mocks base method func (m *MockBeaconNodeValidator_WaitForChainStartServer) SendHeader(arg0 metadata.MD) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SendHeader", arg0) @@ -324,13 +583,13 @@ func (m *MockBeaconNodeValidator_WaitForChainStartServer) SendHeader(arg0 metada return ret0 } -// SendHeader indicates an expected call of SendHeader. +// SendHeader indicates an expected call of SendHeader func (mr *MockBeaconNodeValidator_WaitForChainStartServerMockRecorder) SendHeader(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendHeader", reflect.TypeOf((*MockBeaconNodeValidator_WaitForChainStartServer)(nil).SendHeader), arg0) } -// SendMsg mocks base method. +// SendMsg mocks base method func (m *MockBeaconNodeValidator_WaitForChainStartServer) SendMsg(arg0 interface{}) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SendMsg", arg0) @@ -338,13 +597,13 @@ func (m *MockBeaconNodeValidator_WaitForChainStartServer) SendMsg(arg0 interface return ret0 } -// SendMsg indicates an expected call of SendMsg. +// SendMsg indicates an expected call of SendMsg func (mr *MockBeaconNodeValidator_WaitForChainStartServerMockRecorder) SendMsg(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockBeaconNodeValidator_WaitForChainStartServer)(nil).SendMsg), arg0) } -// SetHeader mocks base method. +// SetHeader mocks base method func (m *MockBeaconNodeValidator_WaitForChainStartServer) SetHeader(arg0 metadata.MD) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SetHeader", arg0) @@ -352,20 +611,139 @@ func (m *MockBeaconNodeValidator_WaitForChainStartServer) SetHeader(arg0 metadat return ret0 } -// SetHeader indicates an expected call of SetHeader. +// SetHeader indicates an expected call of SetHeader func (mr *MockBeaconNodeValidator_WaitForChainStartServerMockRecorder) SetHeader(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetHeader", reflect.TypeOf((*MockBeaconNodeValidator_WaitForChainStartServer)(nil).SetHeader), arg0) } -// SetTrailer mocks base method. +// SetTrailer mocks base method func (m *MockBeaconNodeValidator_WaitForChainStartServer) SetTrailer(arg0 metadata.MD) { m.ctrl.T.Helper() m.ctrl.Call(m, "SetTrailer", arg0) } -// SetTrailer indicates an expected call of SetTrailer. +// SetTrailer indicates an expected call of SetTrailer func (mr *MockBeaconNodeValidator_WaitForChainStartServerMockRecorder) SetTrailer(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTrailer", reflect.TypeOf((*MockBeaconNodeValidator_WaitForChainStartServer)(nil).SetTrailer), arg0) } + +// MockBeaconNodeValidator_StreamDutiesServer is a mock of BeaconNodeValidator_StreamDutiesServer interface +type MockBeaconNodeValidator_StreamDutiesServer struct { + ctrl *gomock.Controller + recorder *MockBeaconNodeValidator_StreamDutiesServerMockRecorder +} + +// MockBeaconNodeValidator_StreamDutiesServerMockRecorder is the mock recorder for MockBeaconNodeValidator_StreamDutiesServer +type MockBeaconNodeValidator_StreamDutiesServerMockRecorder struct { + mock *MockBeaconNodeValidator_StreamDutiesServer +} + +// NewMockBeaconNodeValidator_StreamDutiesServer creates a new mock instance +func NewMockBeaconNodeValidator_StreamDutiesServer(ctrl *gomock.Controller) *MockBeaconNodeValidator_StreamDutiesServer { + mock := &MockBeaconNodeValidator_StreamDutiesServer{ctrl: ctrl} + mock.recorder = &MockBeaconNodeValidator_StreamDutiesServerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockBeaconNodeValidator_StreamDutiesServer) EXPECT() *MockBeaconNodeValidator_StreamDutiesServerMockRecorder { + return m.recorder +} + +// Context mocks base method +func (m *MockBeaconNodeValidator_StreamDutiesServer) Context() context.Context { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Context") + ret0, _ := ret[0].(context.Context) + return ret0 +} + +// Context indicates an expected call of Context +func (mr *MockBeaconNodeValidator_StreamDutiesServerMockRecorder) Context() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockBeaconNodeValidator_StreamDutiesServer)(nil).Context)) +} + +// RecvMsg mocks base method +func (m *MockBeaconNodeValidator_StreamDutiesServer) RecvMsg(arg0 interface{}) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RecvMsg", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// RecvMsg indicates an expected call of RecvMsg +func (mr *MockBeaconNodeValidator_StreamDutiesServerMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockBeaconNodeValidator_StreamDutiesServer)(nil).RecvMsg), arg0) +} + +// Send mocks base method +func (m *MockBeaconNodeValidator_StreamDutiesServer) Send(arg0 *eth.DutiesResponse) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Send", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Send indicates an expected call of Send +func (mr *MockBeaconNodeValidator_StreamDutiesServerMockRecorder) Send(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockBeaconNodeValidator_StreamDutiesServer)(nil).Send), arg0) +} + +// SendHeader mocks base method +func (m *MockBeaconNodeValidator_StreamDutiesServer) SendHeader(arg0 metadata.MD) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendHeader", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendHeader indicates an expected call of SendHeader +func (mr *MockBeaconNodeValidator_StreamDutiesServerMockRecorder) SendHeader(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendHeader", reflect.TypeOf((*MockBeaconNodeValidator_StreamDutiesServer)(nil).SendHeader), arg0) +} + +// SendMsg mocks base method +func (m *MockBeaconNodeValidator_StreamDutiesServer) SendMsg(arg0 interface{}) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendMsg", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendMsg indicates an expected call of SendMsg +func (mr *MockBeaconNodeValidator_StreamDutiesServerMockRecorder) SendMsg(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockBeaconNodeValidator_StreamDutiesServer)(nil).SendMsg), arg0) +} + +// SetHeader mocks base method +func (m *MockBeaconNodeValidator_StreamDutiesServer) SetHeader(arg0 metadata.MD) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetHeader", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetHeader indicates an expected call of SetHeader +func (mr *MockBeaconNodeValidator_StreamDutiesServerMockRecorder) SetHeader(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetHeader", reflect.TypeOf((*MockBeaconNodeValidator_StreamDutiesServer)(nil).SetHeader), arg0) +} + +// SetTrailer mocks base method +func (m *MockBeaconNodeValidator_StreamDutiesServer) SetTrailer(arg0 metadata.MD) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetTrailer", arg0) +} + +// SetTrailer indicates an expected call of SetTrailer +func (mr *MockBeaconNodeValidator_StreamDutiesServerMockRecorder) SetTrailer(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTrailer", reflect.TypeOf((*MockBeaconNodeValidator_StreamDutiesServer)(nil).SetTrailer), arg0) +} diff --git a/beacon-chain/rpc/validator/BUILD.bazel b/beacon-chain/rpc/validator/BUILD.bazel index 86c1f24af9d9..0aad64c39192 100644 --- a/beacon-chain/rpc/validator/BUILD.bazel +++ b/beacon-chain/rpc/validator/BUILD.bazel @@ -44,6 +44,7 @@ go_library( "//shared/hashutil:go_default_library", "//shared/params:go_default_library", "//shared/roughtime:go_default_library", + "//shared/slotutil:go_default_library", "//shared/traceutil:go_default_library", "//shared/trieutil:go_default_library", "@com_github_gogo_protobuf//types:go_default_library", diff --git a/beacon-chain/rpc/validator/assignments.go b/beacon-chain/rpc/validator/assignments.go index 39ca32ca672a..3b5047b08101 100644 --- a/beacon-chain/rpc/validator/assignments.go +++ b/beacon-chain/rpc/validator/assignments.go @@ -7,26 +7,96 @@ import ( ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" "github.com/prysmaticlabs/prysm/beacon-chain/cache" + "github.com/prysmaticlabs/prysm/beacon-chain/core/feed" + statefeed "github.com/prysmaticlabs/prysm/beacon-chain/core/feed/state" "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" "github.com/prysmaticlabs/prysm/beacon-chain/core/state" "github.com/prysmaticlabs/prysm/shared/bytesutil" "github.com/prysmaticlabs/prysm/shared/params" "github.com/prysmaticlabs/prysm/shared/roughtime" + "github.com/prysmaticlabs/prysm/shared/slotutil" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) -// GetDuties returns the committee assignment response from a given validator public key. -// The committee assignment response contains the following fields for the current and previous epoch: -// 1.) The list of validators in the committee. -// 2.) The shard to which the committee is assigned. -// 3.) The slot at which the committee is assigned. -// 4.) The bool signaling if the validator is expected to propose a block at the assigned slot. +// GetDuties returns the duties assigned to a list of validators specified +// in the request object. func (vs *Server) GetDuties(ctx context.Context, req *ethpb.DutiesRequest) (*ethpb.DutiesResponse, error) { if vs.SyncChecker.Syncing() { return nil, status.Error(codes.Unavailable, "Syncing to latest head, not ready to respond") } + return vs.duties(ctx, req) +} + +// StreamDuties returns the duties assigned to a list of validators specified +// in the request object via a server-side stream. The stream sends out new assignments in case +// a chain re-org occurred. +func (vs *Server) StreamDuties(req *ethpb.DutiesRequest, stream ethpb.BeaconNodeValidator_StreamDutiesServer) error { + if vs.SyncChecker.Syncing() { + return status.Error(codes.Unavailable, "Syncing to latest head, not ready to respond") + } + + // We compute duties the very first time the endpoint is called. + res, err := vs.duties(stream.Context(), req) + if err != nil { + return status.Errorf(codes.Internal, "Could not compute validator duties: %v", err) + } + if err := stream.Send(res); err != nil { + return status.Errorf(codes.Internal, "Could not send response over stream: %v", err) + } + + // We start a for loop which ticks on every epoch or a chain reorg. + stateChannel := make(chan *feed.Event, 1) + stateSub := vs.StateNotifier.StateFeed().Subscribe(stateChannel) + defer stateSub.Unsubscribe() + + secondsPerEpoch := params.BeaconConfig().SecondsPerSlot * params.BeaconConfig().SlotsPerEpoch + epochTicker := slotutil.GetSlotTicker(vs.GenesisTimeFetcher.GenesisTime(), secondsPerEpoch) + for { + select { + // Ticks every epoch to submit assignments to connected validator clients. + case <-epochTicker.C(): + res, err := vs.duties(stream.Context(), req) + if err != nil { + return status.Errorf(codes.Internal, "Could not compute validator duties: %v", err) + } + if err := stream.Send(res); err != nil { + return status.Errorf(codes.Internal, "Could not send response over stream: %v", err) + } + case ev := <-stateChannel: + // If a reorg occurred, we recompute duties for the connected validator clients + // and send another response over the server stream right away. + if ev.Type == statefeed.Reorg { + data, ok := ev.Data.(*statefeed.ReorgData) + if !ok { + return status.Errorf(codes.Internal, "Received incorrect data type over reorg feed: %v", data) + } + newSlotEpoch := helpers.SlotToEpoch(data.NewSlot) + oldSlotEpoch := helpers.SlotToEpoch(data.OldSlot) + // We only send out new duties if a reorg across epochs occurred, otherwise + // validator shufflings would not have changed as a result of a reorg. + if newSlotEpoch >= oldSlotEpoch { + continue + } + res, err := vs.duties(stream.Context(), req) + if err != nil { + return status.Errorf(codes.Internal, "Could not compute validator duties: %v", err) + } + if err := stream.Send(res); err != nil { + return status.Errorf(codes.Internal, "Could not send response over stream: %v", err) + } + } + case <-stream.Context().Done(): + return status.Error(codes.Canceled, "Stream context canceled") + case <-vs.Ctx.Done(): + return status.Error(codes.Canceled, "RPC context canceled") + } + } +} +// Compute the validator duties from the head state's corresponding epoch +// for validators public key / indices requested. +func (vs *Server) duties(ctx context.Context, req *ethpb.DutiesRequest) (*ethpb.DutiesResponse, error) { s, err := vs.HeadFetcher.HeadState(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "Could not get head state: %v", err) @@ -43,14 +113,8 @@ func (vs *Server) GetDuties(ctx context.Context, req *ethpb.DutiesRequest) (*eth if err != nil { return nil, status.Errorf(codes.Internal, "Could not compute committee assignments: %v", err) } - // Query the next epoch assignments for committee subnet subscriptions. - nextCommitteeAssignments, _, err := helpers.CommitteeAssignments(s, req.Epoch+1) - if err != nil { - return nil, status.Errorf(codes.Internal, "Could not compute committee assignments: %v", err) - } var committeeIDs []uint64 - var nextCommitteeIDs []uint64 validatorAssignments := make([]*ethpb.DutiesResponse_Duty, 0, len(req.PublicKeys)) for _, pubKey := range req.PublicKeys { if ctx.Err() != nil { @@ -74,19 +138,13 @@ func (vs *Server) GetDuties(ctx context.Context, req *ethpb.DutiesRequest) (*eth assignment.CommitteeIndex = ca.CommitteeIndex committeeIDs = append(committeeIDs, ca.CommitteeIndex) } - // Save the next epoch assignments. - ca, ok = nextCommitteeAssignments[idx] - if ok { - nextCommitteeIDs = append(nextCommitteeIDs, ca.CommitteeIndex) - } - // Assign relevant validator to subnet. - assignValidatorToSubnet(pubKey, assignment.Status) - } else { // If the validator isn't in the beacon state, assume their status is unknown. assignment.Status = ethpb.ValidatorStatus_UNKNOWN_STATUS } validatorAssignments = append(validatorAssignments, assignment) + // Assign relevant validator to subnet. + assignValidatorToSubnet(pubKey, assignment.Status) } return ðpb.DutiesResponse{ @@ -94,11 +152,6 @@ func (vs *Server) GetDuties(ctx context.Context, req *ethpb.DutiesRequest) (*eth }, nil } -// StreamDuties -- -func (vs *Server) StreamDuties(stream ethpb.BeaconNodeValidator_StreamDutiesServer) error { - return status.Error(codes.Unimplemented, "unimplemented") -} - // assignValidatorToSubnet checks the status and pubkey of a particular validator // to discern whether persistent subnets need to be registered for them. func assignValidatorToSubnet(pubkey []byte, status ethpb.ValidatorStatus) { diff --git a/beacon-chain/rpc/validator/assignments_test.go b/beacon-chain/rpc/validator/assignments_test.go index e82fbae3f8dc..ec3dfbbceecd 100644 --- a/beacon-chain/rpc/validator/assignments_test.go +++ b/beacon-chain/rpc/validator/assignments_test.go @@ -8,14 +8,20 @@ import ( "testing" "time" - "github.com/prysmaticlabs/prysm/beacon-chain/cache" + "github.com/golang/mock/gomock" ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" + "github.com/prysmaticlabs/go-ssz" mockChain "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing" + "github.com/prysmaticlabs/prysm/beacon-chain/cache" "github.com/prysmaticlabs/prysm/beacon-chain/cache/depositcache" blk "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks" + "github.com/prysmaticlabs/prysm/beacon-chain/core/feed" + statefeed "github.com/prysmaticlabs/prysm/beacon-chain/core/feed/state" + "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" "github.com/prysmaticlabs/prysm/beacon-chain/core/state" dbutil "github.com/prysmaticlabs/prysm/beacon-chain/db/testing" mockPOW "github.com/prysmaticlabs/prysm/beacon-chain/powchain/testing" + mockRPC "github.com/prysmaticlabs/prysm/beacon-chain/rpc/testing" "github.com/prysmaticlabs/prysm/beacon-chain/state/stateutil" mockSync "github.com/prysmaticlabs/prysm/beacon-chain/sync/initial-sync/testing" "github.com/prysmaticlabs/prysm/shared/bytesutil" @@ -275,6 +281,181 @@ func TestGetDuties_SyncNotReady(t *testing.T) { } } +func TestStreamDuties_SyncNotReady(t *testing.T) { + vs := &Server{ + SyncChecker: &mockSync.Sync{IsSyncing: true}, + } + ctrl := gomock.NewController(t) + defer ctrl.Finish() + mockStream := mockRPC.NewMockBeaconNodeValidator_StreamDutiesServer(ctrl) + if err := vs.StreamDuties(ðpb.DutiesRequest{}, mockStream); err == nil || strings.Contains( + err.Error(), "syncing to latest head", + ) { + t.Error("Did not get wanted error") + } +} + +func TestStreamDuties_OK(t *testing.T) { + db := dbutil.SetupDB(t) + + genesis := blk.NewGenesisBlock([]byte{}) + depChainStart := params.BeaconConfig().MinGenesisActiveValidatorCount + deposits, _, err := testutil.DeterministicDepositsAndKeys(depChainStart) + if err != nil { + t.Fatal(err) + } + eth1Data, err := testutil.DeterministicEth1Data(len(deposits)) + if err != nil { + t.Fatal(err) + } + bs, err := state.GenesisBeaconState(deposits, 0, eth1Data) + if err != nil { + t.Fatalf("Could not setup genesis bs: %v", err) + } + genesisRoot, err := ssz.HashTreeRoot(genesis.Block) + if err != nil { + t.Fatalf("Could not get signing root %v", err) + } + + pubKeys := make([][]byte, len(deposits)) + indices := make([]uint64, len(deposits)) + for i := 0; i < len(deposits); i++ { + pubKeys[i] = deposits[i].Data.PublicKey + indices[i] = uint64(i) + } + + pubkeysAs48ByteType := make([][48]byte, len(pubKeys)) + for i, pk := range pubKeys { + pubkeysAs48ByteType[i] = bytesutil.ToBytes48(pk) + } + + ctx, cancel := context.WithCancel(context.Background()) + vs := &Server{ + Ctx: ctx, + BeaconDB: db, + HeadFetcher: &mockChain.ChainService{State: bs, Root: genesisRoot[:]}, + SyncChecker: &mockSync.Sync{IsSyncing: false}, + GenesisTimeFetcher: &mockChain.ChainService{ + Genesis: time.Now(), + }, + StateNotifier: &mockChain.MockStateNotifier{}, + } + + // Test the first validator in registry. + req := ðpb.DutiesRequest{ + PublicKeys: [][]byte{deposits[0].Data.PublicKey}, + Epoch: 0, + } + wantedRes, err := vs.duties(ctx, req) + if err != nil { + t.Fatal(err) + } + ctrl := gomock.NewController(t) + defer ctrl.Finish() + exitRoutine := make(chan bool) + mockStream := mockRPC.NewMockBeaconNodeValidator_StreamDutiesServer(ctrl) + mockStream.EXPECT().Send(wantedRes).Do(func(arg0 interface{}) { + exitRoutine <- true + }) + mockStream.EXPECT().Context().Return(ctx).AnyTimes() + go func(tt *testing.T) { + if err := vs.StreamDuties(req, mockStream); err != nil && !strings.Contains(err.Error(), "context canceled") { + tt.Errorf("Could not call RPC method: %v", err) + } + }(t) + <-exitRoutine + cancel() +} + +func TestStreamDuties_OK_ChainReorg(t *testing.T) { + db := dbutil.SetupDB(t) + + genesis := blk.NewGenesisBlock([]byte{}) + depChainStart := params.BeaconConfig().MinGenesisActiveValidatorCount + deposits, _, err := testutil.DeterministicDepositsAndKeys(depChainStart) + if err != nil { + t.Fatal(err) + } + eth1Data, err := testutil.DeterministicEth1Data(len(deposits)) + if err != nil { + t.Fatal(err) + } + bs, err := state.GenesisBeaconState(deposits, 0, eth1Data) + if err != nil { + t.Fatalf("Could not setup genesis bs: %v", err) + } + genesisRoot, err := ssz.HashTreeRoot(genesis.Block) + if err != nil { + t.Fatalf("Could not get signing root %v", err) + } + + pubKeys := make([][]byte, len(deposits)) + indices := make([]uint64, len(deposits)) + for i := 0; i < len(deposits); i++ { + pubKeys[i] = deposits[i].Data.PublicKey + indices[i] = uint64(i) + } + + pubkeysAs48ByteType := make([][48]byte, len(pubKeys)) + for i, pk := range pubKeys { + pubkeysAs48ByteType[i] = bytesutil.ToBytes48(pk) + } + + ctx, cancel := context.WithCancel(context.Background()) + vs := &Server{ + Ctx: ctx, + BeaconDB: db, + HeadFetcher: &mockChain.ChainService{State: bs, Root: genesisRoot[:]}, + SyncChecker: &mockSync.Sync{IsSyncing: false}, + GenesisTimeFetcher: &mockChain.ChainService{ + Genesis: time.Now(), + }, + StateNotifier: &mockChain.MockStateNotifier{}, + } + + // Test the first validator in registry. + req := ðpb.DutiesRequest{ + PublicKeys: [][]byte{deposits[0].Data.PublicKey}, + Epoch: 0, + } + wantedRes, err := vs.duties(ctx, req) + if err != nil { + t.Fatal(err) + } + ctrl := gomock.NewController(t) + defer ctrl.Finish() + exitRoutine := make(chan bool) + mockStream := mockRPC.NewMockBeaconNodeValidator_StreamDutiesServer(ctrl) + mockStream.EXPECT().Send(wantedRes).Return(nil) + mockStream.EXPECT().Send(wantedRes).Do(func(arg0 interface{}) { + exitRoutine <- true + }) + mockStream.EXPECT().Context().Return(ctx).AnyTimes() + go func(tt *testing.T) { + if err := vs.StreamDuties(req, mockStream); err != nil && !strings.Contains(err.Error(), "context canceled") { + tt.Errorf("Could not call RPC method: %v", err) + } + }(t) + // Fire a reorg event within the same epoch. This should NOT + // trigger a recomputation not resending of duties over the stream. + for sent := 0; sent == 0; { + sent = vs.StateNotifier.StateFeed().Send(&feed.Event{ + Type: statefeed.Reorg, + Data: &statefeed.ReorgData{OldSlot: 0, NewSlot: 0}, + }) + } + // Fire a reorg event across epoch boundaries. This needs to trigger + // a recomputation and resending of duties over the stream. + for sent := 0; sent == 0; { + sent = vs.StateNotifier.StateFeed().Send(&feed.Event{ + Type: statefeed.Reorg, + Data: &statefeed.ReorgData{OldSlot: helpers.StartSlot(1), NewSlot: 0}, + }) + } + <-exitRoutine + cancel() +} + func TestAssignValidatorToSubnet(t *testing.T) { k := pubKey(3) @@ -292,7 +473,6 @@ func TestAssignValidatorToSubnet(t *testing.T) { if receivedTime < totalTime { t.Fatalf("Expiration time of %f was less than expected duration of %f ", receivedTime.Seconds(), totalTime.Seconds()) } - } func BenchmarkCommitteeAssignment(b *testing.B) { diff --git a/validator/internal/beacon_node_validator_service_mock.go b/validator/internal/beacon_node_validator_service_mock.go index 9534bac36380..a7fda9a54d1f 100644 --- a/validator/internal/beacon_node_validator_service_mock.go +++ b/validator/internal/beacon_node_validator_service_mock.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/prysmaticlabs/ethereumapis/eth/v1alpha1 (interfaces: BeaconNodeValidatorClient,BeaconNodeValidator_WaitForSyncedClient,BeaconNodeValidator_WaitForChainStartClient,BeaconNodeValidator_WaitForActivationClient) +// Source: github.com/prysmaticlabs/ethereumapis/eth/v1alpha1 (interfaces: BeaconNodeValidatorClient,BeaconNodeValidator_WaitForSyncedClient,BeaconNodeValidator_WaitForChainStartClient,BeaconNodeValidator_WaitForActivationClient,BeaconNodeValidator_StreamDutiesClient) // Package internal is a generated GoMock package. package internal @@ -179,10 +179,10 @@ func (mr *MockBeaconNodeValidatorClientMockRecorder) ProposeExit(arg0, arg1 inte } // StreamDuties mocks base method -func (m *MockBeaconNodeValidatorClient) StreamDuties(arg0 context.Context, arg1 ...grpc.CallOption) (eth.BeaconNodeValidator_StreamDutiesClient, error) { +func (m *MockBeaconNodeValidatorClient) StreamDuties(arg0 context.Context, arg1 *eth.DutiesRequest, arg2 ...grpc.CallOption) (eth.BeaconNodeValidator_StreamDutiesClient, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0} - for _, a := range arg1 { + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "StreamDuties", varargs...) @@ -192,9 +192,9 @@ func (m *MockBeaconNodeValidatorClient) StreamDuties(arg0 context.Context, arg1 } // StreamDuties indicates an expected call of StreamDuties -func (mr *MockBeaconNodeValidatorClientMockRecorder) StreamDuties(arg0 interface{}, arg1 ...interface{}) *gomock.Call { +func (mr *MockBeaconNodeValidatorClientMockRecorder) StreamDuties(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0}, arg1...) + varargs := append([]interface{}{arg0, arg1}, arg2...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StreamDuties", reflect.TypeOf((*MockBeaconNodeValidatorClient)(nil).StreamDuties), varargs...) } @@ -726,3 +726,126 @@ func (mr *MockBeaconNodeValidator_WaitForActivationClientMockRecorder) Trailer() mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockBeaconNodeValidator_WaitForActivationClient)(nil).Trailer)) } + +// MockBeaconNodeValidator_StreamDutiesClient is a mock of BeaconNodeValidator_StreamDutiesClient interface +type MockBeaconNodeValidator_StreamDutiesClient struct { + ctrl *gomock.Controller + recorder *MockBeaconNodeValidator_StreamDutiesClientMockRecorder +} + +// MockBeaconNodeValidator_StreamDutiesClientMockRecorder is the mock recorder for MockBeaconNodeValidator_StreamDutiesClient +type MockBeaconNodeValidator_StreamDutiesClientMockRecorder struct { + mock *MockBeaconNodeValidator_StreamDutiesClient +} + +// NewMockBeaconNodeValidator_StreamDutiesClient creates a new mock instance +func NewMockBeaconNodeValidator_StreamDutiesClient(ctrl *gomock.Controller) *MockBeaconNodeValidator_StreamDutiesClient { + mock := &MockBeaconNodeValidator_StreamDutiesClient{ctrl: ctrl} + mock.recorder = &MockBeaconNodeValidator_StreamDutiesClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockBeaconNodeValidator_StreamDutiesClient) EXPECT() *MockBeaconNodeValidator_StreamDutiesClientMockRecorder { + return m.recorder +} + +// CloseSend mocks base method +func (m *MockBeaconNodeValidator_StreamDutiesClient) CloseSend() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CloseSend") + ret0, _ := ret[0].(error) + return ret0 +} + +// CloseSend indicates an expected call of CloseSend +func (mr *MockBeaconNodeValidator_StreamDutiesClientMockRecorder) CloseSend() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseSend", reflect.TypeOf((*MockBeaconNodeValidator_StreamDutiesClient)(nil).CloseSend)) +} + +// Context mocks base method +func (m *MockBeaconNodeValidator_StreamDutiesClient) Context() context.Context { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Context") + ret0, _ := ret[0].(context.Context) + return ret0 +} + +// Context indicates an expected call of Context +func (mr *MockBeaconNodeValidator_StreamDutiesClientMockRecorder) Context() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockBeaconNodeValidator_StreamDutiesClient)(nil).Context)) +} + +// Header mocks base method +func (m *MockBeaconNodeValidator_StreamDutiesClient) Header() (metadata.MD, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Header") + ret0, _ := ret[0].(metadata.MD) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Header indicates an expected call of Header +func (mr *MockBeaconNodeValidator_StreamDutiesClientMockRecorder) Header() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockBeaconNodeValidator_StreamDutiesClient)(nil).Header)) +} + +// Recv mocks base method +func (m *MockBeaconNodeValidator_StreamDutiesClient) Recv() (*eth.DutiesResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Recv") + ret0, _ := ret[0].(*eth.DutiesResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Recv indicates an expected call of Recv +func (mr *MockBeaconNodeValidator_StreamDutiesClientMockRecorder) Recv() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockBeaconNodeValidator_StreamDutiesClient)(nil).Recv)) +} + +// RecvMsg mocks base method +func (m *MockBeaconNodeValidator_StreamDutiesClient) RecvMsg(arg0 interface{}) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RecvMsg", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// RecvMsg indicates an expected call of RecvMsg +func (mr *MockBeaconNodeValidator_StreamDutiesClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockBeaconNodeValidator_StreamDutiesClient)(nil).RecvMsg), arg0) +} + +// SendMsg mocks base method +func (m *MockBeaconNodeValidator_StreamDutiesClient) SendMsg(arg0 interface{}) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendMsg", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendMsg indicates an expected call of SendMsg +func (mr *MockBeaconNodeValidator_StreamDutiesClientMockRecorder) SendMsg(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockBeaconNodeValidator_StreamDutiesClient)(nil).SendMsg), arg0) +} + +// Trailer mocks base method +func (m *MockBeaconNodeValidator_StreamDutiesClient) Trailer() metadata.MD { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Trailer") + ret0, _ := ret[0].(metadata.MD) + return ret0 +} + +// Trailer indicates an expected call of Trailer +func (mr *MockBeaconNodeValidator_StreamDutiesClientMockRecorder) Trailer() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockBeaconNodeValidator_StreamDutiesClient)(nil).Trailer)) +}