From 974c013c04e9386352e83de605efbdbc89af325a Mon Sep 17 00:00:00 2001 From: Lucas Ste <38472950+LucasSte@users.noreply.github.com> Date: Thu, 20 Jun 2024 07:49:10 -0300 Subject: [PATCH] Make futures crate optional in solana-type-overrides (#1792) --- programs/sbf/Cargo.lock | 1 - svm/src/transaction_processor.rs | 3 +-- type-overrides/Cargo.toml | 3 ++- type-overrides/src/lib.rs | 2 ++ 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index 820ba3c8ddd06e..0c9bbdf9784c6b 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -6445,7 +6445,6 @@ dependencies = [ name = "solana-type-overrides" version = "2.0.0" dependencies = [ - "futures 0.3.30", "lazy_static", "rand 0.8.5", ] diff --git a/svm/src/transaction_processor.rs b/svm/src/transaction_processor.rs index 166cda5bc903e6..bd937885c9af98 100644 --- a/svm/src/transaction_processor.rs +++ b/svm/src/transaction_processor.rs @@ -53,14 +53,13 @@ use { transaction::{self, SanitizedTransaction, TransactionError}, transaction_context::{ExecutionRecord, TransactionContext}, }, - solana_type_overrides::sync::{atomic::Ordering, Arc, RwLock}, + solana_type_overrides::sync::{atomic::Ordering, Arc, RwLock, RwLockReadGuard}, solana_vote::vote_account::VoteAccountsHashMap, std::{ cell::RefCell, collections::{hash_map::Entry, HashMap, HashSet}, fmt::{Debug, Formatter}, rc::Rc, - sync::RwLockReadGuard, }, }; diff --git a/type-overrides/Cargo.toml b/type-overrides/Cargo.toml index 28c49f198e73e0..07b69542e53e6f 100644 --- a/type-overrides/Cargo.toml +++ b/type-overrides/Cargo.toml @@ -9,10 +9,11 @@ license = { workspace = true } edition = { workspace = true } [dependencies] -futures = { workspace = true } +futures = { workspace = true, optional = true } lazy_static = { workspace = true } rand = { workspace = true } shuttle = { workspace = true, optional = true } [features] shuttle-test = ["dep:shuttle"] +executor = ["dep:futures"] diff --git a/type-overrides/src/lib.rs b/type-overrides/src/lib.rs index d48cfadffa1eec..4d9a2ac1a63922 100644 --- a/type-overrides/src/lib.rs +++ b/type-overrides/src/lib.rs @@ -6,6 +6,8 @@ /// /// Instead of importing from std, rand, and so on, import the following from solana-type-override, /// and include the 'shuttle-test' feature in your crate to use shuttle. + +#[cfg(feature = "executor")] pub mod executor { #[cfg(not(feature = "shuttle-test"))] pub use futures::executor::*;