diff --git a/Cargo.lock b/Cargo.lock index faef96ad0f1d03..9a856b3f1a31bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9261,29 +9261,57 @@ dependencies = [ "serde", "serde_derive", "shuttle", + "solana-account", "solana-bpf-loader-program", + "solana-clock", "solana-compute-budget", "solana-compute-budget-instruction", + "solana-compute-budget-interface", "solana-compute-budget-program", "solana-ed25519-program", + "solana-epoch-schedule", "solana-feature-set", "solana-fee", + "solana-fee-calculator", + "solana-fee-structure", "solana-frozen-abi", "solana-frozen-abi-macro", + "solana-hash", + "solana-instruction", + "solana-instructions-sysvar", + "solana-keypair", "solana-loader-v4-program", "solana-log-collector", "solana-logger", "solana-measure", + "solana-message", + "solana-native-token", + "solana-nonce", + "solana-precompiles", + "solana-program", "solana-program-runtime", + "solana-pubkey", + "solana-rent", + "solana-rent-debits", + "solana-reserved-account-keys", "solana-sbpf", "solana-sdk", + "solana-sdk-ids", + "solana-secp256k1-program", "solana-secp256r1-program", + "solana-signature", + "solana-signer", "solana-svm", "solana-svm-conformance", "solana-svm-rent-collector", "solana-svm-transaction", "solana-system-program", + "solana-system-transaction", + "solana-sysvar", "solana-timings", + "solana-transaction", + "solana-transaction-context", + "solana-transaction-error", "solana-type-overrides", "test-case", "thiserror 2.0.8", diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index c8db862a47e6f1..b2d05ea2c66871 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -7796,20 +7796,36 @@ dependencies = [ "qualifier_attr", "serde", "serde_derive", + "solana-account", "solana-bpf-loader-program", + "solana-clock", "solana-compute-budget", "solana-compute-budget-instruction", "solana-feature-set", "solana-fee", + "solana-fee-structure", + "solana-hash", + "solana-instruction", + "solana-instructions-sysvar", "solana-loader-v4-program", "solana-log-collector", "solana-measure", + "solana-message", + "solana-nonce", + "solana-precompiles", + "solana-program", "solana-program-runtime", + "solana-pubkey", + "solana-rent", + "solana-rent-debits", "solana-sdk", + "solana-sdk-ids", "solana-svm-rent-collector", "solana-svm-transaction", "solana-system-program", "solana-timings", + "solana-transaction-context", + "solana-transaction-error", "solana-type-overrides", "thiserror 2.0.8", ] diff --git a/svm/Cargo.toml b/svm/Cargo.toml index 4f13eb55e3caff..7d6fb3c6071938 100644 --- a/svm/Cargo.toml +++ b/svm/Cargo.toml @@ -17,26 +17,42 @@ percentage = { workspace = true } qualifier_attr = { workspace = true, optional = true } serde = { workspace = true, features = ["rc"] } serde_derive = { workspace = true } +solana-account = { workspace = true } solana-bpf-loader-program = { workspace = true } +solana-clock = { workspace = true } solana-compute-budget = { workspace = true } solana-compute-budget-instruction = { workspace = true } solana-feature-set = { workspace = true } solana-fee = { workspace = true } +solana-fee-structure = { workspace = true } solana-frozen-abi = { workspace = true, optional = true, features = [ "frozen-abi", ] } solana-frozen-abi-macro = { workspace = true, optional = true, features = [ "frozen-abi", ] } +solana-hash = { workspace = true } +solana-instruction = { workspace = true, features = ["std"] } +solana-instructions-sysvar = { workspace = true } solana-loader-v4-program = { workspace = true } solana-log-collector = { workspace = true } solana-measure = { workspace = true } +solana-message = { workspace = true } +solana-nonce = { workspace = true } +solana-precompiles = { workspace = true } +solana-program = { workspace = true, default-features = false } solana-program-runtime = { workspace = true } +solana-pubkey = { workspace = true } +solana-rent = { workspace = true } +solana-rent-debits = { workspace = true } solana-sdk = { workspace = true } +solana-sdk-ids = { workspace = true } solana-svm-rent-collector = { workspace = true } solana-svm-transaction = { workspace = true } solana-system-program = { workspace = true } solana-timings = { workspace = true } +solana-transaction-context = { workspace = true } +solana-transaction-error = { workspace = true } solana-type-overrides = { workspace = true } thiserror = { workspace = true } @@ -54,15 +70,30 @@ openssl = { workspace = true } prost = { workspace = true } rand0-7 = { workspace = true } shuttle = { workspace = true } +solana-clock = { workspace = true } +solana-compute-budget-interface = { workspace = true } solana-compute-budget-program = { workspace = true } solana-ed25519-program = { workspace = true } +solana-epoch-schedule = { workspace = true } +solana-fee-calculator = { workspace = true } +solana-keypair = { workspace = true } solana-logger = { workspace = true } +solana-native-token = { workspace = true } +solana-pubkey = { workspace = true } +solana-rent = { workspace = true } +solana-reserved-account-keys = { workspace = true } solana-sbpf = { workspace = true } solana-sdk = { workspace = true, features = ["dev-context-only-utils"] } +solana-secp256k1-program = { workspace = true } solana-secp256r1-program = { workspace = true, features = ["openssl-vendored"] } +solana-signature = { workspace = true } +solana-signer = { workspace = true } # See order-crates-for-publishing.py for using this unusual `path = "."` solana-svm = { path = ".", features = ["dev-context-only-utils"] } solana-svm-conformance = { workspace = true } +solana-system-transaction = { workspace = true } +solana-sysvar = { workspace = true } +solana-transaction = { workspace = true } test-case = { workspace = true } [package.metadata.docs.rs] diff --git a/svm/examples/Cargo.lock b/svm/examples/Cargo.lock index f77a09131c7f5a..c1f6c445e421fd 100644 --- a/svm/examples/Cargo.lock +++ b/svm/examples/Cargo.lock @@ -7114,20 +7114,36 @@ dependencies = [ "percentage", "serde", "serde_derive", + "solana-account", "solana-bpf-loader-program", + "solana-clock", "solana-compute-budget", "solana-compute-budget-instruction", "solana-feature-set", "solana-fee", + "solana-fee-structure", + "solana-hash", + "solana-instruction", + "solana-instructions-sysvar", "solana-loader-v4-program", "solana-log-collector", "solana-measure", + "solana-message", + "solana-nonce", + "solana-precompiles", + "solana-program", "solana-program-runtime", + "solana-pubkey", + "solana-rent", + "solana-rent-debits", "solana-sdk", + "solana-sdk-ids", "solana-svm-rent-collector", "solana-svm-transaction", "solana-system-program", "solana-timings", + "solana-transaction-context", + "solana-transaction-error", "solana-type-overrides", "thiserror 2.0.8", ] diff --git a/svm/src/account_loader.rs b/svm/src/account_loader.rs index 1bb8bc1d7e5d54..36db2aaa75a6d3 100644 --- a/svm/src/account_loader.rs +++ b/svm/src/account_loader.rs @@ -8,29 +8,29 @@ use { transaction_processing_callback::{AccountState, TransactionProcessingCallback}, }, ahash::{AHashMap, AHashSet}, + solana_account::{ + Account, AccountSharedData, ReadableAccount, WritableAccount, PROGRAM_OWNERS, + }, solana_compute_budget::compute_budget_limits::ComputeBudgetLimits, solana_feature_set::{self as feature_set, FeatureSet}, + solana_fee_structure::FeeDetails, + solana_instruction::{BorrowedAccountMeta, BorrowedInstruction}, + solana_instructions_sysvar::construct_instructions_data, + solana_nonce::state::State as NonceState, solana_program_runtime::loaded_programs::ProgramCacheForTxBatch, - solana_sdk::{ - account::{Account, AccountSharedData, ReadableAccount, WritableAccount, PROGRAM_OWNERS}, - fee::FeeDetails, + solana_pubkey::Pubkey, + solana_rent::RentDue, + solana_rent_debits::RentDebits, + solana_sdk::rent_collector::{CollectedInfo, RENT_EXEMPT_RENT_EPOCH}, + solana_sdk_ids::{ native_loader, - nonce::State as NonceState, - pubkey::Pubkey, - rent::RentDue, - rent_collector::{CollectedInfo, RENT_EXEMPT_RENT_EPOCH}, - rent_debits::RentDebits, - sysvar::{ - self, - instructions::{construct_instructions_data, BorrowedAccountMeta, BorrowedInstruction}, - slot_history, - }, - transaction::{Result, TransactionError}, - transaction_context::{IndexOfAccount, TransactionAccount}, + sysvar::{self, slot_history}, }, solana_svm_rent_collector::svm_rent_collector::SVMRentCollector, solana_svm_transaction::svm_message::SVMMessage, solana_system_program::{get_system_account_kind, SystemAccountKind}, + solana_transaction_context::{IndexOfAccount, TransactionAccount}, + solana_transaction_error::{TransactionError, TransactionResult as Result}, std::{ collections::HashMap, num::{NonZeroU32, Saturating}, @@ -580,7 +580,7 @@ fn load_transaction_account( ) -> LoadedTransactionAccount { let usage_pattern = AccountUsagePattern::new(message, account_index); - let loaded_account = if solana_sdk::sysvar::instructions::check_id(account_key) { + let loaded_account = if solana_sdk_ids::sysvar::instructions::check_id(account_key) { // Since the instructions sysvar is constructed by the SVM and modified // for each transaction instruction, it cannot be loaded. LoadedTransactionAccount { @@ -697,38 +697,40 @@ mod tests { transaction_account_state_info::TransactionAccountStateInfo, transaction_processing_callback::TransactionProcessingCallback, }, - nonce::state::Versions as NonceVersions, + solana_account::{Account, AccountSharedData, ReadableAccount, WritableAccount}, solana_compute_budget::{compute_budget::ComputeBudget, compute_budget_limits}, + solana_epoch_schedule::EpochSchedule, solana_feature_set::FeatureSet, + solana_hash::Hash, + solana_instruction::{AccountMeta, Instruction}, + solana_keypair::Keypair, + solana_message::{ + compiled_instruction::CompiledInstruction, + v0::{LoadedAddresses, LoadedMessage}, + LegacyMessage, Message, MessageHeader, SanitizedMessage, + }, + solana_native_token::{sol_to_lamports, LAMPORTS_PER_SOL}, + solana_nonce::{self as nonce, versions::Versions as NonceVersions}, + solana_program::bpf_loader_upgradeable::UpgradeableLoaderState, solana_program_runtime::loaded_programs::{ ProgramCacheEntry, ProgramCacheEntryOwner, ProgramCacheEntryType, ProgramCacheForTxBatch, }, + solana_pubkey::Pubkey, + solana_rent::Rent, + solana_rent_debits::RentDebits, + solana_reserved_account_keys::ReservedAccountKeys, solana_sbpf::program::BuiltinProgram, - solana_sdk::{ - account::{Account, AccountSharedData, ReadableAccount, WritableAccount}, - bpf_loader, - bpf_loader_upgradeable::{self, UpgradeableLoaderState}, - epoch_schedule::EpochSchedule, - hash::Hash, - instruction::{AccountMeta, CompiledInstruction, Instruction}, - message::{ - v0::{LoadedAddresses, LoadedMessage}, - LegacyMessage, Message, MessageHeader, SanitizedMessage, - }, - native_loader, - native_token::{sol_to_lamports, LAMPORTS_PER_SOL}, - nonce, - pubkey::Pubkey, - rent::Rent, - rent_collector::{RentCollector, RENT_EXEMPT_RENT_EPOCH}, - rent_debits::RentDebits, - reserved_account_keys::ReservedAccountKeys, - signature::{Keypair, Signature, Signer}, - system_program, system_transaction, sysvar, - transaction::{Result, SanitizedTransaction, Transaction, TransactionError}, - transaction_context::{TransactionAccount, TransactionContext}, + solana_sdk::rent_collector::{RentCollector, RENT_EXEMPT_RENT_EPOCH}, + solana_sdk_ids::{ + bpf_loader, bpf_loader_upgradeable, native_loader, system_program, sysvar, }, + solana_signature::Signature, + solana_signer::Signer, + solana_system_transaction::transfer, + solana_transaction::{sanitized::SanitizedTransaction, Transaction}, + solana_transaction_context::{TransactionAccount, TransactionContext}, + solana_transaction_error::{TransactionError, TransactionResult as Result}, std::{borrow::Cow, cell::RefCell, collections::HashMap, fs::File, io::Read, sync::Arc}, }; @@ -1134,12 +1136,12 @@ mod tests { #[test] fn test_instructions() { solana_logger::setup(); - let instructions_key = solana_sdk::sysvar::instructions::id(); + let instructions_key = solana_sdk_ids::sysvar::instructions::id(); let keypair = Keypair::new(); let instructions = vec![CompiledInstruction::new(1, &(), vec![0, 1])]; let tx = Transaction::new_with_compiled_instructions( &[&keypair], - &[solana_sdk::pubkey::new_rand(), instructions_key], + &[solana_pubkey::new_rand(), instructions_key], Hash::default(), vec![native_loader::id()], instructions, @@ -1364,7 +1366,7 @@ mod tests { #[test] fn test_construct_instructions_account() { let loaded_message = LoadedMessage { - message: Cow::Owned(solana_sdk::message::v0::Message::default()), + message: Cow::Owned(solana_message::v0::Message::default()), loaded_addresses: Cow::Owned(LoadedAddresses::default()), is_writable_account_cache: vec![false], }; @@ -2095,7 +2097,7 @@ mod tests { .insert(recipient, AccountSharedData::default()); let mut account_loader = (&bank).into(); - let tx = system_transaction::transfer( + let tx = transfer( &mint_keypair, &recipient, sol_to_lamports(1.), @@ -2471,7 +2473,7 @@ mod tests { let program1 = program1_keypair.pubkey(); let program2 = Pubkey::new_unique(); let programdata2 = Pubkey::new_unique(); - use solana_sdk::account_utils::StateMut; + use solana_account::state_traits::StateMut; let program2_size = std::mem::size_of::() as u32; let mut program2_account = AccountSharedData::default(); diff --git a/svm/src/account_overrides.rs b/svm/src/account_overrides.rs index c31dc5bac16eec..7381852965f06d 100644 --- a/svm/src/account_overrides.rs +++ b/svm/src/account_overrides.rs @@ -1,5 +1,5 @@ use { - solana_sdk::{account::AccountSharedData, pubkey::Pubkey, sysvar}, + solana_account::AccountSharedData, solana_pubkey::Pubkey, solana_sdk_ids::sysvar, std::collections::HashMap, }; @@ -36,8 +36,8 @@ impl AccountOverrides { #[cfg(test)] mod test { use { - crate::account_overrides::AccountOverrides, - solana_sdk::{account::AccountSharedData, pubkey::Pubkey, sysvar}, + crate::account_overrides::AccountOverrides, solana_account::AccountSharedData, + solana_pubkey::Pubkey, solana_sdk_ids::sysvar, }; #[test] diff --git a/svm/src/message_processor.rs b/svm/src/message_processor.rs index ad4d1723baf4e2..99c0fa5206d05e 100644 --- a/svm/src/message_processor.rs +++ b/svm/src/message_processor.rs @@ -1,15 +1,13 @@ use { + solana_account::WritableAccount, + solana_instructions_sysvar as instructions, solana_measure::measure_us, + solana_precompiles::get_precompile, solana_program_runtime::invoke_context::InvokeContext, - solana_sdk::{ - account::WritableAccount, - precompiles::get_precompile, - sysvar::instructions, - transaction::TransactionError, - transaction_context::{IndexOfAccount, InstructionAccount}, - }, solana_svm_transaction::svm_message::SVMMessage, solana_timings::{ExecuteDetailsTimings, ExecuteTimings}, + solana_transaction_context::{IndexOfAccount, InstructionAccount}, + solana_transaction_error::TransactionError, }; #[derive(Debug, Default, Clone, serde_derive::Deserialize, serde_derive::Serialize)] @@ -138,30 +136,27 @@ mod tests { nid::Nid, }, rand0_7::thread_rng, + solana_account::{AccountSharedData, ReadableAccount}, solana_compute_budget::compute_budget::ComputeBudget, solana_ed25519_program::new_ed25519_instruction, solana_feature_set::FeatureSet, + solana_hash::Hash, + solana_instruction::{error::InstructionError, AccountMeta, Instruction}, + solana_message::{AccountKeys, Message, SanitizedMessage}, solana_program_runtime::{ declare_process_instruction, invoke_context::EnvironmentConfig, loaded_programs::{ProgramCacheEntry, ProgramCacheForTxBatch}, sysvar_cache::SysvarCache, }, - solana_sdk::{ - account::{AccountSharedData, ReadableAccount}, - ed25519_program, - hash::Hash, - instruction::{AccountMeta, Instruction, InstructionError}, - message::{AccountKeys, Message, SanitizedMessage}, - native_loader::{self, create_loadable_account_for_test}, - pubkey::Pubkey, - rent::Rent, - reserved_account_keys::ReservedAccountKeys, - secp256k1_instruction::new_secp256k1_instruction, - secp256k1_program, system_program, - transaction_context::TransactionContext, - }, + solana_pubkey::Pubkey, + solana_rent::Rent, + solana_reserved_account_keys::ReservedAccountKeys, + solana_sdk::native_loader::create_loadable_account_for_test, + solana_sdk_ids::{ed25519_program, native_loader, secp256k1_program, system_program}, + solana_secp256k1_program::new_secp256k1_instruction, solana_secp256r1_program::new_secp256r1_instruction, + solana_transaction_context::TransactionContext, std::sync::Arc, }; @@ -448,11 +443,11 @@ mod tests { let mock_program_id = Pubkey::from([2u8; 32]); let accounts = vec![ ( - solana_sdk::pubkey::new_rand(), + solana_pubkey::new_rand(), AccountSharedData::new(100, 1, &mock_program_id), ), ( - solana_sdk::pubkey::new_rand(), + solana_pubkey::new_rand(), AccountSharedData::new(0, 1, &mock_program_id), ), ( diff --git a/svm/src/nonce_info.rs b/svm/src/nonce_info.rs index 6405c5e9cbe1f4..0fa36bb5eb0328 100644 --- a/svm/src/nonce_info.rs +++ b/svm/src/nonce_info.rs @@ -1,10 +1,10 @@ use { - solana_sdk::{ - account::AccountSharedData, - account_utils::StateMut, - nonce::state::{DurableNonce, State as NonceState, Versions as NonceVersions}, - pubkey::Pubkey, + solana_account::{state_traits::StateMut, AccountSharedData}, + solana_nonce::{ + state::{DurableNonce, State as NonceState}, + versions::Versions as NonceVersions, }, + solana_pubkey::Pubkey, thiserror::Error, }; @@ -62,13 +62,12 @@ impl NonceInfo { mod tests { use { super::*, - solana_sdk::{ - hash::Hash, - nonce::state::{ - Data as NonceData, DurableNonce, State as NonceState, Versions as NonceVersions, - }, - system_program, + solana_hash::Hash, + solana_nonce::{ + state::{Data as NonceData, DurableNonce, State as NonceState}, + versions::Versions as NonceVersions, }, + solana_sdk_ids::system_program, }; fn create_nonce_account(state: NonceState) -> AccountSharedData { diff --git a/svm/src/program_loader.rs b/svm/src/program_loader.rs index 902eebb0782492..f45bf5bdde67b6 100644 --- a/svm/src/program_loader.rs +++ b/svm/src/program_loader.rs @@ -1,21 +1,18 @@ use { crate::transaction_processing_callback::TransactionProcessingCallback, + solana_account::{state_traits::StateMut, AccountSharedData, ReadableAccount}, + solana_clock::Slot, + solana_instruction::error::InstructionError, + solana_program::bpf_loader_upgradeable::{self, UpgradeableLoaderState}, solana_program_runtime::loaded_programs::{ LoadProgramMetrics, ProgramCacheEntry, ProgramCacheEntryOwner, ProgramCacheEntryType, ProgramRuntimeEnvironment, ProgramRuntimeEnvironments, DELAY_VISIBILITY_SLOT_OFFSET, }, - solana_sdk::{ - account::{AccountSharedData, ReadableAccount}, - account_utils::StateMut, - bpf_loader, bpf_loader_deprecated, - bpf_loader_upgradeable::{self, UpgradeableLoaderState}, - clock::Slot, - instruction::InstructionError, - loader_v4::{self, LoaderV4State, LoaderV4Status}, - pubkey::Pubkey, - transaction::{self, TransactionError}, - }, + solana_pubkey::Pubkey, + solana_sdk::loader_v4::{self, LoaderV4State, LoaderV4Status}, + solana_sdk_ids::{bpf_loader, bpf_loader_deprecated}, solana_timings::ExecuteTimings, + solana_transaction_error::{TransactionError, TransactionResult}, solana_type_overrides::sync::Arc, }; @@ -219,7 +216,7 @@ pub fn load_program_with_pubkey( pub(crate) fn get_program_modification_slot( callbacks: &CB, pubkey: &Pubkey, -) -> transaction::Result { +) -> TransactionResult { let program = callbacks .get_account_shared_data(pubkey) .ok_or(TransactionError::ProgramAccountNotFound)?; @@ -254,11 +251,12 @@ mod tests { use { super::*, crate::transaction_processor::TransactionBatchProcessor, + solana_account::WritableAccount, solana_program_runtime::{ loaded_programs::{BlockRelation, ForkGraph, ProgramRuntimeEnvironments}, solana_sbpf::program::BuiltinProgram, }, - solana_sdk::{account::WritableAccount, bpf_loader, bpf_loader_upgradeable}, + solana_sdk_ids::{bpf_loader, bpf_loader_upgradeable}, std::{ cell::RefCell, collections::HashMap, diff --git a/svm/src/rollback_accounts.rs b/svm/src/rollback_accounts.rs index 1a9a764e131186..fec3cb27e3cc16 100644 --- a/svm/src/rollback_accounts.rs +++ b/svm/src/rollback_accounts.rs @@ -1,10 +1,8 @@ use { crate::nonce_info::NonceInfo, - solana_sdk::{ - account::{AccountSharedData, ReadableAccount, WritableAccount}, - clock::Epoch, - pubkey::Pubkey, - }, + solana_account::{AccountSharedData, ReadableAccount, WritableAccount}, + solana_clock::Epoch, + solana_pubkey::Pubkey, }; /// Captured account state used to rollback account state for nonce and fee @@ -107,14 +105,13 @@ impl RollbackAccounts { mod tests { use { super::*, - solana_sdk::{ - account::{ReadableAccount, WritableAccount}, - hash::Hash, - nonce::state::{ - Data as NonceData, DurableNonce, State as NonceState, Versions as NonceVersions, - }, - system_program, + solana_account::{ReadableAccount, WritableAccount}, + solana_hash::Hash, + solana_nonce::{ + state::{Data as NonceData, DurableNonce, State as NonceState}, + versions::Versions as NonceVersions, }, + solana_sdk_ids::system_program, }; #[test] diff --git a/svm/src/transaction_account_state_info.rs b/svm/src/transaction_account_state_info.rs index 3bf90adcd3cba6..b8ce3785f8cf02 100644 --- a/svm/src/transaction_account_state_info.rs +++ b/svm/src/transaction_account_state_info.rs @@ -1,12 +1,10 @@ use { - solana_sdk::{ - account::ReadableAccount, - native_loader, - transaction::Result, - transaction_context::{IndexOfAccount, TransactionContext}, - }, + solana_account::ReadableAccount, + solana_sdk_ids::native_loader, solana_svm_rent_collector::{rent_state::RentState, svm_rent_collector::SVMRentCollector}, solana_svm_transaction::svm_message::SVMMessage, + solana_transaction_context::{IndexOfAccount, TransactionContext}, + solana_transaction_error::TransactionResult as Result, }; #[derive(PartialEq, Debug)] @@ -73,18 +71,19 @@ impl TransactionAccountStateInfo { mod test { use { super::*, - solana_sdk::{ - account::AccountSharedData, - hash::Hash, - instruction::CompiledInstruction, - message::{LegacyMessage, Message, MessageHeader, SanitizedMessage}, - rent::Rent, - rent_collector::RentCollector, - reserved_account_keys::ReservedAccountKeys, - signature::{Keypair, Signer}, - transaction::TransactionError, - transaction_context::TransactionContext, + solana_account::AccountSharedData, + solana_hash::Hash, + solana_keypair::Keypair, + solana_message::{ + compiled_instruction::CompiledInstruction, LegacyMessage, Message, MessageHeader, + SanitizedMessage, }, + solana_rent::Rent, + solana_reserved_account_keys::ReservedAccountKeys, + solana_sdk::rent_collector::RentCollector, + solana_signer::Signer, + solana_transaction_context::TransactionContext, + solana_transaction_error::TransactionError, }; #[test] diff --git a/svm/src/transaction_commit_result.rs b/svm/src/transaction_commit_result.rs index 6d838ea0786d53..5e260e08ea863f 100644 --- a/svm/src/transaction_commit_result.rs +++ b/svm/src/transaction_commit_result.rs @@ -1,9 +1,8 @@ use { crate::transaction_execution_result::TransactionLoadedAccountsStats, - solana_sdk::{ - fee::FeeDetails, inner_instruction::InnerInstructionsList, rent_debits::RentDebits, - transaction::Result as TransactionResult, transaction_context::TransactionReturnData, - }, + solana_fee_structure::FeeDetails, solana_rent_debits::RentDebits, + solana_sdk::inner_instruction::InnerInstructionsList, + solana_transaction_context::TransactionReturnData, solana_transaction_error::TransactionResult, }; pub type TransactionCommitResult = TransactionResult; diff --git a/svm/src/transaction_execution_result.rs b/svm/src/transaction_execution_result.rs index c226ae262a82ad..79ed41cbd61e60 100644 --- a/svm/src/transaction_execution_result.rs +++ b/svm/src/transaction_execution_result.rs @@ -7,7 +7,9 @@ pub use solana_sdk::inner_instruction::{InnerInstruction, InnerInstructionsList} use { crate::account_loader::LoadedTransaction, solana_program_runtime::loaded_programs::ProgramCacheEntry, - solana_sdk::{pubkey::Pubkey, transaction, transaction_context::TransactionReturnData}, + solana_pubkey::Pubkey, + solana_transaction_context::TransactionReturnData, + solana_transaction_error::TransactionResult, std::{collections::HashMap, sync::Arc}, }; @@ -32,7 +34,7 @@ impl ExecutedTransaction { #[derive(Clone, Debug, Eq, PartialEq)] pub struct TransactionExecutionDetails { - pub status: transaction::Result<()>, + pub status: TransactionResult<()>, pub log_messages: Option>, pub inner_instructions: Option, pub return_data: Option, diff --git a/svm/src/transaction_processing_callback.rs b/svm/src/transaction_processing_callback.rs index a1356fc06e6da2..803a7724ddfb8e 100644 --- a/svm/src/transaction_processing_callback.rs +++ b/svm/src/transaction_processing_callback.rs @@ -1,4 +1,4 @@ -use solana_sdk::{account::AccountSharedData, pubkey::Pubkey}; +use {solana_account::AccountSharedData, solana_pubkey::Pubkey}; /// Runtime callbacks for transaction processing. pub trait TransactionProcessingCallback { diff --git a/svm/src/transaction_processing_result.rs b/svm/src/transaction_processing_result.rs index 0658b5035fda0f..c8da2a941c1a9b 100644 --- a/svm/src/transaction_processing_result.rs +++ b/svm/src/transaction_processing_result.rs @@ -3,10 +3,8 @@ use { account_loader::FeesOnlyTransaction, transaction_execution_result::{ExecutedTransaction, TransactionExecutionDetails}, }, - solana_sdk::{ - fee::FeeDetails, - transaction::{Result as TransactionResult, TransactionError}, - }, + solana_fee_structure::FeeDetails, + solana_transaction_error::{TransactionError, TransactionResult}, }; pub type TransactionProcessingResult = TransactionResult; diff --git a/svm/src/transaction_processor.rs b/svm/src/transaction_processor.rs index 0736905336325e..01c4af21b55a42 100644 --- a/svm/src/transaction_processor.rs +++ b/svm/src/transaction_processor.rs @@ -20,17 +20,27 @@ use { }, log::debug, percentage::Percentage, + solana_account::{state_traits::StateMut, AccountSharedData, ReadableAccount, PROGRAM_OWNERS}, solana_bpf_loader_program::syscalls::{ create_program_runtime_environment_v1, create_program_runtime_environment_v2, }, + solana_clock::{Epoch, Slot}, solana_compute_budget::compute_budget::ComputeBudget, solana_compute_budget_instruction::instructions_processor::process_compute_budget_instructions, solana_feature_set::{ enable_transaction_loading_failure_fees, remove_accounts_executable_flag_checks, remove_rounding_in_fee_calculation, FeatureSet, }, + solana_fee_structure::{FeeBudgetLimits, FeeStructure}, + solana_hash::Hash, + solana_instruction::TRANSACTION_LEVEL_STACK_HEIGHT, solana_log_collector::LogCollector, solana_measure::{measure::Measure, measure_us}, + solana_message::compiled_instruction::CompiledInstruction, + solana_nonce::{ + state::{DurableNonce, State as NonceState}, + versions::Versions as NonceVersions, + }, solana_program_runtime::{ invoke_context::{EnvironmentConfig, InvokeContext}, loaded_programs::{ @@ -43,25 +53,17 @@ use { }, sysvar_cache::SysvarCache, }, + solana_pubkey::Pubkey, solana_sdk::{ - account::{AccountSharedData, ReadableAccount, PROGRAM_OWNERS}, - account_utils::StateMut, - clock::{Epoch, Slot}, - fee::{FeeBudgetLimits, FeeStructure}, - hash::Hash, inner_instruction::{InnerInstruction, InnerInstructionsList}, - instruction::{CompiledInstruction, TRANSACTION_LEVEL_STACK_HEIGHT}, - native_loader, - nonce::state::{DurableNonce, State as NonceState, Versions as NonceVersions}, - pubkey::Pubkey, rent_collector::RentCollector, - saturating_add_assign, system_program, - transaction::{self, TransactionError}, - transaction_context::{ExecutionRecord, TransactionContext}, }, + solana_sdk_ids::{native_loader, system_program}, solana_svm_rent_collector::svm_rent_collector::SVMRentCollector, solana_svm_transaction::{svm_message::SVMMessage, svm_transaction::SVMTransaction}, solana_timings::{ExecuteTimingType, ExecuteTimings}, + solana_transaction_context::{ExecutionRecord, TransactionContext}, + solana_transaction_error::{TransactionError, TransactionResult}, solana_type_overrides::sync::{atomic::Ordering, Arc, RwLock, RwLockReadGuard}, std::{ collections::{hash_map::Entry, HashMap, HashSet}, @@ -525,7 +527,7 @@ impl TransactionBatchProcessor { fee_lamports_per_signature: u64, rent_collector: &dyn SVMRentCollector, error_counters: &mut TransactionErrorMetrics, - ) -> transaction::Result { + ) -> TransactionResult { // If this is a nonce transaction, validate the nonce info. // This must be done for every transaction to support SIMD83 because // it may have changed due to use, authorization, or deallocation. @@ -566,7 +568,7 @@ impl TransactionBatchProcessor { fee_lamports_per_signature: u64, rent_collector: &dyn SVMRentCollector, error_counters: &mut TransactionErrorMetrics, - ) -> transaction::Result { + ) -> TransactionResult { let compute_budget_limits = process_compute_budget_instructions( message.program_instructions_iter(), &account_loader.feature_set, @@ -643,7 +645,7 @@ impl TransactionBatchProcessor { nonce_info: &NonceInfo, next_durable_nonce: &DurableNonce, error_counters: &mut TransactionErrorMetrics, - ) -> transaction::Result<()> { + ) -> TransactionResult<()> { // When SIMD83 is enabled, if the nonce has been used in this batch already, we must drop // the transaction. This is the same as if it was used in different batches in the same slot. // If the nonce account was closed in the batch, we error as if the blockhash didn't validate. @@ -711,7 +713,7 @@ impl TransactionBatchProcessor { .for_each(|key| match result.entry(*key) { Entry::Occupied(mut entry) => { let (_, count) = entry.get_mut(); - saturating_add_assign!(*count, 1); + *count = count.saturating_add(1); } Entry::Vacant(entry) => { if let Some(index) = @@ -1197,6 +1199,8 @@ impl TransactionBatchProcessor { #[cfg(test)] mod tests { + #[allow(deprecated)] + use solana_sysvar::fees::Fees; use { super::*, crate::{ @@ -1205,28 +1209,28 @@ mod tests { rollback_accounts::RollbackAccounts, transaction_processing_callback::AccountState, }, + solana_account::{create_account_shared_data_for_test, WritableAccount}, + solana_clock::Clock, solana_compute_budget::compute_budget_limits::ComputeBudgetLimits, + solana_compute_budget_interface::ComputeBudgetInstruction, + solana_epoch_schedule::EpochSchedule, solana_feature_set::FeatureSet, + solana_fee_calculator::FeeCalculator, + solana_fee_structure::{FeeDetails, FeeStructure}, + solana_hash::Hash, + solana_keypair::Keypair, + solana_message::{LegacyMessage, Message, MessageHeader, SanitizedMessage}, + solana_nonce as nonce, solana_program_runtime::loaded_programs::{BlockRelation, ProgramCacheEntryType}, - solana_sdk::{ - account::{create_account_shared_data_for_test, WritableAccount}, - bpf_loader, - compute_budget::ComputeBudgetInstruction, - epoch_schedule::EpochSchedule, - fee::{FeeDetails, FeeStructure}, - fee_calculator::FeeCalculator, - hash::Hash, - message::{LegacyMessage, Message, MessageHeader, SanitizedMessage}, - nonce, - rent_collector::{RentCollector, RENT_EXEMPT_RENT_EPOCH}, - rent_debits::RentDebits, - reserved_account_keys::ReservedAccountKeys, - signature::{Keypair, Signature}, - system_program, - sysvar::{self, rent::Rent}, - transaction::{SanitizedTransaction, Transaction, TransactionError}, - transaction_context::TransactionContext, - }, + solana_rent::Rent, + solana_rent_debits::RentDebits, + solana_reserved_account_keys::ReservedAccountKeys, + solana_sdk::rent_collector::{RentCollector, RENT_EXEMPT_RENT_EPOCH}, + solana_sdk_ids::{bpf_loader, system_program, sysvar}, + solana_signature::Signature, + solana_transaction::{sanitized::SanitizedTransaction, Transaction}, + solana_transaction_context::TransactionContext, + solana_transaction_error::TransactionError, test_case::test_case, }; @@ -1910,7 +1914,7 @@ mod tests { fn test_sysvar_cache_initialization1() { let mock_bank = MockBankCallback::default(); - let clock = sysvar::clock::Clock { + let clock = Clock { slot: 1, epoch_start_timestamp: 2, epoch: 3, @@ -1932,7 +1936,7 @@ mod tests { .unwrap() .insert(sysvar::epoch_schedule::id(), epoch_schedule_account); - let fees = sysvar::fees::Fees { + let fees = Fees { fee_calculator: FeeCalculator { lamports_per_signature: 123, }, @@ -1986,7 +1990,7 @@ mod tests { fn test_reset_and_fill_sysvar_cache() { let mock_bank = MockBankCallback::default(); - let clock = sysvar::clock::Clock { + let clock = Clock { slot: 1, epoch_start_timestamp: 2, epoch: 3, @@ -2008,7 +2012,7 @@ mod tests { .unwrap() .insert(sysvar::epoch_schedule::id(), epoch_schedule_account); - let fees = sysvar::fees::Fees { + let fees = Fees { fee_calculator: FeeCalculator { lamports_per_signature: 123, }, @@ -2139,7 +2143,9 @@ mod tests { epoch: current_epoch, ..RentCollector::default() }; - let min_balance = rent_collector.rent.minimum_balance(nonce::State::size()); + let min_balance = rent_collector + .rent + .minimum_balance(nonce::state::State::size()); let transaction_fee = lamports_per_signature; let priority_fee = 2_000_000u64; let starting_balance = transaction_fee + priority_fee; @@ -2475,7 +2481,7 @@ mod tests { ) .unwrap(); let fee_payer_address = message.fee_payer(); - let min_balance = Rent::default().minimum_balance(nonce::State::size()); + let min_balance = Rent::default().minimum_balance(nonce::state::State::size()); let transaction_fee = lamports_per_signature; let priority_fee = compute_unit_limit; @@ -2483,11 +2489,13 @@ mod tests { { let fee_payer_account = AccountSharedData::new_data( min_balance + transaction_fee + priority_fee, - &nonce::state::Versions::new(nonce::State::Initialized(nonce::state::Data::new( - *fee_payer_address, - DurableNonce::default(), - lamports_per_signature, - ))), + &nonce::versions::Versions::new(nonce::state::State::Initialized( + nonce::state::Data::new( + *fee_payer_address, + DurableNonce::default(), + lamports_per_signature, + ), + )), &system_program::id(), ) .unwrap(); @@ -2556,7 +2564,7 @@ mod tests { { let fee_payer_account = AccountSharedData::new_data( transaction_fee + priority_fee, // no min_balance this time - &nonce::state::Versions::new(nonce::State::Initialized( + &nonce::versions::Versions::new(nonce::state::State::Initialized( nonce::state::Data::default(), )), &system_program::id(),