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

imp: make event emission functions unexported #3205

Merged
merged 4 commits into from
Feb 28, 2023

Conversation

crodriguezvega
Copy link
Contributor

@crodriguezvega crodriguezvega commented Feb 24, 2023

Description

Most of the event emission functions can be unexported.

closes: #XXXX

Commit Message / Changelog Entry

imp: make event emission functions unexported

see the guidelines for commit messages. (view raw markdown for examples)


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 and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/).
  • Added relevant godoc comments.
  • Provide a commit message to be used for the changelog entry in the PR description for review.
  • Re-reviewed Files changed in the Github PR explorer.
  • Review Codecov Report in the comment section below once CI passes.

@crodriguezvega
Copy link
Contributor Author

I think I could also make EmitAcknowledgementEvent unexported if we implement OnRecvPacket in the controller keeper and move this code from the middleware to the keeper.

@codecov-commenter
Copy link

codecov-commenter commented Feb 24, 2023

Codecov Report

Merging #3205 (c738a0d) into main (0308dc7) will not change coverage.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3205   +/-   ##
=======================================
  Coverage   78.60%   78.60%           
=======================================
  Files         177      177           
  Lines       12420    12420           
=======================================
  Hits         9763     9763           
  Misses       2231     2231           
  Partials      426      426           
Impacted Files Coverage Δ
modules/apps/29-fee/keeper/escrow.go 92.81% <100.00%> (ø)
modules/apps/29-fee/keeper/events.go 100.00% <100.00%> (ø)
modules/apps/29-fee/keeper/msg_server.go 97.14% <100.00%> (ø)
modules/core/02-client/keeper/client.go 94.28% <100.00%> (ø)
modules/core/02-client/keeper/events.go 88.46% <100.00%> (ø)
modules/core/02-client/keeper/proposal.go 80.00% <100.00%> (ø)
modules/core/03-connection/keeper/events.go 100.00% <100.00%> (ø)
modules/core/03-connection/keeper/handshake.go 89.83% <100.00%> (ø)
modules/core/04-channel/keeper/events.go 100.00% <100.00%> (ø)
modules/core/04-channel/keeper/handshake.go 91.47% <100.00%> (ø)
... and 2 more

Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

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

Great idea!

// EmitCreateClientEvent emits a create client event
func EmitCreateClientEvent(ctx sdk.Context, clientID string, clientState exported.ClientState) {
// EmitUpgradeChainEvent emits an upgrade chain event.
func EmitUpgradeChainEvent(ctx sdk.Context, height int64) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason this is still public?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one I couldn't change because is used here. But maybe there's also a way around, if we can move the event emission inside SetUpgradedConsensusState?

Copy link
Contributor

@colin-axner colin-axner Feb 27, 2023

Choose a reason for hiding this comment

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

I think it might be a good idea to move all our begin blocker actions to the keeper directory (within abci.go).

func (k Keeper) BeginBlocker(ctx sdk.Context) {
    // functionality
}
// within ibc module.go
func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {
	am.keeper.ClientKeeper.BeginBlocker(ctx)
}

@colin-axner colin-axner requested a review from chatton February 27, 2023 12:54
Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

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

We can handle EmitUpgradeChainEvent in a followup if we decide to make changes. I would prefer it to be moved back to the bottom of the file in that case. Otherwise, the changes look great to me!

Copy link
Contributor

@chatton chatton left a comment

Choose a reason for hiding this comment

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

LGTM

@crodriguezvega crodriguezvega merged commit fa10438 into main Feb 28, 2023
@crodriguezvega crodriguezvega deleted the carlos/unexported-emit-event-functions branch February 28, 2023 12:01
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.

4 participants