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];
/// Authenticated encryption nonce and ciphertext
#[derive(Debug)]
#[derive(Debug, Default)]
pub struct AeCiphertext {
pub nonce: Nonce,
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)]
mod tests {
use {

View File

@ -70,7 +70,7 @@ impl Pedersen {
}
}
#[derive(Serialize, Deserialize, Clone, Debug, Zeroize)]
#[derive(Serialize, Deserialize, Default, Clone, Debug, Zeroize)]
#[zeroize(drop)]
pub struct PedersenOpening(pub(crate) Scalar);
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 {
type Output = PedersenOpening;

View File

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