Skip to content

single-pool v6 final fixes#730

Open
2501babe wants to merge 2 commits into
solana-program:mainfrom
2501babe:20260703_finalfixes
Open

single-pool v6 final fixes#730
2501babe wants to merge 2 commits into
solana-program:mainfrom
2501babe:20260703_finalfixes

Conversation

@2501babe

@2501babe 2501babe commented Jul 3, 2026

Copy link
Copy Markdown
Member

couple cosmetic/qol things came up in the neodyme audit:

  • in deposit math, the nav == 0 || supply == 0 is unreachable. i left it that way for unit tests, but make this clear. also i took the opportunity to flip deposit and withdraw branches since we were taking the second branch 100% and ~100% of the time respectively
  • the WithdrawalTooLarge error was unreachable because any withdrawal greater than total stake in the main account would trigger the error for violating the main account minimum delegation. this was still safe but the intent of both errors was violated. now, we only return WithdrawalViolatesPoolRequirements.into if "value" (lamports minus rent) in the main account is lte minimum delegation already. then we return WithdrawalTooLarge if the withdrawal would bring the pool account below the minimum. because withdrawal amount is a function of actually existing tokens, rather than an arbitrary user input, this should only happen if too much NAV is in the onramp

@2501babe 2501babe self-assigned this Jul 3, 2026
@2501babe 2501babe force-pushed the 20260703_finalfixes branch from e22f101 to 22748c3 Compare July 3, 2026 18:06
@2501babe 2501babe requested a review from joncinque July 3, 2026 19:11
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.

1 participant