Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
2247916
output txn signature for debug purpose
lijunwangs Jan 6, 2024
6ac031b
Use datapoint as opposed to counters
lijunwangs Feb 29, 2024
3d291e3
Add a unit test
lijunwangs Feb 29, 2024
d84f335
removed a print
lijunwangs Feb 29, 2024
07a06ca
Added more unit tests
lijunwangs Feb 29, 2024
529bcc8
Making stats names consistent across layers
lijunwangs Feb 29, 2024
a76f589
Added more unit tests
lijunwangs Feb 29, 2024
1ac2493
Added more unit tests
lijunwangs Feb 29, 2024
67174d0
Do not use binary_search, do simple compare in one loop
lijunwangs Mar 1, 2024
dac53e7
Cargo.lock change
lijunwangs Mar 12, 2024
4cdca1c
measure perf track overhead
lijunwangs Mar 1, 2024
a6a530a
missing cargo.lock
lijunwangs Mar 1, 2024
c14ac99
Do not use Hashmap for perf track. Using vec. Measure the overhead of…
lijunwangs Mar 1, 2024
d122162
Clippy issue
lijunwangs Mar 1, 2024
d94ee5b
clear histogram for streamer stage
lijunwangs Mar 5, 2024
3b2565c
Fixed a rebase issue
lijunwangs Mar 2, 2024
b261b25
Fixed a clippy issue
lijunwangs Mar 2, 2024
79a0f22
instrument to pass the perf_track_metrics down the transaction proces…
lijunwangs Mar 3, 2024
956372b
move ExtendedSanitizedTransaction to solana-runtime-transaction crate
lijunwangs Mar 11, 2024
02f9732
Fixed unit test failures
lijunwangs Mar 11, 2024
e92833a
Fixed unit test failures and merge issues
lijunwangs Mar 11, 2024
8c168a5
Use Arc<Mutex on the perf metrics
lijunwangs Mar 12, 2024
210807f
runtime-transaction/src/extended_transaction.rs
lijunwangs Mar 12, 2024
ee0d4be
Removed mut on ConsumeWorker
lijunwangs Mar 12, 2024
d28e4e6
report tracked packet perf with central scheduler
lijunwangs Mar 12, 2024
4a20ac3
report count of sampled packets in the report period
lijunwangs Mar 12, 2024
770deec
fixed test failures
lijunwangs Mar 12, 2024
c19b5f3
missing Cargo.lock
lijunwangs Mar 12, 2024
9cb75ec
clippy issue
lijunwangs Mar 12, 2024
93861d9
clippy issue
lijunwangs Mar 12, 2024
6b38b51
clippy issue
lijunwangs Mar 12, 2024
b2c1973
clippy issue
lijunwangs Mar 12, 2024
899a837
clippy issue
lijunwangs Mar 12, 2024
f3bd6b7
clippy issue
lijunwangs Mar 12, 2024
62a376f
Use wrappers in ExtendedSanitizedTransaction to simplify changes
lijunwangs Mar 13, 2024
ad6896d
clippy fixes
lijunwangs Mar 13, 2024
fe64657
clippy fixes
lijunwangs Mar 13, 2024
26437de
clippy fixes; dependency sorting
lijunwangs Mar 13, 2024
5f0c223
initialize start_time in ExtendedSanitizedTransaction
lijunwangs Mar 13, 2024
57fc92b
initialize start_time in ExtendedSanitizedTransaction
lijunwangs Mar 13, 2024
5bdb868
Build ExtendedSanitizedTransaction in ImmutablePacket
lijunwangs Mar 14, 2024
53dee5b
Fixed tracked packet performance metrics for central scheduler
lijunwangs Mar 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ members = [
"tokens",
"tpu-client",
"transaction-dos",
"transaction-metrics-tracker",
"transaction-status",
"turbine",
"udp-client",
Expand Down Expand Up @@ -378,6 +379,7 @@ solana-test-validator = { path = "test-validator", version = "=2.0.0" }
solana-thin-client = { path = "thin-client", version = "=2.0.0" }
solana-tpu-client = { path = "tpu-client", version = "=2.0.0", default-features = false }
solana-transaction-status = { path = "transaction-status", version = "=2.0.0" }
solana-transaction-metrics-tracker = { path = "transaction-metrics-tracker", version = "=2.0.0" }
solana-turbine = { path = "turbine", version = "=2.0.0" }
solana-udp-client = { path = "udp-client", version = "=2.0.0" }
solana-version = { path = "version", version = "=2.0.0" }
Expand Down
1 change: 1 addition & 0 deletions accounts-db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ solana-metrics = { workspace = true }
solana-nohash-hasher = { workspace = true }
solana-program-runtime = { workspace = true }
solana-rayon-threadlimit = { workspace = true }
solana-runtime-transaction = { workspace = true }
solana-sdk = { workspace = true }
solana-stake-program = { workspace = true }
solana-svm = { workspace = true }
Expand Down
58 changes: 30 additions & 28 deletions accounts-db/src/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use {
},
dashmap::DashMap,
log::*,
solana_runtime_transaction::extended_transaction::ExtendedSanitizedTransaction,
solana_sdk::{
account::{AccountSharedData, ReadableAccount},
account_utils::StateMut,
Expand All @@ -23,18 +24,15 @@ use {
nonce_info::{NonceFull, NonceInfo},
pubkey::Pubkey,
slot_hashes::SlotHashes,
transaction::{Result, SanitizedTransaction, TransactionAccountLocks, TransactionError},
transaction::{Result, TransactionAccountLocks, TransactionError},
transaction_context::TransactionAccount,
},
solana_svm::{
account_loader::TransactionLoadResult, transaction_results::TransactionExecutionResult,
},
std::{
cmp::Reverse,
collections::{
hash_map::{self},
BinaryHeap, HashMap, HashSet,
},
collections::{hash_map, BinaryHeap, HashMap, HashSet},
ops::RangeBounds,
sync::{
atomic::{AtomicUsize, Ordering},
Expand Down Expand Up @@ -577,7 +575,7 @@ impl Accounts {
#[allow(clippy::needless_collect)]
pub fn lock_accounts<'a>(
&self,
txs: impl Iterator<Item = &'a SanitizedTransaction>,
txs: impl Iterator<Item = &'a ExtendedSanitizedTransaction>,
tx_account_lock_limit: usize,
) -> Vec<Result<()>> {
let tx_account_locks_results: Vec<Result<_>> = txs
Expand All @@ -590,7 +588,7 @@ impl Accounts {
#[allow(clippy::needless_collect)]
pub fn lock_accounts_with_results<'a>(
&self,
txs: impl Iterator<Item = &'a SanitizedTransaction>,
txs: impl Iterator<Item = &'a ExtendedSanitizedTransaction>,
results: impl Iterator<Item = Result<()>>,
tx_account_lock_limit: usize,
) -> Vec<Result<()>> {
Expand Down Expand Up @@ -627,7 +625,7 @@ impl Accounts {
#[allow(clippy::needless_collect)]
pub fn unlock_accounts<'a>(
&self,
txs_and_results: impl Iterator<Item = (&'a SanitizedTransaction, &'a Result<()>)>,
txs_and_results: impl Iterator<Item = (&'a ExtendedSanitizedTransaction, &'a Result<()>)>,
) {
let keys: Vec<_> = txs_and_results
.filter(|(_, res)| res.is_ok())
Expand All @@ -650,7 +648,7 @@ impl Accounts {
pub fn store_cached(
&self,
slot: Slot,
txs: &[SanitizedTransaction],
txs: &[ExtendedSanitizedTransaction],
res: &[TransactionExecutionResult],
loaded: &mut [TransactionLoadResult],
durable_nonce: &DurableNonce,
Expand All @@ -677,14 +675,14 @@ impl Accounts {
#[allow(clippy::too_many_arguments)]
fn collect_accounts_to_store<'a>(
&self,
txs: &'a [SanitizedTransaction],
txs: &'a [ExtendedSanitizedTransaction],
execution_results: &'a [TransactionExecutionResult],
load_results: &'a mut [TransactionLoadResult],
durable_nonce: &DurableNonce,
lamports_per_signature: u64,
) -> (
Vec<(&'a Pubkey, &'a AccountSharedData)>,
Vec<Option<&'a SanitizedTransaction>>,
Vec<Option<&'a ExtendedSanitizedTransaction>>,
) {
let mut accounts = Vec::with_capacity(load_results.len());
let mut transactions = Vec::with_capacity(load_results.len());
Expand Down Expand Up @@ -815,7 +813,7 @@ mod tests {
rent_debits::RentDebits,
signature::{keypair_from_seed, signers::Signers, Keypair, Signer},
system_instruction, system_program,
transaction::{Transaction, MAX_TX_ACCOUNT_LOCKS},
transaction::{SanitizedTransaction, Transaction, MAX_TX_ACCOUNT_LOCKS},
},
solana_svm::{
account_loader::LoadedTransaction,
Expand Down Expand Up @@ -1082,7 +1080,7 @@ mod tests {
};

let tx = new_sanitized_tx(&[&keypair], message, Hash::default());
let results = accounts.lock_accounts([tx].iter(), MAX_TX_ACCOUNT_LOCKS);
let results = accounts.lock_accounts([tx.into()].iter(), MAX_TX_ACCOUNT_LOCKS);
assert_eq!(results[0], Err(TransactionError::AccountLoadedTwice));
}

Expand All @@ -1109,7 +1107,7 @@ mod tests {
..Message::default()
};

let txs = vec![new_sanitized_tx(&[&keypair], message, Hash::default())];
let txs = vec![new_sanitized_tx(&[&keypair], message, Hash::default()).into()];
let results = accounts.lock_accounts(txs.iter(), MAX_TX_ACCOUNT_LOCKS);
assert_eq!(results, vec![Ok(())]);
accounts.unlock_accounts(txs.iter().zip(&results));
Expand All @@ -1131,7 +1129,7 @@ mod tests {
..Message::default()
};

let txs = vec![new_sanitized_tx(&[&keypair], message, Hash::default())];
let txs = vec![new_sanitized_tx(&[&keypair], message, Hash::default()).into()];
let results = accounts.lock_accounts(txs.iter(), MAX_TX_ACCOUNT_LOCKS);
assert_eq!(results[0], Err(TransactionError::TooManyAccountLocks));
}
Expand Down Expand Up @@ -1166,7 +1164,7 @@ mod tests {
instructions,
);
let tx = new_sanitized_tx(&[&keypair0], message, Hash::default());
let results0 = accounts.lock_accounts([tx.clone()].iter(), MAX_TX_ACCOUNT_LOCKS);
let results0 = accounts.lock_accounts([tx.clone().into()].iter(), MAX_TX_ACCOUNT_LOCKS);

assert_eq!(results0, vec![Ok(())]);
assert_eq!(
Expand Down Expand Up @@ -1200,7 +1198,7 @@ mod tests {
instructions,
);
let tx1 = new_sanitized_tx(&[&keypair1], message, Hash::default());
let txs = vec![tx0, tx1];
let txs = vec![tx0.into(), tx1.into()];
let results1 = accounts.lock_accounts(txs.iter(), MAX_TX_ACCOUNT_LOCKS);
assert_eq!(
results1,
Expand All @@ -1220,7 +1218,7 @@ mod tests {
2
);

accounts.unlock_accounts(iter::once(&tx).zip(&results0));
accounts.unlock_accounts(iter::once(&tx.into()).zip(&results0));
accounts.unlock_accounts(txs.iter().zip(&results1));
let instructions = vec![CompiledInstruction::new(2, &(), vec![0, 1])];
let message = Message::new_with_compiled_instructions(
Expand All @@ -1232,7 +1230,7 @@ mod tests {
instructions,
);
let tx = new_sanitized_tx(&[&keypair1], message, Hash::default());
let results2 = accounts.lock_accounts([tx].iter(), MAX_TX_ACCOUNT_LOCKS);
let results2 = accounts.lock_accounts([tx.into()].iter(), MAX_TX_ACCOUNT_LOCKS);
assert_eq!(
results2,
vec![Ok(())] // Now keypair1 account can be locked as writable
Expand Down Expand Up @@ -1295,7 +1293,7 @@ mod tests {
let accounts_clone = accounts_arc.clone();
let exit_clone = exit.clone();
thread::spawn(move || loop {
let txs = vec![writable_tx.clone()];
let txs = vec![writable_tx.clone().into()];
let results = accounts_clone
.clone()
.lock_accounts(txs.iter(), MAX_TX_ACCOUNT_LOCKS);
Expand All @@ -1311,7 +1309,7 @@ mod tests {
});
let counter_clone = counter;
for _ in 0..5 {
let txs = vec![readonly_tx.clone()];
let txs = vec![readonly_tx.clone().into()];
let results = accounts_arc
.clone()
.lock_accounts(txs.iter(), MAX_TX_ACCOUNT_LOCKS);
Expand Down Expand Up @@ -1355,7 +1353,7 @@ mod tests {
instructions,
);
let tx = new_sanitized_tx(&[&keypair0], message, Hash::default());
let results0 = accounts.lock_accounts([tx].iter(), MAX_TX_ACCOUNT_LOCKS);
let results0 = accounts.lock_accounts([tx.into()].iter(), MAX_TX_ACCOUNT_LOCKS);

assert!(results0[0].is_ok());
// Instruction program-id account demoted to readonly
Expand Down Expand Up @@ -1447,7 +1445,7 @@ mod tests {
instructions,
);
let tx2 = new_sanitized_tx(&[&keypair3], message, Hash::default());
let txs = vec![tx0, tx1, tx2];
let txs = vec![tx0.into(), tx1.into(), tx2.into()];

let qos_results = vec![
Ok(()),
Expand Down Expand Up @@ -1577,7 +1575,7 @@ mod tests {
.unwrap()
.insert_new_readonly(&pubkey);
}
let txs = vec![tx0.clone(), tx1.clone()];
let txs = vec![tx0.clone().into(), tx1.clone().into()];
let execution_results = vec![new_execution_result(Ok(()), None); 2];
let (collected_accounts, transactions) = accounts.collect_accounts_to_store(
&txs,
Expand All @@ -1595,8 +1593,12 @@ mod tests {
.any(|(pubkey, _account)| *pubkey == &keypair1.pubkey()));

assert_eq!(transactions.len(), 2);
assert!(transactions.iter().any(|txn| txn.unwrap().eq(&tx0)));
assert!(transactions.iter().any(|txn| txn.unwrap().eq(&tx1)));
assert!(transactions
.iter()
.any(|txn| txn.unwrap().eq(&tx0.clone().into())));
assert!(transactions
.iter()
.any(|txn| txn.unwrap().eq(&tx1.clone().into())));

// Ensure readonly_lock reflects lock
assert_eq!(
Expand Down Expand Up @@ -1949,7 +1951,7 @@ mod tests {
let durable_nonce = DurableNonce::from_blockhash(&Hash::new_unique());
let accounts_db = AccountsDb::new_single_for_tests();
let accounts = Accounts::new(Arc::new(accounts_db));
let txs = vec![tx];
let txs = vec![tx.into()];
let execution_results = vec![new_execution_result(
Err(TransactionError::InstructionError(
1,
Expand Down Expand Up @@ -2055,7 +2057,7 @@ mod tests {
let durable_nonce = DurableNonce::from_blockhash(&Hash::new_unique());
let accounts_db = AccountsDb::new_single_for_tests();
let accounts = Accounts::new(Arc::new(accounts_db));
let txs = vec![tx];
let txs = vec![tx.into()];
let execution_results = vec![new_execution_result(
Err(TransactionError::InstructionError(
1,
Expand Down
Loading