Skip to content

Commit

Permalink
crypto: remove re-exports from penumbra-crypto
Browse files Browse the repository at this point in the history
  • Loading branch information
redshiftzero committed Jul 6, 2023
1 parent 9717284 commit 3beed38
Show file tree
Hide file tree
Showing 24 changed files with 39 additions and 36 deletions.
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/bin/pd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ penumbra-tendermint-proxy = { path = "../../util/tendermint-proxy" }

# Penumbra dependencies
decaf377 = { version = "0.4", features = ["parallel"] }
decaf377-rdsa = { version = "0.6" }
tower-abci = "0.8.0"
jmt = "0.6"
tower-actor = "0.1.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/bin/pd/src/testnet.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! Methods and types used for generating testnet configurations.
//! Mostly relevant until Penumbra reaches mainnet.
use anyhow::Context;
use decaf377_rdsa::{SigningKey, SpendAuth, VerificationKey};
use directories::UserDirs;
use penumbra_chain::genesis::AppState;
use penumbra_crypto::rdsa::{SigningKey, SpendAuth, VerificationKey};
use penumbra_keys::keys::{SpendKey, SpendKeyBytes};
use penumbra_wallet::KeyStore;
use rand::Rng;
Expand Down
1 change: 1 addition & 0 deletions crates/core/app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ penumbra-transaction = { path = "../transaction", features = ["parallel"] }

# Penumbra dependencies
decaf377 = { version = "0.4" }
decaf377-rdsa = { version = "0.6" }
jmt = "0.6"
tokio = { version = "1.21.1", features = ["full", "tracing"] }
async-trait = "0.1.52"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use anyhow::{Context, Result};
use ark_ff::PrimeField;
use async_trait::async_trait;
use decaf377::Fq;
use decaf377_rdsa::{VerificationKey, VerificationKeyBytes};
use once_cell::sync::Lazy;
use penumbra_asset::STAKING_TOKEN_DENOM;
use penumbra_chain::component::StateReadExt as _;
use penumbra_crypto::rdsa::{VerificationKey, VerificationKeyBytes};
use penumbra_governance::{ProposalNft, VotingReceiptToken};
use penumbra_keys::keys::{FullViewingKey, NullifierKey};
use penumbra_sct::component::StateReadExt as _;
Expand Down
1 change: 1 addition & 0 deletions crates/core/component/dex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ decaf377-fmd = { path = "../../../crypto/decaf377-fmd/" }
# Penumbra dependencies
poseidon377 = { version = "0.6", features = ["r1cs"] }
decaf377 = {version = "0.4", features = ["r1cs"] }
decaf377-rdsa = {version = "0.6" }

# Crates.io deps
ark-r1cs-std = {version = "0.4", default-features = false }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use std::sync::Arc;

use anyhow::{anyhow, Result};
use ark_ff::Zero;
use async_trait::async_trait;
use decaf377::Fr;
use penumbra_component::ActionHandler;
use penumbra_crypto::{Fr, Zero};
use penumbra_storage::{StateRead, StateWrite};

