-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Summary
Many modules define ad-hoc events in the message server, that (in a boilerplate fashion) encode the message type, source module, and sender. These are not standardized by code.
Problem Definition
~Every message has the following event defined in the message server
Staking Redelegate:
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
sdk.NewAttribute(sdk.AttributeKeySender, msg.DelegatorAddress),
),Gov vote
ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
sdk.NewAttribute(sdk.AttributeKeySender, msg.Voter),
),
)Osmosis swap
ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender),
),
})The only exception I can see for where this isn't done is authz exec txs.
Proposal
Notice that in ~all cases checked types.AttributeValueCategory = types.ModuleName. The abstraction over msg.Sender, msg.Voter, and msg.DelegatorAddress is basically msg.GetSigners()[0].
We should adapt the event defined here: https://github.com/cosmos/cosmos-sdk/blob/main/x/auth/middleware/run_msgs.go#L91-L93 in the case that this is a non-legacy message. I believe that types.ModuleName is metadata that should be communicatable in the message service registration, and retrievable there.
Then we can delete this event from every msg server.
For Admin Use
- Not duplicate issue
- Appropriate labels applied
- Appropriate contributors tagged
- Contributor assigned/self-assigned