Skip to content

enable 1 sol minimum delegation#240

Merged
2501babe merged 8 commits intosolana-program:mainfrom
2501babe:20260203_min1sol
Feb 5, 2026
Merged

enable 1 sol minimum delegation#240
2501babe merged 8 commits intosolana-program:mainfrom
2501babe:20260203_min1sol

Conversation

@2501babe
Copy link
Member

@2501babe 2501babe commented Feb 4, 2026

this pr sets minimum delegation to 1 sol

my first version of this was >500 lines of test changes. i implemented a cargo feature flag, committed a 1lamp program binary, and testcased everything to run against both 1lamp and 1sol

however i realize this is all pointless. there will never be a moment where we are running this (presumably 5.0.0) release with a 1lamp minimum. so then i switched to testing everything against this and a tagged 4.0.0 binary. but this is also pointless: the test proof of 4.0.0 is tests passing at the 4.0.0 tag commit!

in other words this is all we have to do and im explaining why we dont have to do more in this repo. we will have to validate against agave and stake pools. but this is not a blocker on landing this pr, its a blocker on deploying a program with this commit in it. ill open a separate issue to track that work, it will constitute like 99% of what we actually have to do to ship this

closes #73

@2501babe 2501babe marked this pull request as ready for review February 5, 2026 10:39
@2501babe 2501babe requested a review from joncinque February 5, 2026 10:40
Copy link
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! This will be the easiest way to make the change on the program side.

Just some nits on the tests

Comment on lines 3896 to 3911
// 1: destination is fully funded:
// - old behavior: any split amount is OK
// - new behavior: split amount must be at least the minimum delegation
(
rent_exempt_reserve + minimum_delegation,
1,
expected_results[0].clone(),
Err(StakeError::InsufficientDelegation.into()),
),
// if destination is only short by 1 lamport, then...
// 2: if destination is only short by 1 lamport, then...
// - old behavior: split amount can be 1 lamport
// - new behavior: split amount must be at least the minimum delegation
(
rent_exempt_reserve + minimum_delegation - 1,
1,
expected_results[1].clone(),
Err(StakeError::InsufficientDelegation.into()),
),
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we have success cases anymore, so what do you think about adding a test case for:

        (
            rent_exempt_reserve,
            minimum_delegation,
            Ok(()),
        ),

Copy link
Member Author

@2501babe 2501babe Feb 5, 2026

Choose a reason for hiding this comment

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

4 is that triple, its easy to miss since its a one-liner. the array wasnt all possible successes, just things that succeeded with the old feature gate disabled and failed with it enabled

Copy link
Contributor

Choose a reason for hiding this comment

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

Bah, sorry about that, you're right

Comment on lines 3897 to 3898
// - old behavior: any split amount is OK
// - new behavior: split amount must be at least the minimum delegation
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can you remove the "old behavior" comment?

Copy link
Member Author

Choose a reason for hiding this comment

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

ef641c7 also i removed that saturating sub because even in the old case the comment was in error, minimum_delegation was 1, not 0

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that kind of confused me, thanks!

Comment on lines 3905 to 3906
// - old behavior: split amount can be 1 lamport
// - new behavior: split amount must be at least the minimum delegation
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: same here, can you remove the "old behavior" comment?

Copy link
Member Author

Choose a reason for hiding this comment

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

// - new behavior: split amount must be at least the minimum delegation
(
rent_exempt_reserve + minimum_delegation,
1,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: How about making this minimum_delegation - 1 to go with the comment? There's a bit of overlap with case 5, but this would be specific for the split amount

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
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!

@2501babe 2501babe merged commit ac65294 into solana-program:main Feb 5, 2026
21 checks passed
@2501babe 2501babe deleted the 20260203_min1sol branch February 5, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

implement minimum delegation

2 participants