From 0e1376d6c2fed700f5d6f38383fdd6fed8d15653 Mon Sep 17 00:00:00 2001 From: Terence Tsao Date: Fri, 20 Mar 2020 10:32:24 -0700 Subject: [PATCH 01/11] new patch --- ...thub_prysmaticlabs_ethereumapis-tags.patch | 65 +++++++++++++++---- 1 file changed, 52 insertions(+), 13 deletions(-) diff --git a/third_party/com_github_prysmaticlabs_ethereumapis-tags.patch b/third_party/com_github_prysmaticlabs_ethereumapis-tags.patch index 6bd7eaa2ad51..f521acd4676e 100644 --- a/third_party/com_github_prysmaticlabs_ethereumapis-tags.patch +++ b/third_party/com_github_prysmaticlabs_ethereumapis-tags.patch @@ -87,7 +87,7 @@ index c0fbe31..1211829 100644 protoc_gen_swagger( diff --git a/eth/v1alpha1/attestation.proto b/eth/v1alpha1/attestation.proto -index b177b76..28b4b46 100644 +index 3eee6f2..afbca04 100644 --- a/eth/v1alpha1/attestation.proto +++ b/eth/v1alpha1/attestation.proto @@ -15,6 +15,8 @@ syntax = "proto3"; @@ -122,8 +122,17 @@ index b177b76..28b4b46 100644 + bytes selection_proof = 2 [(gogoproto.moretags) = "ssz-size:\"96\""]; } + message SignedAggregateAttestationAndProof { +@@ -49,7 +51,7 @@ message SignedAggregateAttestationAndProof { + AggregateAttestationAndProof message = 1; + + // 96 byte BLS aggregate signature signed by the aggregator over the message. +- bytes signature = 2; ++ bytes signature = 2 [(gogoproto.moretags) = "ssz-size:\"96\""]; + } + message AttestationData { -@@ -55,7 +57,7 @@ message AttestationData { +@@ -63,7 +65,7 @@ message AttestationData { uint64 committee_index = 2; // 32 byte root of the LMD GHOST block vote. @@ -132,7 +141,7 @@ index b177b76..28b4b46 100644 // The most recent justified checkpoint in the beacon state Checkpoint source = 4; -@@ -91,5 +93,5 @@ message Checkpoint { +@@ -99,5 +101,5 @@ message Checkpoint { uint64 epoch = 1; // Block root of the checkpoint references. @@ -438,7 +447,7 @@ index 0099328..8b8c6eb 100644 // The epoch for which this set of validator assignments is valid. diff --git a/eth/v1alpha1/validator.proto b/eth/v1alpha1/validator.proto -index 47203c1..9e72b10 100644 +index c3a0926..8dcc8a4 100644 --- a/eth/v1alpha1/validator.proto +++ b/eth/v1alpha1/validator.proto @@ -15,6 +15,7 @@ syntax = "proto3"; @@ -449,7 +458,7 @@ index 47203c1..9e72b10 100644 import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; import "eth/v1alpha1/beacon_block.proto"; -@@ -191,7 +192,7 @@ message DomainResponse { +@@ -200,7 +201,7 @@ message DomainResponse { message ValidatorActivationRequest { // A list of 48 byte validator public keys. @@ -458,7 +467,7 @@ index 47203c1..9e72b10 100644 } message ValidatorActivationResponse { -@@ -217,7 +218,7 @@ message ChainStartResponse { +@@ -226,7 +227,7 @@ message ChainStartResponse { message ValidatorIndexRequest { // A 48 byte validator public key. @@ -467,7 +476,7 @@ index 47203c1..9e72b10 100644 } message ValidatorIndexResponse { -@@ -227,7 +228,7 @@ message ValidatorIndexResponse { +@@ -236,7 +237,7 @@ message ValidatorIndexResponse { message ValidatorStatusRequest { // A 48 byte validator public key. @@ -476,7 +485,7 @@ index 47203c1..9e72b10 100644 } enum ValidatorStatus { -@@ -265,7 +266,7 @@ message DutiesRequest { +@@ -274,7 +275,7 @@ message DutiesRequest { uint64 epoch = 1; // Array of byte encoded BLS public keys. @@ -485,7 +494,7 @@ index 47203c1..9e72b10 100644 } message DutiesResponse { -@@ -284,7 +285,7 @@ message DutiesResponse { +@@ -293,7 +294,7 @@ message DutiesResponse { uint64 proposer_slot = 4; // 48 byte BLS public key for the validator who's assigned to perform a duty. @@ -494,7 +503,7 @@ index 47203c1..9e72b10 100644 // The current status of the validator assigned to perform the duty. ValidatorStatus status = 6; -@@ -299,15 +300,16 @@ message BlockRequest { +@@ -308,15 +309,16 @@ message BlockRequest { uint64 slot = 1; // Validator's 32 byte randao reveal secret of the current epoch. @@ -514,7 +523,7 @@ index 47203c1..9e72b10 100644 } message AttestationDataRequest { -@@ -320,7 +322,7 @@ message AttestationDataRequest { +@@ -329,7 +331,7 @@ message AttestationDataRequest { message AttestResponse { // The root of the attestation data successfully submitted to the beacon node. @@ -522,8 +531,38 @@ index 47203c1..9e72b10 100644 + bytes attestation_data_root = 1 [(gogoproto.moretags) = "ssz-size:\"32\""]; } - message AggregationRequest { -@@ -343,10 +345,10 @@ message AggregationResponse { + message AggregateSelectionRequest { +@@ -338,35 +340,35 @@ message AggregateSelectionRequest { + // Committee index of the validator at the given slot. + uint64 committee_index = 2; + // 48 byte public key of the validator. +- bytes public_key = 3; ++ bytes public_key = 3 [(gogoproto.moretags) = "ssz-size:\"48\" spec-name:\"pubkey\""]; + // 96 byte signature of the validator on the slot. This is used as proof that the validator is + // an aggregator for the given slot. +- bytes slot_signature = 4; ++ bytes slot_signature = 4 [(gogoproto.moretags) = "ssz-size:\"96\""]; + } + + message AggregateSelectionResponse { + // The 32 byte signing root response from the aggregate and proof object. +- bytes signing_root = 1; ++ bytes signing_root = 1 [(gogoproto.moretags) = "ssz-size:\"32\""]; + } + + message AggregateSignatureRequest { + // The 96 byte signature of the validator signed over aggregate signing root. + // This proofs the aggregator had control over the aggregation object. +- bytes signature = 1; ++ bytes signature = 1 [(gogoproto.moretags) = "ssz-size:\"96\""]; + } + + message AggregateSignatureResponse { + // The 32 byte hash tree root of the aggregated attestation data. +- bytes attestation_data_root = 1; ++ bytes attestation_data_root = 1 [(gogoproto.moretags) = "ssz-size:\"32\""]; + } + // An Ethereum 2.0 validator. message Validator { // 48 byte BLS public key used for the validator's activities. From 28660ea222a857dab2a9aa26ab5707d375d57ee1 Mon Sep 17 00:00:00 2001 From: Terence Tsao Date: Fri, 20 Mar 2020 10:33:58 -0700 Subject: [PATCH 02/11] update workspace with new ethapi commit --- WORKSPACE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WORKSPACE b/WORKSPACE index 9979674f3e4b..af16b5fbb5bd 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1304,7 +1304,7 @@ go_repository( go_repository( name = "com_github_prysmaticlabs_ethereumapis", - commit = "c0970cf6aa0c0826b73047770e81617bd24a9ffe", + commit = "6763b61f5d63e394f89aab91d763ad608433f3e1", importpath = "github.com/prysmaticlabs/ethereumapis", patch_args = ["-p1"], patches = [ From c673831cc8730b2b4b6d68713ab771652bcfe5ab Mon Sep 17 00:00:00 2001 From: Terence Tsao Date: Fri, 20 Mar 2020 12:06:25 -0700 Subject: [PATCH 03/11] new patch --- beacon-chain/rpc/validator/aggregator.go | 9 +++--- ...thub_prysmaticlabs_ethereumapis-tags.patch | 32 +++++++------------ 2 files changed, 16 insertions(+), 25 deletions(-) diff --git a/beacon-chain/rpc/validator/aggregator.go b/beacon-chain/rpc/validator/aggregator.go index 36809b5fa6e2..cb783728d611 100644 --- a/beacon-chain/rpc/validator/aggregator.go +++ b/beacon-chain/rpc/validator/aggregator.go @@ -11,10 +11,11 @@ import ( "google.golang.org/grpc/status" ) -// SubmitAggregateAndProof is called by a validator when its assigned to be an aggregator. -// The beacon node will broadcast aggregated attestation and proof on the aggregator's behavior. -func (as *Server) SubmitAggregateAndProof(ctx context.Context, req *ethpb.AggregationRequest) (*ethpb.AggregationResponse, error) { - ctx, span := trace.StartSpan(ctx, "AggregatorServer.SubmitAggregation") +// SubmitAggregateSelectionProof is called by a validator when its assigned to be an aggregator. +// The aggregator submits the selection proof to obtain a signing root of the aggregated attestation +// object to sign over. +func (as *Server) SubmitAggregateSelectionProof(ctx context.Context, req *ethpb.AggregateSelectionRequest) (*ethpb.AggregateSelectionResponse, error) { + ctx, span := trace.StartSpan(ctx, "AggregatorServer.SubmitAggregateSelectionProof") defer span.End() span.AddAttributes(trace.Int64Attribute("slot", int64(req.Slot))) diff --git a/third_party/com_github_prysmaticlabs_ethereumapis-tags.patch b/third_party/com_github_prysmaticlabs_ethereumapis-tags.patch index f521acd4676e..fb12d59a17a3 100644 --- a/third_party/com_github_prysmaticlabs_ethereumapis-tags.patch +++ b/third_party/com_github_prysmaticlabs_ethereumapis-tags.patch @@ -447,7 +447,7 @@ index 0099328..8b8c6eb 100644 // The epoch for which this set of validator assignments is valid. diff --git a/eth/v1alpha1/validator.proto b/eth/v1alpha1/validator.proto -index c3a0926..8dcc8a4 100644 +index d92a47f..4962115 100644 --- a/eth/v1alpha1/validator.proto +++ b/eth/v1alpha1/validator.proto @@ -15,6 +15,7 @@ syntax = "proto3"; @@ -458,7 +458,7 @@ index c3a0926..8dcc8a4 100644 import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; import "eth/v1alpha1/beacon_block.proto"; -@@ -200,7 +201,7 @@ message DomainResponse { +@@ -197,7 +198,7 @@ message DomainResponse { message ValidatorActivationRequest { // A list of 48 byte validator public keys. @@ -467,7 +467,7 @@ index c3a0926..8dcc8a4 100644 } message ValidatorActivationResponse { -@@ -226,7 +227,7 @@ message ChainStartResponse { +@@ -223,7 +224,7 @@ message ChainStartResponse { message ValidatorIndexRequest { // A 48 byte validator public key. @@ -476,7 +476,7 @@ index c3a0926..8dcc8a4 100644 } message ValidatorIndexResponse { -@@ -236,7 +237,7 @@ message ValidatorIndexResponse { +@@ -233,7 +234,7 @@ message ValidatorIndexResponse { message ValidatorStatusRequest { // A 48 byte validator public key. @@ -485,7 +485,7 @@ index c3a0926..8dcc8a4 100644 } enum ValidatorStatus { -@@ -274,7 +275,7 @@ message DutiesRequest { +@@ -271,7 +272,7 @@ message DutiesRequest { uint64 epoch = 1; // Array of byte encoded BLS public keys. @@ -494,7 +494,7 @@ index c3a0926..8dcc8a4 100644 } message DutiesResponse { -@@ -293,7 +294,7 @@ message DutiesResponse { +@@ -290,7 +291,7 @@ message DutiesResponse { uint64 proposer_slot = 4; // 48 byte BLS public key for the validator who's assigned to perform a duty. @@ -503,7 +503,7 @@ index c3a0926..8dcc8a4 100644 // The current status of the validator assigned to perform the duty. ValidatorStatus status = 6; -@@ -308,15 +309,16 @@ message BlockRequest { +@@ -305,15 +306,16 @@ message BlockRequest { uint64 slot = 1; // Validator's 32 byte randao reveal secret of the current epoch. @@ -523,7 +523,7 @@ index c3a0926..8dcc8a4 100644 } message AttestationDataRequest { -@@ -329,7 +331,7 @@ message AttestationDataRequest { +@@ -326,7 +328,7 @@ message AttestationDataRequest { message AttestResponse { // The root of the attestation data successfully submitted to the beacon node. @@ -532,7 +532,7 @@ index c3a0926..8dcc8a4 100644 } message AggregateSelectionRequest { -@@ -338,35 +340,35 @@ message AggregateSelectionRequest { +@@ -335,10 +337,10 @@ message AggregateSelectionRequest { // Committee index of the validator at the given slot. uint64 committee_index = 2; // 48 byte public key of the validator. @@ -545,19 +545,9 @@ index c3a0926..8dcc8a4 100644 } message AggregateSelectionResponse { - // The 32 byte signing root response from the aggregate and proof object. -- bytes signing_root = 1; -+ bytes signing_root = 1 [(gogoproto.moretags) = "ssz-size:\"32\""]; - } - - message AggregateSignatureRequest { - // The 96 byte signature of the validator signed over aggregate signing root. - // This proofs the aggregator had control over the aggregation object. -- bytes signature = 1; -+ bytes signature = 1 [(gogoproto.moretags) = "ssz-size:\"96\""]; - } +@@ -353,16 +355,16 @@ message AggregateSubmitRequest { - message AggregateSignatureResponse { + message AggregateSubmitResponse { // The 32 byte hash tree root of the aggregated attestation data. - bytes attestation_data_root = 1; + bytes attestation_data_root = 1 [(gogoproto.moretags) = "ssz-size:\"32\""]; From cf75b8d045e020ac5f960f5cf82f7c9e1f9a6547 Mon Sep 17 00:00:00 2001 From: Terence Tsao Date: Fri, 20 Mar 2020 12:25:15 -0700 Subject: [PATCH 04/11] Update SubmitAggregateSelectionProof --- WORKSPACE | 2 +- beacon-chain/rpc/validator/aggregator.go | 34 +++++++++--------------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index af16b5fbb5bd..709ff59b1869 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1304,7 +1304,7 @@ go_repository( go_repository( name = "com_github_prysmaticlabs_ethereumapis", - commit = "6763b61f5d63e394f89aab91d763ad608433f3e1", + commit = "370a4d7b706016e2aa318334fa2cd0f465447d8d", importpath = "github.com/prysmaticlabs/ethereumapis", patch_args = ["-p1"], patches = [ diff --git a/beacon-chain/rpc/validator/aggregator.go b/beacon-chain/rpc/validator/aggregator.go index cb783728d611..18578f24069a 100644 --- a/beacon-chain/rpc/validator/aggregator.go +++ b/beacon-chain/rpc/validator/aggregator.go @@ -5,14 +5,13 @@ import ( ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" - "github.com/sirupsen/logrus" "go.opencensus.io/trace" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) // SubmitAggregateSelectionProof is called by a validator when its assigned to be an aggregator. -// The aggregator submits the selection proof to obtain a signing root of the aggregated attestation +// The aggregator submits the selection proof to obtain the aggregated attestation // object to sign over. func (as *Server) SubmitAggregateSelectionProof(ctx context.Context, req *ethpb.AggregateSelectionRequest) (*ethpb.AggregateSelectionResponse, error) { ctx, span := trace.StartSpan(ctx, "AggregatorServer.SubmitAggregateSelectionProof") @@ -57,27 +56,18 @@ func (as *Server) SubmitAggregateSelectionProof(ctx context.Context, req *ethpb. // Retrieve the unaggregated attestation from pool. aggregatedAtts := as.AttPool.AggregatedAttestationsBySlotIndex(req.Slot, req.CommitteeIndex) - for _, aggregatedAtt := range aggregatedAtts { - if ctx.Err() != nil { - return nil, ctx.Err() - } - if helpers.IsAggregated(aggregatedAtt) { - if err := as.P2P.Broadcast(ctx, ðpb.AggregateAttestationAndProof{ - AggregatorIndex: validatorIndex, - SelectionProof: req.SlotSignature, - Aggregate: aggregatedAtt, - }); err != nil { - return nil, status.Errorf(codes.Internal, "Could not broadcast aggregated attestation: %v", err) - } - - log.WithFields(logrus.Fields{ - "slot": req.Slot, - "committeeIndex": req.CommitteeIndex, - "validatorIndex": validatorIndex, - "aggregatedCount": aggregatedAtt.AggregationBits.Count(), - }).Debug("Broadcasting aggregated attestation and proof") + // Filter out the best aggregated attestation (ie. the one with the most aggregated bits). + best := aggregatedAtts[0] + for _, aggregatedAtt := range aggregatedAtts[1:] { + if aggregatedAtt.AggregationBits.Count() > best.AggregationBits.Count() { + best = aggregatedAtt } } - return ðpb.AggregationResponse{}, nil + a := ðpb.AggregateAttestationAndProof{ + Aggregate: best, + SelectionProof: req.SlotSignature, + AggregatorIndex: validatorIndex, + } + return ðpb.AggregateSelectionResponse{Aggregate: a}, nil } From 88f17276b7f889d41d333b618dbc44378fd45391 Mon Sep 17 00:00:00 2001 From: Terence Tsao Date: Fri, 20 Mar 2020 12:48:19 -0700 Subject: [PATCH 05/11] RPC side is done --- WORKSPACE | 2 +- beacon-chain/rpc/validator/aggregator.go | 18 ++++++++++++++++++ ...ithub_prysmaticlabs_ethereumapis-tags.patch | 6 +++--- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 709ff59b1869..822bf623f6d5 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1304,7 +1304,7 @@ go_repository( go_repository( name = "com_github_prysmaticlabs_ethereumapis", - commit = "370a4d7b706016e2aa318334fa2cd0f465447d8d", + commit = "aae6bf3b3452f7aa4e8f5a88a3ba31c67c0fc7e4", importpath = "github.com/prysmaticlabs/ethereumapis", patch_args = ["-p1"], patches = [ diff --git a/beacon-chain/rpc/validator/aggregator.go b/beacon-chain/rpc/validator/aggregator.go index 18578f24069a..5e8f7595066a 100644 --- a/beacon-chain/rpc/validator/aggregator.go +++ b/beacon-chain/rpc/validator/aggregator.go @@ -2,6 +2,7 @@ package validator import ( "context" + "github.com/sirupsen/logrus" ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" @@ -71,3 +72,20 @@ func (as *Server) SubmitAggregateSelectionProof(ctx context.Context, req *ethpb. } return ðpb.AggregateSelectionResponse{Aggregate: a}, nil } + +// SubmitSignedAggregateSelectionProof is called by a validator to broadcast a signed +// aggregated and proof object. +func (as *Server) SubmitSignedAggregateSelectionProof(ctx context.Context, req *ethpb.SignedAggregateSubmitRequest) (*ethpb.SignedAggregateSubmitResponse, error) { + if err := as.P2P.Broadcast(ctx, req.Aggregate); err != nil { + return nil, status.Errorf(codes.Internal, "Could not broadcast signed aggregated attestation: %v", err) + } + + log.WithFields(logrus.Fields{ + "slot": req.Aggregate.Message.Aggregate.Data.Slot, + "committeeIndex": req.Aggregate.Message.Aggregate.Data.CommitteeIndex, + "validatorIndex": req.Aggregate.Message.AggregatorIndex, + "aggregatedCount": req.Aggregate.Message.Aggregate.AggregationBits.Count(), + }).Debug("Broadcasting aggregated attestation and proof") + + return ðpb.SignedAggregateSubmitResponse{}, nil +} diff --git a/third_party/com_github_prysmaticlabs_ethereumapis-tags.patch b/third_party/com_github_prysmaticlabs_ethereumapis-tags.patch index fb12d59a17a3..131656fc2d5e 100644 --- a/third_party/com_github_prysmaticlabs_ethereumapis-tags.patch +++ b/third_party/com_github_prysmaticlabs_ethereumapis-tags.patch @@ -447,7 +447,7 @@ index 0099328..8b8c6eb 100644 // The epoch for which this set of validator assignments is valid. diff --git a/eth/v1alpha1/validator.proto b/eth/v1alpha1/validator.proto -index d92a47f..4962115 100644 +index 068a04c..80f73b8 100644 --- a/eth/v1alpha1/validator.proto +++ b/eth/v1alpha1/validator.proto @@ -15,6 +15,7 @@ syntax = "proto3"; @@ -545,9 +545,9 @@ index d92a47f..4962115 100644 } message AggregateSelectionResponse { -@@ -353,16 +355,16 @@ message AggregateSubmitRequest { +@@ -353,16 +355,16 @@ message SignedAggregateSubmitRequest { - message AggregateSubmitResponse { + message SignedAggregateSubmitResponse { // The 32 byte hash tree root of the aggregated attestation data. - bytes attestation_data_root = 1; + bytes attestation_data_root = 1 [(gogoproto.moretags) = "ssz-size:\"32\""]; From 71f4d7d2d5473f247db70ef033a0cf01b4a67947 Mon Sep 17 00:00:00 2001 From: Terence Tsao Date: Fri, 20 Mar 2020 13:08:38 -0700 Subject: [PATCH 06/11] Update configs with new domains --- shared/params/config.go | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/shared/params/config.go b/shared/params/config.go index 9b237f876a5d..a9cb0183dbee 100644 --- a/shared/params/config.go +++ b/shared/params/config.go @@ -76,11 +76,13 @@ type BeaconChainConfig struct { MaxVoluntaryExits uint64 `yaml:"MAX_VOLUNTARY_EXITS"` // MaxVoluntaryExits defines the maximum number of validator exits in a block. // BLS domain values. - DomainBeaconProposer [4]byte `yaml:"DOMAIN_BEACON_PROPOSER"` // DomainBeaconProposer defines the BLS signature domain for beacon proposal verification. - DomainRandao [4]byte `yaml:"DOMAIN_RANDAO"` // DomainRandao defines the BLS signature domain for randao verification. - DomainBeaconAttester [4]byte `yaml:"DOMAIN_ATTESTATION"` // DomainBeaconAttester defines the BLS signature domain for attestation verification. - DomainDeposit [4]byte `yaml:"DOMAIN_DEPOSIT"` // DomainDeposit defines the BLS signature domain for deposit verification. - DomainVoluntaryExit [4]byte `yaml:"DOMAIN_VOLUNTARY_EXIT"` // DomainVoluntaryExit defines the BLS signature domain for exit verification. + DomainBeaconProposer [4]byte `yaml:"DOMAIN_BEACON_PROPOSER"` // DomainBeaconProposer defines the BLS signature domain for beacon proposal verification. + DomainRandao [4]byte `yaml:"DOMAIN_RANDAO"` // DomainRandao defines the BLS signature domain for randao verification. + DomainBeaconAttester [4]byte `yaml:"DOMAIN_ATTESTATION"` // DomainBeaconAttester defines the BLS signature domain for attestation verification. + DomainDeposit [4]byte `yaml:"DOMAIN_DEPOSIT"` // DomainDeposit defines the BLS signature domain for deposit verification. + DomainVoluntaryExit [4]byte `yaml:"DOMAIN_VOLUNTARY_EXIT"` // DomainVoluntaryExit defines the BLS signature domain for exit verification. + DomainSelectionProof [4]byte `yaml:"DOMAIN_SELECTION_PROOF"` // DomainVoluntaryExit defines the BLS signature domain for selection proof. + DomainAggregateAndProof [4]byte `yaml:"DOMAIN_AGGREGATE_AND_PROOF"` // DomainVoluntaryExit defines the BLS signature domain for aggregate and proof. // Prysm constants. GweiPerEth uint64 // GweiPerEth is the amount of gwei corresponding to 1 eth. @@ -171,11 +173,13 @@ var defaultBeaconConfig = &BeaconChainConfig{ MaxVoluntaryExits: 16, // BLS domain values. - DomainBeaconProposer: bytesutil.ToBytes4(bytesutil.Bytes4(0)), - DomainBeaconAttester: bytesutil.ToBytes4(bytesutil.Bytes4(1)), - DomainRandao: bytesutil.ToBytes4(bytesutil.Bytes4(2)), - DomainDeposit: bytesutil.ToBytes4(bytesutil.Bytes4(3)), - DomainVoluntaryExit: bytesutil.ToBytes4(bytesutil.Bytes4(4)), + DomainBeaconProposer: bytesutil.ToBytes4(bytesutil.Bytes4(0)), + DomainBeaconAttester: bytesutil.ToBytes4(bytesutil.Bytes4(1)), + DomainRandao: bytesutil.ToBytes4(bytesutil.Bytes4(2)), + DomainDeposit: bytesutil.ToBytes4(bytesutil.Bytes4(3)), + DomainVoluntaryExit: bytesutil.ToBytes4(bytesutil.Bytes4(4)), + DomainSelectionProof: bytesutil.ToBytes4(bytesutil.Bytes4(5)), + DomainAggregateAndProof: bytesutil.ToBytes4(bytesutil.Bytes4(6)), // Prysm constants. GweiPerEth: 1000000000, From b18c60cf0ee2c9ce602de98d95c2f7c409484431 Mon Sep 17 00:00:00 2001 From: Terence Tsao Date: Fri, 20 Mar 2020 13:08:44 -0700 Subject: [PATCH 07/11] Update validator aggregate --- validator/client/validator_aggregate.go | 28 ++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/validator/client/validator_aggregate.go b/validator/client/validator_aggregate.go index 58dfd223155e..25861c9d662b 100644 --- a/validator/client/validator_aggregate.go +++ b/validator/client/validator_aggregate.go @@ -73,7 +73,7 @@ func (v *validator) SubmitAggregateAndProof(ctx context.Context, slot uint64, pu // https://github.com/ethereum/eth2.0-specs/blob/v0.9.3/specs/validator/0_beacon-chain-validator.md#broadcast-aggregate v.waitToSlotTwoThirds(ctx, slot) - _, err = v.validatorClient.SubmitAggregateAndProof(ctx, ðpb.AggregationRequest{ + res, err := v.validatorClient.SubmitAggregateSelectionProof(ctx, ðpb.AggregateSelectionRequest{ Slot: slot, CommitteeIndex: duty.CommitteeIndex, PublicKey: pubKey[:], @@ -87,6 +87,32 @@ func (v *validator) SubmitAggregateAndProof(ctx context.Context, slot uint64, pu return } + + d, err := v.domainData(ctx, helpers.SlotToEpoch(res.AggregateAndProof.Aggregate.Data.Slot), params.BeaconConfig().DomainAggregateAndProof[:]) + if err != nil { + log.Errorf("Could not get domain data to sign aggregate and proof: %v", err) + return + } + signedRoot, err := helpers.ComputeSigningRoot(res.AggregateAndProof, d.SignatureDomain) + if err != nil { + log.Errorf("Could not compute sign root for aggregate and proof: %v", err) + return + } + + _, err = v.validatorClient.SubmitSignedAggregateSelectionProof(ctx, ðpb.SignedAggregateSubmitRequest{ + SignedAggregateAndProof: ðpb.SignedAggregateAttestationAndProof{ + Message: res.AggregateAndProof, + Signature: signedRoot[:], + }, + }) + if err != nil { + log.Errorf("Could not submit signed aggregate and proof to beacon node: %v", err) + if v.emitAccountMetrics { + validatorAggFailVec.WithLabelValues(fmtKey).Inc() + } + return + } + if err := v.addIndicesToLog(duty); err != nil { log.Errorf("Could not add aggregator indices to logs: %v", err) if v.emitAccountMetrics { From 9dad4df14f2f2ed3ba766a670e43593ae0f13aad Mon Sep 17 00:00:00 2001 From: Terence Tsao Date: Fri, 20 Mar 2020 14:22:21 -0700 Subject: [PATCH 08/11] Fixed rpc tests --- beacon-chain/rpc/aggregator/server.go | 6 +- beacon-chain/rpc/validator/aggregator.go | 15 +- beacon-chain/rpc/validator/aggregator_test.go | 43 +- shared/mock/validator_service_mock.go | 477 ++++++++++++++++++ 4 files changed, 506 insertions(+), 35 deletions(-) create mode 100644 shared/mock/validator_service_mock.go diff --git a/beacon-chain/rpc/aggregator/server.go b/beacon-chain/rpc/aggregator/server.go index 96666f2365ee..8bbd8cbfae42 100644 --- a/beacon-chain/rpc/aggregator/server.go +++ b/beacon-chain/rpc/aggregator/server.go @@ -24,7 +24,7 @@ func (as *Server) SubmitAggregateAndProof(ctx context.Context, req *pb.Aggregati defer span.End() span.AddAttributes(trace.Int64Attribute("slot", int64(req.Slot))) - request := ðpb.AggregationRequest{ + request := ðpb.AggregateSelectionRequest{ Slot: req.Slot, CommitteeIndex: req.CommitteeIndex, PublicKey: req.PublicKey, @@ -32,9 +32,9 @@ func (as *Server) SubmitAggregateAndProof(ctx context.Context, req *pb.Aggregati } // Passthrough request to non-deprecated method. - res, err := as.ValidatorServer.SubmitAggregateAndProof(ctx, request) + _, err := as.ValidatorServer.SubmitAggregateSelectionProof(ctx, request) if err != nil { return nil, err } - return &pb.AggregationResponse{Root: res.AttestationDataRoot}, nil + return &pb.AggregationResponse{}, nil } diff --git a/beacon-chain/rpc/validator/aggregator.go b/beacon-chain/rpc/validator/aggregator.go index 5e8f7595066a..799d4e6df6c3 100644 --- a/beacon-chain/rpc/validator/aggregator.go +++ b/beacon-chain/rpc/validator/aggregator.go @@ -58,6 +58,9 @@ func (as *Server) SubmitAggregateSelectionProof(ctx context.Context, req *ethpb. aggregatedAtts := as.AttPool.AggregatedAttestationsBySlotIndex(req.Slot, req.CommitteeIndex) // Filter out the best aggregated attestation (ie. the one with the most aggregated bits). + if len(aggregatedAtts) == 0 { + return nil, status.Error(codes.Internal, "No aggregated attestation in beacon node") + } best := aggregatedAtts[0] for _, aggregatedAtt := range aggregatedAtts[1:] { if aggregatedAtt.AggregationBits.Count() > best.AggregationBits.Count() { @@ -70,21 +73,21 @@ func (as *Server) SubmitAggregateSelectionProof(ctx context.Context, req *ethpb. SelectionProof: req.SlotSignature, AggregatorIndex: validatorIndex, } - return ðpb.AggregateSelectionResponse{Aggregate: a}, nil + return ðpb.AggregateSelectionResponse{AggregateAndProof: a}, nil } // SubmitSignedAggregateSelectionProof is called by a validator to broadcast a signed // aggregated and proof object. func (as *Server) SubmitSignedAggregateSelectionProof(ctx context.Context, req *ethpb.SignedAggregateSubmitRequest) (*ethpb.SignedAggregateSubmitResponse, error) { - if err := as.P2P.Broadcast(ctx, req.Aggregate); err != nil { + if err := as.P2P.Broadcast(ctx, req.SignedAggregateAndProof); err != nil { return nil, status.Errorf(codes.Internal, "Could not broadcast signed aggregated attestation: %v", err) } log.WithFields(logrus.Fields{ - "slot": req.Aggregate.Message.Aggregate.Data.Slot, - "committeeIndex": req.Aggregate.Message.Aggregate.Data.CommitteeIndex, - "validatorIndex": req.Aggregate.Message.AggregatorIndex, - "aggregatedCount": req.Aggregate.Message.Aggregate.AggregationBits.Count(), + "slot": req.SignedAggregateAndProof.Message.Aggregate.Data.Slot, + "committeeIndex": req.SignedAggregateAndProof.Message.Aggregate.Data.CommitteeIndex, + "validatorIndex": req.SignedAggregateAndProof.Message.AggregatorIndex, + "aggregatedCount": req.SignedAggregateAndProof.Message.Aggregate.AggregationBits.Count(), }).Debug("Broadcasting aggregated attestation and proof") return ðpb.SignedAggregateSubmitResponse{}, nil diff --git a/beacon-chain/rpc/validator/aggregator_test.go b/beacon-chain/rpc/validator/aggregator_test.go index 8b932a3bc562..183eaaaf5428 100644 --- a/beacon-chain/rpc/validator/aggregator_test.go +++ b/beacon-chain/rpc/validator/aggregator_test.go @@ -40,9 +40,9 @@ func TestSubmitAggregateAndProof_Syncing(t *testing.T) { BeaconDB: db, } - req := ðpb.AggregationRequest{CommitteeIndex: 1} + req := ðpb.AggregateSelectionRequest{CommitteeIndex: 1} wanted := "Syncing to latest head, not ready to respond" - if _, err := aggregatorServer.SubmitAggregateAndProof(ctx, req); !strings.Contains(err.Error(), wanted) { + if _, err := aggregatorServer.SubmitAggregateSelectionProof(ctx, req); !strings.Contains(err.Error(), wanted) { t.Error("Did not receive wanted error") } } @@ -64,14 +64,14 @@ func TestSubmitAggregateAndProof_CantFindValidatorIndex(t *testing.T) { priv := bls.RandKey() sig := priv.Sign([]byte{'A'}) - req := ðpb.AggregationRequest{CommitteeIndex: 1, SlotSignature: sig.Marshal(), PublicKey: pubKey(3)} + req := ðpb.AggregateSelectionRequest{CommitteeIndex: 1, SlotSignature: sig.Marshal(), PublicKey: pubKey(3)} wanted := "Could not locate validator index in DB" - if _, err := server.SubmitAggregateAndProof(ctx, req); !strings.Contains(err.Error(), wanted) { + if _, err := server.SubmitAggregateSelectionProof(ctx, req); !strings.Contains(err.Error(), wanted) { t.Errorf("Did not receive wanted error: expected %v, received %v", wanted, err.Error()) } } -func TestSubmitAggregateAndProof_IsAggregator(t *testing.T) { +func TestSubmitAggregateAndProof_IsAggregatorAndNoAtts(t *testing.T) { db := dbutil.SetupDB(t) defer dbutil.TeardownDB(t, db) ctx := context.Background() @@ -90,13 +90,13 @@ func TestSubmitAggregateAndProof_IsAggregator(t *testing.T) { priv := bls.RandKey() sig := priv.Sign([]byte{'A'}) pubKey := pubKey(1) - req := ðpb.AggregationRequest{CommitteeIndex: 1, SlotSignature: sig.Marshal(), PublicKey: pubKey} + req := ðpb.AggregateSelectionRequest{CommitteeIndex: 1, SlotSignature: sig.Marshal(), PublicKey: pubKey} if err := db.SaveValidatorIndex(ctx, pubKey, 100); err != nil { t.Fatal(err) } - if _, err := server.SubmitAggregateAndProof(ctx, req); err != nil { - t.Fatal(err) + if _, err := server.SubmitAggregateSelectionProof(ctx, req); !strings.Contains(err.Error(),"No aggregated attestation in beacon node") { + t.Error("Did not get wanted error") } } @@ -116,7 +116,7 @@ func TestSubmitAggregateAndProof_AggregateOk(t *testing.T) { if err != nil { t.Fatal(err) } - att1, err := generateAtt(beaconState, 1, privKeys) + att1, err := generateAtt(beaconState, 2, privKeys) if err != nil { t.Fatal(err) } @@ -134,19 +134,19 @@ func TestSubmitAggregateAndProof_AggregateOk(t *testing.T) { priv := bls.RandKey() sig := priv.Sign([]byte{'B'}) pubKey := pubKey(2) - req := ðpb.AggregationRequest{CommitteeIndex: 1, SlotSignature: sig.Marshal(), PublicKey: pubKey} + req := ðpb.AggregateSelectionRequest{CommitteeIndex: 1, SlotSignature: sig.Marshal(), PublicKey: pubKey} if err := db.SaveValidatorIndex(ctx, pubKey, 100); err != nil { t.Fatal(err) } - if err := aggregatorServer.AttPool.SaveUnaggregatedAttestation(att0); err != nil { + if err := aggregatorServer.AttPool.SaveAggregatedAttestation(att0); err != nil { t.Fatal(err) } - if err := aggregatorServer.AttPool.SaveUnaggregatedAttestation(att1); err != nil { + if err := aggregatorServer.AttPool.SaveAggregatedAttestation(att1); err != nil { t.Fatal(err) } - if _, err := aggregatorServer.SubmitAggregateAndProof(ctx, req); err != nil { + if _, err := aggregatorServer.SubmitAggregateSelectionProof(ctx, req); err != nil { t.Fatal(err) } @@ -171,11 +171,7 @@ func TestSubmitAggregateAndProof_AggregateNotOk(t *testing.T) { defer dbutil.TeardownDB(t, db) ctx := context.Background() - beaconState, privKeys := testutil.DeterministicGenesisState(t, 32) - att0, err := generateAtt(beaconState, 0, privKeys) - if err != nil { - t.Fatal(err) - } + beaconState, _ := testutil.DeterministicGenesisState(t, 32) beaconState.SetSlot(beaconState.Slot() + params.BeaconConfig().MinAttestationInclusionDelay) aggregatorServer := &Server{ @@ -189,18 +185,12 @@ func TestSubmitAggregateAndProof_AggregateNotOk(t *testing.T) { priv := bls.RandKey() sig := priv.Sign([]byte{'B'}) pubKey := pubKey(2) - req := ðpb.AggregationRequest{CommitteeIndex: 1, SlotSignature: sig.Marshal(), PublicKey: pubKey} + req := ðpb.AggregateSelectionRequest{CommitteeIndex: 1, SlotSignature: sig.Marshal(), PublicKey: pubKey} if err := db.SaveValidatorIndex(ctx, pubKey, 100); err != nil { t.Fatal(err) } - if err := aggregatorServer.AttPool.SaveUnaggregatedAttestation(att0); err != nil { - t.Fatal(err) - } - - if _, err := aggregatorServer.SubmitAggregateAndProof(ctx, req); err != nil { - t.Fatal(err) - } + aggregatorServer.SubmitAggregateSelectionProof(ctx, req) aggregatedAtts := aggregatorServer.AttPool.AggregatedAttestations() if len(aggregatedAtts) != 0 { @@ -211,6 +201,7 @@ func TestSubmitAggregateAndProof_AggregateNotOk(t *testing.T) { func generateAtt(state *beaconstate.BeaconState, index uint64, privKeys []*bls.SecretKey) (*ethpb.Attestation, error) { aggBits := bitfield.NewBitlist(4) aggBits.SetBitAt(index, true) + aggBits.SetBitAt(index+1, true) att := ðpb.Attestation{ Data: ðpb.AttestationData{ CommitteeIndex: 1, diff --git a/shared/mock/validator_service_mock.go b/shared/mock/validator_service_mock.go new file mode 100644 index 000000000000..e76458ae8c8c --- /dev/null +++ b/shared/mock/validator_service_mock.go @@ -0,0 +1,477 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/prysmaticlabs/ethereumapis/eth/v1alpha1 (interfaces: BeaconChainClient) + +// Package mock is a generated GoMock package. +package mock + +import ( + context "context" + gomock "github.com/golang/mock/gomock" + empty "github.com/golang/protobuf/ptypes/empty" + eth "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" + grpc "google.golang.org/grpc" + reflect "reflect" +) + +// MockBeaconChainClient is a mock of BeaconChainClient interface +type MockBeaconChainClient struct { + ctrl *gomock.Controller + recorder *MockBeaconChainClientMockRecorder +} + +// MockBeaconChainClientMockRecorder is the mock recorder for MockBeaconChainClient +type MockBeaconChainClientMockRecorder struct { + mock *MockBeaconChainClient +} + +// NewMockBeaconChainClient creates a new mock instance +func NewMockBeaconChainClient(ctrl *gomock.Controller) *MockBeaconChainClient { + mock := &MockBeaconChainClient{ctrl: ctrl} + mock.recorder = &MockBeaconChainClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockBeaconChainClient) EXPECT() *MockBeaconChainClientMockRecorder { + return m.recorder +} + +// AttestationPool mocks base method +func (m *MockBeaconChainClient) AttestationPool(arg0 context.Context, arg1 *eth.AttestationPoolRequest, arg2 ...grpc.CallOption) (*eth.AttestationPoolResponse, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "AttestationPool", varargs...) + ret0, _ := ret[0].(*eth.AttestationPoolResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AttestationPool indicates an expected call of AttestationPool +func (mr *MockBeaconChainClientMockRecorder) AttestationPool(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AttestationPool", reflect.TypeOf((*MockBeaconChainClient)(nil).AttestationPool), varargs...) +} + +// GetBeaconConfig mocks base method +func (m *MockBeaconChainClient) GetBeaconConfig(arg0 context.Context, arg1 *empty.Empty, arg2 ...grpc.CallOption) (*eth.BeaconConfig, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetBeaconConfig", varargs...) + ret0, _ := ret[0].(*eth.BeaconConfig) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetBeaconConfig indicates an expected call of GetBeaconConfig +func (mr *MockBeaconChainClientMockRecorder) GetBeaconConfig(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBeaconConfig", reflect.TypeOf((*MockBeaconChainClient)(nil).GetBeaconConfig), varargs...) +} + +// GetChainHead mocks base method +func (m *MockBeaconChainClient) GetChainHead(arg0 context.Context, arg1 *empty.Empty, arg2 ...grpc.CallOption) (*eth.ChainHead, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetChainHead", varargs...) + ret0, _ := ret[0].(*eth.ChainHead) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetChainHead indicates an expected call of GetChainHead +func (mr *MockBeaconChainClientMockRecorder) GetChainHead(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetChainHead", reflect.TypeOf((*MockBeaconChainClient)(nil).GetChainHead), varargs...) +} + +// GetValidator mocks base method +func (m *MockBeaconChainClient) GetValidator(arg0 context.Context, arg1 *eth.GetValidatorRequest, arg2 ...grpc.CallOption) (*eth.Validator, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetValidator", varargs...) + ret0, _ := ret[0].(*eth.Validator) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetValidator indicates an expected call of GetValidator +func (mr *MockBeaconChainClientMockRecorder) GetValidator(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidator", reflect.TypeOf((*MockBeaconChainClient)(nil).GetValidator), varargs...) +} + +// GetValidatorActiveSetChanges mocks base method +func (m *MockBeaconChainClient) GetValidatorActiveSetChanges(arg0 context.Context, arg1 *eth.GetValidatorActiveSetChangesRequest, arg2 ...grpc.CallOption) (*eth.ActiveSetChanges, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetValidatorActiveSetChanges", varargs...) + ret0, _ := ret[0].(*eth.ActiveSetChanges) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetValidatorActiveSetChanges indicates an expected call of GetValidatorActiveSetChanges +func (mr *MockBeaconChainClientMockRecorder) GetValidatorActiveSetChanges(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidatorActiveSetChanges", reflect.TypeOf((*MockBeaconChainClient)(nil).GetValidatorActiveSetChanges), varargs...) +} + +// GetValidatorParticipation mocks base method +func (m *MockBeaconChainClient) GetValidatorParticipation(arg0 context.Context, arg1 *eth.GetValidatorParticipationRequest, arg2 ...grpc.CallOption) (*eth.ValidatorParticipationResponse, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetValidatorParticipation", varargs...) + ret0, _ := ret[0].(*eth.ValidatorParticipationResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetValidatorParticipation indicates an expected call of GetValidatorParticipation +func (mr *MockBeaconChainClientMockRecorder) GetValidatorParticipation(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidatorParticipation", reflect.TypeOf((*MockBeaconChainClient)(nil).GetValidatorParticipation), varargs...) +} + +// GetValidatorPerformance mocks base method +func (m *MockBeaconChainClient) GetValidatorPerformance(arg0 context.Context, arg1 *eth.ValidatorPerformanceRequest, arg2 ...grpc.CallOption) (*eth.ValidatorPerformanceResponse, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetValidatorPerformance", varargs...) + ret0, _ := ret[0].(*eth.ValidatorPerformanceResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetValidatorPerformance indicates an expected call of GetValidatorPerformance +func (mr *MockBeaconChainClientMockRecorder) GetValidatorPerformance(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidatorPerformance", reflect.TypeOf((*MockBeaconChainClient)(nil).GetValidatorPerformance), varargs...) +} + +// GetValidatorQueue mocks base method +func (m *MockBeaconChainClient) GetValidatorQueue(arg0 context.Context, arg1 *empty.Empty, arg2 ...grpc.CallOption) (*eth.ValidatorQueue, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetValidatorQueue", varargs...) + ret0, _ := ret[0].(*eth.ValidatorQueue) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetValidatorQueue indicates an expected call of GetValidatorQueue +func (mr *MockBeaconChainClientMockRecorder) GetValidatorQueue(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidatorQueue", reflect.TypeOf((*MockBeaconChainClient)(nil).GetValidatorQueue), varargs...) +} + +// ListAttestations mocks base method +func (m *MockBeaconChainClient) ListAttestations(arg0 context.Context, arg1 *eth.ListAttestationsRequest, arg2 ...grpc.CallOption) (*eth.ListAttestationsResponse, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListAttestations", varargs...) + ret0, _ := ret[0].(*eth.ListAttestationsResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListAttestations indicates an expected call of ListAttestations +func (mr *MockBeaconChainClientMockRecorder) ListAttestations(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAttestations", reflect.TypeOf((*MockBeaconChainClient)(nil).ListAttestations), varargs...) +} + +// ListBeaconCommittees mocks base method +func (m *MockBeaconChainClient) ListBeaconCommittees(arg0 context.Context, arg1 *eth.ListCommitteesRequest, arg2 ...grpc.CallOption) (*eth.BeaconCommittees, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListBeaconCommittees", varargs...) + ret0, _ := ret[0].(*eth.BeaconCommittees) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListBeaconCommittees indicates an expected call of ListBeaconCommittees +func (mr *MockBeaconChainClientMockRecorder) ListBeaconCommittees(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListBeaconCommittees", reflect.TypeOf((*MockBeaconChainClient)(nil).ListBeaconCommittees), varargs...) +} + +// ListBlocks mocks base method +func (m *MockBeaconChainClient) ListBlocks(arg0 context.Context, arg1 *eth.ListBlocksRequest, arg2 ...grpc.CallOption) (*eth.ListBlocksResponse, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListBlocks", varargs...) + ret0, _ := ret[0].(*eth.ListBlocksResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListBlocks indicates an expected call of ListBlocks +func (mr *MockBeaconChainClientMockRecorder) ListBlocks(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListBlocks", reflect.TypeOf((*MockBeaconChainClient)(nil).ListBlocks), varargs...) +} + +// ListIndexedAttestations mocks base method +func (m *MockBeaconChainClient) ListIndexedAttestations(arg0 context.Context, arg1 *eth.ListIndexedAttestationsRequest, arg2 ...grpc.CallOption) (*eth.ListIndexedAttestationsResponse, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListIndexedAttestations", varargs...) + ret0, _ := ret[0].(*eth.ListIndexedAttestationsResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListIndexedAttestations indicates an expected call of ListIndexedAttestations +func (mr *MockBeaconChainClientMockRecorder) ListIndexedAttestations(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListIndexedAttestations", reflect.TypeOf((*MockBeaconChainClient)(nil).ListIndexedAttestations), varargs...) +} + +// ListValidatorAssignments mocks base method +func (m *MockBeaconChainClient) ListValidatorAssignments(arg0 context.Context, arg1 *eth.ListValidatorAssignmentsRequest, arg2 ...grpc.CallOption) (*eth.ValidatorAssignments, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListValidatorAssignments", varargs...) + ret0, _ := ret[0].(*eth.ValidatorAssignments) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListValidatorAssignments indicates an expected call of ListValidatorAssignments +func (mr *MockBeaconChainClientMockRecorder) ListValidatorAssignments(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListValidatorAssignments", reflect.TypeOf((*MockBeaconChainClient)(nil).ListValidatorAssignments), varargs...) +} + +// ListValidatorBalances mocks base method +func (m *MockBeaconChainClient) ListValidatorBalances(arg0 context.Context, arg1 *eth.ListValidatorBalancesRequest, arg2 ...grpc.CallOption) (*eth.ValidatorBalances, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListValidatorBalances", varargs...) + ret0, _ := ret[0].(*eth.ValidatorBalances) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListValidatorBalances indicates an expected call of ListValidatorBalances +func (mr *MockBeaconChainClientMockRecorder) ListValidatorBalances(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListValidatorBalances", reflect.TypeOf((*MockBeaconChainClient)(nil).ListValidatorBalances), varargs...) +} + +// ListValidators mocks base method +func (m *MockBeaconChainClient) ListValidators(arg0 context.Context, arg1 *eth.ListValidatorsRequest, arg2 ...grpc.CallOption) (*eth.Validators, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListValidators", varargs...) + ret0, _ := ret[0].(*eth.Validators) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListValidators indicates an expected call of ListValidators +func (mr *MockBeaconChainClientMockRecorder) ListValidators(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListValidators", reflect.TypeOf((*MockBeaconChainClient)(nil).ListValidators), varargs...) +} + +// StreamAttestations mocks base method +func (m *MockBeaconChainClient) StreamAttestations(arg0 context.Context, arg1 *empty.Empty, arg2 ...grpc.CallOption) (eth.BeaconChain_StreamAttestationsClient, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "StreamAttestations", varargs...) + ret0, _ := ret[0].(eth.BeaconChain_StreamAttestationsClient) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// StreamAttestations indicates an expected call of StreamAttestations +func (mr *MockBeaconChainClientMockRecorder) StreamAttestations(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StreamAttestations", reflect.TypeOf((*MockBeaconChainClient)(nil).StreamAttestations), varargs...) +} + +// StreamBlocks mocks base method +func (m *MockBeaconChainClient) StreamBlocks(arg0 context.Context, arg1 *empty.Empty, arg2 ...grpc.CallOption) (eth.BeaconChain_StreamBlocksClient, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "StreamBlocks", varargs...) + ret0, _ := ret[0].(eth.BeaconChain_StreamBlocksClient) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// StreamBlocks indicates an expected call of StreamBlocks +func (mr *MockBeaconChainClientMockRecorder) StreamBlocks(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StreamBlocks", reflect.TypeOf((*MockBeaconChainClient)(nil).StreamBlocks), varargs...) +} + +// StreamChainHead mocks base method +func (m *MockBeaconChainClient) StreamChainHead(arg0 context.Context, arg1 *empty.Empty, arg2 ...grpc.CallOption) (eth.BeaconChain_StreamChainHeadClient, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "StreamChainHead", varargs...) + ret0, _ := ret[0].(eth.BeaconChain_StreamChainHeadClient) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// StreamChainHead indicates an expected call of StreamChainHead +func (mr *MockBeaconChainClientMockRecorder) StreamChainHead(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StreamChainHead", reflect.TypeOf((*MockBeaconChainClient)(nil).StreamChainHead), varargs...) +} + +// StreamIndexedAttestations mocks base method +func (m *MockBeaconChainClient) StreamIndexedAttestations(arg0 context.Context, arg1 *empty.Empty, arg2 ...grpc.CallOption) (eth.BeaconChain_StreamIndexedAttestationsClient, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "StreamIndexedAttestations", varargs...) + ret0, _ := ret[0].(eth.BeaconChain_StreamIndexedAttestationsClient) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// StreamIndexedAttestations indicates an expected call of StreamIndexedAttestations +func (mr *MockBeaconChainClientMockRecorder) StreamIndexedAttestations(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StreamIndexedAttestations", reflect.TypeOf((*MockBeaconChainClient)(nil).StreamIndexedAttestations), varargs...) +} + +// StreamValidatorsInfo mocks base method +func (m *MockBeaconChainClient) StreamValidatorsInfo(arg0 context.Context, arg1 ...grpc.CallOption) (eth.BeaconChain_StreamValidatorsInfoClient, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0} + for _, a := range arg1 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "StreamValidatorsInfo", varargs...) + ret0, _ := ret[0].(eth.BeaconChain_StreamValidatorsInfoClient) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// StreamValidatorsInfo indicates an expected call of StreamValidatorsInfo +func (mr *MockBeaconChainClientMockRecorder) StreamValidatorsInfo(arg0 interface{}, arg1 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0}, arg1...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StreamValidatorsInfo", reflect.TypeOf((*MockBeaconChainClient)(nil).StreamValidatorsInfo), varargs...) +} + +// SubmitAttesterSlashing mocks base method +func (m *MockBeaconChainClient) SubmitAttesterSlashing(arg0 context.Context, arg1 *eth.AttesterSlashing, arg2 ...grpc.CallOption) (*eth.SubmitSlashingResponse, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "SubmitAttesterSlashing", varargs...) + ret0, _ := ret[0].(*eth.SubmitSlashingResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SubmitAttesterSlashing indicates an expected call of SubmitAttesterSlashing +func (mr *MockBeaconChainClientMockRecorder) SubmitAttesterSlashing(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubmitAttesterSlashing", reflect.TypeOf((*MockBeaconChainClient)(nil).SubmitAttesterSlashing), varargs...) +} + +// SubmitProposerSlashing mocks base method +func (m *MockBeaconChainClient) SubmitProposerSlashing(arg0 context.Context, arg1 *eth.ProposerSlashing, arg2 ...grpc.CallOption) (*eth.SubmitSlashingResponse, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "SubmitProposerSlashing", varargs...) + ret0, _ := ret[0].(*eth.SubmitSlashingResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SubmitProposerSlashing indicates an expected call of SubmitProposerSlashing +func (mr *MockBeaconChainClientMockRecorder) SubmitProposerSlashing(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubmitProposerSlashing", reflect.TypeOf((*MockBeaconChainClient)(nil).SubmitProposerSlashing), varargs...) +} From 3446285382a0d0efbbcdcb4e0b3e29595e4e9adf Mon Sep 17 00:00:00 2001 From: Terence Tsao Date: Fri, 20 Mar 2020 14:27:34 -0700 Subject: [PATCH 09/11] Update mock --- shared/mock/validator_service_mock.go | 477 ------------------ .../beacon_node_validator_service_mock.go | 54 +- 2 files changed, 29 insertions(+), 502 deletions(-) delete mode 100644 shared/mock/validator_service_mock.go diff --git a/shared/mock/validator_service_mock.go b/shared/mock/validator_service_mock.go deleted file mode 100644 index e76458ae8c8c..000000000000 --- a/shared/mock/validator_service_mock.go +++ /dev/null @@ -1,477 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: github.com/prysmaticlabs/ethereumapis/eth/v1alpha1 (interfaces: BeaconChainClient) - -// Package mock is a generated GoMock package. -package mock - -import ( - context "context" - gomock "github.com/golang/mock/gomock" - empty "github.com/golang/protobuf/ptypes/empty" - eth "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" - grpc "google.golang.org/grpc" - reflect "reflect" -) - -// MockBeaconChainClient is a mock of BeaconChainClient interface -type MockBeaconChainClient struct { - ctrl *gomock.Controller - recorder *MockBeaconChainClientMockRecorder -} - -// MockBeaconChainClientMockRecorder is the mock recorder for MockBeaconChainClient -type MockBeaconChainClientMockRecorder struct { - mock *MockBeaconChainClient -} - -// NewMockBeaconChainClient creates a new mock instance -func NewMockBeaconChainClient(ctrl *gomock.Controller) *MockBeaconChainClient { - mock := &MockBeaconChainClient{ctrl: ctrl} - mock.recorder = &MockBeaconChainClientMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use -func (m *MockBeaconChainClient) EXPECT() *MockBeaconChainClientMockRecorder { - return m.recorder -} - -// AttestationPool mocks base method -func (m *MockBeaconChainClient) AttestationPool(arg0 context.Context, arg1 *eth.AttestationPoolRequest, arg2 ...grpc.CallOption) (*eth.AttestationPoolResponse, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "AttestationPool", varargs...) - ret0, _ := ret[0].(*eth.AttestationPoolResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AttestationPool indicates an expected call of AttestationPool -func (mr *MockBeaconChainClientMockRecorder) AttestationPool(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AttestationPool", reflect.TypeOf((*MockBeaconChainClient)(nil).AttestationPool), varargs...) -} - -// GetBeaconConfig mocks base method -func (m *MockBeaconChainClient) GetBeaconConfig(arg0 context.Context, arg1 *empty.Empty, arg2 ...grpc.CallOption) (*eth.BeaconConfig, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "GetBeaconConfig", varargs...) - ret0, _ := ret[0].(*eth.BeaconConfig) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetBeaconConfig indicates an expected call of GetBeaconConfig -func (mr *MockBeaconChainClientMockRecorder) GetBeaconConfig(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBeaconConfig", reflect.TypeOf((*MockBeaconChainClient)(nil).GetBeaconConfig), varargs...) -} - -// GetChainHead mocks base method -func (m *MockBeaconChainClient) GetChainHead(arg0 context.Context, arg1 *empty.Empty, arg2 ...grpc.CallOption) (*eth.ChainHead, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "GetChainHead", varargs...) - ret0, _ := ret[0].(*eth.ChainHead) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetChainHead indicates an expected call of GetChainHead -func (mr *MockBeaconChainClientMockRecorder) GetChainHead(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetChainHead", reflect.TypeOf((*MockBeaconChainClient)(nil).GetChainHead), varargs...) -} - -// GetValidator mocks base method -func (m *MockBeaconChainClient) GetValidator(arg0 context.Context, arg1 *eth.GetValidatorRequest, arg2 ...grpc.CallOption) (*eth.Validator, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "GetValidator", varargs...) - ret0, _ := ret[0].(*eth.Validator) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetValidator indicates an expected call of GetValidator -func (mr *MockBeaconChainClientMockRecorder) GetValidator(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidator", reflect.TypeOf((*MockBeaconChainClient)(nil).GetValidator), varargs...) -} - -// GetValidatorActiveSetChanges mocks base method -func (m *MockBeaconChainClient) GetValidatorActiveSetChanges(arg0 context.Context, arg1 *eth.GetValidatorActiveSetChangesRequest, arg2 ...grpc.CallOption) (*eth.ActiveSetChanges, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "GetValidatorActiveSetChanges", varargs...) - ret0, _ := ret[0].(*eth.ActiveSetChanges) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetValidatorActiveSetChanges indicates an expected call of GetValidatorActiveSetChanges -func (mr *MockBeaconChainClientMockRecorder) GetValidatorActiveSetChanges(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidatorActiveSetChanges", reflect.TypeOf((*MockBeaconChainClient)(nil).GetValidatorActiveSetChanges), varargs...) -} - -// GetValidatorParticipation mocks base method -func (m *MockBeaconChainClient) GetValidatorParticipation(arg0 context.Context, arg1 *eth.GetValidatorParticipationRequest, arg2 ...grpc.CallOption) (*eth.ValidatorParticipationResponse, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "GetValidatorParticipation", varargs...) - ret0, _ := ret[0].(*eth.ValidatorParticipationResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetValidatorParticipation indicates an expected call of GetValidatorParticipation -func (mr *MockBeaconChainClientMockRecorder) GetValidatorParticipation(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidatorParticipation", reflect.TypeOf((*MockBeaconChainClient)(nil).GetValidatorParticipation), varargs...) -} - -// GetValidatorPerformance mocks base method -func (m *MockBeaconChainClient) GetValidatorPerformance(arg0 context.Context, arg1 *eth.ValidatorPerformanceRequest, arg2 ...grpc.CallOption) (*eth.ValidatorPerformanceResponse, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "GetValidatorPerformance", varargs...) - ret0, _ := ret[0].(*eth.ValidatorPerformanceResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetValidatorPerformance indicates an expected call of GetValidatorPerformance -func (mr *MockBeaconChainClientMockRecorder) GetValidatorPerformance(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidatorPerformance", reflect.TypeOf((*MockBeaconChainClient)(nil).GetValidatorPerformance), varargs...) -} - -// GetValidatorQueue mocks base method -func (m *MockBeaconChainClient) GetValidatorQueue(arg0 context.Context, arg1 *empty.Empty, arg2 ...grpc.CallOption) (*eth.ValidatorQueue, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "GetValidatorQueue", varargs...) - ret0, _ := ret[0].(*eth.ValidatorQueue) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetValidatorQueue indicates an expected call of GetValidatorQueue -func (mr *MockBeaconChainClientMockRecorder) GetValidatorQueue(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidatorQueue", reflect.TypeOf((*MockBeaconChainClient)(nil).GetValidatorQueue), varargs...) -} - -// ListAttestations mocks base method -func (m *MockBeaconChainClient) ListAttestations(arg0 context.Context, arg1 *eth.ListAttestationsRequest, arg2 ...grpc.CallOption) (*eth.ListAttestationsResponse, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "ListAttestations", varargs...) - ret0, _ := ret[0].(*eth.ListAttestationsResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ListAttestations indicates an expected call of ListAttestations -func (mr *MockBeaconChainClientMockRecorder) ListAttestations(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAttestations", reflect.TypeOf((*MockBeaconChainClient)(nil).ListAttestations), varargs...) -} - -// ListBeaconCommittees mocks base method -func (m *MockBeaconChainClient) ListBeaconCommittees(arg0 context.Context, arg1 *eth.ListCommitteesRequest, arg2 ...grpc.CallOption) (*eth.BeaconCommittees, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "ListBeaconCommittees", varargs...) - ret0, _ := ret[0].(*eth.BeaconCommittees) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ListBeaconCommittees indicates an expected call of ListBeaconCommittees -func (mr *MockBeaconChainClientMockRecorder) ListBeaconCommittees(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListBeaconCommittees", reflect.TypeOf((*MockBeaconChainClient)(nil).ListBeaconCommittees), varargs...) -} - -// ListBlocks mocks base method -func (m *MockBeaconChainClient) ListBlocks(arg0 context.Context, arg1 *eth.ListBlocksRequest, arg2 ...grpc.CallOption) (*eth.ListBlocksResponse, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "ListBlocks", varargs...) - ret0, _ := ret[0].(*eth.ListBlocksResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ListBlocks indicates an expected call of ListBlocks -func (mr *MockBeaconChainClientMockRecorder) ListBlocks(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListBlocks", reflect.TypeOf((*MockBeaconChainClient)(nil).ListBlocks), varargs...) -} - -// ListIndexedAttestations mocks base method -func (m *MockBeaconChainClient) ListIndexedAttestations(arg0 context.Context, arg1 *eth.ListIndexedAttestationsRequest, arg2 ...grpc.CallOption) (*eth.ListIndexedAttestationsResponse, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "ListIndexedAttestations", varargs...) - ret0, _ := ret[0].(*eth.ListIndexedAttestationsResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ListIndexedAttestations indicates an expected call of ListIndexedAttestations -func (mr *MockBeaconChainClientMockRecorder) ListIndexedAttestations(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListIndexedAttestations", reflect.TypeOf((*MockBeaconChainClient)(nil).ListIndexedAttestations), varargs...) -} - -// ListValidatorAssignments mocks base method -func (m *MockBeaconChainClient) ListValidatorAssignments(arg0 context.Context, arg1 *eth.ListValidatorAssignmentsRequest, arg2 ...grpc.CallOption) (*eth.ValidatorAssignments, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "ListValidatorAssignments", varargs...) - ret0, _ := ret[0].(*eth.ValidatorAssignments) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ListValidatorAssignments indicates an expected call of ListValidatorAssignments -func (mr *MockBeaconChainClientMockRecorder) ListValidatorAssignments(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListValidatorAssignments", reflect.TypeOf((*MockBeaconChainClient)(nil).ListValidatorAssignments), varargs...) -} - -// ListValidatorBalances mocks base method -func (m *MockBeaconChainClient) ListValidatorBalances(arg0 context.Context, arg1 *eth.ListValidatorBalancesRequest, arg2 ...grpc.CallOption) (*eth.ValidatorBalances, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "ListValidatorBalances", varargs...) - ret0, _ := ret[0].(*eth.ValidatorBalances) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ListValidatorBalances indicates an expected call of ListValidatorBalances -func (mr *MockBeaconChainClientMockRecorder) ListValidatorBalances(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListValidatorBalances", reflect.TypeOf((*MockBeaconChainClient)(nil).ListValidatorBalances), varargs...) -} - -// ListValidators mocks base method -func (m *MockBeaconChainClient) ListValidators(arg0 context.Context, arg1 *eth.ListValidatorsRequest, arg2 ...grpc.CallOption) (*eth.Validators, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "ListValidators", varargs...) - ret0, _ := ret[0].(*eth.Validators) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ListValidators indicates an expected call of ListValidators -func (mr *MockBeaconChainClientMockRecorder) ListValidators(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListValidators", reflect.TypeOf((*MockBeaconChainClient)(nil).ListValidators), varargs...) -} - -// StreamAttestations mocks base method -func (m *MockBeaconChainClient) StreamAttestations(arg0 context.Context, arg1 *empty.Empty, arg2 ...grpc.CallOption) (eth.BeaconChain_StreamAttestationsClient, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "StreamAttestations", varargs...) - ret0, _ := ret[0].(eth.BeaconChain_StreamAttestationsClient) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// StreamAttestations indicates an expected call of StreamAttestations -func (mr *MockBeaconChainClientMockRecorder) StreamAttestations(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StreamAttestations", reflect.TypeOf((*MockBeaconChainClient)(nil).StreamAttestations), varargs...) -} - -// StreamBlocks mocks base method -func (m *MockBeaconChainClient) StreamBlocks(arg0 context.Context, arg1 *empty.Empty, arg2 ...grpc.CallOption) (eth.BeaconChain_StreamBlocksClient, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "StreamBlocks", varargs...) - ret0, _ := ret[0].(eth.BeaconChain_StreamBlocksClient) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// StreamBlocks indicates an expected call of StreamBlocks -func (mr *MockBeaconChainClientMockRecorder) StreamBlocks(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StreamBlocks", reflect.TypeOf((*MockBeaconChainClient)(nil).StreamBlocks), varargs...) -} - -// StreamChainHead mocks base method -func (m *MockBeaconChainClient) StreamChainHead(arg0 context.Context, arg1 *empty.Empty, arg2 ...grpc.CallOption) (eth.BeaconChain_StreamChainHeadClient, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "StreamChainHead", varargs...) - ret0, _ := ret[0].(eth.BeaconChain_StreamChainHeadClient) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// StreamChainHead indicates an expected call of StreamChainHead -func (mr *MockBeaconChainClientMockRecorder) StreamChainHead(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StreamChainHead", reflect.TypeOf((*MockBeaconChainClient)(nil).StreamChainHead), varargs...) -} - -// StreamIndexedAttestations mocks base method -func (m *MockBeaconChainClient) StreamIndexedAttestations(arg0 context.Context, arg1 *empty.Empty, arg2 ...grpc.CallOption) (eth.BeaconChain_StreamIndexedAttestationsClient, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "StreamIndexedAttestations", varargs...) - ret0, _ := ret[0].(eth.BeaconChain_StreamIndexedAttestationsClient) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// StreamIndexedAttestations indicates an expected call of StreamIndexedAttestations -func (mr *MockBeaconChainClientMockRecorder) StreamIndexedAttestations(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StreamIndexedAttestations", reflect.TypeOf((*MockBeaconChainClient)(nil).StreamIndexedAttestations), varargs...) -} - -// StreamValidatorsInfo mocks base method -func (m *MockBeaconChainClient) StreamValidatorsInfo(arg0 context.Context, arg1 ...grpc.CallOption) (eth.BeaconChain_StreamValidatorsInfoClient, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0} - for _, a := range arg1 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "StreamValidatorsInfo", varargs...) - ret0, _ := ret[0].(eth.BeaconChain_StreamValidatorsInfoClient) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// StreamValidatorsInfo indicates an expected call of StreamValidatorsInfo -func (mr *MockBeaconChainClientMockRecorder) StreamValidatorsInfo(arg0 interface{}, arg1 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0}, arg1...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StreamValidatorsInfo", reflect.TypeOf((*MockBeaconChainClient)(nil).StreamValidatorsInfo), varargs...) -} - -// SubmitAttesterSlashing mocks base method -func (m *MockBeaconChainClient) SubmitAttesterSlashing(arg0 context.Context, arg1 *eth.AttesterSlashing, arg2 ...grpc.CallOption) (*eth.SubmitSlashingResponse, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "SubmitAttesterSlashing", varargs...) - ret0, _ := ret[0].(*eth.SubmitSlashingResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// SubmitAttesterSlashing indicates an expected call of SubmitAttesterSlashing -func (mr *MockBeaconChainClientMockRecorder) SubmitAttesterSlashing(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubmitAttesterSlashing", reflect.TypeOf((*MockBeaconChainClient)(nil).SubmitAttesterSlashing), varargs...) -} - -// SubmitProposerSlashing mocks base method -func (m *MockBeaconChainClient) SubmitProposerSlashing(arg0 context.Context, arg1 *eth.ProposerSlashing, arg2 ...grpc.CallOption) (*eth.SubmitSlashingResponse, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "SubmitProposerSlashing", varargs...) - ret0, _ := ret[0].(*eth.SubmitSlashingResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// SubmitProposerSlashing indicates an expected call of SubmitProposerSlashing -func (mr *MockBeaconChainClientMockRecorder) SubmitProposerSlashing(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubmitProposerSlashing", reflect.TypeOf((*MockBeaconChainClient)(nil).SubmitProposerSlashing), varargs...) -} diff --git a/validator/internal/beacon_node_validator_service_mock.go b/validator/internal/beacon_node_validator_service_mock.go index f1447a82b995..0e6b3ed0f7f5 100644 --- a/validator/internal/beacon_node_validator_service_mock.go +++ b/validator/internal/beacon_node_validator_service_mock.go @@ -238,26 +238,45 @@ func (mr *MockBeaconNodeValidatorClientMockRecorder) ProposeAttestation(ctx, in return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProposeAttestation", reflect.TypeOf((*MockBeaconNodeValidatorClient)(nil).ProposeAttestation), varargs...) } -// SubmitAggregateAndProof mocks base method -func (m *MockBeaconNodeValidatorClient) SubmitAggregateAndProof(ctx context.Context, in *ethpb.AggregationRequest, opts ...grpc.CallOption) (*ethpb.AggregationResponse, error) { +// SubmitAggregateSelectionProof mocks base method +func (m *MockBeaconNodeValidatorClient) SubmitAggregateSelectionProof(arg0 context.Context, arg1 *ethpb.AggregateSelectionRequest, arg2 ...grpc.CallOption) (*ethpb.AggregateSelectionResponse, error) { m.ctrl.T.Helper() - varargs := []interface{}{ctx, in} - for _, a := range opts { + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "SubmitAggregateAndProof", varargs...) - ret0, _ := ret[0].(*ethpb.AggregationResponse) + ret := m.ctrl.Call(m, "SubmitAggregateSelectionProof", varargs...) + ret0, _ := ret[0].(*ethpb.AggregateSelectionResponse) ret1, _ := ret[1].(error) return ret0, ret1 } -// SubmitAggregateAndProof indicates an expected call of SubmitAggregateAndProof -func (mr *MockBeaconNodeValidatorClientMockRecorder) SubmitAggregateAndProof(ctx, in interface{}, opts ...interface{}) *gomock.Call { +// SubmitAggregateSelectionProof indicates an expected call of SubmitAggregateSelectionProof +func (mr *MockBeaconNodeValidatorClientMockRecorder) SubmitAggregateSelectionProof(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, in}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubmitAggregateAndProof", reflect.TypeOf((*MockBeaconNodeValidatorClient)(nil).SubmitAggregateAndProof), varargs...) + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubmitAggregateSelectionProof", reflect.TypeOf((*MockBeaconNodeValidatorClient)(nil).SubmitAggregateSelectionProof), varargs...) +} + +// SubmitSignedAggregateSelectionProof mocks base method +func (m *MockBeaconNodeValidatorClient) SubmitSignedAggregateSelectionProof(arg0 context.Context, arg1 *ethpb.SignedAggregateSubmitRequest, arg2 ...grpc.CallOption) (*ethpb.SignedAggregateSubmitResponse, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "SubmitSignedAggregateSelectionProof", varargs...) + ret0, _ := ret[0].(*ethpb.SignedAggregateSubmitResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 } +// SubmitSignedAggregateSelectionProof indicates an expected call of SubmitSignedAggregateSelectionProof +func (mr *MockBeaconNodeValidatorClientMockRecorder) SubmitSignedAggregateSelectionProof(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubmitSignedAggregateSelectionProof", reflect.TypeOf((*MockBeaconNodeValidatorClient)(nil).SubmitSignedAggregateSelectionProof), varargs...) +} // ProposeExit mocks base method func (m *MockBeaconNodeValidatorClient) ProposeExit(ctx context.Context, in *ethpb.SignedVoluntaryExit, opts ...grpc.CallOption) (*ptypes.Empty, error) { m.ctrl.T.Helper() @@ -695,21 +714,6 @@ func (mr *MockBeaconNodeValidatorServerMockRecorder) ProposeAttestation(arg0, ar return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProposeAttestation", reflect.TypeOf((*MockBeaconNodeValidatorServer)(nil).ProposeAttestation), arg0, arg1) } -// SubmitAggregateAndProof mocks base method -func (m *MockBeaconNodeValidatorServer) SubmitAggregateAndProof(arg0 context.Context, arg1 *ethpb.AggregationRequest) (*ethpb.AggregationResponse, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SubmitAggregateAndProof", arg0, arg1) - ret0, _ := ret[0].(*ethpb.AggregationResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// SubmitAggregateAndProof indicates an expected call of SubmitAggregateAndProof -func (mr *MockBeaconNodeValidatorServerMockRecorder) SubmitAggregateAndProof(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubmitAggregateAndProof", reflect.TypeOf((*MockBeaconNodeValidatorServer)(nil).SubmitAggregateAndProof), arg0, arg1) -} - // ProposeExit mocks base method func (m *MockBeaconNodeValidatorServer) ProposeExit(arg0 context.Context, arg1 *ethpb.SignedVoluntaryExit) (*ptypes.Empty, error) { m.ctrl.T.Helper() From 1c7be148896a7048253cb703395a78a4e233a3bc Mon Sep 17 00:00:00 2001 From: Terence Tsao Date: Fri, 20 Mar 2020 14:41:46 -0700 Subject: [PATCH 10/11] Fixed validator client tests --- validator/client/validator_aggregate.go | 2 +- validator/client/validator_aggregate_test.go | 22 +++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/validator/client/validator_aggregate.go b/validator/client/validator_aggregate.go index 25861c9d662b..98ebb46a9b1e 100644 --- a/validator/client/validator_aggregate.go +++ b/validator/client/validator_aggregate.go @@ -129,7 +129,7 @@ func (v *validator) SubmitAggregateAndProof(ctx context.Context, slot uint64, pu // This implements selection logic outlined in: // https://github.com/ethereum/eth2.0-specs/blob/v0.9.3/specs/validator/0_beacon-chain-validator.md#aggregation-selection func (v *validator) signSlot(ctx context.Context, pubKey [48]byte, slot uint64) ([]byte, error) { - domain, err := v.domainData(ctx, helpers.SlotToEpoch(slot), params.BeaconConfig().DomainBeaconAttester[:]) + domain, err := v.domainData(ctx, helpers.SlotToEpoch(slot), params.BeaconConfig().DomainSelectionProof[:]) if err != nil { return nil, err } diff --git a/validator/client/validator_aggregate_test.go b/validator/client/validator_aggregate_test.go index f370eaa851e5..9ebbc9306ad2 100644 --- a/validator/client/validator_aggregate_test.go +++ b/validator/client/validator_aggregate_test.go @@ -39,10 +39,26 @@ func TestSubmitAggregateAndProof_Ok(t *testing.T) { gomock.Any(), // epoch ).Return(ðpb.DomainResponse{}, nil /*err*/) - m.validatorClient.EXPECT().SubmitAggregateAndProof( + m.validatorClient.EXPECT().SubmitAggregateSelectionProof( gomock.Any(), // ctx - gomock.AssignableToTypeOf(ðpb.AggregationRequest{}), - ).Return(ðpb.AggregationResponse{}, nil) + gomock.AssignableToTypeOf(ðpb.AggregateSelectionRequest{}), + ).Return(ðpb.AggregateSelectionResponse{ + AggregateAndProof:ðpb.AggregateAttestationAndProof{ + AggregatorIndex: 0, + Aggregate: ðpb.Attestation{Data:ðpb.AttestationData{}}, + SelectionProof: nil, + }, + }, nil) + + m.validatorClient.EXPECT().DomainData( + gomock.Any(), // ctx + gomock.Any(), // epoch + ).Return(ðpb.DomainResponse{}, nil /*err*/) + + m.validatorClient.EXPECT().SubmitSignedAggregateSelectionProof( + gomock.Any(), // ctx + gomock.AssignableToTypeOf(ðpb.SignedAggregateSubmitRequest{}), + ).Return(ðpb.SignedAggregateSubmitResponse{}, nil) validator.SubmitAggregateAndProof(context.Background(), 0, validatorPubKey) } From 6a7d0ba4760d1aa33c1232779845ca6e9916bfd3 Mon Sep 17 00:00:00 2001 From: Terence Tsao Date: Fri, 20 Mar 2020 15:20:19 -0700 Subject: [PATCH 11/11] Raul's feedback --- beacon-chain/rpc/validator/aggregator.go | 6 +++++- beacon-chain/rpc/validator/aggregator_test.go | 2 +- validator/client/validator_aggregate.go | 7 +++---- validator/client/validator_aggregate_test.go | 8 ++++---- validator/internal/beacon_node_validator_service_mock.go | 1 + 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/beacon-chain/rpc/validator/aggregator.go b/beacon-chain/rpc/validator/aggregator.go index 799d4e6df6c3..ecdfcd8047b2 100644 --- a/beacon-chain/rpc/validator/aggregator.go +++ b/beacon-chain/rpc/validator/aggregator.go @@ -2,10 +2,10 @@ package validator import ( "context" - "github.com/sirupsen/logrus" ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" + "github.com/sirupsen/logrus" "go.opencensus.io/trace" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -79,6 +79,10 @@ func (as *Server) SubmitAggregateSelectionProof(ctx context.Context, req *ethpb. // SubmitSignedAggregateSelectionProof is called by a validator to broadcast a signed // aggregated and proof object. func (as *Server) SubmitSignedAggregateSelectionProof(ctx context.Context, req *ethpb.SignedAggregateSubmitRequest) (*ethpb.SignedAggregateSubmitResponse, error) { + if req.SignedAggregateAndProof == nil { + return nil, status.Error(codes.InvalidArgument, "Signed aggregate request can't be nil") + } + if err := as.P2P.Broadcast(ctx, req.SignedAggregateAndProof); err != nil { return nil, status.Errorf(codes.Internal, "Could not broadcast signed aggregated attestation: %v", err) } diff --git a/beacon-chain/rpc/validator/aggregator_test.go b/beacon-chain/rpc/validator/aggregator_test.go index 183eaaaf5428..ee01361d8831 100644 --- a/beacon-chain/rpc/validator/aggregator_test.go +++ b/beacon-chain/rpc/validator/aggregator_test.go @@ -95,7 +95,7 @@ func TestSubmitAggregateAndProof_IsAggregatorAndNoAtts(t *testing.T) { t.Fatal(err) } - if _, err := server.SubmitAggregateSelectionProof(ctx, req); !strings.Contains(err.Error(),"No aggregated attestation in beacon node") { + if _, err := server.SubmitAggregateSelectionProof(ctx, req); !strings.Contains(err.Error(), "No aggregated attestation in beacon node") { t.Error("Did not get wanted error") } } diff --git a/validator/client/validator_aggregate.go b/validator/client/validator_aggregate.go index 98ebb46a9b1e..286f46cc2724 100644 --- a/validator/client/validator_aggregate.go +++ b/validator/client/validator_aggregate.go @@ -87,7 +87,6 @@ func (v *validator) SubmitAggregateAndProof(ctx context.Context, slot uint64, pu return } - d, err := v.domainData(ctx, helpers.SlotToEpoch(res.AggregateAndProof.Aggregate.Data.Slot), params.BeaconConfig().DomainAggregateAndProof[:]) if err != nil { log.Errorf("Could not get domain data to sign aggregate and proof: %v", err) @@ -100,9 +99,9 @@ func (v *validator) SubmitAggregateAndProof(ctx context.Context, slot uint64, pu } _, err = v.validatorClient.SubmitSignedAggregateSelectionProof(ctx, ðpb.SignedAggregateSubmitRequest{ - SignedAggregateAndProof: ðpb.SignedAggregateAttestationAndProof{ - Message: res.AggregateAndProof, - Signature: signedRoot[:], + SignedAggregateAndProof: ðpb.SignedAggregateAttestationAndProof{ + Message: res.AggregateAndProof, + Signature: signedRoot[:], }, }) if err != nil { diff --git a/validator/client/validator_aggregate_test.go b/validator/client/validator_aggregate_test.go index 9ebbc9306ad2..48bd50187103 100644 --- a/validator/client/validator_aggregate_test.go +++ b/validator/client/validator_aggregate_test.go @@ -43,10 +43,10 @@ func TestSubmitAggregateAndProof_Ok(t *testing.T) { gomock.Any(), // ctx gomock.AssignableToTypeOf(ðpb.AggregateSelectionRequest{}), ).Return(ðpb.AggregateSelectionResponse{ - AggregateAndProof:ðpb.AggregateAttestationAndProof{ - AggregatorIndex: 0, - Aggregate: ðpb.Attestation{Data:ðpb.AttestationData{}}, - SelectionProof: nil, + AggregateAndProof: ðpb.AggregateAttestationAndProof{ + AggregatorIndex: 0, + Aggregate: ðpb.Attestation{Data: ðpb.AttestationData{}}, + SelectionProof: nil, }, }, nil) diff --git a/validator/internal/beacon_node_validator_service_mock.go b/validator/internal/beacon_node_validator_service_mock.go index 0e6b3ed0f7f5..554384c440dd 100644 --- a/validator/internal/beacon_node_validator_service_mock.go +++ b/validator/internal/beacon_node_validator_service_mock.go @@ -277,6 +277,7 @@ func (mr *MockBeaconNodeValidatorClientMockRecorder) SubmitSignedAggregateSelect varargs := append([]interface{}{arg0, arg1}, arg2...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubmitSignedAggregateSelectionProof", reflect.TypeOf((*MockBeaconNodeValidatorClient)(nil).SubmitSignedAggregateSelectionProof), varargs...) } + // ProposeExit mocks base method func (m *MockBeaconNodeValidatorClient) ProposeExit(ctx context.Context, in *ethpb.SignedVoluntaryExit, opts ...grpc.CallOption) (*ptypes.Empty, error) { m.ctrl.T.Helper()