Skip to content

Commit

Permalink
rename feature
Browse files Browse the repository at this point in the history
  • Loading branch information
2501babe committed Jan 13, 2025
1 parent e3c0b2f commit d1ec289
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 58 deletions.
60 changes: 30 additions & 30 deletions accounts-db/src/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ impl Accounts {
&self,
txs: impl Iterator<Item = &'a Tx>,
tx_account_lock_limit: usize,
disable_intrabatch_account_locks: bool,
relax_intrabatch_account_locks: bool,
) -> Vec<Result<()>> {
// Validate the account locks, then get iterator if successful validation.
let tx_account_locks_results: Vec<Result<_>> = txs
Expand All @@ -571,7 +571,7 @@ impl Accounts {
.map(|_| TransactionAccountLocksIterator::new(tx))
})
.collect();
self.lock_accounts_inner(tx_account_locks_results, disable_intrabatch_account_locks)
self.lock_accounts_inner(tx_account_locks_results, relax_intrabatch_account_locks)
}

#[must_use]
Expand All @@ -580,7 +580,7 @@ impl Accounts {
txs: impl Iterator<Item = &'a (impl SVMMessage + 'a)>,
results: impl Iterator<Item = Result<()>>,
tx_account_lock_limit: usize,
disable_intrabatch_account_locks: bool,
relax_intrabatch_account_locks: bool,
) -> Vec<Result<()>> {
// Validate the account locks, then get iterator if successful validation.
let tx_account_locks_results: Vec<Result<_>> = txs
Expand All @@ -591,17 +591,17 @@ impl Accounts {
Err(err) => Err(err),
})
.collect();
self.lock_accounts_inner(tx_account_locks_results, disable_intrabatch_account_locks)
self.lock_accounts_inner(tx_account_locks_results, relax_intrabatch_account_locks)
}

