Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinheavey committed Apr 21, 2024
1 parent cc3a267 commit f319a60
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 35 deletions.
6 changes: 5 additions & 1 deletion curve25519/src/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ pub struct PodScalar(pub [u8; 32]);

#[cfg(not(target_os = "solana"))]
mod target_arch {
use {super::*, crate::errors::{Curve25519Error, ElGamalError}, curve25519_dalek::scalar::Scalar};
use {
super::*,
crate::errors::{Curve25519Error, ElGamalError},
curve25519_dalek::scalar::Scalar,
};

impl From<&Scalar> for PodScalar {
fn from(scalar: &Scalar) -> Self {
Expand Down
24 changes: 6 additions & 18 deletions programs/bpf_loader/src/syscalls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -935,9 +935,7 @@ declare_builtin_function!(
result_point_addr: u64,
memory_mapping: &mut MemoryMapping,
) -> Result<u64, Error> {
use solana_curve25519::{
curve_syscall_traits::*, edwards, ristretto, scalar,
};
use solana_curve25519::{curve_syscall_traits::*, edwards, ristretto, scalar};
match curve_id {
CURVE25519_EDWARDS => match group_op {
ADD => {
Expand Down Expand Up @@ -1136,9 +1134,7 @@ declare_builtin_function!(
result_point_addr: u64,
memory_mapping: &mut MemoryMapping,
) -> Result<u64, Error> {
use solana_curve25519::{
curve_syscall_traits::*, edwards, ristretto, scalar,
};
use solana_curve25519::{curve_syscall_traits::*, edwards, ristretto, scalar};

let restrict_msm_length = invoke_context
.feature_set
Expand Down Expand Up @@ -2767,9 +2763,7 @@ mod tests {

#[test]
fn test_syscall_edwards_curve_group_ops() {
use solana_curve25519::curve_syscall_traits::{
ADD, CURVE25519_EDWARDS, MUL, SUB,
};
use solana_curve25519::curve_syscall_traits::{ADD, CURVE25519_EDWARDS, MUL, SUB};

let config = Config::default();
prepare_mockup!(invoke_context, program_id, bpf_loader::id());
Expand Down Expand Up @@ -2924,9 +2918,7 @@ mod tests {

#[test]
fn test_syscall_ristretto_curve_group_ops() {
use solana_curve25519::curve_syscall_traits::{
ADD, CURVE25519_RISTRETTO, MUL, SUB,
};
use solana_curve25519::curve_syscall_traits::{ADD, CURVE25519_RISTRETTO, MUL, SUB};

let config = Config::default();
prepare_mockup!(invoke_context, program_id, bpf_loader::id());
Expand Down Expand Up @@ -3083,9 +3075,7 @@ mod tests {

#[test]
fn test_syscall_multiscalar_multiplication() {
use solana_curve25519::curve_syscall_traits::{
CURVE25519_EDWARDS, CURVE25519_RISTRETTO,
};
use solana_curve25519::curve_syscall_traits::{CURVE25519_EDWARDS, CURVE25519_RISTRETTO};

let config = Config::default();
prepare_mockup!(invoke_context, program_id, bpf_loader::id());
Expand Down Expand Up @@ -3191,9 +3181,7 @@ mod tests {

#[test]
fn test_syscall_multiscalar_multiplication_maximum_length_exceeded() {
use solana_curve25519::curve_syscall_traits::{
CURVE25519_EDWARDS, CURVE25519_RISTRETTO,
};
use solana_curve25519::curve_syscall_traits::{CURVE25519_EDWARDS, CURVE25519_RISTRETTO};

let config = Config::default();
prepare_mockup!(invoke_context, program_id, bpf_loader::id());
Expand Down
2 changes: 1 addition & 1 deletion zk-token-sdk/src/encryption/elgamal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ use {
traits::Identity,
},
serde::{Deserialize, Serialize},
solana_curve25519::errors::ElGamalError,
solana_sdk::{
derivation_path::DerivationPath,
signature::Signature,
Expand All @@ -39,7 +40,6 @@ use {
SeedDerivable, Signer, SignerError,
},
},
solana_curve25519::errors::ElGamalError,
std::convert::TryInto,
subtle::{Choice, ConstantTimeEq},
zeroize::Zeroize,
Expand Down
3 changes: 1 addition & 2 deletions zk-token-sdk/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use crate::{
range_proof::errors::{RangeProofGenerationError, RangeProofVerificationError},
sigma_proofs::errors::*,
};
use solana_curve25519::errors::ElGamalError;
use thiserror::Error;
use {solana_curve25519::errors::ElGamalError, thiserror::Error};

#[derive(Error, Clone, Debug, Eq, PartialEq)]
pub enum AuthenticatedEncryptionError {
Expand Down
5 changes: 1 addition & 4 deletions zk-token-sdk/src/zk_token_elgamal/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ impl From<PodRistrettoPoint> for pod::DecryptHandle {

#[cfg(not(target_os = "solana"))]
mod target_arch {
use {
super::pod,
curve25519_dalek::ristretto::CompressedRistretto,
};
use {super::pod, curve25519_dalek::ristretto::CompressedRistretto};

impl From<CompressedRistretto> for pod::CompressedRistretto {
fn from(cr: CompressedRistretto) -> Self {
Expand Down
6 changes: 3 additions & 3 deletions zk-token-sdk/src/zk_token_elgamal/pod/grouped_elgamal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
use crate::encryption::grouped_elgamal::GroupedElGamalCiphertext;
use {
crate::zk_token_elgamal::pod::{
elgamal::{ElGamalCiphertext, DECRYPT_HANDLE_LEN, ELGAMAL_CIPHERTEXT_LEN},
pedersen::{PedersenCommitment, PEDERSEN_COMMITMENT_LEN},
Pod, Zeroable,
elgamal::{ElGamalCiphertext, DECRYPT_HANDLE_LEN, ELGAMAL_CIPHERTEXT_LEN},
pedersen::{PedersenCommitment, PEDERSEN_COMMITMENT_LEN},
Pod, Zeroable,
},
solana_curve25519::errors::ElGamalError,
std::fmt,
Expand Down
5 changes: 1 addition & 4 deletions zk-token-sdk/src/zk_token_elgamal/pod/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ use crate::zk_token_elgamal::pod::{
Zeroable,
};
#[cfg(not(target_os = "solana"))]
use {
crate::instruction::transfer as decoded,
solana_curve25519::errors::ElGamalError,
};
use {crate::instruction::transfer as decoded, solana_curve25519::errors::ElGamalError};

#[derive(Clone, Copy, Pod, Zeroable)]
#[repr(C)]
Expand Down
3 changes: 1 addition & 2 deletions zk-token-sdk/src/zk_token_elgamal/pod/pedersen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#[cfg(not(target_os = "solana"))]
use {
crate::encryption::pedersen as decoded,
curve25519_dalek::ristretto::CompressedRistretto,
crate::encryption::pedersen as decoded, curve25519_dalek::ristretto::CompressedRistretto,
solana_curve25519::errors::ElGamalError,
};
use {
Expand Down

0 comments on commit f319a60

Please sign in to comment.