Update EthereumAPIs to prysmaticlabs/ethereumapis#137 (#5622)

* Update EthereumAPIs to https://github.com/prysmaticlabs/ethereumapis/pull/137 and implement validator index return field
This commit is contained in:
Preston Van Loon 2020-04-25 13:23:36 -07:00 committed by GitHub
parent 5fbf38c98f
commit 8a9c9607a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 4 deletions

View File

@ -1305,7 +1305,7 @@ go_repository(
go_repository(
name = "com_github_prysmaticlabs_ethereumapis",
commit = "4685995df20b6d7a926fb98778c940e380db33ee",
commit = "1c66911b2ef3c1a290abb2156bcecb33ac32725f",
importpath = "github.com/prysmaticlabs/ethereumapis",
)

View File

@ -123,6 +123,7 @@ func (bs *Server) ListValidatorAssignments(
AttesterSlot: comAssignment.AttesterSlot,
ProposerSlots: proposerIndexToSlots[index],
PublicKey: pubkey[:],
ValidatorIndex: index,
}
res = append(res, assign)
}
@ -256,6 +257,7 @@ func (bs *Server) listValidatorAssignmentsUsingOldArchival(
AttesterSlot: comAssignment.AttesterSlot,
ProposerSlots: proposerIndexToSlots[index],
PublicKey: pubkey[:],
ValidatorIndex: index,
}
res = append(res, assign)
}

View File

@ -257,6 +257,7 @@ func TestServer_ListAssignments_Pagination_DefaultPageSize_NoArchive(t *testing.
AttesterSlot: committeeAssignments[index].AttesterSlot,
ProposerSlots: proposerIndexToSlots[index],
PublicKey: val.PublicKey,
ValidatorIndex: index,
})
}
if !reflect.DeepEqual(res.Assignments, wanted) {
@ -348,6 +349,7 @@ func TestServer_ListAssignments_Pagination_DefaultPageSize_FromArchive(t *testin
AttesterSlot: committeeAssignments[index].AttesterSlot,
ProposerSlots: proposerIndexToSlots[index],
PublicKey: val.PublicKey,
ValidatorIndex: index,
})
}
@ -437,6 +439,7 @@ func TestServer_ListAssignments_FilterPubkeysIndices_NoPagination(t *testing.T)
AttesterSlot: committeeAssignments[index].AttesterSlot,
ProposerSlots: proposerIndexToSlots[index],
PublicKey: val.PublicKey,
ValidatorIndex: index,
})
}
@ -520,6 +523,7 @@ func TestServer_ListAssignments_CanFilterPubkeysIndices_WithPagination(t *testin
AttesterSlot: committeeAssignments[index].AttesterSlot,
ProposerSlots: proposerIndexToSlots[index],
PublicKey: val.PublicKey,
ValidatorIndex: index,
})
}
@ -555,6 +559,7 @@ func TestServer_ListAssignments_CanFilterPubkeysIndices_WithPagination(t *testin
AttesterSlot: cAssignments[index].AttesterSlot,
ProposerSlots: proposerIndexToSlots[index],
PublicKey: val.PublicKey,
ValidatorIndex: index,
})
}

View File

@ -778,9 +778,11 @@ func (bs *Server) GetValidatorQueue(
}
return &ethpb.ValidatorQueue{
ChurnLimit: churnLimit,
ActivationPublicKeys: activationQueueKeys,
ExitPublicKeys: exitQueueKeys,
ChurnLimit: churnLimit,
ActivationPublicKeys: activationQueueKeys,
ExitPublicKeys: exitQueueKeys,
ActivationValidatorIndices: activationQ,
ExitValidatorIndices: exitQueueIndices,
}, nil
}

View File

@ -1434,6 +1434,10 @@ func TestServer_GetValidatorQueue_PendingActivation(t *testing.T) {
if !reflect.DeepEqual(res.ActivationPublicKeys, wanted) {
t.Errorf("Wanted %v, received %v", wanted, res.ActivationPublicKeys)
}
wantedActiveIndices := []uint64{2, 1, 0}
if !reflect.DeepEqual(res.ActivationValidatorIndices, wantedActiveIndices) {
t.Errorf("wanted %v, received %v", wantedActiveIndices, res.ActivationValidatorIndices)
}
}
func TestServer_GetValidatorQueue_ExitedValidatorLeavesQueue(t *testing.T) {
@ -1487,6 +1491,10 @@ func TestServer_GetValidatorQueue_ExitedValidatorLeavesQueue(t *testing.T) {
if !reflect.DeepEqual(res.ExitPublicKeys, wanted) {
t.Errorf("Wanted %v, received %v", wanted, res.ExitPublicKeys)
}
wantedExitIndices := []uint64{1}
if !reflect.DeepEqual(res.ExitValidatorIndices, wantedExitIndices) {
t.Errorf("wanted %v, received %v", wantedExitIndices, res.ExitValidatorIndices)
}
// Now, we move the state.slot past the exit epoch of the validator, and now
// the validator should no longer exist in the queue.