Skip to content

program: wind down pool in ReplenishPool when vote account is closed - #929

Open
IliaZyrin wants to merge 2 commits into
solana-program:mainfrom
IliaZyrin:replenish-closed-vote-account
Open

IliaZyrin wants to merge 2 commits into
solana-program:mainfrom
IliaZyrin:replenish-closed-vote-account

Conversation

@IliaZyrin

Copy link
Copy Markdown

Closes #588

If the vote account is closed, ReplenishPool now winds the pool down instead of erroring:

  • moves on-ramp stake (MoveStake) and lamports (MoveLamports) into the main pool account
  • deactivates the on-ramp if the main account is not fully active
  • deactivates the main account once the on-ramp holds only rent

Once the main account is fully inactive, WithdrawStake splits on lamports, so the full pool NAV is redeemable. Each call does what it can and is otherwise a no-op. The wind-down completes within ~2 epochs. If a vote account is recreated at the same address, the existing path redelegates the pool. "Closed" means not owned by the vote program, and the address is still bound to the pool via check_pool_address.

Tests:

  • closed_vote_account_wind_down: on-ramp state × excess main-account lamports × already-inactive pool, ending with a full withdrawal at NAV.
  • closed_vote_account_recreated: closure while the on-ramp is activating, then recreating the vote account.

This branch has not been deployed

No deployments
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.

program: ReplenishPool should handle a closed vote account

1 participant