Struct solana_runtime::bank::Bank[][src]

pub struct Bank {
    pub rc: BankRc,
    pub src: StatusCacheRc,
    pub ancestors: Ancestors,
    pub evm_chain_id: u64,
    pub evm_state: RwLock<EvmState>,
    pub last_vote_sync: AtomicU64,
    pub rewards: RwLock<Vec<(Pubkey, RewardInfo)>>,
    pub skip_drop: AtomicBool,
    pub cluster_type: Option<ClusterType>,
    pub lazy_rent_collection: AtomicBool,
    pub no_stake_rewrite: AtomicBool,
    pub rewards_pool_pubkeys: Arc<HashSet<Pubkey>>,
    pub transaction_log_collector_config: Arc<RwLock<TransactionLogCollectorConfig>>,
    pub transaction_log_collector: Arc<RwLock<TransactionLogCollector>>,
    pub feature_set: Arc<FeatureSet>,
    pub drop_callback: RwLock<OptionalDropCallback>,
    pub freeze_started: AtomicBool,
    // some fields omitted
}

Manager for the state of all accounts and programs after processing its entries. AbiExample is needed even without Serialize/Deserialize; actual (de-)serialization are implemented elsewhere for versioning

Fields

rc: BankRc

References to accounts, parent and signature status

src: StatusCacheRcancestors: Ancestors

The set of parents including this bank

evm_chain_id: u64evm_state: RwLock<EvmState>last_vote_sync: AtomicU64

Last time when the cluster info vote listener has synced with this bank

rewards: RwLock<Vec<(Pubkey, RewardInfo)>>

Protocol-level rewards that were distributed by this bank

skip_drop: AtomicBoolcluster_type: Option<ClusterType>lazy_rent_collection: AtomicBoolno_stake_rewrite: AtomicBoolrewards_pool_pubkeys: Arc<HashSet<Pubkey>>transaction_log_collector_config: Arc<RwLock<TransactionLogCollectorConfig>>transaction_log_collector: Arc<RwLock<TransactionLogCollector>>feature_set: Arc<FeatureSet>drop_callback: RwLock<OptionalDropCallback>freeze_started: AtomicBool

Implementations

impl Bank[src]

pub fn new(genesis_config: &GenesisConfig) -> Self[src]

pub fn new_with_paths(
    genesis_config: &GenesisConfig,
    evm_paths: Option<(&Path, &Path)>,
    paths: Vec<PathBuf>,
    frozen_account_pubkeys: &[Pubkey],
    debug_keys: Option<Arc<HashSet<Pubkey>>>,
    additional_builtins: Option<&Builtins>,
    account_indexes: HashSet<AccountIndex>,
    accounts_db_caching_enabled: bool
) -> Self
[src]

pub fn new_from_parent(
    parent: &Arc<Bank>,
    collector_id: &Pubkey,
    slot: Slot
) -> Self
[src]

Create a new bank that points to an immutable checkpoint of another bank.

pub fn new_from_parent_with_tracer(
    parent: &Arc<Bank>,
    collector_id: &Pubkey,
    slot: Slot,
    reward_calc_tracer: impl FnMut(&RewardCalculationEvent<'_, '_>)
) -> Self
[src]

pub fn set_callback(
    &self,
    callback: Option<Box<dyn DropCallback + Send + Sync>>
)
[src]

pub fn warp_from_parent(
    parent: &Arc<Bank>,
    collector_id: &Pubkey,
    slot: Slot
) -> Self
[src]

Like new_from_parent but additionally:

  • Doesn’t assume that the parent is anywhere near slot, parent could be millions of slots in the past
  • Adjusts the new bank’s tick height to avoid having to run PoH for millions of slots
  • Freezes the new bank, assuming that the user will Bank::new_from_parent from this bank

pub fn evm_block(&self) -> Option<Block>[src]

pub fn collector_id(&self) -> &Pubkey[src]

pub fn slot(&self) -> Slot[src]

pub fn epoch(&self) -> Epoch[src]

pub fn first_normal_epoch(&self) -> Epoch[src]

pub fn freeze_lock(&self) -> RwLockReadGuard<'_, Hash>[src]

pub fn hash(&self) -> Hash[src]

