Skip to content

program: require onramp to exist for deposit and withdraw#648

Merged
2501babe merged 3 commits intosolana-program:mainfrom
2501babe:20260424_onrampexist
Apr 24, 2026
Merged

program: require onramp to exist for deposit and withdraw#648
2501babe merged 3 commits intosolana-program:mainfrom
2501babe:20260424_onrampexist

Conversation

@2501babe
Copy link
Copy Markdown
Member

@2501babe 2501babe commented Apr 24, 2026

i should have thought of this before but maybe splitting up #580 and #601 made me neglectful. we use onramp lamports for pool value now so we should just hard require it to exist. i considered working around its possible nonexistence but this is pointless. people will want their mev rewards, just make the account

with onramp, the pool_net_asset_value() change is no different, its just a bit more defensive. without onramp, the current version of pool_net_asset_value() is wrong, because it subtracts Rent::get().minimum_balance(0) from the pool value

requiring the onramp saves us from having to contemplate stupid edge cases like "what if it doesnt exist and has rent exemption for 0 but not enough for 200, is that pool value? what if it has enough for 200, is that pool value? what about more than that. what if it doesnt exist but they create it after. what if it has some lamports, but not enough for 0, but they add more after." enough

also i have some kind of brain disease that causes me to abbreviate "net asset value" as "nev" for some reason, so i also fix that

@2501babe 2501babe self-assigned this Apr 24, 2026
@2501babe 2501babe force-pushed the 20260424_onrampexist branch from 3f018b6 to 5bcc433 Compare April 24, 2026 09:12
@2501babe 2501babe marked this pull request as ready for review April 24, 2026 09:33
@2501babe 2501babe requested a review from joncinque April 24, 2026 09:33
Copy link
Copy Markdown
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

Looks great! I always thought you meant it to be "net effective value" 😅

@2501babe 2501babe merged commit a2ed082 into solana-program:main Apr 24, 2026
22 checks passed
@2501babe 2501babe deleted the 20260424_onrampexist branch April 24, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants