@@ -19,20 +19,32 @@ use {
1919 test_case:: test_case,
2020} ;
2121
22- #[ test_case( true , 0 , false ; "activated" ) ]
23- #[ test_case( false , 0 , false ; "activating" ) ]
24- #[ test_case( true , 100_000 , false ; "activated_extra" ) ]
25- #[ test_case( false , 100_000 , false ; "activating_extra" ) ]
26- #[ test_case( true , 0 , true ; "activated_second" ) ]
27- #[ test_case( false , 0 , true ; "activating_second" ) ]
22+ #[ test_case( true , 0 , false , false , false ; "activated::minimum_disabled" ) ]
23+ #[ test_case( true , 0 , false , false , true ; "activated::minimum_disabled::small" ) ]
24+ #[ test_case( true , 0 , false , true , false ; "activated::minimum_enabled" ) ]
25+ #[ test_case( false , 0 , false , false , false ; "activating::minimum_disabled" ) ]
26+ #[ test_case( false , 0 , false , false , true ; "activating::minimum_disabled::small" ) ]
27+ #[ test_case( false , 0 , false , true , false ; "activating::minimum_enabled" ) ]
28+ #[ test_case( true , 100_000 , false , false , false ; "activated::extra" ) ]
29+ #[ test_case( false , 100_000 , false , false , false ; "activating::extra" ) ]
30+ #[ test_case( true , 0 , true , false , false ; "activated::second" ) ]
31+ #[ test_case( false , 0 , true , false , false ; "activating::second" ) ]
2832#[ tokio:: test]
29- async fn success ( activate : bool , extra_lamports : u64 , prior_deposit : bool ) {
30- let mut context = program_test ( ) . start_with_context ( ) . await ;
33+ async fn success (
34+ activate : bool ,
35+ extra_lamports : u64 ,
36+ prior_deposit : bool ,
37+ enable_minimum_delegation : bool ,
38+ small_deposit : bool ,
39+ ) {
40+ let mut context = program_test ( enable_minimum_delegation)
41+ . start_with_context ( )
42+ . await ;
3143 let accounts = SinglePoolAccounts :: default ( ) ;
3244 accounts
3345 . initialize_for_deposit (
3446 & mut context,
35- TEST_STAKE_AMOUNT ,
47+ if small_deposit { 1 } else { TEST_STAKE_AMOUNT } ,
3648 if prior_deposit {
3749 Some ( TEST_STAKE_AMOUNT * 10 )
3850 } else {
@@ -158,11 +170,17 @@ async fn success(activate: bool, extra_lamports: u64, prior_deposit: bool) {
158170 ) ;
159171}
160172
161- #[ test_case( true ; "activated" ) ]
162- #[ test_case( false ; "activating" ) ]
173+ #[ test_case( true , false , false ; "activated::minimum_disabled" ) ]
174+ #[ test_case( true , false , true ; "activated::minimum_disabled::small" ) ]
175+ #[ test_case( true , true , false ; "activated::minimum_enabled" ) ]
176+ #[ test_case( false , false , false ; "activating::minimum_disabled" ) ]
177+ #[ test_case( false , false , true ; "activating::minimum_disabled::small" ) ]
178+ #[ test_case( false , true , false ; "activating::minimum_enabled" ) ]
163179#[ tokio:: test]
164- async fn success_with_seed ( activate : bool ) {
165- let mut context = program_test ( ) . start_with_context ( ) . await ;
180+ async fn success_with_seed ( activate : bool , enable_minimum_delegation : bool , small_deposit : bool ) {
181+ let mut context = program_test ( enable_minimum_delegation)
182+ . start_with_context ( )
183+ . await ;
166184 let accounts = SinglePoolAccounts :: default ( ) ;
167185 let rent = context. banks_client . get_rent ( ) . await . unwrap ( ) ;
168186 let minimum_stake = accounts. initialize ( & mut context) . await ;
@@ -174,7 +192,7 @@ async fn success_with_seed(activate: bool) {
174192 & accounts. vote_account . pubkey ( ) ,
175193 & accounts. alice . pubkey ( ) ,
176194 & rent,
177- minimum_stake,
195+ if small_deposit { 1 } else { minimum_stake } ,
178196 ) ;
179197 let transaction = Transaction :: new_signed_with_payer (
180198 & instructions,
@@ -261,7 +279,7 @@ async fn success_with_seed(activate: bool) {
261279#[ test_case( false ; "activating" ) ]
262280#[ tokio:: test]
263281async fn fail_uninitialized ( activate : bool ) {
264- let mut context = program_test ( ) . start_with_context ( ) . await ;
282+ let mut context = program_test ( false ) . start_with_context ( ) . await ;
265283 let accounts = SinglePoolAccounts :: default ( ) ;
266284 let stake_account = Keypair :: new ( ) ;
267285
@@ -331,13 +349,13 @@ async fn fail_uninitialized(activate: bool) {
331349 check_error ( e, SinglePoolError :: InvalidPoolAccount ) ;
332350}
333351
334- #[ test_case( true , true ; "activated_automorph " ) ]
335- #[ test_case( false , true ; "activating_automorph " ) ]
336- #[ test_case( true , false ; "activated_unauth " ) ]
337- #[ test_case( false , false ; "activating_unauth " ) ]
352+ #[ test_case( true , true ; "activated::automorph " ) ]
353+ #[ test_case( false , true ; "activating::automorph " ) ]
354+ #[ test_case( true , false ; "activated::unauth " ) ]
355+ #[ test_case( false , false ; "activating::unauth " ) ]
338356#[ tokio:: test]
339357async fn fail_bad_account ( activate : bool , automorph : bool ) {
340- let mut context = program_test ( ) . start_with_context ( ) . await ;
358+ let mut context = program_test ( false ) . start_with_context ( ) . await ;
341359 let accounts = SinglePoolAccounts :: default ( ) ;
342360 accounts
343361 . initialize_for_deposit ( & mut context, TEST_STAKE_AMOUNT , None )
@@ -382,10 +400,10 @@ async fn fail_bad_account(activate: bool, automorph: bool) {
382400#[ test_case( false ; "user_active" ) ]
383401#[ tokio:: test]
384402async fn fail_activation_mismatch ( pool_first : bool ) {
385- let mut context = program_test ( ) . start_with_context ( ) . await ;
403+ let mut context = program_test ( false ) . start_with_context ( ) . await ;
386404 let accounts = SinglePoolAccounts :: default ( ) ;
387405
388- let minimum_delegation = get_minimum_delegation (
406+ let minimum_delegation = get_pool_minimum_delegation (
389407 & mut context. banks_client ,
390408 & context. payer ,
391409 & context. last_blockhash ,
0 commit comments