Adapt to changes to native program entrypoint
This commit is contained in:
parent
93860e88d2
commit
31737406da
|
@ -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 {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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,13 +52,9 @@ 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() {
|
|
||||||
None
|
|
||||||
} else {
|
|
||||||
FromPrimitive::from_u8(input[0])
|
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> {
|
||||||
if input.is_empty() {
|
if input.is_empty() {
|
||||||
|
|
Loading…
Reference in New Issue