Skip to content

Commit

Permalink
chore: ensure service module msg responses are non-empty
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanchriswhite committed Dec 1, 2024
1 parent 76d131c commit 6c762ad
Show file tree
Hide file tree
Showing 5 changed files with 240 additions and 82 deletions.
176 changes: 134 additions & 42 deletions api/poktroll/service/tx.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion proto/poktroll/service/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,7 @@ message MsgAddService {
poktroll.shared.Service service = 2 [(gogoproto.nullable) = false]; // The Service being added to the network
}

message MsgAddServiceResponse {}
message MsgAddServiceResponse {
poktroll.shared.Service service = 1;
}

4 changes: 3 additions & 1 deletion x/service/keeper/msg_server_add_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,7 @@ func (k msgServer) AddService(
k.SetService(ctx, msg.Service)

isSuccessful = true
return &types.MsgAddServiceResponse{}, nil
return &types.MsgAddServiceResponse{
Service: &msg.Service,
}, nil
}
3 changes: 2 additions & 1 deletion x/service/keeper/msg_server_add_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ func TestMsgServer_AddService(t *testing.T) {
keepertest.AddAccToAccMapCoins(t, oldServiceOwnerAddr, volatile.DenomuPOKT, oneUPOKTGreaterThanFee)

// Add the service to the store
_, err := srv.AddService(ctx, &types.MsgAddService{
addSvcRes, err := srv.AddService(ctx, &types.MsgAddService{
OwnerAddress: oldServiceOwnerAddr,
Service: oldService,
})
require.NoError(t, err)
require.Equal(t, &oldService, addSvcRes.GetService())

// Validate the service was added
serviceFound, found := k.GetService(ctx, oldService.Id)
Expand Down
Loading

0 comments on commit 6c762ad

Please sign in to comment.