From ba27b9cfe648aa80a36fdc14381d41d64d16748e Mon Sep 17 00:00:00 2001 From: Louis Pahlavi Date: Wed, 2 Apr 2025 11:51:54 +0200 Subject: [PATCH 01/10] build: Add 'js' Cargo feature flag for WASM builds Previously, the wasm32 target implicitly assumed a browser environment, which caused issues when building for non-browser WASM environments due to the unconditional inclusion of `wasm-bindgen`. This commit introduces an explicit 'js' feature flag, making `wasm-bindgen` and `js-sys` conditional dependencies. This allows greater flexibility for different WASM execution environments. Related to #117 --- hash/Cargo.toml | 3 +++ hash/src/lib.rs | 6 +++--- instruction/Cargo.toml | 9 ++++----- instruction/src/lib.rs | 6 +++--- keypair/Cargo.toml | 5 ++--- keypair/src/lib.rs | 6 +++--- message/Cargo.toml | 5 ++--- message/src/legacy.rs | 6 +++--- program/Cargo.toml | 3 +++ program/src/lib.rs | 2 +- program/src/wasm/mod.rs | 2 +- pubkey/Cargo.toml | 9 ++++----- pubkey/src/lib.rs | 10 +++++----- sdk/Cargo.toml | 13 +++++++------ sdk/src/lib.rs | 2 +- sdk/src/wasm/mod.rs | 2 +- transaction/Cargo.toml | 7 +++---- transaction/src/lib.rs | 6 +++--- transaction/src/wasm.rs | 2 +- 19 files changed, 53 insertions(+), 51 deletions(-) diff --git a/hash/Cargo.toml b/hash/Cargo.toml index d9fcb208c..6a2375606 100644 --- a/hash/Cargo.toml +++ b/hash/Cargo.toml @@ -20,6 +20,7 @@ bs58 = { workspace = true, default-features = false } bytemuck = { workspace = true, optional = true } bytemuck_derive = { workspace = true, optional = true } serde = { workspace = true, optional = true } +js-sys = { workspace = true, optional = true } serde_derive = { workspace = true, optional = true } solana-atomic-u64 = { workspace = true } solana-frozen-abi = { workspace = true, optional = true, features = [ @@ -29,6 +30,7 @@ solana-frozen-abi-macro = { workspace = true, optional = true, features = [ "frozen-abi", ] } solana-sanitize = { workspace = true } +wasm-bindgen = { workspace = true, optional = true } [dev-dependencies] solana-hash = { path = ".", features = ["dev-context-only-utils"] } @@ -47,6 +49,7 @@ frozen-abi = [ "dep:solana-frozen-abi-macro", "std" ] +js = ["dep:wasm-bindgen", "dep:js-sys"] serde = ["dep:serde", "dep:serde_derive"] std = [] diff --git a/hash/src/lib.rs b/hash/src/lib.rs index 46bc7dcc4..5d549a712 100644 --- a/hash/src/lib.rs +++ b/hash/src/lib.rs @@ -19,7 +19,7 @@ use { }, solana_sanitize::Sanitize, }; -#[cfg(target_arch = "wasm32")] +#[cfg(feature = "js")] use { js_sys::{Array, Uint8Array}, std::{boxed::Box, format, string::String, vec}, @@ -38,7 +38,7 @@ pub const MAX_BASE58_LEN: usize = 44; /// /// [SHA-256]: https://en.wikipedia.org/wiki/SHA-2 /// [blake3]: https://github.com/BLAKE3-team/BLAKE3 -#[cfg_attr(target_arch = "wasm32", wasm_bindgen)] +#[cfg_attr(feature = "js", wasm_bindgen)] #[cfg_attr(feature = "frozen-abi", derive(solana_frozen_abi_macro::AbiExample))] #[cfg_attr( feature = "borsh", @@ -151,7 +151,7 @@ impl Hash { } } -#[cfg(target_arch = "wasm32")] +#[cfg(feature = "js")] #[allow(non_snake_case)] #[wasm_bindgen] impl Hash { diff --git a/instruction/Cargo.toml b/instruction/Cargo.toml index dcf12d638..dce3e21f1 100644 --- a/instruction/Cargo.toml +++ b/instruction/Cargo.toml @@ -12,21 +12,19 @@ edition = { workspace = true } [dependencies] bincode = { workspace = true, optional = true } borsh = { workspace = true, optional = true } +getrandom = { workspace = true, optional = true, features = ["js", "wasm-bindgen"] } +js-sys = { workspace = true, optional = true } num-traits = { workspace = true } serde = { workspace = true, optional = true } serde_derive = { workspace = true, optional = true } solana-frozen-abi = { workspace = true, optional = true } solana-frozen-abi-macro = { workspace = true, optional = true } solana-pubkey = { workspace = true, default-features = false } +wasm-bindgen = { workspace = true, optional = true } [target.'cfg(target_os = "solana")'.dependencies] solana-define-syscall = { 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] solana-instruction = { path = ".", features = ["borsh"] } @@ -40,6 +38,7 @@ frozen-abi = [ "serde", "std", ] +js = ["dep:getrandom", "dep:wasm-bindgen", "dep:js-sys"] serde = [ "dep:serde", "dep:serde_derive", diff --git a/instruction/src/lib.rs b/instruction/src/lib.rs index 673d379c7..e9a894949 100644 --- a/instruction/src/lib.rs +++ b/instruction/src/lib.rs @@ -26,7 +26,7 @@ pub use account_meta::AccountMeta; pub mod error; #[cfg(target_os = "solana")] pub mod syscalls; -#[cfg(all(feature = "std", target_arch = "wasm32"))] +#[cfg(all(feature = "std", feature = "js"))] pub mod wasm; /// A directive for a single invocation of a Solana program. @@ -88,7 +88,7 @@ pub mod wasm; /// Programs may require signatures from some accounts, in which case they /// should be specified as signers during `Instruction` construction. The /// program must still validate during execution that the account is a signer. -#[cfg(all(feature = "std", not(target_arch = "wasm32")))] +#[cfg(all(feature = "std", not(feature = "js")))] #[cfg_attr( feature = "serde", derive(serde_derive::Serialize, serde_derive::Deserialize) @@ -106,7 +106,7 @@ pub struct Instruction { /// wasm-bindgen version of the Instruction struct. /// This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671 /// is fixed. This must not diverge from the regular non-wasm Instruction struct. -#[cfg(all(feature = "std", target_arch = "wasm32"))] +#[cfg(all(feature = "std", feature = "js"))] #[wasm_bindgen::prelude::wasm_bindgen] #[cfg_attr( feature = "serde", diff --git a/keypair/Cargo.toml b/keypair/Cargo.toml index ea754d842..7f2d79158 100644 --- a/keypair/Cargo.toml +++ b/keypair/Cargo.toml @@ -20,9 +20,7 @@ solana-seed-derivable = { workspace = true, optional = true } solana-seed-phrase = { workspace = true } solana-signature = { workspace = true, features = ["std", "verify"] } solana-signer = { workspace = true } - -[target.'cfg(target_arch = "wasm32")'.dependencies] -wasm-bindgen = { workspace = true } +wasm-bindgen = { workspace = true, optional = true } [dev-dependencies] serde_json = { workspace = true } @@ -30,6 +28,7 @@ static_assertions = { workspace = true } tiny-bip39 = { workspace = true } [features] +js = ["dep:wasm-bindgen"] seed-derivable = ["dep:solana-derivation-path", "dep:solana-seed-derivable", "dep:ed25519-dalek-bip32"] [package.metadata.docs.rs] diff --git a/keypair/src/lib.rs b/keypair/src/lib.rs index 58659881e..6af76b790 100644 --- a/keypair/src/lib.rs +++ b/keypair/src/lib.rs @@ -1,6 +1,6 @@ //! Concrete implementation of a Solana `Signer` from raw bytes #![cfg_attr(docsrs, feature(doc_auto_cfg))] -#[cfg(target_arch = "wasm32")] +#[cfg(feature = "js")] use wasm_bindgen::prelude::*; use { ed25519_dalek::Signer as DalekSigner, @@ -21,7 +21,7 @@ pub mod seed_derivable; pub mod signable; /// A vanilla Ed25519 key pair -#[cfg_attr(target_arch = "wasm32", wasm_bindgen)] +#[cfg_attr(feature = "js", wasm_bindgen)] #[derive(Debug)] pub struct Keypair(ed25519_dalek::Keypair); @@ -119,7 +119,7 @@ impl TryFrom<&[u8]> for Keypair { } } -#[cfg(target_arch = "wasm32")] +#[cfg(feature = "js")] #[allow(non_snake_case)] #[wasm_bindgen] impl Keypair { diff --git a/message/Cargo.toml b/message/Cargo.toml index 38836507e..c34fbdaa3 100644 --- a/message/Cargo.toml +++ b/message/Cargo.toml @@ -29,9 +29,7 @@ solana-system-interface = { workspace = true, optional = true, features = [ "bincode", ] } solana-transaction-error = { workspace = true } - -[target.'cfg(target_arch = "wasm32")'.dependencies] -wasm-bindgen = { workspace = true } +wasm-bindgen = { workspace = true, optional = true } [dev-dependencies] anyhow = { workspace = true } @@ -62,6 +60,7 @@ frozen-abi = [ "solana-hash/frozen-abi", "solana-pubkey/frozen-abi", ] +js = ["dep:wasm-bindgen"] serde = [ "dep:serde", "dep:serde_derive", diff --git a/message/src/legacy.rs b/message/src/legacy.rs index 1c467e9b7..5dd084d3f 100644 --- a/message/src/legacy.rs +++ b/message/src/legacy.rs @@ -17,7 +17,7 @@ pub use builtins::{BUILTIN_PROGRAMS_KEYS, MAYBE_BUILTIN_KEY_OR_SYSVAR}; use serde_derive::{Deserialize, Serialize}; #[cfg(feature = "frozen-abi")] use solana_frozen_abi_macro::{frozen_abi, AbiExample}; -#[cfg(target_arch = "wasm32")] +#[cfg(feature = "js")] use wasm_bindgen::prelude::wasm_bindgen; use { crate::{ @@ -146,7 +146,7 @@ fn compile_instructions(ixs: &[Instruction], keys: &[Pubkey]) -> Vec for PubkeyError { /// [ed25519]: https://ed25519.cr.yp.to/ /// [pdas]: https://solana.com/docs/core/cpi#program-derived-addresses /// [`Keypair`]: https://docs.rs/solana-sdk/latest/solana_sdk/signer/keypair/struct.Keypair.html -#[cfg_attr(target_arch = "wasm32", wasm_bindgen)] +#[cfg_attr(feature = "js", wasm_bindgen)] #[repr(transparent)] #[cfg_attr(feature = "frozen-abi", derive(solana_frozen_abi_macro::AbiExample))] #[cfg_attr( @@ -1079,7 +1079,7 @@ macro_rules! impl_borsh_serialize { #[cfg(feature = "borsh")] impl_borsh_serialize!(borsh0_10); -#[cfg(all(target_arch = "wasm32", feature = "curve25519"))] +#[cfg(all(feature = "js", feature = "curve25519"))] fn js_value_to_seeds_vec(array_of_uint8_arrays: &[JsValue]) -> Result>, JsValue> { let vec_vec_u8 = array_of_uint8_arrays .iter() @@ -1097,12 +1097,12 @@ fn js_value_to_seeds_vec(array_of_uint8_arrays: &[JsValue]) -> Result(display: T) -> JsValue { std::string::ToString::to_string(&display).into() } -#[allow(non_snake_case)] +#[cfg(feature = "js")] #[cfg(target_arch = "wasm32")] #[wasm_bindgen] impl Pubkey { diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index c28c11458..02db7167f 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -19,7 +19,7 @@ program = [] default = [ "borsh", - "full", # functionality that is not compatible or needed for on-chain programs + "full", # functionality that is not compatible or needed for on-chain programs ] full = [ "serde_json", @@ -85,6 +85,8 @@ openssl-vendored = ["solana-precompiles/openssl-vendored"] [dependencies] bincode = { workspace = true } bs58 = { workspace = true } +getrandom = { version = "0.1.1", optional = true, features = ["wasm-bindgen"] } +js-sys = { workspace = true, optional = true } serde = { workspace = true } serde_json = { workspace = true, optional = true } solana-account = { workspace = true, features = ["bincode"] } @@ -173,11 +175,7 @@ solana-transaction-error = { workspace = true, features = [ ], optional = true } solana-validator-exit = { workspace = true } thiserror = { workspace = true } - -[target.'cfg(target_arch = "wasm32")'.dependencies] -getrandom = { version = "0.1.1", features = ["wasm-bindgen"] } -js-sys = { workspace = true } -wasm-bindgen = { workspace = true } +wasm-bindgen = { workspace = true, optional = true } [dev-dependencies] curve25519-dalek = { workspace = true } @@ -191,6 +189,9 @@ solana-instructions-sysvar = { workspace = true, features = ["dev-context-only-u solana-program = { workspace = true, features = ["dev-context-only-utils"] } solana-sdk = { path = ".", features = ["dev-context-only-utils"] } +[feature] +js = ["dep:getrandom", "dep:wasm-bindgen", "dep:js-sys"] + [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"] all-features = true diff --git a/sdk/src/lib.rs b/sdk/src/lib.rs index 65bc41fd4..6ce7bb01a 100644 --- a/sdk/src/lib.rs +++ b/sdk/src/lib.rs @@ -42,7 +42,7 @@ pub use solana_program::program_stubs; // confusing duplication in the docs due to a rustdoc bug. #26211 #[allow(deprecated)] pub use solana_program::sdk_ids; -#[cfg(target_arch = "wasm32")] +#[cfg(feature = "js")] pub use solana_program::wasm_bindgen; pub use solana_program::{ account_info, address_lookup_table, big_mod_exp, blake3, bpf_loader, bpf_loader_deprecated, diff --git a/sdk/src/wasm/mod.rs b/sdk/src/wasm/mod.rs index 6946e730f..cd009b766 100644 --- a/sdk/src/wasm/mod.rs +++ b/sdk/src/wasm/mod.rs @@ -1,5 +1,5 @@ //! solana-sdk Javascript interface -#![cfg(target_arch = "wasm32")] +#![cfg(feature = "js")] pub mod keypair; pub mod transaction; diff --git a/transaction/Cargo.toml b/transaction/Cargo.toml index 1c92148e6..7d9a6fa44 100644 --- a/transaction/Cargo.toml +++ b/transaction/Cargo.toml @@ -19,6 +19,7 @@ solana-frozen-abi = { workspace = true, optional = true } solana-frozen-abi-macro = { workspace = true, optional = true } solana-hash = { workspace = true } solana-instruction = { workspace = true } +solana-keypair = { workspace = true, optional = true } solana-logger = { workspace = true, optional = true } solana-message = { workspace = true } solana-precompiles = { workspace = true, optional = true } @@ -30,10 +31,7 @@ solana-signature = { workspace = true } solana-signer = { workspace = true, optional = true } solana-system-interface = { workspace = true, optional = true, features = ["bincode"] } solana-transaction-error = { workspace = true } - -[target.'cfg(target_arch = "wasm32")'.dependencies] -solana-keypair = { workspace = true } -wasm-bindgen = { workspace = true } +wasm-bindgen = { workspace = true, optional = true } [dev-dependencies] anyhow = { workspace = true } @@ -71,6 +69,7 @@ frozen-abi = [ "dep:solana-frozen-abi-macro", "dep:solana-logger", ] +js = ["dep:wasm-bindgen", "dep:solana-keypair"] precompiles = ["dep:solana-feature-set", "dep:solana-precompiles"] serde = [ "dep:serde", diff --git a/transaction/src/lib.rs b/transaction/src/lib.rs index 18baaf8b5..834566415 100644 --- a/transaction/src/lib.rs +++ b/transaction/src/lib.rs @@ -110,7 +110,7 @@ //! # Ok::<(), anyhow::Error>(()) //! ``` -#[cfg(target_arch = "wasm32")] +#[cfg(feature = "js")] use wasm_bindgen::prelude::wasm_bindgen; #[cfg(feature = "serde")] use { @@ -182,7 +182,7 @@ const PACKET_DATA_SIZE: usize = 1280 - 40 - 8; /// if the caller has knowledge that the first account of the constructed /// transaction's `Message` is both a signer and the expected fee-payer, then /// redundantly specifying the fee-payer is not strictly required. -#[cfg(not(target_arch = "wasm32"))] +#[cfg(not(feature = "js"))] #[cfg_attr( feature = "frozen-abi", derive(solana_frozen_abi_macro::AbiExample), @@ -210,7 +210,7 @@ pub struct Transaction { /// wasm-bindgen version of the Transaction struct. /// This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671 /// is fixed. This must not diverge from the regular non-wasm Transaction struct. -#[cfg(target_arch = "wasm32")] +#[cfg(feature = "js")] #[wasm_bindgen] #[cfg_attr( feature = "frozen-abi", diff --git a/transaction/src/wasm.rs b/transaction/src/wasm.rs index cdfc5792b..1c1f6d844 100644 --- a/transaction/src/wasm.rs +++ b/transaction/src/wasm.rs @@ -1,5 +1,5 @@ //! `Transaction` Javascript interface -#![cfg(target_arch = "wasm32")] +#![cfg(feature = "js")] #![allow(non_snake_case)] use { crate::Transaction, solana_hash::Hash, solana_instruction::wasm::Instructions, From feb600d463db73f8391c25aadf876def8124f32e Mon Sep 17 00:00:00 2001 From: Louis Pahlavi Date: Fri, 4 Apr 2025 11:47:09 +0200 Subject: [PATCH 02/10] Order features alphabetically --- sdk/Cargo.toml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index 02db7167f..990aed5d5 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -15,6 +15,7 @@ include = ["src/**/*", "README.md"] # "program" feature is a legacy feature retained to support v1.3 and older # programs. New development should not use this feature. Instead use the # solana-program crate +js = ["dep:getrandom", "dep:wasm-bindgen", "dep:js-sys"] program = [] default = [ @@ -189,9 +190,6 @@ solana-instructions-sysvar = { workspace = true, features = ["dev-context-only-u solana-program = { workspace = true, features = ["dev-context-only-utils"] } solana-sdk = { path = ".", features = ["dev-context-only-utils"] } -[feature] -js = ["dep:getrandom", "dep:wasm-bindgen", "dep:js-sys"] - [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"] all-features = true From fd92fd93ab5d07d7ab46f4a08f32aecb2d4b1699 Mon Sep 17 00:00:00 2001 From: Louis Pahlavi Date: Fri, 4 Apr 2025 11:47:47 +0200 Subject: [PATCH 03/10] Fix deleted #[allow(non_snake_case)] --- pubkey/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubkey/src/lib.rs b/pubkey/src/lib.rs index 4dbef8d72..bb09a8ade 100644 --- a/pubkey/src/lib.rs +++ b/pubkey/src/lib.rs @@ -1103,7 +1103,7 @@ fn display_to_jsvalue(display: T) -> JsValue { } #[cfg(feature = "js")] -#[cfg(target_arch = "wasm32")] +#[allow(non_snake_case)] #[wasm_bindgen] impl Pubkey { /// Create a new Pubkey object From db2b4094a0446c0e0117ab2919245532919ff900 Mon Sep 17 00:00:00 2001 From: Louis Pahlavi Date: Fri, 4 Apr 2025 15:06:10 +0200 Subject: [PATCH 04/10] Gate js feature dependencies with wasm32 target_arch --- hash/Cargo.toml | 6 ++---- instruction/Cargo.toml | 8 +++++--- keypair/Cargo.toml | 2 ++ message/Cargo.toml | 2 ++ program/Cargo.toml | 6 ++---- pubkey/Cargo.toml | 8 +++++--- sdk/Cargo.toml | 6 ++++-- transaction/Cargo.toml | 4 +++- 8 files changed, 25 insertions(+), 17 deletions(-) diff --git a/hash/Cargo.toml b/hash/Cargo.toml index 6a2375606..df1068740 100644 --- a/hash/Cargo.toml +++ b/hash/Cargo.toml @@ -20,7 +20,6 @@ bs58 = { workspace = true, default-features = false } bytemuck = { workspace = true, optional = true } bytemuck_derive = { workspace = true, optional = true } serde = { workspace = true, optional = true } -js-sys = { workspace = true, optional = true } serde_derive = { workspace = true, optional = true } solana-atomic-u64 = { workspace = true } solana-frozen-abi = { workspace = true, optional = true, features = [ @@ -30,14 +29,13 @@ solana-frozen-abi-macro = { workspace = true, optional = true, features = [ "frozen-abi", ] } solana-sanitize = { workspace = true } -wasm-bindgen = { workspace = true, optional = true } [dev-dependencies] solana-hash = { path = ".", features = ["dev-context-only-utils"] } [target.'cfg(target_arch = "wasm32")'.dependencies] -js-sys = { workspace = true } -wasm-bindgen = { workspace = true } +js-sys = { workspace = true, optional = true } +wasm-bindgen = { workspace = true, optional = true } [features] borsh = ["dep:borsh", "std"] diff --git a/instruction/Cargo.toml b/instruction/Cargo.toml index dce3e21f1..2b4daf491 100644 --- a/instruction/Cargo.toml +++ b/instruction/Cargo.toml @@ -12,19 +12,21 @@ edition = { workspace = true } [dependencies] bincode = { workspace = true, optional = true } borsh = { workspace = true, optional = true } -getrandom = { workspace = true, optional = true, features = ["js", "wasm-bindgen"] } -js-sys = { workspace = true, optional = true } num-traits = { workspace = true } serde = { workspace = true, optional = true } serde_derive = { workspace = true, optional = true } solana-frozen-abi = { workspace = true, optional = true } solana-frozen-abi-macro = { workspace = true, optional = true } solana-pubkey = { workspace = true, default-features = false } -wasm-bindgen = { workspace = true, optional = true } [target.'cfg(target_os = "solana")'.dependencies] solana-define-syscall = { workspace = true } +[target.'cfg(target_arch = "wasm32")'.dependencies] +getrandom = { workspace = true, optional = true, features = ["js", "wasm-bindgen"] } +js-sys = { workspace = true, optional = true } +wasm-bindgen = { workspace = true, optional = true } + [dev-dependencies] solana-instruction = { path = ".", features = ["borsh"] } diff --git a/keypair/Cargo.toml b/keypair/Cargo.toml index 7f2d79158..624038eed 100644 --- a/keypair/Cargo.toml +++ b/keypair/Cargo.toml @@ -20,6 +20,8 @@ solana-seed-derivable = { workspace = true, optional = true } solana-seed-phrase = { workspace = true } solana-signature = { workspace = true, features = ["std", "verify"] } solana-signer = { workspace = true } + +[target.'cfg(target_arch = "wasm32")'.dependencies] wasm-bindgen = { workspace = true, optional = true } [dev-dependencies] diff --git a/message/Cargo.toml b/message/Cargo.toml index c34fbdaa3..529422cc6 100644 --- a/message/Cargo.toml +++ b/message/Cargo.toml @@ -29,6 +29,8 @@ solana-system-interface = { workspace = true, optional = true, features = [ "bincode", ] } solana-transaction-error = { workspace = true } + +[target.'cfg(target_arch = "wasm32")'.dependencies] wasm-bindgen = { workspace = true, optional = true } [dev-dependencies] diff --git a/program/Cargo.toml b/program/Cargo.toml index a4e1ec4a5..a005f3163 100644 --- a/program/Cargo.toml +++ b/program/Cargo.toml @@ -19,7 +19,6 @@ borsh = { workspace = true, optional = true } borsh0-10 = { workspace = true, optional = true } bs58 = { workspace = true, features = ["alloc"] } bytemuck = { workspace = true } -getrandom = { workspace = true, optional = true, features = ["js", "wasm-bindgen"] } lazy_static = { workspace = true } log = { workspace = true } memoffset = { workspace = true } @@ -88,7 +87,6 @@ solana-sysvar = { workspace = true, features = ["bincode", "bytemuck"] } solana-sysvar-id = { workspace = true } solana-vote-interface = { workspace = true, features = ["bincode"] } thiserror = { workspace = true } -wasm-bindgen = { workspace = true, optional = true } # This is currently needed to build on-chain programs reliably. # Borsh 0.10 may pull in hashbrown 0.13, which uses ahash 0.8, which uses @@ -112,8 +110,8 @@ solana-logger = { workspace = true } [target.'cfg(target_arch = "wasm32")'.dependencies] console_error_panic_hook = { workspace = true } console_log = { workspace = true } -getrandom = { workspace = true, features = ["js", "wasm-bindgen"] } -wasm-bindgen = { workspace = true } +getrandom = { workspace = true, optional = true, features = ["js", "wasm-bindgen"] } +wasm-bindgen = { workspace = true, optional = true } [dev-dependencies] array-bytes = { workspace = true } diff --git a/pubkey/Cargo.toml b/pubkey/Cargo.toml index d602014dc..b6d7f357b 100644 --- a/pubkey/Cargo.toml +++ b/pubkey/Cargo.toml @@ -18,8 +18,6 @@ bytemuck = { workspace = true, optional = true } bytemuck_derive = { workspace = true, optional = true } five8_const = { workspace = true } num-traits = { workspace = true } -getrandom = { workspace = true, optional = true, features = ["js", "wasm-bindgen"] } -js-sys = { workspace = true, optional = true } rand = { workspace = true, optional = true } serde = { workspace = true, optional = true } serde_derive = { workspace = true, optional = true } @@ -32,7 +30,6 @@ solana-frozen-abi-macro = { workspace = true, optional = true, features = [ "frozen-abi", ] } solana-sanitize = { workspace = true } -wasm-bindgen = { workspace = true, optional = true } [target.'cfg(target_os = "solana")'.dependencies] solana-define-syscall = { workspace = true } @@ -42,6 +39,11 @@ solana-sha256-hasher = { workspace = true } curve25519-dalek = { workspace = true, optional = true } solana-sha256-hasher = { workspace = true, optional = true } +[target.'cfg(target_arch = "wasm32")'.dependencies] +getrandom = { workspace = true, optional = true, features = ["js", "wasm-bindgen"] } +js-sys = { workspace = true, optional = true } +wasm-bindgen = { workspace = true, optional = true } + [dev-dependencies] anyhow = { workspace = true } arbitrary = { workspace = true, features = ["derive"] } diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index 990aed5d5..460bab4cd 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -86,8 +86,6 @@ openssl-vendored = ["solana-precompiles/openssl-vendored"] [dependencies] bincode = { workspace = true } bs58 = { workspace = true } -getrandom = { version = "0.1.1", optional = true, features = ["wasm-bindgen"] } -js-sys = { workspace = true, optional = true } serde = { workspace = true } serde_json = { workspace = true, optional = true } solana-account = { workspace = true, features = ["bincode"] } @@ -176,6 +174,10 @@ solana-transaction-error = { workspace = true, features = [ ], optional = true } solana-validator-exit = { workspace = true } thiserror = { workspace = true } + +[target.'cfg(target_arch = "wasm32")'.dependencies] +getrandom = { version = "0.1.1", optional = true, features = ["wasm-bindgen"] } +js-sys = { workspace = true, optional = true } wasm-bindgen = { workspace = true, optional = true } [dev-dependencies] diff --git a/transaction/Cargo.toml b/transaction/Cargo.toml index 7d9a6fa44..8ba5a9832 100644 --- a/transaction/Cargo.toml +++ b/transaction/Cargo.toml @@ -19,7 +19,6 @@ solana-frozen-abi = { workspace = true, optional = true } solana-frozen-abi-macro = { workspace = true, optional = true } solana-hash = { workspace = true } solana-instruction = { workspace = true } -solana-keypair = { workspace = true, optional = true } solana-logger = { workspace = true, optional = true } solana-message = { workspace = true } solana-precompiles = { workspace = true, optional = true } @@ -31,6 +30,9 @@ solana-signature = { workspace = true } solana-signer = { workspace = true, optional = true } solana-system-interface = { workspace = true, optional = true, features = ["bincode"] } solana-transaction-error = { workspace = true } + +[target.'cfg(target_arch = "wasm32")'.dependencies] +solana-keypair = { workspace = true, optional = true } wasm-bindgen = { workspace = true, optional = true } [dev-dependencies] From 7eafb82ea4d94a3716a9bf2cfde5dd60e388486e Mon Sep 17 00:00:00 2001 From: Louis Pahlavi Date: Fri, 4 Apr 2025 15:46:59 +0200 Subject: [PATCH 05/10] Simplify std gated imports --- hash/src/lib.rs | 4 ++-- pubkey/src/lib.rs | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/hash/src/lib.rs b/hash/src/lib.rs index 5d549a712..6991bb640 100644 --- a/hash/src/lib.rs +++ b/hash/src/lib.rs @@ -3,13 +3,13 @@ #![cfg_attr(feature = "frozen-abi", feature(min_specialization))] #[cfg(feature = "borsh")] use borsh::{BorshDeserialize, BorshSchema, BorshSerialize}; -#[cfg(any(feature = "std", target_arch = "wasm32"))] +#[cfg(any(feature = "std"))] extern crate std; #[cfg(feature = "bytemuck")] use bytemuck_derive::{Pod, Zeroable}; #[cfg(feature = "serde")] use serde_derive::{Deserialize, Serialize}; -#[cfg(any(all(feature = "borsh", feature = "std"), target_arch = "wasm32"))] +#[cfg(any(all(feature = "borsh", feature = "std", feature = "js")))] use std::string::ToString; use { core::{ diff --git a/pubkey/src/lib.rs b/pubkey/src/lib.rs index bb09a8ade..57b50cfb3 100644 --- a/pubkey/src/lib.rs +++ b/pubkey/src/lib.rs @@ -4,7 +4,7 @@ #![cfg_attr(feature = "frozen-abi", feature(min_specialization))] #![allow(clippy::arithmetic_side_effects)] -#[cfg(any(feature = "std", target_arch = "wasm32"))] +#[cfg(any(feature = "std"))] extern crate std; #[cfg(feature = "dev-context-only-utils")] use arbitrary::Arbitrary; @@ -12,7 +12,7 @@ use arbitrary::Arbitrary; use bytemuck_derive::{Pod, Zeroable}; #[cfg(feature = "serde")] use serde_derive::{Deserialize, Serialize}; -#[cfg(any(feature = "std", target_arch = "wasm32"))] +#[cfg(any(feature = "std"))] use std::vec::Vec; #[cfg(feature = "borsh")] use { @@ -426,7 +426,7 @@ impl TryFrom<&[u8]> for Pubkey { } } -#[cfg(any(feature = "std", target_arch = "wasm32"))] +#[cfg(any(feature = "std"))] impl TryFrom> for Pubkey { type Error = Vec; @@ -480,16 +480,16 @@ impl Pubkey { type T = u32; const COUNTER_BYTES: usize = size_of::(); let mut b = [0u8; PUBKEY_BYTES]; - #[cfg(any(feature = "std", target_arch = "wasm32"))] + #[cfg(any(feature = "std"))] let mut i = I.fetch_add(1) as T; - #[cfg(not(any(feature = "std", target_arch = "wasm32")))] + #[cfg(not(any(feature = "std")))] let i = I.fetch_add(1) as T; // use big endian representation to ensure that recent unique pubkeys // are always greater than less recent unique pubkeys. b[0..COUNTER_BYTES].copy_from_slice(&i.to_be_bytes()); // fill the rest of the pubkey with pseudorandom numbers to make // data statistically similar to real pubkeys. - #[cfg(any(feature = "std", target_arch = "wasm32"))] + #[cfg(any(feature = "std"))] { let mut hash = std::hash::DefaultHasher::new(); for slice in b[COUNTER_BYTES..].chunks_mut(COUNTER_BYTES) { @@ -500,7 +500,7 @@ impl Pubkey { } // if std is not available, just replicate last byte of the counter. // this is not as good as a proper hash, but at least it is uniform - #[cfg(not(any(feature = "std", target_arch = "wasm32")))] + #[cfg(not(any(feature = "std")))] { for b in b[COUNTER_BYTES..].iter_mut() { *b = (i & 0xFF) as u8; @@ -1079,7 +1079,7 @@ macro_rules! impl_borsh_serialize { #[cfg(feature = "borsh")] impl_borsh_serialize!(borsh0_10); -#[cfg(all(feature = "js", feature = "curve25519"))] +#[cfg(all(feature = "js", feature = "std", feature = "curve25519"))] fn js_value_to_seeds_vec(array_of_uint8_arrays: &[JsValue]) -> Result>, JsValue> { let vec_vec_u8 = array_of_uint8_arrays .iter() @@ -1097,12 +1097,12 @@ fn js_value_to_seeds_vec(array_of_uint8_arrays: &[JsValue]) -> Result(display: T) -> JsValue { std::string::ToString::to_string(&display).into() } -#[cfg(feature = "js")] +#[cfg(all(feature = "js", feature = "std"))] #[allow(non_snake_case)] #[wasm_bindgen] impl Pubkey { From b15c25c07a29ed07ce16125153169c9b71dae6be Mon Sep 17 00:00:00 2001 From: Louis Pahlavi Date: Mon, 7 Apr 2025 15:24:51 +0200 Subject: [PATCH 06/10] Remove unnecessary 'any' --- hash/src/lib.rs | 4 ++-- pubkey/src/lib.rs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hash/src/lib.rs b/hash/src/lib.rs index 6991bb640..85404df9a 100644 --- a/hash/src/lib.rs +++ b/hash/src/lib.rs @@ -3,13 +3,13 @@ #![cfg_attr(feature = "frozen-abi", feature(min_specialization))] #[cfg(feature = "borsh")] use borsh::{BorshDeserialize, BorshSchema, BorshSerialize}; -#[cfg(any(feature = "std"))] +#[cfg(feature = "std")] extern crate std; #[cfg(feature = "bytemuck")] use bytemuck_derive::{Pod, Zeroable}; #[cfg(feature = "serde")] use serde_derive::{Deserialize, Serialize}; -#[cfg(any(all(feature = "borsh", feature = "std", feature = "js")))] +#[cfg(all(feature = "borsh", feature = "std", feature = "js"))] use std::string::ToString; use { core::{ diff --git a/pubkey/src/lib.rs b/pubkey/src/lib.rs index 57b50cfb3..0b98a6c73 100644 --- a/pubkey/src/lib.rs +++ b/pubkey/src/lib.rs @@ -4,7 +4,7 @@ #![cfg_attr(feature = "frozen-abi", feature(min_specialization))] #![allow(clippy::arithmetic_side_effects)] -#[cfg(any(feature = "std"))] +#[cfg(feature = "std")] extern crate std; #[cfg(feature = "dev-context-only-utils")] use arbitrary::Arbitrary; @@ -12,7 +12,7 @@ use arbitrary::Arbitrary; use bytemuck_derive::{Pod, Zeroable}; #[cfg(feature = "serde")] use serde_derive::{Deserialize, Serialize}; -#[cfg(any(feature = "std"))] +#[cfg(feature = "std")] use std::vec::Vec; #[cfg(feature = "borsh")] use { @@ -426,7 +426,7 @@ impl TryFrom<&[u8]> for Pubkey { } } -#[cfg(any(feature = "std"))] +#[cfg(feature = "std")] impl TryFrom> for Pubkey { type Error = Vec; @@ -480,7 +480,7 @@ impl Pubkey { type T = u32; const COUNTER_BYTES: usize = size_of::(); let mut b = [0u8; PUBKEY_BYTES]; - #[cfg(any(feature = "std"))] + #[cfg(feature = "std")] let mut i = I.fetch_add(1) as T; #[cfg(not(any(feature = "std")))] let i = I.fetch_add(1) as T; @@ -489,7 +489,7 @@ impl Pubkey { b[0..COUNTER_BYTES].copy_from_slice(&i.to_be_bytes()); // fill the rest of the pubkey with pseudorandom numbers to make // data statistically similar to real pubkeys. - #[cfg(any(feature = "std"))] + #[cfg(feature = "std")] { let mut hash = std::hash::DefaultHasher::new(); for slice in b[COUNTER_BYTES..].chunks_mut(COUNTER_BYTES) { From c800e7cad74fc7c1eb85c609b69ba60cf17f2f46 Mon Sep 17 00:00:00 2001 From: Louis Pahlavi Date: Mon, 7 Apr 2025 15:29:03 +0200 Subject: [PATCH 07/10] Change 'all' to 'any' --- hash/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hash/src/lib.rs b/hash/src/lib.rs index 85404df9a..1a89d7631 100644 --- a/hash/src/lib.rs +++ b/hash/src/lib.rs @@ -9,7 +9,7 @@ extern crate std; use bytemuck_derive::{Pod, Zeroable}; #[cfg(feature = "serde")] use serde_derive::{Deserialize, Serialize}; -#[cfg(all(feature = "borsh", feature = "std", feature = "js"))] +#[cfg(any(feature = "borsh", feature = "std", feature = "js"))] use std::string::ToString; use { core::{ From 4e12c1090711a8b7590f4c8fa4afd46b95b404a4 Mon Sep 17 00:00:00 2001 From: Louis Pahlavi Date: Tue, 8 Apr 2025 15:01:59 +0200 Subject: [PATCH 08/10] Also gate javascript features with target_arch --- hash/src/lib.rs | 8 ++++---- instruction/src/lib.rs | 6 +++--- keypair/src/lib.rs | 6 +++--- message/src/legacy.rs | 6 +++--- program/src/lib.rs | 2 +- program/src/wasm/mod.rs | 2 +- pubkey/src/lib.rs | 10 +++++----- sdk/src/lib.rs | 2 +- sdk/src/wasm/mod.rs | 2 +- transaction/src/lib.rs | 6 +++--- transaction/src/wasm.rs | 2 +- 11 files changed, 26 insertions(+), 26 deletions(-) diff --git a/hash/src/lib.rs b/hash/src/lib.rs index 1a89d7631..2dd51e7d9 100644 --- a/hash/src/lib.rs +++ b/hash/src/lib.rs @@ -9,7 +9,7 @@ extern crate std; use bytemuck_derive::{Pod, Zeroable}; #[cfg(feature = "serde")] use serde_derive::{Deserialize, Serialize}; -#[cfg(any(feature = "borsh", feature = "std", feature = "js"))] +#[cfg(any(feature = "borsh", feature = "std", all(feature = "js", target_arch = "wasm32")))] use std::string::ToString; use { core::{ @@ -19,7 +19,7 @@ use { }, solana_sanitize::Sanitize, }; -#[cfg(feature = "js")] +#[cfg(all(feature = "js", target_arch = "wasm32"))] use { js_sys::{Array, Uint8Array}, std::{boxed::Box, format, string::String, vec}, @@ -38,7 +38,7 @@ pub const MAX_BASE58_LEN: usize = 44; /// /// [SHA-256]: https://en.wikipedia.org/wiki/SHA-2 /// [blake3]: https://github.com/BLAKE3-team/BLAKE3 -#[cfg_attr(feature = "js", wasm_bindgen)] +#[cfg_attr(all(feature = "js", target_arch = "wasm32"), wasm_bindgen)] #[cfg_attr(feature = "frozen-abi", derive(solana_frozen_abi_macro::AbiExample))] #[cfg_attr( feature = "borsh", @@ -151,7 +151,7 @@ impl Hash { } } -#[cfg(feature = "js")] +#[cfg(all(feature = "js", target_arch = "wasm32"))] #[allow(non_snake_case)] #[wasm_bindgen] impl Hash { diff --git a/instruction/src/lib.rs b/instruction/src/lib.rs index e9a894949..15f1d66b3 100644 --- a/instruction/src/lib.rs +++ b/instruction/src/lib.rs @@ -26,7 +26,7 @@ pub use account_meta::AccountMeta; pub mod error; #[cfg(target_os = "solana")] pub mod syscalls; -#[cfg(all(feature = "std", feature = "js"))] +#[cfg(all(feature = "std", feature = "js", target_arch = "wasm32"))] pub mod wasm; /// A directive for a single invocation of a Solana program. @@ -88,7 +88,7 @@ pub mod wasm; /// Programs may require signatures from some accounts, in which case they /// should be specified as signers during `Instruction` construction. The /// program must still validate during execution that the account is a signer. -#[cfg(all(feature = "std", not(feature = "js")))] +#[cfg(all(feature = "std", not(all(feature = "js", target_arch = "wasm32"))))] #[cfg_attr( feature = "serde", derive(serde_derive::Serialize, serde_derive::Deserialize) @@ -106,7 +106,7 @@ pub struct Instruction { /// wasm-bindgen version of the Instruction struct. /// This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671 /// is fixed. This must not diverge from the regular non-wasm Instruction struct. -#[cfg(all(feature = "std", feature = "js"))] +#[cfg(all(feature = "std", feature = "js", target_arch = "wasm32"))] #[wasm_bindgen::prelude::wasm_bindgen] #[cfg_attr( feature = "serde", diff --git a/keypair/src/lib.rs b/keypair/src/lib.rs index 6af76b790..3b8ea76d9 100644 --- a/keypair/src/lib.rs +++ b/keypair/src/lib.rs @@ -1,6 +1,6 @@ //! Concrete implementation of a Solana `Signer` from raw bytes #![cfg_attr(docsrs, feature(doc_auto_cfg))] -#[cfg(feature = "js")] +#[cfg(all(feature = "js", target_arch = "wasm32"))] use wasm_bindgen::prelude::*; use { ed25519_dalek::Signer as DalekSigner, @@ -21,7 +21,7 @@ pub mod seed_derivable; pub mod signable; /// A vanilla Ed25519 key pair -#[cfg_attr(feature = "js", wasm_bindgen)] +#[cfg_attr(all(feature = "js", target_arch = "wasm32"), wasm_bindgen)] #[derive(Debug)] pub struct Keypair(ed25519_dalek::Keypair); @@ -119,7 +119,7 @@ impl TryFrom<&[u8]> for Keypair { } } -#[cfg(feature = "js")] +#[cfg(all(feature = "js", target_arch = "wasm32"))] #[allow(non_snake_case)] #[wasm_bindgen] impl Keypair { diff --git a/message/src/legacy.rs b/message/src/legacy.rs index 5dd084d3f..d96a3a300 100644 --- a/message/src/legacy.rs +++ b/message/src/legacy.rs @@ -17,7 +17,7 @@ pub use builtins::{BUILTIN_PROGRAMS_KEYS, MAYBE_BUILTIN_KEY_OR_SYSVAR}; use serde_derive::{Deserialize, Serialize}; #[cfg(feature = "frozen-abi")] use solana_frozen_abi_macro::{frozen_abi, AbiExample}; -#[cfg(feature = "js")] +#[cfg(all(feature = "js", target_arch = "wasm32"))] use wasm_bindgen::prelude::wasm_bindgen; use { crate::{ @@ -146,7 +146,7 @@ fn compile_instructions(ixs: &[Instruction], keys: &[Pubkey]) -> Vec for PubkeyError { /// [ed25519]: https://ed25519.cr.yp.to/ /// [pdas]: https://solana.com/docs/core/cpi#program-derived-addresses /// [`Keypair`]: https://docs.rs/solana-sdk/latest/solana_sdk/signer/keypair/struct.Keypair.html -#[cfg_attr(feature = "js", wasm_bindgen)] +#[cfg_attr(all(feature = "js", target_arch = "wasm32"), wasm_bindgen)] #[repr(transparent)] #[cfg_attr(feature = "frozen-abi", derive(solana_frozen_abi_macro::AbiExample))] #[cfg_attr( @@ -1079,7 +1079,7 @@ macro_rules! impl_borsh_serialize { #[cfg(feature = "borsh")] impl_borsh_serialize!(borsh0_10); -#[cfg(all(feature = "js", feature = "std", feature = "curve25519"))] +#[cfg(all(feature = "js", feature = "std", feature = "curve25519", target_arch = "wasm32"))] fn js_value_to_seeds_vec(array_of_uint8_arrays: &[JsValue]) -> Result>, JsValue> { let vec_vec_u8 = array_of_uint8_arrays .iter() @@ -1097,12 +1097,12 @@ fn js_value_to_seeds_vec(array_of_uint8_arrays: &[JsValue]) -> Result(display: T) -> JsValue { std::string::ToString::to_string(&display).into() } -#[cfg(all(feature = "js", feature = "std"))] +#[cfg(all(feature = "js", feature = "std", target_arch = "wasm32"))] #[allow(non_snake_case)] #[wasm_bindgen] impl Pubkey { diff --git a/sdk/src/lib.rs b/sdk/src/lib.rs index 6ce7bb01a..a200eec8b 100644 --- a/sdk/src/lib.rs +++ b/sdk/src/lib.rs @@ -42,7 +42,7 @@ pub use solana_program::program_stubs; // confusing duplication in the docs due to a rustdoc bug. #26211 #[allow(deprecated)] pub use solana_program::sdk_ids; -#[cfg(feature = "js")] +#[cfg(all(feature = "js", target_arch = "wasm32"))] pub use solana_program::wasm_bindgen; pub use solana_program::{ account_info, address_lookup_table, big_mod_exp, blake3, bpf_loader, bpf_loader_deprecated, diff --git a/sdk/src/wasm/mod.rs b/sdk/src/wasm/mod.rs index cd009b766..b65c00a85 100644 --- a/sdk/src/wasm/mod.rs +++ b/sdk/src/wasm/mod.rs @@ -1,5 +1,5 @@ //! solana-sdk Javascript interface -#![cfg(feature = "js")] +#![cfg(all(feature = "js", target_arch = "wasm32"))] pub mod keypair; pub mod transaction; diff --git a/transaction/src/lib.rs b/transaction/src/lib.rs index 834566415..9d6b7ce1d 100644 --- a/transaction/src/lib.rs +++ b/transaction/src/lib.rs @@ -110,7 +110,7 @@ //! # Ok::<(), anyhow::Error>(()) //! ``` -#[cfg(feature = "js")] +#[cfg(all(feature = "js", target_arch = "wasm32"))] use wasm_bindgen::prelude::wasm_bindgen; #[cfg(feature = "serde")] use { @@ -182,7 +182,7 @@ const PACKET_DATA_SIZE: usize = 1280 - 40 - 8; /// if the caller has knowledge that the first account of the constructed /// transaction's `Message` is both a signer and the expected fee-payer, then /// redundantly specifying the fee-payer is not strictly required. -#[cfg(not(feature = "js"))] +#[cfg(not(all(feature = "js", target_arch = "wasm32")))] #[cfg_attr( feature = "frozen-abi", derive(solana_frozen_abi_macro::AbiExample), @@ -210,7 +210,7 @@ pub struct Transaction { /// wasm-bindgen version of the Transaction struct. /// This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671 /// is fixed. This must not diverge from the regular non-wasm Transaction struct. -#[cfg(feature = "js")] +#[cfg(all(feature = "js", target_arch = "wasm32"))] #[wasm_bindgen] #[cfg_attr( feature = "frozen-abi", diff --git a/transaction/src/wasm.rs b/transaction/src/wasm.rs index 1c1f6d844..fdf645ec2 100644 --- a/transaction/src/wasm.rs +++ b/transaction/src/wasm.rs @@ -1,5 +1,5 @@ //! `Transaction` Javascript interface -#![cfg(feature = "js")] +#![cfg(all(feature = "js", target_arch = "wasm32"))] #![allow(non_snake_case)] use { crate::Transaction, solana_hash::Hash, solana_instruction::wasm::Instructions, From 616d0efa908b27863d21a3252d2480a37863f484 Mon Sep 17 00:00:00 2001 From: Louis Pahlavi Date: Tue, 8 Apr 2025 15:15:50 +0200 Subject: [PATCH 09/10] Add 'js' to default features --- hash/Cargo.toml | 2 +- instruction/Cargo.toml | 10 ++++++++-- keypair/Cargo.toml | 2 +- message/Cargo.toml | 9 ++++++++- program/Cargo.toml | 10 ++++++++-- pubkey/Cargo.toml | 10 ++++++++-- sdk/Cargo.toml | 13 ++++++++++++- transaction/Cargo.toml | 13 ++++++++++++- 8 files changed, 58 insertions(+), 11 deletions(-) diff --git a/hash/Cargo.toml b/hash/Cargo.toml index df1068740..054e673ba 100644 --- a/hash/Cargo.toml +++ b/hash/Cargo.toml @@ -40,7 +40,7 @@ wasm-bindgen = { workspace = true, optional = true } [features] borsh = ["dep:borsh", "std"] bytemuck = ["dep:bytemuck", "dep:bytemuck_derive"] -default = ["std"] +default = ["std", "js"] dev-context-only-utils = ["bs58/alloc"] frozen-abi = [ "dep:solana-frozen-abi", diff --git a/instruction/Cargo.toml b/instruction/Cargo.toml index 2b4daf491..bcb23e824 100644 --- a/instruction/Cargo.toml +++ b/instruction/Cargo.toml @@ -33,14 +33,20 @@ solana-instruction = { path = ".", features = ["borsh"] } [features] bincode = ["dep:bincode", "dep:serde"] borsh = ["dep:borsh"] -default = ["std"] +default = ["std", "js"] frozen-abi = [ "dep:solana-frozen-abi", "dep:solana-frozen-abi-macro", "serde", "std", ] -js = ["dep:getrandom", "dep:wasm-bindgen", "dep:js-sys"] +js = [ + "dep:getrandom", + "dep:wasm-bindgen", + "dep:js-sys", + "solana-instruction/js", + "solana-pubkey/js", +] serde = [ "dep:serde", "dep:serde_derive", diff --git a/keypair/Cargo.toml b/keypair/Cargo.toml index 624038eed..9301d4c79 100644 --- a/keypair/Cargo.toml +++ b/keypair/Cargo.toml @@ -30,7 +30,7 @@ static_assertions = { workspace = true } tiny-bip39 = { workspace = true } [features] -js = ["dep:wasm-bindgen"] +js = ["dep:wasm-bindgen", "solana-pubkey/js"] seed-derivable = ["dep:solana-derivation-path", "dep:solana-seed-derivable", "dep:ed25519-dalek-bip32"] [package.metadata.docs.rs] diff --git a/message/Cargo.toml b/message/Cargo.toml index 529422cc6..62ac0a683 100644 --- a/message/Cargo.toml +++ b/message/Cargo.toml @@ -54,6 +54,7 @@ bincode = [ "serde", ] blake3 = ["dep:blake3"] +default = ["js"] dev-context-only-utils = ["bincode", "blake3"] frozen-abi = [ "dep:solana-frozen-abi", @@ -62,7 +63,13 @@ frozen-abi = [ "solana-hash/frozen-abi", "solana-pubkey/frozen-abi", ] -js = ["dep:wasm-bindgen"] +js = [ + "dep:wasm-bindgen", + "solana-instruction/js", + "solana-message/js", + "solana-program/js", + "solana-pubkey/js", +] serde = [ "dep:serde", "dep:serde_derive", diff --git a/program/Cargo.toml b/program/Cargo.toml index a005f3163..1b8ec8051 100644 --- a/program/Cargo.toml +++ b/program/Cargo.toml @@ -130,7 +130,7 @@ rustdoc-args = ["--cfg=docsrs"] crate-type = ["cdylib", "rlib"] [features] -default = ["borsh"] +default = ["borsh", "js"] borsh = [ "dep:borsh", "dep:borsh0-10", @@ -157,7 +157,13 @@ frozen-abi = [ "solana-stake-interface/frozen-abi", "solana-sysvar/frozen-abi" ] -js = ["dep:getrandom", "dep:wasm-bindgen"] +js = [ + "dep:getrandom", + "dep:wasm-bindgen", + "solana-instruction/js", + "solana-message/js", + "solana-pubkey/js", +] [lints] workspace = true diff --git a/pubkey/Cargo.toml b/pubkey/Cargo.toml index b6d7f357b..102b47346 100644 --- a/pubkey/Cargo.toml +++ b/pubkey/Cargo.toml @@ -64,14 +64,20 @@ strum_macros = { workspace = true } borsh = ["dep:borsh", "dep:borsh0-10", "std"] bytemuck = ["dep:bytemuck", "dep:bytemuck_derive"] curve25519 = ["dep:curve25519-dalek", "sha2"] -default = ["std"] +default = ["std", "js"] dev-context-only-utils = ["dep:arbitrary", "rand"] frozen-abi = [ "dep:solana-frozen-abi", "dep:solana-frozen-abi-macro", "std", ] -js = ["dep:getrandom", "dep:wasm-bindgen", "dep:js-sys"] +js = [ + "dep:getrandom", + "dep:wasm-bindgen", + "dep:js-sys", + "solana-program/js", + "solana-pubkey/js", +] rand = ["dep:rand", "std"] serde = ["dep:serde", "dep:serde_derive"] sha2 = ["dep:solana-sha256-hasher", "solana-sha256-hasher/sha2"] diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index 460bab4cd..c31ea36d8 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -12,14 +12,25 @@ edition = { workspace = true } include = ["src/**/*", "README.md"] [features] +js = [ + "dep:getrandom", + "dep:wasm-bindgen", + "dep:js-sys", + "solana-instruction/js", + "solana-keypair/js", + "solana-message/js", + "solana-program/js", + "solana-pubkey/js", + "solana-transaction/js", +] # "program" feature is a legacy feature retained to support v1.3 and older # programs. New development should not use this feature. Instead use the # solana-program crate -js = ["dep:getrandom", "dep:wasm-bindgen", "dep:js-sys"] program = [] default = [ "borsh", + "js", "full", # functionality that is not compatible or needed for on-chain programs ] full = [ diff --git a/transaction/Cargo.toml b/transaction/Cargo.toml index 8ba5a9832..c358a9826 100644 --- a/transaction/Cargo.toml +++ b/transaction/Cargo.toml @@ -65,13 +65,24 @@ blake3 = [ "bincode", "solana-message/blake3", ] +default = ["js"] dev-context-only-utils = ["blake3", "precompiles", "serde", "verify"] frozen-abi = [ "dep:solana-frozen-abi", "dep:solana-frozen-abi-macro", "dep:solana-logger", ] -js = ["dep:wasm-bindgen", "dep:solana-keypair"] +js = [ + "dep:wasm-bindgen", + "dep:solana-keypair", + "solana-hash/js", + "solana-instruction/js", + "solana-keypair/js", + "solana-message/js", + "solana-program/js", + "solana-pubkey/js", + "solana-sdk/js" +] precompiles = ["dep:solana-feature-set", "dep:solana-precompiles"] serde = [ "dep:serde", From 58a34db921b20b2fec791b4b50dcf0c9a1633090 Mon Sep 17 00:00:00 2001 From: Louis Pahlavi Date: Thu, 3 Jul 2025 16:59:45 +0200 Subject: [PATCH 10/10] Cargo sort --- Cargo.toml | 44 ++++----- account-info/Cargo.toml | 16 +-- account/Cargo.toml | 44 ++++----- address-lookup-table-interface/Cargo.toml | 34 +++---- atomic-u64/Cargo.toml | 6 +- big-mod-exp/Cargo.toml | 10 +- bincode/Cargo.toml | 6 +- blake3-hasher/Cargo.toml | 16 +-- borsh/Cargo.toml | 6 +- client-traits/Cargo.toml | 6 +- clock/Cargo.toml | 18 ++-- cluster-type/Cargo.toml | 18 ++-- commitment-config/Cargo.toml | 10 +- compute-budget-interface/Cargo.toml | 22 ++--- cpi/Cargo.toml | 6 +- derivation-path/Cargo.toml | 6 +- ed25519-program/Cargo.toml | 6 +- epoch-info/Cargo.toml | 10 +- epoch-rewards-hasher/Cargo.toml | 6 +- epoch-rewards/Cargo.toml | 27 ++--- epoch-schedule/Cargo.toml | 16 +-- example-mocks/Cargo.toml | 6 +- feature-gate-interface/Cargo.toml | 34 +++---- feature-set-interface/Cargo.toml | 12 +-- feature-set/Cargo.toml | 12 +-- fee-calculator/Cargo.toml | 18 ++-- fee-structure/Cargo.toml | 18 ++-- file-download/Cargo.toml | 6 +- frozen-abi-macro/Cargo.toml | 10 +- frozen-abi/Cargo.toml | 14 +-- genesis-config/Cargo.toml | 40 ++++---- hard-forks/Cargo.toml | 14 +-- hash/Cargo.toml | 28 +++--- inflation/Cargo.toml | 14 +-- instruction/Cargo.toml | 54 +++++----- instructions-sysvar/Cargo.toml | 16 +-- keccak-hasher/Cargo.toml | 14 +-- keypair/Cargo.toml | 22 +++-- loader-v2-interface/Cargo.toml | 18 ++-- loader-v3-interface/Cargo.toml | 22 ++--- loader-v4-interface/Cargo.toml | 22 ++--- logger/Cargo.toml | 12 +-- message/Cargo.toml | 74 +++++++------- msg/Cargo.toml | 6 +- nonce/Cargo.toml | 30 +++--- offchain-message/Cargo.toml | 18 ++-- package-metadata-macro/Cargo.toml | 6 +- package-metadata/Cargo.toml | 6 +- packet/Cargo.toml | 34 +++---- poh-config/Cargo.toml | 11 +-- precompile-error/Cargo.toml | 6 +- precompiles/Cargo.toml | 18 ++-- presigner/Cargo.toml | 6 +- program-entrypoint/Cargo.toml | 6 +- program-error/Cargo.toml | 18 ++-- program-pack/Cargo.toml | 6 +- program/Cargo.toml | 114 +++++++++++----------- pubkey/Cargo.toml | 60 ++++++------ quic-definitions/Cargo.toml | 6 +- rent-collector/Cargo.toml | 28 +++--- rent-debits/Cargo.toml | 14 +-- rent/Cargo.toml | 16 +-- reserved-account-keys/Cargo.toml | 16 +-- reward-info/Cargo.toml | 14 +-- sdk-ids/Cargo.toml | 6 +- sdk-macro/Cargo.toml | 6 +- sdk/Cargo.toml | 18 ++-- secp256k1-program/Cargo.toml | 34 +++---- secp256k1-recover/Cargo.toml | 20 ++-- secp256r1-program/Cargo.toml | 20 ++-- seed-derivable/Cargo.toml | 6 +- seed-phrase/Cargo.toml | 6 +- serde-varint/Cargo.toml | 6 +- serde/Cargo.toml | 6 +- serialize-utils/Cargo.toml | 6 +- sha256-hasher/Cargo.toml | 6 +- short-vec/Cargo.toml | 12 +-- shred-version/Cargo.toml | 6 +- signature/Cargo.toml | 32 +++--- signer/Cargo.toml | 10 +- slot-hashes/Cargo.toml | 14 +-- slot-history/Cargo.toml | 18 ++-- sysvar-id/Cargo.toml | 8 +- sysvar/Cargo.toml | 56 +++++------ transaction-error/Cargo.toml | 18 ++-- transaction/Cargo.toml | 89 ++++++++--------- vote-interface/Cargo.toml | 68 ++++++------- 87 files changed, 855 insertions(+), 868 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6c10366eb..8f6abc88a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,14 +1,3 @@ -[profile.release] -split-debuginfo = "unpacked" -lto = "thin" - -# Enable basic optimizations for unittests -[profile.test] -opt-level = 1 - -# Enable optimizations for procmacros for faster recompile -[profile.dev.build-override] -opt-level = 1 [workspace] members = [ @@ -227,7 +216,6 @@ solana-decode-error = { path = "decode-error", version = "2.2.1" } solana-define-syscall = { path = "define-syscall", version = "2.2.1" } solana-derivation-path = { path = "derivation-path", version = "2.2.1" } solana-ed25519-program = { path = "ed25519-program", version = "2.2.1" } -solana-program-entrypoint = { path = "program-entrypoint", version = "2.2.1" } solana-epoch-info = { path = "epoch-info", version = "2.2.1" } solana-epoch-rewards = { path = "epoch-rewards", version = "2.2.1" } solana-epoch-rewards-hasher = { path = "epoch-rewards-hasher", version = "2.2.1" } @@ -238,9 +226,9 @@ solana-feature-set = { path = "feature-set", version = "2.2.1" } solana-feature-set-interface = { path = "feature-set-interface", version = "4.0.1" } solana-fee-calculator = { path = "fee-calculator", version = "2.2.1" } solana-fee-structure = { path = "fee-structure", version = "2.2.1" } +solana-file-download = { path = "file-download", version = "2.2.1" } solana-frozen-abi = { path = "frozen-abi", version = "2.2.1" } solana-frozen-abi-macro = { path = "frozen-abi-macro", version = "2.2.1" } -solana-file-download = { path = "file-download", version = "2.2.1" } solana-genesis-config = { path = "genesis-config", version = "2.2.1" } solana-hard-forks = { path = "hard-forks", version = "2.2.1", default-features = false } solana-hash = { path = "hash", version = "2.2.1", default-features = false } @@ -268,6 +256,7 @@ solana-precompile-error = { path = "precompile-error", version = "2.2.1" } solana-precompiles = { path = "precompiles", version = "2.2.1" } solana-presigner = { path = "presigner", version = "2.2.1" } solana-program = { path = "program", version = "2.2.1", default-features = false } +solana-program-entrypoint = { path = "program-entrypoint", version = "2.2.1" } solana-program-error = { path = "program-error", version = "2.2.1" } solana-program-memory = { path = "program-memory", version = "2.2.1" } solana-program-option = { path = "program-option", version = "2.2.1" } @@ -280,6 +269,11 @@ solana-rent-debits = { path = "rent-debits", version = "2.2.1" } solana-reserved-account-keys = { path = "reserved-account-keys", version = "2.2.1", default-features = false } solana-reward-info = { path = "reward-info", version = "2.2.1" } solana-sanitize = { path = "sanitize", version = "2.2.1" } +solana-sdk = { path = "sdk", version = "2.2.1" } +solana-sdk-ids = { path = "sdk-ids", version = "2.2.1" } +solana-sdk-macro = { path = "sdk-macro", version = "2.2.1" } +solana-secp256k1-program = { path = "secp256k1-program", version = "2.2.1" } +solana-secp256k1-recover = { path = "secp256k1-recover", version = "2.2.1" } solana-secp256r1-program = { path = "secp256r1-program", version = "2.2.1", default-features = false } solana-seed-derivable = { path = "seed-derivable", version = "2.2.1" } solana-seed-phrase = { path = "seed-phrase", version = "2.2.1" } @@ -287,27 +281,22 @@ solana-serde = { path = "serde", version = "2.2.1" } solana-serde-varint = { path = "serde-varint", version = "2.2.1" } solana-serialize-utils = { path = "serialize-utils", version = "2.2.1" } solana-sha256-hasher = { path = "sha256-hasher", version = "2.2.1" } +solana-short-vec = { path = "short-vec", version = "2.2.1" } +solana-shred-version = { path = "shred-version", version = "2.2.1" } solana-signature = { path = "signature", version = "2.2.1", default-features = false } solana-signer = { path = "signer", version = "2.2.1" } solana-slot-hashes = { path = "slot-hashes", version = "2.2.1" } solana-slot-history = { path = "slot-history", version = "2.2.1" } -solana-time-utils = { path = "time-utils", version = "2.2.1" } -solana-sdk = { path = "sdk", version = "2.2.1" } -solana-sdk-ids = { path = "sdk-ids", version = "2.2.1" } -solana-sdk-macro = { path = "sdk-macro", version = "2.2.1" } -solana-secp256k1-program = { path = "secp256k1-program", version = "2.2.1" } -solana-secp256k1-recover = { path = "secp256k1-recover", version = "2.2.1" } -solana-short-vec = { path = "short-vec", version = "2.2.1" } -solana-shred-version = { path = "shred-version", version = "2.2.1" } solana-stable-layout = { path = "stable-layout", version = "2.2.1" } solana-stake-interface = { version = "1.2.1" } solana-system-interface = "1.0" solana-system-transaction = { path = "system-transaction", version = "2.2.1" } solana-sysvar = { path = "sysvar", version = "2.2.1" } solana-sysvar-id = { path = "sysvar-id", version = "2.2.1" } +solana-time-utils = { path = "time-utils", version = "2.2.1" } solana-transaction = { path = "transaction", version = "2.2.1" } -solana-transaction-error = { path = "transaction-error", version = "2.2.1" } solana-transaction-context = { version = "2.2.1" } +solana-transaction-error = { path = "transaction-error", version = "2.2.1" } solana-validator-exit = { path = "validator-exit", version = "2.2.1" } solana-vote-interface = { path = "vote-interface", version = "2.2.1" } static_assertions = "1.1.0" @@ -320,6 +309,17 @@ tiny-bip39 = "0.8.2" toml = "0.8.20" uriparse = "0.6.4" wasm-bindgen = "0.2.100" +[profile.release] +split-debuginfo = "unpacked" +lto = "thin" + +# Enable basic optimizations for unittests +[profile.test] +opt-level = 1 + +# Enable optimizations for procmacros for faster recompile +[profile.dev.build-override] +opt-level = 1 [patch.crates-io] # We include the following crates as our dependencies above from crates.io: diff --git a/account-info/Cargo.toml b/account-info/Cargo.toml index f27e1d6b9..629091854 100644 --- a/account-info/Cargo.toml +++ b/account-info/Cargo.toml @@ -9,17 +9,17 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +bincode = ["dep:bincode", "dep:serde"] + [dependencies] bincode = { workspace = true, optional = true } serde = { workspace = true, optional = true } solana-program-error = { workspace = true } solana-program-memory = { workspace = true } solana-pubkey = { workspace = true, default-features = false } - -[features] -bincode = ["dep:bincode", "dep:serde"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] diff --git a/account/Cargo.toml b/account/Cargo.toml index df88055d3..1534c8c38 100644 --- a/account/Cargo.toml +++ b/account/Cargo.toml @@ -9,24 +9,10 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } -[dependencies] -bincode = { workspace = true, optional = true } -qualifier_attr = { workspace = true, optional = true } -serde = { workspace = true, optional = true } -serde_bytes = { workspace = true, optional = true } -serde_derive = { workspace = true, optional = true } -solana-account-info = { workspace = true } -solana-clock = { workspace = true } -solana-frozen-abi = { workspace = true, optional = true } -solana-frozen-abi-macro = { workspace = true, optional = true } -solana-instruction = { workspace = true } -solana-logger = { workspace = true, optional = true } -solana-pubkey = { workspace = true } -solana-sdk-ids = { workspace = true } -solana-sysvar = { workspace = true, features = ["bincode"], optional = true } - -[dev-dependencies] -solana-account = { path = ".", features = ["dev-context-only-utils"] } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] [features] bincode = [ @@ -49,7 +35,21 @@ serde = [ "solana-pubkey/serde", ] -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] +[dependencies] +bincode = { workspace = true, optional = true } +qualifier_attr = { workspace = true, optional = true } +serde = { workspace = true, optional = true } +serde_bytes = { workspace = true, optional = true } +serde_derive = { workspace = true, optional = true } +solana-account-info = { workspace = true } +solana-clock = { workspace = true } +solana-frozen-abi = { workspace = true, optional = true } +solana-frozen-abi-macro = { workspace = true, optional = true } +solana-instruction = { workspace = true } +solana-logger = { workspace = true, optional = true } +solana-pubkey = { workspace = true } +solana-sdk-ids = { workspace = true } +solana-sysvar = { workspace = true, features = ["bincode"], optional = true } + +[dev-dependencies] +solana-account = { path = ".", features = ["dev-context-only-utils"] } diff --git a/address-lookup-table-interface/Cargo.toml b/address-lookup-table-interface/Cargo.toml index c4deae08c..814480e2c 100644 --- a/address-lookup-table-interface/Cargo.toml +++ b/address-lookup-table-interface/Cargo.toml @@ -9,6 +9,23 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +bincode = [ + "dep:bincode", + "dep:solana-instruction", + "serde", + "solana-instruction/bincode", +] +bytemuck = ["dep:bytemuck", "solana-pubkey/bytemuck"] +dev-context-only-utils = ["bincode", "bytemuck"] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro", "serde"] +serde = ["dep:serde", "dep:serde_derive", "solana-pubkey/serde"] + [dependencies] bincode = { workspace = true, optional = true } bytemuck = { workspace = true, optional = true } @@ -35,22 +52,5 @@ solana-address-lookup-table-interface = { path = ".", features = [ ] } solana-hash = { workspace = true } -[features] -bincode = [ - "dep:bincode", - "dep:solana-instruction", - "serde", - "solana-instruction/bincode", -] -bytemuck = ["dep:bytemuck", "solana-pubkey/bytemuck"] -dev-context-only-utils = ["bincode", "bytemuck"] -frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro", "serde"] -serde = ["dep:serde", "dep:serde_derive", "solana-pubkey/serde"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] - [lints] workspace = true diff --git a/atomic-u64/Cargo.toml b/atomic-u64/Cargo.toml index 43fcd4ca3..548c5d486 100644 --- a/atomic-u64/Cargo.toml +++ b/atomic-u64/Cargo.toml @@ -9,8 +9,8 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } -[target.'cfg(not(target_pointer_width = "64"))'.dependencies] -parking_lot = { workspace = true } - [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[target.'cfg(not(target_pointer_width = "64"))'.dependencies] +parking_lot = { workspace = true } diff --git a/big-mod-exp/Cargo.toml b/big-mod-exp/Cargo.toml index a6b1fa66c..3cbd70115 100644 --- a/big-mod-exp/Cargo.toml +++ b/big-mod-exp/Cargo.toml @@ -9,21 +9,21 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } -[target.'cfg(target_os = "solana")'.dependencies] -solana-define-syscall = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] [target.'cfg(not(target_os = "solana"))'.dependencies] num-bigint = { workspace = true } num-traits = { workspace = true } +[target.'cfg(target_os = "solana")'.dependencies] +solana-define-syscall = { 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 diff --git a/bincode/Cargo.toml b/bincode/Cargo.toml index 70201f15a..a2d55f13f 100644 --- a/bincode/Cargo.toml +++ b/bincode/Cargo.toml @@ -9,6 +9,9 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] bincode = { workspace = true } serde = { workspace = true } @@ -19,8 +22,5 @@ solana-instruction = { workspace = true, default-features = false, features = [ [dev-dependencies] solana-system-interface = { workspace = true, features = ["bincode"] } -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - [lints] workspace = true diff --git a/blake3-hasher/Cargo.toml b/blake3-hasher/Cargo.toml index 295b5ac27..59e969ce7 100644 --- a/blake3-hasher/Cargo.toml +++ b/blake3-hasher/Cargo.toml @@ -14,6 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] all-features = true rustdoc-args = ["--cfg=docsrs"] +[features] +borsh = ["dep:borsh", "std"] +dev-context-only-utils = ["std"] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro", "std"] +serde = ["dep:serde", "dep:serde_derive"] +blake3 = ["dep:blake3"] +std = ["solana-hash/std"] + [dependencies] borsh = { workspace = true, optional = true } serde = { workspace = true, optional = true } @@ -41,13 +49,5 @@ solana-define-syscall = { workspace = true } bs58 = { workspace = true, features = ["std"] } solana-blake3-hasher = { path = ".", features = ["dev-context-only-utils"] } -[features] -borsh = ["dep:borsh", "std"] -dev-context-only-utils = ["std"] -frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro", "std"] -serde = ["dep:serde", "dep:serde_derive"] -blake3 = ["dep:blake3"] -std = ["solana-hash/std"] - [lints] workspace = true diff --git a/borsh/Cargo.toml b/borsh/Cargo.toml index 426767bba..1a25cc7c1 100644 --- a/borsh/Cargo.toml +++ b/borsh/Cargo.toml @@ -9,12 +9,12 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] borsh = { workspace = true } borsh0-10 = { workspace = true } -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - [lints] workspace = true diff --git a/client-traits/Cargo.toml b/client-traits/Cargo.toml index abfcd8759..a1edbf483 100644 --- a/client-traits/Cargo.toml +++ b/client-traits/Cargo.toml @@ -9,6 +9,9 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] solana-account = { workspace = true } solana-commitment-config = { workspace = true } @@ -23,6 +26,3 @@ solana-signer = { workspace = true } solana-system-interface = { workspace = true } solana-transaction = { workspace = true, features = ["bincode"] } solana-transaction-error = { workspace = true } - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] diff --git a/clock/Cargo.toml b/clock/Cargo.toml index e22459cc5..b32f5f988 100644 --- a/clock/Cargo.toml +++ b/clock/Cargo.toml @@ -9,6 +9,15 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +serde = ["dep:serde", "dep:serde_derive"] +sysvar = ["dep:solana-sdk-ids", "dep:solana-sysvar-id"] + [dependencies] serde = { workspace = true, optional = true } serde_derive = { workspace = true, optional = true } @@ -19,12 +28,3 @@ solana-sysvar-id = { workspace = true, optional = true } [dev-dependencies] solana-clock = { path = ".", features = ["sysvar"] } static_assertions = { workspace = true } - -[features] -serde = ["dep:serde", "dep:serde_derive"] -sysvar = ["dep:solana-sdk-ids", "dep:solana-sysvar-id"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] diff --git a/cluster-type/Cargo.toml b/cluster-type/Cargo.toml index 21a1bee89..ea14e6a4b 100644 --- a/cluster-type/Cargo.toml +++ b/cluster-type/Cargo.toml @@ -9,18 +9,18 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] +serde = ["dep:serde", "dep:serde_derive"] + [dependencies] serde = { workspace = true, optional = true } serde_derive = { workspace = true, optional = true } solana-frozen-abi = { workspace = true, optional = true } solana-frozen-abi-macro = { workspace = true, optional = true } solana-hash = { workspace = true, default-features = false } - -[features] -frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] -serde = ["dep:serde", "dep:serde_derive"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] diff --git a/commitment-config/Cargo.toml b/commitment-config/Cargo.toml index 6224c03dc..cba27c057 100644 --- a/commitment-config/Cargo.toml +++ b/commitment-config/Cargo.toml @@ -9,12 +9,12 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } -[dependencies] -serde = { workspace = true, optional = true } -serde_derive = { workspace = true, optional = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] [features] serde = ["dep:serde", "dep:serde_derive"] -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] +[dependencies] +serde = { workspace = true, optional = true } +serde_derive = { workspace = true, optional = true } diff --git a/compute-budget-interface/Cargo.toml b/compute-budget-interface/Cargo.toml index c045b718a..aed2d2ffd 100644 --- a/compute-budget-interface/Cargo.toml +++ b/compute-budget-interface/Cargo.toml @@ -9,6 +9,17 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +borsh = ["dep:borsh"] +dev-context-only-utils = ["borsh"] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro", "serde"] +serde = ["dep:serde", "dep:serde_derive"] + [dependencies] borsh = { workspace = true, optional = true } serde = { workspace = true, optional = true } @@ -22,16 +33,5 @@ solana-frozen-abi-macro = { workspace = true, features = [ solana-instruction = { workspace = true, features = ["std"] } solana-sdk-ids = { workspace = true } -[features] -borsh = ["dep:borsh"] -dev-context-only-utils = ["borsh"] -frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro", "serde"] -serde = ["dep:serde", "dep:serde_derive"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] - [lints] workspace = true diff --git a/cpi/Cargo.toml b/cpi/Cargo.toml index 66205741a..dcdd67133 100644 --- a/cpi/Cargo.toml +++ b/cpi/Cargo.toml @@ -9,6 +9,9 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] solana-account-info = { workspace = true } solana-instruction = { workspace = true } @@ -26,8 +29,5 @@ solana-sdk-ids = { workspace = true } solana-system-interface = { workspace = true, features = ["bincode"] } static_assertions = { workspace = true } -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - [lints] workspace = true diff --git a/derivation-path/Cargo.toml b/derivation-path/Cargo.toml index 321049f48..21092e4fa 100644 --- a/derivation-path/Cargo.toml +++ b/derivation-path/Cargo.toml @@ -9,6 +9,9 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] derivation-path = { workspace = true } qstring = { workspace = true } @@ -16,6 +19,3 @@ uriparse = { workspace = true } [dev-dependencies] assert_matches = { workspace = true } - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] diff --git a/ed25519-program/Cargo.toml b/ed25519-program/Cargo.toml index d59deed97..0721cace0 100644 --- a/ed25519-program/Cargo.toml +++ b/ed25519-program/Cargo.toml @@ -9,6 +9,9 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] bytemuck = { workspace = true } bytemuck_derive = { workspace = true } @@ -27,8 +30,5 @@ solana-logger = { workspace = true } solana-sdk = { path = "../sdk" } solana-signer = { workspace = true } -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - [lints] workspace = true diff --git a/epoch-info/Cargo.toml b/epoch-info/Cargo.toml index 757c2347e..48430f4b6 100644 --- a/epoch-info/Cargo.toml +++ b/epoch-info/Cargo.toml @@ -9,15 +9,15 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } -[dependencies] -serde = { workspace = true, optional = true } -serde_derive = { workspace = true, optional = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] [features] serde = ["dep:serde", "dep:serde_derive"] -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] +[dependencies] +serde = { workspace = true, optional = true } +serde_derive = { workspace = true, optional = true } [lints] workspace = true diff --git a/epoch-rewards-hasher/Cargo.toml b/epoch-rewards-hasher/Cargo.toml index d641044ef..40356c274 100644 --- a/epoch-rewards-hasher/Cargo.toml +++ b/epoch-rewards-hasher/Cargo.toml @@ -9,13 +9,13 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] siphasher = { workspace = true } solana-hash = { workspace = true } solana-pubkey = { workspace = true } -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - [lints] workspace = true diff --git a/epoch-rewards/Cargo.toml b/epoch-rewards/Cargo.toml index 256ec18ea..6e9f2f42c 100644 --- a/epoch-rewards/Cargo.toml +++ b/epoch-rewards/Cargo.toml @@ -9,6 +9,22 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +frozen-abi = [ + "dep:solana-frozen-abi", + "dep:solana-frozen-abi-macro", + "solana-hash/frozen-abi", + "std", +] +serde = ["dep:serde", "dep:serde_derive", "solana-hash/serde"] +std = [] +sysvar = ["dep:solana-sysvar-id"] + [dependencies] serde = { workspace = true, optional = true } serde_derive = { workspace = true, optional = true } @@ -22,16 +38,5 @@ solana-sysvar-id = { workspace = true, optional = true } [dev-dependencies] solana-epoch-rewards = { path = ".", features = ["sysvar"] } -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] - -[features] -frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro", "solana-hash/frozen-abi", "std"] -serde = ["dep:serde", "dep:serde_derive", "solana-hash/serde"] -std = [] -sysvar = ["dep:solana-sysvar-id"] - [lints] workspace = true diff --git a/epoch-schedule/Cargo.toml b/epoch-schedule/Cargo.toml index 7c8e62a94..ef833bcef 100644 --- a/epoch-schedule/Cargo.toml +++ b/epoch-schedule/Cargo.toml @@ -9,6 +9,14 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[features] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] +serde = ["dep:serde", "dep:serde_derive"] +sysvar = ["dep:solana-sdk-ids", "dep:solana-sysvar-id"] + [dependencies] serde = { workspace = true, optional = true } serde_derive = { workspace = true, optional = true } @@ -18,18 +26,10 @@ solana-sdk-ids = { workspace = true, optional = true } solana-sdk-macro = { workspace = true } solana-sysvar-id = { workspace = true, optional = true } -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - [dev-dependencies] solana-clock = { workspace = true } solana-epoch-schedule = { path = ".", features = ["sysvar"] } static_assertions = { workspace = true } -[features] -frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] -serde = ["dep:serde", "dep:serde_derive"] -sysvar = ["dep:solana-sdk-ids", "dep:solana-sysvar-id"] - [lints] workspace = true diff --git a/example-mocks/Cargo.toml b/example-mocks/Cargo.toml index 1cf787147..17ae55910 100644 --- a/example-mocks/Cargo.toml +++ b/example-mocks/Cargo.toml @@ -9,6 +9,9 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] serde = { workspace = true } serde_derive = { workspace = true } @@ -23,6 +26,3 @@ solana-pubkey = { workspace = true } solana-sdk-ids = { workspace = true } solana-system-interface = { workspace = true } thiserror = { workspace = true } - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] diff --git a/feature-gate-interface/Cargo.toml b/feature-gate-interface/Cargo.toml index 2093a142b..2d5c38016 100644 --- a/feature-gate-interface/Cargo.toml +++ b/feature-gate-interface/Cargo.toml @@ -9,6 +9,23 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[features] +bincode = [ + "dep:bincode", + "dep:solana-account", + "dep:solana-account-info", + "dep:solana-instruction", + "dep:solana-program-error", + "dep:solana-rent", + "dep:solana-system-interface", + "serde", +] +dev-context-only-utils = ["bincode"] +serde = ["dep:serde", "dep:serde_derive"] + [dependencies] bincode = { workspace = true, optional = true } serde = { workspace = true, optional = true } @@ -27,22 +44,5 @@ solana-system-interface = { workspace = true, optional = true, features = [ [dev-dependencies] solana-feature-gate-interface = { path = ".", features = ["dev-context-only-utils"] } -[features] -bincode = [ - "dep:bincode", - "dep:solana-account", - "dep:solana-account-info", - "dep:solana-instruction", - "dep:solana-program-error", - "dep:solana-rent", - "dep:solana-system-interface", - "serde" -] -dev-context-only-utils = ["bincode"] -serde = ["dep:serde", "dep:serde_derive"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - [lints] workspace = true diff --git a/feature-set-interface/Cargo.toml b/feature-set-interface/Cargo.toml index de35f2ad7..c57d888ff 100644 --- a/feature-set-interface/Cargo.toml +++ b/feature-set-interface/Cargo.toml @@ -9,6 +9,12 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[features] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] + [dependencies] ahash = { workspace = true } solana-frozen-abi = { workspace = true, optional = true, features = [ @@ -19,11 +25,5 @@ solana-frozen-abi-macro = { workspace = true, optional = true, features = [ ] } solana-pubkey = { workspace = true } -[features] -frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - [lints] workspace = true diff --git a/feature-set/Cargo.toml b/feature-set/Cargo.toml index c160b2cb0..58aeceb3a 100644 --- a/feature-set/Cargo.toml +++ b/feature-set/Cargo.toml @@ -9,6 +9,12 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[features] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] + [dependencies] ahash = { workspace = true } lazy_static = { workspace = true } @@ -23,11 +29,5 @@ solana-hash = { workspace = true } solana-pubkey = { workspace = true } solana-sha256-hasher = { workspace = true } -[features] -frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - [lints] workspace = true diff --git a/fee-calculator/Cargo.toml b/fee-calculator/Cargo.toml index a50dae551..b66c4da1d 100644 --- a/fee-calculator/Cargo.toml +++ b/fee-calculator/Cargo.toml @@ -9,6 +9,15 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] +serde = ["dep:serde", "dep:serde_derive"] + [dependencies] log = { workspace = true } serde = { workspace = true, optional = true } @@ -20,12 +29,3 @@ solana-frozen-abi-macro = { workspace = true, optional = true } solana-clock = { workspace = true } solana-logger = { workspace = true } static_assertions = { workspace = true } - -[features] -frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] -serde = ["dep:serde", "dep:serde_derive"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] diff --git a/fee-structure/Cargo.toml b/fee-structure/Cargo.toml index e14bf3e27..5b3d81b20 100644 --- a/fee-structure/Cargo.toml +++ b/fee-structure/Cargo.toml @@ -9,6 +9,15 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +frozen-abi = ["dep:solana-frozen-abi"] +serde = ["dep:serde", "dep:serde_derive"] + [dependencies] serde = { workspace = true, optional = true } serde_derive = { workspace = true, optional = true } @@ -17,17 +26,8 @@ solana-frozen-abi = { workspace = true, optional = true, features = [ ] } solana-native-token = { workspace = true } -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] - [target.'cfg(not(target_os = "solana"))'.dependencies] solana-message = { workspace = true } -[features] -frozen-abi = ["dep:solana-frozen-abi"] -serde = ["dep:serde", "dep:serde_derive"] - [lints] workspace = true diff --git a/file-download/Cargo.toml b/file-download/Cargo.toml index 8b82c502c..64a53bc7f 100644 --- a/file-download/Cargo.toml +++ b/file-download/Cargo.toml @@ -9,11 +9,11 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] console = { workspace = true } indicatif = { workspace = true } log = { workspace = true } reqwest = { workspace = true, features = ["blocking", "brotli", "deflate", "gzip", "rustls-tls", "json"] } - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] diff --git a/frozen-abi-macro/Cargo.toml b/frozen-abi-macro/Cargo.toml index accceb719..fcb6ff2db 100644 --- a/frozen-abi-macro/Cargo.toml +++ b/frozen-abi-macro/Cargo.toml @@ -12,16 +12,16 @@ edition = { workspace = true } [lib] proc-macro = true -[dependencies] -proc-macro2 = { workspace = true } -quote = { workspace = true } -syn = { workspace = true, features = ["full", "extra-traits"] } - [features] default = [] # activate the frozen-abi feature when we actually want to do frozen-abi testing, # otherwise leave it off because it requires nightly Rust frozen-abi = [] +[dependencies] +proc-macro2 = { workspace = true } +quote = { workspace = true } +syn = { workspace = true, features = ["full", "extra-traits"] } + [lints] workspace = true diff --git a/frozen-abi/Cargo.toml b/frozen-abi/Cargo.toml index ae94d121a..786024a82 100644 --- a/frozen-abi/Cargo.toml +++ b/frozen-abi/Cargo.toml @@ -9,6 +9,12 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[features] +default = [] +# activate the frozen-abi feature when we actually want to do frozen-abi testing, +# otherwise leave it off because it requires nightly Rust +frozen-abi = [] + [dependencies] bs58 = { workspace = true, features = ["alloc"] } bv = { workspace = true, features = ["serde"] } @@ -27,14 +33,8 @@ memmap2 = { workspace = true } [target.'cfg(not(target_os = "solana"))'.dev-dependencies] bitflags = { workspace = true, features = ["serde"] } serde_bytes = { workspace = true } -solana-logger = { workspace = true } serde_with = { workspace = true, features = ["macros"] } - -[features] -default = [] -# activate the frozen-abi feature when we actually want to do frozen-abi testing, -# otherwise leave it off because it requires nightly Rust -frozen-abi = [] +solana-logger = { workspace = true } [lints] workspace = true diff --git a/genesis-config/Cargo.toml b/genesis-config/Cargo.toml index 0e8819c94..5f64d3688 100644 --- a/genesis-config/Cargo.toml +++ b/genesis-config/Cargo.toml @@ -9,6 +9,26 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] +serde = [ + "dep:serde", + "dep:serde_derive", + "solana-account/serde", + "solana-clock/serde", + "solana-cluster-type/serde", + "solana-epoch-schedule/serde", + "solana-fee-calculator/serde", + "solana-inflation/serde", + "solana-poh-config/serde", + "solana-rent/serde", +] + [dependencies] bincode = { workspace = true } chrono = { workspace = true, features = ["alloc"] } @@ -40,25 +60,5 @@ solana-time-utils = { workspace = true } solana-genesis-config = { path = ".", features = ["serde"] } solana-pubkey = { workspace = true, features = ["rand"] } -[features] -frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] -serde = [ - "dep:serde", - "dep:serde_derive", - "solana-account/serde", - "solana-clock/serde", - "solana-cluster-type/serde", - "solana-epoch-schedule/serde", - "solana-fee-calculator/serde", - "solana-inflation/serde", - "solana-poh-config/serde", - "solana-rent/serde", -] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] - [lints] workspace = true diff --git a/hard-forks/Cargo.toml b/hard-forks/Cargo.toml index 659ebc8fa..5823fd932 100644 --- a/hard-forks/Cargo.toml +++ b/hard-forks/Cargo.toml @@ -9,18 +9,18 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } -[dependencies] -serde = { workspace = true, optional = true } -serde_derive = { workspace = true, optional = true } -solana-frozen-abi = { workspace = true, optional = true, features = ["frozen-abi"] } -solana-frozen-abi-macro = { workspace = true, optional = true, features = ["frozen-abi"] } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] [features] frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] serde = ["dep:serde", "dep:serde_derive"] -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] +[dependencies] +serde = { workspace = true, optional = true } +serde_derive = { workspace = true, optional = true } +solana-frozen-abi = { workspace = true, optional = true, features = ["frozen-abi"] } +solana-frozen-abi-macro = { workspace = true, optional = true, features = ["frozen-abi"] } [lints] workspace = true diff --git a/hash/Cargo.toml b/hash/Cargo.toml index 054e673ba..fc5274cc1 100644 --- a/hash/Cargo.toml +++ b/hash/Cargo.toml @@ -14,6 +14,16 @@ targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"] all-features = true rustdoc-args = ["--cfg=docsrs"] +[features] +borsh = ["dep:borsh", "std"] +bytemuck = ["dep:bytemuck", "dep:bytemuck_derive"] +default = ["std", "js"] +dev-context-only-utils = ["bs58/alloc"] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro", "std"] +js = ["dep:wasm-bindgen", "dep:js-sys"] +serde = ["dep:serde", "dep:serde_derive"] +std = [] + [dependencies] borsh = { workspace = true, optional = true } bs58 = { workspace = true, default-features = false } @@ -30,26 +40,12 @@ solana-frozen-abi-macro = { workspace = true, optional = true, features = [ ] } solana-sanitize = { workspace = true } -[dev-dependencies] -solana-hash = { path = ".", features = ["dev-context-only-utils"] } - [target.'cfg(target_arch = "wasm32")'.dependencies] js-sys = { workspace = true, optional = true } wasm-bindgen = { workspace = true, optional = true } -[features] -borsh = ["dep:borsh", "std"] -bytemuck = ["dep:bytemuck", "dep:bytemuck_derive"] -default = ["std", "js"] -dev-context-only-utils = ["bs58/alloc"] -frozen-abi = [ - "dep:solana-frozen-abi", - "dep:solana-frozen-abi-macro", - "std" -] -js = ["dep:wasm-bindgen", "dep:js-sys"] -serde = ["dep:serde", "dep:serde_derive"] -std = [] +[dev-dependencies] +solana-hash = { path = ".", features = ["dev-context-only-utils"] } [lints] workspace = true diff --git a/inflation/Cargo.toml b/inflation/Cargo.toml index c593d1926..693938bff 100644 --- a/inflation/Cargo.toml +++ b/inflation/Cargo.toml @@ -9,15 +9,15 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } -[dependencies] -serde = { workspace = true, optional = true } -serde_derive = { workspace = true, optional = true } -solana-frozen-abi = { workspace = true, optional = true } -solana-frozen-abi-macro = { workspace = true, optional = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] [features] frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] serde = ["dep:serde", "dep:serde_derive"] -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] +[dependencies] +serde = { workspace = true, optional = true } +serde_derive = { workspace = true, optional = true } +solana-frozen-abi = { workspace = true, optional = true } +solana-frozen-abi-macro = { workspace = true, optional = true } diff --git a/instruction/Cargo.toml b/instruction/Cargo.toml index bcb23e824..08ac5d037 100644 --- a/instruction/Cargo.toml +++ b/instruction/Cargo.toml @@ -9,26 +9,10 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } -[dependencies] -bincode = { workspace = true, optional = true } -borsh = { workspace = true, optional = true } -num-traits = { workspace = true } -serde = { workspace = true, optional = true } -serde_derive = { workspace = true, optional = true } -solana-frozen-abi = { workspace = true, optional = true } -solana-frozen-abi-macro = { workspace = true, optional = true } -solana-pubkey = { workspace = true, default-features = false } - -[target.'cfg(target_os = "solana")'.dependencies] -solana-define-syscall = { workspace = true } - -[target.'cfg(target_arch = "wasm32")'.dependencies] -getrandom = { workspace = true, optional = true, features = ["js", "wasm-bindgen"] } -js-sys = { workspace = true, optional = true } -wasm-bindgen = { workspace = true, optional = true } - -[dev-dependencies] -solana-instruction = { path = ".", features = ["borsh"] } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] [features] bincode = ["dep:bincode", "dep:serde"] @@ -47,17 +31,29 @@ js = [ "solana-instruction/js", "solana-pubkey/js", ] -serde = [ - "dep:serde", - "dep:serde_derive", - "solana-pubkey/serde", -] +serde = ["dep:serde", "dep:serde_derive", "solana-pubkey/serde"] std = [] -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] +[dependencies] +bincode = { workspace = true, optional = true } +borsh = { workspace = true, optional = true } +num-traits = { workspace = true } +serde = { workspace = true, optional = true } +serde_derive = { workspace = true, optional = true } +solana-frozen-abi = { workspace = true, optional = true } +solana-frozen-abi-macro = { workspace = true, optional = true } +solana-pubkey = { workspace = true, default-features = false } + +[target.'cfg(target_arch = "wasm32")'.dependencies] +getrandom = { workspace = true, optional = true, features = ["js", "wasm-bindgen"] } +js-sys = { workspace = true, optional = true } +wasm-bindgen = { workspace = true, optional = true } + +[target.'cfg(target_os = "solana")'.dependencies] +solana-define-syscall = { workspace = true } + +[dev-dependencies] +solana-instruction = { path = ".", features = ["borsh"] } [lints] workspace = true diff --git a/instructions-sysvar/Cargo.toml b/instructions-sysvar/Cargo.toml index a12bfea34..9ab8066d7 100644 --- a/instructions-sysvar/Cargo.toml +++ b/instructions-sysvar/Cargo.toml @@ -9,6 +9,14 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +dev-context-only-utils = ["dep:qualifier_attr"] + [dependencies] qualifier_attr = { workspace = true, optional = true } solana-account-info = { workspace = true } @@ -23,13 +31,5 @@ solana-sysvar-id = { workspace = true } [target.'cfg(not(target_os = "solana"))'.dependencies] bitflags = { workspace = true } -[features] -dev-context-only-utils = ["dep:qualifier_attr"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] - [lints] workspace = true diff --git a/keccak-hasher/Cargo.toml b/keccak-hasher/Cargo.toml index 8f66863fb..01faff511 100644 --- a/keccak-hasher/Cargo.toml +++ b/keccak-hasher/Cargo.toml @@ -14,6 +14,13 @@ targets = ["x86_64-unknown-linux-gnu"] all-features = true rustdoc-args = ["--cfg=docsrs"] +[features] +borsh = ["dep:borsh", "std"] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro", "std"] +serde = ["dep:serde", "dep:serde_derive"] +sha3 = ["dep:sha3"] +std = ["solana-hash/std"] + [dependencies] borsh = { workspace = true, optional = true } serde = { workspace = true, optional = true } @@ -37,12 +44,5 @@ sha3 = { workspace = true } sha3 = { workspace = true, optional = true } solana-define-syscall = { workspace = true } -[features] -borsh = ["dep:borsh", "std"] -frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro", "std"] -serde = ["dep:serde", "dep:serde_derive"] -sha3 = ["dep:sha3"] -std = ["solana-hash/std"] - [lints] workspace = true diff --git a/keypair/Cargo.toml b/keypair/Cargo.toml index 9301d4c79..0600a4f33 100644 --- a/keypair/Cargo.toml +++ b/keypair/Cargo.toml @@ -9,6 +9,19 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +js = ["dep:wasm-bindgen", "solana-pubkey/js"] +seed-derivable = [ + "dep:solana-derivation-path", + "dep:solana-seed-derivable", + "dep:ed25519-dalek-bip32", +] + [dependencies] bs58 = { workspace = true, features = ["std"] } ed25519-dalek = { workspace = true } @@ -28,12 +41,3 @@ wasm-bindgen = { workspace = true, optional = true } serde_json = { workspace = true } static_assertions = { workspace = true } tiny-bip39 = { workspace = true } - -[features] -js = ["dep:wasm-bindgen", "solana-pubkey/js"] -seed-derivable = ["dep:solana-derivation-path", "dep:solana-seed-derivable", "dep:ed25519-dalek-bip32"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] diff --git a/loader-v2-interface/Cargo.toml b/loader-v2-interface/Cargo.toml index 682089f3e..95a49b0bd 100644 --- a/loader-v2-interface/Cargo.toml +++ b/loader-v2-interface/Cargo.toml @@ -9,6 +9,15 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +bincode = ["dep:solana-instruction", "serde"] +serde = ["dep:serde", "dep:serde_bytes", "dep:serde_derive"] + [dependencies] serde = { workspace = true, optional = true } serde_bytes = { workspace = true, optional = true } @@ -17,14 +26,5 @@ solana-instruction = { workspace = true, features = ["bincode", "std"], optional solana-pubkey = { workspace = true } solana-sdk-ids = { workspace = true } -[features] -bincode = ["dep:solana-instruction", "serde"] -serde = ["dep:serde", "dep:serde_bytes", "dep:serde_derive"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] - [lints] workspace = true diff --git a/loader-v3-interface/Cargo.toml b/loader-v3-interface/Cargo.toml index bfc052f4f..7246a2a03 100644 --- a/loader-v3-interface/Cargo.toml +++ b/loader-v3-interface/Cargo.toml @@ -9,6 +9,17 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +bincode = ["dep:solana-system-interface", "serde", "solana-instruction/bincode"] +dev-context-only-utils = ["bincode"] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro", "serde"] +serde = ["dep:serde", "dep:serde_bytes", "dep:serde_derive", "solana-pubkey/serde"] + [dependencies] serde = { workspace = true, optional = true } serde_bytes = { workspace = true, optional = true } @@ -28,16 +39,5 @@ solana-system-interface = { workspace = true, features = ["bincode"], optional = bincode = { workspace = true } solana-loader-v3-interface = { path = ".", features = ["dev-context-only-utils"] } -[features] -bincode = ["dep:solana-system-interface", "serde", "solana-instruction/bincode"] -dev-context-only-utils = ["bincode"] -frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro", "serde"] -serde = ["dep:serde", "dep:serde_bytes", "dep:serde_derive", "solana-pubkey/serde"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] - [lints] workspace = true diff --git a/loader-v4-interface/Cargo.toml b/loader-v4-interface/Cargo.toml index 0a97f7ec6..98166dcfd 100644 --- a/loader-v4-interface/Cargo.toml +++ b/loader-v4-interface/Cargo.toml @@ -9,6 +9,17 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +bincode = ["dep:solana-system-interface", "serde", "solana-instruction/bincode"] +dev-context-only-utils = ["bincode"] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro", "serde"] +serde = ["dep:serde", "dep:serde_bytes", "dep:serde_derive", "solana-pubkey/serde"] + [dependencies] serde = { workspace = true, optional = true } serde_bytes = { workspace = true, optional = true } @@ -28,16 +39,5 @@ solana-system-interface = { workspace = true, features = ["bincode"], optional = memoffset = { workspace = true } solana-loader-v4-interface = { path = ".", features = ["dev-context-only-utils"] } -[features] -bincode = ["dep:solana-system-interface", "serde", "solana-instruction/bincode"] -dev-context-only-utils = ["bincode"] -frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro", "serde"] -serde = ["dep:serde", "dep:serde_bytes", "dep:serde_derive", "solana-pubkey/serde"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] - [lints] workspace = true diff --git a/logger/Cargo.toml b/logger/Cargo.toml index adb1b614a..914e18265 100644 --- a/logger/Cargo.toml +++ b/logger/Cargo.toml @@ -9,6 +9,12 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[lib] +name = "solana_logger" + [dependencies] env_logger = { workspace = true } lazy_static = { workspace = true } @@ -17,9 +23,3 @@ log = { workspace = true } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] libc = { workspace = true } signal-hook = { workspace = true } - -[lib] -name = "solana_logger" - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] diff --git a/message/Cargo.toml b/message/Cargo.toml index 62ac0a683..fdaa8341e 100644 --- a/message/Cargo.toml +++ b/message/Cargo.toml @@ -9,6 +9,43 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +bincode = [ + "dep:bincode", + "dep:solana-bincode", + "dep:solana-system-interface", + "serde", +] +blake3 = ["dep:blake3"] +default = ["js"] +dev-context-only-utils = ["bincode", "blake3"] +frozen-abi = [ + "dep:solana-frozen-abi", + "dep:solana-frozen-abi-macro", + "dep:solana-logger", + "solana-hash/frozen-abi", + "solana-pubkey/frozen-abi", +] +js = [ + "dep:wasm-bindgen", + "solana-instruction/js", + "solana-message/js", + "solana-program/js", + "solana-pubkey/js", +] +serde = [ + "dep:serde", + "dep:serde_derive", + "dep:solana-short-vec", + "solana-hash/serde", + "solana-pubkey/serde", +] + [dependencies] bincode = { workspace = true, optional = true } blake3 = { workspace = true, features = ["traits-preview"], optional = true } @@ -46,42 +83,5 @@ solana-sha256-hasher = { workspace = true } solana-sysvar = { workspace = true } static_assertions = { workspace = true } -[features] -bincode = [ - "dep:bincode", - "dep:solana-bincode", - "dep:solana-system-interface", - "serde", -] -blake3 = ["dep:blake3"] -default = ["js"] -dev-context-only-utils = ["bincode", "blake3"] -frozen-abi = [ - "dep:solana-frozen-abi", - "dep:solana-frozen-abi-macro", - "dep:solana-logger", - "solana-hash/frozen-abi", - "solana-pubkey/frozen-abi", -] -js = [ - "dep:wasm-bindgen", - "solana-instruction/js", - "solana-message/js", - "solana-program/js", - "solana-pubkey/js", -] -serde = [ - "dep:serde", - "dep:serde_derive", - "dep:solana-short-vec", - "solana-hash/serde", - "solana-pubkey/serde", -] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] - [lints] workspace = true diff --git a/msg/Cargo.toml b/msg/Cargo.toml index eadd984b0..3a7cc8535 100644 --- a/msg/Cargo.toml +++ b/msg/Cargo.toml @@ -9,11 +9,11 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } -[target.'cfg(target_os = "solana")'.dependencies] -solana-define-syscall = { workspace = true } - [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] +[target.'cfg(target_os = "solana")'.dependencies] +solana-define-syscall = { workspace = true } + [lints] workspace = true diff --git a/nonce/Cargo.toml b/nonce/Cargo.toml index 5943a3f25..8b053d170 100644 --- a/nonce/Cargo.toml +++ b/nonce/Cargo.toml @@ -9,17 +9,10 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } -[dependencies] -serde = { workspace = true, optional = true } -serde_derive = { workspace = true, optional = true } -solana-fee-calculator = { workspace = true } -solana-hash = { workspace = true, default-features = false } -solana-pubkey = { workspace = true, default-features = false } -solana-sha256-hasher = { workspace = true } - -[dev-dependencies] -bincode = { workspace = true } -solana-nonce = { path = ".", features = ["dev-context-only-utils"] } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] [features] dev-context-only-utils = ["serde"] @@ -31,7 +24,14 @@ serde = [ "solana-pubkey/serde", ] -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] +[dependencies] +serde = { workspace = true, optional = true } +serde_derive = { workspace = true, optional = true } +solana-fee-calculator = { workspace = true } +solana-hash = { workspace = true, default-features = false } +solana-pubkey = { workspace = true, default-features = false } +solana-sha256-hasher = { workspace = true } + +[dev-dependencies] +bincode = { workspace = true } +solana-nonce = { path = ".", features = ["dev-context-only-utils"] } diff --git a/offchain-message/Cargo.toml b/offchain-message/Cargo.toml index fcf2ddf3e..0933cc009 100644 --- a/offchain-message/Cargo.toml +++ b/offchain-message/Cargo.toml @@ -9,6 +9,15 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +dev-context-only-utils = ["verify"] +verify = ["dep:solana-pubkey", "solana-signature/verify"] + [dependencies] num_enum = { workspace = true } solana-hash = { workspace = true } @@ -23,12 +32,3 @@ solana-signer = { workspace = true } solana-keypair = { workspace = true } solana-offchain-message = { path = ".", features = ["dev-context-only-utils"] } static_assertions = { workspace = true } - -[features] -dev-context-only-utils = ["verify"] -verify = ["dep:solana-pubkey", "solana-signature/verify"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] diff --git a/package-metadata-macro/Cargo.toml b/package-metadata-macro/Cargo.toml index a26f44970..ba756b4b9 100644 --- a/package-metadata-macro/Cargo.toml +++ b/package-metadata-macro/Cargo.toml @@ -9,6 +9,9 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [lib] proc-macro = true @@ -17,6 +20,3 @@ proc-macro2 = { workspace = true } quote = { workspace = true } syn = { workspace = true, features = ["full"] } toml = { workspace = true } - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] diff --git a/package-metadata/Cargo.toml b/package-metadata/Cargo.toml index 3a55b383a..459751a0b 100644 --- a/package-metadata/Cargo.toml +++ b/package-metadata/Cargo.toml @@ -9,9 +9,9 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] solana-package-metadata-macro = { workspace = true } solana-pubkey = { workspace = true } - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] diff --git a/packet/Cargo.toml b/packet/Cargo.toml index 2817b9b6e..92b3f5feb 100644 --- a/packet/Cargo.toml +++ b/packet/Cargo.toml @@ -9,6 +9,23 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +bincode = ["dep:bincode", "serde"] +dev-context-only-utils = ["bincode"] +serde = [ + "bitflags/serde", + "dep:cfg_eval", + "dep:serde", + "dep:serde_derive", + "dep:serde_with", +] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] + [dependencies] bincode = { workspace = true, optional = true } bitflags = { workspace = true } @@ -23,22 +40,5 @@ solana-frozen-abi-macro = { workspace = true, optional = true, features = ["froz solana-packet = { path = ".", features = ["dev-context-only-utils"] } static_assertions = { workspace = true } -[features] -bincode = ["dep:bincode", "serde"] -dev-context-only-utils = ["bincode"] -serde = [ - "bitflags/serde", - "dep:cfg_eval", - "dep:serde", - "dep:serde_derive", - "dep:serde_with" -] -frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] - [lints] workspace = true diff --git a/poh-config/Cargo.toml b/poh-config/Cargo.toml index 2d2b63ca6..943a2876d 100644 --- a/poh-config/Cargo.toml +++ b/poh-config/Cargo.toml @@ -14,6 +14,10 @@ targets = ["x86_64-unknown-linux-gnu"] all-features = true rustdoc-args = ["--cfg=docsrs"] +[features] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] +serde = ["dep:serde", "dep:serde_derive"] + [dependencies] serde = { workspace = true, optional = true } serde_derive = { workspace = true, optional = true } @@ -28,12 +32,5 @@ solana-frozen-abi-macro = { workspace = true, optional = true, features = [ solana-clock = { workspace = true } static_assertions = { workspace = true } -[features] -frozen-abi = [ - "dep:solana-frozen-abi", - "dep:solana-frozen-abi-macro", -] -serde = ["dep:serde", "dep:serde_derive"] - [lints] workspace = true diff --git a/precompile-error/Cargo.toml b/precompile-error/Cargo.toml index 931fddb4c..ae8810abd 100644 --- a/precompile-error/Cargo.toml +++ b/precompile-error/Cargo.toml @@ -9,9 +9,9 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] num-traits = { workspace = true } solana-decode-error = { workspace = true } - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] diff --git a/precompiles/Cargo.toml b/precompiles/Cargo.toml index acd533ae6..ee42e4044 100644 --- a/precompiles/Cargo.toml +++ b/precompiles/Cargo.toml @@ -9,6 +9,15 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +# Enables the "vendored" feature of openssl inside of secp256r1-program +openssl-vendored = ["solana-secp256r1-program/openssl-vendored"] + [dependencies] lazy_static = { workspace = true } solana-ed25519-program = { workspace = true } @@ -20,14 +29,5 @@ solana-sdk-ids = { workspace = true } solana-secp256k1-program = { workspace = true, features = ["bincode"] } solana-secp256r1-program = { workspace = true, default-features = false } -[features] -# Enables the "vendored" feature of openssl inside of secp256r1-program -openssl-vendored = ["solana-secp256r1-program/openssl-vendored"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] - [lints] workspace = true diff --git a/presigner/Cargo.toml b/presigner/Cargo.toml index 5f9929b04..89ced3b1d 100644 --- a/presigner/Cargo.toml +++ b/presigner/Cargo.toml @@ -9,6 +9,9 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] solana-pubkey = { workspace = true } solana-signature = { workspace = true, features = ["verify"] } @@ -16,6 +19,3 @@ solana-signer = { workspace = true } [dev-dependencies] solana-keypair = { workspace = true } - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] diff --git a/program-entrypoint/Cargo.toml b/program-entrypoint/Cargo.toml index 5d5fbc458..597e97dc8 100644 --- a/program-entrypoint/Cargo.toml +++ b/program-entrypoint/Cargo.toml @@ -9,11 +9,11 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] solana-account-info = { workspace = true } solana-msg = { workspace = true } solana-program-error = { workspace = true } solana-pubkey = { workspace = true, default-features = false } - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] diff --git a/program-error/Cargo.toml b/program-error/Cargo.toml index 88f24a9db..48e79a2a3 100644 --- a/program-error/Cargo.toml +++ b/program-error/Cargo.toml @@ -9,6 +9,15 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +borsh = ["dep:borsh"] +serde = ["dep:serde", "dep:serde_derive"] + [dependencies] borsh = { workspace = true, optional = true } num-traits = { workspace = true } @@ -20,12 +29,3 @@ solana-instruction = { workspace = true, default-features = false, features = [ ] } solana-msg = { workspace = true } solana-pubkey = { workspace = true, default-features = false } - -[features] -borsh = ["dep:borsh"] -serde = ["dep:serde", "dep:serde_derive"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] diff --git a/program-pack/Cargo.toml b/program-pack/Cargo.toml index 298715799..a0ddf5519 100644 --- a/program-pack/Cargo.toml +++ b/program-pack/Cargo.toml @@ -9,8 +9,8 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } -[dependencies] -solana-program-error = { workspace = true } - [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +solana-program-error = { workspace = true } diff --git a/program/Cargo.toml b/program/Cargo.toml index 1b8ec8051..f6577668d 100644 --- a/program/Cargo.toml +++ b/program/Cargo.toml @@ -12,6 +12,50 @@ edition = { workspace = true } rust-version = "1.79.0" # solana platform-tools rust version include = ["src/**/*", "README.md"] +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[lib] +crate-type = ["cdylib", "rlib"] + +[features] +default = ["borsh", "js"] +borsh = [ + "dep:borsh", + "dep:borsh0-10", + "dep:solana-borsh", + "solana-hash/borsh", + "solana-instruction/borsh", + "solana-program-error/borsh", + "solana-pubkey/borsh", + "solana-stake-interface/borsh", +] +dev-context-only-utils = ["solana-instructions-sysvar/dev-context-only-utils"] +frozen-abi = [ + "dep:solana-frozen-abi", + "dep:solana-frozen-abi-macro", + "solana-epoch-rewards/frozen-abi", + "solana-epoch-schedule/frozen-abi", + "solana-fee-calculator/frozen-abi", + "solana-hash/frozen-abi", + "solana-instruction/frozen-abi", + "solana-message/frozen-abi", + "solana-pubkey/frozen-abi", + "solana-rent/frozen-abi", + "solana-short-vec/frozen-abi", + "solana-stake-interface/frozen-abi", + "solana-sysvar/frozen-abi", +] +js = [ + "dep:getrandom", + "dep:wasm-bindgen", + "solana-instruction/js", + "solana-message/js", + "solana-pubkey/js", +] + [dependencies] bincode = { workspace = true } blake3 = { workspace = true, features = ["traits-preview"] } @@ -88,31 +132,27 @@ solana-sysvar-id = { workspace = true } solana-vote-interface = { workspace = true, features = ["bincode"] } thiserror = { workspace = true } -# This is currently needed to build on-chain programs reliably. -# Borsh 0.10 may pull in hashbrown 0.13, which uses ahash 0.8, which uses -# getrandom 0.2 underneath. This explicit dependency allows for no-std if cargo -# upgrades Borsh's dependency to hashbrown 0.13. -# Remove this once borsh 0.11 or 1.0 is released, which correctly declares the -# hashbrown dependency as optional. -[target.'cfg(target_os = "solana")'.dependencies] -getrandom = { workspace = true, features = ["custom"] } -solana-define-syscall = { workspace = true } - [target.'cfg(not(target_os = "solana"))'.dependencies] num-bigint = { workspace = true } rand = { workspace = true } solana-example-mocks = { workspace = true } -[target.'cfg(not(target_os = "solana"))'.dev-dependencies] -arbitrary = { workspace = true, features = ["derive"] } -solana-logger = { workspace = true } - [target.'cfg(target_arch = "wasm32")'.dependencies] console_error_panic_hook = { workspace = true } console_log = { workspace = true } getrandom = { workspace = true, optional = true, features = ["js", "wasm-bindgen"] } wasm-bindgen = { workspace = true, optional = true } +# This is currently needed to build on-chain programs reliably. +# Borsh 0.10 may pull in hashbrown 0.13, which uses ahash 0.8, which uses +# getrandom 0.2 underneath. This explicit dependency allows for no-std if cargo +# upgrades Borsh's dependency to hashbrown 0.13. +# Remove this once borsh 0.11 or 1.0 is released, which correctly declares the +# hashbrown dependency as optional. +[target.'cfg(target_os = "solana")'.dependencies] +getrandom = { workspace = true, features = ["custom"] } +solana-define-syscall = { workspace = true } + [dev-dependencies] array-bytes = { workspace = true } assert_matches = { workspace = true } @@ -121,49 +161,9 @@ serde_json = { workspace = true } solana-pubkey = { workspace = true, features = ["dev-context-only-utils"] } solana-sysvar = { workspace = true, features = ["dev-context-only-utils"] } -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] - -[lib] -crate-type = ["cdylib", "rlib"] - -[features] -default = ["borsh", "js"] -borsh = [ - "dep:borsh", - "dep:borsh0-10", - "dep:solana-borsh", - "solana-hash/borsh", - "solana-instruction/borsh", - "solana-program-error/borsh", - "solana-pubkey/borsh", - "solana-stake-interface/borsh", -] -dev-context-only-utils = ["solana-instructions-sysvar/dev-context-only-utils"] -frozen-abi = [ - "dep:solana-frozen-abi", - "dep:solana-frozen-abi-macro", - "solana-epoch-rewards/frozen-abi", - "solana-epoch-schedule/frozen-abi", - "solana-fee-calculator/frozen-abi", - "solana-hash/frozen-abi", - "solana-instruction/frozen-abi", - "solana-message/frozen-abi", - "solana-pubkey/frozen-abi", - "solana-rent/frozen-abi", - "solana-short-vec/frozen-abi", - "solana-stake-interface/frozen-abi", - "solana-sysvar/frozen-abi" -] -js = [ - "dep:getrandom", - "dep:wasm-bindgen", - "solana-instruction/js", - "solana-message/js", - "solana-pubkey/js", -] +[target.'cfg(not(target_os = "solana"))'.dev-dependencies] +arbitrary = { workspace = true, features = ["derive"] } +solana-logger = { workspace = true } [lints] workspace = true diff --git a/pubkey/Cargo.toml b/pubkey/Cargo.toml index 102b47346..8941ee901 100644 --- a/pubkey/Cargo.toml +++ b/pubkey/Cargo.toml @@ -9,6 +9,30 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +borsh = ["dep:borsh", "dep:borsh0-10", "std"] +bytemuck = ["dep:bytemuck", "dep:bytemuck_derive"] +curve25519 = ["dep:curve25519-dalek", "sha2"] +default = ["std", "js"] +dev-context-only-utils = ["dep:arbitrary", "rand"] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro", "std"] +js = [ + "dep:getrandom", + "dep:wasm-bindgen", + "dep:js-sys", + "solana-program/js", + "solana-pubkey/js", +] +rand = ["dep:rand", "std"] +serde = ["dep:serde", "dep:serde_derive"] +sha2 = ["dep:solana-sha256-hasher", "solana-sha256-hasher/sha2"] +std = [] + [dependencies] arbitrary = { workspace = true, features = ["derive"], optional = true } borsh = { workspace = true, optional = true } @@ -31,10 +55,6 @@ solana-frozen-abi-macro = { workspace = true, optional = true, features = [ ] } solana-sanitize = { workspace = true } -[target.'cfg(target_os = "solana")'.dependencies] -solana-define-syscall = { workspace = true } -solana-sha256-hasher = { workspace = true } - [target.'cfg(not(target_os = "solana"))'.dependencies] curve25519-dalek = { workspace = true, optional = true } solana-sha256-hasher = { workspace = true, optional = true } @@ -44,6 +64,10 @@ getrandom = { workspace = true, optional = true, features = ["js", "wasm-bindgen js-sys = { workspace = true, optional = true } wasm-bindgen = { workspace = true, optional = true } +[target.'cfg(target_os = "solana")'.dependencies] +solana-define-syscall = { workspace = true } +solana-sha256-hasher = { workspace = true } + [dev-dependencies] anyhow = { workspace = true } arbitrary = { workspace = true, features = ["derive"] } @@ -60,33 +84,5 @@ solana-pubkey = { path = ".", features = [ strum = { workspace = true } strum_macros = { workspace = true } -[features] -borsh = ["dep:borsh", "dep:borsh0-10", "std"] -bytemuck = ["dep:bytemuck", "dep:bytemuck_derive"] -curve25519 = ["dep:curve25519-dalek", "sha2"] -default = ["std", "js"] -dev-context-only-utils = ["dep:arbitrary", "rand"] -frozen-abi = [ - "dep:solana-frozen-abi", - "dep:solana-frozen-abi-macro", - "std", -] -js = [ - "dep:getrandom", - "dep:wasm-bindgen", - "dep:js-sys", - "solana-program/js", - "solana-pubkey/js", -] -rand = ["dep:rand", "std"] -serde = ["dep:serde", "dep:serde_derive"] -sha2 = ["dep:solana-sha256-hasher", "solana-sha256-hasher/sha2"] -std = [] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] - [lints] workspace = true diff --git a/quic-definitions/Cargo.toml b/quic-definitions/Cargo.toml index fece1f45c..6d299a293 100644 --- a/quic-definitions/Cargo.toml +++ b/quic-definitions/Cargo.toml @@ -9,11 +9,11 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } -[dependencies] -solana-keypair = { workspace = true } - [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] +[dependencies] +solana-keypair = { workspace = true } + [lints] workspace = true diff --git a/rent-collector/Cargo.toml b/rent-collector/Cargo.toml index 01d68205b..b664c6351 100644 --- a/rent-collector/Cargo.toml +++ b/rent-collector/Cargo.toml @@ -9,6 +9,20 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] +serde = [ + "dep:serde", + "dep:serde_derive", + "solana-epoch-schedule/serde", + "solana-rent/serde", +] + [dependencies] serde = { workspace = true, optional = true } serde_derive = { workspace = true, optional = true } @@ -27,19 +41,5 @@ assert_matches = { workspace = true } solana-logger = { workspace = true } solana-pubkey = { workspace = true, features = ["rand"] } -[features] -frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] -serde = [ - "dep:serde", - "dep:serde_derive", - "solana-epoch-schedule/serde", - "solana-rent/serde", -] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] - [lints] workspace = true diff --git a/rent-debits/Cargo.toml b/rent-debits/Cargo.toml index e9d155f70..d2b2b5e9c 100644 --- a/rent-debits/Cargo.toml +++ b/rent-debits/Cargo.toml @@ -9,17 +9,17 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } -[dependencies] -solana-pubkey = { workspace = true } -solana-reward-info = { workspace = true } - -[features] -dev-context-only-utils = [] - [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] all-features = true rustdoc-args = ["--cfg=docsrs"] +[features] +dev-context-only-utils = [] + +[dependencies] +solana-pubkey = { workspace = true } +solana-reward-info = { workspace = true } + [lints] workspace = true diff --git a/rent/Cargo.toml b/rent/Cargo.toml index 418a9e3f9..7dfa013c7 100644 --- a/rent/Cargo.toml +++ b/rent/Cargo.toml @@ -9,6 +9,14 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[features] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] +serde = ["dep:serde", "dep:serde_derive"] +sysvar = ["dep:solana-sdk-ids", "dep:solana-sysvar-id"] + [dependencies] serde = { workspace = true, optional = true } serde_derive = { workspace = true, optional = true } @@ -22,13 +30,5 @@ solana-sysvar-id = { workspace = true, optional = true } solana-clock = { workspace = true } static_assertions = { workspace = true } -[features] -frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] -serde = ["dep:serde", "dep:serde_derive"] -sysvar = ["dep:solana-sdk-ids", "dep:solana-sysvar-id"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - [lints] workspace = true diff --git a/reserved-account-keys/Cargo.toml b/reserved-account-keys/Cargo.toml index c99cba983..cbea30303 100644 --- a/reserved-account-keys/Cargo.toml +++ b/reserved-account-keys/Cargo.toml @@ -9,6 +9,14 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] + [dependencies] lazy_static = { workspace = true } solana-feature-set = { workspace = true } @@ -25,13 +33,5 @@ solana-sdk-ids = { workspace = true } solana-message = { workspace = true } solana-sysvar = { workspace = true } -[features] -frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] - [lints] workspace = true diff --git a/reward-info/Cargo.toml b/reward-info/Cargo.toml index 5dfc77732..e3b55141b 100644 --- a/reward-info/Cargo.toml +++ b/reward-info/Cargo.toml @@ -9,15 +9,15 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } -[dependencies] -serde = { workspace = true, optional = true } -serde_derive = { workspace = true, optional = true } -solana-frozen-abi = { workspace = true, optional = true } -solana-frozen-abi-macro = { workspace = true, optional = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] [features] frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] serde = ["dep:serde", "dep:serde_derive"] -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] +[dependencies] +serde = { workspace = true, optional = true } +serde_derive = { workspace = true, optional = true } +solana-frozen-abi = { workspace = true, optional = true } +solana-frozen-abi-macro = { workspace = true, optional = true } diff --git a/sdk-ids/Cargo.toml b/sdk-ids/Cargo.toml index 249ce27f0..c43d77647 100644 --- a/sdk-ids/Cargo.toml +++ b/sdk-ids/Cargo.toml @@ -9,11 +9,11 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } -[dependencies] -solana-pubkey = { workspace = true, default-features = false } - [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] +[dependencies] +solana-pubkey = { workspace = true, default-features = false } + [lints] workspace = true diff --git a/sdk-macro/Cargo.toml b/sdk-macro/Cargo.toml index 7dc46aa04..5b2b807d5 100644 --- a/sdk-macro/Cargo.toml +++ b/sdk-macro/Cargo.toml @@ -9,6 +9,9 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [lib] proc-macro = true @@ -17,6 +20,3 @@ bs58 = { workspace = true, features = ["alloc"] } proc-macro2 = { workspace = true } quote = { workspace = true } syn = { workspace = true, features = ["full"] } - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index c31ea36d8..67afbec28 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -11,6 +11,14 @@ license = { workspace = true } edition = { workspace = true } include = ["src/**/*", "README.md"] +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[lib] +crate-type = ["cdylib", "rlib"] + [features] js = [ "dep:getrandom", @@ -89,7 +97,7 @@ frozen-abi = [ "solana-short-vec/frozen-abi", "solana-signature/frozen-abi", "solana-transaction/frozen-abi", - "solana-transaction-error/frozen-abi" + "solana-transaction-error/frozen-abi", ] # Enables the "vendored" feature of openssl inside of secp256r1-program openssl-vendored = ["solana-precompiles/openssl-vendored"] @@ -203,13 +211,5 @@ solana-instructions-sysvar = { workspace = true, features = ["dev-context-only-u solana-program = { workspace = true, features = ["dev-context-only-utils"] } solana-sdk = { path = ".", features = ["dev-context-only-utils"] } -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] - -[lib] -crate-type = ["cdylib", "rlib"] - [lints] workspace = true diff --git a/secp256k1-program/Cargo.toml b/secp256k1-program/Cargo.toml index e0440293d..e7862edd0 100644 --- a/secp256k1-program/Cargo.toml +++ b/secp256k1-program/Cargo.toml @@ -9,6 +9,23 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +bincode = [ + "dep:bincode", + "dep:solana-feature-set", + "dep:solana-instruction", + "dep:solana-precompile-error", + "dep:solana-sdk-ids", + "serde", +] +dev-context-only-utils = ["bincode"] +serde = ["dep:serde", "dep:serde_derive"] + [dependencies] bincode = { workspace = true, optional = true } digest = { workspace = true } @@ -36,20 +53,3 @@ solana-program-error = { workspace = true } solana-sdk = { path = "../sdk" } solana-secp256k1-program = { path = ".", features = ["dev-context-only-utils"] } solana-signer = { workspace = true } - -[features] -bincode = [ - "dep:bincode", - "dep:solana-feature-set", - "dep:solana-instruction", - "dep:solana-precompile-error", - "dep:solana-sdk-ids", - "serde", -] -dev-context-only-utils = ["bincode"] -serde = ["dep:serde", "dep:serde_derive"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] diff --git a/secp256k1-recover/Cargo.toml b/secp256k1-recover/Cargo.toml index 3fbe28bcd..edaea7d60 100644 --- a/secp256k1-recover/Cargo.toml +++ b/secp256k1-recover/Cargo.toml @@ -9,6 +9,13 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[features] +borsh = ["dep:borsh"] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] + [dependencies] borsh = { workspace = true, optional = true } solana-frozen-abi = { workspace = true, optional = true, features = [ @@ -19,12 +26,12 @@ solana-frozen-abi-macro = { workspace = true, optional = true, features = [ ] } thiserror = { workspace = true } -[target.'cfg(target_os = "solana")'.dependencies] -solana-define-syscall = { workspace = true } - [target.'cfg(not(target_os = "solana"))'.dependencies] libsecp256k1 = { workspace = true } +[target.'cfg(target_os = "solana")'.dependencies] +solana-define-syscall = { workspace = true } + [dev-dependencies] anyhow = { workspace = true } borsh = { workspace = true } @@ -33,12 +40,5 @@ solana-program = { path = "../program" } [target.'cfg(not(target_os = "solana"))'.dev-dependencies] libsecp256k1 = { workspace = true, features = ["hmac"] } -[features] -borsh = ["dep:borsh"] -frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - [lints] workspace = true diff --git a/secp256r1-program/Cargo.toml b/secp256r1-program/Cargo.toml index 4bf47902c..205d5e32f 100644 --- a/secp256r1-program/Cargo.toml +++ b/secp256r1-program/Cargo.toml @@ -9,6 +9,15 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +default = [] +openssl-vendored = ["openssl/vendored"] + [dependencies] bytemuck = { workspace = true, features = ["derive"] } solana-feature-set = { workspace = true } @@ -16,21 +25,12 @@ solana-precompile-error = { workspace = true } solana-sdk-ids = { workspace = true } [target.'cfg(all(not(target_arch = "wasm32"), not(target_os = "solana")))'.dependencies] -solana-instruction = { workspace = true, features = ["std"] } openssl = { workspace = true } +solana-instruction = { workspace = true, features = ["std"] } [dev-dependencies] solana-logger = { workspace = true } solana-sdk = { path = "../sdk" } -[features] -default = [] -openssl-vendored = ["openssl/vendored"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] - [lints] workspace = true diff --git a/seed-derivable/Cargo.toml b/seed-derivable/Cargo.toml index fbdfe12d8..4bb678f85 100644 --- a/seed-derivable/Cargo.toml +++ b/seed-derivable/Cargo.toml @@ -9,8 +9,8 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } -[dependencies] -solana-derivation-path = { workspace = true } - [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +solana-derivation-path = { workspace = true } diff --git a/seed-phrase/Cargo.toml b/seed-phrase/Cargo.toml index 76b05cdf2..3a367dc93 100644 --- a/seed-phrase/Cargo.toml +++ b/seed-phrase/Cargo.toml @@ -9,10 +9,10 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] hmac = { workspace = true } pbkdf2 = { workspace = true } sha2 = { workspace = true } - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] diff --git a/serde-varint/Cargo.toml b/serde-varint/Cargo.toml index 7a7a6a8e6..1525b69f8 100644 --- a/serde-varint/Cargo.toml +++ b/serde-varint/Cargo.toml @@ -9,6 +9,9 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] serde = { workspace = true } @@ -17,6 +20,3 @@ bincode = { workspace = true } rand = { workspace = true } serde_derive = { workspace = true } solana-short-vec = { workspace = true } - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] diff --git a/serde/Cargo.toml b/serde/Cargo.toml index a5e34c93e..d5c0f2c9c 100644 --- a/serde/Cargo.toml +++ b/serde/Cargo.toml @@ -9,12 +9,12 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] serde = { workspace = true } [dev-dependencies] bincode = { workspace = true } serde_derive = { workspace = true } - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] diff --git a/serialize-utils/Cargo.toml b/serialize-utils/Cargo.toml index b9306f8f3..e29090c52 100644 --- a/serialize-utils/Cargo.toml +++ b/serialize-utils/Cargo.toml @@ -9,6 +9,9 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] solana-instruction = { workspace = true, default-features = false, features = [ "std", @@ -25,6 +28,3 @@ solana-pubkey = { workspace = true, default-features = false, features = [ "borsh", "serde", ] } - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] diff --git a/sha256-hasher/Cargo.toml b/sha256-hasher/Cargo.toml index 5d9077157..5951e38f5 100644 --- a/sha256-hasher/Cargo.toml +++ b/sha256-hasher/Cargo.toml @@ -12,6 +12,9 @@ edition = { workspace = true } [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] +[features] +sha2 = ["dep:sha2"] + [dependencies] solana-hash = { workspace = true } @@ -25,8 +28,5 @@ sha2 = { workspace = true } sha2 = { workspace = true, optional = true } solana-define-syscall = { workspace = true } -[features] -sha2 = ["dep:sha2"] - [lints] workspace = true diff --git a/short-vec/Cargo.toml b/short-vec/Cargo.toml index 306b5dc28..b1a880abd 100644 --- a/short-vec/Cargo.toml +++ b/short-vec/Cargo.toml @@ -9,6 +9,12 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[features] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] + [dependencies] serde = { workspace = true } solana-frozen-abi = { workspace = true, optional = true, features = [ @@ -23,11 +29,5 @@ assert_matches = { workspace = true } bincode = { workspace = true } serde_json = { workspace = true } -[features] -frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - [lints] workspace = true diff --git a/shred-version/Cargo.toml b/shred-version/Cargo.toml index 606183c88..a2b6896fb 100644 --- a/shred-version/Cargo.toml +++ b/shred-version/Cargo.toml @@ -9,13 +9,13 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] solana-hard-forks = { workspace = true } solana-hash = { workspace = true } solana-sha256-hasher = { workspace = true } -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - [lints] workspace = true diff --git a/signature/Cargo.toml b/signature/Cargo.toml index 47f6f2b6c..e39bf9fcb 100644 --- a/signature/Cargo.toml +++ b/signature/Cargo.toml @@ -9,6 +9,20 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +default = ["std", "alloc"] +alloc = [] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro", "std"] +rand = ["dep:rand"] +serde = ["dep:serde", "dep:serde_derive", "dep:serde-big-array"] +std = ["alloc"] +verify = ["dep:ed25519-dalek"] + [dependencies] bs58 = { workspace = true } ed25519-dalek = { workspace = true, optional = true } @@ -35,23 +49,5 @@ solana-pubkey = { workspace = true, features = ["std"] } solana-short-vec = { workspace = true } solana-signature = { path = ".", features = ["serde"] } -[features] -default = ["std", "alloc"] -alloc = [] -frozen-abi = [ - "dep:solana-frozen-abi", - "dep:solana-frozen-abi-macro", - "std" -] -rand = ["dep:rand"] -serde = ["dep:serde", "dep:serde_derive", "dep:serde-big-array"] -std = ["alloc"] -verify = ["dep:ed25519-dalek"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] - [lints] workspace = true diff --git a/signer/Cargo.toml b/signer/Cargo.toml index 87ae77a51..12fed1753 100644 --- a/signer/Cargo.toml +++ b/signer/Cargo.toml @@ -9,12 +9,12 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } -[dependencies] -solana-pubkey = { workspace = true } -solana-signature = { workspace = true } -solana-transaction-error = { workspace = true } - [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] all-features = true rustdoc-args = ["--cfg=docsrs"] + +[dependencies] +solana-pubkey = { workspace = true } +solana-signature = { workspace = true } +solana-transaction-error = { workspace = true } diff --git a/slot-hashes/Cargo.toml b/slot-hashes/Cargo.toml index d26d6d810..2b4a90e82 100644 --- a/slot-hashes/Cargo.toml +++ b/slot-hashes/Cargo.toml @@ -9,6 +9,13 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[features] +serde = ["dep:serde", "dep:serde_derive", "solana-hash/serde"] +sysvar = ["dep:solana-sdk-ids", "dep:solana-sysvar-id"] + [dependencies] serde = { workspace = true, optional = true } serde_derive = { workspace = true, optional = true } @@ -18,10 +25,3 @@ solana-sysvar-id = { workspace = true, optional = true } [dev-dependencies] solana-sha256-hasher = { workspace = true } - -[features] -serde = ["dep:serde", "dep:serde_derive", "solana-hash/serde"] -sysvar = ["dep:solana-sdk-ids", "dep:solana-sysvar-id"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] diff --git a/slot-history/Cargo.toml b/slot-history/Cargo.toml index 8e43978dd..b9e634de2 100644 --- a/slot-history/Cargo.toml +++ b/slot-history/Cargo.toml @@ -9,18 +9,18 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +serde = ["dep:serde", "dep:serde_derive", "bv/serde"] +sysvar = ["dep:solana-sdk-ids", "dep:solana-sysvar-id"] + [dependencies] bv = { workspace = true } serde = { workspace = true, optional = true } serde_derive = { workspace = true, optional = true } solana-sdk-ids = { workspace = true, optional = true } solana-sysvar-id = { workspace = true, optional = true } - -[features] -serde = ["dep:serde", "dep:serde_derive", "bv/serde"] -sysvar = ["dep:solana-sdk-ids", "dep:solana-sysvar-id"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] diff --git a/sysvar-id/Cargo.toml b/sysvar-id/Cargo.toml index beebc2a53..a86f5a349 100644 --- a/sysvar-id/Cargo.toml +++ b/sysvar-id/Cargo.toml @@ -9,14 +9,14 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } -[dependencies] -solana-pubkey = { workspace = true, default-features = false } -solana-sdk-ids = { workspace = true } - [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] all-features = true rustdoc-args = ["--cfg=docsrs"] +[dependencies] +solana-pubkey = { workspace = true, default-features = false } +solana-sdk-ids = { workspace = true } + [lints] workspace = true diff --git a/sysvar/Cargo.toml b/sysvar/Cargo.toml index 314455eda..1a96f7fc6 100644 --- a/sysvar/Cargo.toml +++ b/sysvar/Cargo.toml @@ -9,6 +9,34 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +bincode = ["dep:bincode", "serde", "solana-stake-interface/bincode"] +bytemuck = ["dep:bytemuck", "dep:bytemuck_derive"] +dev-context-only-utils = ["bincode", "bytemuck", "solana-instructions-sysvar/dev-context-only-utils"] +frozen-abi = [ + "dep:solana-frozen-abi", + "dep:solana-frozen-abi-macro", + "solana-stake-interface/frozen-abi", +] +serde = [ + "dep:serde", + "dep:serde_derive", + "solana-clock/serde", + "solana-epoch-rewards/serde", + "solana-epoch-schedule/serde", + "solana-fee-calculator/serde", + "solana-last-restart-slot/serde", + "solana-rent/serde", + "solana-slot-hashes/serde", + "solana-slot-history/serde", + "solana-stake-interface/serde", +] + [dependencies] bincode = { workspace = true, optional = true } bytemuck = { workspace = true, optional = true } @@ -56,33 +84,5 @@ solana-sha256-hasher = { workspace = true } solana-sysvar = { path = ".", features = ["dev-context-only-utils"] } test-case = { workspace = true } -[features] -bincode = ["dep:bincode", "serde", "solana-stake-interface/bincode"] -bytemuck = ["dep:bytemuck", "dep:bytemuck_derive"] -dev-context-only-utils = ["bincode", "bytemuck", "solana-instructions-sysvar/dev-context-only-utils"] -frozen-abi = [ - "dep:solana-frozen-abi", - "dep:solana-frozen-abi-macro", - "solana-stake-interface/frozen-abi" -] -serde = [ - "dep:serde", - "dep:serde_derive", - "solana-clock/serde", - "solana-epoch-rewards/serde", - "solana-epoch-schedule/serde", - "solana-fee-calculator/serde", - "solana-last-restart-slot/serde", - "solana-rent/serde", - "solana-slot-hashes/serde", - "solana-slot-history/serde", - "solana-stake-interface/serde", -] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] - [lints] workspace = true diff --git a/transaction-error/Cargo.toml b/transaction-error/Cargo.toml index 989990c83..0443a7fdd 100644 --- a/transaction-error/Cargo.toml +++ b/transaction-error/Cargo.toml @@ -9,6 +9,15 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] +serde = ["dep:serde", "dep:serde_derive", "solana-instruction/serde"] + [dependencies] serde = { workspace = true, optional = true } serde_derive = { workspace = true, optional = true } @@ -19,14 +28,5 @@ solana-instruction = { workspace = true, default-features = false, features = [ ] } solana-sanitize = { workspace = true } -[features] -frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] -serde = ["dep:serde", "dep:serde_derive", "solana-instruction/serde"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] - [lints] workspace = true diff --git a/transaction/Cargo.toml b/transaction/Cargo.toml index c358a9826..f2ac89089 100644 --- a/transaction/Cargo.toml +++ b/transaction/Cargo.toml @@ -9,6 +9,49 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +bincode = [ + "dep:bincode", + "dep:solana-bincode", + "dep:solana-signer", + "dep:solana-system-interface", + "serde", + "solana-message/bincode", +] +blake3 = ["bincode", "solana-message/blake3"] +default = ["js"] +dev-context-only-utils = ["blake3", "precompiles", "serde", "verify"] +frozen-abi = [ + "dep:solana-frozen-abi", + "dep:solana-frozen-abi-macro", + "dep:solana-logger", +] +js = [ + "dep:wasm-bindgen", + "dep:solana-keypair", + "solana-hash/js", + "solana-instruction/js", + "solana-keypair/js", + "solana-message/js", + "solana-program/js", + "solana-pubkey/js", + "solana-sdk/js", +] +precompiles = ["dep:solana-feature-set", "dep:solana-precompiles"] +serde = [ + "dep:serde", + "dep:serde_derive", + "dep:solana-short-vec", + "solana-message/serde", + "solana-signature/serde", +] +verify = ["blake3", "solana-signature/verify"] + [dependencies] bincode = { workspace = true, optional = true } serde = { workspace = true, optional = true } @@ -51,49 +94,3 @@ solana-sdk = { path = "../sdk" } solana-sha256-hasher = { workspace = true } solana-transaction = { path = ".", features = ["dev-context-only-utils"] } static_assertions = { workspace = true } - -[features] -bincode = [ - "dep:bincode", - "dep:solana-bincode", - "dep:solana-signer", - "dep:solana-system-interface", - "serde", - "solana-message/bincode", -] -blake3 = [ - "bincode", - "solana-message/blake3", -] -default = ["js"] -dev-context-only-utils = ["blake3", "precompiles", "serde", "verify"] -frozen-abi = [ - "dep:solana-frozen-abi", - "dep:solana-frozen-abi-macro", - "dep:solana-logger", -] -js = [ - "dep:wasm-bindgen", - "dep:solana-keypair", - "solana-hash/js", - "solana-instruction/js", - "solana-keypair/js", - "solana-message/js", - "solana-program/js", - "solana-pubkey/js", - "solana-sdk/js" -] -precompiles = ["dep:solana-feature-set", "dep:solana-precompiles"] -serde = [ - "dep:serde", - "dep:serde_derive", - "dep:solana-short-vec", - "solana-message/serde", - "solana-signature/serde", -] -verify = ["blake3", "solana-signature/verify"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] diff --git a/vote-interface/Cargo.toml b/vote-interface/Cargo.toml index 2432945a5..95dfe21c2 100644 --- a/vote-interface/Cargo.toml +++ b/vote-interface/Cargo.toml @@ -9,6 +9,40 @@ homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[features] +bincode = [ + "dep:bincode", + "dep:solana-serialize-utils", + "dep:solana-system-interface", + "serde", +] +dev-context-only-utils = [ + "bincode", + "dep:arbitrary", + "solana-pubkey/dev-context-only-utils", +] +frozen-abi = [ + "dep:solana-frozen-abi", + "dep:solana-frozen-abi-macro", + "serde", + "solana-hash/frozen-abi", + "solana-pubkey/frozen-abi", + "solana-short-vec/frozen-abi", +] +serde = [ + "dep:serde", + "dep:serde_derive", + "dep:solana-serde-varint", + "dep:solana-short-vec", + "solana-hash/serde", + "solana-pubkey/serde", +] + [dependencies] arbitrary = { workspace = true, features = ["derive"], optional = true } bincode = { workspace = true, optional = true } @@ -45,39 +79,5 @@ solana-logger = { workspace = true } solana-pubkey = { workspace = true, features = ["dev-context-only-utils"] } solana-vote-interface = { path = ".", features = ["dev-context-only-utils"] } -[features] -bincode = [ - "dep:bincode", - "dep:solana-serialize-utils", - "dep:solana-system-interface", - "serde" -] -dev-context-only-utils = [ - "bincode", - "dep:arbitrary", - "solana-pubkey/dev-context-only-utils", -] -frozen-abi = [ - "dep:solana-frozen-abi", - "dep:solana-frozen-abi-macro", - "serde", - "solana-hash/frozen-abi", - "solana-pubkey/frozen-abi", - "solana-short-vec/frozen-abi", -] -serde = [ - "dep:serde", - "dep:serde_derive", - "dep:solana-serde-varint", - "dep:solana-short-vec", - "solana-hash/serde", - "solana-pubkey/serde" -] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -all-features = true -rustdoc-args = ["--cfg=docsrs"] - [lints] workspace = true