Skip to content

Commit

Permalink
Removes emitting of sdk.EventTypeMessage (#1933)
Browse files Browse the repository at this point in the history
* Update changelog.

* Remove emitting of EventTypeMessage.
  • Loading branch information
Taztingo authored Apr 16, 2024
1 parent 8256904 commit bb43132
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 167 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* Bump the SDK to `v0.50.5-pio-1` (from an earlier ephemeral version) [#1897](https://github.com/provenance-io/provenance/pull/1897).
* Removed `rewards` module [#1905](https://github.com/provenance-io/provenance/pull/1905).
* Remove unused navs [#1920](https://github.com/provenance-io/provenance/issues/1920).
* Remove emitting of EventTypeMessage [#1760](https://github.com/provenance-io/provenance/issues/1760).
* Update genutil for sdk 50 [#1760](https://github.com/provenance-io/provenance/issues/1760).
* Migrate module params from param space to module store.
* Attribute module param migration [#1927](https://github.com/provenance-io/provenance/pull/1927)
Expand Down
4 changes: 0 additions & 4 deletions internal/handlers/msg_service_router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1125,10 +1125,6 @@ func CreateSendCoinEvents(fromAddress, toAddress string, amt sdk.Coins) []abci.E
sdk.NewAttribute(banktypes.AttributeKeySender, fromAddress),
sdk.NewAttribute(sdk.AttributeKeyAmount, amt.String()),
))
events = events.AppendEvent(sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(banktypes.AttributeKeySender, fromAddress),
))

return events.ToABCIEvents()
}
119 changes: 0 additions & 119 deletions x/marker/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,6 @@ func (k msgServer) AddMarker(goCtx context.Context, msg *types.MsgAddMarkerReque
}
}

ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
),
)

return &types.MsgAddMarkerResponse{}, nil
}

Expand All @@ -153,13 +146,6 @@ func (k msgServer) AddAccess(goCtx context.Context, msg *types.MsgAddAccessReque
}
}

ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
),
)

return &types.MsgAddAccessResponse{}, nil
}

Expand Down Expand Up @@ -198,13 +184,6 @@ func (k msgServer) Finalize(goCtx context.Context, msg *types.MsgFinalizeRequest
return nil, sdkerrors.ErrInvalidRequest.Wrap(err.Error())
}

ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
),
)

return &types.MsgFinalizeResponse{}, nil
}

Expand All @@ -221,13 +200,6 @@ func (k msgServer) Activate(goCtx context.Context, msg *types.MsgActivateRequest
return nil, sdkerrors.ErrInvalidRequest.Wrap(err.Error())
}

ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
),
)

return &types.MsgActivateResponse{}, nil
}

Expand All @@ -244,13 +216,6 @@ func (k msgServer) Cancel(goCtx context.Context, msg *types.MsgCancelRequest) (*
return nil, sdkerrors.ErrInvalidRequest.Wrap(err.Error())
}

ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
),
)

return &types.MsgCancelResponse{}, nil
}

Expand All @@ -267,13 +232,6 @@ func (k msgServer) Delete(goCtx context.Context, msg *types.MsgDeleteRequest) (*
return nil, sdkerrors.ErrInvalidRequest.Wrap(err.Error())
}

ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
),
)

return &types.MsgDeleteResponse{}, nil
}

Expand All @@ -290,13 +248,6 @@ func (k msgServer) Mint(goCtx context.Context, msg *types.MsgMintRequest) (*type
return nil, sdkerrors.ErrInvalidRequest.Wrap(err.Error())
}

ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
),
)

defer func() {
telemetry.IncrCounterWithLabels(
[]string{types.ModuleName, types.EventTelemetryKeyMint},
Expand Down Expand Up @@ -331,13 +282,6 @@ func (k msgServer) Burn(goCtx context.Context, msg *types.MsgBurnRequest) (*type
return nil, sdkerrors.ErrInvalidRequest.Wrap(err.Error())
}

ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
),
)

defer func() {
telemetry.IncrCounterWithLabels(
[]string{types.ModuleName, types.EventTelemetryKeyBurn},
Expand Down Expand Up @@ -378,13 +322,6 @@ func (k msgServer) Withdraw(goCtx context.Context, msg *types.MsgWithdrawRequest
return nil, sdkerrors.ErrInvalidRequest.Wrap(err.Error())
}

ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
),
)

defer func() {
telemetry.IncrCounterWithLabels(
[]string{types.ModuleName, types.EventTelemetryKeyWithdraw},
Expand Down Expand Up @@ -438,13 +375,6 @@ func (k msgServer) Transfer(goCtx context.Context, msg *types.MsgTransferRequest
return nil, err
}

ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
),
)

defer func() {
telemetry.IncrCounterWithLabels(
[]string{types.ModuleName, types.EventTelemetryKeyTransfer},
Expand Down Expand Up @@ -493,13 +423,6 @@ func (k msgServer) IbcTransfer(goCtx context.Context, msg *types.MsgIbcTransferR
return nil, err
}

ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
),
)

