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

move solana-program to dev deps of solana-bpf-loader-program #4766

Merged
merged 2 commits into from
Feb 5, 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
5 changes: 5 additions & 0 deletions Cargo.lock

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

9 changes: 7 additions & 2 deletions programs/bpf_loader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ qualifier_attr = { workspace = true }
scopeguard = { workspace = true }
solana-account = { workspace = true }
solana-account-info = { workspace = true }
solana-big-mod-exp = { workspace = true }
solana-bincode = { workspace = true }
solana-blake3-hasher = { workspace = true }
solana-bn254 = { workspace = true }
solana-clock = { workspace = true }
solana-compute-budget = { workspace = true }
Expand All @@ -26,12 +28,13 @@ solana-feature-set = { workspace = true }
solana-hash = { workspace = true }
solana-instruction = { workspace = true }
solana-keccak-hasher = { workspace = true }
solana-loader-v3-interface = { workspace = true, features = ["serde"] }
solana-loader-v4-interface = { workspace = true, optional = true }
solana-log-collector = { workspace = true }
solana-measure = { workspace = true }
solana-packet = { workspace = true }
solana-poseidon = { workspace = true }
solana-precompiles = { workspace = true }
solana-program = { workspace = true }
solana-program-entrypoint = { workspace = true }
solana-program-memory = { workspace = true }
solana-program-runtime = { workspace = true }
Expand All @@ -58,10 +61,12 @@ solana-epoch-rewards = { workspace = true }
solana-epoch-schedule = { workspace = true }
solana-fee-calculator = { workspace = true }
solana-last-restart-slot = { workspace = true }
solana-program = { workspace = true }
solana-pubkey = { workspace = true, features = ["rand"] }
solana-rent = { workspace = true }
solana-slot-hashes = { workspace = true }
solana-transaction-context = { workspace = true, features = ["dev-context-only-utils"] }
static_assertions = { workspace = true }
test-case = { workspace = true }

