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

fix!: Ensure Handler Exists for Messages #16613

Merged
merged 4 commits into from
Jun 19, 2023
Merged

fix!: Ensure Handler Exists for Messages #16613

merged 4 commits into from
Jun 19, 2023

Conversation

alexanderbez
Copy link
Contributor

Description

Closes: #16610

Update runTx to ensure each message has a registered handler.


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...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

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 the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • 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)

Comment on lines 832 to +838
return sdk.GasInfo{}, nil, nil, err
}

for _, msg := range msgs {
handler := app.msgServiceRouter.Handler(msg)
if handler == nil {
return sdk.GasInfo{}, nil, nil, errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "no message handler found for %T", msg)
Copy link
Contributor

Choose a reason for hiding this comment

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

Change potentially affects state.

Call sequence:

(*github.com/cosmos/cosmos-sdk/baseapp.BaseApp).runTx (baseapp/baseapp.go:778)
(*github.com/cosmos/cosmos-sdk/baseapp.BaseApp).deliverTx (baseapp/baseapp.go:708)
(*github.com/cosmos/cosmos-sdk/baseapp.BaseApp).FinalizeBlock (baseapp/baseapp.go:648)

@alexanderbez alexanderbez marked this pull request as ready for review June 19, 2023 20:15
@alexanderbez alexanderbez requested a review from a team as a code owner June 19, 2023 20:15
@alexanderbez alexanderbez added the backport/v0.50.x PR scheduled for inclusion in the v0.50's next stable release label Jun 19, 2023
Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

utACK.

@alexanderbez alexanderbez added this pull request to the merge queue Jun 19, 2023
Merged via the queue into main with commit 6f9152d Jun 19, 2023
@alexanderbez alexanderbez deleted the bez/16610 branch June 19, 2023 21:41
mergify bot pushed a commit that referenced this pull request Jun 19, 2023
(cherry picked from commit 6f9152d)

# Conflicts:
#	CHANGELOG.md
julienrbrt added a commit that referenced this pull request Jun 19, 2023
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

While simple could we add a test case or two

@alexanderbez
Copy link
Contributor Author

The tests I modified ensure a handler exists, otherwise they would fail. Happy to add more explicit tests though!

@tac0turtle
Copy link
Member

oh sorry github pointed me to one file changed instead of four

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v0.50.x PR scheduled for inclusion in the v0.50's next stable release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CheckTx flow does not check if the handler exists for a given message
3 participants