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(callbacks)!: SendPacket validation bypass and erroneous event emission are fixed #4568

Merged
merged 11 commits into from
Sep 7, 2023

Conversation

srdtrk
Copy link
Member

@srdtrk srdtrk commented Sep 5, 2023

Description

closes: #4566, #4567

Commit Message / Changelog Entry

fix(callbacks)!: SendPacket validation bypass and erroneous event emission are fixed

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.

if callbackData.AllowRetry() {
panic(storetypes.ErrorOutOfGas{Descriptor: fmt.Sprintf("ibc %s callback out of gas; commitGasLimit: %d", callbackType, callbackData.CommitGasLimit)})
}
err = errorsmod.Wrapf(types.ErrCallbackOutOfGas, "ibc %s callback out of gas", callbackType)
Copy link
Contributor

@colin-axner colin-axner Sep 5, 2023

Choose a reason for hiding this comment

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

I guess we are okay overwriting the returned error if the cached context runs of gas?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we have an order of precedence now:

regularErr < panicErr < pastLimitErr

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm okay with that since the panics are likely due to out of gas error anyways

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we update godoc with this order of precedence and behaviour?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added godocs.

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.

Changes LGTM, a little more documentation could be useful. Thank you @srdtrk for the attention to detail! This is a state machine breaking change so will require a v0.2.0 when we backport

if callbackData.AllowRetry() {
panic(storetypes.ErrorOutOfGas{Descriptor: fmt.Sprintf("ibc %s callback out of gas; commitGasLimit: %d", callbackType, callbackData.CommitGasLimit)})
}
err = errorsmod.Wrapf(types.ErrCallbackOutOfGas, "ibc %s callback out of gas", callbackType)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we update godoc with this order of precedence and behaviour?

@srdtrk srdtrk merged commit e192899 into main Sep 7, 2023
59 checks passed
@srdtrk srdtrk deleted the serdar/callbacks-fix-sendpacket-bug branch September 7, 2023 12:02
mergify bot pushed a commit that referenced this pull request Sep 7, 2023
…ssion are fixed (#4568)

* fix: fixed callbacks out of gas handling

* fix: fixed panics and oog errors not showing up on events

* docs(callbacks): added godocs for error precedence

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
(cherry picked from commit e192899)

# Conflicts:
#	modules/apps/callbacks/ibc_middleware.go
mmsqe pushed a commit to mmsqe/ibc-go that referenced this pull request Nov 27, 2023
…ssion are fixed (cosmos#4568)

* fix: fixed callbacks out of gas handling

* fix: fixed panics and oog errors not showing up on events

* docs(callbacks): added godocs for error precedence

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
mergify bot pushed a commit that referenced this pull request Feb 21, 2024
…ssion are fixed (#4568)

* fix: fixed callbacks out of gas handling

* fix: fixed panics and oog errors not showing up on events

* docs(callbacks): added godocs for error precedence

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
(cherry picked from commit e192899)

# Conflicts:
#	modules/apps/callbacks/ibc_middleware.go
srdtrk added a commit that referenced this pull request Mar 22, 2024
…ssion are fixed (backport #4568) (#5881)

* fix(callbacks)!: SendPacket validation bypass and erroneous event emission are fixed (#4568)

* fix: fixed callbacks out of gas handling

* fix: fixed panics and oog errors not showing up on events

* docs(callbacks): added godocs for error precedence

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
(cherry picked from commit e192899)

# Conflicts:
#	modules/apps/callbacks/ibc_middleware.go

* fix conflicts

* fix import

---------

Co-authored-by: srdtrk <59252793+srdtrk@users.noreply.github.com>
Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Callback panics and out of gas errors are not emitted in events
5 participants