浏览代码

remove solana-sdk from accounts-db (#4984)

Kevin Heavey 9 月之前
父节点
当前提交
8340ee60dd
共有 46 个文件被更改,包括 255 次插入187 次删除
  1. 22 1
      Cargo.lock
  2. 32 4
      accounts-db/Cargo.toml
  3. 4 6
      accounts-db/benches/accounts.rs
  4. 1 1
      accounts-db/benches/accounts_index.rs
  5. 2 4
      accounts-db/benches/append_vec.rs
  6. 4 6
      accounts-db/benches/bench_accounts_file.rs
  7. 2 1
      accounts-db/benches/bench_hashing.rs
  8. 5 4
      accounts-db/benches/bench_lock_accounts.rs
  9. 2 1
      accounts-db/benches/bench_serde.rs
  10. 3 1
      accounts-db/benches/utils.rs
  11. 4 5
      accounts-db/src/account_locks.rs
  12. 3 1
      accounts-db/src/account_storage/meta.rs
  13. 21 18
      accounts-db/src/accounts.rs
  14. 2 4
      accounts-db/src/accounts_cache.rs
  15. 8 11
      accounts-db/src/accounts_db.rs
  16. 6 6
      accounts-db/src/accounts_db/geyser_plugin_utils.rs
  17. 4 2
      accounts-db/src/accounts_db/scan_account_storage.rs
  18. 1 1
      accounts-db/src/accounts_db/stats.rs
  19. 26 9
      accounts-db/src/accounts_db/tests.rs
  20. 2 1
      accounts-db/src/accounts_file.rs
  21. 5 6
      accounts-db/src/accounts_hash.rs
  22. 3 5
      accounts-db/src/accounts_index.rs
  23. 1 1
      accounts-db/src/accounts_index/in_mem_accounts_index.rs
  24. 2 5
      accounts-db/src/accounts_partition.rs
  25. 2 3
      accounts-db/src/accounts_update_notifier_interface.rs
  26. 2 4
      accounts-db/src/ancient_append_vecs.rs
  27. 8 12
      accounts-db/src/append_vec.rs
  28. 1 1
      accounts-db/src/append_vec/test_utils.rs
  29. 8 8
      accounts-db/src/blockhash_queue.rs
  30. 2 4
      accounts-db/src/bucket_map_holder.rs
  31. 1 1
      accounts-db/src/bucket_map_holder_stats.rs
  32. 1 1
      accounts-db/src/hardened_unpack.rs
  33. 3 5
      accounts-db/src/read_only_accounts_cache.rs
  34. 2 1
      accounts-db/src/secondary_index.rs
  35. 6 10
      accounts-db/src/stake_rewards.rs
  36. 4 8
      accounts-db/src/storable_accounts.rs
  37. 3 5
      accounts-db/src/tiered_storage.rs
  38. 1 1
      accounts-db/src/tiered_storage/byte_block.rs
  39. 1 1
      accounts-db/src/tiered_storage/footer.rs
  40. 6 8
      accounts-db/src/tiered_storage/hot.rs
  41. 2 1
      accounts-db/src/tiered_storage/meta.rs
  42. 1 1
      accounts-db/src/tiered_storage/readable.rs
  43. 3 5
      accounts-db/src/tiered_storage/test_utils.rs
  44. 1 1
      accounts-db/tests/read_only_accounts_cache.rs
  45. 16 1
      programs/sbf/Cargo.lock
  46. 16 1
      svm/examples/Cargo.lock

+ 22 - 1
Cargo.lock

@@ -6196,24 +6196,45 @@ dependencies = [
  "serde_bytes",
  "serde_derive",
  "smallvec",
+ "solana-account",
  "solana-accounts-db",
+ "solana-address-lookup-table-interface",
  "solana-bucket-map",
  "solana-clock",
  "solana-compute-budget",
+ "solana-epoch-schedule",
+ "solana-fee-calculator",
  "solana-frozen-abi",
  "solana-frozen-abi-macro",
+ "solana-genesis-config",
  "solana-hash",
  "solana-inline-spl",
+ "solana-instruction",
+ "solana-keypair",
  "solana-lattice-hash",
  "solana-logger",
  "solana-measure",
+ "solana-message",
  "solana-metrics",
  "solana-nohash-hasher",
  "solana-pubkey",
  "solana-rayon-threadlimit",
- "solana-sdk",
+ "solana-rent",
+ "solana-rent-collector",
+ "solana-reward-info",
+ "solana-sdk-ids",
+ "solana-sha256-hasher",
+ "solana-signer",
+ "solana-slot-hashes",
+ "solana-slot-history",
  "solana-stake-program",
  "solana-svm-transaction",
+ "solana-system-interface",
+ "solana-sysvar",
+ "solana-time-utils",
+ "solana-transaction",
+ "solana-transaction-context",
+ "solana-transaction-error",
  "solana-vote-program",
  "static_assertions",
  "strum",

+ 32 - 4
accounts-db/Cargo.toml

@@ -35,25 +35,46 @@ seqlock = { workspace = true }
 serde = { workspace = true, features = ["rc"] }
 serde_derive = { workspace = true }
 smallvec = { workspace = true, features = ["const_generics"] }
+solana-account = { workspace = true, features = ["serde"] }
+solana-address-lookup-table-interface = { workspace = true, features = [
+    "bincode",
+    "bytemuck",
+] }
 solana-bucket-map = { workspace = true }
 solana-clock = { workspace = true }
+solana-epoch-schedule = { workspace = true }
+solana-fee-calculator = { 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-genesis-config = { workspace = true, features = ["serde"] }
+solana-hash = { workspace = true, features = ["serde"] }
 solana-inline-spl = { workspace = true }
+solana-keypair = { workspace = true, optional = true }
 solana-lattice-hash = { workspace = true }
 solana-measure = { workspace = true }
+solana-message = { workspace = true }
 solana-metrics = { workspace = true }
 solana-nohash-hasher = { workspace = true }
 solana-pubkey = { workspace = true }
 solana-rayon-threadlimit = { workspace = true }
-solana-sdk = { workspace = true }
+solana-rent = { workspace = true, optional = true }
+solana-rent-collector = { workspace = true }
+solana-reward-info = { workspace = true, features = ["serde"] }
+solana-sha256-hasher = { workspace = true }
+solana-signer = { workspace = true, optional = true }
+solana-slot-hashes = { workspace = true }
 solana-stake-program = { workspace = true, optional = true }
 solana-svm-transaction = { workspace = true }
+solana-system-interface = { workspace = true }
+solana-sysvar = { workspace = true }
+solana-time-utils = { workspace = true }
+solana-transaction = { workspace = true }
+solana-transaction-context = { workspace = true }
+solana-transaction-error = { workspace = true }
 solana-vote-program = { workspace = true, optional = true }
 static_assertions = { workspace = true }
 tar = { workspace = true }
@@ -74,8 +95,10 @@ serde_bytes = { workspace = true }
 # See order-crates-for-publishing.py for using this unusual `path = "."`
 solana-accounts-db = { path = ".", features = ["dev-context-only-utils"] }
 solana-compute-budget = { workspace = true }
+solana-instruction = { workspace = true }
 solana-logger = { workspace = true }
-solana-sdk = { workspace = true, features = ["dev-context-only-utils"] }
+solana-sdk-ids = { workspace = true }
+solana-slot-history = { workspace = true }
 static_assertions = { workspace = true }
 strum = { workspace = true, features = ["derive"] }
 strum_macros = { workspace = true }
@@ -87,14 +110,19 @@ targets = ["x86_64-unknown-linux-gnu"]
 [features]
 dev-context-only-utils = [
     "dep:qualifier_attr",
+    "dep:solana-keypair",
+    "dep:solana-rent",
+    "dep:solana-signer",
     "dep:solana-stake-program",
     "dep:solana-vote-program",
+    "solana-account/dev-context-only-utils",
     "solana-pubkey/rand",
+    "solana-transaction/dev-context-only-utils",
 ]
 frozen-abi = [
     "dep:solana-frozen-abi",
     "dep:solana-frozen-abi-macro",
-    "solana-sdk/frozen-abi",
+    "solana-fee-calculator/frozen-abi",
     "solana-vote-program/frozen-abi",
 ]
 

+ 4 - 6
accounts-db/benches/accounts.rs

@@ -7,6 +7,7 @@ use {
     dashmap::DashMap,
     rand::Rng,
     rayon::iter::{IntoParallelRefIterator, ParallelIterator},
+    solana_account::{Account, AccountSharedData, ReadableAccount},
     solana_accounts_db::{
         account_info::{AccountInfo, StorageLocation},
         accounts::{AccountAddressFilter, Accounts},
@@ -17,13 +18,10 @@ use {
         accounts_index::ScanConfig,
         ancestors::Ancestors,
     },
+    solana_hash::Hash,
     solana_pubkey::Pubkey,
-    solana_sdk::{
-        account::{Account, AccountSharedData, ReadableAccount},
-        hash::Hash,
-        rent_collector::RentCollector,
-        sysvar::epoch_schedule::EpochSchedule,
-    },
+    solana_rent_collector::RentCollector,
+    solana_sysvar::epoch_schedule::EpochSchedule,
     std::{
         collections::{HashMap, HashSet},
         path::PathBuf,

+ 1 - 1
accounts-db/benches/accounts_index.rs

@@ -4,6 +4,7 @@ extern crate test;
 
 use {
     rand::{thread_rng, Rng},
+    solana_account::AccountSharedData,
     solana_accounts_db::{
         account_info::AccountInfo,
         accounts_index::{
@@ -11,7 +12,6 @@ use {
             ACCOUNTS_INDEX_CONFIG_FOR_BENCHMARKS,
         },
     },
-    solana_sdk::account::AccountSharedData,
     std::sync::Arc,
     test::Bencher,
 };

+ 2 - 4
accounts-db/benches/append_vec.rs

@@ -3,6 +3,7 @@ extern crate test;
 
 use {
     rand::{thread_rng, Rng},
+    solana_account::{AccountSharedData, ReadableAccount},
     solana_accounts_db::{
         account_storage::meta::StoredMeta,
         accounts_file::StoredAccountsInfo,
@@ -11,10 +12,7 @@ use {
             AppendVec,
         },
     },
-    solana_sdk::{
-        account::{AccountSharedData, ReadableAccount},
-        clock::Slot,
-    },
+    solana_clock::Slot,
     std::{
         sync::{Arc, Mutex},
         thread::{sleep, spawn},

+ 4 - 6
accounts-db/benches/bench_accounts_file.rs

@@ -1,6 +1,7 @@
 #![allow(clippy::arithmetic_side_effects)]
 use {
     criterion::{criterion_group, criterion_main, BatchSize, BenchmarkId, Criterion, Throughput},
+    solana_account::{AccountSharedData, ReadableAccount},
     solana_accounts_db::{
         accounts_file::StorageAccess,
         append_vec::{self, AppendVec, SCAN_BUFFER_SIZE_WITHOUT_DATA},
@@ -9,13 +10,10 @@ use {
             hot::{HotStorageReader, HotStorageWriter},
         },
     },
+    solana_clock::Slot,
     solana_pubkey::Pubkey,
-    solana_sdk::{
-        account::{AccountSharedData, ReadableAccount},
-        clock::Slot,
-        rent_collector::RENT_EXEMPT_RENT_EPOCH,
-        system_instruction::MAX_PERMITTED_DATA_LENGTH,
-    },
+    solana_rent_collector::RENT_EXEMPT_RENT_EPOCH,
+    solana_system_interface::MAX_PERMITTED_DATA_LENGTH,
     std::mem::ManuallyDrop,
 };
 

+ 2 - 1
accounts-db/benches/bench_hashing.rs

@@ -1,12 +1,13 @@
 use {
     criterion::{criterion_group, criterion_main, BatchSize, BenchmarkId, Criterion, Throughput},
     rand::seq::SliceRandom,
+    solana_account::AccountSharedData,
     solana_accounts_db::{
         accounts_db::AccountsDb,
         accounts_hash::{AccountHash, AccountsHasher},
     },
+    solana_hash::Hash,
     solana_pubkey::Pubkey,
-    solana_sdk::{account::AccountSharedData, hash::Hash},
 };
 
 const KB: usize = 1024;

+ 5 - 4
accounts-db/benches/bench_lock_accounts.rs

@@ -2,11 +2,12 @@ use {
     criterion::{black_box, criterion_group, criterion_main, Criterion, Throughput},
     itertools::iproduct,
     solana_accounts_db::{accounts::Accounts, accounts_db::AccountsDb},
+    solana_instruction::{AccountMeta, Instruction},
     solana_pubkey::Pubkey,
-    solana_sdk::{
-        instruction::{AccountMeta, Instruction},
-        system_program,
-        transaction::{SanitizedTransaction, Transaction, MAX_TX_ACCOUNT_LOCKS},
+    solana_sdk_ids::system_program,
+    solana_transaction::{
+        sanitized::{SanitizedTransaction, MAX_TX_ACCOUNT_LOCKS},
+        Transaction,
     },
     std::sync::Arc,
 };

+ 2 - 1
accounts-db/benches/bench_serde.rs

@@ -1,8 +1,9 @@
 use {
     criterion::{criterion_group, criterion_main, BatchSize, BenchmarkId, Criterion, Throughput},
     serde::{Deserialize, Serialize},
+    solana_account::Account,
+    solana_clock::Epoch,
     solana_pubkey::Pubkey,
-    solana_sdk::{account::Account, clock::Epoch},
     std::mem,
 };
 

+ 3 - 1
accounts-db/benches/utils.rs

@@ -8,8 +8,10 @@ use {
         Rng, SeedableRng,
     },
     rand_chacha::ChaChaRng,
+    solana_account::AccountSharedData,
     solana_pubkey::Pubkey,
-    solana_sdk::{account::AccountSharedData, rent::Rent, rent_collector::RENT_EXEMPT_RENT_EPOCH},
+    solana_rent::Rent,
+    solana_rent_collector::RENT_EXEMPT_RENT_EPOCH,
     std::iter,
 };
 

+ 4 - 5
accounts-db/src/account_locks.rs

@@ -2,11 +2,10 @@
 use qualifier_attr::qualifiers;
 use {
     ahash::{AHashMap, AHashSet},
+    solana_message::AccountKeys,
     solana_pubkey::Pubkey,
-    solana_sdk::{
-        message::AccountKeys,
-        transaction::{TransactionError, MAX_TX_ACCOUNT_LOCKS},
-    },
+    solana_transaction::sanitized::MAX_TX_ACCOUNT_LOCKS,
+    solana_transaction_error::TransactionError,
     std::{cell::RefCell, collections::hash_map},
 };
 
@@ -156,7 +155,7 @@ fn has_duplicates(account_keys: AccountKeys) -> bool {
 
 #[cfg(test)]
 mod tests {
-    use {super::*, solana_sdk::message::v0::LoadedAddresses};
+    use {super::*, solana_message::v0::LoadedAddresses};
 
     #[test]
     fn test_account_locks() {

+ 3 - 1
accounts-db/src/account_storage/meta.rs

@@ -5,8 +5,10 @@ use {
         append_vec::AppendVecStoredAccountMeta,
         tiered_storage::hot::{HotAccount, HotAccountMeta},
     },
+    solana_account::ReadableAccount,
+    solana_clock::Epoch,
+    solana_hash::Hash,
     solana_pubkey::Pubkey,
-    solana_sdk::{account::ReadableAccount, hash::Hash, stake_history::Epoch},
 };
 
 pub type StoredMetaWriteVersion = u64;

+ 21 - 18
accounts-db/src/accounts.rs

@@ -11,19 +11,20 @@ use {
     },
     dashmap::DashMap,
     log::*,
-    solana_pubkey::Pubkey,
-    solana_sdk::{
-        account::{AccountSharedData, ReadableAccount},
-        address_lookup_table::{self, error::AddressLookupError, state::AddressLookupTable},
-        clock::{BankId, Slot},
-        message::v0::LoadedAddresses,
-        slot_hashes::SlotHashes,
-        transaction::{Result, SanitizedTransaction},
-        transaction_context::TransactionAccount,
+    solana_account::{AccountSharedData, ReadableAccount},
+    solana_address_lookup_table_interface::{
+        self as address_lookup_table, error::AddressLookupError, state::AddressLookupTable,
     },
+    solana_clock::{BankId, Slot},
+    solana_message::v0::LoadedAddresses,
+    solana_pubkey::Pubkey,
+    solana_slot_hashes::SlotHashes,
     solana_svm_transaction::{
         message_address_table_lookup::SVMMessageAddressTableLookup, svm_message::SVMMessage,
     },
+    solana_transaction::sanitized::SanitizedTransaction,
+    solana_transaction_context::TransactionAccount,
+    solana_transaction_error::TransactionResult as Result,
     std::{
         cmp::Reverse,
         collections::{BinaryHeap, HashSet},
@@ -663,16 +664,18 @@ impl Accounts {
 mod tests {
     use {
         super::*,
-        solana_sdk::{
-            account::{AccountSharedData, WritableAccount},
-            address_lookup_table::state::LookupTableMeta,
-            hash::Hash,
-            instruction::CompiledInstruction,
-            message::{v0::MessageAddressTableLookup, Message, MessageHeader},
-            native_loader,
-            signature::{signers::Signers, Keypair, Signer},
-            transaction::{Transaction, TransactionError, MAX_TX_ACCOUNT_LOCKS},
+        solana_account::{AccountSharedData, WritableAccount},
+        solana_address_lookup_table_interface::state::LookupTableMeta,
+        solana_hash::Hash,
+        solana_keypair::Keypair,
+        solana_message::{
+            compiled_instruction::CompiledInstruction, v0::MessageAddressTableLookup, Message,
+            MessageHeader,
         },
+        solana_sdk_ids::native_loader,
+        solana_signer::{signers::Signers, Signer},
+        solana_transaction::{sanitized::MAX_TX_ACCOUNT_LOCKS, Transaction},
+        solana_transaction_error::TransactionError,
         std::{
             borrow::Cow,
             iter,

+ 2 - 4
accounts-db/src/accounts_cache.rs

@@ -3,12 +3,10 @@ use {
     ahash::RandomState as AHashRandomState,
     dashmap::DashMap,
     seqlock::SeqLock,
+    solana_account::{AccountSharedData, ReadableAccount},
+    solana_clock::Slot,
     solana_nohash_hasher::BuildNoHashHasher,
     solana_pubkey::Pubkey,
-    solana_sdk::{
-        account::{AccountSharedData, ReadableAccount},
-        clock::Slot,
-    },
     std::{
         collections::BTreeSet,
         ops::Deref,

+ 8 - 11
accounts-db/src/accounts_db.rs

@@ -82,21 +82,18 @@ use {
     rayon::{prelude::*, ThreadPool},
     seqlock::SeqLock,
     smallvec::SmallVec,
+    solana_account::{Account, AccountSharedData, ReadableAccount},
+    solana_clock::{BankId, Epoch, Slot},
+    solana_epoch_schedule::EpochSchedule,
+    solana_genesis_config::GenesisConfig,
+    solana_hash::Hash,
     solana_lattice_hash::lt_hash::LtHash,
     solana_measure::{meas_dur, measure::Measure, measure_us},
     solana_nohash_hasher::{BuildNoHashHasher, IntMap, IntSet},
     solana_pubkey::Pubkey,
     solana_rayon_threadlimit::get_thread_count,
-    solana_sdk::{
-        account::{Account, AccountSharedData, ReadableAccount},
-        clock::{BankId, Epoch, Slot},
-        epoch_schedule::EpochSchedule,
-        genesis_config::GenesisConfig,
-        hash::Hash,
-        rent_collector::RentCollector,
-        saturating_add_assign,
-        transaction::SanitizedTransaction,
-    },
+    solana_rent_collector::RentCollector,
+    solana_transaction::sanitized::SanitizedTransaction,
     std::{
         borrow::Cow,
         boxed::Box,
@@ -6527,7 +6524,7 @@ impl AccountsDb {
                         pubkey,
                         current_write_version,
                     );
-                    saturating_add_assign!(current_write_version, 1);
+                    current_write_version = current_write_version.saturating_add(1);
 
                     let cached_account =
                         self.accounts_cache.store(slot, pubkey, account_shared_data);

+ 6 - 6
accounts-db/src/accounts_db/geyser_plugin_utils.rs

@@ -1,9 +1,11 @@
 use {
     crate::{account_storage::meta::StoredAccountMeta, accounts_db::AccountsDb},
+    solana_account::AccountSharedData,
+    solana_clock::Slot,
     solana_measure::measure::Measure,
     solana_metrics::*,
     solana_pubkey::Pubkey,
-    solana_sdk::{account::AccountSharedData, clock::Slot, transaction::SanitizedTransaction},
+    solana_transaction::sanitized::SanitizedTransaction,
     std::collections::{HashMap, HashSet},
 };
 
@@ -171,12 +173,10 @@ pub mod tests {
             },
         },
         dashmap::DashMap,
+        solana_account::{AccountSharedData, ReadableAccount},
+        solana_clock::Slot,
         solana_pubkey::Pubkey,
-        solana_sdk::{
-            account::{AccountSharedData, ReadableAccount},
-            clock::Slot,
-            transaction::SanitizedTransaction,
-        },
+        solana_transaction::sanitized::SanitizedTransaction,
         std::sync::{
             atomic::{AtomicBool, Ordering},
             Arc,

+ 4 - 2
accounts-db/src/accounts_db/scan_account_storage.rs

@@ -10,9 +10,11 @@ use {
         sorted_storages::SortedStorages,
     },
     rayon::prelude::*,
+    solana_account::ReadableAccount as _,
+    solana_clock::Slot,
+    solana_hash::Hash,
     solana_measure::{measure::Measure, measure_us},
     solana_pubkey::Pubkey,
-    solana_sdk::{account::ReadableAccount as _, clock::Slot, hash::Hash},
     std::{
         hash::{DefaultHasher, Hash as _, Hasher as _},
         ops::Range,
@@ -377,7 +379,7 @@ mod tests {
             append_vec::AppendVec,
             cache_hash_data::{CacheHashDataFile, DeletionPolicy as CacheHashDeletionPolicy},
         },
-        solana_sdk::account::AccountSharedData,
+        solana_account::AccountSharedData,
         tempfile::TempDir,
         test_case::test_case,
     };

+ 1 - 1
accounts-db/src/accounts_db/stats.rs

@@ -1,6 +1,6 @@
 use {
     crate::{accounts_index::AccountsIndexRootsStats, append_vec::APPEND_VEC_STATS},
-    solana_sdk::timing::AtomicInterval,
+    solana_time_utils::AtomicInterval,
     std::{
         num::Saturating,
         sync::atomic::{AtomicU64, AtomicUsize, Ordering},

+ 26 - 9
accounts-db/src/accounts_db/tests.rs

@@ -16,11 +16,12 @@ use {
     assert_matches::assert_matches,
     itertools::Itertools,
     rand::{prelude::SliceRandom, thread_rng, Rng},
-    solana_pubkey::PUBKEY_BYTES,
-    solana_sdk::{
-        account::{accounts_equal, Account, AccountSharedData, ReadableAccount, WritableAccount},
-        hash::HASH_BYTES,
+    solana_account::{
+        accounts_equal, Account, AccountSharedData, InheritableAccountFields, ReadableAccount,
+        WritableAccount, DUMMY_INHERITABLE_ACCOUNT_FIELDS,
     },
+    solana_hash::HASH_BYTES,
+    solana_pubkey::PUBKEY_BYTES,
     std::{
         hash::DefaultHasher,
         iter::{self, FromIterator},
@@ -79,6 +80,23 @@ where
     }
 }
 
+fn create_loadable_account_with_fields(
+    name: &str,
+    (lamports, rent_epoch): InheritableAccountFields,
+) -> AccountSharedData {
+    AccountSharedData::from(Account {
+        lamports,
+        owner: solana_sdk_ids::native_loader::id(),
+        data: name.as_bytes().to_vec(),
+        executable: true,
+        rent_epoch,
+    })
+}
+
+fn create_loadable_account_for_test(name: &str) -> AccountSharedData {
+    create_loadable_account_with_fields(name, DUMMY_INHERITABLE_ACCOUNT_FIELDS)
+}
+
 impl AccountStorageEntry {
     fn add_account(&self, num_bytes: usize) {
         self.add_accounts(1, num_bytes)
@@ -2458,7 +2476,7 @@ fn test_verify_bank_capitalization() {
             some_slot,
             &[(
                 &native_account_pubkey,
-                &solana_sdk::native_loader::create_loadable_account_for_test("foo"),
+                &create_loadable_account_for_test("foo"),
             )],
         );
         db.add_root_and_flush_write_cache(some_slot);
@@ -3279,15 +3297,14 @@ fn test_delete_dependencies() {
 
 #[test]
 fn test_account_balance_for_capitalization_sysvar() {
-    let normal_sysvar = solana_sdk::account::create_account_for_test(
-        &solana_sdk::slot_history::SlotHistory::default(),
-    );
+    let normal_sysvar =
+        solana_account::create_account_for_test(&solana_slot_history::SlotHistory::default());
     assert_eq!(normal_sysvar.lamports(), 1);
 }
 
 #[test]
 fn test_account_balance_for_capitalization_native_program() {
-    let normal_native_program = solana_sdk::native_loader::create_loadable_account_for_test("foo");
+    let normal_native_program = create_loadable_account_for_test("foo");
     assert_eq!(normal_native_program.lamports(), 1);
 }
 

+ 2 - 1
accounts-db/src/accounts_file.rs

@@ -9,8 +9,9 @@ use {
             error::TieredStorageError, hot::HOT_FORMAT, index::IndexOffset, TieredStorage,
         },
     },
+    solana_account::AccountSharedData,
+    solana_clock::Slot,
     solana_pubkey::Pubkey,
-    solana_sdk::{account::AccountSharedData, clock::Slot},
     std::{
         mem,
         path::{Path, PathBuf},

+ 5 - 6
accounts-db/src/accounts_hash.rs

@@ -8,15 +8,14 @@ use {
     bytemuck_derive::{Pod, Zeroable},
     log::*,
     rayon::prelude::*,
+    solana_clock::Slot,
+    solana_hash::{Hash, HASH_BYTES},
     solana_lattice_hash::lt_hash::LtHash,
     solana_measure::{measure::Measure, measure_us},
     solana_pubkey::Pubkey,
-    solana_sdk::{
-        hash::{Hash, Hasher, HASH_BYTES},
-        rent_collector::RentCollector,
-        slot_history::Slot,
-        sysvar::epoch_schedule::EpochSchedule,
-    },
+    solana_rent_collector::RentCollector,
+    solana_sha256_hasher::Hasher,
+    solana_sysvar::epoch_schedule::EpochSchedule,
     std::{
         clone,
         convert::TryInto,

+ 3 - 5
accounts-db/src/accounts_index.rs

@@ -17,12 +17,10 @@ use {
         iter::{IntoParallelIterator, ParallelIterator},
         ThreadPool,
     },
+    solana_account::ReadableAccount,
+    solana_clock::{BankId, Slot},
     solana_measure::measure::Measure,
     solana_pubkey::Pubkey,
-    solana_sdk::{
-        account::ReadableAccount,
-        clock::{BankId, Slot},
-    },
     std::{
         collections::{btree_map::BTreeMap, HashSet},
         fmt::Debug,
@@ -2113,9 +2111,9 @@ impl<T: IndexValue, U: DiskIndexValue + From<T> + Into<T>> AccountsIndex<T, U> {
 pub mod tests {
     use {
         super::*,
+        solana_account::{AccountSharedData, WritableAccount},
         solana_inline_spl::token::SPL_TOKEN_ACCOUNT_OWNER_OFFSET,
         solana_pubkey::PUBKEY_BYTES,
-        solana_sdk::account::{AccountSharedData, WritableAccount},
         std::ops::RangeInclusive,
     };
 

+ 1 - 1
accounts-db/src/accounts_index/in_mem_accounts_index.rs

@@ -10,9 +10,9 @@ use {
     },
     rand::{thread_rng, Rng},
     solana_bucket_map::bucket_api::BucketApi,
+    solana_clock::Slot,
     solana_measure::measure::Measure,
     solana_pubkey::Pubkey,
-    solana_sdk::clock::Slot,
     std::{
         collections::{hash_map::Entry, HashMap, HashSet},
         fmt::Debug,

+ 2 - 5
accounts-db/src/accounts_partition.rs

@@ -2,12 +2,9 @@
 use {
     itertools::Itertools,
     log::trace,
+    solana_clock::{Epoch, Slot, SlotCount, SlotIndex},
+    solana_epoch_schedule::EpochSchedule,
     solana_pubkey::Pubkey,
-    solana_sdk::{
-        clock::{Slot, SlotCount, SlotIndex},
-        stake_history::Epoch,
-        sysvar::epoch_schedule::EpochSchedule,
-    },
     std::{collections::HashSet, mem, ops::RangeInclusive},
 };
 

+ 2 - 3
accounts-db/src/accounts_update_notifier_interface.rs

@@ -1,7 +1,6 @@
 use {
-    crate::account_storage::meta::StoredAccountMeta,
-    solana_pubkey::Pubkey,
-    solana_sdk::{account::AccountSharedData, clock::Slot, transaction::SanitizedTransaction},
+    crate::account_storage::meta::StoredAccountMeta, solana_account::AccountSharedData,
+    solana_clock::Slot, solana_pubkey::Pubkey, solana_transaction::sanitized::SanitizedTransaction,
     std::sync::Arc,
 };
 

+ 2 - 4
accounts-db/src/ancient_append_vecs.rs

@@ -1237,11 +1237,9 @@ pub mod tests {
             storable_accounts::{tests::build_accounts_from_storage, StorableAccountsBySlot},
         },
         rand::seq::SliceRandom as _,
+        solana_account::{AccountSharedData, ReadableAccount, WritableAccount},
+        solana_hash::Hash,
         solana_pubkey::Pubkey,
-        solana_sdk::{
-            account::{AccountSharedData, ReadableAccount, WritableAccount},
-            hash::Hash,
-        },
         std::{collections::HashSet, ops::Range},
         strum::IntoEnumIterator,
         strum_macros::EnumIter,

+ 8 - 12
accounts-db/src/append_vec.rs

@@ -20,13 +20,11 @@ use {
     },
     log::*,
     memmap2::MmapMut,
+    solana_account::{AccountSharedData, ReadableAccount, WritableAccount},
+    solana_clock::Epoch,
+    solana_hash::Hash,
     solana_pubkey::Pubkey,
-    solana_sdk::{
-        account::{AccountSharedData, ReadableAccount, WritableAccount},
-        hash::Hash,
-        stake_history::Epoch,
-        system_instruction::MAX_PERMITTED_DATA_LENGTH,
-    },
+    solana_system_interface::MAX_PERMITTED_DATA_LENGTH,
     std::{
         convert::TryFrom,
         fs::{remove_file, File, OpenOptions},
@@ -44,7 +42,7 @@ use {
 
 pub mod test_utils;
 #[cfg(test)]
-use solana_sdk::account::accounts_equal;
+use solana_account::accounts_equal;
 
 /// size of the fixed sized fields in an append vec
 /// we need to add data len and align it to get the actual stored size
@@ -850,7 +848,7 @@ impl AppendVec {
     pub fn get_account_test(
         &self,
         offset: usize,
-    ) -> Option<(StoredMeta, solana_sdk::account::AccountSharedData)> {
+    ) -> Option<(StoredMeta, solana_account::AccountSharedData)> {
         let sizes = self.get_account_sizes(&[offset]);
         let result = self.get_stored_account_meta_callback(offset, |r_callback| {
             let r2 = self.get_account_shared_data(offset);
@@ -1235,10 +1233,8 @@ pub mod tests {
         assert_matches::assert_matches,
         memoffset::offset_of,
         rand::{thread_rng, Rng},
-        solana_sdk::{
-            account::{Account, AccountSharedData},
-            clock::Slot,
-        },
+        solana_account::{Account, AccountSharedData},
+        solana_clock::Slot,
         std::{mem::ManuallyDrop, time::Instant},
         test_case::test_case,
     };

+ 1 - 1
accounts-db/src/append_vec/test_utils.rs

@@ -3,8 +3,8 @@
 use {
     super::StoredMeta,
     rand::{distributions::Alphanumeric, Rng},
+    solana_account::AccountSharedData,
     solana_pubkey::Pubkey,
-    solana_sdk::account::AccountSharedData,
     std::path::PathBuf,
 };
 

+ 8 - 8
accounts-db/src/blockhash_queue.rs

@@ -1,10 +1,11 @@
 #[allow(deprecated)]
-use solana_sdk::sysvar::recent_blockhashes;
+use solana_sysvar::recent_blockhashes;
 use {
     serde::{Deserialize, Serialize},
-    solana_sdk::{
-        clock::MAX_RECENT_BLOCKHASHES, fee_calculator::FeeCalculator, hash::Hash, timing::timestamp,
-    },
+    solana_clock::MAX_RECENT_BLOCKHASHES,
+    solana_fee_calculator::FeeCalculator,
+    solana_hash::Hash,
+    solana_time_utils::timestamp,
     std::collections::HashMap,
 };
 
@@ -152,11 +153,10 @@ impl BlockhashQueue {
 #[cfg(test)]
 mod tests {
     #[allow(deprecated)]
-    use solana_sdk::sysvar::recent_blockhashes::IterItem;
+    use solana_sysvar::recent_blockhashes::IterItem;
     use {
-        super::*,
-        bincode::serialize,
-        solana_sdk::{clock::MAX_RECENT_BLOCKHASHES, hash::hash},
+        super::*, bincode::serialize, solana_clock::MAX_RECENT_BLOCKHASHES,
+        solana_sha256_hasher::hash,
     };
 
     #[test]

+ 2 - 4
accounts-db/src/bucket_map_holder.rs

@@ -8,11 +8,9 @@ use {
         waitable_condvar::WaitableCondvar,
     },
     solana_bucket_map::bucket_map::{BucketMap, BucketMapConfig},
+    solana_clock::{Slot, DEFAULT_MS_PER_SLOT},
     solana_measure::measure::Measure,
-    solana_sdk::{
-        clock::{Slot, DEFAULT_MS_PER_SLOT},
-        timing::AtomicInterval,
-    },
+    solana_time_utils::AtomicInterval,
     std::{
         fmt::Debug,
         marker::PhantomData,

+ 1 - 1
accounts-db/src/bucket_map_holder_stats.rs

@@ -3,7 +3,7 @@ use {
         accounts_index::{in_mem_accounts_index::InMemAccountsIndex, DiskIndexValue, IndexValue},
         bucket_map_holder::{Age, AtomicAge, BucketMapHolder},
     },
-    solana_sdk::timing::AtomicInterval,
+    solana_time_utils::AtomicInterval,
     std::{
         fmt::Debug,
         sync::atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering},

+ 1 - 1
accounts-db/src/hardened_unpack.rs

@@ -2,7 +2,7 @@ use {
     bzip2::bufread::BzDecoder,
     log::*,
     rand::{thread_rng, Rng},
-    solana_sdk::genesis_config::{GenesisConfig, DEFAULT_GENESIS_ARCHIVE, DEFAULT_GENESIS_FILE},
+    solana_genesis_config::{GenesisConfig, DEFAULT_GENESIS_ARCHIVE, DEFAULT_GENESIS_FILE},
     std::{
         collections::HashMap,
         fs::{self, File},

+ 3 - 5
accounts-db/src/read_only_accounts_cache.rs

@@ -10,12 +10,10 @@ use {
         seq::{IteratorRandom, SliceRandom},
         thread_rng, Rng,
     },
+    solana_account::{AccountSharedData, ReadableAccount},
+    solana_clock::Slot,
     solana_measure::{measure::Measure, measure_us},
     solana_pubkey::Pubkey,
-    solana_sdk::{
-        account::{AccountSharedData, ReadableAccount},
-        clock::Slot,
-    },
     std::{
         mem::ManuallyDrop,
         sync::{
@@ -454,7 +452,7 @@ mod tests {
         super::*,
         rand::{Rng, SeedableRng},
         rand_chacha::ChaChaRng,
-        solana_sdk::account::Account,
+        solana_account::Account,
         std::{
             collections::HashMap,
             iter::repeat_with,

+ 2 - 1
accounts-db/src/secondary_index.rs

@@ -1,7 +1,8 @@
 use {
     dashmap::{mapref::entry::Entry::Occupied, DashMap},
     log::*,
-    solana_sdk::{pubkey::Pubkey, timing::AtomicInterval},
+    solana_pubkey::Pubkey,
+    solana_time_utils::AtomicInterval,
     std::{
         collections::HashSet,
         fmt::Debug,

+ 6 - 10
accounts-db/src/stake_rewards.rs

@@ -2,8 +2,10 @@
 
 use {
     crate::storable_accounts::{AccountForStorage, StorableAccounts},
+    solana_account::AccountSharedData,
+    solana_clock::Slot,
     solana_pubkey::Pubkey,
-    solana_sdk::{account::AccountSharedData, clock::Slot, reward_info::RewardInfo},
+    solana_reward_info::RewardInfo,
 };
 
 #[cfg_attr(feature = "frozen-abi", derive(AbiExample))]
@@ -44,14 +46,8 @@ impl<'a> StorableAccounts<'a> for (Slot, &'a [StakeReward]) {
 
 #[cfg(feature = "dev-context-only-utils")]
 use {
-    rand::Rng,
-    solana_sdk::{
-        account::WritableAccount,
-        rent::Rent,
-        signature::{Keypair, Signer},
-    },
-    solana_stake_program::stake_state,
-    solana_vote_program::vote_state,
+    rand::Rng, solana_account::WritableAccount, solana_keypair::Keypair, solana_rent::Rent,
+    solana_signer::Signer, solana_stake_program::stake_state, solana_vote_program::vote_state,
 };
 
 // These functions/fields are only usable from a dev context (i.e. tests and benches)
@@ -86,7 +82,7 @@ impl StakeReward {
         Self {
             stake_pubkey: Pubkey::new_unique(),
             stake_reward_info: RewardInfo {
-                reward_type: solana_sdk::reward_type::RewardType::Staking,
+                reward_type: solana_reward_info::RewardType::Staking,
                 lamports: reward_lamports,
                 post_balance: 0,  /* unused atm */
                 commission: None, /* unused atm */

+ 4 - 8
accounts-db/src/storable_accounts.rs

@@ -5,11 +5,9 @@ use {
         accounts_db::{AccountFromStorage, AccountStorageEntry, AccountsDb},
         accounts_index::ZeroLamport,
     },
+    solana_account::{AccountSharedData, ReadableAccount},
+    solana_clock::{Epoch, Slot},
     solana_pubkey::Pubkey,
-    solana_sdk::{
-        account::{AccountSharedData, ReadableAccount},
-        clock::{Epoch, Slot},
-    },
     std::sync::{Arc, RwLock},
 };
 
@@ -321,10 +319,8 @@ pub mod tests {
             accounts_hash::AccountHash,
             append_vec::AppendVecStoredAccountMeta,
         },
-        solana_sdk::{
-            account::{accounts_equal, AccountSharedData, WritableAccount},
-            hash::Hash,
-        },
+        solana_account::{accounts_equal, AccountSharedData, WritableAccount},
+        solana_hash::Hash,
         std::sync::Arc,
     };
 

+ 3 - 5
accounts-db/src/tiered_storage.rs

@@ -178,12 +178,10 @@ mod tests {
         file::TieredStorageMagicNumber,
         footer::TieredStorageFooter,
         hot::HOT_FORMAT,
+        solana_account::{AccountSharedData, ReadableAccount},
+        solana_clock::Slot,
         solana_pubkey::Pubkey,
-        solana_sdk::{
-            account::{AccountSharedData, ReadableAccount},
-            clock::Slot,
-            system_instruction::MAX_PERMITTED_DATA_LENGTH,
-        },
+        solana_system_interface::MAX_PERMITTED_DATA_LENGTH,
         std::{
             collections::{HashMap, HashSet},
             mem::ManuallyDrop,

+ 1 - 1
accounts-db/src/tiered_storage/byte_block.rs

@@ -188,7 +188,7 @@ impl ByteBlockReader {
 
 #[cfg(test)]
 mod tests {
-    use {super::*, solana_sdk::stake_history::Epoch};
+    use {super::*, solana_clock::Epoch};
 
     fn read_type_unaligned<T>(buffer: &[u8], offset: usize) -> (T, usize) {
         let size = std::mem::size_of::<T>();

+ 1 - 1
accounts-db/src/tiered_storage/footer.rs

@@ -10,8 +10,8 @@ use {
     bytemuck::Zeroable,
     memmap2::Mmap,
     num_enum::TryFromPrimitiveError,
+    solana_hash::Hash,
     solana_pubkey::Pubkey,
-    solana_sdk::hash::Hash,
     std::{mem, path::Path, ptr},
     thiserror::Error,
 };

+ 6 - 8
accounts-db/src/tiered_storage/hot.rs

@@ -22,12 +22,10 @@ use {
     bytemuck_derive::{Pod, Zeroable},
     memmap2::{Mmap, MmapOptions},
     modular_bitfield::prelude::*,
+    solana_account::{AccountSharedData, ReadableAccount, WritableAccount},
+    solana_clock::Epoch,
     solana_pubkey::Pubkey,
-    solana_sdk::{
-        account::{AccountSharedData, ReadableAccount, WritableAccount},
-        rent_collector::RENT_EXEMPT_RENT_EPOCH,
-        stake_history::Epoch,
-    },
+    solana_rent_collector::RENT_EXEMPT_RENT_EPOCH,
     std::{io::Write, option::Option, path::Path},
 };
 
@@ -833,10 +831,10 @@ mod tests {
         assert_matches::assert_matches,
         memoffset::offset_of,
         rand::{seq::SliceRandom, Rng},
+        solana_account::ReadableAccount,
+        solana_clock::{Epoch, Slot},
+        solana_hash::Hash,
         solana_pubkey::Pubkey,
-        solana_sdk::{
-            account::ReadableAccount, hash::Hash, slot_history::Slot, stake_history::Epoch,
-        },
         std::path::PathBuf,
         tempfile::TempDir,
     };

+ 2 - 1
accounts-db/src/tiered_storage/meta.rs

@@ -4,7 +4,8 @@ use {
     crate::tiered_storage::owners::OwnerOffset,
     bytemuck_derive::{Pod, Zeroable},
     modular_bitfield::prelude::*,
-    solana_sdk::{pubkey::Pubkey, stake_history::Epoch},
+    solana_clock::Epoch,
+    solana_pubkey::Pubkey,
 };
 
 /// The struct that handles the account meta flags.

+ 1 - 1
accounts-db/src/tiered_storage/readable.rs

@@ -11,8 +11,8 @@ use {
             TieredStorageResult,
         },
     },
+    solana_account::AccountSharedData,
     solana_pubkey::Pubkey,
-    solana_sdk::account::AccountSharedData,
     std::path::Path,
 };
 

+ 3 - 5
accounts-db/src/tiered_storage/test_utils.rs

@@ -6,12 +6,10 @@ use {
         account_storage::meta::{StoredAccountMeta, StoredMeta},
         accounts_hash::AccountHash,
     },
+    solana_account::{Account, AccountSharedData, ReadableAccount},
+    solana_hash::Hash,
     solana_pubkey::Pubkey,
-    solana_sdk::{
-        account::{Account, AccountSharedData, ReadableAccount},
-        hash::Hash,
-        rent_collector::RENT_EXEMPT_RENT_EPOCH,
-    },
+    solana_rent_collector::RENT_EXEMPT_RENT_EPOCH,
 };
 
 /// Create a test account based on the specified seed.

+ 1 - 1
accounts-db/tests/read_only_accounts_cache.rs

@@ -1,8 +1,8 @@
 use {
     rand::{rngs::SmallRng, SeedableRng},
+    solana_account::{Account, AccountSharedData},
     solana_accounts_db::read_only_accounts_cache::{ReadOnlyAccountsCache, CACHE_ENTRY_SIZE},
     solana_pubkey::Pubkey,
-    solana_sdk::account::{Account, AccountSharedData},
     std::{collections::HashSet, sync::atomic::Ordering},
     test_case::test_matrix,
 };

+ 16 - 1
programs/sbf/Cargo.lock

@@ -5129,18 +5129,33 @@ dependencies = [
  "serde",
  "serde_derive",
  "smallvec",
+ "solana-account",
+ "solana-address-lookup-table-interface",
  "solana-bucket-map",
  "solana-clock",
+ "solana-epoch-schedule",
+ "solana-fee-calculator",
+ "solana-genesis-config",
  "solana-hash",
  "solana-inline-spl",
  "solana-lattice-hash",
  "solana-measure",
+ "solana-message",
  "solana-metrics",
  "solana-nohash-hasher",
  "solana-pubkey",
  "solana-rayon-threadlimit",
- "solana-sdk",
+ "solana-rent-collector",
+ "solana-reward-info",
+ "solana-sha256-hasher",
+ "solana-slot-hashes",
  "solana-svm-transaction",
+ "solana-system-interface",
+ "solana-sysvar",
+ "solana-time-utils",
+ "solana-transaction",
+ "solana-transaction-context",
+ "solana-transaction-error",
  "static_assertions",
  "tar",
  "tempfile",

+ 16 - 1
svm/examples/Cargo.lock

@@ -4983,18 +4983,33 @@ dependencies = [
  "serde",
  "serde_derive",
  "smallvec",
+ "solana-account",
+ "solana-address-lookup-table-interface",
  "solana-bucket-map",
  "solana-clock",
+ "solana-epoch-schedule",
+ "solana-fee-calculator",
+ "solana-genesis-config",
  "solana-hash",
  "solana-inline-spl",
  "solana-lattice-hash",
  "solana-measure",
+ "solana-message",
  "solana-metrics",
  "solana-nohash-hasher",
  "solana-pubkey",
  "solana-rayon-threadlimit",
- "solana-sdk",
+ "solana-rent-collector",
+ "solana-reward-info",
+ "solana-sha256-hasher",
+ "solana-slot-hashes",
  "solana-svm-transaction",
+ "solana-system-interface",
+ "solana-sysvar",
+ "solana-time-utils",
+ "solana-transaction",
+ "solana-transaction-context",
+ "solana-transaction-error",
  "static_assertions",
  "tar",
  "tempfile",