pub fn is_frozen(&self) -> bool[src]

pub fn freeze_started(&self) -> bool[src]

pub fn status_cache_ancestors(&self) -> Vec<u64>[src]

pub fn unix_timestamp_from_genesis(&self) -> i64[src]

computed unix_timestamp at this slot height

pub fn get_unused_from_slot(rooted_slot: Slot, unused: u64) -> u64[src]

Unused conversion

pub fn clock(&self) -> Clock[src]

pub fn get_slot_history(&self) -> SlotHistory[src]

pub fn epoch_duration_in_years(&self, prev_epoch: Epoch) -> f64[src]

pub fn slot_in_year_for_inflation(&self) -> f64[src]

pub fn update_recent_blockhashes(&self)[src]

pub fn commit_evm(&self)[src]

pub fn rehash(&self)[src]

pub fn freeze(&self)[src]

pub fn exhaustively_free_unused_resource(&self)[src]

pub fn epoch_schedule(&self) -> &EpochSchedule[src]

pub fn squash(&self)[src]

squash the parent’s state up into this Bank, this Bank becomes a root

pub fn parent(&self) -> Option<Arc<Bank>>[src]

Return the more recent checkpoint of this bank instance.

pub fn parent_slot(&self) -> Slot[src]

pub fn add_native_program(
    &self,
    name: &str,
    program_id: &Pubkey,
    must_replace: bool
)
[src]

pub fn set_rent_burn_percentage(&mut self, burn_percent: u8)[src]

pub fn set_hashes_per_tick(&mut self, hashes_per_tick: Option<u64>)[src]

pub fn last_blockhash(&self) -> Hash[src]

Return the last block hash registered.

pub fn get_minimum_balance_for_rent_exemption(&self, data_len: usize) -> u64[src]

pub fn last_blockhash_with_fee_calculator(&self) -> (Hash, FeeCalculator)[src]

pub fn get_fee_calculator(&self, hash: &Hash) -> Option<FeeCalculator>[src]

pub fn get_fee_rate_governor(&self) -> &FeeRateGovernor[src]

pub fn get_blockhash_last_valid_slot(&self, blockhash: &Hash) -> Option<Slot>[src]

pub fn confirmed_last_blockhash(&self) -> (Hash, FeeCalculator)[src]

pub fn clear_signatures(&self)[src]

Forget all signatures. Useful for benchmarking.

pub fn clear_slot_signatures(&self, slot: Slot)[src]

pub fn can_commit(result: &Result<()>) -> bool[src]

pub fn register_tick(&self, hash: &Hash)[src]

Tell the bank which Entry IDs exist on the ledger. This function assumes subsequent calls correspond to later entries, and will boot the oldest ones once its internal cache is full. Once boot, the bank will reject transactions using that hash.

pub fn is_complete(&self) -> bool[src]

pub fn is_block_boundary(&self, tick_height: u64) -> bool[src]

pub fn process_transaction(&self, tx: &Transaction) -> Result<()>[src]

Process a Transaction. This is used for unit tests and simply calls the vector Bank::process_transactions method

pub fn prepare_batch<'a, 'b>(
    &'a self,
    txs: &'b [Transaction],
    iteration_order: Option<Vec<usize>>
) -> TransactionBatch<'a, 'b>
[src]

pub fn prepare_simulation_batch<'a, 'b>(
    &'a self,
    txs: &'b [Transaction]
) -> TransactionBatch<'a, 'b>
[src]

pub fn take_evm_state_cloned(&self) -> Option<EvmBackend<Incomming>>[src]

pub fn take_evm_state_form_simulation(&self) -> Option<EvmBackend<Incomming>>[src]

pub fn simulate_transaction(
    &self,
    transaction: Transaction
) -> (Result<()>, TransactionLogMessages)
[src]

Run transactions against a frozen bank without committing the results

pub fn unlock_accounts(&self, batch: &mut TransactionBatch<'_, '_>)[src]

pub fn remove_unrooted_slot(&self, slot: Slot)[src]

pub fn set_shrink_paths(&self, paths: Vec<PathBuf>)[src]

pub fn check_hash_age(&self, hash: &Hash, max_age: usize) -> Option<bool>[src]

