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

Sealevel native warp route adapter does not account for rent balance #4558

Open
yorhodes opened this issue Sep 23, 2024 · 0 comments
Open

Sealevel native warp route adapter does not account for rent balance #4558

yorhodes opened this issue Sep 23, 2024 · 0 comments
Labels
alt-VM non-EVM alternative execution environment cosmos solana move cardano polkadot solana tech-debt warp-route

Comments

@yorhodes
Copy link
Collaborator

Problem

The native sealevel token adapter queries the balance held by the collateral account to check if the requested amount is available to be withdrawn. However, all Sealevel accounts with non-zero data must have a minimum balance to avoid being pruned by the network (referred to as Rent).

The current implementation does not account for this minimum balance requirement, which can lead to the adapter returning a false negative when checking if the requested amount is available to be withdrawn.

Solution

The adapter should account for the minimum balance requirement when checking if the requested amount is available to be withdrawn. This can be done by adding the minimum balance to the requested amount before querying the balance held by the collateral account.

The way to do this would be:

  • get the account data length of collateralAccount via an RPC call (the data len is 0 for this collateral account)
  • use the Solana SDK to calculate the required rent (we can't hardcode this bc it's different on Solana vs Eclipse)

Example showing the rent via the CLI:

Solana mainnet

$ solana rent 0 -u mainnet-beta
Rent per byte-year: 0.00000348 SOL
Rent per epoch: 0.000002439 SOL
Rent-exempt minimum: 0.00089088 SOL

eclipse

$ solana rent 0 -u https://mainnetbeta-rpc.eclipse.xyz
Rent per byte-year: 0.000000034 SOL
Rent per epoch: 0.000000023 SOL
Rent-exempt minimum: 0.000008704 SOL

@yorhodes yorhodes added warp-route tech-debt alt-VM non-EVM alternative execution environment cosmos solana move cardano polkadot solana labels Sep 23, 2024
github-merge-queue bot pushed a commit that referenced this issue Sep 23, 2024
### Description

- **Modify native adapter collateral balance check**

### Drive-by changes

- None

### Related issues

- Opens #4558

### Backward compatibility

Yes

### Testing

Manual in warp UI, released as a beta build  5.2.1-beta0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alt-VM non-EVM alternative execution environment cosmos solana move cardano polkadot solana tech-debt warp-route
Projects
Status: Backlog
Development

No branches or pull requests

1 participant