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

Create a RevertContext to pass to onRevert #310

Closed
Tracked by #258
lumtis opened this issue Aug 11, 2024 · 0 comments · Fixed by #305
Closed
Tracked by #258

Create a RevertContext to pass to onRevert #310

lumtis opened this issue Aug 11, 2024 · 0 comments · Fixed by #305
Assignees

Comments

@lumtis
Copy link
Member

lumtis commented Aug 11, 2024

After some experimentation, we would need a revertContext object to correctly handle a revert.

The following format should address any use case

revertContext:
  address asset -> address of the asset (empty is gas token)
  uint64 amount
  bytes revertMessage -> an arbitrary message that can be set during the initiation of a CCTX, this allow the contract to handle custom revert logic with context from the initial inbound (like for example setting the address of the user that should be refunded for a smart contract to handle onRevert)
  • revertContext can be used on ZEVM and EVM.

  • revertContext is passed to all functions handling revert until onRevert. Example: withdrawAndRevert -> revertWithERC20 -> onRevert

  • change onRevert interface to just take revertContext in argument

Other change to consider:

  • Consolidate the event emitted between executeRevert and revertWithERC20 into a single Reverted event that emit the RevertContext
@skosito skosito self-assigned this Aug 12, 2024
@skosito skosito linked a pull request Aug 12, 2024 that will close this issue
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 a pull request may close this issue.

2 participants