Skip to content

program: test replenish for sub-minimum delegation#649

Open
2501babe wants to merge 1 commit intosolana-program:mainfrom
2501babe:20260425_replsubmin
Open

program: test replenish for sub-minimum delegation#649
2501babe wants to merge 1 commit intosolana-program:mainfrom
2501babe:20260425_replsubmin

Conversation

@2501babe
Copy link
Copy Markdown
Member

while looking at onchain svsp transactions i noticed people will not uncommonly replenish in the thousands of lamports and realized we dont have tests that these instructions will still succeed after the minimum delegation goes to 1sol. the logic is clever... too clever to let it go untested:

let must_delegate_onramp = match option_onramp_status.unwrap_or_default() {
    // activating
    StakeActivationStatus {
        effective: 0,
        activating,
        deactivating: 0,
    } if activating > 0 => {
        onramp_non_rent_lamports >= minimum_delegation
            && onramp_non_rent_lamports > activating
    }   
    // inactive, or deactivating this epoch due to DeactivateDelinquent
    // effective may be nonzero here because we are using the status prior to MoveStake
    StakeActivationStatus {
        effective: _,
        activating: 0,
        deactivating,
    } if deactivating == 0 || onramp_deactivation_epoch == clock.epoch => {
        onramp_non_rent_lamports >= minimum_delegation
    }   
    // partially active, partially inactive, or some state beyond mortal reckoning
    _ => false,
};

also i cover the no-op cases that i previously skipped

@2501babe 2501babe self-assigned this Apr 26, 2026
* test moving less than the minimum to onramp adds to activating but does not attempt to delegate inactive
* test the no-op cases successfully no-op
* use unique value for existing lamports in onramp
@2501babe 2501babe force-pushed the 20260425_replsubmin branch from 2dd09dd to 3d2bb28 Compare April 26, 2026 07:06
@2501babe 2501babe marked this pull request as ready for review April 26, 2026 07:40
@2501babe 2501babe requested a review from grod220 April 26, 2026 07:40
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