Skip to content

Commit

Permalink
[Code Health] Ensure tokenomics module msg responses are non-empty (#975
Browse files Browse the repository at this point in the history
)

## Summary

Ensure all supplier module msg responses are non-empty. This adds a
`Params` field to the following protobuf type(s), and updates the unit
tests to assert for presence and correctness.

- `MsgUpdateParamsResponse`

## Issue

- #663

## Type of change

Select one or more from the following:

- [ ] New feature, functionality or library
- [ ] Consensus breaking; add the `consensus-breaking` label if so. See
#791 for details
- [ ] Bug fix
- [x] Code health or cleanup
- [ ] Documentation
- [ ] Other (specify)

## Testing

- [ ] **Documentation**: `make docusaurus_start`; only needed if you
make doc changes
- [ ] **Unit Tests**: `make go_develop_and_test`
- [ ] **LocalNet E2E Tests**: `make test_e2e`
- [ ] **DevNet E2E Tests**: Add the `devnet-test-e2e` label to the PR.

## Sanity Checklist

- [x] I have tested my changes using the available tooling
- [ ] I have commented my code
- [x] I have performed a self-review of my own code; both comments &
source code
- [ ] I create and reference any new tickets, if applicable
- [ ] I have left TODOs throughout the codebase, if applicable
  • Loading branch information
bryanchriswhite authored Dec 9, 2024
1 parent 3faea85 commit 0376986
Show file tree
Hide file tree
Showing 7 changed files with 274 additions and 113 deletions.
6 changes: 4 additions & 2 deletions api/poktroll/application/query.pulsar.go

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

230 changes: 161 additions & 69 deletions api/poktroll/tokenomics/tx.pulsar.go

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion proto/poktroll/tokenomics/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ message MsgUpdateParams {

// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
message MsgUpdateParamsResponse {}
message MsgUpdateParamsResponse {
Params params = 1;
}

// MsgUpdateParam is the Msg/UpdateParam request type to update a single param.
message MsgUpdateParam {
Expand Down
6 changes: 4 additions & 2 deletions x/application/types/query.pb.go

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

4 changes: 3 additions & 1 deletion x/tokenomics/keeper/msg_update_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@ func (k msgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams)

logger.Info("Done updating params")

return &types.MsgUpdateParamsResponse{}, nil
return &types.MsgUpdateParamsResponse{
Params: &msg.Params,
}, nil
}
3 changes: 2 additions & 1 deletion x/tokenomics/keeper/msg_update_params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,12 @@ func TestMsgUpdateParams(t *testing.T) {

for _, test := range tests {
t.Run(test.desc, func(t *testing.T) {
_, err := srv.UpdateParams(ctx, test.req)
updateRes, err := srv.UpdateParams(ctx, test.req)
if test.shouldError {
require.Error(t, err)
require.ErrorContains(t, err, test.expectedErrMsg)
} else {
require.Equal(t, &test.req.Params, updateRes.GetParams())
require.Nil(t, err)
}
})
Expand Down
134 changes: 97 additions & 37 deletions x/tokenomics/types/tx.pb.go

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

0 comments on commit 0376986

Please sign in to comment.