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 calls based on required error success in broadcast message. #3475

Conversation

DimitrisJim
Copy link
Contributor

@DimitrisJim DimitrisJim commented Apr 18, 2023

Description

closes: #3435

Commit Message / Changelog Entry

imp: refactor calls based on required error success in broadcast message.

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.

e2e/testsuite/tx.go Outdated Show resolved Hide resolved
e2e/testsuite/tx.go Outdated Show resolved Hide resolved
} else {
s.Require().Equal(uint32(2), transferTxResp.Code)
s.Require().Contains(transferTxResp.RawLog, "errUnknownField")
s.Require().Contains("errUnknownField", transferTxResp.RawLog)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

as far as I could tell this is coming from unknownproto in the sdk, couldn't find a registered error for it elsewhere.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's correct. I can't remember exactly where the SDK is constructing the returned error. The test is passing a sdk.Msg with an extra field the chain doesn't understand, so when it tries to unmarshal the sdk.Msg, the unknown field error is returned. I think it's fine to leave as is. It would be nice if we knew the root error though. I wonder if it is this error. Ah I think I found it!

Is the updated change the right ordering? Looks like the Contains godoc has the elem in question as the second argument?

@DimitrisJim DimitrisJim force-pushed the 3435-e2e-replace-assertvalidtxresponse-and-error-check-with-assertsuccesstx-or-assertfailedtx branch from 5ba660d to 8acc156 Compare April 24, 2023 08:09
@DimitrisJim DimitrisJim force-pushed the 3435-e2e-replace-assertvalidtxresponse-and-error-check-with-assertsuccesstx-or-assertfailedtx branch from 8acc156 to 54d245e Compare April 24, 2023 08:28
@DimitrisJim DimitrisJim marked this pull request as ready for review April 24, 2023 08:47
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.

Nice work!! Left minor comments, but otherwise everything looks great to me :)

e2e/tests/transfer/base_test.go Outdated Show resolved Hide resolved
} else {
s.Require().Equal(uint32(2), transferTxResp.Code)
s.Require().Contains(transferTxResp.RawLog, "errUnknownField")
s.Require().Contains("errUnknownField", transferTxResp.RawLog)
Copy link
Contributor

Choose a reason for hiding this comment

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

That's correct. I can't remember exactly where the SDK is constructing the returned error. The test is passing a sdk.Msg with an extra field the chain doesn't understand, so when it tries to unmarshal the sdk.Msg, the unknown field error is returned. I think it's fine to leave as is. It would be nice if we knew the root error though. I wonder if it is this error. Ah I think I found it!

Is the updated change the right ordering? Looks like the Contains godoc has the elem in question as the second argument?

e2e/testsuite/tx.go Outdated Show resolved Hide resolved
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.

ACK, thanks @DimitrisJim!

e2e/tests/transfer/authz_test.go Outdated Show resolved Hide resolved
…rror-check-with-assertsuccesstx-or-assertfailedtx
DimitrisJim and others added 3 commits May 3, 2023 23:07
…rror-check-with-assertsuccesstx-or-assertfailedtx
…rror-check-with-assertsuccesstx-or-assertfailedtx
…rror-check-with-assertsuccesstx-or-assertfailedtx
@DimitrisJim
Copy link
Contributor Author

note: would be nice if #3552 is handled first in order to get the tests that require specific errors from there to use them here, see #3475 (comment)

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.

Thanks @DimitrisJim 🙏

…rror-check-with-assertsuccesstx-or-assertfailedtx
@DimitrisJim DimitrisJim enabled auto-merge (squash) May 17, 2023 19:51
@DimitrisJim DimitrisJim merged commit b21014e into main May 17, 2023
@DimitrisJim DimitrisJim deleted the 3435-e2e-replace-assertvalidtxresponse-and-error-check-with-assertsuccesstx-or-assertfailedtx branch May 17, 2023 19:57
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.

e2e: Replace AssertValidTxResponse and error check with AssertSuccessTx or AssertFailedTx
5 participants