pub fn check_tx_durable_nonce(
    &self,
    tx: &Transaction
) -> Option<(Pubkey, Account)>
[src]

pub fn check_transactions(
    &self,
    txs: &[Transaction],
    iteration_order: Option<&[usize]>,
    lock_results: &[Result<()>],
    max_age: usize,
    error_counters: &mut ErrorCounters
) -> Vec<TransactionCheckResult>
[src]

pub fn collect_balances(
    &self,
    batch: &TransactionBatch<'_, '_>
) -> TransactionBalances
[src]

pub fn remove_executor(&self, pubkey: &Pubkey)[src]

Remove an executor from the bank’s cache

pub fn evm_hashes(&self) -> [H256; 256][src]

pub fn load_and_execute_transactions(
    &self,
    batch: &TransactionBatch<'_, '_>,
    max_age: usize,
    enable_cpi_recording: bool,
    enable_log_recording: bool,
    timings: &mut ExecuteTimings,
    evm_state_getter: impl Fn(&Self) -> Option<EvmBackend<Incomming>>
) -> (Vec<TransactionLoadResult>, Vec<TransactionExecutionResult>, Vec<Option<InnerInstructionsList>>, Vec<TransactionLogMessages>, Vec<usize>, u64, u64, Option<EvmBackend<Incomming>>)
[src]

pub fn commit_transactions(
    &self,
    txs: &[Transaction],
    iteration_order: Option<&[usize]>,
    loaded_accounts: &mut [TransactionLoadResult],
    executed: &[TransactionExecutionResult],
    tx_count: u64,
    signature_count: u64,
    timings: &mut ExecuteTimings,
    patch: Option<EvmBackend<Incomming>>
) -> TransactionResults
[src]

pub fn cluster_type(&self) -> ClusterType[src]

#[must_use]pub fn load_execute_and_commit_transactions(
    &self,
    batch: &TransactionBatch<'_, '_>,
    max_age: usize,
    collect_balances: bool,
    enable_cpi_recording: bool,
    enable_log_recording: bool,
    timings: &mut ExecuteTimings
) -> (TransactionResults, TransactionBalancesSet, Vec<Option<InnerInstructionsList>>, Vec<TransactionLogMessages>)
[src]

Process a batch of transactions.

#[must_use]pub fn process_transactions(&self, txs: &[Transaction]) -> Vec<Result<()>>[src]

pub fn transfer(
    &self,
    n: u64,
    keypair: &Keypair,
    to: &Pubkey
) -> Result<Signature>
[src]

Create, sign, and process a Transaction from keypair to to of n lamports where blockhash is the last Entry ID observed by the client.

pub fn transfer_evm(
    &self,
    n: u64,
    fee_payer: &Keypair,
    keypair: &SecretKey,
    to: &Address
) -> Result<Signature>
[src]

pub fn read_balance(account: &Account) -> u64[src]

pub fn get_balance(&self, pubkey: &Pubkey) -> u64[src]

Each program would need to be able to introspect its own state this is hard-coded to the Budget language

pub fn parents(&self) -> Vec<Arc<Bank>>[src]

Compute all the parents of the bank in order

pub fn parents_inclusive(self: Arc<Self>) -> Vec<Arc<Bank>>[src]

Compute all the parents of the bank including this bank itself

pub fn store_account(&self, pubkey: &Pubkey, account: &Account)[src]

pub fn force_flush_accounts_cache(&self)[src]

pub fn flush_accounts_cache_if_needed(&self)[src]

pub fn expire_old_recycle_stores(&self)[src]

pub fn withdraw(&self, pubkey: &Pubkey, lamports: u64) -> Result<()>[src]

pub fn deposit(&self, pubkey: &Pubkey, lamports: u64) -> u64[src]

pub fn accounts(&self) -> Arc<Accounts>[src]

pub fn set_inflation(&self, inflation: Inflation)[src]

pub fn set_bpf_compute_budget(
    &mut self,
    bpf_compute_budget: Option<BpfComputeBudget>
)
[src]

pub fn hard_forks(&self) -> Arc<RwLock<HardForks>>[src]

pub fn get_account(&self, pubkey: &Pubkey) -> Option<Account>[src]

