Skip to content

Commit

Permalink
fix: wrong address set in EventUpdateGroupPolicy (#14526)
Browse files Browse the repository at this point in the history
(cherry picked from commit 3729243)

# Conflicts:
#	CHANGELOG.md
  • Loading branch information
julienrbrt authored and mergify[bot] committed Jan 7, 2023
1 parent 0a1d0b9 commit 004c640
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,18 @@ Ref: https://keepachangelog.com/en/1.0.0/
* [#13794](https://github.com/cosmos/cosmos-sdk/pull/13794) `types/module.Manager` now supports the
`cosmossdk.io/core/appmodule.AppModule` API via the new `NewManagerFromMap` constructor.
* [#14019](https://github.com/cosmos/cosmos-sdk/issues/14019) Remove the interface casting to allow other implementations of a `CommitMultiStore`.
<<<<<<< HEAD
* [#14175](https://github.com/cosmos/cosmos-sdk/pull/14175) Add `server.DefaultBaseappOptions(appopts)` function to reduce boiler plate in root.go.
=======
* [#13881](https://github.com/cosmos/cosmos-sdk/pull/13881) Optimize iteration on nested cached KV stores and other operations in general.
* (x/gov) [#14347](https://github.com/cosmos/cosmos-sdk/pull/14347) Support `v1.Proposal` message in `v1beta1.Proposal.Content`.
* (x/gov) [#14390](https://github.com/cosmos/cosmos-sdk/pull/14390) Add title, proposer and summary to proposal struct
* (baseapp) [#14417](https://github.com/cosmos/cosmos-sdk/pull/14417) `SetStreamingService` accepts appOptions, AppCodec and Storekeys needed to set streamers.
* Store pacakge no longer has a dependency on baseapp.
* (store) [#14438](https://github.com/cosmos/cosmos-sdk/pull/14438) Pass logger from baseapp to store.
* (store) [#14439](https://github.com/cosmos/cosmos-sdk/pull/14439) Remove global metric gatherer from store.
* By default store has a no op metric gatherer, the application developer must set another metric gatherer or us the provided one in `store/metrics`.
>>>>>>> 37292437c (fix: wrong address set in `EventUpdateGroupPolicy` (#14526))
### State Machine Breaking

Expand Down Expand Up @@ -252,7 +263,15 @@ extension interfaces. `module.Manager.Modules` is now of type `map[string]interf

### Bug Fixes

<<<<<<< HEAD
* (x/auth) [#13838](https://github.com/cosmos/cosmos-sdk/pull/13838) Fix calling `String()` and `MarshalYAML` panics when pubkey is set on a `BaseAccount`.
=======
* (x/group) [#](https://github.com/cosmos/cosmos-sdk/pull) Fix wrong address set in `EventUpdateGroupPolicy`.
* (server) [#14441](https://github.com/cosmos/cosmos-sdk/pull/14441) Fix `--log_format` flag not working.
* (x/upgrade) [#13936](https://github.com/cosmos/cosmos-sdk/pull/13936) Make downgrade verification work again
* (x/group) [#13742](https://github.com/cosmos/cosmos-sdk/pull/13742) Fix `validate-genesis` when group policy accounts exist.
* (x/auth) [#13838](https://github.com/cosmos/cosmos-sdk/pull/13838) Fix calling `String()` when pubkey is set on a `BaseAccount`.
>>>>>>> 37292437c (fix: wrong address set in `EventUpdateGroupPolicy` (#14526))
* (rosetta) [#13583](https://github.com/cosmos/cosmos-sdk/pull/13583) Misc fixes for cosmos-rosetta.
* (x/evidence) [#13740](https://github.com/cosmos/cosmos-sdk/pull/13740) Fix evidence query API to decode the hash properly.
* (bank) [#13691](https://github.com/cosmos/cosmos-sdk/issues/13691) Fix unhandled error for vesting account transfers, when total vesting amount exceeds total balance.
Expand Down
23 changes: 23 additions & 0 deletions x/group/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,9 @@ func (s *TestSuite) TestUpdateGroupMetadata() {
res, err := s.groupKeeper.GroupInfo(ctx, &group.QueryGroupInfoRequest{GroupId: groupID})
s.Require().NoError(err)
s.Assert().Equal(spec.expStored, res.Info)

events := sdkCtx.EventManager().ABCIEvents()
s.Require().Len(events, 1) // EventUpdateGroup
})
}
}
Expand Down Expand Up @@ -777,6 +780,9 @@ func (s *TestSuite) TestUpdateGroupMembers() {
s.Assert().Equal(spec.expMembers[i].Member.AddedAt, loadedMembers[i].Member.AddedAt)
s.Assert().Equal(spec.expMembers[i].GroupId, loadedMembers[i].GroupId)
}

events := sdkCtx.EventManager().ABCIEvents()
s.Require().Len(events, 1) // EventUpdateGroup
})
}
}
Expand Down Expand Up @@ -1312,11 +1318,28 @@ func (s *TestSuite) TestUpdateGroupPolicyMetadata() {
return
}
s.Require().NoError(err)

res, err := s.groupKeeper.GroupPolicyInfo(s.ctx, &group.QueryGroupPolicyInfoRequest{
Address: groupPolicyAddr,
})
s.Require().NoError(err)
s.Assert().Equal(spec.expGroupPolicy, res.Info)

// check events
var hasUpdateGroupPolicyEvent bool
events := s.ctx.(sdk.Context).EventManager().ABCIEvents()
for _, event := range events {
event, err := sdk.ParseTypedEvent(event)
s.Require().NoError(err)

if e, ok := event.(*group.EventUpdateGroupPolicy); ok {
s.Require().Equal(e.Address, groupPolicyAddr)
hasUpdateGroupPolicyEvent = true
break
}
}

s.Require().True(hasUpdateGroupPolicyEvent)
})
}
}
Expand Down
3 changes: 1 addition & 2 deletions x/group/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -921,8 +921,7 @@ func (k Keeper) doUpdateGroupPolicy(ctx sdk.Context, groupPolicy string, admin s
return err
}

err = ctx.EventManager().EmitTypedEvent(&group.EventUpdateGroupPolicy{Address: admin})
if err != nil {
if err = ctx.EventManager().EmitTypedEvent(&group.EventUpdateGroupPolicy{Address: groupPolicyInfo.Address}); err != nil {
return err
}

Expand Down

0 comments on commit 004c640

Please sign in to comment.