Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce public visibility of some SVM related structs and APIs #4378

Merged
merged 2 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions builtins-default-costs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ pub enum BuiltinCost {
}

impl BuiltinCost {
pub fn native_cost(&self) -> u64 {
fn native_cost(&self) -> u64 {
match self {
BuiltinCost::Migrating(MigratingBuiltinCost { native_cost, .. }) => *native_cost,
BuiltinCost::NotMigrating(NotMigratingBuiltinCost { native_cost }) => *native_cost,
}
}

pub fn core_bpf_migration_feature(&self) -> Option<&Pubkey> {
fn core_bpf_migration_feature(&self) -> Option<&Pubkey> {
match self {
BuiltinCost::Migrating(MigratingBuiltinCost {
core_bpf_migration_feature,
Expand All @@ -58,7 +58,7 @@ impl BuiltinCost {
}
}

pub fn position(&self) -> Option<usize> {
fn position(&self) -> Option<usize> {
match self {
BuiltinCost::Migrating(MigratingBuiltinCost { position, .. }) => Some(*position),
BuiltinCost::NotMigrating(_) => None,
Expand Down Expand Up @@ -137,7 +137,7 @@ pub const MIGRATING_BUILTINS_COSTS: &[(Pubkey, BuiltinCost)] = &[
),
];

pub const NON_MIGRATING_BUILTINS_COSTS: &[(Pubkey, BuiltinCost)] = &[
const NON_MIGRATING_BUILTINS_COSTS: &[(Pubkey, BuiltinCost)] = &[
(
vote::id(),
BuiltinCost::NotMigrating(NotMigratingBuiltinCost {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use {
};

// The maximum number of pubkeys that a packet can contain.
pub const FILTER_SIZE: u8 = (PACKET_DATA_SIZE / core::mem::size_of::<Pubkey>()) as u8;
pub(crate) const FILTER_SIZE: u8 = (PACKET_DATA_SIZE / core::mem::size_of::<Pubkey>()) as u8;

#[derive(Clone, Copy, Debug, PartialEq)]
pub(crate) enum ProgramKind {
Expand Down
2 changes: 2 additions & 0 deletions compute-budget/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ license = { workspace = true }
edition = { workspace = true }

[dependencies]
qualifier_attr = { workspace = true, optional = true }
solana-fee-structure = { workspace = true }
solana-frozen-abi = { workspace = true, optional = true, features = [
"frozen-abi",
] }
solana-program-entrypoint = { workspace = true }

[features]
dev-context-only-utils = ["dep:qualifier_attr"]
frozen-abi = ["dep:solana-frozen-abi", "solana-fee-structure/frozen-abi"]

[lints]
Expand Down
5 changes: 4 additions & 1 deletion compute-budget/src/compute_budget.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use crate::compute_budget_limits::{self, ComputeBudgetLimits, DEFAULT_HEAP_COST};
#[cfg(feature = "dev-context-only-utils")]
use qualifier_attr::qualifiers;

#[cfg(feature = "frozen-abi")]
impl ::solana_frozen_abi::abi_example::AbiExample for ComputeBudget {
Expand Down Expand Up @@ -146,7 +148,8 @@ impl From<ComputeBudgetLimits> for ComputeBudget {
}

impl ComputeBudget {
pub fn new(compute_unit_limit: u64) -> Self {
#[cfg_attr(feature = "dev-context-only-utils", qualifiers(pub))]
fn new(compute_unit_limit: u64) -> Self {
ComputeBudget {
compute_unit_limit,
log_64_units: 100,
Expand Down
1 change: 1 addition & 0 deletions program-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ thiserror = { workspace = true }

[dev-dependencies]
assert_matches = { workspace = true }
solana-compute-budget = { workspace = true, features = ["dev-context-only-utils"] }
solana-instruction = { workspace = true, features = ["bincode"] }
solana-pubkey = { workspace = true, features = ["rand"] }
solana-transaction-context = { workspace = true, features = [
Expand Down
1 change: 1 addition & 0 deletions svm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ prost = { workspace = true }
rand0-7 = { workspace = true }
shuttle = { workspace = true }
solana-clock = { workspace = true }
solana-compute-budget = { workspace = true, features = ["dev-context-only-utils"] }
solana-compute-budget-interface = { workspace = true }
solana-compute-budget-program = { workspace = true }
solana-ed25519-program = { workspace = true }
Expand Down
Loading