mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-11 20:20:05 +00:00
cleanup duties naming (#13451)
* updating some naming to reflect changes to duties * fixing unit tests * fixing more tests
This commit is contained in:
parent
5a2453ac9c
commit
4afb379f8d
beacon-chain/rpc/prysm/v1alpha1/validator
validator/client
@ -4,7 +4,7 @@ go_library(
|
|||||||
name = "go_default_library",
|
name = "go_default_library",
|
||||||
srcs = [
|
srcs = [
|
||||||
"aggregator.go",
|
"aggregator.go",
|
||||||
"assignments.go",
|
"duties.go",
|
||||||
"attester.go",
|
"attester.go",
|
||||||
"blocks.go",
|
"blocks.go",
|
||||||
"construct_generic_block.go",
|
"construct_generic_block.go",
|
||||||
@ -178,7 +178,7 @@ go_test(
|
|||||||
timeout = "moderate",
|
timeout = "moderate",
|
||||||
srcs = [
|
srcs = [
|
||||||
"aggregator_test.go",
|
"aggregator_test.go",
|
||||||
"assignments_test.go",
|
"duties_test.go",
|
||||||
"attester_test.go",
|
"attester_test.go",
|
||||||
"blocks_test.go",
|
"blocks_test.go",
|
||||||
"construct_generic_block_test.go",
|
"construct_generic_block_test.go",
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
func TestSubmitAggregateAndProof_GetDutiesRequestFailure(t *testing.T) {
|
func TestSubmitAggregateAndProof_GetDutiesRequestFailure(t *testing.T) {
|
||||||
hook := logTest.NewGlobal()
|
hook := logTest.NewGlobal()
|
||||||
validator, _, validatorKey, finish := setup(t)
|
validator, _, validatorKey, finish := setup(t)
|
||||||
validator.duties = ðpb.DutiesResponse{Duties: []*ethpb.DutiesResponse_Duty{}}
|
validator.duties = ðpb.DutiesResponse{CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{}}
|
||||||
defer finish()
|
defer finish()
|
||||||
|
|
||||||
var pubKey [fieldparams.BLSPubkeyLength]byte
|
var pubKey [fieldparams.BLSPubkeyLength]byte
|
||||||
@ -39,7 +39,7 @@ func TestSubmitAggregateAndProof_SignFails(t *testing.T) {
|
|||||||
var pubKey [fieldparams.BLSPubkeyLength]byte
|
var pubKey [fieldparams.BLSPubkeyLength]byte
|
||||||
copy(pubKey[:], validatorKey.PublicKey().Marshal())
|
copy(pubKey[:], validatorKey.PublicKey().Marshal())
|
||||||
validator.duties = ðpb.DutiesResponse{
|
validator.duties = ðpb.DutiesResponse{
|
||||||
Duties: []*ethpb.DutiesResponse_Duty{
|
CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
PublicKey: validatorKey.PublicKey().Marshal(),
|
PublicKey: validatorKey.PublicKey().Marshal(),
|
||||||
},
|
},
|
||||||
@ -78,7 +78,7 @@ func TestSubmitAggregateAndProof_Ok(t *testing.T) {
|
|||||||
var pubKey [fieldparams.BLSPubkeyLength]byte
|
var pubKey [fieldparams.BLSPubkeyLength]byte
|
||||||
copy(pubKey[:], validatorKey.PublicKey().Marshal())
|
copy(pubKey[:], validatorKey.PublicKey().Marshal())
|
||||||
validator.duties = ðpb.DutiesResponse{
|
validator.duties = ðpb.DutiesResponse{
|
||||||
Duties: []*ethpb.DutiesResponse_Duty{
|
CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
PublicKey: validatorKey.PublicKey().Marshal(),
|
PublicKey: validatorKey.PublicKey().Marshal(),
|
||||||
},
|
},
|
||||||
|
@ -187,7 +187,7 @@ func (v *validator) duty(pubKey [fieldparams.BLSPubkeyLength]byte) (*ethpb.Dutie
|
|||||||
return nil, errors.New("no duties for validators")
|
return nil, errors.New("no duties for validators")
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, duty := range v.duties.Duties {
|
for _, duty := range v.duties.CurrentEpochDuties {
|
||||||
if bytes.Equal(pubKey[:], duty.PublicKey) {
|
if bytes.Equal(pubKey[:], duty.PublicKey) {
|
||||||
return duty, nil
|
return duty, nil
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ import (
|
|||||||
func TestRequestAttestation_ValidatorDutiesRequestFailure(t *testing.T) {
|
func TestRequestAttestation_ValidatorDutiesRequestFailure(t *testing.T) {
|
||||||
hook := logTest.NewGlobal()
|
hook := logTest.NewGlobal()
|
||||||
validator, _, validatorKey, finish := setup(t)
|
validator, _, validatorKey, finish := setup(t)
|
||||||
validator.duties = ðpb.DutiesResponse{Duties: []*ethpb.DutiesResponse_Duty{}}
|
validator.duties = ðpb.DutiesResponse{CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{}}
|
||||||
defer finish()
|
defer finish()
|
||||||
|
|
||||||
var pubKey [fieldparams.BLSPubkeyLength]byte
|
var pubKey [fieldparams.BLSPubkeyLength]byte
|
||||||
@ -47,7 +47,7 @@ func TestAttestToBlockHead_SubmitAttestation_EmptyCommittee(t *testing.T) {
|
|||||||
defer finish()
|
defer finish()
|
||||||
var pubKey [fieldparams.BLSPubkeyLength]byte
|
var pubKey [fieldparams.BLSPubkeyLength]byte
|
||||||
copy(pubKey[:], validatorKey.PublicKey().Marshal())
|
copy(pubKey[:], validatorKey.PublicKey().Marshal())
|
||||||
validator.duties = ðpb.DutiesResponse{Duties: []*ethpb.DutiesResponse_Duty{
|
validator.duties = ðpb.DutiesResponse{CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
PublicKey: validatorKey.PublicKey().Marshal(),
|
PublicKey: validatorKey.PublicKey().Marshal(),
|
||||||
CommitteeIndex: 0,
|
CommitteeIndex: 0,
|
||||||
@ -63,7 +63,7 @@ func TestAttestToBlockHead_SubmitAttestation_RequestFailure(t *testing.T) {
|
|||||||
|
|
||||||
validator, m, validatorKey, finish := setup(t)
|
validator, m, validatorKey, finish := setup(t)
|
||||||
defer finish()
|
defer finish()
|
||||||
validator.duties = ðpb.DutiesResponse{Duties: []*ethpb.DutiesResponse_Duty{
|
validator.duties = ðpb.DutiesResponse{CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
PublicKey: validatorKey.PublicKey().Marshal(),
|
PublicKey: validatorKey.PublicKey().Marshal(),
|
||||||
CommitteeIndex: 5,
|
CommitteeIndex: 5,
|
||||||
@ -101,7 +101,7 @@ func TestAttestToBlockHead_AttestsCorrectly(t *testing.T) {
|
|||||||
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
||||||
var pubKey [fieldparams.BLSPubkeyLength]byte
|
var pubKey [fieldparams.BLSPubkeyLength]byte
|
||||||
copy(pubKey[:], validatorKey.PublicKey().Marshal())
|
copy(pubKey[:], validatorKey.PublicKey().Marshal())
|
||||||
validator.duties = ðpb.DutiesResponse{Duties: []*ethpb.DutiesResponse_Duty{
|
validator.duties = ðpb.DutiesResponse{CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
PublicKey: validatorKey.PublicKey().Marshal(),
|
PublicKey: validatorKey.PublicKey().Marshal(),
|
||||||
CommitteeIndex: 5,
|
CommitteeIndex: 5,
|
||||||
@ -174,7 +174,7 @@ func TestAttestToBlockHead_BlocksDoubleAtt(t *testing.T) {
|
|||||||
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
||||||
var pubKey [fieldparams.BLSPubkeyLength]byte
|
var pubKey [fieldparams.BLSPubkeyLength]byte
|
||||||
copy(pubKey[:], validatorKey.PublicKey().Marshal())
|
copy(pubKey[:], validatorKey.PublicKey().Marshal())
|
||||||
validator.duties = ðpb.DutiesResponse{Duties: []*ethpb.DutiesResponse_Duty{
|
validator.duties = ðpb.DutiesResponse{CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
PublicKey: validatorKey.PublicKey().Marshal(),
|
PublicKey: validatorKey.PublicKey().Marshal(),
|
||||||
CommitteeIndex: 5,
|
CommitteeIndex: 5,
|
||||||
@ -226,7 +226,7 @@ func TestAttestToBlockHead_BlocksSurroundAtt(t *testing.T) {
|
|||||||
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
||||||
var pubKey [fieldparams.BLSPubkeyLength]byte
|
var pubKey [fieldparams.BLSPubkeyLength]byte
|
||||||
copy(pubKey[:], validatorKey.PublicKey().Marshal())
|
copy(pubKey[:], validatorKey.PublicKey().Marshal())
|
||||||
validator.duties = ðpb.DutiesResponse{Duties: []*ethpb.DutiesResponse_Duty{
|
validator.duties = ðpb.DutiesResponse{CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
PublicKey: validatorKey.PublicKey().Marshal(),
|
PublicKey: validatorKey.PublicKey().Marshal(),
|
||||||
CommitteeIndex: 5,
|
CommitteeIndex: 5,
|
||||||
@ -278,7 +278,7 @@ func TestAttestToBlockHead_BlocksSurroundedAtt(t *testing.T) {
|
|||||||
var pubKey [fieldparams.BLSPubkeyLength]byte
|
var pubKey [fieldparams.BLSPubkeyLength]byte
|
||||||
copy(pubKey[:], validatorKey.PublicKey().Marshal())
|
copy(pubKey[:], validatorKey.PublicKey().Marshal())
|
||||||
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
||||||
validator.duties = ðpb.DutiesResponse{Duties: []*ethpb.DutiesResponse_Duty{
|
validator.duties = ðpb.DutiesResponse{CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
PublicKey: validatorKey.PublicKey().Marshal(),
|
PublicKey: validatorKey.PublicKey().Marshal(),
|
||||||
CommitteeIndex: 5,
|
CommitteeIndex: 5,
|
||||||
@ -365,7 +365,7 @@ func TestAttestToBlockHead_DoesAttestAfterDelay(t *testing.T) {
|
|||||||
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
||||||
var pubKey [fieldparams.BLSPubkeyLength]byte
|
var pubKey [fieldparams.BLSPubkeyLength]byte
|
||||||
copy(pubKey[:], validatorKey.PublicKey().Marshal())
|
copy(pubKey[:], validatorKey.PublicKey().Marshal())
|
||||||
validator.duties = ðpb.DutiesResponse{Duties: []*ethpb.DutiesResponse_Duty{
|
validator.duties = ðpb.DutiesResponse{CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
PublicKey: validatorKey.PublicKey().Marshal(),
|
PublicKey: validatorKey.PublicKey().Marshal(),
|
||||||
CommitteeIndex: 5,
|
CommitteeIndex: 5,
|
||||||
@ -404,7 +404,7 @@ func TestAttestToBlockHead_CorrectBitfieldLength(t *testing.T) {
|
|||||||
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
||||||
var pubKey [fieldparams.BLSPubkeyLength]byte
|
var pubKey [fieldparams.BLSPubkeyLength]byte
|
||||||
copy(pubKey[:], validatorKey.PublicKey().Marshal())
|
copy(pubKey[:], validatorKey.PublicKey().Marshal())
|
||||||
validator.duties = ðpb.DutiesResponse{Duties: []*ethpb.DutiesResponse_Duty{
|
validator.duties = ðpb.DutiesResponse{CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
PublicKey: validatorKey.PublicKey().Marshal(),
|
PublicKey: validatorKey.PublicKey().Marshal(),
|
||||||
CommitteeIndex: 5,
|
CommitteeIndex: 5,
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
func TestSubmitSyncCommitteeMessage_ValidatorDutiesRequestFailure(t *testing.T) {
|
func TestSubmitSyncCommitteeMessage_ValidatorDutiesRequestFailure(t *testing.T) {
|
||||||
hook := logTest.NewGlobal()
|
hook := logTest.NewGlobal()
|
||||||
validator, m, validatorKey, finish := setup(t)
|
validator, m, validatorKey, finish := setup(t)
|
||||||
validator.duties = ðpb.DutiesResponse{Duties: []*ethpb.DutiesResponse_Duty{}}
|
validator.duties = ðpb.DutiesResponse{CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{}}
|
||||||
defer finish()
|
defer finish()
|
||||||
|
|
||||||
m.validatorClient.EXPECT().GetSyncMessageBlockRoot(
|
m.validatorClient.EXPECT().GetSyncMessageBlockRoot(
|
||||||
@ -44,7 +44,7 @@ func TestSubmitSyncCommitteeMessage_BadDomainData(t *testing.T) {
|
|||||||
hook := logTest.NewGlobal()
|
hook := logTest.NewGlobal()
|
||||||
validatorIndex := primitives.ValidatorIndex(7)
|
validatorIndex := primitives.ValidatorIndex(7)
|
||||||
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
||||||
validator.duties = ðpb.DutiesResponse{Duties: []*ethpb.DutiesResponse_Duty{
|
validator.duties = ðpb.DutiesResponse{CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
PublicKey: validatorKey.PublicKey().Marshal(),
|
PublicKey: validatorKey.PublicKey().Marshal(),
|
||||||
Committee: committee,
|
Committee: committee,
|
||||||
@ -76,7 +76,7 @@ func TestSubmitSyncCommitteeMessage_CouldNotSubmit(t *testing.T) {
|
|||||||
hook := logTest.NewGlobal()
|
hook := logTest.NewGlobal()
|
||||||
validatorIndex := primitives.ValidatorIndex(7)
|
validatorIndex := primitives.ValidatorIndex(7)
|
||||||
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
||||||
validator.duties = ðpb.DutiesResponse{Duties: []*ethpb.DutiesResponse_Duty{
|
validator.duties = ðpb.DutiesResponse{CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
PublicKey: validatorKey.PublicKey().Marshal(),
|
PublicKey: validatorKey.PublicKey().Marshal(),
|
||||||
Committee: committee,
|
Committee: committee,
|
||||||
@ -117,7 +117,7 @@ func TestSubmitSyncCommitteeMessage_OK(t *testing.T) {
|
|||||||
hook := logTest.NewGlobal()
|
hook := logTest.NewGlobal()
|
||||||
validatorIndex := primitives.ValidatorIndex(7)
|
validatorIndex := primitives.ValidatorIndex(7)
|
||||||
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
||||||
validator.duties = ðpb.DutiesResponse{Duties: []*ethpb.DutiesResponse_Duty{
|
validator.duties = ðpb.DutiesResponse{CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
PublicKey: validatorKey.PublicKey().Marshal(),
|
PublicKey: validatorKey.PublicKey().Marshal(),
|
||||||
Committee: committee,
|
Committee: committee,
|
||||||
@ -161,7 +161,7 @@ func TestSubmitSyncCommitteeMessage_OK(t *testing.T) {
|
|||||||
func TestSubmitSignedContributionAndProof_ValidatorDutiesRequestFailure(t *testing.T) {
|
func TestSubmitSignedContributionAndProof_ValidatorDutiesRequestFailure(t *testing.T) {
|
||||||
hook := logTest.NewGlobal()
|
hook := logTest.NewGlobal()
|
||||||
validator, _, validatorKey, finish := setup(t)
|
validator, _, validatorKey, finish := setup(t)
|
||||||
validator.duties = ðpb.DutiesResponse{Duties: []*ethpb.DutiesResponse_Duty{}}
|
validator.duties = ðpb.DutiesResponse{CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{}}
|
||||||
defer finish()
|
defer finish()
|
||||||
|
|
||||||
var pubKey [fieldparams.BLSPubkeyLength]byte
|
var pubKey [fieldparams.BLSPubkeyLength]byte
|
||||||
@ -175,7 +175,7 @@ func TestSubmitSignedContributionAndProof_GetSyncSubcommitteeIndexFailure(t *tes
|
|||||||
validator, m, validatorKey, finish := setup(t)
|
validator, m, validatorKey, finish := setup(t)
|
||||||
validatorIndex := primitives.ValidatorIndex(7)
|
validatorIndex := primitives.ValidatorIndex(7)
|
||||||
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
||||||
validator.duties = ðpb.DutiesResponse{Duties: []*ethpb.DutiesResponse_Duty{
|
validator.duties = ðpb.DutiesResponse{CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
PublicKey: validatorKey.PublicKey().Marshal(),
|
PublicKey: validatorKey.PublicKey().Marshal(),
|
||||||
Committee: committee,
|
Committee: committee,
|
||||||
@ -203,7 +203,7 @@ func TestSubmitSignedContributionAndProof_NothingToDo(t *testing.T) {
|
|||||||
validator, m, validatorKey, finish := setup(t)
|
validator, m, validatorKey, finish := setup(t)
|
||||||
validatorIndex := primitives.ValidatorIndex(7)
|
validatorIndex := primitives.ValidatorIndex(7)
|
||||||
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
||||||
validator.duties = ðpb.DutiesResponse{Duties: []*ethpb.DutiesResponse_Duty{
|
validator.duties = ðpb.DutiesResponse{CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
PublicKey: validatorKey.PublicKey().Marshal(),
|
PublicKey: validatorKey.PublicKey().Marshal(),
|
||||||
Committee: committee,
|
Committee: committee,
|
||||||
@ -231,7 +231,7 @@ func TestSubmitSignedContributionAndProof_BadDomain(t *testing.T) {
|
|||||||
validator, m, validatorKey, finish := setup(t)
|
validator, m, validatorKey, finish := setup(t)
|
||||||
validatorIndex := primitives.ValidatorIndex(7)
|
validatorIndex := primitives.ValidatorIndex(7)
|
||||||
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
||||||
validator.duties = ðpb.DutiesResponse{Duties: []*ethpb.DutiesResponse_Duty{
|
validator.duties = ðpb.DutiesResponse{CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
PublicKey: validatorKey.PublicKey().Marshal(),
|
PublicKey: validatorKey.PublicKey().Marshal(),
|
||||||
Committee: committee,
|
Committee: committee,
|
||||||
@ -273,7 +273,7 @@ func TestSubmitSignedContributionAndProof_CouldNotGetContribution(t *testing.T)
|
|||||||
validator, m, validatorKey, finish := setupWithKey(t, validatorKey)
|
validator, m, validatorKey, finish := setupWithKey(t, validatorKey)
|
||||||
validatorIndex := primitives.ValidatorIndex(7)
|
validatorIndex := primitives.ValidatorIndex(7)
|
||||||
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
||||||
validator.duties = ðpb.DutiesResponse{Duties: []*ethpb.DutiesResponse_Duty{
|
validator.duties = ðpb.DutiesResponse{CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
PublicKey: validatorKey.PublicKey().Marshal(),
|
PublicKey: validatorKey.PublicKey().Marshal(),
|
||||||
Committee: committee,
|
Committee: committee,
|
||||||
@ -323,7 +323,7 @@ func TestSubmitSignedContributionAndProof_CouldNotSubmitContribution(t *testing.
|
|||||||
validator, m, validatorKey, finish := setupWithKey(t, validatorKey)
|
validator, m, validatorKey, finish := setupWithKey(t, validatorKey)
|
||||||
validatorIndex := primitives.ValidatorIndex(7)
|
validatorIndex := primitives.ValidatorIndex(7)
|
||||||
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
||||||
validator.duties = ðpb.DutiesResponse{Duties: []*ethpb.DutiesResponse_Duty{
|
validator.duties = ðpb.DutiesResponse{CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
PublicKey: validatorKey.PublicKey().Marshal(),
|
PublicKey: validatorKey.PublicKey().Marshal(),
|
||||||
Committee: committee,
|
Committee: committee,
|
||||||
@ -401,7 +401,7 @@ func TestSubmitSignedContributionAndProof_Ok(t *testing.T) {
|
|||||||
validator, m, validatorKey, finish := setupWithKey(t, validatorKey)
|
validator, m, validatorKey, finish := setupWithKey(t, validatorKey)
|
||||||
validatorIndex := primitives.ValidatorIndex(7)
|
validatorIndex := primitives.ValidatorIndex(7)
|
||||||
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
committee := []primitives.ValidatorIndex{0, 3, 4, 2, validatorIndex, 6, 8, 9, 10}
|
||||||
validator.duties = ðpb.DutiesResponse{Duties: []*ethpb.DutiesResponse_Duty{
|
validator.duties = ðpb.DutiesResponse{CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
PublicKey: validatorKey.PublicKey().Marshal(),
|
PublicKey: validatorKey.PublicKey().Marshal(),
|
||||||
Committee: committee,
|
Committee: committee,
|
||||||
|
@ -701,7 +701,7 @@ func (v *validator) RolesAt(ctx context.Context, slot primitives.Slot) (map[[fie
|
|||||||
v.dutiesLock.RLock()
|
v.dutiesLock.RLock()
|
||||||
defer v.dutiesLock.RUnlock()
|
defer v.dutiesLock.RUnlock()
|
||||||
rolesAt := make(map[[fieldparams.BLSPubkeyLength]byte][]iface.ValidatorRole)
|
rolesAt := make(map[[fieldparams.BLSPubkeyLength]byte][]iface.ValidatorRole)
|
||||||
for validator, duty := range v.duties.Duties {
|
for validator, duty := range v.duties.CurrentEpochDuties {
|
||||||
var roles []iface.ValidatorRole
|
var roles []iface.ValidatorRole
|
||||||
|
|
||||||
if duty == nil {
|
if duty == nil {
|
||||||
|
@ -456,7 +456,7 @@ func TestUpdateDuties_DoesNothingWhenNotEpochStart_AlreadyExistingAssignments(t
|
|||||||
v := validator{
|
v := validator{
|
||||||
validatorClient: client,
|
validatorClient: client,
|
||||||
duties: ðpb.DutiesResponse{
|
duties: ðpb.DutiesResponse{
|
||||||
Duties: []*ethpb.DutiesResponse_Duty{
|
CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
Committee: []primitives.ValidatorIndex{},
|
Committee: []primitives.ValidatorIndex{},
|
||||||
AttesterSlot: 10,
|
AttesterSlot: 10,
|
||||||
@ -482,7 +482,7 @@ func TestUpdateDuties_ReturnsError(t *testing.T) {
|
|||||||
validatorClient: client,
|
validatorClient: client,
|
||||||
keyManager: newMockKeymanager(t, randKeypair(t)),
|
keyManager: newMockKeymanager(t, randKeypair(t)),
|
||||||
duties: ðpb.DutiesResponse{
|
duties: ðpb.DutiesResponse{
|
||||||
Duties: []*ethpb.DutiesResponse_Duty{
|
CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
CommitteeIndex: 1,
|
CommitteeIndex: 1,
|
||||||
},
|
},
|
||||||
@ -508,7 +508,7 @@ func TestUpdateDuties_OK(t *testing.T) {
|
|||||||
|
|
||||||
slot := params.BeaconConfig().SlotsPerEpoch
|
slot := params.BeaconConfig().SlotsPerEpoch
|
||||||
resp := ðpb.DutiesResponse{
|
resp := ðpb.DutiesResponse{
|
||||||
Duties: []*ethpb.DutiesResponse_Duty{
|
CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
AttesterSlot: params.BeaconConfig().SlotsPerEpoch,
|
AttesterSlot: params.BeaconConfig().SlotsPerEpoch,
|
||||||
ValidatorIndex: 200,
|
ValidatorIndex: 200,
|
||||||
@ -544,10 +544,10 @@ func TestUpdateDuties_OK(t *testing.T) {
|
|||||||
|
|
||||||
util.WaitTimeout(&wg, 2*time.Second)
|
util.WaitTimeout(&wg, 2*time.Second)
|
||||||
|
|
||||||
assert.Equal(t, params.BeaconConfig().SlotsPerEpoch+1, v.duties.Duties[0].ProposerSlots[0], "Unexpected validator assignments")
|
assert.Equal(t, params.BeaconConfig().SlotsPerEpoch+1, v.duties.CurrentEpochDuties[0].ProposerSlots[0], "Unexpected validator assignments")
|
||||||
assert.Equal(t, params.BeaconConfig().SlotsPerEpoch, v.duties.Duties[0].AttesterSlot, "Unexpected validator assignments")
|
assert.Equal(t, params.BeaconConfig().SlotsPerEpoch, v.duties.CurrentEpochDuties[0].AttesterSlot, "Unexpected validator assignments")
|
||||||
assert.Equal(t, resp.Duties[0].CommitteeIndex, v.duties.Duties[0].CommitteeIndex, "Unexpected validator assignments")
|
assert.Equal(t, resp.CurrentEpochDuties[0].CommitteeIndex, v.duties.CurrentEpochDuties[0].CommitteeIndex, "Unexpected validator assignments")
|
||||||
assert.Equal(t, resp.Duties[0].ValidatorIndex, v.duties.Duties[0].ValidatorIndex, "Unexpected validator assignments")
|
assert.Equal(t, resp.CurrentEpochDuties[0].ValidatorIndex, v.duties.CurrentEpochDuties[0].ValidatorIndex, "Unexpected validator assignments")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUpdateDuties_OK_FilterBlacklistedPublicKeys(t *testing.T) {
|
func TestUpdateDuties_OK_FilterBlacklistedPublicKeys(t *testing.T) {
|
||||||
@ -570,7 +570,7 @@ func TestUpdateDuties_OK_FilterBlacklistedPublicKeys(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resp := ðpb.DutiesResponse{
|
resp := ðpb.DutiesResponse{
|
||||||
Duties: []*ethpb.DutiesResponse_Duty{},
|
CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{},
|
||||||
}
|
}
|
||||||
client.EXPECT().GetDuties(
|
client.EXPECT().GetDuties(
|
||||||
gomock.Any(),
|
gomock.Any(),
|
||||||
@ -644,7 +644,7 @@ func TestRolesAt_OK(t *testing.T) {
|
|||||||
defer finish()
|
defer finish()
|
||||||
|
|
||||||
v.duties = ðpb.DutiesResponse{
|
v.duties = ðpb.DutiesResponse{
|
||||||
Duties: []*ethpb.DutiesResponse_Duty{
|
CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
CommitteeIndex: 1,
|
CommitteeIndex: 1,
|
||||||
AttesterSlot: 1,
|
AttesterSlot: 1,
|
||||||
@ -684,7 +684,7 @@ func TestRolesAt_OK(t *testing.T) {
|
|||||||
|
|
||||||
// Test sync committee role at epoch boundary.
|
// Test sync committee role at epoch boundary.
|
||||||
v.duties = ðpb.DutiesResponse{
|
v.duties = ðpb.DutiesResponse{
|
||||||
Duties: []*ethpb.DutiesResponse_Duty{
|
CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
CommitteeIndex: 1,
|
CommitteeIndex: 1,
|
||||||
AttesterSlot: 1,
|
AttesterSlot: 1,
|
||||||
@ -720,7 +720,7 @@ func TestRolesAt_DoesNotAssignProposer_Slot0(t *testing.T) {
|
|||||||
defer finish()
|
defer finish()
|
||||||
|
|
||||||
v.duties = ðpb.DutiesResponse{
|
v.duties = ðpb.DutiesResponse{
|
||||||
Duties: []*ethpb.DutiesResponse_Duty{
|
CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
CommitteeIndex: 1,
|
CommitteeIndex: 1,
|
||||||
AttesterSlot: 0,
|
AttesterSlot: 0,
|
||||||
@ -847,7 +847,7 @@ func TestCheckAndLogValidatorStatus_OK(t *testing.T) {
|
|||||||
v := validator{
|
v := validator{
|
||||||
validatorClient: client,
|
validatorClient: client,
|
||||||
duties: ðpb.DutiesResponse{
|
duties: ðpb.DutiesResponse{
|
||||||
Duties: []*ethpb.DutiesResponse_Duty{
|
CurrentEpochDuties: []*ethpb.DutiesResponse_Duty{
|
||||||
{
|
{
|
||||||
CommitteeIndex: 1,
|
CommitteeIndex: 1,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user