Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Don't forward transactions that are expired or failed signature check #4199

Merged
merged 4 commits into from
May 8, 2019

Conversation

pgarg66
Copy link
Contributor

@pgarg66 pgarg66 commented May 7, 2019

Problem

The old leader can potentially forward expired transactions to the new leader. This puts more pressure on leader's pipeline stages (e.g. SigVerify and BankingStage), and create a backlog of transaction. If this backlog grows, the node can run out of memory.

Summary of Changes

Drop the transactions that have expired (blockhash is too old).

Fixes #3959

@pgarg66
Copy link
Contributor Author

pgarg66 commented May 7, 2019

#4071

runtime/src/bank.rs Outdated Show resolved Hide resolved
@@ -514,9 +543,10 @@ impl BankingStage {

let tx_len = verified_transactions.len();

let (processed, unprocessed_txs) = f(bank, &verified_transactions, poh)?;
let (processed, unprocessed_txs) = fn_proc(bank, &verified_transactions, poh)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code looks unnecessarily awkward. It looks like breaking it up would make it possible to write without closures and minimal copypasta. What if we moved the code above into its own function? Then the caller would invoke that new function and use it to create (processed, unprocessed_txs) and valid_unprocessed_txs directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest patch should untangle this function.

@@ -480,15 +481,43 @@ impl BankingStage {
Ok((chunk_start, unprocessed_txs))
}

fn process_received_packets_using_closure<'a, F>(
fn filter_out_invalid_transactions(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function can use a couple tests and a code comment. Probably a better name too (filter_valid_transaction_indexes?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworked the function and added some tests.

@codecov
Copy link

codecov bot commented May 7, 2019

Codecov Report

Merging #4199 into master will increase coverage by <.1%.
The diff coverage is 97.1%.

@@           Coverage Diff            @@
##           master   #4199     +/-   ##
========================================
+ Coverage    78.6%   78.6%   +<.1%     
========================================
  Files         164     164             
  Lines       28263   28296     +33     
========================================
+ Hits        22234   22268     +34     
+ Misses       6029    6028      -1

@aeyakovenko
Copy link
Member

aeyakovenko commented May 8, 2019

@sagar-solana we should also drop anything that can't afford the fee (could be done in a different PR though)

@pgarg66 pgarg66 requested a review from garious May 8, 2019 03:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bootstrap leader in non CUDA testnet is running OOM
6 participants