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

feat: require Sealevel native transfers to cover the rent of the recipient #4936

Merged
merged 11 commits into from
Dec 4, 2024

Conversation

tkporter
Copy link
Collaborator

@tkporter tkporter commented Dec 2, 2024

Description

  • Happened a few times where someone transferred SOL from Eclipse -> SOL on Solana, and the recipient did not yet exist (so had no SOL balance to cover its rent). The amount on these transfers would be insufficient to cover the rent of the recipient, so the transfer could never be delivered. See https://discord.com/channels/935678348330434570/1311371339889639486/1311381212828532858 for context on the first time this happened. There were then a few other instances the day after
  • This introduces ITokenAdapter.getMinimumTransferAmount, where impls generally return a minimum of 0, but native Sealevel and native Sealevel warp routes have some logic that is aware of required rent exemption balances
  • Atm, in WarpCore this only checks getMinimumTransferAmount on the destination side and not the origin -- my reasoning here is that:
    a. for the specific issue this is addressing, the destination side is the only one where issues can arise. On the origin, the account that escrows the SOL is always rent exempt
    b. checking on the origin for completeness could be done, but would require some extra logic to be aware of where tokens are escrowed on the origin side (i.e. the recipient should be the account that escrows the SOL), which felt unnecessary / confusing

Drive-by changes

Related issues

Backward compatibility

Testing

Copy link

changeset-bot bot commented Dec 2, 2024

🦋 Changeset detected

Latest commit: 6e8384c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@hyperlane-xyz/sdk Minor
@hyperlane-xyz/cli Minor
@hyperlane-xyz/helloworld Minor
@hyperlane-xyz/infra Minor
@hyperlane-xyz/widgets Minor
@hyperlane-xyz/ccip-server Minor
@hyperlane-xyz/github-proxy Minor
@hyperlane-xyz/utils Minor
@hyperlane-xyz/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

codecov bot commented Dec 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.53%. Comparing base (d0e53f5) to head (6e8384c).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4936      +/-   ##
==========================================
+ Coverage   77.44%   77.53%   +0.09%     
==========================================
  Files         103      103              
  Lines        2110     2110              
  Branches      195      190       -5     
==========================================
+ Hits         1634     1636       +2     
+ Misses        455      453       -2     
  Partials       21       21              
Components Coverage Δ
core 87.80% <ø> (ø)
hooks 79.39% <ø> (ø)
isms 83.68% <ø> (ø)
token 91.27% <ø> (ø)
middlewares 79.80% <ø> (+0.64%) ⬆️

Copy link
Contributor

@jmrossy jmrossy left a comment

Choose a reason for hiding this comment

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

Nice fix! One optional comment and needs a lint fix

typescript/sdk/src/warp/WarpCore.ts Show resolved Hide resolved
@tkporter tkporter enabled auto-merge December 4, 2024 03:17
@tkporter tkporter disabled auto-merge December 4, 2024 03:22
@tkporter tkporter enabled auto-merge December 4, 2024 03:25
@tkporter tkporter added this pull request to the merge queue Dec 4, 2024
Merged via the queue into main with commit 2054f4f Dec 4, 2024
36 of 37 checks passed
@tkporter tkporter deleted the trevor/fix-sol-transfer-without-rent branch December 4, 2024 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants