diff --git a/builtins/Cargo.toml b/builtins/Cargo.toml index 637a4af083012c..7c416c4a36fc43 100644 --- a/builtins/Cargo.toml +++ b/builtins/Cargo.toml @@ -10,7 +10,7 @@ license = { workspace = true } edition = { workspace = true } [features] -dev-context-only-utils = [] +mock-builtin-migrations = [] [dependencies] ahash = { workspace = true } diff --git a/builtins/src/cost_modeling.rs b/builtins/src/cost_modeling.rs index 8049db142192da..942773e2b3fd3a 100644 --- a/builtins/src/cost_modeling.rs +++ b/builtins/src/cost_modeling.rs @@ -9,10 +9,15 @@ use { solana_sdk_ids::{ed25519_program, secp256k1_program}, }; +#[cfg(not(feature = "mock-builtin-migrations"))] /// CONTRIBUTOR: If you change any builtin Core BPF migration configurations /// in this crate's `BUILTINS` list, you must update this constant to reflect /// the number of builtin programs that have Core BPF migration configurations. pub const NUM_COST_MODELED_BUILTINS_WITH_MIGRATIONS: usize = 3; +#[cfg(feature = "mock-builtin-migrations")] +/// CONTRIBUTOR: Under the `mock-builtin-migrations` feature, this value is +/// `BUILTINS.len()`. If a new builtin is added, this should be updated. +pub const NUM_COST_MODELED_BUILTINS_WITH_MIGRATIONS: usize = 11; /// Configuration for cost modeling of a builtin program. #[derive(Debug)] @@ -172,7 +177,6 @@ pub fn get_builtin_migration_feature_index_from_feature_id(feature_id: &Pubkey) mod test { use super::*; - #[cfg(not(feature = "dev-context-only-utils"))] #[test] fn test_cost_modeled_builtins_with_migrations_compiles() { // This test is a compile-time check to ensure that the number of diff --git a/builtins/src/lib.rs b/builtins/src/lib.rs index f76e794e7758e7..66e3bf7965c4b9 100644 --- a/builtins/src/lib.rs +++ b/builtins/src/lib.rs @@ -32,11 +32,11 @@ macro_rules! testable_prototype { $prototype { name: stringify!($name), core_bpf_migration_config: { - #[cfg(not(feature = "dev-context-only-utils"))] + #[cfg(not(feature = "mock-builtin-migrations"))] { $core_bpf_migration_config } - #[cfg(feature = "dev-context-only-utils")] + #[cfg(feature = "mock-builtin-migrations")] { Some( test_only::$name::CONFIG ) } @@ -223,7 +223,7 @@ mod buffer_accounts { // into the builtins list for both the feature ID and the source program ID. // These arbitrary IDs can then be used to configure feature-activation runtime // tests. -#[cfg(any(test, feature = "dev-context-only-utils"))] +#[cfg(any(test, feature = "mock-builtin-migrations"))] pub mod test_only { use crate::core_bpf_migration::{CoreBpfMigrationConfig, CoreBpfMigrationTargetType}; pub mod system_program { @@ -398,12 +398,11 @@ pub mod test_only { } } -#[cfg(all(feature = "dev-context-only-utils", test))] +#[cfg(all(feature = "mock-builtin-migrations", test))] mod tests { // Since a macro is used to initialize the test IDs from the `test_only` // module, best to ensure the lists have the expected values within a test // context. - #[cfg(feature = "dev-context-only-utils")] #[test] fn test_testable_prototypes() { assert_eq!( diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 1556a459f5e0c0..92c3ab6010eb19 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -107,7 +107,7 @@ memoffset = { workspace = true } rand0-7 = { package = "rand", version = "0.7" } rand_chacha = { workspace = true } solana-accounts-db = { workspace = true, features = ["dev-context-only-utils"] } -solana-builtins = { workspace = true, features = ["dev-context-only-utils"] } +solana-builtins = { workspace = true, features = ["mock-builtin-migrations"] } solana-logger = { workspace = true } # See order-crates-for-publishing.py for using this unusual `path = "."` solana-runtime = { path = ".", features = ["dev-context-only-utils"] }