Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: Use bytemuck_derive explicitly instead of "derive" feature on bytemuck #1799

Merged
merged 5 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions accounts-db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ bincode = { workspace = true }
blake3 = { workspace = true }
bv = { workspace = true, features = ["serde"] }
bytemuck = { workspace = true }
bytemuck_derive = { workspace = true }
bzip2 = { workspace = true }
crossbeam-channel = { workspace = true }
dashmap = { workspace = true, features = ["rayon", "raw-api"] }
Expand Down
2 changes: 1 addition & 1 deletion accounts-db/src/accounts_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use {
ancestors::Ancestors,
pubkey_bins::PubkeyBinCalculator24,
},
bytemuck::{Pod, Zeroable},
bytemuck_derive::{Pod, Zeroable},
log::*,
memmap2::MmapMut,
rayon::prelude::*,
Expand Down
2 changes: 1 addition & 1 deletion accounts-db/src/cache_hash_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use crate::pubkey_bins::PubkeyBinCalculator24;
use {
crate::{accounts_hash::CalculateHashIntermediate, cache_hash_data_stats::CacheHashDataStats},
bytemuck::{Pod, Zeroable},
bytemuck_derive::{Pod, Zeroable},
memmap2::MmapMut,
solana_measure::measure::Measure,
solana_sdk::clock::Slot,
Expand Down
4 changes: 2 additions & 2 deletions accounts-db/src/tiered_storage/file.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use {
super::{error::TieredStorageError, TieredStorageResult},
bytemuck::{AnyBitPattern, NoUninit, Pod, Zeroable},
bytemuck::{AnyBitPattern, NoUninit, Zeroable},
std::{
fs::{File, OpenOptions},
io::{BufWriter, Read, Result as IoResult, Seek, SeekFrom, Write},
Expand All @@ -13,7 +13,7 @@ use {
/// The ending 8 bytes of a valid tiered account storage file.
pub const FILE_MAGIC_NUMBER: u64 = u64::from_le_bytes(*b"AnzaTech");

#[derive(Debug, PartialEq, Eq, Clone, Copy, Pod, Zeroable)]
#[derive(Debug, PartialEq, Eq, Clone, Copy, bytemuck_derive::Pod, bytemuck_derive::Zeroable)]
#[repr(C)]
pub struct TieredStorageMagicNumber(pub u64);

Expand Down
2 changes: 1 addition & 1 deletion accounts-db/src/tiered_storage/hot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use {
StorableAccounts, TieredStorageError, TieredStorageFormat, TieredStorageResult,
},
},
bytemuck::{Pod, Zeroable},
bytemuck_derive::{Pod, Zeroable},
memmap2::{Mmap, MmapOptions},
modular_bitfield::prelude::*,
solana_sdk::{
Expand Down
2 changes: 1 addition & 1 deletion accounts-db/src/tiered_storage/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub trait AccountOffset: Clone + Copy + Pod + Zeroable {}
/// This can be used to obtain the AccountOffset and address by looking through
/// the accounts index block.
#[repr(C)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Pod, Zeroable)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, bytemuck_derive::Pod, bytemuck_derive::Zeroable)]
pub struct IndexOffset(pub u32);

// Ensure there are no implicit padding bytes
Expand Down
2 changes: 1 addition & 1 deletion accounts-db/src/tiered_storage/meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use {
crate::tiered_storage::owners::OwnerOffset,
bytemuck::{Pod, Zeroable},
bytemuck_derive::{Pod, Zeroable},
modular_bitfield::prelude::*,
solana_sdk::{pubkey::Pubkey, stake_history::Epoch},
};
Expand Down
3 changes: 2 additions & 1 deletion bucket_map/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ edition = { workspace = true }

[dependencies]
bv = { workspace = true, features = ["serde"] }
bytemuck = { workspace = true, features = ["derive"] }
bytemuck = { workspace = true }
bytemuck_derive = { workspace = true }
log = { workspace = true }
memmap2 = { workspace = true }
modular-bitfield = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion bucket_map/src/restart.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Persistent info of disk index files to allow files to be reused on restart.
use {
crate::bucket_map::{BucketMapConfig, MAX_SEARCH_DEFAULT},
bytemuck::{Pod, Zeroable},
bytemuck_derive::{Pod, Zeroable},
memmap2::MmapMut,
std::{
collections::HashMap,
Expand Down
3 changes: 2 additions & 1 deletion curves/curve25519/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ license = { workspace = true }
edition = { workspace = true }

[dependencies]
bytemuck = { workspace = true, features = ["derive"] }
bytemuck = { workspace = true }
bytemuck_derive = { workspace = true }
solana-program = { workspace = true }
thiserror = { workspace = true }

Expand Down
3 changes: 2 additions & 1 deletion curves/curve25519/src/edwards.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bytemuck::{Pod, Zeroable};
use bytemuck_derive::{Pod, Zeroable};
pub use target_arch::*;

#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Pod, Zeroable)]
Expand Down Expand Up @@ -138,6 +138,7 @@ mod target_arch {
curve_syscall_traits::{ADD, CURVE25519_EDWARDS, MUL, SUB},
scalar::PodScalar,
},
bytemuck::Zeroable,
};

pub fn validate_edwards(point: &PodEdwardsPoint) -> bool {
Expand Down
3 changes: 2 additions & 1 deletion curves/curve25519/src/ristretto.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bytemuck::{Pod, Zeroable};
use bytemuck_derive::{Pod, Zeroable};
pub use target_arch::*;

#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Pod, Zeroable)]
Expand Down Expand Up @@ -139,6 +139,7 @@ mod target_arch {
curve_syscall_traits::{ADD, CURVE25519_RISTRETTO, MUL, SUB},
scalar::PodScalar,
},
bytemuck::Zeroable,
};

pub fn validate_ristretto(point: &PodRistrettoPoint) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion curves/curve25519/src/scalar.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub use bytemuck::{Pod, Zeroable};
pub use bytemuck_derive::{Pod, Zeroable};

#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Pod, Zeroable)]
#[repr(transparent)]
Expand Down
5 changes: 5 additions & 0 deletions programs/sbf/Cargo.lock

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

2 changes: 1 addition & 1 deletion programs/zk-elgamal-proof/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = { workspace = true }
edition = { workspace = true }

[dependencies]
bytemuck = { workspace = true, features = ["derive"] }
bytemuck = { workspace = true }
num-derive = { workspace = true }
num-traits = { workspace = true }
solana-program-runtime = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion programs/zk-token-proof-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = { workspace = true }
edition = { workspace = true }

[dev-dependencies]
bytemuck = { workspace = true, features = ["derive"] }
bytemuck = { workspace = true }
curve25519-dalek = { workspace = true }
solana-compute-budget = { workspace = true }
solana-program-test = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion programs/zk-token-proof/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = { workspace = true }
edition = { workspace = true }

[dependencies]
bytemuck = { workspace = true, features = ["derive"] }
bytemuck = { workspace = true }
num-derive = { workspace = true }
num-traits = { workspace = true }
solana-program-runtime = { workspace = true }
Expand Down
3 changes: 2 additions & 1 deletion zk-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ edition = { workspace = true }

[dependencies]
base64 = { workspace = true }
bytemuck = { workspace = true, features = ["derive"] }
bytemuck = { workspace = true }
bytemuck_derive = { workspace = true }
merlin = { workspace = true }
num-derive = { workspace = true }
num-traits = { workspace = true }
Expand Down
8 changes: 4 additions & 4 deletions zk-sdk/src/encryption/pod/elgamal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use {
pod::impl_from_str, DECRYPT_HANDLE_LEN, ELGAMAL_CIPHERTEXT_LEN, ELGAMAL_PUBKEY_LEN,
},
base64::{prelude::BASE64_STANDARD, Engine},
bytemuck::{Pod, Zeroable},
bytemuck::Zeroable,
std::fmt,
};
#[cfg(not(target_os = "solana"))]
Expand All @@ -24,7 +24,7 @@ const ELGAMAL_PUBKEY_MAX_BASE64_LEN: usize = 44;
const ELGAMAL_CIPHERTEXT_MAX_BASE64_LEN: usize = 88;

/// The `ElGamalCiphertext` type as a `Pod`.
#[derive(Clone, Copy, Pod, Zeroable, PartialEq, Eq)]
#[derive(Clone, Copy, bytemuck_derive::Pod, bytemuck_derive::Zeroable, PartialEq, Eq)]
#[repr(transparent)]
pub struct PodElGamalCiphertext(pub(crate) [u8; ELGAMAL_CIPHERTEXT_LEN]);

Expand Down Expand Up @@ -69,7 +69,7 @@ impl TryFrom<PodElGamalCiphertext> for ElGamalCiphertext {
}

/// The `ElGamalPubkey` type as a `Pod`.
#[derive(Clone, Copy, Default, Pod, Zeroable, PartialEq, Eq)]
#[derive(Clone, Copy, Default, bytemuck_derive::Pod, bytemuck_derive::Zeroable, PartialEq, Eq)]
#[repr(transparent)]
pub struct PodElGamalPubkey(pub(crate) [u8; ELGAMAL_PUBKEY_LEN]);

Expand Down Expand Up @@ -108,7 +108,7 @@ impl TryFrom<PodElGamalPubkey> for ElGamalPubkey {
}

/// The `DecryptHandle` type as a `Pod`.
#[derive(Clone, Copy, Default, Pod, Zeroable, PartialEq, Eq)]
#[derive(Clone, Copy, Default, bytemuck_derive::Pod, bytemuck_derive::Zeroable, PartialEq, Eq)]
#[repr(transparent)]
pub struct PodDecryptHandle(pub(crate) [u8; DECRYPT_HANDLE_LEN]);

Expand Down
6 changes: 3 additions & 3 deletions zk-sdk/src/encryption/pod/grouped_elgamal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use {
},
errors::ElGamalError,
},
bytemuck::{Pod, Zeroable},
bytemuck::Zeroable,
std::fmt,
};

Expand Down Expand Up @@ -61,7 +61,7 @@ const GROUPED_ELGAMAL_CIPHERTEXT_3_HANDLES: usize =
PEDERSEN_COMMITMENT_LEN + DECRYPT_HANDLE_LEN + DECRYPT_HANDLE_LEN + DECRYPT_HANDLE_LEN;

/// The `GroupedElGamalCiphertext` type with two decryption handles as a `Pod`
#[derive(Clone, Copy, Pod, Zeroable, PartialEq, Eq)]
#[derive(Clone, Copy, bytemuck_derive::Pod, bytemuck_derive::Zeroable, PartialEq, Eq)]
#[repr(transparent)]
pub struct PodGroupedElGamalCiphertext2Handles(
pub(crate) [u8; GROUPED_ELGAMAL_CIPHERTEXT_2_HANDLES],
Expand Down Expand Up @@ -97,7 +97,7 @@ impl TryFrom<PodGroupedElGamalCiphertext2Handles> for GroupedElGamalCiphertext<2
impl_extract!(TYPE = PodGroupedElGamalCiphertext2Handles);

/// The `GroupedElGamalCiphertext` type with three decryption handles as a `Pod`
#[derive(Clone, Copy, Pod, Zeroable, PartialEq, Eq)]
#[derive(Clone, Copy, bytemuck_derive::Pod, bytemuck_derive::Zeroable, PartialEq, Eq)]
#[repr(transparent)]
pub struct PodGroupedElGamalCiphertext3Handles(
pub(crate) [u8; GROUPED_ELGAMAL_CIPHERTEXT_3_HANDLES],
Expand Down
2 changes: 1 addition & 1 deletion zk-sdk/src/encryption/pod/pedersen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use {
crate::encryption::PEDERSEN_COMMITMENT_LEN,
bytemuck::{Pod, Zeroable},
bytemuck_derive::{Pod, Zeroable},
std::fmt,
};
#[cfg(not(target_os = "solana"))]
Expand Down
2 changes: 1 addition & 1 deletion zk-sdk/src/pod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bytemuck::{Pod, Zeroable};
use bytemuck_derive::{Pod, Zeroable};

#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Pod, Zeroable)]
#[repr(transparent)]
Expand Down
4 changes: 2 additions & 2 deletions zk-sdk/src/sigma_proofs/pod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ impl TryFrom<PodZeroCiphertextProof> for ZeroCiphertextProof {
}

/// The `PercentageWithCapProof` type as a `Pod`.
#[derive(Clone, Copy, Pod, Zeroable)]
#[derive(Clone, Copy, bytemuck_derive::Pod, bytemuck_derive::Zeroable)]
#[repr(transparent)]
pub struct PodPercentageWithCapProof(pub(crate) [u8; PERCENTAGE_WITH_CAP_PROOF_LEN]);

Expand All @@ -213,7 +213,7 @@ impl TryFrom<PodPercentageWithCapProof> for PercentageWithCapProof {
}

/// The `PubkeyValidityProof` type as a `Pod`.
#[derive(Clone, Copy, Pod, Zeroable)]
#[derive(Clone, Copy, bytemuck_derive::Pod, bytemuck_derive::Zeroable)]
#[repr(transparent)]
pub struct PodPubkeyValidityProof(pub(crate) [u8; PUBKEY_VALIDITY_PROOF_LEN]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use {
sigma_proofs::pod::PodBatchedGroupedCiphertext2HandlesValidityProof,
zk_elgamal_proof_program::proof_data::{ProofType, ZkProofData},
},
bytemuck::{Pod, Zeroable},
bytemuck_derive::{Pod, Zeroable},
};
#[cfg(not(target_os = "solana"))]
use {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use {
sigma_proofs::pod::PodBatchedGroupedCiphertext3HandlesValidityProof,
zk_elgamal_proof_program::proof_data::{ProofType, ZkProofData},
},
bytemuck::{Pod, Zeroable},
bytemuck_derive::{Pod, Zeroable},
};
#[cfg(not(target_os = "solana"))]
use {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use {
batched_range_proof::BatchedRangeProofContext, ProofType, ZkProofData,
},
},
bytemuck::{Pod, Zeroable},
bytemuck_derive::{Pod, Zeroable},
};

/// The instruction data that is needed for the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use {
batched_range_proof::BatchedRangeProofContext, ProofType, ZkProofData,
},
},
bytemuck::{Pod, Zeroable},
bytemuck_derive::{Pod, Zeroable},
};

#[cfg(not(target_os = "solana"))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use {
batched_range_proof::BatchedRangeProofContext, ProofType, ZkProofData,
},
},
bytemuck::{Pod, Zeroable},
bytemuck_derive::{Pod, Zeroable},
};

/// The instruction data that is needed for the
Expand Down
Loading