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

refactor: remove redundant granter from x/foundation events #757

Merged
merged 2 commits into from
Oct 26, 2022
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/foundation) [\#744](https://github.com/line/lbm-sdk/pull/744) revisit foundation operator
* (store,x/wasm) [\#742](https://github.com/line/lbm-sdk/pull/742) fix to add error message in GetByteCode()
* (amino) [\#745](https://github.com/line/lbm-sdk/pull/745) apply the missing amino codec of `x/token`, `x/collection`, `x/wasm` and `x/foundation`
* (x/foundation) [\#757](https://github.com/line/lbm-sdk/pull/757) remove redundant granter from x/foundation events

### Bug Fixes
* (x/wasm) [\#453](https://github.com/line/lbm-sdk/pull/453) modify wasm grpc query api path
Expand Down
2 changes: 0 additions & 2 deletions docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -17122,7 +17122,6 @@ EventGrant is emitted on Msg/Grant

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `granter` | [string](#string) | | |
| `grantee` | [string](#string) | | the address of the grantee. |
| `authorization` | [google.protobuf.Any](#google.protobuf.Any) | | authorization granted. |

Expand Down Expand Up @@ -17154,7 +17153,6 @@ EventRevoke is emitted on Msg/Revoke

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `granter` | [string](#string) | | |
| `grantee` | [string](#string) | | address of the grantee. |
| `msg_type_url` | [string](#string) | | message type url for which an autorization is revoked. |

Expand Down
10 changes: 4 additions & 6 deletions proto/lbm/foundation/v1/event.proto
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,19 @@ message EventLeaveFoundation {

// EventGrant is emitted on Msg/Grant
message EventGrant {
string granter = 1;
// the address of the grantee.
string grantee = 2;
string grantee = 1;
// authorization granted.
google.protobuf.Any authorization = 3
google.protobuf.Any authorization = 2
[(cosmos_proto.accepts_interface) = "github.com/line/lbm-sdk/x/authz.Authorization"];
}

// EventRevoke is emitted on Msg/Revoke
message EventRevoke {
string granter = 1;
// address of the grantee.
string grantee = 2;
string grantee = 1;
// message type url for which an autorization is revoked.
string msg_type_url = 3;
string msg_type_url = 2;
}

// EventGovMint is an event emitted when the minter mint coins to the treasury.
Expand Down
212 changes: 55 additions & 157 deletions x/foundation/event.pb.go

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

6 changes: 0 additions & 6 deletions x/foundation/keeper/grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ func (k Keeper) Grant(ctx sdk.Context, grantee sdk.AccAddress, authorization fou
return err
}

// TODO: remove granter from the event proto.
granter := foundation.ModuleName
if err := ctx.EventManager().EmitTypedEvent(&foundation.EventGrant{
Granter: granter,
Grantee: grantee.String(),
Authorization: any,
}); err != nil {
Expand All @@ -42,10 +39,7 @@ func (k Keeper) Revoke(ctx sdk.Context, grantee sdk.AccAddress, msgTypeURL strin
}
k.deleteAuthorization(ctx, grantee, msgTypeURL)

// TODO: remove granter from the event proto.
granter := foundation.ModuleName
if err := ctx.EventManager().EmitTypedEvent(&foundation.EventRevoke{
Granter: granter,
Grantee: grantee.String(),
MsgTypeUrl: msgTypeURL,
}); err != nil {
Expand Down