From 1a0602552ba6d34f9185c12edc7795b65140d062 Mon Sep 17 00:00:00 2001 From: Joe Caulfield Date: Thu, 5 Dec 2024 12:02:05 +0900 Subject: [PATCH] sdk: evict shred_version --- Cargo.lock | 11 ++++++++++ Cargo.toml | 2 ++ programs/sbf/Cargo.lock | 11 ++++++++++ sdk/Cargo.toml | 2 ++ sdk/shred-version/Cargo.toml | 22 +++++++++++++++++++ .../src/lib.rs} | 7 +----- sdk/src/lib.rs | 4 +++- svm/examples/Cargo.lock | 11 ++++++++++ 8 files changed, 63 insertions(+), 7 deletions(-) create mode 100644 sdk/shred-version/Cargo.toml rename sdk/{src/shred_version.rs => shred-version/src/lib.rs} (94%) diff --git a/Cargo.lock b/Cargo.lock index ee843ebf273fea..51a970c8ab156a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8803,6 +8803,7 @@ dependencies = [ "solana-serde", "solana-serde-varint", "solana-short-vec", + "solana-shred-version", "solana-signature", "solana-signer", "solana-system-transaction", @@ -8988,6 +8989,16 @@ dependencies = [ "solana-frozen-abi-macro", ] +[[package]] +name = "solana-shred-version" +version = "2.2.0" +dependencies = [ + "byteorder", + "solana-hard-forks", + "solana-hash", + "solana-sha256-hasher", +] + [[package]] name = "solana-signature" version = "2.2.0" diff --git a/Cargo.toml b/Cargo.toml index 7657fe3dc21e45..4145b5442787a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -174,6 +174,7 @@ members = [ "sdk/serialize-utils", "sdk/sha256-hasher", "sdk/short-vec", + "sdk/shred-version", "sdk/signature", "sdk/signer", "sdk/slot-hashes", @@ -576,6 +577,7 @@ solana-secp256k1-program = { path = "sdk/secp256k1-program", version = "=2.2.0" solana-secp256k1-recover = { path = "curves/secp256k1-recover", version = "=2.2.0", default-features = false } solana-send-transaction-service = { path = "send-transaction-service", version = "=2.2.0" } solana-short-vec = { path = "sdk/short-vec", version = "=2.2.0" } +solana-shred-version = { path = "sdk/shred-version", version = "=2.2.0" } solana-stable-layout = { path = "sdk/stable-layout", version = "=2.2.0" } solana-stake-program = { path = "programs/stake", version = "=2.2.0" } solana-storage-bigtable = { path = "storage-bigtable", version = "=2.2.0" } diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index 75f3192dea3ccf..dbaeef4ff99f38 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -7454,6 +7454,7 @@ dependencies = [ "solana-serde", "solana-serde-varint", "solana-short-vec", + "solana-shred-version", "solana-signature", "solana-signer", "solana-system-transaction", @@ -7601,6 +7602,16 @@ dependencies = [ "serde", ] +[[package]] +name = "solana-shred-version" +version = "2.2.0" +dependencies = [ + "byteorder 1.5.0", + "solana-hard-forks", + "solana-hash", + "solana-sha256-hasher", +] + [[package]] name = "solana-signature" version = "2.2.0" diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index aa17bba0768db1..cbdce2305ec9ac 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -49,6 +49,7 @@ full = [ "dep:solana-secp256k1-program", "dep:solana-seed-derivable", "dep:solana-seed-phrase", + "dep:solana-shred-version", "dep:solana-signer", "dep:solana-system-transaction", "dep:solana-transaction", @@ -180,6 +181,7 @@ solana-seed-phrase = { workspace = true, optional = true } solana-serde = { workspace = true } solana-serde-varint = { workspace = true } solana-short-vec = { workspace = true } +solana-shred-version = { workspace = true, optional = true } solana-signature = { workspace = true, features = [ "rand", "serde", diff --git a/sdk/shred-version/Cargo.toml b/sdk/shred-version/Cargo.toml new file mode 100644 index 00000000000000..17b30e4389f5c4 --- /dev/null +++ b/sdk/shred-version/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "solana-shred-version" +description = "Calculation of shred versions." +documentation = "https://docs.rs/solana-shred-version" +version = { workspace = true } +authors = { workspace = true } +repository = { workspace = true } +homepage = { workspace = true } +license = { workspace = true } +edition = { workspace = true } + +[dependencies] +byteorder = { workspace = true } +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/sdk/src/shred_version.rs b/sdk/shred-version/src/lib.rs similarity index 94% rename from sdk/src/shred_version.rs rename to sdk/shred-version/src/lib.rs index 52560a1709c102..123e96465b8eff 100644 --- a/sdk/src/shred_version.rs +++ b/sdk/shred-version/src/lib.rs @@ -2,12 +2,7 @@ //! //! [shred]: https://solana.com/docs/terminology#shred -#![cfg(feature = "full")] - -use solana_sdk::{ - hard_forks::HardForks, - hash::{extend_and_hash, Hash}, -}; +use {solana_hard_forks::HardForks, solana_hash::Hash, solana_sha256_hasher::extend_and_hash}; pub fn version_from_hash(hash: &Hash) -> u16 { let hash = hash.as_ref(); diff --git a/sdk/src/lib.rs b/sdk/src/lib.rs index 6d1371e2b53712..3c5264a1c54e5c 100644 --- a/sdk/src/lib.rs +++ b/sdk/src/lib.rs @@ -89,7 +89,9 @@ pub mod reward_type { pub use solana_reward_info::RewardType; } pub mod rpc_port; -pub mod shred_version; +#[cfg(feature = "full")] +#[deprecated(since = "2.2.0", note = "Use `solana-shred-version` crate instead")] +pub use solana_shred_version as shred_version; pub mod signature; pub mod signer; pub mod transaction; diff --git a/svm/examples/Cargo.lock b/svm/examples/Cargo.lock index 901d23235388e7..65246877defd1b 100644 --- a/svm/examples/Cargo.lock +++ b/svm/examples/Cargo.lock @@ -6773,6 +6773,7 @@ dependencies = [ "solana-serde", "solana-serde-varint", "solana-short-vec", + "solana-shred-version", "solana-signature", "solana-signer", "solana-system-transaction", @@ -6920,6 +6921,16 @@ dependencies = [ "serde", ] +[[package]] +name = "solana-shred-version" +version = "2.2.0" +dependencies = [ + "byteorder", + "solana-hard-forks", + "solana-hash", + "solana-sha256-hasher", +] + [[package]] name = "solana-signature" version = "2.2.0"