Sealevel native warp route adapter does not account for rent balance #4558
Labels
alt-VM
non-EVM alternative execution environment cosmos solana move cardano polkadot
solana
tech-debt
warp-route
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:
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
The text was updated successfully, but these errors were encountered: