diff --git a/crates/bin/pcli/src/command/tx.rs b/crates/bin/pcli/src/command/tx.rs index 7e691f4164..5d66401437 100644 --- a/crates/bin/pcli/src/command/tx.rs +++ b/crates/bin/pcli/src/command/tx.rs @@ -22,7 +22,7 @@ use penumbra_proto::{ EpochByHeightRequest, LiquidityPositionByIdRequest, ProposalInfoRequest, ProposalInfoResponse, ProposalRateDataRequest, ValidatorPenaltyRequest, }, - core::dex::v1alpha1::PositionId, + core::component::dex::v1alpha1::PositionId, }; use penumbra_stake::rate::RateData; use penumbra_stake::{DelegationToken, IdentityKey, Penalty, UnbondingToken, UndelegateClaimPlan}; diff --git a/crates/bin/pcli/src/command/validator.rs b/crates/bin/pcli/src/command/validator.rs index e05b8cabf2..d7d78d1aad 100644 --- a/crates/bin/pcli/src/command/validator.rs +++ b/crates/bin/pcli/src/command/validator.rs @@ -7,7 +7,9 @@ use anyhow::{Context, Result}; use penumbra_fee::Fee; use penumbra_governance::{ValidatorVote, ValidatorVoteBody, Vote}; use penumbra_keys::keys::AddressIndex; -use penumbra_proto::{core::stake::v1alpha1::Validator as ProtoValidator, DomainType, Message}; +use penumbra_proto::{ + core::component::stake::v1alpha1::Validator as ProtoValidator, DomainType, Message, +}; use penumbra_stake::{ validator, validator::{Validator, ValidatorToml}, diff --git a/crates/bin/pclientd/tests/network_integration.rs b/crates/bin/pclientd/tests/network_integration.rs index 94eb1d99c3..d13ac9981d 100644 --- a/crates/bin/pclientd/tests/network_integration.rs +++ b/crates/bin/pclientd/tests/network_integration.rs @@ -13,7 +13,7 @@ use penumbra_asset::{asset, Value, STAKING_TOKEN_ASSET_ID}; use penumbra_chain::test_keys; use penumbra_custody::soft_kms; use penumbra_proto::{ - core::{crypto::v1alpha1::Fee, ibc::v1alpha1::IbcAction}, + core::{component::fee::v1alpha1::Fee, component::ibc::v1alpha1::IbcAction}, custody::v1alpha1::{ custody_protocol_service_client::CustodyProtocolServiceClient, AuthorizeRequest, }, @@ -230,7 +230,7 @@ async fn swap_claim_flow() -> anyhow::Result<()> { // Here we don't want to use the Penumbra Rust libraries much, because // we're executing as if we were a Go program that had to construct all these // protos manually, with no access to Penumbra crypto. - use penumbra_proto::core::crypto::v1alpha1 as crypto; + use penumbra_proto::core::num::v1alpha1 as num; use penumbra_proto::view::v1alpha1::transaction_planner_request as tpr; // 5.1. Generate a transaction plan performing a swap. Since there are no liquidity positions @@ -252,7 +252,7 @@ async fn swap_claim_flow() -> anyhow::Result<()> { ), target_asset: Some(gm.into()), fee: Some(Fee { - amount: Some(crypto::Amount { lo: 0, hi: 0 }), + amount: Some(num::Amount { lo: 0, hi: 0 }), asset_id: None, }), claim_address: Some(test_keys::ADDRESS_1.clone().into()), diff --git a/crates/bin/pd/src/info/specific.rs b/crates/bin/pd/src/info/specific.rs index 4f4cd9ea11..d42b410f25 100644 --- a/crates/bin/pd/src/info/specific.rs +++ b/crates/bin/pd/src/info/specific.rs @@ -366,9 +366,11 @@ impl SpecificQueryService for Info { } }; Ok(tonic::Response::new( - s.map_ok(|p: penumbra_proto::core::dex::v1alpha1::Position| { - LiquidityPositionsByIdResponse { data: Some(p) } - }) + s.map_ok( + |p: penumbra_proto::core::component::dex::v1alpha1::Position| { + LiquidityPositionsByIdResponse { data: Some(p) } + }, + ) .map_err(|e: anyhow::Error| { tonic::Status::unavailable(format!( "error getting position value from storage: {e}" diff --git a/crates/core/component/chain/src/effect_hash.rs b/crates/core/component/chain/src/effect_hash.rs index b83daa0dcc..8b2610e87f 100644 --- a/crates/core/component/chain/src/effect_hash.rs +++ b/crates/core/component/chain/src/effect_hash.rs @@ -1,4 +1,6 @@ -use penumbra_proto::{core::crypto::v1alpha1 as pb_crypto, DomainType, TypeUrl}; +use penumbra_proto::{ + penumbra::core::component::chain::v1alpha1 as pb_crypto, DomainType, TypeUrl, +}; /// Something that can be hashed to produce an [`EffectHash`]. pub trait EffectingData { diff --git a/crates/core/component/chain/src/epoch.rs b/crates/core/component/chain/src/epoch.rs index 49cdc2ef71..45b2d15179 100644 --- a/crates/core/component/chain/src/epoch.rs +++ b/crates/core/component/chain/src/epoch.rs @@ -1,4 +1,4 @@ -use penumbra_proto::{core::chain::v1alpha1 as pb_chain, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::chain::v1alpha1 as pb_chain, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; /// Penumbra groups blocks into epochs and restricts validator changes to epoch boundaries. diff --git a/crates/core/component/chain/src/genesis/allocation.rs b/crates/core/component/chain/src/genesis/allocation.rs index e00c9e238d..cf3f1e1943 100644 --- a/crates/core/component/chain/src/genesis/allocation.rs +++ b/crates/core/component/chain/src/genesis/allocation.rs @@ -1,6 +1,6 @@ use penumbra_keys::Address; use penumbra_num::Amount; -use penumbra_proto::{core::chain::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::chain::v1alpha1 as pb, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; /// A (transparent) genesis allocation. diff --git a/crates/core/component/chain/src/genesis/app_state.rs b/crates/core/component/chain/src/genesis/app_state.rs index 212416f541..e5d4a42bbe 100644 --- a/crates/core/component/chain/src/genesis/app_state.rs +++ b/crates/core/component/chain/src/genesis/app_state.rs @@ -1,6 +1,10 @@ use anyhow::Context; use penumbra_proto::{ - core::chain::v1alpha1 as pb, core::stake::v1alpha1 as pb_stake, DomainType, TypeUrl, + // TODO: avoid this import! + core::component::stake::v1alpha1 as pb_stake, + penumbra::core::component::chain::v1alpha1 as pb, + DomainType, + TypeUrl, }; use serde::{Deserialize, Serialize}; diff --git a/crates/core/component/chain/src/known_assets.rs b/crates/core/component/chain/src/known_assets.rs index 5c4eb3c0cd..6d60f87599 100644 --- a/crates/core/component/chain/src/known_assets.rs +++ b/crates/core/component/chain/src/known_assets.rs @@ -1,5 +1,5 @@ use penumbra_asset::asset::{self, DenomMetadata}; -use penumbra_proto::{core::chain::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::chain::v1alpha1 as pb, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Default, Serialize, Deserialize)] diff --git a/crates/core/component/chain/src/note_source.rs b/crates/core/component/chain/src/note_source.rs index 032c69a632..98111ea99f 100644 --- a/crates/core/component/chain/src/note_source.rs +++ b/crates/core/component/chain/src/note_source.rs @@ -1,5 +1,5 @@ use anyhow::{anyhow, Result}; -use penumbra_proto::{core::chain::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::chain::v1alpha1 as pb, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; #[derive(Clone, Copy, Serialize, Deserialize, PartialEq, Eq)] diff --git a/crates/core/component/chain/src/params.rs b/crates/core/component/chain/src/params.rs index faf119323d..6b63371787 100644 --- a/crates/core/component/chain/src/params.rs +++ b/crates/core/component/chain/src/params.rs @@ -8,7 +8,7 @@ use std::{ use anyhow::Context; use penumbra_num::Amount; use penumbra_proto::client::v1alpha1 as pb_client; -use penumbra_proto::core::chain::v1alpha1 as pb_chain; +use penumbra_proto::penumbra::core::component::chain::v1alpha1 as pb_chain; use penumbra_proto::view::v1alpha1 as pb_view; use penumbra_proto::{DomainType, TypeUrl}; @@ -16,6 +16,7 @@ use serde::{Deserialize, Serialize}; pub mod change; +// TODO: lift into the App #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] #[serde( try_from = "pb_chain::ChainParameters", diff --git a/crates/core/component/compact-block/src/compact_block.rs b/crates/core/component/compact-block/src/compact_block.rs index 361edaadcc..ea8639f897 100644 --- a/crates/core/component/compact-block/src/compact_block.rs +++ b/crates/core/component/compact-block/src/compact_block.rs @@ -4,7 +4,8 @@ use anyhow::Result; use penumbra_chain::params::{ChainParameters, FmdParameters}; use penumbra_dex::{BatchSwapOutputData, TradingPair}; use penumbra_proto::{ - client::v1alpha1::CompactBlockRangeResponse, core::chain::v1alpha1 as pb, DomainType, TypeUrl, + client::v1alpha1::CompactBlockRangeResponse, + penumbra::core::component::compact_block::v1alpha1 as pb, DomainType, TypeUrl, }; use penumbra_sct::Nullifier; use penumbra_tct::builder::{block, epoch}; diff --git a/crates/core/component/compact-block/src/state_payload.rs b/crates/core/component/compact-block/src/state_payload.rs index c412a50598..3fe17c8c41 100644 --- a/crates/core/component/compact-block/src/state_payload.rs +++ b/crates/core/component/compact-block/src/state_payload.rs @@ -2,7 +2,7 @@ use std::convert::TryFrom; use anyhow::Result; use penumbra_dex::swap::SwapPayload; -use penumbra_proto::core::chain::v1alpha1::{self as pb}; +use penumbra_proto::penumbra::core::component::compact_block::v1alpha1::{self as pb}; use penumbra_shielded_pool::{note, NotePayload}; use serde::{Deserialize, Serialize}; diff --git a/crates/core/component/dao/src/action/dao_deposit.rs b/crates/core/component/dao/src/action/dao_deposit.rs index 14d72d7d49..f89f607a89 100644 --- a/crates/core/component/dao/src/action/dao_deposit.rs +++ b/crates/core/component/dao/src/action/dao_deposit.rs @@ -3,7 +3,8 @@ use serde::{Deserialize, Serialize}; use std::convert::{TryFrom, TryInto}; use penumbra_asset::{Balance, Value}; -use penumbra_proto::{core::governance::v1alpha1 as pb, DomainType, TypeUrl}; +// TODO: why are the Dao actions not in the dao protos? +use penumbra_proto::{penumbra::core::component::governance::v1alpha1 as pb, DomainType, TypeUrl}; #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(try_from = "pb::DaoDeposit", into = "pb::DaoDeposit")] diff --git a/crates/core/component/dao/src/action/dao_output.rs b/crates/core/component/dao/src/action/dao_output.rs index 3de22efed1..e86ff3e806 100644 --- a/crates/core/component/dao/src/action/dao_output.rs +++ b/crates/core/component/dao/src/action/dao_output.rs @@ -4,7 +4,7 @@ use std::convert::{TryFrom, TryInto}; use penumbra_asset::{Balance, Value}; use penumbra_keys::Address; -use penumbra_proto::{core::governance::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::governance::v1alpha1 as pb, DomainType, TypeUrl}; #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(try_from = "pb::DaoOutput", into = "pb::DaoOutput")] diff --git a/crates/core/component/dao/src/action/dao_spend.rs b/crates/core/component/dao/src/action/dao_spend.rs index 05de4ac917..71adf9104b 100644 --- a/crates/core/component/dao/src/action/dao_spend.rs +++ b/crates/core/component/dao/src/action/dao_spend.rs @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize}; use std::convert::{TryFrom, TryInto}; use penumbra_asset::{Balance, Value}; -use penumbra_proto::{core::governance::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::governance::v1alpha1 as pb, DomainType, TypeUrl}; #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(try_from = "pb::DaoSpend", into = "pb::DaoSpend")] diff --git a/crates/core/component/dex/src/batch_swap_output_data.rs b/crates/core/component/dex/src/batch_swap_output_data.rs index 21af60a66c..b33b55baf8 100644 --- a/crates/core/component/dex/src/batch_swap_output_data.rs +++ b/crates/core/component/dex/src/batch_swap_output_data.rs @@ -8,7 +8,8 @@ use ark_r1cs_std::{ use ark_relations::r1cs::{ConstraintSystemRef, SynthesisError}; use decaf377::{r1cs::FqVar, Fq}; use penumbra_proto::{ - client::v1alpha1::BatchSwapOutputDataResponse, core::dex::v1alpha1 as pb, DomainType, TypeUrl, + client::v1alpha1::BatchSwapOutputDataResponse, penumbra::core::component::dex::v1alpha1 as pb, + DomainType, TypeUrl, }; use serde::{Deserialize, Serialize}; diff --git a/crates/core/component/dex/src/lp/action.rs b/crates/core/component/dex/src/lp/action.rs index 791f45e7ed..edd7dd4c55 100644 --- a/crates/core/component/dex/src/lp/action.rs +++ b/crates/core/component/dex/src/lp/action.rs @@ -1,7 +1,7 @@ use serde::{Deserialize, Serialize}; use penumbra_asset::{balance, Balance, Value}; -use penumbra_proto::{core::dex::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::dex::v1alpha1 as pb, DomainType, TypeUrl}; use super::{position, position::Position, LpNft}; diff --git a/crates/core/component/dex/src/lp/nft.rs b/crates/core/component/dex/src/lp/nft.rs index a2d9c34a46..1cb3e388d8 100644 --- a/crates/core/component/dex/src/lp/nft.rs +++ b/crates/core/component/dex/src/lp/nft.rs @@ -1,5 +1,5 @@ use penumbra_asset::asset; -use penumbra_proto::{core::dex::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::dex::v1alpha1 as pb, DomainType, TypeUrl}; use regex::Regex; use super::position::{Id, State}; diff --git a/crates/core/component/dex/src/lp/plan.rs b/crates/core/component/dex/src/lp/plan.rs index 1c19b6cab9..bb35aa3208 100644 --- a/crates/core/component/dex/src/lp/plan.rs +++ b/crates/core/component/dex/src/lp/plan.rs @@ -2,7 +2,7 @@ use ark_ff::Zero; use decaf377::Fr; use decaf377_rdsa::{Signature, SpendAuth}; use penumbra_asset::{balance, Balance, Value}; -use penumbra_proto::{core::dex::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::dex::v1alpha1 as pb, DomainType, TypeUrl}; use penumbra_tct as tct; use rand_core::{CryptoRng, RngCore}; use serde::{Deserialize, Serialize}; diff --git a/crates/core/component/dex/src/lp/position.rs b/crates/core/component/dex/src/lp/position.rs index 712d15e10f..3d357e8b36 100644 --- a/crates/core/component/dex/src/lp/position.rs +++ b/crates/core/component/dex/src/lp/position.rs @@ -1,7 +1,9 @@ use anyhow::{anyhow, Context}; use penumbra_asset::asset; use penumbra_num::Amount; -use penumbra_proto::{core::dex::v1alpha1 as pb, serializers::bech32str, DomainType, TypeUrl}; +use penumbra_proto::{ + penumbra::core::component::dex::v1alpha1 as pb, serializers::bech32str, DomainType, TypeUrl, +}; use rand_core::CryptoRngCore; use serde::{Deserialize, Serialize}; diff --git a/crates/core/component/dex/src/lp/reserves.rs b/crates/core/component/dex/src/lp/reserves.rs index d4e89232c5..b0ce4dfd44 100644 --- a/crates/core/component/dex/src/lp/reserves.rs +++ b/crates/core/component/dex/src/lp/reserves.rs @@ -1,6 +1,6 @@ use penumbra_asset::{Balance, Value}; use penumbra_num::Amount; -use penumbra_proto::{core::dex::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::dex::v1alpha1 as pb, DomainType, TypeUrl}; use crate::TradingPair; diff --git a/crates/core/component/dex/src/lp/trading_function.rs b/crates/core/component/dex/src/lp/trading_function.rs index 2584c139a7..8bebe50473 100644 --- a/crates/core/component/dex/src/lp/trading_function.rs +++ b/crates/core/component/dex/src/lp/trading_function.rs @@ -1,7 +1,7 @@ use anyhow::{anyhow, Result}; use penumbra_asset::{asset, Value}; use penumbra_num::{fixpoint::U128x128, Amount}; -use penumbra_proto::{core::dex::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::dex::v1alpha1 as pb, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; use tracing::instrument; diff --git a/crates/core/component/dex/src/swap/action.rs b/crates/core/component/dex/src/swap/action.rs index e23e335f0b..0790249fb8 100644 --- a/crates/core/component/dex/src/swap/action.rs +++ b/crates/core/component/dex/src/swap/action.rs @@ -4,7 +4,8 @@ use decaf377::Fr; use penumbra_asset::{balance, Balance, Value}; use penumbra_num::Amount; use penumbra_proto::{ - core::crypto::v1alpha1 as pbc, core::dex::v1alpha1 as pb, DomainType, TypeUrl, + core::component::dex::v1alpha1 as pbc, penumbra::core::component::dex::v1alpha1 as pb, + DomainType, TypeUrl, }; use serde::{Deserialize, Serialize}; diff --git a/crates/core/component/dex/src/swap/payload.rs b/crates/core/component/dex/src/swap/payload.rs index 011597a107..9291f326a9 100644 --- a/crates/core/component/dex/src/swap/payload.rs +++ b/crates/core/component/dex/src/swap/payload.rs @@ -1,6 +1,6 @@ use anyhow::anyhow; use penumbra_keys::FullViewingKey; -use penumbra_proto::core::dex::v1alpha1 as pb; +use penumbra_proto::penumbra::core::component::dex::v1alpha1 as pb; use serde::{Deserialize, Serialize}; use super::{SwapCiphertext, SwapPlaintext}; diff --git a/crates/core/component/dex/src/swap/plaintext.rs b/crates/core/component/dex/src/swap/plaintext.rs index 4c9ad3125f..60613348e2 100644 --- a/crates/core/component/dex/src/swap/plaintext.rs +++ b/crates/core/component/dex/src/swap/plaintext.rs @@ -8,7 +8,8 @@ use decaf377::{FieldExt, Fq}; use once_cell::sync::Lazy; use penumbra_fee::Fee; use penumbra_proto::{ - core::crypto::v1alpha1 as pb_crypto, core::dex::v1alpha1 as pb, DomainType, TypeUrl, + core::keys::v1alpha1 as pb_keys, penumbra::core::component::dex::v1alpha1 as pb, DomainType, + TypeUrl, }; use penumbra_tct::StateCommitment; use poseidon377::{hash_1, hash_4, hash_7}; @@ -334,7 +335,7 @@ impl From<&SwapPlaintext> for [u8; SWAP_LEN_BYTES] { bytes[80..96].copy_from_slice(&swap.delta_2_i.to_le_bytes()); bytes[96..112].copy_from_slice(&swap.claim_fee.0.amount.to_le_bytes()); bytes[112..144].copy_from_slice(&swap.claim_fee.0.asset_id.to_bytes()); - let pb_address = pb_crypto::Address::from(swap.claim_address); + let pb_address = pb_keys::Address::from(swap.claim_address); bytes[144..224].copy_from_slice(&pb_address.inner); bytes[224..256].copy_from_slice(&swap.rseed.to_bytes()); bytes @@ -373,7 +374,7 @@ impl TryFrom<&[u8]> for SwapPlaintext { let address_bytes: [u8; 80] = bytes[144..224] .try_into() .map_err(|_| anyhow!("error fetching address bytes"))?; - let pb_address = pb_crypto::Address { + let pb_address = pb_keys::Address { inner: address_bytes.to_vec(), alt_bech32m: String::new(), }; diff --git a/crates/core/component/dex/src/swap/plan.rs b/crates/core/component/dex/src/swap/plan.rs index 940a4a0b97..1a996d3abb 100644 --- a/crates/core/component/dex/src/swap/plan.rs +++ b/crates/core/component/dex/src/swap/plan.rs @@ -4,7 +4,7 @@ use ark_ff::{UniformRand, Zero}; use decaf377::{FieldExt, Fq, Fr}; use penumbra_asset::{balance, Balance, Value}; use penumbra_keys::FullViewingKey; -use penumbra_proto::{core::dex::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::dex::v1alpha1 as pb, DomainType, TypeUrl}; use rand_core::{CryptoRng, RngCore}; use serde::{Deserialize, Serialize}; diff --git a/crates/core/component/dex/src/swap/proof.rs b/crates/core/component/dex/src/swap/proof.rs index f7951c7442..9d518ee3e0 100644 --- a/crates/core/component/dex/src/swap/proof.rs +++ b/crates/core/component/dex/src/swap/proof.rs @@ -12,7 +12,7 @@ use decaf377::{Fq, Fr}; use decaf377_fmd as fmd; use decaf377_ka as ka; use penumbra_fee::Fee; -use penumbra_proto::{core::crypto::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{core::component::dex::v1alpha1 as pb, DomainType, TypeUrl}; use penumbra_tct as tct; use penumbra_tct::r1cs::StateCommitmentVar; diff --git a/crates/core/component/dex/src/swap/view.rs b/crates/core/component/dex/src/swap/view.rs index 79b1b3f694..d8a7c61300 100644 --- a/crates/core/component/dex/src/swap/view.rs +++ b/crates/core/component/dex/src/swap/view.rs @@ -1,4 +1,4 @@ -use penumbra_proto::{core::dex::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::dex::v1alpha1 as pb, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; use super::{Swap, SwapPlaintext}; diff --git a/crates/core/component/dex/src/swap_claim/action.rs b/crates/core/component/dex/src/swap_claim/action.rs index b8e196c41d..288297d788 100644 --- a/crates/core/component/dex/src/swap_claim/action.rs +++ b/crates/core/component/dex/src/swap_claim/action.rs @@ -2,7 +2,7 @@ use anyhow::Context; use penumbra_asset::Balance; use penumbra_fee::Fee; use penumbra_proof_params::GROTH16_PROOF_LENGTH_BYTES; -use penumbra_proto::{core::dex::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::dex::v1alpha1 as pb, DomainType, TypeUrl}; use penumbra_sct::Nullifier; use penumbra_tct as tct; use serde::{Deserialize, Serialize}; @@ -37,7 +37,7 @@ impl DomainType for SwapClaim { impl From for pb::SwapClaim { fn from(sc: SwapClaim) -> Self { pb::SwapClaim { - proof: sc.proof.0.into(), + proof: Some(sc.proof.into()), body: Some(sc.body.into()), epoch_duration: sc.epoch_duration, } @@ -47,7 +47,11 @@ impl From for pb::SwapClaim { impl TryFrom for SwapClaim { type Error = anyhow::Error; fn try_from(sc: pb::SwapClaim) -> Result { - let proof_bytes: [u8; GROTH16_PROOF_LENGTH_BYTES] = (sc.proof[..]) + let proof_bytes: [u8; GROTH16_PROOF_LENGTH_BYTES] = sc + .proof + .ok_or_else(|| anyhow::anyhow!("missing swap claim proof"))? + .inner + .as_slice() .try_into() .context("swap claim proof malformed")?; Ok(Self { diff --git a/crates/core/component/dex/src/swap_claim/plan.rs b/crates/core/component/dex/src/swap_claim/plan.rs index e03b00d9d6..34275e846d 100644 --- a/crates/core/component/dex/src/swap_claim/plan.rs +++ b/crates/core/component/dex/src/swap_claim/plan.rs @@ -5,7 +5,7 @@ use penumbra_keys::{ FullViewingKey, }; use penumbra_proof_params::SWAPCLAIM_PROOF_PROVING_KEY; -use penumbra_proto::{core::dex::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::dex::v1alpha1 as pb, DomainType, TypeUrl}; use penumbra_sct::Nullifier; use penumbra_tct as tct; diff --git a/crates/core/component/dex/src/swap_claim/proof.rs b/crates/core/component/dex/src/swap_claim/proof.rs index 4551d8939d..a90ad34ac2 100644 --- a/crates/core/component/dex/src/swap_claim/proof.rs +++ b/crates/core/component/dex/src/swap_claim/proof.rs @@ -8,7 +8,7 @@ use ark_serialize::{CanonicalDeserialize, CanonicalSerialize}; use ark_snark::SNARK; use decaf377::{r1cs::FqVar, Bls12_377, Fq}; use penumbra_fee::Fee; -use penumbra_proto::{core::crypto::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{core::component::dex::v1alpha1 as pb, DomainType, TypeUrl}; use penumbra_tct as tct; use penumbra_tct::r1cs::StateCommitmentVar; diff --git a/crates/core/component/dex/src/swap_claim/view.rs b/crates/core/component/dex/src/swap_claim/view.rs index 1ed65032e1..01ba616c71 100644 --- a/crates/core/component/dex/src/swap_claim/view.rs +++ b/crates/core/component/dex/src/swap_claim/view.rs @@ -1,4 +1,4 @@ -use penumbra_proto::{core::dex::v1alpha1 as pbd, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::dex::v1alpha1 as pbd, DomainType, TypeUrl}; use penumbra_shielded_pool::NoteView; use serde::{Deserialize, Serialize}; diff --git a/crates/core/component/dex/src/swap_execution.rs b/crates/core/component/dex/src/swap_execution.rs index cad55fed47..d5bcd8ebb8 100644 --- a/crates/core/component/dex/src/swap_execution.rs +++ b/crates/core/component/dex/src/swap_execution.rs @@ -1,7 +1,7 @@ use anyhow::Result; use penumbra_asset::Value; use penumbra_num::fixpoint::U128x128; -use penumbra_proto::{core::dex::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::dex::v1alpha1 as pb, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; /// Contains the summary data of a trade, for client consumption. diff --git a/crates/core/component/dex/src/trading_pair.rs b/crates/core/component/dex/src/trading_pair.rs index 132d925477..062a99fcf5 100644 --- a/crates/core/component/dex/src/trading_pair.rs +++ b/crates/core/component/dex/src/trading_pair.rs @@ -3,7 +3,7 @@ use ark_ff::ToConstraintField; use ark_r1cs_std::prelude::{AllocVar, EqGadget}; use ark_relations::r1cs::SynthesisError; use decaf377::{FieldExt, Fq}; -use penumbra_proto::{core::dex::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::dex::v1alpha1 as pb, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; use std::{fmt, str::FromStr}; diff --git a/crates/core/component/governance/src/delegator_vote/action.rs b/crates/core/component/governance/src/delegator_vote/action.rs index 57661300a8..b59dfc793e 100644 --- a/crates/core/component/governance/src/delegator_vote/action.rs +++ b/crates/core/component/governance/src/delegator_vote/action.rs @@ -4,7 +4,7 @@ use crate::{vote::Vote, DelegatorVoteProof}; use decaf377_rdsa::{Signature, SpendAuth, VerificationKey}; use penumbra_asset::Value; use penumbra_num::Amount; -use penumbra_proto::{core::governance::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{core::component::governance::v1alpha1 as pb, DomainType, TypeUrl}; use penumbra_sct::Nullifier; use penumbra_tct as tct; diff --git a/crates/core/component/governance/src/delegator_vote/plan.rs b/crates/core/component/governance/src/delegator_vote/plan.rs index 12568663e8..0c7e1005d8 100644 --- a/crates/core/component/governance/src/delegator_vote/plan.rs +++ b/crates/core/component/governance/src/delegator_vote/plan.rs @@ -6,7 +6,7 @@ use penumbra_asset::{Balance, Value}; use penumbra_keys::FullViewingKey; use penumbra_num::Amount; use penumbra_proof_params::DELEGATOR_VOTE_PROOF_PROVING_KEY; -use penumbra_proto::{core::governance::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{core::component::governance::v1alpha1 as pb, DomainType, TypeUrl}; use penumbra_sct::Nullifier; use penumbra_shielded_pool::Note; use penumbra_tct as tct; diff --git a/crates/core/component/governance/src/delegator_vote/proof.rs b/crates/core/component/governance/src/delegator_vote/proof.rs index 28a530716e..13cd7ab9f0 100644 --- a/crates/core/component/governance/src/delegator_vote/proof.rs +++ b/crates/core/component/governance/src/delegator_vote/proof.rs @@ -14,7 +14,7 @@ use ark_r1cs_std::prelude::AllocVar; use ark_relations::r1cs::{ConstraintSynthesizer, ConstraintSystemRef}; use ark_snark::SNARK; use decaf377_rdsa::{SpendAuth, VerificationKey}; -use penumbra_proto::{core::crypto::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{core::component::governance::v1alpha1 as pb, DomainType, TypeUrl}; use penumbra_tct as tct; use penumbra_tct::r1cs::StateCommitmentVar; use tct::r1cs::PositionVar; diff --git a/crates/core/component/governance/src/delegator_vote/view.rs b/crates/core/component/governance/src/delegator_vote/view.rs index da38e4eb5d..1934e2715d 100644 --- a/crates/core/component/governance/src/delegator_vote/view.rs +++ b/crates/core/component/governance/src/delegator_vote/view.rs @@ -1,4 +1,4 @@ -use penumbra_proto::{core::transaction::v1alpha1 as pbt, DomainType, TypeUrl}; +use penumbra_proto::{core::component::governance::v1alpha1 as pbt, DomainType, TypeUrl}; use penumbra_shielded_pool::NoteView; use serde::{Deserialize, Serialize}; diff --git a/crates/core/component/governance/src/proposal.rs b/crates/core/component/governance/src/proposal.rs index e180f98d7f..a88b8fb5ab 100644 --- a/crates/core/component/governance/src/proposal.rs +++ b/crates/core/component/governance/src/proposal.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; use std::str::FromStr; use penumbra_chain::params::ChainParameters; -use penumbra_proto::{core::governance::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::governance::v1alpha1 as pb, DomainType, TypeUrl}; /// A governance proposal. #[derive(Debug, Clone, Serialize, Deserialize)] diff --git a/crates/core/component/governance/src/proposal_deposit_claim/action.rs b/crates/core/component/governance/src/proposal_deposit_claim/action.rs index 3640e92a5d..725773f90a 100644 --- a/crates/core/component/governance/src/proposal_deposit_claim/action.rs +++ b/crates/core/component/governance/src/proposal_deposit_claim/action.rs @@ -5,7 +5,7 @@ use penumbra_asset::{ Balance, Value, STAKING_TOKEN_ASSET_ID, }; use penumbra_num::Amount; -use penumbra_proto::{core::governance::v1alpha1 as pb, TypeUrl}; +use penumbra_proto::{penumbra::core::component::governance::v1alpha1 as pb, TypeUrl}; use crate::proposal_state::{Outcome, Withdrawn}; diff --git a/crates/core/component/governance/src/proposal_state.rs b/crates/core/component/governance/src/proposal_state.rs index 1ec6e498f4..a000fc8eac 100644 --- a/crates/core/component/governance/src/proposal_state.rs +++ b/crates/core/component/governance/src/proposal_state.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -use penumbra_proto::{core::governance::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::governance::v1alpha1 as pb, DomainType, TypeUrl}; #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(try_from = "pb::ProposalState", into = "pb::ProposalState")] diff --git a/crates/core/component/governance/src/proposal_submit/action.rs b/crates/core/component/governance/src/proposal_submit/action.rs index 5b097d0610..288cbd53cf 100644 --- a/crates/core/component/governance/src/proposal_submit/action.rs +++ b/crates/core/component/governance/src/proposal_submit/action.rs @@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize}; use penumbra_asset::{Balance, Value, STAKING_TOKEN_ASSET_ID}; use penumbra_num::Amount; -use penumbra_proto::{core::governance::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::governance::v1alpha1 as pb, DomainType, TypeUrl}; use crate::proposal::Proposal; diff --git a/crates/core/component/governance/src/proposal_withdraw/action.rs b/crates/core/component/governance/src/proposal_withdraw/action.rs index 96a25e3ed3..af79700f17 100644 --- a/crates/core/component/governance/src/proposal_withdraw/action.rs +++ b/crates/core/component/governance/src/proposal_withdraw/action.rs @@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize}; use penumbra_asset::{Balance, Value}; use penumbra_num::Amount; -use penumbra_proto::{core::governance::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::governance::v1alpha1 as pb, DomainType, TypeUrl}; use crate::ProposalNft; diff --git a/crates/core/component/governance/src/tally.rs b/crates/core/component/governance/src/tally.rs index dc3ed5efa7..c8cf21d249 100644 --- a/crates/core/component/governance/src/tally.rs +++ b/crates/core/component/governance/src/tally.rs @@ -3,7 +3,7 @@ use std::ops::{Add, AddAssign}; use serde::{Deserialize, Serialize}; use penumbra_chain::params::{ChainParameters, Ratio}; -use penumbra_proto::{core::governance::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::governance::v1alpha1 as pb, DomainType, TypeUrl}; use crate::{ proposal_state::{Outcome as StateOutcome, Withdrawn}, diff --git a/crates/core/component/governance/src/validator_vote/action.rs b/crates/core/component/governance/src/validator_vote/action.rs index d7d8d1601b..b4da36ffea 100644 --- a/crates/core/component/governance/src/validator_vote/action.rs +++ b/crates/core/component/governance/src/validator_vote/action.rs @@ -1,5 +1,5 @@ use decaf377_rdsa::{Signature, SpendAuth}; -use penumbra_proto::{core::governance::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::governance::v1alpha1 as pb, DomainType, TypeUrl}; use penumbra_stake::{GovernanceKey, IdentityKey}; use serde::{Deserialize, Serialize}; diff --git a/crates/core/component/governance/src/vote.rs b/crates/core/component/governance/src/vote.rs index 105b583759..3109b4b89b 100644 --- a/crates/core/component/governance/src/vote.rs +++ b/crates/core/component/governance/src/vote.rs @@ -4,7 +4,7 @@ use std::{ }; use anyhow::anyhow; -use penumbra_proto::{core::governance::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::governance::v1alpha1 as pb, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; /// A vote on a proposal. diff --git a/crates/core/component/ibc/src/component/client_counter.rs b/crates/core/component/ibc/src/component/client_counter.rs index 628b014bbd..72a8cb8d69 100644 --- a/crates/core/component/ibc/src/component/client_counter.rs +++ b/crates/core/component/ibc/src/component/client_counter.rs @@ -3,7 +3,7 @@ use ibc_types::core::client::Height; use ibc_types::core::connection::{ChainId, ConnectionId}; use ibc_types::lightclients::tendermint::TrustThreshold; use penumbra_chain::component::PENUMBRA_PROOF_SPECS; -use penumbra_proto::{core::ibc::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::ibc::v1alpha1 as pb, DomainType, TypeUrl}; #[derive(Clone, Debug)] pub struct ClientCounter(pub u64); diff --git a/crates/core/component/ibc/src/component/connection_counter.rs b/crates/core/component/ibc/src/component/connection_counter.rs index 3bab258a06..1f6efe179a 100644 --- a/crates/core/component/ibc/src/component/connection_counter.rs +++ b/crates/core/component/ibc/src/component/connection_counter.rs @@ -1,6 +1,6 @@ use ibc_types::core::connection::Version; use once_cell::sync::Lazy; -use penumbra_proto::{core::ibc::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::ibc::v1alpha1 as pb, DomainType, TypeUrl}; #[derive(Debug, Clone)] pub struct ConnectionCounter(pub u64); diff --git a/crates/core/component/ibc/src/component/transfer.rs b/crates/core/component/ibc/src/component/transfer.rs index 2e00ab0e83..052cebb589 100644 --- a/crates/core/component/ibc/src/component/transfer.rs +++ b/crates/core/component/ibc/src/component/transfer.rs @@ -18,7 +18,8 @@ use penumbra_asset::{asset, asset::DenomMetadata, Value}; use penumbra_keys::Address; use penumbra_num::Amount; use penumbra_proto::{ - core::ibc::v1alpha1::FungibleTokenPacketData, StateReadProto, StateWriteProto, + penumbra::core::component::ibc::v1alpha1::FungibleTokenPacketData, StateReadProto, + StateWriteProto, }; use penumbra_shielded_pool::component::{NoteManager, SupplyWrite}; use penumbra_storage::{StateRead, StateWrite}; diff --git a/crates/core/component/ibc/src/ibc_action.rs b/crates/core/component/ibc/src/ibc_action.rs index 239bf0479c..d8fb6afb1e 100644 --- a/crates/core/component/ibc/src/ibc_action.rs +++ b/crates/core/component/ibc/src/ibc_action.rs @@ -12,7 +12,7 @@ use ibc_types::core::{ use ibc_types::DomainType as IbcTypesDomainType; use ibc_types::TypeUrl as IbcTypesTypeUrl; -use penumbra_proto::core::ibc::v1alpha1::{self as pb}; +use penumbra_proto::penumbra::core::component::ibc::v1alpha1::{self as pb}; use penumbra_proto::{DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; diff --git a/crates/core/component/ibc/src/ics20_withdrawal.rs b/crates/core/component/ibc/src/ics20_withdrawal.rs index 3d0531268d..a3e862b4c2 100644 --- a/crates/core/component/ibc/src/ics20_withdrawal.rs +++ b/crates/core/component/ibc/src/ics20_withdrawal.rs @@ -6,7 +6,7 @@ use penumbra_asset::{ use penumbra_keys::Address; use penumbra_num::Amount; use penumbra_proto::{ - core::ibc::v1alpha1::{self as pb, FungibleTokenPacketData}, + penumbra::core::component::ibc::v1alpha1::{self as pb, FungibleTokenPacketData}, DomainType, TypeUrl, }; use serde::{Deserialize, Serialize}; diff --git a/crates/core/component/sct/src/nullifier.rs b/crates/core/component/sct/src/nullifier.rs index 2d1fc68c2b..6666f26ef5 100644 --- a/crates/core/component/sct/src/nullifier.rs +++ b/crates/core/component/sct/src/nullifier.rs @@ -8,7 +8,7 @@ use poseidon377::hash_3; use once_cell::sync::Lazy; use penumbra_keys::keys::{NullifierKey, NullifierKeyVar}; -use penumbra_proto::{core::crypto::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{core::component::sct::v1alpha1 as pb, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; #[derive(PartialEq, Eq, Clone, Copy, Hash, PartialOrd, Ord, Serialize, Deserialize)] diff --git a/crates/core/component/shielded-pool/src/note.rs b/crates/core/component/shielded-pool/src/note.rs index f3af4e8d0c..68b57eda9d 100644 --- a/crates/core/component/shielded-pool/src/note.rs +++ b/crates/core/component/shielded-pool/src/note.rs @@ -12,7 +12,7 @@ use penumbra_keys::{ symmetric::{OutgoingCipherKey, OvkWrappedKey, PayloadKey, PayloadKind}, Address, AddressView, }; -use penumbra_proto::core::crypto::v1alpha1 as pb; +use penumbra_proto::penumbra::core::component::shielded_pool::v1alpha1 as pb; use rand::{CryptoRng, Rng}; use serde::{Deserialize, Serialize}; use thiserror; diff --git a/crates/core/component/shielded-pool/src/note_payload.rs b/crates/core/component/shielded-pool/src/note_payload.rs index c3ea35673d..7d317974f0 100644 --- a/crates/core/component/shielded-pool/src/note_payload.rs +++ b/crates/core/component/shielded-pool/src/note_payload.rs @@ -1,10 +1,10 @@ use anyhow::{Context, Error}; -use bytes::Bytes; - use penumbra_keys::keys::FullViewingKey; use penumbra_num::Amount; -use penumbra_proto::{core::crypto::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{ + penumbra::core::component::shielded_pool::v1alpha1 as pb, DomainType, TypeUrl, +}; use serde::{Deserialize, Serialize}; use crate::{note, Note, NoteCiphertext}; @@ -82,7 +82,7 @@ impl From for pb::NotePayload { fn from(msg: NotePayload) -> Self { pb::NotePayload { note_commitment: Some(msg.note_commitment.into()), - ephemeral_key: Bytes::copy_from_slice(&msg.ephemeral_key.0), + ephemeral_key: msg.ephemeral_key.0.to_vec(), encrypted_note: Some(msg.encrypted_note.into()), } } diff --git a/crates/core/component/shielded-pool/src/nullifier_derivation.rs b/crates/core/component/shielded-pool/src/nullifier_derivation.rs index 1e983eca0e..6c5c05c38b 100644 --- a/crates/core/component/shielded-pool/src/nullifier_derivation.rs +++ b/crates/core/component/shielded-pool/src/nullifier_derivation.rs @@ -10,7 +10,9 @@ use ark_groth16::{ }; use ark_relations::r1cs::{ConstraintSynthesizer, ConstraintSystemRef}; use ark_snark::SNARK; -use penumbra_proto::{core::crypto::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{ + penumbra::core::component::shielded_pool::v1alpha1 as pb, DomainType, TypeUrl, +}; use penumbra_tct as tct; use rand::{CryptoRng, Rng}; use tct::StateCommitment; diff --git a/crates/core/component/shielded-pool/src/output/action.rs b/crates/core/component/shielded-pool/src/output/action.rs index 25c32cbdd5..ea47e21cd4 100644 --- a/crates/core/component/shielded-pool/src/output/action.rs +++ b/crates/core/component/shielded-pool/src/output/action.rs @@ -1,11 +1,11 @@ use std::convert::{TryFrom, TryInto}; use anyhow::{Context, Error}; -use bytes::Bytes; use penumbra_asset::balance; use penumbra_keys::symmetric::{OvkWrappedKey, WrappedMemoKey}; use penumbra_proto::{ - core::crypto::v1alpha1 as pbc, core::transaction::v1alpha1 as pb, DomainType, TypeUrl, + core::component::shielded_pool::v1alpha1 as pb, + penumbra::core::component::shielded_pool::v1alpha1 as pbc, DomainType, TypeUrl, }; use serde::{Deserialize, Serialize}; @@ -75,8 +75,8 @@ impl From for pb::OutputBody { pb::OutputBody { note_payload: Some(output.note_payload.into()), balance_commitment: Some(output.balance_commitment.into()), - wrapped_memo_key: Bytes::copy_from_slice(&output.wrapped_memo_key.0), - ovk_wrapped_key: Bytes::copy_from_slice(&output.ovk_wrapped_key.0), + wrapped_memo_key: output.wrapped_memo_key.0.to_vec(), + ovk_wrapped_key: output.ovk_wrapped_key.0.to_vec(), } } } diff --git a/crates/core/component/shielded-pool/src/output/plan.rs b/crates/core/component/shielded-pool/src/output/plan.rs index 3574403b43..d5e1d94d7d 100644 --- a/crates/core/component/shielded-pool/src/output/plan.rs +++ b/crates/core/component/shielded-pool/src/output/plan.rs @@ -7,7 +7,7 @@ use penumbra_keys::{ symmetric::WrappedMemoKey, Address, PayloadKey, }; -use penumbra_proto::{core::transaction::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{core::component::shielded_pool::v1alpha1 as pb, DomainType, TypeUrl}; use rand_core::{CryptoRng, RngCore}; use serde::{Deserialize, Serialize}; @@ -163,10 +163,10 @@ impl TryFrom for OutputPlan { .dest_address .ok_or_else(|| anyhow::anyhow!("missing address"))? .try_into()?, - rseed: Rseed(msg.rseed.as_ref().try_into()?), - value_blinding: Fr::from_bytes(msg.value_blinding.as_ref().try_into()?)?, - proof_blinding_r: Fq::from_bytes(msg.proof_blinding_r.as_ref().try_into()?)?, - proof_blinding_s: Fq::from_bytes(msg.proof_blinding_s.as_ref().try_into()?)?, + rseed: Rseed(msg.rseed.as_slice().try_into()?), + value_blinding: Fr::from_bytes(msg.value_blinding.as_slice().try_into()?)?, + proof_blinding_r: Fq::from_bytes(msg.proof_blinding_r.as_slice().try_into()?)?, + proof_blinding_s: Fq::from_bytes(msg.proof_blinding_s.as_slice().try_into()?)?, }) } } diff --git a/crates/core/component/shielded-pool/src/output/proof.rs b/crates/core/component/shielded-pool/src/output/proof.rs index f39813d084..34fb3db98f 100644 --- a/crates/core/component/shielded-pool/src/output/proof.rs +++ b/crates/core/component/shielded-pool/src/output/proof.rs @@ -15,7 +15,9 @@ use ark_r1cs_std::prelude::*; use ark_relations::r1cs::{ConstraintSynthesizer, ConstraintSystemRef}; use ark_snark::SNARK; use penumbra_keys::{keys::Diversifier, Address}; -use penumbra_proto::{core::crypto::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{ + penumbra::core::component::shielded_pool::v1alpha1 as pb, DomainType, TypeUrl, +}; use penumbra_tct::r1cs::StateCommitmentVar; use crate::{note, Note, Rseed}; @@ -231,7 +233,7 @@ mod tests { use penumbra_proof_params::generate_prepared_test_parameters; use proptest::prelude::*; - use penumbra_proto::core::crypto::v1alpha1 as pb; + use penumbra_proto::penumbra::core::component::shielded_pool::v1alpha1 as pb; use rand_core::OsRng; use crate::{note, Note}; diff --git a/crates/core/component/shielded-pool/src/output/view.rs b/crates/core/component/shielded-pool/src/output/view.rs index 43b70324ee..3c40cf44d6 100644 --- a/crates/core/component/shielded-pool/src/output/view.rs +++ b/crates/core/component/shielded-pool/src/output/view.rs @@ -1,5 +1,5 @@ use penumbra_keys::PayloadKey; -use penumbra_proto::{core::transaction::v1alpha1 as pbt, DomainType, TypeUrl}; +use penumbra_proto::{core::component::shielded_pool::v1alpha1 as pbt, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; use crate::NoteView; @@ -48,7 +48,7 @@ impl TryFrom for OutputView { .payload_key .ok_or_else(|| anyhow::anyhow!("missing payload key field"))? .inner - .as_ref() + .as_slice() .try_into()?, }), pbt::output_view::OutputView::Opaque(x) => Ok(OutputView::Opaque { diff --git a/crates/core/component/shielded-pool/src/spend/action.rs b/crates/core/component/shielded-pool/src/spend/action.rs index 023b724117..85d4052bb5 100644 --- a/crates/core/component/shielded-pool/src/spend/action.rs +++ b/crates/core/component/shielded-pool/src/spend/action.rs @@ -1,10 +1,9 @@ use std::convert::{TryFrom, TryInto}; use anyhow::{Context, Error}; -use bytes::Bytes; use decaf377_rdsa::{Signature, SpendAuth, VerificationKey}; use penumbra_asset::balance; -use penumbra_proto::{core::transaction::v1alpha1 as transaction, DomainType, TypeUrl}; +use penumbra_proto::{core::component::shielded_pool::v1alpha1 as pb, DomainType, TypeUrl}; use penumbra_sct::Nullifier; use serde::{Deserialize, Serialize}; @@ -18,7 +17,7 @@ pub struct Spend { } #[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(try_from = "transaction::SpendBody", into = "transaction::SpendBody")] +#[serde(try_from = "pb::SpendBody", into = "pb::SpendBody")] pub struct Body { pub balance_commitment: balance::Commitment, pub nullifier: Nullifier, @@ -30,12 +29,12 @@ impl TypeUrl for Spend { } impl DomainType for Spend { - type Proto = transaction::Spend; + type Proto = pb::Spend; } -impl From for transaction::Spend { +impl From for pb::Spend { fn from(msg: Spend) -> Self { - transaction::Spend { + pb::Spend { body: Some(msg.body.into()), auth_sig: Some(msg.auth_sig.into()), proof: Some(msg.proof.into()), @@ -43,10 +42,10 @@ impl From for transaction::Spend { } } -impl TryFrom for Spend { +impl TryFrom for Spend { type Error = Error; - fn try_from(proto: transaction::Spend) -> anyhow::Result { + fn try_from(proto: pb::Spend) -> anyhow::Result { let body = proto .body .ok_or_else(|| anyhow::anyhow!("missing spend body"))? @@ -76,25 +75,25 @@ impl TypeUrl for Body { } impl DomainType for Body { - type Proto = transaction::SpendBody; + type Proto = pb::SpendBody; } -impl From for transaction::SpendBody { +impl From for pb::SpendBody { fn from(msg: Body) -> Self { let nullifier_bytes: [u8; 32] = msg.nullifier.into(); let rk_bytes: [u8; 32] = msg.rk.into(); - transaction::SpendBody { + pb::SpendBody { balance_commitment: Some(msg.balance_commitment.into()), - nullifier: Bytes::copy_from_slice(&nullifier_bytes), - rk: Bytes::copy_from_slice(&rk_bytes), + nullifier: nullifier_bytes.to_vec(), + rk: rk_bytes.to_vec(), } } } -impl TryFrom for Body { +impl TryFrom for Body { type Error = Error; - fn try_from(proto: transaction::SpendBody) -> anyhow::Result { + fn try_from(proto: pb::SpendBody) -> anyhow::Result { let balance_commitment: balance::Commitment = proto .balance_commitment .ok_or_else(|| anyhow::anyhow!("missing value commitment"))? diff --git a/crates/core/component/shielded-pool/src/spend/plan.rs b/crates/core/component/shielded-pool/src/spend/plan.rs index 3342cec075..4bac126941 100644 --- a/crates/core/component/shielded-pool/src/spend/plan.rs +++ b/crates/core/component/shielded-pool/src/spend/plan.rs @@ -3,7 +3,7 @@ use decaf377::{FieldExt, Fq, Fr}; use decaf377_rdsa::{Signature, SpendAuth}; use penumbra_asset::{Balance, Value, STAKING_TOKEN_ASSET_ID}; use penumbra_keys::{Address, FullViewingKey}; -use penumbra_proto::{core::transaction::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{core::component::shielded_pool::v1alpha1 as pb, DomainType, TypeUrl}; use penumbra_sct::Nullifier; use penumbra_tct as tct; use rand_core::{CryptoRng, RngCore}; @@ -161,10 +161,10 @@ impl TryFrom for SpendPlan { .ok_or_else(|| anyhow::anyhow!("missing note"))? .try_into()?, position: msg.position.into(), - randomizer: Fr::from_bytes(msg.randomizer.as_ref().try_into()?)?, - value_blinding: Fr::from_bytes(msg.value_blinding.as_ref().try_into()?)?, - proof_blinding_r: Fq::from_bytes(msg.proof_blinding_r.as_ref().try_into()?)?, - proof_blinding_s: Fq::from_bytes(msg.proof_blinding_s.as_ref().try_into()?)?, + randomizer: Fr::from_bytes(msg.randomizer.as_slice().try_into()?)?, + value_blinding: Fr::from_bytes(msg.value_blinding.as_slice().try_into()?)?, + proof_blinding_r: Fq::from_bytes(msg.proof_blinding_r.as_slice().try_into()?)?, + proof_blinding_s: Fq::from_bytes(msg.proof_blinding_s.as_slice().try_into()?)?, }) } } diff --git a/crates/core/component/shielded-pool/src/spend/proof.rs b/crates/core/component/shielded-pool/src/spend/proof.rs index 05432be038..33d913e577 100644 --- a/crates/core/component/shielded-pool/src/spend/proof.rs +++ b/crates/core/component/shielded-pool/src/spend/proof.rs @@ -17,7 +17,9 @@ use ark_r1cs_std::prelude::AllocVar; use ark_relations::r1cs::{ConstraintSynthesizer, ConstraintSystemRef}; use ark_snark::SNARK; use decaf377_rdsa::{SpendAuth, VerificationKey}; -use penumbra_proto::{core::crypto::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{ + penumbra::core::component::shielded_pool::v1alpha1 as pb, DomainType, TypeUrl, +}; use penumbra_tct as tct; use penumbra_tct::r1cs::StateCommitmentVar; diff --git a/crates/core/component/shielded-pool/src/spend/view.rs b/crates/core/component/shielded-pool/src/spend/view.rs index 825057d8bd..b6fbb92b0f 100644 --- a/crates/core/component/shielded-pool/src/spend/view.rs +++ b/crates/core/component/shielded-pool/src/spend/view.rs @@ -1,4 +1,4 @@ -use penumbra_proto::{core::transaction::v1alpha1 as pbt, DomainType, TypeUrl}; +use penumbra_proto::{core::component::shielded_pool::v1alpha1 as pbt, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; use crate::{NoteView, Spend}; diff --git a/crates/core/component/stake/src/changes.rs b/crates/core/component/stake/src/changes.rs index baf8f75da9..2f17151ab1 100644 --- a/crates/core/component/stake/src/changes.rs +++ b/crates/core/component/stake/src/changes.rs @@ -1,6 +1,6 @@ use crate::{Delegate, Undelegate}; use anyhow::Result; -use penumbra_proto::{core::stake::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::stake::v1alpha1 as pb, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; /// Data structure used to track queued delegation changes that have been diff --git a/crates/core/component/stake/src/component.rs b/crates/core/component/stake/src/component.rs index 2546f323f6..7c453abcea 100644 --- a/crates/core/component/stake/src/component.rs +++ b/crates/core/component/stake/src/component.rs @@ -1106,7 +1106,7 @@ pub trait StateReadExt: StateRead { // TODO: this is pulling out the whole proto, but only parsing // the consensus key. Alternatively, we could store the consensus // keys in a separate index. - self.get_proto::( + self.get_proto::( &state_key::validators::by_id(identity_key), ) .map_ok(|opt| { diff --git a/crates/core/component/stake/src/current_consensus_keys.rs b/crates/core/component/stake/src/current_consensus_keys.rs index 587a1c6bda..9a3e405258 100644 --- a/crates/core/component/stake/src/current_consensus_keys.rs +++ b/crates/core/component/stake/src/current_consensus_keys.rs @@ -1,5 +1,5 @@ use anyhow::Result; -use penumbra_proto::{core::stake::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::stake::v1alpha1 as pb, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; use tendermint::PublicKey; diff --git a/crates/core/component/stake/src/delegate.rs b/crates/core/component/stake/src/delegate.rs index 92d9550a0b..ade6f50a88 100644 --- a/crates/core/component/stake/src/delegate.rs +++ b/crates/core/component/stake/src/delegate.rs @@ -1,6 +1,6 @@ use penumbra_asset::{Balance, Value, STAKING_TOKEN_ASSET_ID}; use penumbra_num::Amount; -use penumbra_proto::{core::stake::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::stake::v1alpha1 as pb, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; use crate::{DelegationToken, IdentityKey}; diff --git a/crates/core/component/stake/src/funding_stream.rs b/crates/core/component/stake/src/funding_stream.rs index 0ec6aa6160..1afb23fa33 100644 --- a/crates/core/component/stake/src/funding_stream.rs +++ b/crates/core/component/stake/src/funding_stream.rs @@ -1,5 +1,5 @@ use penumbra_keys::Address; -use penumbra_proto::{core::stake::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::stake::v1alpha1 as pb, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; use crate::rate::BaseRateData; diff --git a/crates/core/component/stake/src/governance_key.rs b/crates/core/component/stake/src/governance_key.rs index 5266bb5ad1..c840c84456 100644 --- a/crates/core/component/stake/src/governance_key.rs +++ b/crates/core/component/stake/src/governance_key.rs @@ -1,7 +1,9 @@ use penumbra_proto::{ - core::crypto::v1alpha1 as pb, + // TODO: why is the governance key part of this crate? + core::keys::v1alpha1 as pb, serializers::bech32str::{self, validator_governance_key::BECH32_PREFIX}, - DomainType, TypeUrl, + DomainType, + TypeUrl, }; use serde::{Deserialize, Serialize}; diff --git a/crates/core/component/stake/src/identity_key.rs b/crates/core/component/stake/src/identity_key.rs index a62fc5a84f..5d1d313abe 100644 --- a/crates/core/component/stake/src/identity_key.rs +++ b/crates/core/component/stake/src/identity_key.rs @@ -1,8 +1,10 @@ use penumbra_proto::{ client::v1alpha1::{CurrentValidatorRateRequest, NextValidatorRateRequest}, - core::crypto::v1alpha1 as pb, + // TODO: why is this not in the keys crate? + core::keys::v1alpha1 as pb, serializers::bech32str::{self, validator_identity_key::BECH32_PREFIX}, - DomainType, TypeUrl, + DomainType, + TypeUrl, }; use serde::{Deserialize, Serialize}; diff --git a/crates/core/component/stake/src/penalty.rs b/crates/core/component/stake/src/penalty.rs index c47b7465e1..9e763b1d9a 100644 --- a/crates/core/component/stake/src/penalty.rs +++ b/crates/core/component/stake/src/penalty.rs @@ -4,7 +4,7 @@ use ark_ff::ToConstraintField; use ark_r1cs_std::prelude::*; use ark_relations::r1cs::SynthesisError; use decaf377::{r1cs::FqVar, FieldExt, Fq}; -use penumbra_proto::{core::stake::v1alpha1 as pbs, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::stake::v1alpha1 as pbs, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; use penumbra_asset::{ diff --git a/crates/core/component/stake/src/rate.rs b/crates/core/component/stake/src/rate.rs index d458723ef2..cc3cec00b8 100644 --- a/crates/core/component/stake/src/rate.rs +++ b/crates/core/component/stake/src/rate.rs @@ -3,7 +3,8 @@ use penumbra_num::Amount; use penumbra_proto::client::v1alpha1::CurrentValidatorRateResponse; use penumbra_proto::{ - client::v1alpha1::NextValidatorRateResponse, core::stake::v1alpha1 as pb, DomainType, TypeUrl, + client::v1alpha1::NextValidatorRateResponse, penumbra::core::component::stake::v1alpha1 as pb, + DomainType, TypeUrl, }; use serde::{Deserialize, Serialize}; diff --git a/crates/core/component/stake/src/undelegate.rs b/crates/core/component/stake/src/undelegate.rs index a7741c6b98..5cc72dbf72 100644 --- a/crates/core/component/stake/src/undelegate.rs +++ b/crates/core/component/stake/src/undelegate.rs @@ -1,6 +1,6 @@ use penumbra_asset::{Balance, Value}; use penumbra_num::Amount; -use penumbra_proto::{core::stake::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::stake::v1alpha1 as pb, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; use crate::{DelegationToken, IdentityKey, UnbondingToken}; diff --git a/crates/core/component/stake/src/undelegate_claim/action.rs b/crates/core/component/stake/src/undelegate_claim/action.rs index 4e8581f74a..5045efbe34 100644 --- a/crates/core/component/stake/src/undelegate_claim/action.rs +++ b/crates/core/component/stake/src/undelegate_claim/action.rs @@ -1,5 +1,5 @@ use penumbra_asset::balance; -use penumbra_proto::{core::stake::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::stake::v1alpha1 as pb, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; use crate::{IdentityKey, Penalty, UndelegateClaimProof}; diff --git a/crates/core/component/stake/src/undelegate_claim/plan.rs b/crates/core/component/stake/src/undelegate_claim/plan.rs index 0700c47190..acb50cfb03 100644 --- a/crates/core/component/stake/src/undelegate_claim/plan.rs +++ b/crates/core/component/stake/src/undelegate_claim/plan.rs @@ -2,7 +2,7 @@ use decaf377::{FieldExt, Fq, Fr}; use penumbra_asset::{asset, balance, Balance}; use penumbra_num::Amount; use penumbra_proof_params::UNDELEGATECLAIM_PROOF_PROVING_KEY; -use penumbra_proto::{core::stake::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::stake::v1alpha1 as pb, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; diff --git a/crates/core/component/stake/src/undelegate_claim/proof.rs b/crates/core/component/stake/src/undelegate_claim/proof.rs index 64b4833f4a..4e15e4deb2 100644 --- a/crates/core/component/stake/src/undelegate_claim/proof.rs +++ b/crates/core/component/stake/src/undelegate_claim/proof.rs @@ -8,7 +8,7 @@ use ark_groth16::{Groth16, PreparedVerifyingKey, Proof, ProvingKey}; use ark_r1cs_std::prelude::*; use ark_relations::r1cs::{ConstraintSynthesizer, ConstraintSystemRef}; use ark_snark::SNARK; -use penumbra_proto::{core::crypto::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{core::component::stake::v1alpha1 as pb, DomainType, TypeUrl}; use decaf377::{FieldExt, Fq, Fr}; use penumbra_asset::{ diff --git a/crates/core/component/stake/src/uptime.rs b/crates/core/component/stake/src/uptime.rs index 27573b4edc..582c5fcd3d 100644 --- a/crates/core/component/stake/src/uptime.rs +++ b/crates/core/component/stake/src/uptime.rs @@ -1,6 +1,6 @@ use bitvec::prelude::*; -use penumbra_proto::{core::stake::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::stake::v1alpha1 as pb, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; /// Records information on a validator's uptime. diff --git a/crates/core/component/stake/src/validator.rs b/crates/core/component/stake/src/validator.rs index 36d063f6ec..95f64ebeb1 100644 --- a/crates/core/component/stake/src/validator.rs +++ b/crates/core/component/stake/src/validator.rs @@ -1,7 +1,7 @@ //! Penumbra validators and related structures. use penumbra_keys::Address; -use penumbra_proto::{core::stake::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::stake::v1alpha1 as pb, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; use serde_unit_struct::{Deserialize_unit_struct, Serialize_unit_struct}; use serde_with::{serde_as, DisplayFromStr}; diff --git a/crates/core/component/stake/src/validator/bonding.rs b/crates/core/component/stake/src/validator/bonding.rs index 3effa88907..17dc96ca87 100644 --- a/crates/core/component/stake/src/validator/bonding.rs +++ b/crates/core/component/stake/src/validator/bonding.rs @@ -1,4 +1,4 @@ -use penumbra_proto::{core::stake::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::stake::v1alpha1 as pb, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; #[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)] diff --git a/crates/core/component/stake/src/validator/definition.rs b/crates/core/component/stake/src/validator/definition.rs index 3375316388..e5231b4885 100644 --- a/crates/core/component/stake/src/validator/definition.rs +++ b/crates/core/component/stake/src/validator/definition.rs @@ -1,5 +1,5 @@ use decaf377_rdsa::{Signature, SpendAuth}; -use penumbra_proto::{core::stake::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::stake::v1alpha1 as pb, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; use crate::validator::Validator; diff --git a/crates/core/component/stake/src/validator/info.rs b/crates/core/component/stake/src/validator/info.rs index c28ede822e..71523816a5 100644 --- a/crates/core/component/stake/src/validator/info.rs +++ b/crates/core/component/stake/src/validator/info.rs @@ -1,5 +1,6 @@ use penumbra_proto::{ - client::v1alpha1::ValidatorInfoResponse, core::stake::v1alpha1 as pb, DomainType, TypeUrl, + client::v1alpha1::ValidatorInfoResponse, penumbra::core::component::stake::v1alpha1 as pb, + DomainType, TypeUrl, }; use serde::{Deserialize, Serialize}; diff --git a/crates/core/component/stake/src/validator/state.rs b/crates/core/component/stake/src/validator/state.rs index 0720690b12..aa62290948 100644 --- a/crates/core/component/stake/src/validator/state.rs +++ b/crates/core/component/stake/src/validator/state.rs @@ -1,5 +1,5 @@ use anyhow::anyhow; -use penumbra_proto::{core::stake::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::stake::v1alpha1 as pb, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; /// The state of a validator in the validator state machine. diff --git a/crates/core/component/stake/src/validator/status.rs b/crates/core/component/stake/src/validator/status.rs index e719e2954f..df8fb1c3be 100644 --- a/crates/core/component/stake/src/validator/status.rs +++ b/crates/core/component/stake/src/validator/status.rs @@ -1,4 +1,4 @@ -use penumbra_proto::{core::stake::v1alpha1 as pb, DomainType, TypeUrl}; +use penumbra_proto::{penumbra::core::component::stake::v1alpha1 as pb, DomainType, TypeUrl}; use serde::{Deserialize, Serialize}; use crate::{validator::BondingState, validator::State, IdentityKey}; diff --git a/crates/core/transaction/src/effect_hash.rs b/crates/core/transaction/src/effect_hash.rs index 64654f7444..b161637c2a 100644 --- a/crates/core/transaction/src/effect_hash.rs +++ b/crates/core/transaction/src/effect_hash.rs @@ -14,9 +14,10 @@ use penumbra_governance::{ use penumbra_ibc::Ics20Withdrawal; use penumbra_keys::{FullViewingKey, PayloadKey}; use penumbra_proto::{ - core::crypto::v1alpha1 as pbc, core::dex::v1alpha1 as pbd, core::governance::v1alpha1 as pbg, - core::ibc::v1alpha1 as pbi, core::stake::v1alpha1 as pbs, core::transaction::v1alpha1 as pbt, - Message, + core::component::dex::v1alpha1 as pbd, core::component::fee::v1alpha1 as pbf, + core::component::governance::v1alpha1 as pbg, core::component::ibc::v1alpha1 as pbi, + core::component::shielded_pool::v1alpha1 as pb_sp, core::component::stake::v1alpha1 as pbs, + core::transaction::v1alpha1 as pbt, crypto::decaf377_fmd::v1alpha1 as pb_fmd, Message, }; use penumbra_proto::{DomainType, TypeUrl}; use penumbra_shielded_pool::{output, spend}; @@ -316,7 +317,7 @@ impl EffectingData for output::Body { fn effect_hash(&self) -> EffectHash { // The effecting data is in the body of the output, so we can // just use hash the proto-encoding of the body. - let body: pbt::OutputBody = self.clone().into(); + let body: pb_sp::OutputBody = self.clone().into(); hash_proto_effecting_data(output::Body::TYPE_URL, &body) } } @@ -325,7 +326,7 @@ impl EffectingData for spend::Body { fn effect_hash(&self) -> EffectHash { // The effecting data is in the body of the spend, so we can // just use hash the proto-encoding of the body. - let body: pbt::SpendBody = self.clone().into(); + let body: pb_sp::SpendBody = self.clone().into(); hash_proto_effecting_data(spend::Body::TYPE_URL, &body) } } @@ -494,7 +495,7 @@ impl EffectingData for DetectionData { impl EffectingData for Clue { fn effect_hash(&self) -> EffectHash { - let data: pbc::Clue = self.clone().into(); + let data: pb_fmd::Clue = self.clone().into(); hash_proto_effecting_data(Clue::TYPE_URL, &data) } } @@ -508,7 +509,7 @@ impl EffectingData for TransactionParameters { impl EffectingData for Fee { fn effect_hash(&self) -> EffectHash { - let proto_encoded_fee: pbc::Fee = self.clone().into(); + let proto_encoded_fee: pbf::Fee = self.clone().into(); hash_proto_effecting_data(Fee::TYPE_URL, &proto_encoded_fee) } } diff --git a/crates/core/transaction/src/plan/action.rs b/crates/core/transaction/src/plan/action.rs index f714c6e3f6..5ba541f26f 100644 --- a/crates/core/transaction/src/plan/action.rs +++ b/crates/core/transaction/src/plan/action.rs @@ -264,7 +264,7 @@ impl From for pb_t::ActionPlan { }, ActionPlan::PositionWithdraw(inner) => pb_t::ActionPlan { action: Some(pb_t::action_plan::Action::PositionWithdraw(Into::< - penumbra_proto::core::dex::v1alpha1::PositionWithdrawPlan, + penumbra_proto::core::component::dex::v1alpha1::PositionWithdrawPlan, >::into( inner ))), diff --git a/crates/core/transaction/src/plan/clue.rs b/crates/core/transaction/src/plan/clue.rs index ebebc70d7a..55a37f4111 100644 --- a/crates/core/transaction/src/plan/clue.rs +++ b/crates/core/transaction/src/plan/clue.rs @@ -63,7 +63,7 @@ impl TryFrom for CluePlan { .address .ok_or_else(|| anyhow::anyhow!("missing address"))? .try_into()?, - rseed: msg.rseed.as_ref().try_into()?, + rseed: msg.rseed.as_slice().try_into()?, precision_bits: msg.precision_bits.try_into()?, }) } diff --git a/crates/core/transaction/src/transaction.rs b/crates/core/transaction/src/transaction.rs index 86d031d4ae..22cb4c80b7 100644 --- a/crates/core/transaction/src/transaction.rs +++ b/crates/core/transaction/src/transaction.rs @@ -5,7 +5,6 @@ use std::{ use anyhow::{Context, Error}; use ark_ff::Zero; -use bytes::Bytes; use decaf377::Fr; use decaf377_fmd::Clue; use decaf377_rdsa::{Binding, Signature, VerificationKey, VerificationKeyBytes}; @@ -542,10 +541,10 @@ impl From for pbt::TransactionBody { fn from(msg: TransactionBody) -> Self { let encrypted_memo: pbt::MemoData = match msg.memo { Some(memo) => pbt::MemoData { - encrypted_memo: bytes::Bytes::copy_from_slice(&memo.0), + encrypted_memo: memo.0.to_vec(), }, None => pbt::MemoData { - encrypted_memo: Bytes::default(), + encrypted_memo: Default::default(), }, }; @@ -631,7 +630,7 @@ impl From for pbt::Transaction { pbt::Transaction { body: Some(msg.transaction_body.into()), anchor: Some(msg.anchor.into()), - binding_sig: Bytes::copy_from_slice(&sig_bytes), + binding_sig: sig_bytes.to_vec(), } } } diff --git a/crates/core/transaction/src/view.rs b/crates/core/transaction/src/view.rs index a317011ba8..df058db078 100644 --- a/crates/core/transaction/src/view.rs +++ b/crates/core/transaction/src/view.rs @@ -1,5 +1,4 @@ use anyhow::Context; -use bytes::Bytes; use decaf377_rdsa::{Binding, Signature}; use penumbra_fee::Fee; use penumbra_proto::{core::transaction::v1alpha1 as pbt, DomainType, TypeUrl}; @@ -209,7 +208,7 @@ impl From for pbt::TransactionView { Self { body_view: Some(v.body_view.into()), anchor: Some(v.anchor.into()), - binding_sig: Bytes::copy_from_slice(&v.binding_sig.to_bytes()), + binding_sig: v.binding_sig.to_bytes().to_vec(), } } } diff --git a/crates/view/src/service.rs b/crates/view/src/service.rs index 0d8a63055f..d71ea4abef 100644 --- a/crates/view/src/service.rs +++ b/crates/view/src/service.rs @@ -30,7 +30,7 @@ use penumbra_proto::{ tendermint_proxy_service_client::TendermintProxyServiceClient, BroadcastTxSyncRequest, GetStatusRequest, }, - core::crypto::v1alpha1 as pbc, + core::keys::v1alpha1 as pbc, view::v1alpha1::{ self as pb, view_protocol_service_client::ViewProtocolServiceClient, diff --git a/crates/wasm/src/keys.rs b/crates/wasm/src/keys.rs index 0b128a7673..15368de722 100644 --- a/crates/wasm/src/keys.rs +++ b/crates/wasm/src/keys.rs @@ -1,7 +1,7 @@ use crate::error::WasmResult; use penumbra_keys::keys::{SeedPhrase, SpendKey}; use penumbra_keys::{Address, FullViewingKey}; -use penumbra_proto::{core::crypto::v1alpha1 as pb, serializers::bech32str, DomainType}; +use penumbra_proto::{core::keys::v1alpha1 as pb, serializers::bech32str, DomainType}; use rand_core::OsRng; use std::str::FromStr; use wasm_bindgen::prelude::*; diff --git a/crates/wasm/src/storage.rs b/crates/wasm/src/storage.rs index 0070873149..d2566ad44f 100644 --- a/crates/wasm/src/storage.rs +++ b/crates/wasm/src/storage.rs @@ -3,8 +3,8 @@ use crate::note_record::SpendableNoteRecord; use indexed_db_futures::prelude::OpenDbRequest; use indexed_db_futures::{IdbDatabase, IdbQuerySource}; use penumbra_asset::asset::{DenomMetadata, Id}; -use penumbra_proto::core::chain::v1alpha1::{ChainParameters, FmdParameters}; -use penumbra_proto::core::crypto::v1alpha1::StateCommitment; +use penumbra_proto::core::component::chain::v1alpha1::{ChainParameters, FmdParameters}; +use penumbra_proto::crypto::tct::v1alpha1::StateCommitment; use penumbra_proto::view::v1alpha1::{NotesRequest, SwapRecord}; use penumbra_proto::DomainType; use penumbra_sct::Nullifier; @@ -104,7 +104,8 @@ impl IndexedDBStorage { let tx = self.db.transaction_on_one("notes")?; let store = tx.object_store("notes")?; - let note_proto: penumbra_proto::core::crypto::v1alpha1::Note = note.clone().try_into()?; + let note_proto: penumbra_proto::core::component::shielded_pool::v1alpha1::Note = + note.clone().try_into()?; let note_js = serde_wasm_bindgen::to_value(¬e_proto)?; let commitment_proto = note.commit().to_proto(); diff --git a/crates/wasm/src/view_server.rs b/crates/wasm/src/view_server.rs index 4e7a4e1003..27d859b4e5 100644 --- a/crates/wasm/src/view_server.rs +++ b/crates/wasm/src/view_server.rs @@ -178,7 +178,7 @@ impl ViewServer { &mut self, compact_block: JsValue, ) -> WasmResult { - let block_proto: penumbra_proto::core::chain::v1alpha1::CompactBlock = + let block_proto: penumbra_proto::core::component::compact_block::v1alpha1::CompactBlock = serde_wasm_bindgen::from_value(compact_block)?; let block: CompactBlock = block_proto.try_into()?; diff --git a/crates/wasm/src/wasm_planner.rs b/crates/wasm/src/wasm_planner.rs index bc48bab6b0..38369827a7 100644 --- a/crates/wasm/src/wasm_planner.rs +++ b/crates/wasm/src/wasm_planner.rs @@ -6,9 +6,12 @@ use anyhow::Result; use ark_ff::UniformRand; use decaf377::Fq; use penumbra_dex::swap_claim::SwapClaimPlan; -use penumbra_proto::core::chain::v1alpha1::{ChainParameters, FmdParameters}; -use penumbra_proto::core::crypto::v1alpha1::{Address, DenomMetadata, Fee, StateCommitment, Value}; +use penumbra_proto::core::asset::v1alpha1::{DenomMetadata, Value}; +use penumbra_proto::core::component::chain::v1alpha1::{ChainParameters, FmdParameters}; +use penumbra_proto::core::component::fee::v1alpha1::Fee; +use penumbra_proto::core::keys::v1alpha1::Address; use penumbra_proto::core::transaction::v1alpha1::{MemoPlaintext, TransactionPlan}; +use penumbra_proto::crypto::tct::v1alpha1::StateCommitment; use penumbra_proto::DomainType; use rand_core::OsRng; use serde_wasm_bindgen::Error;