#[must_use]
fn lock_accounts_inner(
&self,
tx_account_locks_results: Vec<Result<TransactionAccountLocksIterator<impl SVMMessage>>>,
disable_intrabatch_account_locks: bool,
relax_intrabatch_account_locks: bool,
) -> Vec<Result<()>> {
let account_locks = &mut self.account_locks.lock().unwrap();
if disable_intrabatch_account_locks {
if relax_intrabatch_account_locks {
let validated_batch_keys = tx_account_locks_results
.into_iter()
.map(|tx_account_locks_result| {
Expand Down Expand Up @@ -922,7 +922,7 @@ mod tests {

#[test_case(false; "old")]
#[test_case(true; "simd83")]
fn test_lock_accounts_with_duplicates(disable_intrabatch_account_locks: bool) {
fn test_lock_accounts_with_duplicates(relax_intrabatch_account_locks: bool) {
let accounts_db = AccountsDb::new_single_for_tests();
let accounts = Accounts::new(Arc::new(accounts_db));

Expand All @@ -940,14 +940,14 @@ mod tests {
let results = accounts.lock_accounts(
[tx].iter(),
MAX_TX_ACCOUNT_LOCKS,
disable_intrabatch_account_locks,
relax_intrabatch_account_locks,
);
assert_eq!(results[0], Err(TransactionError::AccountLoadedTwice));
}

#[test_case(false; "old")]
#[test_case(true; "simd83")]
fn test_lock_accounts_with_too_many_accounts(disable_intrabatch_account_locks: bool) {
fn test_lock_accounts_with_too_many_accounts(relax_intrabatch_account_locks: bool) {
let accounts_db = AccountsDb::new_single_for_tests();
let accounts = Accounts::new(Arc::new(accounts_db));

Expand All @@ -973,7 +973,7 @@ mod tests {
let results = accounts.lock_accounts(
txs.iter(),
MAX_TX_ACCOUNT_LOCKS,
disable_intrabatch_account_locks,
relax_intrabatch_account_locks,
);
assert_eq!(results, vec![Ok(())]);
accounts.unlock_accounts(txs.iter().zip(&results));
Expand All @@ -999,15 +999,15 @@ mod tests {
let results = accounts.lock_accounts(
txs.iter(),
MAX_TX_ACCOUNT_LOCKS,
disable_intrabatch_account_locks,
relax_intrabatch_account_locks,
);
assert_eq!(results[0], Err(TransactionError::TooManyAccountLocks));
}
}

#[test_case(false; "old")]
#[test_case(true; "simd83")]
fn test_accounts_locks(disable_intrabatch_account_locks: bool) {
fn test_accounts_locks(relax_intrabatch_account_locks: bool) {
let keypair0 = Keypair::new();
let keypair1 = Keypair::new();
let keypair2 = Keypair::new();
Expand Down Expand Up @@ -1038,7 +1038,7 @@ mod tests {
let results0 = accounts.lock_accounts(
[tx.clone()].iter(),
MAX_TX_ACCOUNT_LOCKS,
disable_intrabatch_account_locks,
relax_intrabatch_account_locks,
);

assert_eq!(results0, vec![Ok(())]);
Expand Down Expand Up @@ -1072,7 +1072,7 @@ mod tests {
let results1 = accounts.lock_accounts(
txs.iter(),
MAX_TX_ACCOUNT_LOCKS,
disable_intrabatch_account_locks,
relax_intrabatch_account_locks,
);
assert_eq!(
results1,
Expand Down Expand Up @@ -1102,7 +1102,7 @@ mod tests {
let results2 = accounts.lock_accounts(
[tx].iter(),
MAX_TX_ACCOUNT_LOCKS,
disable_intrabatch_account_locks,
relax_intrabatch_account_locks,
);
assert_eq!(
results2,
Expand All @@ -1119,7 +1119,7 @@ mod tests {

#[test_case(false; "old")]
#[test_case(true; "simd83")]
fn test_accounts_locks_multithreaded(disable_intrabatch_account_locks: bool) {
fn test_accounts_locks_multithreaded(relax_intrabatch_account_locks: bool) {
let counter = Arc::new(AtomicU64::new(0));
let exit = Arc::new(AtomicBool::new(false));

Expand Down Expand Up @@ -1169,7 +1169,7 @@ mod tests {
let results = accounts_clone.clone().lock_accounts(
txs.iter(),
MAX_TX_ACCOUNT_LOCKS,
disable_intrabatch_account_locks,
relax_intrabatch_account_locks,
);
for result in results.iter() {
if result.is_ok() {
Expand All @@ -1187,7 +1187,7 @@ mod tests {
let results = accounts_arc.clone().lock_accounts(
txs.iter(),
MAX_TX_ACCOUNT_LOCKS,
disable_intrabatch_account_locks,
relax_intrabatch_account_locks,
);
if results[0].is_ok() {
let counter_value = counter_clone.clone().load(Ordering::Acquire);
Expand All @@ -1202,7 +1202,7 @@ mod tests {

#[test_case(false; "old")]
#[test_case(true; "simd83")]
fn test_demote_program_write_locks(disable_intrabatch_account_locks: bool) {
fn test_demote_program_write_locks(relax_intrabatch_account_locks: bool) {
let keypair0 = Keypair::new();
let keypair1 = Keypair::new();
let keypair2 = Keypair::new();
Expand Down Expand Up @@ -1233,7 +1233,7 @@ mod tests {
let results0 = accounts.lock_accounts(
[tx].iter(),
MAX_TX_ACCOUNT_LOCKS,
disable_intrabatch_account_locks,
relax_intrabatch_account_locks,
);

assert!(results0[0].is_ok());
Expand Down Expand Up @@ -1272,7 +1272,7 @@ mod tests {

#[test_case(false; "old")]
#[test_case(true; "simd83")]
fn test_accounts_locks_with_results(disable_intrabatch_account_locks: bool) {
fn test_accounts_locks_with_results(relax_intrabatch_account_locks: bool) {
let keypair0 = Keypair::new();
let keypair1 = Keypair::new();
let keypair2 = Keypair::new();
Expand Down Expand Up @@ -1332,7 +1332,7 @@ mod tests {
txs.iter(),
qos_results.into_iter(),
MAX_TX_ACCOUNT_LOCKS,
disable_intrabatch_account_locks,
relax_intrabatch_account_locks,
);

assert_eq!(
Expand Down Expand Up @@ -1360,7 +1360,7 @@ mod tests {

#[test_case(false; "old")]
#[test_case(true; "simd83")]
fn test_accounts_locks_intrabatch_conflicts(disable_intrabatch_account_locks: bool) {
fn test_accounts_locks_intrabatch_conflicts(relax_intrabatch_account_locks: bool) {
let pubkey = Pubkey::new_unique();
let account_data = AccountSharedData::new(1, 0, &Pubkey::default());
let accounts_db = Arc::new(AccountsDb::new_single_for_tests());
Expand Down Expand Up @@ -1389,7 +1389,7 @@ mod tests {
let results = accounts.lock_accounts(
[w_tx.clone()].iter(),
MAX_TX_ACCOUNT_LOCKS,
disable_intrabatch_account_locks,
relax_intrabatch_account_locks,
);

assert_eq!(results, vec![Ok(())]);
Expand All @@ -1398,7 +1398,7 @@ mod tests {
let results = accounts.lock_accounts(
[r_tx.clone()].iter(),
MAX_TX_ACCOUNT_LOCKS,
disable_intrabatch_account_locks,
relax_intrabatch_account_locks,
);

assert_eq!(results, vec![Err(TransactionError::AccountInUse)]);
Expand All @@ -1407,7 +1407,7 @@ mod tests {
let results = accounts.lock_accounts(
[w_tx.clone()].iter(),
MAX_TX_ACCOUNT_LOCKS,
disable_intrabatch_account_locks,
relax_intrabatch_account_locks,
);

assert_eq!(results, vec![Err(TransactionError::AccountInUse)]);
Expand All @@ -1417,10 +1417,10 @@ mod tests {
let results = accounts.lock_accounts(
[w_tx.clone(), r_tx.clone()].iter(),
MAX_TX_ACCOUNT_LOCKS,
disable_intrabatch_account_locks,
relax_intrabatch_account_locks,
);

if disable_intrabatch_account_locks {
if relax_intrabatch_account_locks {
assert_eq!(results, vec![Ok(()), Ok(())]);
} else {
assert_eq!(results, vec![Ok(()), Err(TransactionError::AccountInUse)]);
Expand All @@ -1431,10 +1431,10 @@ mod tests {
let results = accounts.lock_accounts(
[w_tx.clone(), r_tx.clone()].iter(),
MAX_TX_ACCOUNT_LOCKS,
disable_intrabatch_account_locks,
relax_intrabatch_account_locks,
);

if disable_intrabatch_account_locks {
if relax_intrabatch_account_locks {
assert_eq!(results, vec![Ok(()), Ok(())]);
} else {
assert_eq!(results, vec![Ok(()), Err(TransactionError::AccountInUse)]);
Expand Down
4 changes: 2 additions & 2 deletions core/src/banking_stage/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2310,7 +2310,7 @@ mod tests {

#[test_case(false; "old")]
#[test_case(true; "simd83")]
fn test_consume_buffered_packets_retryable(disable_intrabatch_account_locks: bool) {
fn test_consume_buffered_packets_retryable(relax_intrabatch_account_locks: bool) {
let ledger_path = get_tmp_ledger_path_auto_delete!();
{
let (transactions, bank, _bank_forks, poh_recorder, _entry_receiver, _, poh_simulator) =
Expand Down Expand Up @@ -2360,7 +2360,7 @@ mod tests {
let _ = bank_start.working_bank.accounts().lock_accounts(
std::iter::once(&manual_lock_tx),
bank_start.working_bank.get_transaction_account_lock_limit(),
disable_intrabatch_account_locks,
relax_intrabatch_account_locks,
);

let banking_stage_stats = BankingStageStats::default();
Expand Down
12 changes: 6 additions & 6 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3138,13 +3138,13 @@ impl Bank {
/// Attempt to take locks on the accounts in a transaction batch
pub fn try_lock_accounts(&self, txs: &[impl SVMMessage]) -> Vec<Result<()>> {
let tx_account_lock_limit = self.get_transaction_account_lock_limit();
let disable_intrabatch_account_locks = self
let relax_intrabatch_account_locks = self
.feature_set
.is_active(&feature_set::disable_intrabatch_account_locks::id());
.is_active(&feature_set::relax_intrabatch_account_locks::id());
self.rc.accounts.lock_accounts(
txs.iter(),
tx_account_lock_limit,
disable_intrabatch_account_locks,
relax_intrabatch_account_locks,
)
}

Expand All @@ -3156,14 +3156,14 @@ impl Bank {
tx_results: impl Iterator<Item = Result<()>>,
) -> Vec<Result<()>> {
let tx_account_lock_limit = self.get_transaction_account_lock_limit();
let disable_intrabatch_account_locks = self
let relax_intrabatch_account_locks = self
.feature_set
.is_active(&feature_set::disable_intrabatch_account_locks::id());
.is_active(&feature_set::relax_intrabatch_account_locks::id());
self.rc.accounts.lock_accounts_with_results(
txs.iter(),
tx_results,
tx_account_lock_limit,
disable_intrabatch_account_locks,
relax_intrabatch_account_locks,
)
}

Expand Down
16 changes: 8 additions & 8 deletions runtime/src/bank/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3145,15 +3145,15 @@ fn test_debits_before_credits() {

#[test_case(false; "old")]
#[test_case(true; "simd83")]
fn test_readonly_accounts(disable_intrabatch_account_locks: bool) {
fn test_readonly_accounts(relax_intrabatch_account_locks: bool) {
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config_with_leader(500, &solana_pubkey::new_rand(), 0);
let mut bank = Bank::new_for_tests(&genesis_config);
if !disable_intrabatch_account_locks {
bank.deactivate_feature(&feature_set::disable_intrabatch_account_locks::id());
if !relax_intrabatch_account_locks {
bank.deactivate_feature(&feature_set::relax_intrabatch_account_locks::id());
}
let (bank, _bank_forks) = bank.wrap_with_bank_forks_for_tests();

Expand Down Expand Up @@ -3223,7 +3223,7 @@ fn test_readonly_accounts(disable_intrabatch_account_locks: bool) {
assert_eq!(results[0], Ok(()));
assert_eq!(
results[1],
if disable_intrabatch_account_locks {
if relax_intrabatch_account_locks {
Ok(())
} else {
Err(TransactionError::AccountInUse)
Expand Down Expand Up @@ -9470,7 +9470,7 @@ fn test_vote_epoch_panic() {

#[test_case(false; "old")]
#[test_case(true; "simd83")]
fn test_tx_log_order(disable_intrabatch_account_locks: bool) {
fn test_tx_log_order(relax_intrabatch_account_locks: bool) {
let GenesisConfigInfo {
genesis_config,
mint_keypair,
Expand All @@ -9481,8 +9481,8 @@ fn test_tx_log_order(disable_intrabatch_account_locks: bool) {
bootstrap_validator_stake_lamports(),
);
let mut bank = Bank::new_for_tests(&genesis_config);
if !disable_intrabatch_account_locks {
bank.deactivate_feature(&feature_set::disable_intrabatch_account_locks::id());
if !relax_intrabatch_account_locks {
bank.deactivate_feature(&feature_set::relax_intrabatch_account_locks::id());
}
let (bank, _bank_forks) = bank.wrap_with_bank_forks_for_tests();
*bank.transaction_log_collector_config.write().unwrap() = TransactionLogCollectorConfig {
Expand Down Expand Up @@ -9541,7 +9541,7 @@ fn test_tx_log_order(disable_intrabatch_account_locks: bool) {
.as_ref()
.unwrap()[2]
.contains(&"failed".to_string()));
if disable_intrabatch_account_locks {
if relax_intrabatch_account_locks {
assert!(commit_results[2].is_ok());
} else {
assert!(commit_results[2].is_err());
Expand Down
Loading

0 comments on commit d1ec289

Please sign in to comment.