diff --git a/Cargo.lock b/Cargo.lock index 3836d8432f3db2..33c94d9b8e4cbc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -73,6 +73,7 @@ dependencies = [ "log", "rustc_version 0.4.0", "serde", + "serde_derive", "serde_json", "sha2 0.10.8", "solana-clap-utils", @@ -121,6 +122,7 @@ dependencies = [ "scopeguard", "semver 1.0.22", "serde", + "serde_derive", "serde_yaml 0.8.26", "serde_yaml 0.9.34+deprecated", "solana-clap-utils", @@ -156,6 +158,7 @@ dependencies = [ "rayon", "regex", "serde", + "serde_derive", "serde_json", "signal-hook", "solana-account-decoder", @@ -5459,7 +5462,6 @@ dependencies = [ "num-derive", "num-traits", "rustc_version 0.4.0", - "serde", "solana-frozen-abi", "solana-frozen-abi-macro", "solana-program", @@ -5525,6 +5527,7 @@ name = "solana-banks-interface" version = "2.0.0" dependencies = [ "serde", + "serde_derive", "solana-sdk", "tarpc", ] @@ -6533,6 +6536,7 @@ dependencies = [ "clap 3.2.23", "rand 0.8.5", "serde", + "serde_derive", "serde_json", "solana-logger", ] @@ -7319,6 +7323,7 @@ dependencies = [ "rand 0.8.5", "rustc_version 0.4.0", "serde", + "serde_derive", "solana-bpf-loader-program", "solana-frozen-abi", "solana-frozen-abi-macro", @@ -7404,6 +7409,7 @@ dependencies = [ "indicatif", "pickledb", "serde", + "serde_derive", "solana-account-decoder", "solana-clap-utils", "solana-cli-config", @@ -7715,6 +7721,7 @@ dependencies = [ "num-traits", "rand 0.7.3", "serde", + "serde_derive", "serde_json", "sha3 0.9.1", "solana-program", @@ -7769,6 +7776,7 @@ dependencies = [ "num-traits", "rand 0.7.3", "serde", + "serde_derive", "serde_json", "sha3 0.9.1", "solana-program", diff --git a/Cargo.toml b/Cargo.toml index 31f590274a20a3..a3b91c9ebd5760 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -298,9 +298,9 @@ rustversion = "1.0.14" scopeguard = "1.2.0" semver = "1.0.22" seqlock = "0.2.0" -serde = "1.0.197" +serde = "1.0.197" # must match the serde_derive version, see https://github.com/serde-rs/serde/issues/2584#issuecomment-1685252251 serde_bytes = "0.11.14" -serde_derive = "1.0.103" +serde_derive = "1.0.197" # must match the serde version, see https://github.com/serde-rs/serde/issues/2584#issuecomment-1685252251 serde_json = "1.0.115" serde_with = { version = "2.3.3", default-features = false } serde_yaml = "0.9.34" diff --git a/banks-interface/Cargo.toml b/banks-interface/Cargo.toml index 6bf995674c413d..47971646c9fb19 100644 --- a/banks-interface/Cargo.toml +++ b/banks-interface/Cargo.toml @@ -10,7 +10,8 @@ license = { workspace = true } edition = { workspace = true } [dependencies] -serde = { workspace = true, features = ["derive"] } +serde = { workspace = true } +serde_derive = { workspace = true } solana-sdk = { workspace = true } tarpc = { workspace = true, features = ["full"] } diff --git a/banks-interface/src/lib.rs b/banks-interface/src/lib.rs index 9e2e5092231ae4..d1cd7b867b514d 100644 --- a/banks-interface/src/lib.rs +++ b/banks-interface/src/lib.rs @@ -1,7 +1,7 @@ #![allow(deprecated)] use { - serde::{Deserialize, Serialize}, + serde_derive::{Deserialize, Serialize}, solana_sdk::{ account::Account, clock::Slot, diff --git a/cargo-registry/Cargo.toml b/cargo-registry/Cargo.toml index 395493a8e85f00..4b9ca6c0c61881 100644 --- a/cargo-registry/Cargo.toml +++ b/cargo-registry/Cargo.toml @@ -15,7 +15,8 @@ flate2 = { workspace = true } hex = { workspace = true } hyper = { workspace = true, features = ["full"] } log = { workspace = true } -serde = { workspace = true, features = ["derive"] } +serde = { workspace = true } +serde_derive = { workspace = true } serde_json = { workspace = true } sha2 = { workspace = true } solana-clap-utils = { workspace = true } diff --git a/cargo-registry/src/crate_handler.rs b/cargo-registry/src/crate_handler.rs index 0a0458b3e7e909..ad8aa003978939 100644 --- a/cargo-registry/src/crate_handler.rs +++ b/cargo-registry/src/crate_handler.rs @@ -9,7 +9,7 @@ use { }, hyper::body::Bytes, log::*, - serde::{Deserialize, Serialize}, + serde_derive::{Deserialize, Serialize}, serde_json::from_slice, sha2::{Digest, Sha256}, solana_cli::program_v4::{process_deploy_program, process_dump, read_and_verify_elf}, diff --git a/cargo-registry/src/sparse_index.rs b/cargo-registry/src/sparse_index.rs index 68ff4bfac1c6a0..8720da2250e037 100644 --- a/cargo-registry/src/sparse_index.rs +++ b/cargo-registry/src/sparse_index.rs @@ -5,7 +5,7 @@ use { response_builder, }, log::info, - serde::{Deserialize, Serialize}, + serde_derive::{Deserialize, Serialize}, std::{ collections::BTreeMap, sync::{Arc, RwLock}, diff --git a/frozen-abi/Cargo.toml b/frozen-abi/Cargo.toml index 1cbc1f06c3f793..fa850652f84cec 100644 --- a/frozen-abi/Cargo.toml +++ b/frozen-abi/Cargo.toml @@ -13,7 +13,7 @@ edition = { workspace = true } bs58 = { workspace = true } bv = { workspace = true, features = ["serde"] } log = { workspace = true, features = ["std"] } -serde = { workspace = true, features = ["derive", "rc"] } +serde = { workspace = true, features = ["rc"] } serde_derive = { workspace = true } sha2 = { workspace = true } solana-frozen-abi-macro = { workspace = true } diff --git a/frozen-abi/src/abi_digester.rs b/frozen-abi/src/abi_digester.rs index fee2b560e2b3a5..39ae3430b4c11c 100644 --- a/frozen-abi/src/abi_digester.rs +++ b/frozen-abi/src/abi_digester.rs @@ -542,22 +542,22 @@ mod tests { type TestTypeAlias = i32; #[frozen_abi(digest = "Apwkp9Ah9zKirzwuSzVoU9QRc43EghpkD1nGVakJLfUY")] - #[derive(Serialize, AbiExample)] + #[derive(serde_derive::Serialize, AbiExample)] struct TestStruct { test_field: i8, test_field2: i8, } #[frozen_abi(digest = "4LbuvQLX78XPbm4hqqZcHFHpseDJcw4qZL9EUZXSi2Ss")] - #[derive(Serialize, AbiExample)] + #[derive(serde_derive::Serialize, AbiExample)] struct TestTupleStruct(i8, i8); #[frozen_abi(digest = "FNHa6mNYJZa59Fwbipep5dXRXcFreaDHn9jEUZEH1YLv")] - #[derive(Serialize, AbiExample)] + #[derive(serde_derive::Serialize, AbiExample)] struct TestNewtypeStruct(i8); #[frozen_abi(digest = "Hbs1X2X7TF2gFEfsspwfZ1JKr8ZGbLY3uidQBebqcMYt")] - #[derive(Serialize, AbiExample)] + #[derive(serde_derive::Serialize, AbiExample)] struct Foo<'a> { #[serde(with = "serde_bytes")] data1: Vec, @@ -568,21 +568,21 @@ mod tests { } #[frozen_abi(digest = "5qio5qYurHDv6fq5kcwP2ue2RBEazSZF8CPk2kUuwC2j")] - #[derive(Serialize, AbiExample)] + #[derive(serde_derive::Serialize, AbiExample)] struct TestStructReversed { test_field2: i8, test_field: i8, } #[frozen_abi(digest = "DLLrTWprsMjdJGR447A4mui9HpqxbKdsFXBfaWPcwhny")] - #[derive(Serialize, AbiExample)] + #[derive(serde_derive::Serialize, AbiExample)] struct TestStructAnotherType { test_field: i16, test_field2: i8, } #[frozen_abi(digest = "GMeECsxg37a5qznstWXeeX3d6HXs6j12oB4SKaZZuNJk")] - #[derive(Serialize, AbiExample)] + #[derive(serde_derive::Serialize, AbiExample)] struct TestNest { nested_field: [TestStruct; 5], } @@ -591,26 +591,26 @@ mod tests { type TestUnitStruct = std::marker::PhantomData; #[frozen_abi(digest = "6kj3mPXbzWTwZho48kZWxZjuseLU2oiqhbpqca4DmcRq")] - #[derive(Serialize, AbiExample, AbiEnumVisitor)] + #[derive(serde_derive::Serialize, AbiExample, AbiEnumVisitor)] enum TestEnum { Variant1, Variant2, } #[frozen_abi(digest = "3WqYwnbQEdu6iPZi5LJa2b5kw55hxBtZdqFqiViFCKPo")] - #[derive(Serialize, AbiExample, AbiEnumVisitor)] + #[derive(serde_derive::Serialize, AbiExample, AbiEnumVisitor)] enum TestTupleVariant { Variant1(u8, u16), Variant2(u8, u16), } #[frozen_abi(digest = "4E9gJjvKiETBeZ8dybZPAQ7maaHTHFucmLqgX2m6yrBh")] - #[derive(Serialize, AbiExample)] + #[derive(serde_derive::Serialize, AbiExample)] struct TestVecEnum { enums: Vec, } - #[derive(Serialize, AbiExample)] + #[derive(serde_derive::Serialize, AbiExample)] struct TestGenericStruct { test_field: T, } @@ -618,7 +618,7 @@ mod tests { #[frozen_abi(digest = "2Dr5k3Z513mV4KrGeUfcMwjsVHLmVyLiZarmfnXawEbf")] type TestConcreteStruct = TestGenericStruct; - #[derive(Serialize, AbiExample, AbiEnumVisitor)] + #[derive(serde_derive::Serialize, AbiExample, AbiEnumVisitor)] enum TestGenericEnum { TestVariant(T), } @@ -647,7 +647,7 @@ mod tests { #[frozen_abi(digest = "7rH7gnEhJ8YouzqPT6VPyUDELvL51DGednSPcoLXG2rg")] type TestOptionWithIsize = Option; - #[derive(Serialize, AbiExample, AbiEnumVisitor)] + #[derive(serde_derive::Serialize, AbiExample, AbiEnumVisitor)] enum TestMyOption { None, Some(T), @@ -663,7 +663,7 @@ mod tests { bitflags::bitflags! { #[frozen_abi(digest = "HhKNkaeAd7AohTb8S8sPKjAWwzxWY2DPz5FvkWmx5bSH")] - #[derive(Serialize, Deserialize)] + #[derive(serde_derive::Serialize, serde_derive::Deserialize)] struct TestFlags: u8 { const TestBit = 0b0000_0001; } @@ -688,12 +688,12 @@ mod tests { mod skip_should_be_same { #[frozen_abi(digest = "4LbuvQLX78XPbm4hqqZcHFHpseDJcw4qZL9EUZXSi2Ss")] - #[derive(Serialize, AbiExample)] + #[derive(serde_derive::Serialize, AbiExample)] #[allow(dead_code)] struct TestTupleStruct(i8, i8, #[serde(skip)] i8); #[frozen_abi(digest = "Hk7BYjZ71upWQJAx2PqoNcapggobPmFbMJd34xVdvRso")] - #[derive(Serialize, AbiExample)] + #[derive(serde_derive::Serialize, AbiExample)] struct TestStruct { test_field: i8, #[serde(skip)] @@ -701,7 +701,7 @@ mod tests { } #[frozen_abi(digest = "6kj3mPXbzWTwZho48kZWxZjuseLU2oiqhbpqca4DmcRq")] - #[derive(Serialize, AbiExample, AbiEnumVisitor)] + #[derive(serde_derive::Serialize, AbiExample, AbiEnumVisitor)] enum TestEnum { Variant1, Variant2, @@ -711,7 +711,7 @@ mod tests { } #[frozen_abi(digest = "3WqYwnbQEdu6iPZi5LJa2b5kw55hxBtZdqFqiViFCKPo")] - #[derive(Serialize, AbiExample, AbiEnumVisitor)] + #[derive(serde_derive::Serialize, AbiExample, AbiEnumVisitor)] enum TestTupleVariant { Variant1(u8, u16), Variant2(u8, u16, #[serde(skip)] u32), @@ -719,10 +719,10 @@ mod tests { } #[frozen_abi(digest = "B1PcwZdUfGnxaRid9e6ZwkST3NZ2KUEYobA1DkxWrYLP")] - #[derive(Serialize, AbiExample)] + #[derive(serde_derive::Serialize, AbiExample)] struct TestArcWeak(std::sync::Weak); #[frozen_abi(digest = "4R8uCLR1BVU1aFgkSaNyKcFD1FeM6rGdsjbJBFpnqx4v")] - #[derive(Serialize, AbiExample)] + #[derive(serde_derive::Serialize, AbiExample)] struct TestRcWeak(std::rc::Weak); } diff --git a/frozen-abi/src/lib.rs b/frozen-abi/src/lib.rs index a44ef405d18fd0..d9007738a68f16 100644 --- a/frozen-abi/src/lib.rs +++ b/frozen-abi/src/lib.rs @@ -15,11 +15,6 @@ mod hash; #[macro_use] extern crate solana_frozen_abi_macro; -#[cfg(RUSTC_WITH_SPECIALIZATION)] -#[cfg(test)] -#[macro_use] -extern crate serde_derive; - // Not public API. Referenced by macro-generated code. #[doc(hidden)] pub mod __private { diff --git a/install/Cargo.toml b/install/Cargo.toml index a09d08c548c0b1..39a039a0b0600f 100644 --- a/install/Cargo.toml +++ b/install/Cargo.toml @@ -25,7 +25,8 @@ nix = { workspace = true, features = ["signal"] } reqwest = { workspace = true, features = ["blocking", "brotli", "deflate", "gzip", "rustls-tls", "json"] } scopeguard = { workspace = true } semver = { workspace = true } -serde = { workspace = true, features = ["derive"] } +serde = { workspace = true } +serde_derive = { workspace = true } serde_yaml = { workspace = true } serde_yaml_08 = { package = "serde_yaml", version = "0.8.26" } solana-clap-utils = { workspace = true } diff --git a/install/src/command.rs b/install/src/command.rs index 004b2d03b30242..8a81e1d72337ec 100644 --- a/install/src/command.rs +++ b/install/src/command.rs @@ -8,7 +8,7 @@ use { console::{style, Emoji}, crossbeam_channel::unbounded, indicatif::{ProgressBar, ProgressStyle}, - serde::{Deserialize, Serialize}, + serde_derive::{Deserialize, Serialize}, solana_config_program::{config_instruction, get_config_data, ConfigState}, solana_rpc_client::rpc_client::RpcClient, solana_sdk::{ diff --git a/install/src/config.rs b/install/src/config.rs index 7d787c4aacfa88..07fc52c122afd0 100644 --- a/install/src/config.rs +++ b/install/src/config.rs @@ -1,6 +1,6 @@ use { crate::update_manifest::UpdateManifest, - serde::{Deserialize, Serialize}, + serde_derive::{Deserialize, Serialize}, solana_sdk::pubkey::Pubkey, std::{ fs::{create_dir_all, File}, diff --git a/install/src/update_manifest.rs b/install/src/update_manifest.rs index 57d408f8972530..e8d468d4540f26 100644 --- a/install/src/update_manifest.rs +++ b/install/src/update_manifest.rs @@ -1,5 +1,5 @@ use { - serde::{Deserialize, Serialize}, + serde_derive::{Deserialize, Serialize}, solana_config_program::ConfigState, solana_sdk::{ hash::Hash, diff --git a/ledger-tool/Cargo.toml b/ledger-tool/Cargo.toml index 7d527c91842479..8bc796258ac175 100644 --- a/ledger-tool/Cargo.toml +++ b/ledger-tool/Cargo.toml @@ -23,7 +23,8 @@ log = { workspace = true } num_cpus = { workspace = true } rayon = { workspace = true } regex = { workspace = true } -serde = { workspace = true, features = ["derive"] } +serde = { workspace = true } +serde_derive = { workspace = true } serde_json = { workspace = true } solana-account-decoder = { workspace = true } solana-accounts-db = { workspace = true } diff --git a/ledger-tool/src/main.rs b/ledger-tool/src/main.rs index b17b3cb9f265e6..2dbb433b633d24 100644 --- a/ledger-tool/src/main.rs +++ b/ledger-tool/src/main.rs @@ -17,7 +17,7 @@ use { }, dashmap::DashMap, log::*, - serde::Serialize, + serde_derive::Serialize, solana_account_decoder::UiAccountEncoding, solana_accounts_db::{ accounts_db::CalcAccountsHashDataSource, accounts_index::ScanConfig, diff --git a/ledger-tool/src/output.rs b/ledger-tool/src/output.rs index ceb79ec9982dd8..236cfbb5cdceac 100644 --- a/ledger-tool/src/output.rs +++ b/ledger-tool/src/output.rs @@ -1,10 +1,8 @@ use { crate::ledger_utils::get_program_ids, chrono::{Local, TimeZone}, - serde::{ - ser::{Impossible, SerializeSeq, SerializeStruct, Serializer}, - Deserialize, Serialize, - }, + serde::ser::{Impossible, SerializeSeq, SerializeStruct, Serializer}, + serde_derive::{Deserialize, Serialize}, solana_account_decoder::{UiAccount, UiAccountData, UiAccountEncoding}, solana_accounts_db::accounts_index::ScanConfig, solana_cli_output::{ @@ -742,7 +740,7 @@ impl AccountsScanner { } } -impl Serialize for AccountsScanner { +impl serde::Serialize for AccountsScanner { fn serialize(&self, serializer: S) -> Result where S: Serializer, diff --git a/ledger-tool/src/program.rs b/ledger-tool/src/program.rs index 8700337f1d4ebc..a52f05d126d5d9 100644 --- a/ledger-tool/src/program.rs +++ b/ledger-tool/src/program.rs @@ -2,7 +2,7 @@ use { crate::{args::*, canonicalize_ledger_path, ledger_utils::*}, clap::{value_t, App, AppSettings, Arg, ArgMatches, SubCommand}, log::*, - serde::{Deserialize, Serialize}, + serde_derive::{Deserialize, Serialize}, serde_json::Result, solana_bpf_loader_program::{ create_vm, load_program_from_bytes, serialization::serialize_parameters, diff --git a/net-shaper/Cargo.toml b/net-shaper/Cargo.toml index 8e6a46853fc3aa..91a8ca9a99c33d 100644 --- a/net-shaper/Cargo.toml +++ b/net-shaper/Cargo.toml @@ -12,7 +12,8 @@ edition = { workspace = true } [dependencies] clap = { version = "3.1.5", features = ["cargo"] } rand = { workspace = true } -serde = { workspace = true, features = ["derive"] } +serde = { workspace = true } +serde_derive = { workspace = true } serde_json = { workspace = true } solana-logger = { workspace = true } diff --git a/net-shaper/src/main.rs b/net-shaper/src/main.rs index f431cc557681d1..6443c777fdb367 100644 --- a/net-shaper/src/main.rs +++ b/net-shaper/src/main.rs @@ -2,7 +2,7 @@ use { clap::{crate_description, crate_name, crate_version, Arg, ArgMatches, Command}, rand::{thread_rng, Rng}, - serde::{Deserialize, Serialize}, + serde_derive::{Deserialize, Serialize}, std::{fs, io, path::PathBuf}, }; diff --git a/programs/address-lookup-table/Cargo.toml b/programs/address-lookup-table/Cargo.toml index b4cee366dddfb9..9a9fcf45ceffd4 100644 --- a/programs/address-lookup-table/Cargo.toml +++ b/programs/address-lookup-table/Cargo.toml @@ -15,7 +15,6 @@ bytemuck = { workspace = true } log = { workspace = true } num-derive = { workspace = true } num-traits = { workspace = true } -serde = { workspace = true, features = ["derive"] } solana-frozen-abi = { workspace = true } solana-frozen-abi-macro = { workspace = true } solana-program = { workspace = true } diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index 59f1c1da2f4832..ab1aab93517c9c 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -4699,7 +4699,6 @@ dependencies = [ "num-derive 0.4.2", "num-traits", "rustc_version", - "serde", "solana-frozen-abi", "solana-frozen-abi-macro", "solana-program", @@ -4728,6 +4727,7 @@ name = "solana-banks-interface" version = "2.0.0" dependencies = [ "serde", + "serde_derive", "solana-sdk", "tarpc", ] @@ -4790,6 +4790,7 @@ version = "2.0.0" dependencies = [ "array-bytes", "serde", + "serde_derive", "serde_json", "solana-program", ] @@ -6362,6 +6363,7 @@ dependencies = [ "percentage", "rustc_version", "serde", + "serde_derive", "solana-frozen-abi", "solana-frozen-abi-macro", "solana-loader-v4-program", @@ -6665,6 +6667,7 @@ dependencies = [ "num-traits", "rand 0.7.3", "serde", + "serde_derive", "serde_json", "sha3 0.9.1", "solana-program", diff --git a/programs/sbf/Cargo.toml b/programs/sbf/Cargo.toml index 830b57d8e5359b..94b6bdff24c61e 100644 --- a/programs/sbf/Cargo.toml +++ b/programs/sbf/Cargo.toml @@ -23,7 +23,8 @@ num-derive = "0.3" num-traits = "0.2" rand = "0.8" rustversion = "1.0.14" -serde = "1.0.112" +serde = "1.0.112" # must match the serde_derive version, see https://github.com/serde-rs/serde/issues/2584#issuecomment-1685252251 +serde_derive = "1.0.112" # must match the serde version, see https://github.com/serde-rs/serde/issues/2584#issuecomment-1685252251 serde_json = "1.0.56" solana-account-decoder = { path = "../../account-decoder", version = "=2.0.0" } solana-accounts-db = { path = "../../accounts-db", version = "=2.0.0" } diff --git a/programs/sbf/rust/big_mod_exp/Cargo.toml b/programs/sbf/rust/big_mod_exp/Cargo.toml index 783b5c59eed47f..47d2913e47f192 100644 --- a/programs/sbf/rust/big_mod_exp/Cargo.toml +++ b/programs/sbf/rust/big_mod_exp/Cargo.toml @@ -11,7 +11,8 @@ edition = { workspace = true } [dependencies] array-bytes = { workspace = true } -serde = { workspace = true, features = ["derive"] } +serde = { workspace = true } +serde_derive = { workspace = true } serde_json = { workspace = true } solana-program = { workspace = true } diff --git a/programs/sbf/rust/big_mod_exp/src/lib.rs b/programs/sbf/rust/big_mod_exp/src/lib.rs index d28380688217e0..11a56d7ff17bbf 100644 --- a/programs/sbf/rust/big_mod_exp/src/lib.rs +++ b/programs/sbf/rust/big_mod_exp/src/lib.rs @@ -4,7 +4,7 @@ extern crate solana_program; use solana_program::{big_mod_exp::big_mod_exp, custom_panic_default, msg}; fn big_mod_exp_test() { - #[derive(serde::Deserialize)] + #[derive(serde_derive::Deserialize)] #[serde(rename_all = "PascalCase")] struct TestCase { base: String, diff --git a/sdk/program/Cargo.toml b/sdk/program/Cargo.toml index 9b3d7d5a06899a..cbe60c915ea12a 100644 --- a/sdk/program/Cargo.toml +++ b/sdk/program/Cargo.toml @@ -27,7 +27,7 @@ memoffset = { workspace = true } num-derive = { workspace = true } num-traits = { workspace = true, features = ["i128"] } rustversion = { workspace = true } -serde = { workspace = true, features = ["derive"] } +serde = { workspace = true } serde_bytes = { workspace = true } serde_derive = { workspace = true } sha2 = { workspace = true } diff --git a/sdk/program/src/address_lookup_table/instruction.rs b/sdk/program/src/address_lookup_table/instruction.rs index ccf4bbe3a19022..5687ab6d05a1aa 100644 --- a/sdk/program/src/address_lookup_table/instruction.rs +++ b/sdk/program/src/address_lookup_table/instruction.rs @@ -6,7 +6,7 @@ use { pubkey::Pubkey, system_program, }, - serde::{Deserialize, Serialize}, + serde_derive::{Deserialize, Serialize}, }; #[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)] diff --git a/sdk/program/src/address_lookup_table/state.rs b/sdk/program/src/address_lookup_table/state.rs index 436fb01c21b9ec..df564f78fe2577 100644 --- a/sdk/program/src/address_lookup_table/state.rs +++ b/sdk/program/src/address_lookup_table/state.rs @@ -1,7 +1,7 @@ #[cfg(feature = "frozen-abi")] use solana_frozen_abi_macro::{AbiEnumVisitor, AbiExample}; use { - serde::{Deserialize, Serialize}, + serde_derive::{Deserialize, Serialize}, solana_program::{ address_lookup_table::error::AddressLookupError, clock::Slot, diff --git a/sdk/program/src/alt_bn128/compression.rs b/sdk/program/src/alt_bn128/compression.rs index 0b63b202d4d854..5bcbe06434172e 100644 --- a/sdk/program/src/alt_bn128/compression.rs +++ b/sdk/program/src/alt_bn128/compression.rs @@ -388,7 +388,7 @@ mod tests { } #[test] fn alt_bn128_compression_pairing_test_input() { - use serde::Deserialize; + use serde_derive::Deserialize; let test_data = r#"[ { diff --git a/sdk/program/src/alt_bn128/mod.rs b/sdk/program/src/alt_bn128/mod.rs index 6ed0f964c83041..4919df3ac845ad 100644 --- a/sdk/program/src/alt_bn128/mod.rs +++ b/sdk/program/src/alt_bn128/mod.rs @@ -402,7 +402,7 @@ mod tests { #[test] fn alt_bn128_addition_test() { - use serde::Deserialize; + use serde_derive::Deserialize; let test_data = r#"[ { @@ -496,7 +496,7 @@ mod tests { #[test] fn alt_bn128_multiplication_test() { - use serde::Deserialize; + use serde_derive::Deserialize; let test_data = r#"[ { @@ -630,7 +630,7 @@ mod tests { #[test] fn alt_bn128_pairing_test() { - use serde::Deserialize; + use serde_derive::Deserialize; let test_data = r#"[ { diff --git a/sdk/program/src/big_mod_exp.rs b/sdk/program/src/big_mod_exp.rs index 11bd7098f15a6c..d3447436288206 100644 --- a/sdk/program/src/big_mod_exp.rs +++ b/sdk/program/src/big_mod_exp.rs @@ -62,7 +62,7 @@ mod tests { #[test] fn big_mod_exp_test() { - #[derive(serde::Deserialize)] + #[derive(serde_derive::Deserialize)] #[serde(rename_all = "PascalCase")] struct TestCase { base: String, diff --git a/sdk/program/src/example_mocks.rs b/sdk/program/src/example_mocks.rs index 48f3355710e1f2..ebde291ced11bd 100644 --- a/sdk/program/src/example_mocks.rs +++ b/sdk/program/src/example_mocks.rs @@ -204,7 +204,7 @@ pub mod solana_sdk { message::{Message, VersionedMessage}, pubkey::Pubkey, }, - serde::Serialize, + serde_derive::Serialize, }; pub struct VersionedTransaction { diff --git a/sdk/program/src/message/versions/mod.rs b/sdk/program/src/message/versions/mod.rs index f87cc2eb9d7bd3..e9e0197d266e25 100644 --- a/sdk/program/src/message/versions/mod.rs +++ b/sdk/program/src/message/versions/mod.rs @@ -10,8 +10,8 @@ use { serde::{ de::{self, Deserializer, SeqAccess, Unexpected, Visitor}, ser::{SerializeTuple, Serializer}, - Deserialize, Serialize, }, + serde_derive::{Deserialize, Serialize}, std::{collections::HashSet, fmt}, }; @@ -166,7 +166,7 @@ impl Default for VersionedMessage { } } -impl Serialize for VersionedMessage { +impl serde::Serialize for VersionedMessage { fn serialize(&self, serializer: S) -> Result where S: Serializer, @@ -192,7 +192,7 @@ enum MessagePrefix { Versioned(u8), } -impl<'de> Deserialize<'de> for MessagePrefix { +impl<'de> serde::Deserialize<'de> for MessagePrefix { fn deserialize(deserializer: D) -> Result where D: Deserializer<'de>, @@ -228,7 +228,7 @@ impl<'de> Deserialize<'de> for MessagePrefix { } } -impl<'de> Deserialize<'de> for VersionedMessage { +impl<'de> serde::Deserialize<'de> for VersionedMessage { fn deserialize(deserializer: D) -> Result where D: Deserializer<'de>, diff --git a/sdk/program/src/vote/state/mod.rs b/sdk/program/src/vote/state/mod.rs index 472a52c559aae5..056b6c33ec21cf 100644 --- a/sdk/program/src/vote/state/mod.rs +++ b/sdk/program/src/vote/state/mod.rs @@ -902,14 +902,14 @@ pub mod serde_compact_vote_state_update { }; #[cfg_attr(feature = "frozen-abi", derive(AbiExample))] - #[derive(Deserialize, Serialize)] + #[derive(serde_derive::Deserialize, serde_derive::Serialize)] struct LockoutOffset { #[serde(with = "serde_varint")] offset: Slot, confirmation_count: u8, } - #[derive(Deserialize, Serialize)] + #[derive(serde_derive::Deserialize, serde_derive::Serialize)] struct CompactVoteStateUpdate { root: Slot, #[serde(with = "short_vec")] @@ -999,14 +999,14 @@ pub mod serde_tower_sync { }; #[cfg_attr(feature = "frozen-abi", derive(AbiExample))] - #[derive(Deserialize, Serialize)] + #[derive(serde_derive::Deserialize, serde_derive::Serialize)] struct LockoutOffset { #[serde(with = "serde_varint")] offset: Slot, confirmation_count: u8, } - #[derive(Deserialize, Serialize)] + #[derive(serde_derive::Deserialize, serde_derive::Serialize)] struct CompactTowerSync { root: Slot, #[serde(with = "short_vec")] diff --git a/svm/Cargo.toml b/svm/Cargo.toml index 2135dd6aacd7f8..f6e0c09a2671c4 100644 --- a/svm/Cargo.toml +++ b/svm/Cargo.toml @@ -13,7 +13,8 @@ edition = { workspace = true } itertools = { workspace = true } log = { workspace = true } percentage = { workspace = true } -serde = { workspace = true, features = ["derive", "rc"] } +serde = { workspace = true, features = ["rc"] } +serde_derive = { workspace = true } solana-frozen-abi = { workspace = true } solana-frozen-abi-macro = { workspace = true } solana-loader-v4-program = { workspace = true } diff --git a/svm/src/message_processor.rs b/svm/src/message_processor.rs index 112d9c67e4ab31..6830b5663dc703 100644 --- a/svm/src/message_processor.rs +++ b/svm/src/message_processor.rs @@ -1,5 +1,4 @@ use { - serde::{Deserialize, Serialize}, solana_measure::measure::Measure, solana_program_runtime::{ invoke_context::InvokeContext, @@ -16,7 +15,7 @@ use { }, }; -#[derive(Debug, Default, Clone, Deserialize, Serialize)] +#[derive(Debug, Default, Clone, serde_derive::Deserialize, serde_derive::Serialize)] pub struct MessageProcessor {} #[cfg(RUSTC_WITH_SPECIALIZATION)] @@ -170,7 +169,7 @@ mod tests { std::sync::Arc, }; - #[derive(Debug, Serialize, Deserialize)] + #[derive(Debug, serde_derive::Serialize, serde_derive::Deserialize)] enum MockInstruction { NoopSuccess, NoopFail, @@ -186,7 +185,7 @@ mod tests { #[test] fn test_process_message_readonly_handling() { - #[derive(Serialize, Deserialize)] + #[derive(serde_derive::Serialize, serde_derive::Deserialize)] enum MockSystemInstruction { Correct, TransferLamports { lamports: u64 }, @@ -404,7 +403,7 @@ mod tests { #[test] fn test_process_message_duplicate_accounts() { - #[derive(Serialize, Deserialize)] + #[derive(serde_derive::Serialize, serde_derive::Deserialize)] enum MockSystemInstruction { BorrowFail, MultiBorrowMut, diff --git a/tokens/Cargo.toml b/tokens/Cargo.toml index 37e675c521af5f..dd5e04e2eedfe2 100644 --- a/tokens/Cargo.toml +++ b/tokens/Cargo.toml @@ -18,7 +18,8 @@ ctrlc = { workspace = true, features = ["termination"] } indexmap = { workspace = true } indicatif = { workspace = true } pickledb = { workspace = true, features = ["yaml"] } -serde = { workspace = true, features = ["derive"] } +serde = { workspace = true } +serde_derive = { workspace = true } solana-account-decoder = { workspace = true } solana-clap-utils = { workspace = true } solana-cli-config = { workspace = true } diff --git a/zk-sdk/Cargo.toml b/zk-sdk/Cargo.toml index a86e7ec5a49bdf..8b67d12c693987 100644 --- a/zk-sdk/Cargo.toml +++ b/zk-sdk/Cargo.toml @@ -28,7 +28,8 @@ curve25519-dalek = { workspace = true, features = ["serde"] } itertools = { workspace = true } lazy_static = { workspace = true } rand = { version = "0.7" } -serde = { workspace = true, features = ["derive"] } +serde = { workspace = true } +serde_derive = { workspace = true } serde_json = { workspace = true } sha3 = "0.9" solana-sdk = { workspace = true } diff --git a/zk-token-sdk/Cargo.toml b/zk-token-sdk/Cargo.toml index 4d4ff1a21b03af..fb3dc25649b5a8 100644 --- a/zk-token-sdk/Cargo.toml +++ b/zk-token-sdk/Cargo.toml @@ -30,7 +30,8 @@ itertools = { workspace = true } lazy_static = { workspace = true } merlin = { workspace = true } rand = { version = "0.7" } -serde = { workspace = true, features = ["derive"] } +serde = { workspace = true } +serde_derive = { workspace = true } serde_json = { workspace = true } sha3 = "0.9" solana-sdk = { workspace = true }