Derive Pod/Zeroable for Pubkey

(cherry picked from commit f966859829)

# Conflicts:
#	Cargo.lock
#	programs/bpf/Cargo.lock
#	sdk/program/Cargo.toml
This commit is contained in:
Michael Vines
2021-10-06 17:38:34 -07:00
parent 348ba57b12
commit 81d2c3261c
4 changed files with 38 additions and 16 deletions

5
Cargo.lock generated
View File

@ -5130,7 +5130,12 @@ dependencies = [
"borsh-derive",
"bs58 0.3.1",
"bv",
<<<<<<< HEAD
"curve25519-dalek 2.1.0",
=======
"bytemuck",
"curve25519-dalek 3.2.0",
>>>>>>> f96685982 (Derive Pod/Zeroable for Pubkey)
"hex",
"itertools 0.9.0",
"lazy_static",

View File

@ -3295,7 +3295,12 @@ dependencies = [
"borsh-derive",
"bs58 0.3.1",
"bv",
<<<<<<< HEAD
"curve25519-dalek 2.1.0",
=======
"bytemuck",
"curve25519-dalek 3.2.0",
>>>>>>> f96685982 (Derive Pod/Zeroable for Pubkey)
"hex",
"itertools 0.9.0",
"lazy_static",

View File

@ -12,9 +12,17 @@ edition = "2018"
[dependencies]
bincode = "1.3.1"
<<<<<<< HEAD
borsh = "0.9.0"
borsh-derive = "0.9.0"
bs58 = "0.3.1"
=======
blake3 = { version = "1.0.0", features = ["traits-preview"] }
borsh = "0.9.1"
borsh-derive = "0.9.1"
bs58 = "0.4.0"
bytemuck = { version = "1.7.2", features = ["derive"] }
>>>>>>> f96685982 (Derive Pod/Zeroable for Pubkey)
bv = { version = "0.11.1", features = ["serde"] }
hex = "0.4.2"
itertools = "0.9.0"

View File

@ -1,14 +1,16 @@
#![allow(clippy::integer_arithmetic)]
use crate::{decode_error::DecodeError, hash::hashv};
use borsh::{BorshDeserialize, BorshSchema, BorshSerialize};
use num_derive::{FromPrimitive, ToPrimitive};
use std::{
convert::{Infallible, TryFrom},
fmt, mem,
str::FromStr,
use {
crate::{decode_error::DecodeError, hash::hashv},
borsh::{BorshDeserialize, BorshSchema, BorshSerialize},
bytemuck::{Pod, Zeroable},
num_derive::{FromPrimitive, ToPrimitive},
std::{
convert::{Infallible, TryFrom},
fmt, mem,
str::FromStr,
},
thiserror::Error,
};
use thiserror::Error;
/// Number of bytes in a pubkey
pub const PUBKEY_BYTES: usize = 32;
@ -48,20 +50,22 @@ impl From<u64> for PubkeyError {
#[repr(transparent)]
#[derive(
Serialize,
Deserialize,
BorshSerialize,
AbiExample,
BorshDeserialize,
BorshSchema,
BorshSerialize,
Clone,
Copy,
Default,
Deserialize,
Eq,
PartialEq,
Ord,
PartialOrd,
Hash,
AbiExample,
Ord,
PartialEq,
PartialOrd,
Pod,
Serialize,
Zeroable,
)]
pub struct Pubkey([u8; 32]);