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 transfer triggered vps #3804

Merged
merged 26 commits into from
Sep 17, 2024
Merged

Fix transfer triggered vps #3804

merged 26 commits into from
Sep 17, 2024

Conversation

grarco
Copy link
Collaborator

@grarco grarco commented Sep 10, 2024

Describe your changes

Addresses a bug discovered while attempting shielded actions on campfire. With #2928 we stopped triggering vps for the addresses that do not occupy the first segment of a storage keys. This has an effect on transfers, since the balance keys have as their first address the multitoken account. Our current implementation of the transfer and multi-transfer prelude functions manually triggers the vp of the source, but we do nothing for the destination(s), so we are not triggering their vps right now.

This PR implements the followings:

  • The multi token vp ensures that the vps of all the involved parties (sources and destinations) have been triggered
  • The transfer and multi-trasnfer functions now also trigger the vps of the destinations
  • The execute method of the ibc context triggers the vp of the involved address for all the packets we support
  • The masp balance key is now part of the is_masp_key and is_masp_transfer_key to ensure correct validation
  • Adds two new steps in the ibc test to test rejection of malformed transaction
  • New unit test for the masp vp to verify that changing only the balance key is disallowed
  • New unit test for the multitoken vp to verify that the relevant verifiers are triggered

Misc:

Checklist before merging

  • If this PR has some consensus breaking changes, I added the corresponding breaking:: labels
    • This will require 2 reviewers to approve the changes

Copy link

codecov bot commented Sep 10, 2024

Codecov Report

Attention: Patch coverage is 85.93750% with 36 lines in your changes missing coverage. Please review.

Project coverage is 72.81%. Comparing base (f7830f6) to head (41583eb).
Report is 31 commits behind head on main.

Files with missing lines Patch % Lines
crates/ibc/src/lib.rs 58.75% 33 Missing ⚠️
crates/node/src/shims/abcipp_shim_types.rs 0.00% 1 Missing ⚠️
crates/trans_token/src/vp.rs 98.78% 1 Missing ⚠️
crates/tx_prelude/src/token.rs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3804      +/-   ##
==========================================
+ Coverage   72.78%   72.81%   +0.02%     
==========================================
  Files         338      338              
  Lines      103923   104164     +241     
==========================================
+ Hits        75637    75842     +205     
- Misses      28286    28322      +36     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@grarco grarco marked this pull request as ready for review September 12, 2024 10:20
grarco added a commit that referenced this pull request Sep 13, 2024
grarco added a commit that referenced this pull request Sep 13, 2024
@grarco grarco force-pushed the grarco/fix-transfer-dest-vp-trigger branch from 06a80ae to 02e9057 Compare September 13, 2024 20:24
@grarco grarco added breaking: protocol bug Something isn't working ledger labels Sep 14, 2024
@grarco grarco force-pushed the grarco/fix-transfer-dest-vp-trigger branch from 2f0db67 to b634d91 Compare September 14, 2024 17:45
{
self.verifiers.borrow_mut().insert(
Address::from_str(verifier.as_ref()).map_err(|_| {
Error::NftTransfer(NftTransferError::Other(
Copy link
Member

Choose a reason for hiding this comment

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

Does this only for NFT transfers? I'm confused about the choice of error type

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're right, could be both a fungible or non-fungible transfer. I've added a new error variant in 41583eb

@grarco grarco added the merge Ready to merge - mergifyio bot will add the PR to merge queue when all checks pass label Sep 17, 2024
mergify bot added a commit that referenced this pull request Sep 17, 2024
@mergify mergify bot merged commit d4dd9ff into main Sep 17, 2024
24 checks passed
@mergify mergify bot deleted the grarco/fix-transfer-dest-vp-trigger branch September 17, 2024 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking: protocol bug Something isn't working ledger merge Ready to merge - mergifyio bot will add the PR to merge queue when all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants