Move load_accounts to runtime (#34017)
* Move load_accounts to runtime --------- Signed-off-by: Lucas Steuernagel <lucas.tnagel@gmail.com>
This commit is contained in:
parent
e589c07fef
commit
2c71d21fad
File diff suppressed because it is too large
Load Diff
|
@ -6,7 +6,6 @@ extern crate lazy_static;
|
||||||
|
|
||||||
pub mod account_info;
|
pub mod account_info;
|
||||||
pub mod account_overrides;
|
pub mod account_overrides;
|
||||||
pub mod account_rent_state;
|
|
||||||
pub mod account_storage;
|
pub mod account_storage;
|
||||||
pub mod accounts;
|
pub mod accounts;
|
||||||
pub mod accounts_cache;
|
pub mod accounts_cache;
|
||||||
|
|
|
@ -10,7 +10,7 @@ use {
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub enum RentState {
|
pub(crate) enum RentState {
|
||||||
/// account.lamports == 0
|
/// account.lamports == 0
|
||||||
Uninitialized,
|
Uninitialized,
|
||||||
/// 0 < account.lamports < rent-exempt-minimum
|
/// 0 < account.lamports < rent-exempt-minimum
|
||||||
|
@ -58,7 +58,7 @@ impl RentState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn submit_rent_state_metrics(pre_rent_state: &RentState, post_rent_state: &RentState) {
|
pub(super) fn submit_rent_state_metrics(pre_rent_state: &RentState, post_rent_state: &RentState) {
|
||||||
match (pre_rent_state, post_rent_state) {
|
match (pre_rent_state, post_rent_state) {
|
||||||
(&RentState::Uninitialized, &RentState::RentPaying { .. }) => {
|
(&RentState::Uninitialized, &RentState::RentPaying { .. }) => {
|
||||||
inc_new_counter_info!("rent_paying_err-new_account", 1);
|
inc_new_counter_info!("rent_paying_err-new_account", 1);
|
||||||
|
@ -73,7 +73,7 @@ pub(crate) fn submit_rent_state_metrics(pre_rent_state: &RentState, post_rent_st
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn check_rent_state(
|
pub(crate) fn check_rent_state(
|
||||||
pre_rent_state: Option<&RentState>,
|
pre_rent_state: Option<&RentState>,
|
||||||
post_rent_state: Option<&RentState>,
|
post_rent_state: Option<&RentState>,
|
||||||
transaction_context: &TransactionContext,
|
transaction_context: &TransactionContext,
|
||||||
|
@ -97,7 +97,7 @@ pub fn check_rent_state(
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn check_rent_state_with_account(
|
pub(super) fn check_rent_state_with_account(
|
||||||
pre_rent_state: &RentState,
|
pre_rent_state: &RentState,
|
||||||
post_rent_state: &RentState,
|
post_rent_state: &RentState,
|
||||||
address: &Pubkey,
|
address: &Pubkey,
|
File diff suppressed because it is too large
Load Diff
|
@ -278,6 +278,7 @@ pub struct BankRc {
|
||||||
pub(crate) bank_id_generator: Arc<AtomicU64>,
|
pub(crate) bank_id_generator: Arc<AtomicU64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use crate::accounts::load_accounts;
|
||||||
#[cfg(RUSTC_WITH_SPECIALIZATION)]
|
#[cfg(RUSTC_WITH_SPECIALIZATION)]
|
||||||
use solana_frozen_abi::abi_example::AbiExample;
|
use solana_frozen_abi::abi_example::AbiExample;
|
||||||
|
|
||||||
|
@ -5243,7 +5244,8 @@ impl Bank {
|
||||||
));
|
));
|
||||||
|
|
||||||
let mut load_time = Measure::start("accounts_load");
|
let mut load_time = Measure::start("accounts_load");
|
||||||
let mut loaded_transactions = self.rc.accounts.load_accounts(
|
let mut loaded_transactions = load_accounts(
|
||||||
|
&self.rc.accounts.accounts_db,
|
||||||
&self.ancestors,
|
&self.ancestors,
|
||||||
sanitized_txs,
|
sanitized_txs,
|
||||||
check_results,
|
check_results,
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
use {
|
use {
|
||||||
super::Bank,
|
super::Bank,
|
||||||
|
crate::accounts::account_rent_state::RentState,
|
||||||
log::{debug, warn},
|
log::{debug, warn},
|
||||||
solana_accounts_db::{account_rent_state::RentState, stake_rewards::RewardInfo},
|
solana_accounts_db::stake_rewards::RewardInfo,
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
account::{ReadableAccount, WritableAccount},
|
account::{ReadableAccount, WritableAccount},
|
||||||
pubkey::Pubkey,
|
pubkey::Pubkey,
|
||||||
|
|
|
@ -10872,7 +10872,8 @@ fn test_rent_state_list_len() {
|
||||||
let num_accounts = tx.message().account_keys.len();
|
let num_accounts = tx.message().account_keys.len();
|
||||||
let sanitized_tx = SanitizedTransaction::try_from_legacy_transaction(tx).unwrap();
|
let sanitized_tx = SanitizedTransaction::try_from_legacy_transaction(tx).unwrap();
|
||||||
let mut error_counters = TransactionErrorMetrics::default();
|
let mut error_counters = TransactionErrorMetrics::default();
|
||||||
let loaded_txs = bank.rc.accounts.load_accounts(
|
let loaded_txs = load_accounts(
|
||||||
|
&bank.accounts().accounts_db,
|
||||||
&bank.ancestors,
|
&bank.ancestors,
|
||||||
&[sanitized_tx.clone()],
|
&[sanitized_tx.clone()],
|
||||||
vec![(Ok(()), None)],
|
vec![(Ok(()), None)],
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
use {
|
use {
|
||||||
crate::bank::Bank,
|
crate::{
|
||||||
solana_accounts_db::account_rent_state::{check_rent_state, RentState},
|
accounts::account_rent_state::{check_rent_state, RentState},
|
||||||
|
bank::Bank,
|
||||||
|
},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
account::ReadableAccount,
|
account::ReadableAccount,
|
||||||
message::SanitizedMessage,
|
message::SanitizedMessage,
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate lazy_static;
|
extern crate lazy_static;
|
||||||
|
|
||||||
|
pub mod accounts;
|
||||||
pub mod accounts_background_service;
|
pub mod accounts_background_service;
|
||||||
pub mod bank;
|
pub mod bank;
|
||||||
pub mod bank_client;
|
pub mod bank_client;
|
||||||
|
|
Loading…
Reference in New Issue