Skip to content

Commit

Permalink
update FeeSigmaProof to PercentageWithCapProof in the `zk_token_e…
Browse files Browse the repository at this point in the history
…lgamal` module
  • Loading branch information
samkim-crypto committed Apr 11, 2024
1 parent 1a62734 commit e366a89
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion zk-token-sdk/src/instruction/fee_sigma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use {
pub struct FeeSigmaProofData {
pub context: FeeSigmaProofContext,

pub proof: pod::FeeSigmaProof,
pub proof: pod::PercentageWithCapProof,
}

/// The context data needed to verify a pubkey validity proof.
Expand Down
2 changes: 1 addition & 1 deletion zk-token-sdk/src/instruction/transfer/with_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ pub struct TransferWithFeeProof {
pub claimed_commitment: pod::PedersenCommitment,
pub equality_proof: pod::CiphertextCommitmentEqualityProof,
pub ciphertext_amount_validity_proof: pod::BatchedGroupedCiphertext2HandlesValidityProof,
pub fee_sigma_proof: pod::FeeSigmaProof,
pub fee_sigma_proof: pod::PercentageWithCapProof,
pub fee_ciphertext_validity_proof: pod::BatchedGroupedCiphertext2HandlesValidityProof,
pub range_proof: pod::RangeProofU256,
}
Expand Down
4 changes: 2 additions & 2 deletions zk-token-sdk/src/zk_token_elgamal/pod/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ pub use {
range_proof::{RangeProofU128, RangeProofU256, RangeProofU64},
sigma_proofs::{
BatchedGroupedCiphertext2HandlesValidityProof, CiphertextCiphertextEqualityProof,
CiphertextCommitmentEqualityProof, FeeSigmaProof, GroupedCiphertext2HandlesValidityProof,
PubkeyValidityProof, ZeroBalanceProof,
CiphertextCommitmentEqualityProof, GroupedCiphertext2HandlesValidityProof,
PercentageWithCapProof, PubkeyValidityProof, ZeroBalanceProof,
},
};

Expand Down
12 changes: 6 additions & 6 deletions zk-token-sdk/src/zk_token_elgamal/pod/sigma_proofs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const BATCHED_GROUPED_CIPHERTEXT_2_HANDLES_VALIDITY_PROOF_LEN: usize = 160;
const ZERO_BALANCE_PROOF_LEN: usize = 96;

/// Byte length of a fee sigma proof
const FEE_SIGMA_PROOF_LEN: usize = 256;
const PERCENTAGE_WITH_CAP_PROOF_LEN: usize = 256;

/// Byte length of a public key validity proof
const PUBKEY_VALIDITY_PROOF_LEN: usize = 64;
Expand Down Expand Up @@ -152,23 +152,23 @@ impl TryFrom<ZeroBalanceProof> for DecodedZeroBalanceProof {
}
}

/// The `FeeSigmaProof` type as a `Pod`.
/// The `PercentageWithCapProof` type as a `Pod`.
#[derive(Clone, Copy, Pod, Zeroable)]
#[repr(transparent)]
pub struct FeeSigmaProof(pub [u8; FEE_SIGMA_PROOF_LEN]);
pub struct PercentageWithCapProof(pub [u8; PERCENTAGE_WITH_CAP_PROOF_LEN]);

#[cfg(not(target_os = "solana"))]
impl From<DecodedPercentageWithCapProof> for FeeSigmaProof {
impl From<DecodedPercentageWithCapProof> for PercentageWithCapProof {
fn from(decoded_proof: DecodedPercentageWithCapProof) -> Self {
Self(decoded_proof.to_bytes())
}
}

#[cfg(not(target_os = "solana"))]
impl TryFrom<FeeSigmaProof> for DecodedPercentageWithCapProof {
impl TryFrom<PercentageWithCapProof> for DecodedPercentageWithCapProof {
type Error = FeeSigmaProofVerificationError;

fn try_from(pod_proof: FeeSigmaProof) -> Result<Self, Self::Error> {
fn try_from(pod_proof: PercentageWithCapProof) -> Result<Self, Self::Error> {
Self::from_bytes(&pod_proof.0)
}
}
Expand Down

0 comments on commit e366a89

Please sign in to comment.