@@ -3111,41 +3111,51 @@ fn test_filter_program_errors_and_collect_priority_fee() {
3111
3111
) ;
3112
3112
}
3113
3113
3114
+ // HANA NOTE the original version of this test means well but is unsound
3115
+ // it seems like the idea is that in an entry the second tx should be invalid because the txes are *not serialized*
3116
+ // but in reality the only reason it fails is because of locks. ie it would fail even if keypair had a balance
3117
+ // on the other hand it is a perfectly valid simd83 batch because the first transaction funds the second
3118
+ // i wanted to change rather than delete it tho since i dunno how much coverage the tx count functions have
3114
3119
#[ test]
3115
3120
fn test_debits_before_credits ( ) {
3116
3121
let ( genesis_config, mint_keypair) =
3117
3122
create_genesis_config_no_tx_fee_no_rent ( sol_to_lamports ( 2. ) ) ;
3118
3123
let ( bank, _bank_forks) = Bank :: new_with_bank_forks_for_tests ( & genesis_config) ;
3119
3124
let keypair = Keypair :: new ( ) ;
3120
3125
let tx0 = system_transaction:: transfer (
3121
- & mint_keypair,
3122
- & keypair. pubkey ( ) ,
3123
- sol_to_lamports ( 2. ) ,
3124
- genesis_config. hash ( ) ,
3125
- ) ;
3126
- let tx1 = system_transaction:: transfer (
3127
3126
& keypair,
3128
3127
& mint_keypair. pubkey ( ) ,
3129
3128
sol_to_lamports ( 1. ) ,
3130
3129
genesis_config. hash ( ) ,
3131
3130
) ;
3131
+ let tx1 = system_transaction:: transfer (
3132
+ & mint_keypair,
3133
+ & keypair. pubkey ( ) ,
3134
+ sol_to_lamports ( 2. ) ,
3135
+ genesis_config. hash ( ) ,
3136
+ ) ;
3132
3137
let txs = vec ! [ tx0, tx1] ;
3133
3138
let results = bank. process_transactions ( txs. iter ( ) ) ;
3134
- assert ! ( results[ 1 ] . is_err( ) ) ;
3139
+ assert ! ( results[ 0 ] . is_err( ) ) ;
3135
3140
3136
3141
// Assert bad transactions aren't counted.
3137
3142
assert_eq ! ( bank. transaction_count( ) , 1 ) ;
3138
3143
assert_eq ! ( bank. non_vote_transaction_count_since_restart( ) , 1 ) ;
3139
3144
}
3140
3145
3141
- #[ test]
3142
- fn test_readonly_accounts ( ) {
3146
+ #[ test_case( false ; "old" ) ]
3147
+ #[ test_case( true ; "simd83" ) ]
3148
+ fn test_readonly_accounts ( disable_intrabatch_account_locks : bool ) {
3143
3149
let GenesisConfigInfo {
3144
3150
genesis_config,
3145
3151
mint_keypair,
3146
3152
..
3147
3153
} = create_genesis_config_with_leader ( 500 , & solana_pubkey:: new_rand ( ) , 0 ) ;
3148
- let ( bank, _bank_forks) = Bank :: new_with_bank_forks_for_tests ( & genesis_config) ;
3154
+ let mut bank = Bank :: new_for_tests ( & genesis_config) ;
3155
+ if !disable_intrabatch_account_locks {
3156
+ bank. deactivate_feature ( & feature_set:: disable_intrabatch_account_locks:: id ( ) ) ;
3157
+ }
3158
+ let ( bank, _bank_forks) = bank. wrap_with_bank_forks_for_tests ( ) ;
3149
3159
3150
3160
let vote_pubkey0 = solana_pubkey:: new_rand ( ) ;
3151
3161
let vote_pubkey1 = solana_pubkey:: new_rand ( ) ;
@@ -3209,9 +3219,16 @@ fn test_readonly_accounts() {
3209
3219
) ;
3210
3220
let txs = vec ! [ tx0, tx1] ;
3211
3221
let results = bank. process_transactions ( txs. iter ( ) ) ;
3212
- // However, an account may not be locked as read-only and writable at the same time.
3222
+ // Whether an account can be locked as read-only and writable at the same time depends on features .
3213
3223
assert_eq ! ( results[ 0 ] , Ok ( ( ) ) ) ;
3214
- assert_eq ! ( results[ 1 ] , Err ( TransactionError :: AccountInUse ) ) ;
3224
+ assert_eq ! (
3225
+ results[ 1 ] ,
3226
+ if disable_intrabatch_account_locks {
3227
+ Ok ( ( ) )
3228
+ } else {
3229
+ Err ( TransactionError :: AccountInUse )
3230
+ }
3231
+ ) ;
3215
3232
}
3216
3233
3217
3234
#[ test]
@@ -9451,8 +9468,9 @@ fn test_vote_epoch_panic() {
9451
9468
) ;
9452
9469
}
9453
9470
9454
- #[ test]
9455
- fn test_tx_log_order ( ) {
9471
+ #[ test_case( false ; "old" ) ]
9472
+ #[ test_case( true ; "simd83" ) ]
9473
+ fn test_tx_log_order ( disable_intrabatch_account_locks : bool ) {
9456
9474
let GenesisConfigInfo {
9457
9475
genesis_config,
9458
9476
mint_keypair,
@@ -9462,7 +9480,11 @@ fn test_tx_log_order() {
9462
9480
& Pubkey :: new_unique ( ) ,
9463
9481
bootstrap_validator_stake_lamports ( ) ,
9464
9482
) ;
9465
- let ( bank, _bank_forks) = Bank :: new_with_bank_forks_for_tests ( & genesis_config) ;
9483
+ let mut bank = Bank :: new_for_tests ( & genesis_config) ;
9484
+ if !disable_intrabatch_account_locks {
9485
+ bank. deactivate_feature ( & feature_set:: disable_intrabatch_account_locks:: id ( ) ) ;
9486
+ }
9487
+ let ( bank, _bank_forks) = bank. wrap_with_bank_forks_for_tests ( ) ;
9466
9488
* bank. transaction_log_collector_config . write ( ) . unwrap ( ) = TransactionLogCollectorConfig {
9467
9489
mentioned_addresses : HashSet :: new ( ) ,
9468
9490
filter : TransactionLogCollectorFilter :: All ,
@@ -9519,7 +9541,11 @@ fn test_tx_log_order() {
9519
9541
. as_ref( )
9520
9542
. unwrap( ) [ 2 ]
9521
9543
. contains( & "failed" . to_string( ) ) ) ;
9522
- assert ! ( commit_results[ 2 ] . is_err( ) ) ;
9544
+ if disable_intrabatch_account_locks {
9545
+ assert ! ( commit_results[ 2 ] . is_ok( ) ) ;
9546
+ } else {
9547
+ assert ! ( commit_results[ 2 ] . is_err( ) ) ;
9548
+ }
9523
9549
9524
9550
let stored_logs = & bank. transaction_log_collector . read ( ) . unwrap ( ) . logs ;
9525
9551
let success_log_info = stored_logs
0 commit comments