diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 5c911ab79a..a6ab24c48a 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -38,6 +38,7 @@ pub mod log_collector; pub mod message_processor; pub mod neon_evm_program; pub mod non_circulating_supply; +mod nonce_keyed_account; mod pubkey_bins; mod read_only_accounts_cache; pub mod rent_collector; diff --git a/sdk/src/nonce_keyed_account.rs b/runtime/src/nonce_keyed_account.rs similarity index 98% rename from sdk/src/nonce_keyed_account.rs rename to runtime/src/nonce_keyed_account.rs index 77097fb86f..dda439f190 100644 --- a/sdk/src/nonce_keyed_account.rs +++ b/runtime/src/nonce_keyed_account.rs @@ -1,16 +1,11 @@ -#![cfg(feature = "full")] - -use crate::{ +use solana_sdk::{ account::{ReadableAccount, WritableAccount}, account_utils::State as AccountUtilsState, feature_set, ic_msg, - keyed_account::KeyedAccount, - nonce_account::create_account, - process_instruction::InvokeContext, -}; -use solana_program::{ instruction::{checked_add, InstructionError}, + keyed_account::KeyedAccount, nonce::{self, state::Versions, State}, + process_instruction::InvokeContext, pubkey::Pubkey, system_instruction::{nonce_to_instruction_error, NonceError}, sysvar::rent::Rent, @@ -256,30 +251,30 @@ impl<'a> NonceKeyedAccount for KeyedAccount<'a> { } } -/// Convenience function for working with keyed accounts in tests -pub fn with_test_keyed_account(lamports: u64, signer: bool, f: F) -where - F: Fn(&KeyedAccount), -{ - let pubkey = Pubkey::new_unique(); - let account = create_account(lamports); - let keyed_account = KeyedAccount::new(&pubkey, signer, &account); - f(&keyed_account) -} - #[cfg(test)] mod test { use super::*; - use crate::{ + use solana_sdk::{ account::ReadableAccount, account_utils::State as AccountUtilsState, + hash::{hash, Hash}, keyed_account::KeyedAccount, nonce::{self, State}, + nonce_account::create_account, nonce_account::verify_nonce_account, process_instruction::MockInvokeContext, system_instruction::SystemError, }; - use solana_program::hash::{hash, Hash}; + + fn with_test_keyed_account(lamports: u64, signer: bool, f: F) + where + F: Fn(&KeyedAccount), + { + let pubkey = Pubkey::new_unique(); + let account = create_account(lamports); + let keyed_account = KeyedAccount::new(&pubkey, signer, &account); + f(&keyed_account) + } fn create_test_blockhash(seed: usize) -> (Hash, u64) { ( diff --git a/runtime/src/system_instruction_processor.rs b/runtime/src/system_instruction_processor.rs index e0dd9571a8..2c9a278861 100644 --- a/runtime/src/system_instruction_processor.rs +++ b/runtime/src/system_instruction_processor.rs @@ -1,3 +1,4 @@ +use crate::nonce_keyed_account::NonceKeyedAccount; use log::*; use solana_sdk::{ account::{AccountSharedData, ReadableAccount, WritableAccount}, @@ -6,7 +7,6 @@ use solana_sdk::{ instruction::InstructionError, keyed_account::{from_keyed_account, get_signers, keyed_account_at_index, KeyedAccount}, nonce, - nonce_keyed_account::NonceKeyedAccount, process_instruction::InvokeContext, program_utils::limited_deserialize, pubkey::Pubkey, diff --git a/sdk/src/lib.rs b/sdk/src/lib.rs index c5a3436dc8..bf99180e5b 100644 --- a/sdk/src/lib.rs +++ b/sdk/src/lib.rs @@ -33,7 +33,6 @@ pub mod keyed_account; pub mod log; pub mod native_loader; pub mod nonce_account; -pub mod nonce_keyed_account; pub mod packet; pub mod poh_config; pub mod precompiles;