diff --git a/svm/src/transaction_processor.rs b/svm/src/transaction_processor.rs index 5c544d35b4cab5..34e452611e0b7f 100644 --- a/svm/src/transaction_processor.rs +++ b/svm/src/transaction_processor.rs @@ -381,7 +381,6 @@ impl TransactionBatchProcessor { &None::>, &processing_results, ); - println!("HANA update acocunts: {:#?}", update_accounts); for (pubkey, account) in update_accounts { accounts_map.insert(*pubkey, account.clone()); } @@ -537,7 +536,6 @@ impl TransactionBatchProcessor { } }); - println!("HANA nonces equal: {:?}", nonces_are_equal); match nonces_are_equal { Some(false) => (), Some(true) => { diff --git a/svm/tests/integration_test.rs b/svm/tests/integration_test.rs index 231c3baf1047ab..473ffc4a95825f 100644 --- a/svm/tests/integration_test.rs +++ b/svm/tests/integration_test.rs @@ -1172,7 +1172,27 @@ fn nonce_reuse(enable_fee_only_transactions: bool, fee_paying_nonce: bool) -> Ve common_test_entry.decrease_expected_lamports(&fee_payer, LAMPORTS_PER_SIGNATURE); - // batch 0: + // batch 0: one transaction that advances the nonce twice + { + let mut test_entry = common_test_entry.clone(); + + let transaction = Transaction::new_signed_with_payer( + &[advance_instruction.clone(), advance_instruction.clone()], + Some(&fee_payer), + &[&fee_payer_keypair], + *initial_durable.as_hash(), + ); + + test_entry.push_nonce_transaction_with_status( + transaction, + initial_nonce_info.clone(), + ExecutionStatus::ExecutedFailed, + ); + + test_entries.push(test_entry); + } + + // batch 1: // * a successful nonce transaction // * a nonce transaction that reuses the same nonce; this transaction must be dropped { @@ -1198,7 +1218,7 @@ fn nonce_reuse(enable_fee_only_transactions: bool, fee_paying_nonce: bool) -> Ve test_entries.push(test_entry); } - // batch 1: + // batch 2: // * an executable failed nonce transaction // * a nonce transaction that reuses the same nonce; this transaction must be dropped { @@ -1226,7 +1246,7 @@ fn nonce_reuse(enable_fee_only_transactions: bool, fee_paying_nonce: bool) -> Ve test_entries.push(test_entry); } - // batch 2: + // batch 3: // * a processable non-executable nonce transaction, if fee-only transactions are enabled // * a nonce transaction that reuses the same nonce; this transaction must be dropped if enable_fee_only_transactions { @@ -1263,7 +1283,31 @@ fn nonce_reuse(enable_fee_only_transactions: bool, fee_paying_nonce: bool) -> Ve test_entries.push(test_entry); } - // TODO very evil idea: tx1 is a non-nonce txn that nevertheless advances the nonce. tx2 dropped + // batch 4: + // * a successful blockhash transaction that also advances the nonce + // * a nonce transaction that reuses the same nonce; this transaction must be dropped + { + let mut test_entry = common_test_entry.clone(); + + let first_transaction = Transaction::new_signed_with_payer( + &[ + successful_noop_instruction.clone(), + advance_instruction.clone(), + ], + Some(&fee_payer), + &[&fee_payer_keypair], + Hash::default(), + ); + + test_entry.push_nonce_transaction(first_transaction, initial_nonce_info.clone()); + test_entry.push_nonce_transaction_with_status( + second_transaction.clone(), + advanced_nonce_info.clone(), + ExecutionStatus::Discarded, + ); + + test_entries.push(test_entry); + } for test_entry in &mut test_entries { test_entry