Expand description
The bank
module tracks client accounts and the progress of on-chain
programs.
A single bank relates to a block produced by a single leader and each bank except for the genesis bank points back to a parent bank.
The bank is the main entrypoint for processing verified transactions with the function
Bank::process_transactions
It does this by loading the accounts using the reference it holds on the account store, and then passing those to an InvokeContext which handles loading the programs specified by the Transaction and executing it.
The bank then stores the results to the accounts store.
It then has apis for retrieving if a transaction has been processed and it’s status.
See get_signature_status
et al.
Bank lifecycle:
A bank is newly created and open to transactions. Transactions are applied
until either the bank reached the tick count when the node is the leader for that slot, or the
node has applied all transactions present in all Entry
s in the slot.
Once it is complete, the bank can then be frozen. After frozen, no more transactions can be applied or state changes made. At the frozen step, rent will be applied and various sysvar special accounts update to the new state of the system.
After frozen, and the bank has had the appropriate number of votes on it, then it can become rooted. At this point, it will not be able to be removed from the chain and the state is finalized.
It offers a high-level API that signs transactions on behalf of the caller, and a low-level API for when they have already been signed and verified.
Modules§
- test_
utils - utility function used for testing and benchmarking.
Structs§
- Bank
- 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
- Bank
Fields ToDeserialize - Bank
Incremental Snapshot Persistence - Incremental snapshots only calculate their accounts hash based on the account changes WITHIN the incremental slot range. So, we need to keep track of the full snapshot expected accounts hash results. We also need to keep track of the hash and capitalization specific to the incremental snapshot slot range. The capitalization we calculate for the incremental slot will NOT be consistent with the bank’s capitalization. It is not feasible to calculate a capitalization delta that is correct given just incremental slots account data and the full snapshot’s capitalization.
- BankRc
- Builtin
Programs - Commit
Transaction Counts - Load
AndExecute Transactions Output - NewBank
Options - Nonce
Full - Holds fee subtracted nonce info
- Nonce
Partial - Holds limited nonce info available during transaction checks
- Optional
Drop Callback - Rent
Debit - Rent
Debits - Reward
Info - Squash
Timing - Total
Accounts Stats - Struct to collect stats when scanning all accounts in
get_total_accounts_stats()
- Transaction
Balances Set - Transaction
Execution Details - Transaction
LogCollector - Transaction
LogCollector Config - Transaction
LogInfo - Transaction
Results - Transaction
Simulation Result - Verify
Bank Hash - params to
verify_bank_hash
Enums§
- Durable
Nonce Fee - Reward
Calculation Event - Reward
Type - Transaction
Execution Result - Type safe representation of a transaction execution attempt which differentiates between a transaction that was executed (will be committed to the ledger) and a transaction which wasn’t executed and will be dropped.
- Transaction
LogCollector Filter
Constants§
Traits§
Functions§
- inner_
instructions_ list_ from_ instruction_ trace - Convert from an InstructionTrace to InnerInstructionsList
Type Aliases§
- Bank
Slot Delta - Bank
Status Cache - Inner
Instructions - An ordered list of compiled instructions that were invoked during a transaction instruction
- Inner
Instructions List - A list of compiled instructions that were invoked during each instruction of a transaction
- Partitions
PerCycle - Rewrites
- Transaction
Balances - Transaction
Check Result - Transaction
LogMessages - A list of log messages emitted during a transaction