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 EventTypeMessage emission in custom modules #57

Merged
merged 2 commits into from
Jul 10, 2024

Conversation

poorphd
Copy link

@poorphd poorphd commented Jul 2, 2024

Description

EventTypeMessage events with sdk.AttributeKeyModule and sdk.AttributeKeySender are now emitted directly at message execution (in baseapp). This change removes the redundant boilerplate event emission from all custom modules.

The module name is assumed by baseapp to be the second element of the message route, e.g., "cosmos.bank.v1beta1.MsgSend" -> "bank". For modules that do not follow the standard message path (e.g., IBC), it is advised to continue emitting the module name event. Baseapp only emits the EventTypeMessage event if the module has not already done so.

This refactor ensures cleaner code and leverages the automatic event emission provided by baseapp.

Closes: L-4


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • included the necessary unit and integration tests
  • reviewed "Files changed" and left comments if necessary

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@poorphd poorphd self-assigned this Jul 2, 2024
@poorphd poorphd requested a review from dudong2 July 2, 2024 07:32
EventTypeMessage events with sdk.AttributeKeyModule and sdk.AttributeKeySender are now emitted directly at message execution (in baseapp). This change removes the redundant boilerplate event emission from all custom modules.

The module name is assumed by baseapp to be the second element of the message route, e.g., "cosmos.bank.v1beta1.MsgSend" -> "bank". For modules that do not follow the standard message path (e.g., IBC), it is advised to continue emitting the module name event. Baseapp only emits the EventTypeMessage event if the module has not already done so.

This refactor ensures cleaner code and leverages the automatic event emission provided by baseapp.
@poorphd poorphd force-pushed the patch/issue-L-4 branch from 80f34b3 to 4d8fbbf Compare July 2, 2024 08:35
@dudong2
Copy link

dudong2 commented Jul 2, 2024

There are several event emit in x/<module name>/msg_server.go. We need to remove all event emit with sdk.AttributeKeyModule and sdk.AttributeKeySender(eg. RemoveLiquidity, ...)

@poorphd
Copy link
Author

poorphd commented Jul 2, 2024

removed

@poorphd poorphd marked this pull request as ready for review July 9, 2024 07:33
@poorphd poorphd requested review from dongsam and zsystm July 9, 2024 07:33
Copy link
Member

@dongsam dongsam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, adding the test code improved the review efficiency. Thanks 👍

Copy link

@zsystm zsystm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@poorphd poorphd merged commit 95b582c into v8/develop Jul 10, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

QA Report
4 participants