use crate::{
Expand Down
7 changes: 3 additions & 4 deletions crates/core/component/dex/src/lp/plan.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use ark_ff::Zero;
use decaf377::Fr;
use decaf377_rdsa::{Signature, SpendAuth};
use penumbra_asset::{balance, Balance, Value};
use penumbra_crypto::{
rdsa::{Signature, SpendAuth},
Fr, Zero,
};
use penumbra_proto::{core::dex::v1alpha1 as pb, DomainType, TypeUrl};
use penumbra_tct as tct;
use rand_core::{CryptoRng, RngCore};
Expand Down
3 changes: 2 additions & 1 deletion crates/core/component/dex/src/swap/action.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use anyhow::Context;
use ark_ff::Zero;
use decaf377::Fr;
use penumbra_asset::{balance, Balance, Value};
use penumbra_crypto::{Fr, Zero};
use penumbra_num::Amount;
use penumbra_proto::{
core::crypto::v1alpha1 as pbc, core::dex::v1alpha1 as pb, DomainType, TypeUrl,
Expand Down
2 changes: 1 addition & 1 deletion crates/core/component/dex/src/swap/plan.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use anyhow::{anyhow, Context, Result};
use ark_ff::{UniformRand, Zero};

use decaf377::{FieldExt, Fq, Fr};
use penumbra_asset::{balance, Balance, Value};
use penumbra_crypto::{FieldExt, Fq, Fr};
use penumbra_keys::FullViewingKey;
use penumbra_proto::{core::dex::v1alpha1 as pb, DomainType, TypeUrl};
use rand_core::{CryptoRng, RngCore};
Expand Down
2 changes: 1 addition & 1 deletion crates/core/component/dex/src/swap_claim/plan.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use decaf377::{FieldExt, Fq};
use penumbra_asset::{Balance, Value};
use penumbra_crypto::{FieldExt, Fq};
use penumbra_keys::{
keys::{IncomingViewingKey, NullifierKey},
FullViewingKey,
Expand Down
1 change: 1 addition & 0 deletions crates/core/component/fee/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ penumbra-num = { path = "../../../core/num", default-features = false }

# Penumbra dependencies
decaf377-rdsa = { version = "0.6" }
decaf377 = { version = "0.4" }

# Crates.io dependencies
ark-ff = { version = "0.4", default_features = false }
Expand Down
2 changes: 1 addition & 1 deletion crates/core/component/fee/src/fee.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use penumbra_proto::{core::crypto::v1alpha1 as pb, DomainType, TypeUrl};

use decaf377::Fr;
use penumbra_asset::{asset, balance, Balance, Value, STAKING_TOKEN_ASSET_ID};
use penumbra_crypto::Fr;
use penumbra_num::Amount;

#[derive(Clone, Debug, PartialEq, Eq)]
Expand Down
3 changes: 2 additions & 1 deletion crates/core/component/shielded-pool/src/output/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ use std::convert::{TryFrom, TryInto};

use anyhow::{Context, Error};
use bytes::Bytes;
use decaf377::FieldExt;
use penumbra_asset::balance;
use penumbra_crypto::{EffectHash, EffectingData, FieldExt};
use penumbra_crypto::{EffectHash, EffectingData};
use penumbra_keys::symmetric::{OvkWrappedKey, WrappedMemoKey};
use penumbra_proto::{
core::crypto::v1alpha1 as pbc, core::transaction::v1alpha1 as pb, DomainType, TypeUrl,
Expand Down
3 changes: 2 additions & 1 deletion crates/core/component/shielded-pool/src/output/plan.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use ark_ff::UniformRand;
use decaf377::{FieldExt, Fq, Fr};
use decaf377_ka as ka;
use penumbra_asset::{Balance, Value, STAKING_TOKEN_ASSET_ID};
use penumbra_crypto::{ka, FieldExt, Fq, Fr};
use penumbra_keys::{
keys::{IncomingViewingKey, OutgoingViewingKey},
symmetric::WrappedMemoKey,
Expand Down
7 changes: 3 additions & 4 deletions crates/core/component/shielded-pool/src/spend/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ use std::convert::{TryFrom, TryInto};

use anyhow::{Context, Error};
use bytes::Bytes;
use decaf377::FieldExt;
use decaf377_rdsa::{Signature, SpendAuth, VerificationKey};
use penumbra_asset::balance;
use penumbra_crypto::{
rdsa::{Signature, SpendAuth, VerificationKey},
EffectHash, EffectingData, FieldExt,
};
use penumbra_crypto::{EffectHash, EffectingData};
use penumbra_proto::{core::transaction::v1alpha1 as transaction, DomainType, TypeUrl};
use penumbra_sct::Nullifier;

Expand Down
2 changes: 1 addition & 1 deletion crates/core/component/shielded-pool/src/spend/plan.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use ark_ff::UniformRand;
use decaf377::{FieldExt, Fq, Fr};
use decaf377_rdsa::{Signature, SpendAuth};
use penumbra_asset::{Balance, Value, STAKING_TOKEN_ASSET_ID};
use penumbra_crypto::{FieldExt, Fq, Fr};
use penumbra_keys::{Address, FullViewingKey};
use penumbra_proto::{core::transaction::v1alpha1 as pb, DomainType, TypeUrl};
use penumbra_sct::Nullifier;
Expand Down
3 changes: 2 additions & 1 deletion crates/core/component/stake/src/rate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,12 @@ impl TryFrom<CurrentValidatorRateResponse> for RateData {
#[cfg(test)]
mod tests {
use super::*;
use decaf377_rdsa as rdsa;
use rand_core::OsRng;

#[test]
fn slash_rate_by_penalty() {
let sk = penumbra_crypto::rdsa::SigningKey::new(OsRng);
let sk = rdsa::SigningKey::new(OsRng);
let ik = IdentityKey((&sk).into());

let rate_data = RateData {
Expand Down
5 changes: 3 additions & 2 deletions crates/core/component/stake/src/state_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,15 @@ pub(super) mod internal {

#[cfg(test)]
mod tests {
use decaf377_rdsa as rdsa;
use std::collections::BTreeSet;

use super::*;
use rand_core::OsRng;

#[test]
fn penalty_in_epoch_padding() {
let sk = penumbra_crypto::rdsa::SigningKey::new(OsRng);
let sk = rdsa::SigningKey::new(OsRng);
let ik = IdentityKey((&sk).into());

assert_eq!(
Expand All @@ -112,7 +113,7 @@ mod tests {

#[test]
fn penalty_in_epoch_sorting() {
let sk = penumbra_crypto::rdsa::SigningKey::new(OsRng);
let sk = rdsa::SigningKey::new(OsRng);
let ik = IdentityKey((&sk).into());

let k791 = penalty_in_epoch(&ik, 791);
Expand Down
2 changes: 1 addition & 1 deletion crates/core/component/stake/src/undelegate_claim/plan.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use decaf377::{FieldExt, Fq, Fr};
use penumbra_asset::{asset, balance, Balance};
use penumbra_crypto::{FieldExt, Fq, Fr};
use penumbra_num::Amount;
use penumbra_proof_params::UNDELEGATECLAIM_PROOF_PROVING_KEY;
use penumbra_proto::{core::stake::v1alpha1 as pb, DomainType, TypeUrl};
Expand Down
4 changes: 2 additions & 2 deletions crates/core/component/stake/src/undelegate_claim/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ use ark_snark::SNARK;
use penumbra_proto::{core::crypto::v1alpha1 as pb, DomainType, TypeUrl};
use rand_core::OsRng;

use decaf377::{FieldExt, Fq, Fr};
use penumbra_asset::{
asset, asset::AssetIdVar, balance, balance::commitment::BalanceCommitmentVar, Balance, Value,
STAKING_TOKEN_ASSET_ID,
};
use penumbra_crypto::{FieldExt, Fq, Fr};
use penumbra_num::{Amount, AmountVar};
use penumbra_proof_params::{ParameterSetup, VerifyingKeyExt, GROTH16_PROOF_LENGTH_BYTES};

Expand Down Expand Up @@ -191,7 +191,7 @@ mod tests {
use super::*;
use ark_ff::{PrimeField, UniformRand};
use decaf377::{Fq, Fr};
use penumbra_crypto::rdsa;
use decaf377_rdsa as rdsa;
use penumbra_num::Amount;
use proptest::prelude::*;
use rand_core::OsRng;
Expand Down
2 changes: 1 addition & 1 deletion crates/core/component/stake/src/validator/definition.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use penumbra_crypto::rdsa::{Signature, SpendAuth};
use decaf377_rdsa::{Signature, SpendAuth};
use penumbra_proto::{core::stake::v1alpha1 as pb, DomainType, TypeUrl};
use serde::{Deserialize, Serialize};

Expand Down
7 changes: 0 additions & 7 deletions crates/core/crypto/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#![allow(clippy::clone_on_copy)]
pub use ark_ff::{One, Zero};
pub use decaf377::{FieldExt, Fq, Fr};
pub use decaf377_fmd as fmd;
pub use decaf377_ka as ka;
pub use decaf377_rdsa as rdsa;

mod effect_hash;
mod transaction;

Expand Down
6 changes: 2 additions & 4 deletions crates/core/transaction/src/auth_data.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use penumbra_crypto::{
rdsa::{Signature, SpendAuth},
EffectHash,
};
use decaf377_rdsa::{Signature, SpendAuth};
use penumbra_crypto::EffectHash;
use penumbra_proto::{core::transaction::v1alpha1 as pb, DomainType, TypeUrl};

/// Authorization data returned in response to a
Expand Down

0 comments on commit 3beed38

Please sign in to comment.