Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty Committee Check in Submit Attestation #5672

Merged
merged 2 commits into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions validator/client/validator_attest.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ func (v *validator) SubmitAttestation(ctx context.Context, slot uint64, pubKey [
}
return
}
if len(duty.Committee) == 0 {
log.Debug("Empty committee for validator duty, not attesting")
return
}

v.waitToSlotOneThird(ctx, slot)

Expand Down
18 changes: 17 additions & 1 deletion validator/client/validator_attest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,23 @@ func TestRequestAttestation_ValidatorDutiesRequestFailure(t *testing.T) {
testutil.AssertLogsContain(t, hook, "Could not fetch validator assignment")
}

func TestAttestToBlockHead_SubmitAttestationRequestFailure(t *testing.T) {
func TestAttestToBlockHead_SubmitAttestation_EmptyCommittee(t *testing.T) {
hook := logTest.NewGlobal()

validator, _, finish := setup(t)
defer finish()
validator.duties = &ethpb.DutiesResponse{Duties: []*ethpb.DutiesResponse_Duty{
{
PublicKey: validatorKey.PublicKey.Marshal(),
CommitteeIndex: 0,
Committee: make([]uint64, 0),
ValidatorIndex: 0,
}}}
validator.SubmitAttestation(context.Background(), 0, validatorPubKey)
testutil.AssertLogsContain(t, hook, "Empty committee")
}

func TestAttestToBlockHead_SubmitAttestation_RequestFailure(t *testing.T) {
hook := logTest.NewGlobal()

validator, m, finish := setup(t)
Expand Down