Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
04f9a52
feat: add test for decrease 1e8c69eeb34a5050cd86ebe50f067770c5175839
juliaaschmidt Oct 23, 2025
83c5a4e
feat: add test for cluster-restart hijacks d99681a8e32a51fd60b480069d…
juliaaschmidt Oct 23, 2025
43e8dfd
feat: add test for do not remove validator if lamports present 4906cb…
juliaaschmidt Oct 23, 2025
f25594b
style: rm superfluous comment
juliaaschmidt Oct 23, 2025
448d7d2
feat: ignore Uninitialized accounts during update_validator_list_bala…
juliaaschmidt Oct 23, 2025
cf3ac2d
feat: withdraw stake tests with transient lamports 40c260abd4e46ac464…
juliaaschmidt Oct 30, 2025
d4a3ef3
style: comments
juliaaschmidt Oct 30, 2025
ce5ed9b
feat: add test for reset preferred validator during withdrawal 2ce9b2…
juliaaschmidt Oct 30, 2025
d30b5c9
style: rm comment
juliaaschmidt Oct 30, 2025
bd47fa4
feat: Set status to DeactivatingAll if transient lamports 82e9fa9bd3f…
juliaaschmidt Oct 30, 2025
6be1272
gpg test
juliaaschmidt Dec 15, 2025
f2fa20b
gpg test
juliaaschmidt Dec 15, 2025
2d876a7
fix: rm sol withdraw authority from tests
juliaaschmidt Dec 15, 2025
877fff4
fix: rustfmt + clippy program
juliaaschmidt Dec 15, 2025
51ecff2
style: replace println! statements with comments in tests
juliaaschmidt Feb 2, 2026
59b69ef
fix: remove unnecessary update_validator_list_balance call
juliaaschmidt Feb 2, 2026
f05f088
fix: prefix unused variables with underscore for clippy
juliaaschmidt Feb 2, 2026
0231697
Add comment explaining synthetic state in cleanup test
juliaaschmidt Feb 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions program/tests/decrease.rs
Original file line number Diff line number Diff line change
Expand Up @@ -658,3 +658,55 @@ async fn fail_additional_with_increasing() {
) if code == StakePoolError::WrongStakeStake as u32
);
}

#[test_case(DecreaseInstruction::Additional; "additional")]
#[test_case(DecreaseInstruction::Reserve; "reserve")]
#[test_case(DecreaseInstruction::Deprecated; "deprecated")]
#[tokio::test]
async fn fail_validator_marked_for_removal_decrease_stake(instruction_type: DecreaseInstruction) {
let (
mut context,
stake_pool_accounts,
validator_stake,
_deposit_info,
decrease_lamports,
_reserve_lamports,
) = setup().await;

// First, remove the validator from the pool to mark it for removal
let error = stake_pool_accounts
.remove_validator_from_pool(
&mut context.banks_client,
&context.payer,
&context.last_blockhash,
&validator_stake.stake_account,
&validator_stake.transient_stake_account,
)
.await;
assert!(error.is_none(), "Failed to remove validator: {:?}", error);

// Now attempt to decrease stake on the removed validator - this should fail
let error = stake_pool_accounts
.decrease_validator_stake_either(
&mut context.banks_client,
&context.payer,
&context.last_blockhash,
&validator_stake.stake_account,
&validator_stake.transient_stake_account,
decrease_lamports,
validator_stake.transient_stake_seed,
instruction_type,
)
.await
.unwrap()
.unwrap();

// Should fail with ValidatorNotFound error
assert_matches!(
error,
TransactionError::InstructionError(
_,
InstructionError::Custom(code)
) if code == StakePoolError::ValidatorNotFound as u32
);
}
Loading