Skip to content

Commit

Permalink
reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoranYi committed Sep 22, 2023
1 parent 2886661 commit a9bbf47
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 16 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions program-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ solana-program-runtime = { workspace = true }
solana-runtime = { workspace = true }
solana-sdk = { workspace = true }
solana-vote-program = { workspace = true }
test-case = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["full"] }

Expand Down
20 changes: 5 additions & 15 deletions program-test/tests/stake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use {
stake::{instruction as stake_instruction, instruction::StakeError},
transaction::{Transaction, TransactionError},
},
test_case::test_case,
};

#[derive(PartialEq)]
Expand All @@ -20,6 +21,10 @@ enum PendingStakeActivationTestFlag {
NoMerge,
}

#[test_case(PendingStakeActivationTestFlag::NoMerge; "test that redelegate stake then deactivate it then withdraw from it is not permitted")]
#[test_case(PendingStakeActivationTestFlag::MergeActive; "test that redelegate stake then merge it with another active stake then deactivate it then withdraw from it is not permitted")]
#[test_case(PendingStakeActivationTestFlag::MergeInactive; "test that redelegate stake then merge it with another inactive stake then deactivate it then withdraw from it is not permitted")]
#[tokio::test]
async fn test_stake_redelegation_pending_activation(merge_flag: PendingStakeActivationTestFlag) {
let program_test = ProgramTest::default();
let mut context = program_test.start_with_context().await;
Expand Down Expand Up @@ -186,18 +191,3 @@ async fn test_stake_redelegation_pending_activation(merge_flag: PendingStakeActi
.await
.unwrap();
}

#[tokio::test]
async fn test_stake_redelegation_then_deactivation_withdraw_not_permitted() {
test_stake_redelegation_pending_activation(PendingStakeActivationTestFlag::NoMerge).await
}

#[tokio::test]
async fn test_stake_redelegation_then_merge_active_then_deactivation_withdraw_not_permitted() {
test_stake_redelegation_pending_activation(PendingStakeActivationTestFlag::MergeActive).await
}

#[tokio::test]
async fn test_stake_redelegation_then_merge_inactive_then_deactivation_withdraw_not_permitted() {
test_stake_redelegation_pending_activation(PendingStakeActivationTestFlag::MergeInactive).await
}
2 changes: 1 addition & 1 deletion program-test/tests/warp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use {
transaction::{Transaction, TransactionError},
},
solana_stake_program::stake_state,
solana_vote_program::vote_state::{self},
solana_vote_program::vote_state,
std::convert::TryInto,
};

Expand Down
36 changes: 36 additions & 0 deletions programs/sbf/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a9bbf47

Please sign in to comment.