program: use Rent over rent_exempt_reserve#542
Conversation
| let user_excess_lamports = post_pool_lamports | ||
| .checked_sub(pool_stake_state.delegation.stake) | ||
| .and_then(|amount| amount.checked_sub(pool_stake_meta.rent_exempt_reserve)) | ||
| .and_then(|amount| amount.checked_sub(pool_rent_exempt_reserve)) |
There was a problem hiding this comment.
Just noting that this is assuming a stake account will be the same size post-merge, which makes sense to me
There was a problem hiding this comment.
yep, it isnt articulated by the stake program but this would be in line with the general principle of current behavior. if you Split, the new account has the currently enforced size asserted and both accounts must meet minimum delegation. if you Merge, we dont enforce size and we dont enforce minimum delegation
the principle i read into this is that an old Merge destination is allowed to continue as it was before, since closing the source is good, and the destination would have kept on existing as it was if there was no merge. so i dont think we would ever change this if we made larger stake accounts
|
@grod220 would you mind giving |
grod220
left a comment
There was a problem hiding this comment.
The work in program/src/processor.rs looks good to me 👍 . A minor take-or-leave comment for the CLI.
| assert_eq!( | ||
| account.data.len(), | ||
| StakeStateV2::size_of(), | ||
| "StakeStateV2 is no longer canonical, or StakeStateV2::size_of() is no longer 200." | ||
| ); |
There was a problem hiding this comment.
If you brought the get_minimum_balance_for_rent_exemption() down, invoked it with account.data.len() and then memoized the result (keyed by size)---this could automatically adjust to different future stake account sizings. Just an idea.
There was a problem hiding this comment.
yea that was what i meant by "we may be fetching hundreds of accounts here so memoize the rents"
|
ty! |
downstream changes to support solana-program/stake#303
also fix a mistake in the cli using the wrong
size_of()note i had to bump quinn-proto in the lockfile for audit, it doesnt affect anything in here though