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

chore: ics29 fee payee event emission #1568

Merged
merged 2 commits into from
Jun 23, 2022
Merged

Conversation

damiannolan
Copy link
Contributor

Description

  • Emit event for RegisterPayee
  • Emit event for RegisterCounterpartyPayee

closes: #1566


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

Copy link
Contributor

@crodriguezvega crodriguezvega left a comment

Choose a reason for hiding this comment

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

I just left a nit...

Thank you, @damiannolan, for picking up this so quickly!

@@ -39,3 +39,35 @@ func EmitIncentivizedPacketEvent(ctx sdk.Context, packetID channeltypes.PacketId
),
)
}

// EmitRegisteredPayeeEvent emits an event containing information of a registered payee for a relayer on a particular channel
func EmitRegisteredPayeeEvent(ctx sdk.Context, relayer, payee, channelID string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: currently the Emit... functions we have in the code base use a verb in the present tense, therefore should we rename this to EmitRegisterPayeeEvent? I agree with you that event names that signal that something has occurred should have a verb in the past tense, but maybe we can stay consistent for now with the rest of the codebase and refactor the names of all the functions in a separate PR...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I actually thought of this when I added these functions here 😅
The main reason I opted for past tense was because of the existing EmitIncentivizedPacketEvent at the top of the file. I've no problem to update these tho, I'll push an update! 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, true, there was already one Emit... function here like that... I should have caught that one back then; shame on me! ;)

}

// EmitRegisteredCounterpartyPayeeEvent emits an event containing information of a registered counterparty payee for a relayer on a particular channel
func EmitRegisteredCounterpartyPayeeEvent(ctx sdk.Context, relayer, counterpartyPayee, channelID string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same nit.

Copy link
Contributor

@charleenfei charleenfei left a comment

Choose a reason for hiding this comment

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

lgtm!

@@ -2,9 +2,15 @@ package types

// 29-fee events
const (
EventTypeIncentivizedPacket = "incentivized_ibc_packet"
EventTypeIncentivizedPacket = "incentivized_ibc_packet"
EventTypeRegisterPayee = "register_payee"
Copy link
Contributor

Choose a reason for hiding this comment

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

just thinking aloud would there be a benefit to prefixing these events with say ics29_register_payee. In the future, there may be similar events from other modules it might become harder to distinguish?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When we emit events we should always be including the sdk.AttributeKeyModule with the module name as well so it can be correlated like that pretty easily too I guess!

@damiannolan damiannolan merged commit dbd0f77 into main Jun 23, 2022
@damiannolan damiannolan deleted the damian/1566-payee-events branch June 23, 2022 09:46
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.

emit event on RegisterPayee and RegisterCounterpartyPayee rpc handlers
4 participants