diff --git a/Cargo.lock b/Cargo.lock index 37a8bd785cf4b3..5070f5ee307411 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6034,7 +6034,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "solana-program", + "solana-define-syscall", "thiserror", ] diff --git a/curves/bn254/Cargo.toml b/curves/bn254/Cargo.toml index c2cc0fe86764d6..02d5b8c18300e8 100644 --- a/curves/bn254/Cargo.toml +++ b/curves/bn254/Cargo.toml @@ -11,7 +11,7 @@ edition = { workspace = true } [dependencies] bytemuck = { workspace = true, features = ["derive"] } -solana-program = { workspace = true } +solana-define-syscall = { workspace = true } thiserror = { workspace = true } [target.'cfg(not(target_os = "solana"))'.dependencies] diff --git a/curves/bn254/src/compression.rs b/curves/bn254/src/compression.rs index b284772fca01b6..883dd39015b63e 100644 --- a/curves/bn254/src/compression.rs +++ b/curves/bn254/src/compression.rs @@ -194,7 +194,7 @@ mod target_arch { super::*, alt_bn128_compression_size::{G1, G1_COMPRESSED, G2, G2_COMPRESSED}, prelude::*, - solana_program::syscalls, + solana_define_syscall::definitions as syscalls, }; pub fn alt_bn128_g1_compress( diff --git a/curves/bn254/src/lib.rs b/curves/bn254/src/lib.rs index e60417cde6b53d..ff582abab32818 100644 --- a/curves/bn254/src/lib.rs +++ b/curves/bn254/src/lib.rs @@ -305,7 +305,7 @@ mod target_arch { #[cfg(target_os = "solana")] mod target_arch { - use {super::*, solana_program::syscalls}; + use {super::*, solana_define_syscall::definitions as syscalls}; pub fn alt_bn128_addition(input: &[u8]) -> Result, AltBn128Error> { if input.len() > ALT_BN128_ADDITION_INPUT_LEN { diff --git a/define-syscall/src/definitions.rs b/define-syscall/src/definitions.rs new file mode 100644 index 00000000000000..3bd2d31dcbbe32 --- /dev/null +++ b/define-syscall/src/definitions.rs @@ -0,0 +1,25 @@ +//! This module is only for syscall definitions that bring in no extra dependencies. +use crate::define_syscall; + +define_syscall!(fn sol_keccak256(vals: *const u8, val_len: u64, hash_result: *mut u8) -> u64); +define_syscall!(fn sol_blake3(vals: *const u8, val_len: u64, hash_result: *mut u8) -> u64); +define_syscall!(fn sol_curve_validate_point(curve_id: u64, point_addr: *const u8, result: *mut u8) -> u64); +define_syscall!(fn sol_curve_group_op(curve_id: u64, group_op: u64, left_input_addr: *const u8, right_input_addr: *const u8, result_point_addr: *mut u8) -> u64); +define_syscall!(fn sol_curve_multiscalar_mul(curve_id: u64, scalars_addr: *const u8, points_addr: *const u8, points_len: u64, result_point_addr: *mut u8) -> u64); +define_syscall!(fn sol_curve_pairing_map(curve_id: u64, point: *const u8, result: *mut u8) -> u64); +define_syscall!(fn sol_alt_bn128_group_op(group_op: u64, input: *const u8, input_size: u64, result: *mut u8) -> u64); +define_syscall!(fn sol_big_mod_exp(params: *const u8, result: *mut u8) -> u64); +define_syscall!(fn sol_remaining_compute_units() -> u64); +define_syscall!(fn sol_alt_bn128_compression(op: u64, input: *const u8, input_size: u64, result: *mut u8) -> u64); +define_syscall!(fn sol_get_sysvar(sysvar_id_addr: *const u8, result: *mut u8, offset: u64, length: u64) -> u64); +define_syscall!(fn sol_get_epoch_stake(vote_address: *const u8) -> u64); + +// these are to be deprecated once they are superceded by sol_get_sysvar +define_syscall!(fn sol_get_clock_sysvar(addr: *mut u8) -> u64); +define_syscall!(fn sol_get_epoch_schedule_sysvar(addr: *mut u8) -> u64); +define_syscall!(fn sol_get_rent_sysvar(addr: *mut u8) -> u64); +define_syscall!(fn sol_get_last_restart_slot(addr: *mut u8) -> u64); +define_syscall!(fn sol_get_epoch_rewards_sysvar(addr: *mut u8) -> u64); + +// this cannot go through sol_get_sysvar but can be removed once no longer in use +define_syscall!(fn sol_get_fees_sysvar(addr: *mut u8) -> u64); diff --git a/define-syscall/src/lib.rs b/define-syscall/src/lib.rs index 7e94b953bfef4d..119afea0ec7188 100644 --- a/define-syscall/src/lib.rs +++ b/define-syscall/src/lib.rs @@ -1,3 +1,5 @@ +pub mod definitions; + #[cfg(target_feature = "static-syscalls")] #[macro_export] macro_rules! define_syscall { diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index 89d56b13fb096f..e5245ee5b0f478 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -4923,7 +4923,7 @@ dependencies = [ "ark-ff", "ark-serialize", "bytemuck", - "solana-program", + "solana-define-syscall", "thiserror", ] diff --git a/sdk/program/src/syscalls/definitions.rs b/sdk/program/src/syscalls/definitions.rs index 961a0f7ad02189..1eba11116cdd0d 100644 --- a/sdk/program/src/syscalls/definitions.rs +++ b/sdk/program/src/syscalls/definitions.rs @@ -2,7 +2,17 @@ pub use solana_cpi::syscalls::{ sol_get_return_data, sol_invoke_signed_c, sol_invoke_signed_rust, sol_set_return_data, }; -use solana_define_syscall::define_syscall; +#[deprecated( + since = "2.2.0", + note = "Use `solana_define_syscall::definitions` instead" +)] +pub use solana_define_syscall::definitions::{ + sol_alt_bn128_compression, sol_alt_bn128_group_op, sol_big_mod_exp, sol_blake3, + sol_curve_group_op, sol_curve_multiscalar_mul, sol_curve_pairing_map, sol_curve_validate_point, + sol_get_clock_sysvar, sol_get_epoch_rewards_sysvar, sol_get_epoch_schedule_sysvar, + sol_get_epoch_stake, sol_get_fees_sysvar, sol_get_last_restart_slot, sol_get_rent_sysvar, + sol_get_sysvar, sol_keccak256, sol_remaining_compute_units, +}; #[cfg(target_feature = "static-syscalls")] pub use solana_define_syscall::sys_hash; #[deprecated(since = "2.1.0", note = "Use `solana_instruction::syscalls` instead")] @@ -27,25 +37,3 @@ pub use solana_pubkey::syscalls::{ pub use solana_secp256k1_recover::sol_secp256k1_recover; #[deprecated(since = "2.1.0", note = "Use solana_sha256_hasher::sol_sha256 instead")] pub use solana_sha256_hasher::sol_sha256; -define_syscall!(fn sol_keccak256(vals: *const u8, val_len: u64, hash_result: *mut u8) -> u64); -define_syscall!(fn sol_blake3(vals: *const u8, val_len: u64, hash_result: *mut u8) -> u64); -define_syscall!(fn sol_curve_validate_point(curve_id: u64, point_addr: *const u8, result: *mut u8) -> u64); -define_syscall!(fn sol_curve_group_op(curve_id: u64, group_op: u64, left_input_addr: *const u8, right_input_addr: *const u8, result_point_addr: *mut u8) -> u64); -define_syscall!(fn sol_curve_multiscalar_mul(curve_id: u64, scalars_addr: *const u8, points_addr: *const u8, points_len: u64, result_point_addr: *mut u8) -> u64); -define_syscall!(fn sol_curve_pairing_map(curve_id: u64, point: *const u8, result: *mut u8) -> u64); -define_syscall!(fn sol_alt_bn128_group_op(group_op: u64, input: *const u8, input_size: u64, result: *mut u8) -> u64); -define_syscall!(fn sol_big_mod_exp(params: *const u8, result: *mut u8) -> u64); -define_syscall!(fn sol_remaining_compute_units() -> u64); -define_syscall!(fn sol_alt_bn128_compression(op: u64, input: *const u8, input_size: u64, result: *mut u8) -> u64); -define_syscall!(fn sol_get_sysvar(sysvar_id_addr: *const u8, result: *mut u8, offset: u64, length: u64) -> u64); -define_syscall!(fn sol_get_epoch_stake(vote_address: *const u8) -> u64); - -// these are to be deprecated once they are superceded by sol_get_sysvar -define_syscall!(fn sol_get_clock_sysvar(addr: *mut u8) -> u64); -define_syscall!(fn sol_get_epoch_schedule_sysvar(addr: *mut u8) -> u64); -define_syscall!(fn sol_get_rent_sysvar(addr: *mut u8) -> u64); -define_syscall!(fn sol_get_last_restart_slot(addr: *mut u8) -> u64); -define_syscall!(fn sol_get_epoch_rewards_sysvar(addr: *mut u8) -> u64); - -// this cannot go through sol_get_sysvar but can be removed once no longer in use -define_syscall!(fn sol_get_fees_sysvar(addr: *mut u8) -> u64);