Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Update rpc validator exit tests #7122

Merged
merged 7 commits into from
Aug 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion beacon-chain/rpc/validator/exit.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (vs *Server) ProposeExit(ctx context.Context, req *ethpb.SignedVoluntaryExi

r, err := req.Exit.HashTreeRoot()
if err != nil {
return nil, err
return nil, status.Errorf(codes.Internal, "Could not get tree hash of exit: %v", err)
}

return &ethpb.ProposeExitResponse{
Expand Down
10 changes: 8 additions & 2 deletions beacon-chain/rpc/validator/exit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@ func TestSub(t *testing.T) {
req.Signature, err = helpers.ComputeDomainAndSign(beaconState, epoch, req.Exit, params.BeaconConfig().DomainVoluntaryExit, keys[0])
require.NoError(t, err)

_, err = server.ProposeExit(context.Background(), req)
resp, err := server.ProposeExit(context.Background(), req)
require.NoError(t, err)
expectedRoot, err := req.Exit.HashTreeRoot()
require.NoError(t, err)
assert.DeepEqual(t, expectedRoot[:], resp.ExitRoot)

// Ensure the state notification was broadcast.
notificationFound := false
Expand Down Expand Up @@ -142,6 +145,9 @@ func TestProposeExit_NoPanic(t *testing.T) {
require.ErrorContains(t, "invalid signature provided", err, "Expected error for invalid signature length")
req.Signature, err = helpers.ComputeDomainAndSign(beaconState, epoch, req.Exit, params.BeaconConfig().DomainVoluntaryExit, keys[0])
require.NoError(t, err)
_, err = server.ProposeExit(context.Background(), req)
resp, err := server.ProposeExit(context.Background(), req)
require.NoError(t, err)
expectedRoot, err := req.Exit.HashTreeRoot()
require.NoError(t, err)
assert.DeepEqual(t, expectedRoot[:], resp.ExitRoot)
}