pub fn get_account_modified_slot(
    &self,
    pubkey: &Pubkey
) -> Option<(Account, Slot)>
[src]

pub fn get_program_accounts(
    &self,
    program_id: &Pubkey
) -> Vec<(Pubkey, Account)>
[src]

pub fn get_filtered_program_accounts<F: Fn(&Account) -> bool>(
    &self,
    program_id: &Pubkey,
    filter: F
) -> Vec<(Pubkey, Account)>
[src]

pub fn get_filtered_indexed_accounts<F: Fn(&Account) -> bool>(
    &self,
    index_key: &IndexKey,
    filter: F
) -> Vec<(Pubkey, Account)>
[src]

pub fn get_all_accounts_with_modified_slots(
    &self
) -> Vec<(Pubkey, Account, Slot)>
[src]

pub fn get_program_accounts_modified_since_parent(
    &self,
    program_id: &Pubkey
) -> Vec<(Pubkey, Account)>
[src]

pub fn get_transaction_logs(
    &self,
    address: Option<&Pubkey>
) -> Option<Vec<TransactionLogInfo>>
[src]

pub fn get_all_accounts_modified_since_parent(&self) -> Vec<(Pubkey, Account)>[src]

pub fn get_account_modified_since_parent(
    &self,
    pubkey: &Pubkey
) -> Option<(Account, Slot)>
[src]

pub fn get_largest_accounts(
    &self,
    num: usize,
    filter_by_address: &HashSet<Pubkey>,
    filter: AccountAddressFilter
) -> Vec<(Pubkey, u64)>
[src]

pub fn transaction_count(&self) -> u64[src]

pub fn signature_count(&self) -> u64[src]

pub fn get_signature_status_processed_since_parent(
    &self,
    signature: &Signature
) -> Option<Result<()>>
[src]

pub fn get_signature_status_with_blockhash(
    &self,
    signature: &Signature,
    blockhash: &Hash
) -> Option<Result<()>>
[src]

pub fn get_signature_status_slot(
    &self,
    signature: &Signature
) -> Option<(Slot, Result<()>)>
[src]

pub fn get_signature_status(&self, signature: &Signature) -> Option<Result<()>>[src]

pub fn has_signature(&self, signature: &Signature) -> bool[src]

pub fn get_snapshot_storages(&self) -> SnapshotStorages[src]

pub fn calculate_capitalization(&self) -> u64[src]

pub fn calculate_and_verify_capitalization(&self) -> bool[src]

pub fn set_capitalization(&self) -> u64[src]

Forcibly overwrites current capitalization by actually recalculating accounts’ balances. This should only be used for developing purposes.

pub fn get_accounts_hash(&self) -> Hash[src]

pub fn get_thread_pool(&self) -> &ThreadPool[src]

pub fn update_accounts_hash_with_index_option(
    &self,
    use_index: bool,
    debug_verify: bool
) -> Hash
[src]

pub fn update_accounts_hash(&self) -> Hash[src]

pub fn verify_snapshot_bank(&self) -> bool[src]

A snapshot bank should be purged of 0 lamport accounts which are not part of the hash calculation and could shield other real accounts.

pub fn hashes_per_tick(&self) -> &Option<u64>[src]

Return the number of hashes per tick

pub fn ticks_per_slot(&self) -> u64[src]

Return the number of ticks per slot

pub fn slots_per_year(&self) -> f64[src]

Return the number of slots per year

pub fn tick_height(&self) -> u64[src]

Return the number of ticks since genesis.

pub fn inflation(&self) -> Inflation[src]

Return the inflation parameters of the Bank

pub fn capitalization(&self) -> u64[src]

Return the total capitalization of the Bank

pub fn max_tick_height(&self) -> u64[src]

Return this bank’s max_tick_height

pub fn block_height(&self) -> u64[src]

Return the block_height of this bank

pub fn get_slots_in_epoch(&self, epoch: Epoch) -> u64[src]

Return the number of slots per epoch for the given epoch

pub fn get_leader_schedule_epoch(&self, slot: Slot) -> Epoch[src]

returns the epoch for which this bank’s leader_schedule_slot_offset and slot would need to cache leader_schedule

pub fn cloned_stake_delegations(&self) -> HashMap<Pubkey, Delegation>[src]

