Skip to content

Commit

Permalink
SVM: move transaction_results from accounts-db to SVM (solana-labs#35183
Browse files Browse the repository at this point in the history
)

SVM: Remove accounts-db deps in accounts_loader tests
  • Loading branch information
dmakarov authored Feb 20, 2024
1 parent a1c39a3 commit 0acee67
Show file tree
Hide file tree
Showing 21 changed files with 63 additions and 55 deletions.
5 changes: 3 additions & 2 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions accounts-db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ solana-program-runtime = { workspace = true }
solana-rayon-threadlimit = { workspace = true }
solana-sdk = { workspace = true }
solana-stake-program = { workspace = true }
solana-svm = { workspace = true }
solana-system-program = { workspace = true }
solana-vote-program = { workspace = true }
static_assertions = { workspace = true }
Expand Down
26 changes: 9 additions & 17 deletions accounts-db/src/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use {
accounts_index::{IndexKey, ScanConfig, ScanError, ScanResult, ZeroLamport},
ancestors::Ancestors,
storable_accounts::StorableAccounts,
transaction_results::TransactionExecutionResult,
},
dashmap::DashMap,
log::*,
Expand All @@ -23,10 +22,12 @@ use {
},
nonce_info::{NonceFull, NonceInfo},
pubkey::Pubkey,
rent_debits::RentDebits,
slot_hashes::SlotHashes,
transaction::{Result, SanitizedTransaction, TransactionAccountLocks, TransactionError},
transaction_context::{IndexOfAccount, TransactionAccount},
transaction_context::TransactionAccount,
},
solana_svm::{
account_loader::TransactionLoadResult, transaction_results::TransactionExecutionResult,
},
std::{
cmp::Reverse,
Expand Down Expand Up @@ -98,19 +99,6 @@ pub struct Accounts {
pub(crate) account_locks: Mutex<AccountLocks>,
}

// for the load instructions
pub type TransactionRent = u64;
pub type TransactionProgramIndices = Vec<Vec<IndexOfAccount>>;
#[derive(PartialEq, Eq, Debug, Clone)]
pub struct LoadedTransaction {
pub accounts: Vec<TransactionAccount>,
pub program_indices: TransactionProgramIndices,
pub rent: TransactionRent,
pub rent_debits: RentDebits,
}

pub type TransactionLoadResult = (Result<LoadedTransaction>, Option<NonceFull>);

pub enum AccountAddressFilter {
Exclude, // exclude all addresses matching the filter
Include, // only include addresses matching the filter
Expand Down Expand Up @@ -804,7 +792,6 @@ fn prepare_if_nonce_account(
mod tests {
use {
super::*,
crate::transaction_results::{DurableNonceFee, TransactionExecutionDetails},
assert_matches::assert_matches,
solana_program_runtime::loaded_programs::LoadedProgramsForTxBatch,
solana_sdk::{
Expand All @@ -814,10 +801,15 @@ mod tests {
instruction::{CompiledInstruction, InstructionError},
message::{Message, MessageHeader},
native_loader, nonce, nonce_account,
rent_debits::RentDebits,
signature::{keypair_from_seed, signers::Signers, Keypair, Signer},
system_instruction, system_program,
transaction::{Transaction, MAX_TX_ACCOUNT_LOCKS},
},
solana_svm::{
account_loader::LoadedTransaction,
transaction_results::{DurableNonceFee, TransactionExecutionDetails},
},
std::{
borrow::Cow,
sync::atomic::{AtomicBool, AtomicU64, Ordering},
Expand Down
1 change: 0 additions & 1 deletion accounts-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ pub mod sorted_storages;
pub mod stake_rewards;
pub mod storable_accounts;
pub mod tiered_storage;
pub mod transaction_results;
pub mod utils;
mod verify_accounts_hash_in_background;
pub mod waitable_condvar;
Expand Down
2 changes: 1 addition & 1 deletion banks-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ edition = { workspace = true }
bincode = { workspace = true }
crossbeam-channel = { workspace = true }
futures = { workspace = true }
solana-accounts-db = { workspace = true }
solana-banks-interface = { workspace = true }
solana-client = { workspace = true }
solana-runtime = { workspace = true }
solana-sdk = { workspace = true }
solana-send-transaction-service = { workspace = true }
solana-svm = { workspace = true }
tarpc = { workspace = true, features = ["full"] }
tokio = { workspace = true, features = ["full"] }
tokio-serde = { workspace = true, features = ["bincode"] }
Expand Down
2 changes: 1 addition & 1 deletion banks-server/src/banks_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use {
bincode::{deserialize, serialize},
crossbeam_channel::{unbounded, Receiver, Sender},
futures::{future, prelude::stream::StreamExt},
solana_accounts_db::transaction_results::TransactionExecutionResult,
solana_banks_interface::{
Banks, BanksRequest, BanksResponse, BanksTransactionResultWithMetadata,
BanksTransactionResultWithSimulation, TransactionConfirmationStatus, TransactionMetadata,
Expand Down Expand Up @@ -30,6 +29,7 @@ use {
send_transaction_service::{SendTransactionService, TransactionInfo},
tpu_info::NullTpuInfo,
},
solana_svm::transaction_results::TransactionExecutionResult,
std::{
convert::TryFrom,
io,
Expand Down
8 changes: 4 additions & 4 deletions core/src/banking_stage/committer.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
use {
super::leader_slot_timing_metrics::LeaderExecuteAndCommitTimings,
itertools::Itertools,
solana_accounts_db::{
accounts::TransactionLoadResult,
transaction_results::{TransactionExecutionResult, TransactionResults},
},
solana_ledger::{
blockstore_processor::TransactionStatusSender, token_balances::collect_token_balances,
},
Expand All @@ -16,6 +12,10 @@ use {
transaction_batch::TransactionBatch,
},
solana_sdk::{hash::Hash, pubkey::Pubkey, saturating_add_assign},
solana_svm::{
account_loader::TransactionLoadResult,
transaction_results::{TransactionExecutionResult, TransactionResults},
},
solana_transaction_status::{
token_balances::TransactionTokenBalancesSet, TransactionTokenBalance,
},
Expand Down
10 changes: 6 additions & 4 deletions ledger/src/blockstore_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ use {
accounts_index::AccountSecondaryIndexes,
accounts_update_notifier_interface::AccountsUpdateNotifier,
epoch_accounts_hash::EpochAccountsHash,
transaction_results::{
TransactionExecutionDetails, TransactionExecutionResult, TransactionResults,
},
},
solana_cost_model::cost_model::CostModel,
solana_entry::entry::{
Expand Down Expand Up @@ -57,7 +54,12 @@ use {
VersionedTransaction,
},
},
solana_svm::runtime_config::RuntimeConfig,
solana_svm::{
runtime_config::RuntimeConfig,
transaction_results::{
TransactionExecutionDetails, TransactionExecutionResult, TransactionResults,
},
},
solana_transaction_status::token_balances::TransactionTokenBalancesSet,
solana_vote::{vote_account::VoteAccountsHashMap, vote_sender_types::ReplayVoteSender},
std::{
Expand Down
6 changes: 4 additions & 2 deletions programs/sbf/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 programs/sbf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ solana-sdk = { path = "../../sdk", version = "=1.19.0" }
solana-transaction-status = { path = "../../transaction-status", version = "=1.19.0" }
solana-validator = { path = "../../validator", version = "=1.19.0" }
solana-zk-token-sdk = { path = "../../zk-token-sdk", version = "=1.19.0" }
solana-svm = { path = "../../svm", version = "=1.19.0" }
solana_rbpf = "=0.8.0"
static_assertions = "1.1.0"
thiserror = "1.0"
Expand Down Expand Up @@ -96,6 +97,7 @@ solana-sbf-rust-invoke = { workspace = true }
solana-sbf-rust-realloc = { workspace = true, features = ["default"] }
solana-sbf-rust-realloc-invoke = { workspace = true }
solana-sdk = { workspace = true }
solana-svm = { workspace = true }
solana-transaction-status = { workspace = true }
solana_rbpf = { workspace = true }

Expand Down
8 changes: 4 additions & 4 deletions programs/sbf/tests/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ use {
solana_account_decoder::parse_bpf_loader::{
parse_bpf_upgradeable_loader, BpfUpgradeableLoaderAccountType,
},
solana_accounts_db::transaction_results::{
DurableNonceFee, InnerInstruction, TransactionExecutionDetails, TransactionExecutionResult,
TransactionResults,
},
solana_ledger::token_balances::collect_token_balances,
solana_program_runtime::{
compute_budget::ComputeBudget,
Expand Down Expand Up @@ -52,6 +48,10 @@ use {
sysvar::{self, clock},
transaction::VersionedTransaction,
},
solana_svm::transaction_results::{
DurableNonceFee, InnerInstruction, TransactionExecutionDetails, TransactionExecutionResult,
TransactionResults,
},
solana_transaction_status::{
map_inner_instructions, ConfirmedTransactionWithStatusMeta, TransactionStatusMeta,
TransactionWithStatusMeta, VersionedTransactionWithStatusMeta,
Expand Down
1 change: 1 addition & 0 deletions rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ solana-send-transaction-service = { workspace = true }
solana-stake-program = { workspace = true }
solana-storage-bigtable = { workspace = true }
solana-streamer = { workspace = true }
solana-svm = { workspace = true }
solana-tpu-client = { workspace = true }
solana-transaction-status = { workspace = true }
solana-version = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion rpc/src/transaction_status_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ use {
crate::transaction_notifier_interface::TransactionNotifierArc,
crossbeam_channel::{Receiver, RecvTimeoutError},
itertools::izip,
solana_accounts_db::transaction_results::{DurableNonceFee, TransactionExecutionDetails},
solana_ledger::{
blockstore::Blockstore,
blockstore_processor::{TransactionStatusBatch, TransactionStatusMessage},
},
solana_svm::transaction_results::{DurableNonceFee, TransactionExecutionDetails},
solana_transaction_status::{
extract_and_fmt_memos, map_inner_instructions, Reward, TransactionStatusMeta,
},
Expand Down
10 changes: 5 additions & 5 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ use {
},
serde::Serialize,
solana_accounts_db::{
accounts::{AccountAddressFilter, Accounts, PubkeyAccountSlot, TransactionLoadResult},
accounts::{AccountAddressFilter, Accounts, PubkeyAccountSlot},
accounts_db::{
AccountShrinkThreshold, AccountStorageEntry, AccountsDb, AccountsDbConfig,
CalcAccountsHashDataSource, VerifyAccountsHashAndLamportsConfig,
Expand All @@ -89,9 +89,6 @@ use {
sorted_storages::SortedStorages,
stake_rewards::StakeReward,
storable_accounts::StorableAccounts,
transaction_results::{
TransactionExecutionDetails, TransactionExecutionResult, TransactionResults,
},
},
solana_bpf_loader_program::syscalls::create_program_runtime_environment_v1,
solana_cost_model::cost_tracker::CostTracker,
Expand Down Expand Up @@ -160,13 +157,16 @@ use {
self, InflationPointCalculationEvent, PointValue, StakeStateV2,
},
solana_svm::{
account_loader::TransactionCheckResult,
account_loader::{TransactionCheckResult, TransactionLoadResult},
account_overrides::AccountOverrides,
runtime_config::RuntimeConfig,
transaction_error_metrics::TransactionErrorMetrics,
transaction_processor::{
TransactionBatchProcessor, TransactionLogMessages, TransactionProcessingCallback,
},
transaction_results::{
TransactionExecutionDetails, TransactionExecutionResult, TransactionResults,
},
},
solana_system_program::{get_system_account_kind, SystemAccountKind},
solana_vote::vote_account::{VoteAccount, VoteAccounts, VoteAccountsHashMap},
Expand Down
3 changes: 1 addition & 2 deletions runtime/src/bank/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ use {
ancestors::Ancestors,
inline_spl_token,
partitioned_rewards::TestPartitionedEpochRewards,
transaction_results::DurableNonceFee,
},
solana_logger,
solana_program_runtime::{
Expand Down Expand Up @@ -110,7 +109,7 @@ use {
solana_stake_program::stake_state::{self, StakeStateV2},
solana_svm::{
account_loader::load_accounts, transaction_account_state_info::TransactionAccountStateInfo,
transaction_error_metrics::TransactionErrorMetrics,
transaction_error_metrics::TransactionErrorMetrics, transaction_results::DurableNonceFee,
},
solana_vote_program::{
vote_instruction,
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/bank_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use {
solana_sdk::{pubkey::Pubkey, signature::Signer},
};
use {
solana_accounts_db::transaction_results::TransactionResults,
solana_sdk::transaction::SanitizedTransaction,
solana_svm::transaction_results::TransactionResults,
solana_vote::{vote_parser, vote_sender_types::ReplayVoteSender},
};

Expand Down
2 changes: 0 additions & 2 deletions svm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ edition = { workspace = true }
itertools = { workspace = true }
log = { workspace = true }
percentage = { workspace = true }
solana-accounts-db = { workspace = true }
solana-bpf-loader-program = { workspace = true }
solana-frozen-abi = { workspace = true }
solana-frozen-abi-macro = { workspace = true }
Expand All @@ -29,7 +28,6 @@ crate-type = ["lib"]
name = "solana_svm"

[dev-dependencies]
solana-accounts-db = { workspace = true, features = ["dev-context-only-utils"] }
solana-logger = { workspace = true }
solana-sdk = { workspace = true, features = ["dev-context-only-utils"] }

Expand Down
Loading

0 comments on commit 0acee67

Please sign in to comment.