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 d9fcb208c..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,25 +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 } -wasm-bindgen = { workspace = true } +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"] -dev-context-only-utils = ["bs58/alloc"] -frozen-abi = [ - "dep:solana-frozen-abi", - "dep:solana-frozen-abi-macro", - "std" -] -serde = ["dep:serde", "dep:serde_derive"] -std = [] +[dev-dependencies] +solana-hash = { path = ".", features = ["dev-context-only-utils"] } [lints] workspace = true diff --git a/hash/src/lib.rs b/hash/src/lib.rs index 46bc7dcc4..2dd51e7d9 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(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(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(target_arch = "wasm32")] +#[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(target_arch = "wasm32", 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(target_arch = "wasm32")] +#[cfg(all(feature = "js", target_arch = "wasm32"))] #[allow(non_snake_case)] #[wasm_bindgen] impl Hash { 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 dcf12d638..08ac5d037 100644 --- a/instruction/Cargo.toml +++ b/instruction/Cargo.toml @@ -9,6 +9,31 @@ 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:serde"] +borsh = ["dep:borsh"] +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", + "solana-instruction/js", + "solana-pubkey/js", +] +serde = ["dep:serde", "dep:serde_derive", "solana-pubkey/serde"] +std = [] + [dependencies] bincode = { workspace = true, optional = true } borsh = { workspace = true, optional = true } @@ -19,38 +44,16 @@ 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 } -[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"] } -[features] -bincode = ["dep:bincode", "dep:serde"] -borsh = ["dep:borsh"] -default = ["std"] -frozen-abi = [ - "dep:solana-frozen-abi", - "dep:solana-frozen-abi-macro", - "serde", - "std", -] -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"] - [lints] workspace = true diff --git a/instruction/src/lib.rs b/instruction/src/lib.rs index 673d379c7..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", target_arch = "wasm32"))] +#[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(target_arch = "wasm32")))] +#[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", target_arch = "wasm32"))] +#[cfg(all(feature = "std", feature = "js", target_arch = "wasm32"))] #[wasm_bindgen::prelude::wasm_bindgen] #[cfg_attr( feature = "serde", 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 ea754d842..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 } @@ -22,17 +35,9 @@ 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 } static_assertions = { workspace = true } tiny-bip39 = { workspace = true } - -[features] -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/keypair/src/lib.rs b/keypair/src/lib.rs index 58659881e..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(target_arch = "wasm32")] +#[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(target_arch = "wasm32", 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(target_arch = "wasm32")] +#[cfg(all(feature = "js", target_arch = "wasm32"))] #[allow(non_snake_case)] #[wasm_bindgen] impl Keypair { 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 38836507e..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 } @@ -31,7 +68,7 @@ solana-system-interface = { workspace = true, optional = true, features = [ 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 } @@ -46,34 +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"] -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", -] -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/message/src/legacy.rs b/message/src/legacy.rs index 1c467e9b7..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(target_arch = "wasm32")] +#[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(target_arch = "wasm32", 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( @@ -426,7 +426,7 @@ impl TryFrom<&[u8]> for Pubkey { } } -#[cfg(any(feature = "std", target_arch = "wasm32"))] +#[cfg(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(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(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(target_arch = "wasm32", 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,13 +1097,13 @@ 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", target_arch = "wasm32"))] #[allow(non_snake_case)] -#[cfg(target_arch = "wasm32")] #[wasm_bindgen] impl Pubkey { /// Create a new Pubkey object 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 c28c11458..67afbec28 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -11,7 +11,26 @@ 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", + "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 @@ -19,7 +38,8 @@ program = [] default = [ "borsh", - "full", # functionality that is not compatible or needed for on-chain programs + "js", + "full", # functionality that is not compatible or needed for on-chain programs ] full = [ "serde_json", @@ -77,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"] @@ -175,9 +195,9 @@ 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 } +getrandom = { version = "0.1.1", optional = true, features = ["wasm-bindgen"] } +js-sys = { workspace = true, optional = true } +wasm-bindgen = { workspace = true, optional = true } [dev-dependencies] curve25519-dalek = { workspace = true } @@ -191,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/sdk/src/lib.rs b/sdk/src/lib.rs index 65bc41fd4..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(target_arch = "wasm32")] +#[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 6946e730f..b65c00a85 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(all(feature = "js", target_arch = "wasm32"))] pub mod keypair; pub mod transaction; 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 1c92148e6..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 } @@ -32,8 +75,8 @@ solana-system-interface = { workspace = true, optional = true, features = ["binc solana-transaction-error = { workspace = true } [target.'cfg(target_arch = "wasm32")'.dependencies] -solana-keypair = { workspace = true } -wasm-bindgen = { workspace = true } +solana-keypair = { workspace = true, optional = true } +wasm-bindgen = { workspace = true, optional = true } [dev-dependencies] anyhow = { workspace = true } @@ -51,37 +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", -] -dev-context-only-utils = ["blake3", "precompiles", "serde", "verify"] -frozen-abi = [ - "dep:solana-frozen-abi", - "dep:solana-frozen-abi-macro", - "dep:solana-logger", -] -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/transaction/src/lib.rs b/transaction/src/lib.rs index 18baaf8b5..9d6b7ce1d 100644 --- a/transaction/src/lib.rs +++ b/transaction/src/lib.rs @@ -110,7 +110,7 @@ //! # Ok::<(), anyhow::Error>(()) //! ``` -#[cfg(target_arch = "wasm32")] +#[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(target_arch = "wasm32"))] +#[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(target_arch = "wasm32")] +#[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 cdfc5792b..fdf645ec2 100644 --- a/transaction/src/wasm.rs +++ b/transaction/src/wasm.rs @@ -1,5 +1,5 @@ //! `Transaction` Javascript interface -#![cfg(target_arch = "wasm32")] +#![cfg(all(feature = "js", target_arch = "wasm32"))] #![allow(non_snake_case)] use { crate::Transaction, solana_hash::Hash, solana_instruction::wasm::Instructions, 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