Skip to content

Commit

Permalink
we have acheived absolute victory over fee-only txns
Browse files Browse the repository at this point in the history
  • Loading branch information
2501babe committed Sep 13, 2024
1 parent e52bb56 commit ef119fe
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
25 changes: 20 additions & 5 deletions svm/src/transaction_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,26 @@ impl<FG: ForkGraph> TransactionBatchProcessor<FG> {
TransactionLoadResult::NotLoaded(err) => Err(err),
TransactionLoadResult::FeesOnly(fees_only_tx) => {
if enable_transaction_loading_failure_fees {
// XXX store rollback accounts here
// XXX HANA when we replace `collect_accounts_to_store` we want to encapsulate this code too
let fee_payer_address = tx.fee_payer();
match fees_only_tx.rollback_accounts {
RollbackAccounts::FeePayerOnly {
ref fee_payer_account,
} => {
accounts_map.insert(*fee_payer_address, fee_payer_account.clone());
}
RollbackAccounts::SameNonceAndFeePayer { ref nonce } => {
accounts_map.insert(*nonce.address(), nonce.account().clone());
}
RollbackAccounts::SeparateNonceAndFeePayer {
ref nonce,
ref fee_payer_account,
} => {
accounts_map.insert(*nonce.address(), nonce.account().clone());
accounts_map.insert(*fee_payer_address, fee_payer_account.clone());
}
}

Ok(ProcessedTransaction::FeesOnly(Box::new(fees_only_tx)))
} else {
Err(fees_only_tx.load_error)
Expand Down Expand Up @@ -509,10 +528,6 @@ impl<FG: ForkGraph> TransactionBatchProcessor<FG> {
let current_nonce = StateMut::<NonceVersions>::state(nonce_account).ok()?;
let future_nonce =
StateMut::<NonceVersions>::state(nonce_info.account()).ok()?;
println!(
"HANA current: {:#?}\n future: {:#?}",
current_nonce, future_nonce
);
match (current_nonce.state(), future_nonce.state()) {
(
NonceState::Initialized(ref current_data),
Expand Down
5 changes: 1 addition & 4 deletions svm/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,6 @@ fn intrabatch_account_reuse(enable_fee_only_transactions: bool) -> Vec<SvmTestEn
test_entries.push(test_entry);
}


// XXX ugh next i need to check a non-executable followed by a successful
// i dont think i update the accounts map from rollback accounts
// or do i??? collect accounts is supposed to do that
Expand Down Expand Up @@ -1230,7 +1229,7 @@ fn nonce_reuse(enable_fee_only_transactions: bool, fee_paying_nonce: bool) -> Ve
// batch 2:
// * 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 {
let mut test_entry = common_test_entry.clone();

let first_transaction = Transaction::new_signed_with_payer(
Expand All @@ -1253,15 +1252,13 @@ fn nonce_reuse(enable_fee_only_transactions: bool, fee_paying_nonce: bool) -> Ve
);

// if the nonce account pays fees, it keeps its new rent epoch, otherwise it resets
/* XXX
if !fee_paying_nonce {
test_entry
.final_accounts
.get_mut(&nonce_pubkey)
.unwrap()
.set_rent_epoch(0);
}
*/

test_entries.push(test_entry);
}
Expand Down

0 comments on commit ef119fe

Please sign in to comment.