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: change sdk.Events usage to []abci.Event #3980

Merged
merged 4 commits into from
Jul 3, 2023

Conversation

colin-axner
Copy link
Contributor

@colin-axner colin-axner commented Jun 28, 2023

Description

Note: When changing from *sdk.Result to *abci.ExecTxResult, GetEvents() would have begun returning []abci.Event, but I decided to pull out these changes anyways to reduce the burden of "why is this changing" on reviewers when reviewing the update to SDK v0.50

Let me know if you think this deserves a changelog even if no code changes would need to be made by downstream users since they would update to this change at the same time as the SDK bump

closes: #3979

Commit Message / Changelog Entry

refactor!: testing pkg event helper function now take []abci.Event instead of sdk.Events as an argument

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.

@@ -163,7 +163,7 @@ func (suite *KeeperTestSuite) TestDistributeFeeEvent() {
sdk.NewAttribute(types.AttributeKeyReceiver, suite.chainA.SenderAccount.GetAddress().String()),
sdk.NewAttribute(types.AttributeKeyFee, defaultTimeoutFee.String()),
),
}
}.ToABCIEvents()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

for convenience I left as is and called ToABCIEvents() since sdk.Events is just a wrapper around []abci.Event

@@ -6,7 +6,7 @@ import (

"github.com/stretchr/testify/suite"

sdk "github.com/cosmos/cosmos-sdk/types"
abci "github.com/cometbft/cometbft/abci/types"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

seems like we have slight inconsistency between abci alias and abcitypes alias. I think I prefer abci just because there is no go file at that level https://github.com/cometbft/cometbft/tree/main/abci, but I don't have a strong preference. We can make consistent in a followup

Copy link
Member

Choose a reason for hiding this comment

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

I like abci

Copy link
Member

@damiannolan damiannolan left a comment

Choose a reason for hiding this comment

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

Nice, looks pretty clean to me! I think we're using ParsePacketFromEvents() in e2e as well and CI builds look like they're failing. Should be an easy enough fix I think :)

@@ -6,7 +6,7 @@ import (

"github.com/stretchr/testify/suite"

sdk "github.com/cosmos/cosmos-sdk/types"
abci "github.com/cometbft/cometbft/abci/types"
Copy link
Member

Choose a reason for hiding this comment

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

I like abci

@colin-axner
Copy link
Contributor Author

Nice, looks pretty clean to me! I think we're using ParsePacketFromEvents() in e2e as well and CI builds look like they're failing. Should be an easy enough fix I think :)

oh yea! My bad. Fixed :)

@codecov-commenter
Copy link

Codecov Report

Merging #3980 (5a0e9e8) into main (6fcedca) will not change coverage.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3980   +/-   ##
=======================================
  Coverage   78.84%   78.84%           
=======================================
  Files         187      187           
  Lines       12950    12950           
=======================================
  Hits        10211    10211           
  Misses       2311     2311           
  Partials      428      428           
Impacted Files Coverage Δ
.../apps/27-interchain-accounts/host/keeper/keeper.go 87.39% <ø> (ø)
modules/core/04-channel/keeper/handshake.go 89.50% <ø> (ø)
.../apps/27-interchain-accounts/host/client/cli/tx.go 29.70% <100.00%> (ø)
...s/apps/27-interchain-accounts/host/keeper/relay.go 71.08% <100.00%> (ø)
modules/apps/27-interchain-accounts/types/codec.go 79.54% <100.00%> (ø)

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.

nice! it'll definitely be good to cut down the file changes for sdk 50!

@faddat
Copy link
Contributor

faddat commented Jul 2, 2023

@charleenfei I agree. Definitely think this is a helpful change.

@faddat faddat mentioned this pull request Jul 2, 2023
9 tasks
@colin-axner colin-axner enabled auto-merge (squash) July 3, 2023 10:29
@colin-axner colin-axner merged commit dffc7b7 into main Jul 3, 2023
@colin-axner colin-axner deleted the colin/3979-events-to-abcievent branch July 3, 2023 10:35
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.

Use []abci.Event instead of sdk.Events in argument to testing pkg event parsing functions
7 participants