mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-24 20:37:17 +00:00
f5cb04012e
* Config * Updated proto * Updated pool * Updated RPC * Updated validator client * run time works * Clean ups * Fix tests * Visibility * Merge branch 'master' of https://github.com/prysmaticlabs/prysm into aggregator * Raul's feedback * Tests for RPC server * Tests for validator client * Span * More tests * Use go routine for SubmitAggregateAndProof * Go routines * Updated comments * Use array of roles * Fixed tests * Build * Update validator/client/runner.go Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com> * Update validator/client/runner.go Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com> * If * Merge branch 'refactor-validator-roles' of https://github.com/prysmaticlabs/prysm into refactor-validator-roles * Empty * Feedback * Merge branch 'master' of https://github.com/prysmaticlabs/prysm into aggregator * Removed proto/eth/v1alpha1/shard_chain.pb.go? * Cleaned up * Revert * Comments * Lint * Comment * Merge branch 'master' into aggregator
47 lines
1.4 KiB
Go
47 lines
1.4 KiB
Go
package client
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/golang/mock/gomock"
|
|
pb "github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1"
|
|
"github.com/prysmaticlabs/prysm/shared/testutil"
|
|
logTest "github.com/sirupsen/logrus/hooks/test"
|
|
)
|
|
|
|
func TestSubmitAggregateAndProof_AssignmentRequestFailure(t *testing.T) {
|
|
hook := logTest.NewGlobal()
|
|
validator, _, finish := setup(t)
|
|
validator.assignments = &pb.AssignmentResponse{ValidatorAssignment: []*pb.AssignmentResponse_ValidatorAssignment{}}
|
|
defer finish()
|
|
|
|
validator.SubmitAggregateAndProof(context.Background(), 0, validatorPubKey)
|
|
|
|
testutil.AssertLogsContain(t, hook, "Could not fetch validator assignment")
|
|
}
|
|
|
|
func TestSubmitAggregateAndProof_Ok(t *testing.T) {
|
|
hook := logTest.NewGlobal()
|
|
validator, m, finish := setup(t)
|
|
defer finish()
|
|
validator.assignments = &pb.AssignmentResponse{ValidatorAssignment: []*pb.AssignmentResponse_ValidatorAssignment{
|
|
{
|
|
PublicKey: validatorKey.PublicKey.Marshal(),
|
|
},
|
|
}}
|
|
|
|
m.validatorClient.EXPECT().DomainData(
|
|
gomock.Any(), // ctx
|
|
gomock.Any(), // epoch
|
|
).Return(&pb.DomainResponse{}, nil /*err*/)
|
|
|
|
m.aggregatorClient.EXPECT().SubmitAggregateAndProof(
|
|
gomock.Any(), // ctx
|
|
gomock.AssignableToTypeOf(&pb.AggregationRequest{}),
|
|
).Return(&pb.AggregationResponse{}, nil)
|
|
|
|
validator.SubmitAggregateAndProof(context.Background(), 0, validatorPubKey)
|
|
testutil.AssertLogsContain(t, hook, "Assigned and submitted aggregation and proof request")
|
|
}
|