Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Tyera <[email protected]>
  • Loading branch information
samkim-crypto and Tyera authored Jun 27, 2023
1 parent 85bd1a1 commit 301a844
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl CiphertextCiphertextEqualityProof {
}
}

/// Creates a ciphertext-commitment equality proof.
/// Verifies a ciphertext-ciphertext equality proof.
///
/// * `source_pubkey` - The ElGamal pubkey associated with the first ciphertext to be proved
/// * `destination_pubkey` - The ElGamal pubkey associated with the second ciphertext to be proved
Expand Down
26 changes: 13 additions & 13 deletions zk-token-sdk/src/sigma_proofs/fee_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,27 @@ impl FeeSigmaProof {
/// - the `fee_rate_basis_point`, which defines the fee rate in units of 0.01%,
/// - the `max_fee`, which defines the cap amount for a transfer fee.
///
/// This means that there are two cases to consider. If `fee_amount` >= `max_fee`, then the
/// This means that there are two cases to consider. If `fee_amount >= max_fee`, then the
/// `fee_amount` must always equal `max_fee`.
///
/// If `fee_amount` < `max_fee`, then assuming that there is no division rounding, the
/// `fee_amount` must satisfy the relation `transfer_amount` * (`fee_rate_basis_point` /
/// 10_000) = `fee_amount` or equivalently, `transfer_amount` * `fee_rate_basis_point` - 10_000
/// * `fee_amount` = 0. More generally, let `delta_fee` = `transfer_amount` *
/// `fee_rate_basis_point` - 10_000 * `fee_amount`. Then assuming that a division rounding
/// could occur, the `delta_fee` must satisfy the bound 0 <= `delta_fee` < 10_000.
/// If `fee_amount < max_fee`, then assuming that there is no division rounding, the
/// `fee_amount` must satisfy the relation `transfer_amount * (fee_rate_basis_point /
/// 10_000) = fee_amount` or equivalently, `(transfer_amount * fee_rate_basis_point) - (10_000
/// * fee_amount) = 0`. More generally, let `delta_fee = (transfer_amount *
/// fee_rate_basis_point) - (10_000 * fee_amount)`. Then assuming that a division rounding
/// could occur, the `delta_fee` must satisfy the bound `0 <= delta_fee < 10_000`.
///
/// If `fee_amount` >= `max_fee`, then `fee_amount` = `max_fee` and therefore, the prover can
/// If `fee_amount >= max_fee`, then `fee_amount = max_fee` and therefore, the prover can
/// generate a proof certifying that a fee commitment exactly encodes `max_fee`. If
/// `fee_amount` < `max_fee`, then the prover can create a commitment to `delta_fee` and
/// create a range proof certifying that the committed value satisfies the bound 0 <=
/// `delta_fee` < 10_000.
/// `fee_amount < max_fee`, then the prover can create a commitment to `delta_fee` and
/// create a range proof certifying that the committed value satisfies the bound `0 <=
/// delta_fee < 10_000`.
///
/// Since the type of proof that a prover generates reveals information about the transfer
/// amount and transfer fee, the prover must generate and include both types of proof. If
/// `fee_amount` >= `max_fee`, then the prover generates a valid `fee_max_proof`, but commits
/// `fee_amount >= max_fee`, then the prover generates a valid `fee_max_proof`, but commits
/// to 0 as the "claimed" delta value and simulates ("fakes") a proof (`fee_equality_proof`)
/// that this is valid. If `fee_amount` > `max_fee`, then the prover simulates a
/// that this is valid. If `fee_amount > max_fee`, then the prover simulates a
/// `fee_max_proof`, and creates a valid `fee_equality_proof` certifying that the claimed delta
/// value is equal to the "real" delta value.
///
Expand Down

0 comments on commit 301a844

Please sign in to comment.