current stake delegations for this bank

pub fn staked_nodes(&self) -> HashMap<Pubkey, u64>[src]

pub fn vote_accounts(&self) -> Vec<(Pubkey, (u64, ArcVoteAccount))>[src]

current vote accounts for this bank along with the stake attributed to each account Note: This clones the entire vote-accounts hashmap. For a single account lookup use get_vote_account instead.

pub fn get_vote_account(
    &self,
    vote_account: &Pubkey
) -> Option<(u64, ArcVoteAccount)>
[src]

Vote account for the given vote account pubkey along with the stake.

pub fn epoch_stakes(&self, epoch: Epoch) -> Option<&EpochStakes>[src]

Get the EpochStakes for a given epoch

pub fn epoch_stakes_map(&self) -> &HashMap<Epoch, EpochStakes>[src]

pub fn epoch_staked_nodes(&self, epoch: Epoch) -> Option<HashMap<Pubkey, u64>>[src]

pub fn epoch_vote_accounts(
    &self,
    epoch: Epoch
) -> Option<&HashMap<Pubkey, (u64, ArcVoteAccount)>>
[src]

vote accounts for the specific epoch along with the stake attributed to each account

pub fn epoch_authorized_voter(&self, vote_account: &Pubkey) -> Option<&Pubkey>[src]

Get the fixed authorized voter for the given vote account for the current epoch

pub fn epoch_vote_accounts_for_node_id(
    &self,
    node_id: &Pubkey
) -> Option<&NodeVoteAccounts>
[src]

Get the fixed set of vote accounts for the given node id for the current epoch

pub fn total_epoch_stake(&self) -> u64[src]

Get the fixed total stake of all vote accounts for current epoch

pub fn epoch_vote_account_stake(&self, vote_account: &Pubkey) -> u64[src]

Get the fixed stake of the given vote account for the current epoch

pub fn get_epoch_and_slot_index(&self, slot: Slot) -> (Epoch, SlotIndex)[src]

given a slot, return the epoch and offset into the epoch this slot falls e.g. with a fixed number for slots_per_epoch, the calculation is simply:

( slot/slots_per_epoch, slot % slots_per_epoch )

pub fn get_epoch_info(&self) -> EpochInfo[src]

pub fn is_empty(&self) -> bool[src]

pub fn add_builtin(
    &mut self,
    name: &str,
    program_id: Pubkey,
    process_instruction_with_context: ProcessInstructionWithContext
)
[src]

Add an instruction processor to intercept instructions before the dynamic loader.

pub fn replace_builtin(
    &mut self,
    name: &str,
    program_id: Pubkey,
    process_instruction_with_context: ProcessInstructionWithContext
)
[src]

Replace a builtin instruction processor if it already exists

pub fn clean_accounts(&self, skip_last: bool)[src]

pub fn shrink_all_slots(&self)[src]

pub fn print_accounts_stats(&self)[src]

pub fn process_stale_slot_with_budget(
    &self,
    consumed_budget: usize,
    budget_recovery_delta: usize
) -> usize
[src]

pub fn shrink_candidate_slots(&self) -> usize[src]

pub fn secp256k1_program_enabled(&self) -> bool[src]

pub fn no_overflow_rent_distribution_enabled(&self) -> bool[src]

pub fn stake_program_v2_enabled(&self) -> bool[src]

pub fn check_init_vote_data_enabled(&self) -> bool[src]

pub fn simple_capitalization_enabled(&self) -> bool[src]

pub fn unlock_switch_vote(&self) -> bool[src]

pub fn deactivate_feature(&mut self, id: &Pubkey)[src]

pub fn activate_feature(&mut self, id: &Pubkey)[src]

Trait Implementations

impl Debug for Bank[src]

impl Default for Bank[src]

impl Drop for Bank[src]

impl PartialEq<Bank> for Bank[src]

Auto Trait Implementations

impl !RefUnwindSafe for Bank

impl Send for Bank

impl Sync for Bank

impl Unpin for Bank

impl !UnwindSafe for Bank

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> MaybeDebug for T where
    T: Debug
[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Typeable for T where
    T: Any

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

impl<T> WithSubscriber for T[src]