diff --git a/Cargo.lock b/Cargo.lock index 71e5c7faae..7b9f8c2218 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4363,6 +4363,7 @@ dependencies = [ "console-subscriber", "csv", "decaf377", + "decaf377-rdsa", "directories", "ed25519-consensus", "futures", @@ -4488,6 +4489,7 @@ dependencies = [ "bitvec", "blake2b_simd 0.5.11", "decaf377", + "decaf377-rdsa", "ed25519-consensus", "futures", "hex", @@ -4775,6 +4777,7 @@ dependencies = [ "decaf377", "decaf377-fmd", "decaf377-ka", + "decaf377-rdsa", "futures", "hex", "im", @@ -4858,6 +4861,7 @@ dependencies = [ "bincode", "blake2b_simd 0.5.11", "bytes", + "decaf377", "decaf377-rdsa", "metrics", "penumbra-asset", diff --git a/crates/bin/pd/Cargo.toml b/crates/bin/pd/Cargo.toml index a8c511cc21..07edfa8ea0 100644 --- a/crates/bin/pd/Cargo.toml +++ b/crates/bin/pd/Cargo.toml @@ -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" diff --git a/crates/bin/pd/src/testnet.rs b/crates/bin/pd/src/testnet.rs index f0e83dfa84..9641287d28 100644 --- a/crates/bin/pd/src/testnet.rs +++ b/crates/bin/pd/src/testnet.rs @@ -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; diff --git a/crates/core/app/Cargo.toml b/crates/core/app/Cargo.toml index 917ff79368..5a2fbbe1cd 100644 --- a/crates/core/app/Cargo.toml +++ b/crates/core/app/Cargo.toml @@ -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" diff --git a/crates/core/app/src/action_handler/actions/proposal/submit.rs b/crates/core/app/src/action_handler/actions/proposal/submit.rs index 2b4cfb7a2f..9c9dae14e9 100644 --- a/crates/core/app/src/action_handler/actions/proposal/submit.rs +++ b/crates/core/app/src/action_handler/actions/proposal/submit.rs @@ -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 _; diff --git a/crates/core/component/dex/Cargo.toml b/crates/core/component/dex/Cargo.toml index c9eea0aed1..d113377c03 100644 --- a/crates/core/component/dex/Cargo.toml +++ b/crates/core/component/dex/Cargo.toml @@ -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 } diff --git a/crates/core/component/dex/src/component/action_handler/position/withdraw.rs b/crates/core/component/dex/src/component/action_handler/position/withdraw.rs index cd51bc3f9a..2896781995 100644 --- a/crates/core/component/dex/src/component/action_handler/position/withdraw.rs +++ b/crates/core/component/dex/src/component/action_handler/position/withdraw.rs @@ -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::{ diff --git a/crates/core/component/dex/src/lp/plan.rs b/crates/core/component/dex/src/lp/plan.rs index 28d9441e21..1c19b6cab9 100644 --- a/crates/core/component/dex/src/lp/plan.rs +++ b/crates/core/component/dex/src/lp/plan.rs @@ -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}; diff --git a/crates/core/component/dex/src/swap/action.rs b/crates/core/component/dex/src/swap/action.rs index 447ca244f1..075312fc1c 100644 --- a/crates/core/component/dex/src/swap/action.rs +++ b/crates/core/component/dex/src/swap/action.rs @@ -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, diff --git a/crates/core/component/dex/src/swap/plan.rs b/crates/core/component/dex/src/swap/plan.rs index 24107781a7..940a4a0b97 100644 --- a/crates/core/component/dex/src/swap/plan.rs +++ b/crates/core/component/dex/src/swap/plan.rs @@ -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}; diff --git a/crates/core/component/dex/src/swap_claim/plan.rs b/crates/core/component/dex/src/swap_claim/plan.rs index dd27d338da..e03b00d9d6 100644 --- a/crates/core/component/dex/src/swap_claim/plan.rs +++ b/crates/core/component/dex/src/swap_claim/plan.rs @@ -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, diff --git a/crates/core/component/fee/Cargo.toml b/crates/core/component/fee/Cargo.toml index 6b59a37d79..7092a53d38 100644 --- a/crates/core/component/fee/Cargo.toml +++ b/crates/core/component/fee/Cargo.toml @@ -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 } diff --git a/crates/core/component/fee/src/fee.rs b/crates/core/component/fee/src/fee.rs index a679071225..9f19742fef 100644 --- a/crates/core/component/fee/src/fee.rs +++ b/crates/core/component/fee/src/fee.rs @@ -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)] diff --git a/crates/core/component/shielded-pool/src/output/action.rs b/crates/core/component/shielded-pool/src/output/action.rs index 6ee0deae9c..1ba8e47c89 100644 --- a/crates/core/component/shielded-pool/src/output/action.rs +++ b/crates/core/component/shielded-pool/src/output/action.rs @@ -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, diff --git a/crates/core/component/shielded-pool/src/output/plan.rs b/crates/core/component/shielded-pool/src/output/plan.rs index 49dd5f72f6..327370439d 100644 --- a/crates/core/component/shielded-pool/src/output/plan.rs +++ b/crates/core/component/shielded-pool/src/output/plan.rs @@ -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, diff --git a/crates/core/component/shielded-pool/src/spend/action.rs b/crates/core/component/shielded-pool/src/spend/action.rs index c383c1ecbc..c45ab4e197 100644 --- a/crates/core/component/shielded-pool/src/spend/action.rs +++ b/crates/core/component/shielded-pool/src/spend/action.rs @@ -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; diff --git a/crates/core/component/shielded-pool/src/spend/plan.rs b/crates/core/component/shielded-pool/src/spend/plan.rs index 044190eda4..3342cec075 100644 --- a/crates/core/component/shielded-pool/src/spend/plan.rs +++ b/crates/core/component/shielded-pool/src/spend/plan.rs @@ -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; diff --git a/crates/core/component/stake/src/rate.rs b/crates/core/component/stake/src/rate.rs index bb11e15ede..2a3f429459 100644 --- a/crates/core/component/stake/src/rate.rs +++ b/crates/core/component/stake/src/rate.rs @@ -296,11 +296,12 @@ impl TryFrom 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 { diff --git a/crates/core/component/stake/src/state_key.rs b/crates/core/component/stake/src/state_key.rs index ef6f7e1318..c46f7d76af 100644 --- a/crates/core/component/stake/src/state_key.rs +++ b/crates/core/component/stake/src/state_key.rs @@ -93,6 +93,7 @@ pub(super) mod internal { #[cfg(test)] mod tests { + use decaf377_rdsa as rdsa; use std::collections::BTreeSet; use super::*; @@ -100,7 +101,7 @@ mod tests { #[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!( @@ -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); diff --git a/crates/core/component/stake/src/undelegate_claim/plan.rs b/crates/core/component/stake/src/undelegate_claim/plan.rs index eabf3df7a3..0700c47190 100644 --- a/crates/core/component/stake/src/undelegate_claim/plan.rs +++ b/crates/core/component/stake/src/undelegate_claim/plan.rs @@ -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}; diff --git a/crates/core/component/stake/src/undelegate_claim/proof.rs b/crates/core/component/stake/src/undelegate_claim/proof.rs index 94672833cf..82e05fef89 100644 --- a/crates/core/component/stake/src/undelegate_claim/proof.rs +++ b/crates/core/component/stake/src/undelegate_claim/proof.rs @@ -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}; @@ -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; diff --git a/crates/core/component/stake/src/validator/definition.rs b/crates/core/component/stake/src/validator/definition.rs index 016180564c..3375316388 100644 --- a/crates/core/component/stake/src/validator/definition.rs +++ b/crates/core/component/stake/src/validator/definition.rs @@ -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}; diff --git a/crates/core/crypto/src/lib.rs b/crates/core/crypto/src/lib.rs index c2057a3305..776941789e 100644 --- a/crates/core/crypto/src/lib.rs +++ b/crates/core/crypto/src/lib.rs @@ -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; diff --git a/crates/core/transaction/src/auth_data.rs b/crates/core/transaction/src/auth_data.rs index 8d1534e89e..8e4fe9f0e1 100644 --- a/crates/core/transaction/src/auth_data.rs +++ b/crates/core/transaction/src/auth_data.rs @@ -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