Skip to content

Commit

Permalink
fix(x/intent): QueryActionsByAddress returning one Action multiple ti…
Browse files Browse the repository at this point in the history
…mes (#187)

* fix(x/intent): make QueryActionsByAddressResponse.Actions non-nullable

* fix(x/intent): don't reuse pointer of iterating variable

* chore: changelog
  • Loading branch information
Pitasi authored Apr 17, 2024
1 parent 749112b commit 551e99e
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 125 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Bug Fixes

* (x/intent) [#187](https://github.com/warden-protocol/wardenprotocol/pull/187) Fix QueryActionsByAddress to not reuse the pointer of iterating variable, causing the query to return the same action multiple times

### Misc

* (docs) [#127](https://github.com/warden-protocol/wardenprotocol/pull/127) Add CHANGELOG.md
Expand Down
152 changes: 76 additions & 76 deletions api/warden/intent/query.pulsar.go

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

2 changes: 1 addition & 1 deletion proto/warden/intent/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ message QueryActionsByAddressRequest {

message QueryActionsByAddressResponse {
cosmos.base.query.v1beta1.PageResponse pagination = 1;
repeated Action actions = 2;
repeated Action actions = 2 [ (gogoproto.nullable) = false ];
}

message QueryActionByIdRequest { uint64 id = 1; }
Expand Down
4 changes: 2 additions & 2 deletions warden/x/intent/keeper/query_actions_by_address.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ func (k Keeper) ActionsByAddress(goCtx context.Context, req *types.QueryActionsB
return nil, err
}

var result []*types.Action
var result []types.Action
for _, action := range actions {
if req.Status != types.ActionStatus_ACTION_STATUS_UNSPECIFIED && action.Status != req.Status {
continue
}
result = append(result, &action)
result = append(result, action)
}

return &types.QueryActionsByAddressResponse{
Expand Down
Loading

0 comments on commit 551e99e

Please sign in to comment.