diff --git a/Cargo.lock b/Cargo.lock index 5b17555bc..9e3b07aa3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3686,7 +3686,6 @@ dependencies = [ "bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "bs58 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", "generic-array 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index 24e540085..e8d8fda94 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -36,7 +36,6 @@ assert_matches = { version = "1.3.0", optional = true } bincode = "1.1.4" bs58 = "0.2.5" byteorder = { version = "1.3.2", optional = true } -cfg-if = "0.1.9" chrono = { version = "0.4.9", features = ["serde"], optional = true } generic-array = { version = "0.13.2", default-features = false, features = ["serde", "more_lengths"], optional = true } hex = "0.3.2" diff --git a/sdk/src/account.rs b/sdk/src/account.rs index 035bb8f70..dbd0bf0dc 100644 --- a/sdk/src/account.rs +++ b/sdk/src/account.rs @@ -1,4 +1,4 @@ -use crate::{pubkey::Pubkey, clock::Epoch}; +use crate::{clock::Epoch, pubkey::Pubkey}; use std::{cmp, fmt}; /// An Account with data that is stored on chain diff --git a/sdk/src/fee_calculator.rs b/sdk/src/fee_calculator.rs index 8b5385afc..18187e742 100644 --- a/sdk/src/fee_calculator.rs +++ b/sdk/src/fee_calculator.rs @@ -1,5 +1,5 @@ -use crate::message::Message; use crate::clock::{DEFAULT_TICKS_PER_SECOND, DEFAULT_TICKS_PER_SLOT}; +use crate::message::Message; use log::*; #[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug)] diff --git a/sdk/src/genesis_block.rs b/sdk/src/genesis_block.rs index b5e208775..f51e7ccab 100644 --- a/sdk/src/genesis_block.rs +++ b/sdk/src/genesis_block.rs @@ -1,6 +1,7 @@ //! The `genesis_block` module is a library for generating the chain's genesis block. use crate::account::Account; +use crate::clock::{DEFAULT_SLOTS_PER_EPOCH, DEFAULT_SLOTS_PER_SEGMENT, DEFAULT_TICKS_PER_SLOT}; use crate::fee_calculator::FeeCalculator; use crate::hash::{hash, Hash}; use crate::inflation::Inflation; @@ -9,7 +10,6 @@ use crate::pubkey::Pubkey; use crate::rent::Rent; use crate::signature::{Keypair, KeypairUtil}; use crate::system_program::{self, solana_system_program}; -use crate::clock::{DEFAULT_SLOTS_PER_EPOCH, DEFAULT_SLOTS_PER_SEGMENT, DEFAULT_TICKS_PER_SLOT}; use bincode::{deserialize, serialize}; use memmap::Mmap; use std::fs::{File, OpenOptions}; diff --git a/sdk/src/lib.rs b/sdk/src/lib.rs index fa88f7a97..edcaf41d8 100644 --- a/sdk/src/lib.rs +++ b/sdk/src/lib.rs @@ -1,49 +1,67 @@ -#[macro_use] -extern crate cfg_if; - pub mod clock; pub mod pubkey; // On-chain program modules -cfg_if! { - if #[cfg(feature = "program")] { - pub mod entrypoint; - pub mod log; - pub mod program_test; - } -} +#[cfg(feature = "program")] +pub mod entrypoint; +#[cfg(feature = "program")] +pub mod log; +#[cfg(feature = "program")] +pub mod program_test; // Kitchen sink modules -cfg_if! { - if #[cfg(feature = "kitchen_sink")] { - pub mod account; - pub mod account_utils; - pub mod bpf_loader; - pub mod client; - pub mod fee_calculator; - pub mod genesis_block; - pub mod hash; - pub mod inflation; - pub mod instruction; - pub mod instruction_processor_utils; - pub mod loader_instruction; - pub mod message; - pub mod native_loader; - pub mod packet; - pub mod poh_config; - pub mod rent; - pub mod rpc_port; - pub mod short_vec; - pub mod signature; - pub mod system_instruction; - pub mod system_program; - pub mod system_transaction; - pub mod sysvar; - pub mod timing; - pub mod transaction; - pub mod transport; - } -} +#[cfg(feature = "kitchen_sink")] +pub mod account; +#[cfg(feature = "kitchen_sink")] +pub mod account_utils; +#[cfg(feature = "kitchen_sink")] +pub mod bpf_loader; +#[cfg(feature = "kitchen_sink")] +pub mod client; +#[cfg(feature = "kitchen_sink")] +pub mod fee_calculator; +#[cfg(feature = "kitchen_sink")] +pub mod genesis_block; +#[cfg(feature = "kitchen_sink")] +pub mod hash; +#[cfg(feature = "kitchen_sink")] +pub mod inflation; +#[cfg(feature = "kitchen_sink")] +pub mod instruction; +#[cfg(feature = "kitchen_sink")] +pub mod instruction_processor_utils; +#[cfg(feature = "kitchen_sink")] +pub mod loader_instruction; +#[cfg(feature = "kitchen_sink")] +pub mod message; +#[cfg(feature = "kitchen_sink")] +pub mod native_loader; +#[cfg(feature = "kitchen_sink")] +pub mod packet; +#[cfg(feature = "kitchen_sink")] +pub mod poh_config; +#[cfg(feature = "kitchen_sink")] +pub mod rent; +#[cfg(feature = "kitchen_sink")] +pub mod rpc_port; +#[cfg(feature = "kitchen_sink")] +pub mod short_vec; +#[cfg(feature = "kitchen_sink")] +pub mod signature; +#[cfg(feature = "kitchen_sink")] +pub mod system_instruction; +#[cfg(feature = "kitchen_sink")] +pub mod system_program; +#[cfg(feature = "kitchen_sink")] +pub mod system_transaction; +#[cfg(feature = "kitchen_sink")] +pub mod sysvar; +#[cfg(feature = "kitchen_sink")] +pub mod timing; +#[cfg(feature = "kitchen_sink")] +pub mod transaction; +#[cfg(feature = "kitchen_sink")] +pub mod transport; #[macro_use] extern crate serde_derive; diff --git a/sdk/src/sysvar/clock.rs b/sdk/src/sysvar/clock.rs index 57d30cb02..9b3748200 100644 --- a/sdk/src/sysvar/clock.rs +++ b/sdk/src/sysvar/clock.rs @@ -56,8 +56,8 @@ pub fn create_account( } use crate::account::KeyedAccount; -use crate::instruction::InstructionError; use crate::clock::Segment; +use crate::instruction::InstructionError; pub fn from_keyed_account(account: &KeyedAccount) -> Result { if !check_id(account.unsigned_key()) {