polaris
polaris copied to clipboard
bug(core): events with the same name but different attributes will panic
Cosmos emits events that have the same name but different attributes:
ctx.EventManager().EmitEvent(
sdk.NewEvent(govtypes.EventTypeSubmitProposal,
sdk.NewAttribute(govtypes.AttributeKeyVotingPeriodStart, fmt.Sprintf("%d", proposal.Id)),
),
)
ctx.EventManager().EmitEvent(
sdk.NewEvent(
types.EventTypeSubmitProposal,
sdk.NewAttribute(types.AttributeKeyProposalID, fmt.Sprintf("%d", proposalID)),
sdk.NewAttribute(types.AttributeKeyProposalMessages, msgsStr),
),
)
this case is not handled and will cause the chain to panic.
example :
https://github.com/cosmos/cosmos-sdk/blob/73c806414528f37bc81ff7a31004094e8e91efba/x/gov/keeper/msg_server.go#L73
https://github.com/cosmos/cosmos-sdk/blob/73c806414528f37bc81ff7a31004094e8e91efba/x/gov/keeper/proposal.go#L104
temp fix #558 ignore all attributes on SubmitProposal
event