* Derive Pod/Zeroable for Pubkey
(cherry picked from commit f966859829
)
# Conflicts:
# Cargo.lock
# programs/bpf/Cargo.lock
# sdk/program/Cargo.toml
* rebase
Co-authored-by: Michael Vines <mvines@gmail.com>
This commit is contained in:
21
Cargo.lock
generated
21
Cargo.lock
generated
@ -468,6 +468,26 @@ version = "0.6.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b0017894339f586ccb943b01b9555de56770c11cda818e7e3d8bd93f4ed7f46e"
|
checksum = "b0017894339f586ccb943b01b9555de56770c11cda818e7e3d8bd93f4ed7f46e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bytemuck"
|
||||||
|
version = "1.7.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "72957246c41db82b8ef88a5486143830adeb8227ef9837740bdec67724cf2c5b"
|
||||||
|
dependencies = [
|
||||||
|
"bytemuck_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bytemuck_derive"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8e215f8c2f9f79cb53c8335e687ffd07d5bfcb6fe5fc80723762d0be46e7cc54"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2 1.0.24",
|
||||||
|
"quote 1.0.9",
|
||||||
|
"syn 1.0.60",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "byteorder"
|
name = "byteorder"
|
||||||
version = "1.3.4"
|
version = "1.3.4"
|
||||||
@ -5101,6 +5121,7 @@ dependencies = [
|
|||||||
"borsh-derive",
|
"borsh-derive",
|
||||||
"bs58",
|
"bs58",
|
||||||
"bv",
|
"bv",
|
||||||
|
"bytemuck",
|
||||||
"curve25519-dalek 2.1.0",
|
"curve25519-dalek 2.1.0",
|
||||||
"hex",
|
"hex",
|
||||||
"itertools 0.9.0",
|
"itertools 0.9.0",
|
||||||
|
21
programs/bpf/Cargo.lock
generated
21
programs/bpf/Cargo.lock
generated
@ -294,6 +294,26 @@ version = "0.3.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
|
checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bytemuck"
|
||||||
|
version = "1.7.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "72957246c41db82b8ef88a5486143830adeb8227ef9837740bdec67724cf2c5b"
|
||||||
|
dependencies = [
|
||||||
|
"bytemuck_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bytemuck_derive"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8e215f8c2f9f79cb53c8335e687ffd07d5bfcb6fe5fc80723762d0be46e7cc54"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2 1.0.24",
|
||||||
|
"quote 1.0.6",
|
||||||
|
"syn 1.0.67",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "byteorder"
|
name = "byteorder"
|
||||||
version = "0.5.3"
|
version = "0.5.3"
|
||||||
@ -3283,6 +3303,7 @@ dependencies = [
|
|||||||
"borsh-derive",
|
"borsh-derive",
|
||||||
"bs58",
|
"bs58",
|
||||||
"bv",
|
"bv",
|
||||||
|
"bytemuck",
|
||||||
"curve25519-dalek 2.1.0",
|
"curve25519-dalek 2.1.0",
|
||||||
"hex",
|
"hex",
|
||||||
"itertools 0.9.0",
|
"itertools 0.9.0",
|
||||||
|
@ -15,6 +15,7 @@ bincode = "1.3.1"
|
|||||||
borsh = "0.9.0"
|
borsh = "0.9.0"
|
||||||
borsh-derive = "0.9.0"
|
borsh-derive = "0.9.0"
|
||||||
bs58 = "0.3.1"
|
bs58 = "0.3.1"
|
||||||
|
bytemuck = { version = "1.7.2", features = ["derive"] }
|
||||||
bv = { version = "0.11.1", features = ["serde"] }
|
bv = { version = "0.11.1", features = ["serde"] }
|
||||||
hex = "0.4.2"
|
hex = "0.4.2"
|
||||||
itertools = "0.9.0"
|
itertools = "0.9.0"
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
#![allow(clippy::integer_arithmetic)]
|
#![allow(clippy::integer_arithmetic)]
|
||||||
use crate::{decode_error::DecodeError, hash::hashv};
|
use {
|
||||||
|
crate::{decode_error::DecodeError, hash::hashv},
|
||||||
use borsh::{BorshDeserialize, BorshSchema, BorshSerialize};
|
borsh::{BorshDeserialize, BorshSchema, BorshSerialize},
|
||||||
use num_derive::{FromPrimitive, ToPrimitive};
|
bytemuck::{Pod, Zeroable},
|
||||||
use std::{
|
num_derive::{FromPrimitive, ToPrimitive},
|
||||||
convert::{Infallible, TryFrom},
|
std::{
|
||||||
fmt, mem,
|
convert::{Infallible, TryFrom},
|
||||||
str::FromStr,
|
fmt, mem,
|
||||||
|
str::FromStr,
|
||||||
|
},
|
||||||
|
thiserror::Error,
|
||||||
};
|
};
|
||||||
use thiserror::Error;
|
|
||||||
|
|
||||||
/// Number of bytes in a pubkey
|
/// Number of bytes in a pubkey
|
||||||
pub const PUBKEY_BYTES: usize = 32;
|
pub const PUBKEY_BYTES: usize = 32;
|
||||||
@ -48,20 +50,22 @@ impl From<u64> for PubkeyError {
|
|||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
#[derive(
|
#[derive(
|
||||||
Serialize,
|
AbiExample,
|
||||||
Deserialize,
|
|
||||||
BorshSerialize,
|
|
||||||
BorshDeserialize,
|
BorshDeserialize,
|
||||||
BorshSchema,
|
BorshSchema,
|
||||||
|
BorshSerialize,
|
||||||
Clone,
|
Clone,
|
||||||
Copy,
|
Copy,
|
||||||
Default,
|
Default,
|
||||||
|
Deserialize,
|
||||||
Eq,
|
Eq,
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Hash,
|
Hash,
|
||||||
AbiExample,
|
Ord,
|
||||||
|
PartialEq,
|
||||||
|
PartialOrd,
|
||||||
|
Pod,
|
||||||
|
Serialize,
|
||||||
|
Zeroable,
|
||||||
)]
|
)]
|
||||||
pub struct Pubkey([u8; 32]);
|
pub struct Pubkey([u8; 32]);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user