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

Separate the validation from the execution process for send/mint/burn_coins operations #512

Merged
merged 7 commits into from
Mar 9, 2023

Conversation

Farhad-Shabani
Copy link
Member

Closes: #502

Remark

I attempted the separation of the recv_packet function into recv_packet_validate and recv_packet_execute , but encountered a limitation to do so, because:
Even if the validation fails, we still need to perform some execution logic. Specifically, we need to store a failure acknowledgement containing the error log and emit the subsequent event. The problem is that we don't have mutable access to the context in the validation step, which makes it tricky to properly implement this logic.

There might be a way to solve this, but, IMO, highly likely requires us to touch some other parts and make changes beyond the scope of the current PR. Thus, I decided to put any ideas around this on hold, and that's the implementation I could come up with for now.


PR author checklist:

  • Added changelog entry, using unclog.
  • Added tests.
  • Linked to GitHub issue.
  • Updated code comments and documentation (e.g., docs/).
  • Tagged one reviewer who will be the one responsible for shepherding this PR.

Reviewer checklist:

  • Reviewed Files changed in the GitHub PR explorer.
  • Manually tested (in case integration/unit/mock tests are absent).

@Farhad-Shabani Farhad-Shabani marked this pull request as ready for review March 9, 2023 04:38
@Farhad-Shabani Farhad-Shabani added the A: breaking Admin: breaking change that may impact operators label Mar 9, 2023
@codecov
Copy link

codecov bot commented Mar 9, 2023

Codecov Report

Patch coverage: 25.88% and project coverage change: -0.15 ⚠️

Comparison is base (d0d0683) 71.94% compared to head (c3f50b1) 71.80%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #512      +/-   ##
==========================================
- Coverage   71.94%   71.80%   -0.15%     
==========================================
  Files         126      126              
  Lines       15771    15820      +49     
==========================================
+ Hits        11347    11359      +12     
- Misses       4424     4461      +37     
Impacted Files Coverage Δ
crates/ibc/src/applications/transfer/context.rs 51.06% <0.00%> (ø)
crates/ibc/src/applications/transfer/relay.rs 0.00% <0.00%> (ø)
.../src/applications/transfer/relay/on_recv_packet.rs 0.00% <0.00%> (ø)
crates/ibc/src/core/ics26_routing/context.rs 81.48% <ø> (ø)
crates/ibc/src/mock/context.rs 75.11% <42.85%> (-0.67%) ⬇️
...c/src/applications/transfer/relay/send_transfer.rs 95.48% <75.00%> (-0.55%) ⬇️
crates/ibc/src/core/context/recv_packet.rs 96.27% <100.00%> (+0.02%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@plafer plafer left a comment

Choose a reason for hiding this comment

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

great job on this PR, it was a tricky one!

@Farhad-Shabani Farhad-Shabani merged commit a7f8062 into main Mar 9, 2023
@Farhad-Shabani Farhad-Shabani deleted the farhad/bank-val-exec-separation branch March 9, 2023 15:37
Farhad-Shabani added a commit that referenced this pull request Sep 9, 2024
…n_coins` operations (#512)

* Add sent/mint/burn_coins validation interface

* Add sent/mint/burn_coins validation interface

* Revert naming to recv_packet_execute

* add clarifying comment

* Fix send/mint/burn_coins_validate comment

* more clarifying comments

* clippy

---------

Co-authored-by: Philippe Laferriere <plafer@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: breaking Admin: breaking change that may impact operators
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Enable token transfer app to store a map of trace hash with the associated denom
2 participants