[lib]
Expand All @@ -87,4 +92,4 @@ shuttle-test = [
"solana-program-runtime/shuttle-test",
"solana-sbpf/shuttle-test"
]
svm-internal = []
svm-internal = ["dep:solana-loader-v4-interface"]
11 changes: 5 additions & 6 deletions programs/bpf_loader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ use {
enable_bpf_loader_set_authority_checked_ix, remove_accounts_executable_flag_checks,
},
solana_instruction::{error::InstructionError, AccountMeta},
solana_loader_v3_interface::{
instruction::UpgradeableLoaderInstruction, state::UpgradeableLoaderState,
},
solana_log_collector::{ic_logger_msg, ic_msg, LogCollector},
solana_measure::measure::Measure,
solana_program::{
bpf_loader_upgradeable::UpgradeableLoaderState,
loader_upgradeable_instruction::UpgradeableLoaderInstruction,
},
solana_program_entrypoint::{MAX_PERMITTED_DATA_INCREASE, SUCCESS},
solana_program_runtime::{
invoke_context::{BpfAllocator, InvokeContext, SerializedAccountMetadata, SyscallContext},
Expand Down Expand Up @@ -1583,9 +1582,9 @@ mod test_utils {
#[cfg(feature = "svm-internal")]
use {
super::*, crate::syscalls::create_program_runtime_environment_v1,
solana_account::ReadableAccount, solana_program::loader_v4,
solana_program::loader_v4::LoaderV4State,
solana_account::ReadableAccount, solana_loader_v4_interface::state::LoaderV4State,
solana_program_runtime::loaded_programs::DELAY_VISIBILITY_SLOT_OFFSET,
solana_sdk_ids::loader_v4,
};

#[cfg(feature = "svm-internal")]
Expand Down
28 changes: 21 additions & 7 deletions programs/bpf_loader/src/syscalls/cpi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@ use {
crate::serialization::account_data_region_memory_state,
scopeguard::defer,
solana_feature_set::{self as feature_set, enable_bpf_loader_set_authority_checked_ix},
solana_loader_v3_interface::instruction as bpf_loader_upgradeable,
solana_measure::measure::Measure,
solana_program::{
bpf_loader_upgradeable,
syscalls::{
MAX_CPI_ACCOUNT_INFOS, MAX_CPI_INSTRUCTION_ACCOUNTS, MAX_CPI_INSTRUCTION_DATA_LEN,
},
},
solana_program_runtime::invoke_context::SerializedAccountMetadata,
solana_sbpf::{
ebpf,
Expand All @@ -19,6 +14,25 @@ use {
solana_transaction_context::BorrowedAccount,
std::{mem, ptr},
};
// consts inlined to avoid solana-program dep
const MAX_CPI_INSTRUCTION_DATA_LEN: u64 = 10 * 1024;
#[cfg(test)]
static_assertions::const_assert_eq!(
MAX_CPI_INSTRUCTION_DATA_LEN,
solana_program::syscalls::MAX_CPI_INSTRUCTION_DATA_LEN
);
const MAX_CPI_INSTRUCTION_ACCOUNTS: u8 = u8::MAX;
#[cfg(test)]
static_assertions::const_assert_eq!(
MAX_CPI_INSTRUCTION_ACCOUNTS,
solana_program::syscalls::MAX_CPI_INSTRUCTION_ACCOUNTS
);
const MAX_CPI_ACCOUNT_INFOS: usize = 128;
#[cfg(test)]
static_assertions::const_assert_eq!(
MAX_CPI_ACCOUNT_INFOS,
solana_program::syscalls::MAX_CPI_ACCOUNT_INFOS
);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we have an assertion here during tests, I believe the change must be fine. @Lichtso do you have any opinion on this?


fn check_account_info_pointer(
invoke_context: &InvokeContext,
Expand Down Expand Up @@ -1044,7 +1058,7 @@ fn check_authorized_program(
if native_loader::check_id(program_id)
|| bpf_loader::check_id(program_id)
|| bpf_loader_deprecated::check_id(program_id)
|| (bpf_loader_upgradeable::check_id(program_id)
|| (solana_sdk_ids::bpf_loader_upgradeable::check_id(program_id)
&& !(bpf_loader_upgradeable::is_upgrade_instruction(instruction_data)
|| bpf_loader_upgradeable::is_set_authority_instruction(instruction_data)
|| (invoke_context
Expand Down
6 changes: 2 additions & 4 deletions programs/bpf_loader/src/syscalls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ pub use self::{
#[allow(deprecated)]
use {
solana_account_info::AccountInfo,
solana_big_mod_exp::{big_mod_exp, BigModExpParams},
solana_blake3_hasher as blake3,
solana_bn254::prelude::{
alt_bn128_addition, alt_bn128_multiplication, alt_bn128_multiplication_128,
alt_bn128_pairing, AltBn128Error, ALT_BN128_ADDITION_OUTPUT_LEN,
Expand All @@ -38,10 +40,6 @@ use {
solana_log_collector::{ic_logger_msg, ic_msg},
solana_poseidon as poseidon,
solana_precompiles::is_precompile,
solana_program::{
big_mod_exp::{big_mod_exp, BigModExpParams},
blake3,
},
solana_program_entrypoint::{BPF_ALIGN_OF_U128, MAX_PERMITTED_DATA_INCREASE, SUCCESS},
solana_program_memory::is_nonoverlapping,
solana_program_runtime::{invoke_context::InvokeContext, stable_log},
Expand Down
2 changes: 1 addition & 1 deletion programs/loader-v4/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ solana-bpf-loader-program = { workspace = true, features = ["svm-internal"] }
solana-compute-budget = { workspace = true }
solana-instruction = { workspace = true }
solana-loader-v3-interface = { workspace = true }
solana-loader-v4-interface = { workspace = true }
solana-loader-v4-interface = { workspace = true, features = ["serde"] }
solana-log-collector = { workspace = true }
solana-measure = { workspace = true }
solana-packet = { workspace = true }
Expand Down
5 changes: 4 additions & 1 deletion programs/sbf/Cargo.lock

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

5 changes: 4 additions & 1 deletion svm/examples/Cargo.lock

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

Loading