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

Revert application state changes on failed acknowledgements #107

Merged
merged 13 commits into from
Apr 12, 2021

Conversation

colin-axner
Copy link
Contributor

@colin-axner colin-axner commented Apr 7, 2021

Description

Thanks @AdityaSripal for the first commits

closes: #91
closes: #68


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.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

@colin-axner
Copy link
Contributor Author

I just need to update developer docs to make this functionality extra clear

Copy link
Member

@AdityaSripal AdityaSripal left a comment

Choose a reason for hiding this comment

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

Looks good, just document requirement that async acks need to handle packet processing more carefully.

Great work @colin-axner!

CHANGELOG.md Outdated Show resolved Hide resolved
The IBC handler will then commit this acknowledgement of the packet so that a relayer may relay the
acknowledgement back to the sender module.

The state changes that occurred during this callback will only be written if:
- the acknowledgement was successful as indicated by the `Success()` function of the acknowledgement
- if the acknowledgement returned is nil indicating that an asynchronous process is occurring
Copy link
Member

Choose a reason for hiding this comment

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

So anyone using async acks will have to take care to revert state themselves. This should be documented

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a note. Going to merge this pr, feel free to open an issue or comment here if you think it could use more information

// state changes should be written via the `Success()` function. Application state
// changes are only written if the acknowledgement is successful or the acknowledgement
// returned is nil indicating that an asynchronous acknowledgement will occur.
ack := processPacket(ctx, packet, packetData)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ack := processPacket(ctx, packet, packetData)
ack := processPacket(ctx, packet)

It's a bit confusing to have both packet and packetData here. For documentation purposes, we can do keep it as above. processPacket is responsible for decoding packetdata

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it is useful to show the app developer they need to decode the packet data, as shown by the line above this one

Going to leave as is since it matches ICS 20


## IBC callback changes

### OnRecvPacket
Copy link
Member

Choose a reason for hiding this comment

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

Big fan of this doc 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Me too! We should continue this for future major version releases

@colin-axner colin-axner enabled auto-merge (squash) April 12, 2021 10:18
@colin-axner colin-axner merged commit e988386 into main Apr 12, 2021
@colin-axner colin-axner deleted the colin/91-revert branch April 12, 2021 10:23
faddat referenced this pull request in notional-labs/ibc-go Feb 23, 2022
Add docs on (un)supported systems
faddat referenced this pull request in notional-labs/ibc-go Mar 1, 2022
Fix typo in demo instructions
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.

OnRecv changes to revert state on failed acknowledgement Non-atomicity of operations
2 participants