Skip to content

Commit

Permalink
extract big-mod-exp crate (#4491)
Browse files Browse the repository at this point in the history
* extract big-mod-exp crate

* remove unused deps

* remove unnecessary doc target

* revert changes to lock file version

* missing workspace members entry

* trigger ci
  • Loading branch information
kevinheavey authored Jan 19, 2025
1 parent 530e77f commit 73650a1
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 2 deletions.
14 changes: 14 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ members = [
"sdk/account-info",
"sdk/address-lookup-table-interface",
"sdk/atomic-u64",
"sdk/big-mod-exp",
"sdk/bincode",
"sdk/borsh",
"sdk/cargo-build-sbf",
Expand Down Expand Up @@ -451,6 +452,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
10 changes: 10 additions & 0 deletions programs/sbf/Cargo.lock

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

29 changes: 29 additions & 0 deletions sdk/big-mod-exp/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[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 }

[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"]

[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 @@ -29,6 +29,7 @@ serde_derive = { workspace = true }
solana-account-info = { workspace = true, features = ["bincode"] }
solana-address-lookup-table-interface = { workspace = true, features = ["bincode", "bytemuck"] }
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
10 changes: 10 additions & 0 deletions 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 73650a1

Please sign in to comment.