defer func() {
telemetry.IncrCounterWithLabels(
[]string{types.ModuleName, types.EventTelemetryKeyIbcTransfer},
Expand Down Expand Up @@ -545,13 +468,6 @@ func (k msgServer) SetDenomMetadata(
return nil, err
}

ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
),
)

return &types.MsgSetDenomMetadataResponse{}, nil
}

Expand Down Expand Up @@ -611,13 +527,6 @@ func (k msgServer) AddFinalizeActivateMarker(goCtx context.Context, msg *types.M
return nil, sdkerrors.ErrInvalidRequest.Wrap(err.Error())
}

ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
),
)

return &types.MsgAddFinalizeActivateMarkerResponse{}, nil
}

Expand Down Expand Up @@ -689,13 +598,6 @@ func (k msgServer) UpdateRequiredAttributes(goCtx context.Context, msg *types.Ms
m.SetRequiredAttributes(reqAttrs)
k.SetMarker(ctx, m)

ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
),
)

return &types.MsgUpdateRequiredAttributesResponse{}, nil
}

Expand Down Expand Up @@ -726,13 +628,6 @@ func (k msgServer) UpdateForcedTransfer(goCtx context.Context, msg *types.MsgUpd
marker.SetAllowForcedTransfer(msg.AllowForcedTransfer)
k.SetMarker(ctx, marker)

ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
),
)

return &types.MsgUpdateForcedTransferResponse{}, nil
}

Expand Down Expand Up @@ -807,13 +702,6 @@ func (k msgServer) UpdateSendDenyList(goCtx context.Context, msg *types.MsgUpdat
k.AddSendDeny(ctx, markerAddr, denyAddr)
}

ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
),
)

return &types.MsgUpdateSendDenyListResponse{}, nil
}

Expand All @@ -840,12 +728,5 @@ func (k msgServer) AddNetAssetValues(goCtx context.Context, msg *types.MsgAddNet
return nil, sdkerrors.ErrInvalidRequest.Wrap(err.Error())
}

ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
),
)

return &types.MsgAddNetAssetValuesResponse{}, nil
}
11 changes: 0 additions & 11 deletions x/marker/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,17 +509,6 @@ func (s *MsgServerTestSuite) TestUpdateForcedTransfer() {
allowsForcedTransfer := markerNow.AllowsForcedTransfer()
s.Assert().Equal(tc.msg.AllowForcedTransfer, allowsForcedTransfer, "AllowsForcedTransfer after UpdateForcedTransfer")
}

expEvents := sdk.Events{
{
Type: sdk.EventTypeMessage,
Attributes: []abci.EventAttribute{
{Key: sdk.AttributeKeyModule, Value: types.ModuleName},
},
},
}
events := em.Events()
s.Assert().Equal(expEvents, events, "events emitted during UpdateForcedTransfer")
}
})
}
Expand Down
7 changes: 0 additions & 7 deletions x/metadata/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -761,12 +761,5 @@ func (k msgServer) AddNetAssetValues(goCtx context.Context, msg *types.MsgAddNet
return nil, sdkerrors.ErrInvalidRequest.Wrap(err.Error())
}

ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
),
)

return &types.MsgAddNetAssetValuesResponse{}, nil
}
14 changes: 0 additions & 14 deletions x/oracle/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ func (s msgServer) UpdateOracle(goCtx context.Context, msg *types.MsgUpdateOracl

s.Keeper.SetOracle(ctx, sdk.MustAccAddressFromBech32(msg.Address))

ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
),
)

return &types.MsgUpdateOracleResponse{}, nil
}

Expand All @@ -50,13 +43,6 @@ func (s msgServer) SendQueryOracle(goCtx context.Context, msg *types.MsgSendQuer
return nil, err
}

ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
),
)

return &types.MsgSendQueryOracleResponse{
Sequence: seq,
}, nil
Expand Down
13 changes: 1 addition & 12 deletions x/oracle/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ import (

func (s *KeeperTestSuite) TestUpdateOracle() {
authority := s.app.OracleKeeper.GetAuthority()
event := sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
)

tests := []struct {
name string
Expand All @@ -37,8 +33,7 @@ func (s *KeeperTestSuite) TestUpdateOracle() {
Address: "cosmos1w6t0l7z0yerj49ehnqwqaayxqpe3u7e23edgma",
Authority: authority,
},
res: &types.MsgUpdateOracleResponse{},
event: &event,
res: &types.MsgUpdateOracleResponse{},
},
}

Expand Down Expand Up @@ -67,11 +62,6 @@ func (s *KeeperTestSuite) TestUpdateOracle() {
}

func (s *KeeperTestSuite) TestSendQueryOracle() {
event := sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
)

s.app.OracleKeeper = s.app.OracleKeeper.WithMockICS4Wrapper(keeper.MockICS4Wrapper{})
s.app.OracleKeeper = s.app.OracleKeeper.WithMockScopedKeeper(keeper.MockScopedKeeper{})

Expand Down Expand Up @@ -103,7 +93,6 @@ func (s *KeeperTestSuite) TestSendQueryOracle() {
res: &types.MsgSendQueryOracleResponse{
Sequence: 1,
},
event: &event,
mockChannel: true,
},
}
Expand Down

0 comments on commit bb43132

Please sign in to comment.