Skip to content

Commit

Permalink
extract big-mod-exp crate
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinheavey committed Jan 16, 2025
1 parent 535b0db commit 8705df5
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 4 deletions.
17 changes: 17 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ solana-banks-client = { path = "banks-client", version = "=2.2.0" }
solana-banks-interface = { path = "banks-interface", version = "=2.2.0" }
solana-banks-server = { path = "banks-server", version = "=2.2.0" }
solana-bench-tps = { path = "bench-tps", version = "=2.2.0" }
solana-big-mod-exp = { path = "sdk/big-mod-exp", version = "=2.2.0" }
solana-bincode = { path = "sdk/bincode", version = "=2.2.0" }
solana-bloom = { path = "bloom", version = "=2.2.0" }
solana-bn254 = { path = "curves/bn254", version = "=2.2.0" }
Expand Down
15 changes: 14 additions & 1 deletion programs/sbf/Cargo.lock

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

34 changes: 34 additions & 0 deletions sdk/big-mod-exp/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[package]
name = "solana-big-mod-exp"
description = "Solana big integer modular exponentiation"
documentation = "https://docs.rs/solana-big-mod-exp"
version = { workspace = true }
authors = { workspace = true }
repository = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
edition = { workspace = true }

[target.'cfg(target_os = "solana")'.dependencies]
solana-define-syscall = { workspace = true }

[target.'cfg(not(target_os = "solana"))'.dependencies]
num-bigint = { workspace = true }
num-traits = { workspace = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { workspace = true, features = ["js", "wasm-bindgen"] }
js-sys = { workspace = true }
wasm-bindgen = { workspace = true }

[dev-dependencies]
array-bytes = { workspace = true }
serde = { workspace = true }
serde_derive = { workspace = true }
serde_json = { workspace = true }

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]

[lints]
workspace = true
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub fn big_mod_exp(base: &[u8], exponent: &[u8], modulus: &[u8]) -> Vec<u8> {
modulus_len: modulus.len() as u64,
};
unsafe {
crate::syscalls::sol_big_mod_exp(
solana_define_syscall::definitions::sol_big_mod_exp(
&param as *const _ as *const u8,
return_value.as_mut_slice() as *mut _ as *mut u8,
)
Expand Down
1 change: 1 addition & 0 deletions sdk/program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ serde_bytes = { workspace = true }
serde_derive = { workspace = true }
solana-account-info = { workspace = true, features = ["bincode"] }
solana-atomic-u64 = { workspace = true }
solana-big-mod-exp = { workspace = true }
solana-bincode = { workspace = true }
solana-borsh = { workspace = true, optional = true }
solana-clock = { workspace = true, features = ["serde", "sysvar"] }
Expand Down
3 changes: 2 additions & 1 deletion sdk/program/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,6 @@
extern crate self as solana_program;

pub mod address_lookup_table;
pub mod big_mod_exp;
pub mod blake3;
pub mod bpf_loader;
pub mod bpf_loader_deprecated;
Expand Down Expand Up @@ -506,6 +505,8 @@ pub mod sysvar;
pub mod vote;
pub mod wasm;

#[deprecated(since = "2.2.0", note = "Use `solana-big-mod-exp` crate instead")]
pub use solana_big_mod_exp as big_mod_exp;
#[cfg(feature = "borsh")]
#[deprecated(since = "2.1.0", note = "Use `solana-borsh` crate instead")]
pub use solana_borsh::deprecated as borsh;
Expand Down
15 changes: 14 additions & 1 deletion svm/examples/Cargo.lock

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

0 comments on commit 8705df5

Please sign in to comment.