Adapt to changes to native program entrypoint

This commit is contained in:
Michael Vines 2021-10-21 10:49:29 -07:00
parent 93860e88d2
commit 31737406da
3 changed files with 5 additions and 24 deletions

View File

@ -97,7 +97,7 @@ pub type Nonce = [u8; 12];
pub type Ciphertext = [u8; 24]; pub type Ciphertext = [u8; 24];
/// Authenticated encryption nonce and ciphertext /// Authenticated encryption nonce and ciphertext
#[derive(Debug)] #[derive(Debug, Default)]
pub struct AeCiphertext { pub struct AeCiphertext {
pub nonce: Nonce, pub nonce: Nonce,
pub ciphertext: Ciphertext, pub ciphertext: Ciphertext,
@ -129,15 +129,6 @@ impl AeCiphertext {
} }
} }
impl Default for AeCiphertext {
fn default() -> Self {
AeCiphertext {
nonce: [0_u8; 12],
ciphertext: [0_u8; 24],
}
}
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use { use {

View File

@ -70,7 +70,7 @@ impl Pedersen {
} }
} }
#[derive(Serialize, Deserialize, Clone, Debug, Zeroize)] #[derive(Serialize, Deserialize, Default, Clone, Debug, Zeroize)]
#[zeroize(drop)] #[zeroize(drop)]
pub struct PedersenOpening(pub(crate) Scalar); pub struct PedersenOpening(pub(crate) Scalar);
impl PedersenOpening { impl PedersenOpening {
@ -107,12 +107,6 @@ impl ConstantTimeEq for PedersenOpening {
} }
} }
impl Default for PedersenOpening {
fn default() -> Self {
PedersenOpening(Scalar::default())
}
}
impl<'a, 'b> Add<&'b PedersenOpening> for &'a PedersenOpening { impl<'a, 'b> Add<&'b PedersenOpening> for &'a PedersenOpening {
type Output = PedersenOpening; type Output = PedersenOpening;

View File

@ -4,7 +4,7 @@ use {
bytemuck::{bytes_of, Pod}, bytemuck::{bytes_of, Pod},
num_derive::{FromPrimitive, ToPrimitive}, num_derive::{FromPrimitive, ToPrimitive},
num_traits::{FromPrimitive, ToPrimitive}, num_traits::{FromPrimitive, ToPrimitive},
solana_program::{instruction::Instruction, pubkey::Pubkey}, solana_program::instruction::Instruction,
}; };
#[derive(Clone, Copy, Debug, FromPrimitive, ToPrimitive, PartialEq)] #[derive(Clone, Copy, Debug, FromPrimitive, ToPrimitive, PartialEq)]
@ -52,12 +52,8 @@ impl ProofInstruction {
} }
} }
pub fn decode_type(program_id: &Pubkey, input: &[u8]) -> Option<Self> { pub fn decode_type(input: &[u8]) -> Option<Self> {
if *program_id != crate::zk_token_proof_program::id() || input.is_empty() { FromPrimitive::from_u8(input[0])
None
} else {
FromPrimitive::from_u8(input[0])
}
} }
pub fn decode_data<T: Pod>(input: &[u8]) -> Option<&T> { pub fn decode_data<T: Pod>(input: &[u8]) -> Option<&T> {