Skip to content

Commit

Permalink
transaction: 🚪 reëxport TransactionPlan (#3864)
Browse files Browse the repository at this point in the history
as the crate's documentation points out, `TransactionPlan` is one of the
critical types provided by this library.

let's `pub use` it in `lib.rs`, alongside `Transaction`.
  • Loading branch information
cratelyn authored Feb 22, 2024
1 parent 1381ca8 commit 6b99c0e
Show file tree
Hide file tree
Showing 17 changed files with 23 additions and 29 deletions.
2 changes: 1 addition & 1 deletion crates/bin/pcli/src/command/tx/proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use anyhow::{Context, Result};
use penumbra_app::params::AppParameters;
use penumbra_governance::{proposal::ChangedAppParameters, Proposal, ProposalPayload};
use penumbra_proto::DomainType;
use penumbra_transaction::plan::TransactionPlan;
use penumbra_transaction::TransactionPlan;

use super::FeeTier;

Expand Down
4 changes: 1 addition & 3 deletions crates/bin/pcli/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ use penumbra_proto::{
view::v1::broadcast_transaction_response::Status as BroadcastStatus,
view::v1::GasPricesRequest, DomainType,
};
use penumbra_transaction::{
gas::GasCost, plan::TransactionPlan, txhash::TransactionId, Transaction,
};
use penumbra_transaction::{gas::GasCost, txhash::TransactionId, Transaction, TransactionPlan};
use penumbra_view::ViewClient;
use std::future::Future;
use tonic::transport::{Channel, ClientTlsConfig};
Expand Down
2 changes: 1 addition & 1 deletion crates/bin/pcli/src/terminal.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::Result;
use penumbra_custody::threshold::Terminal;
use penumbra_transaction::plan::TransactionPlan;
use penumbra_transaction::TransactionPlan;
use tokio::io::{self, AsyncBufReadExt};
use tonic::async_trait;

Expand Down
13 changes: 6 additions & 7 deletions crates/bin/pclientd/tests/network_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,12 @@ async fn swap_claim_flow() -> anyhow::Result<()> {
.ok_or_else(|| anyhow::anyhow!("TransactionPlannerResponse missing plan"))?;

// Hold on to the swap plaintext to be able to claim.
let swap_plaintext =
TryInto::<penumbra_transaction::plan::TransactionPlan>::try_into(plan.clone())?
.swap_plans()
.next()
.expect("swap plan must be present")
.swap_plaintext
.clone();
let swap_plaintext = TryInto::<penumbra_transaction::TransactionPlan>::try_into(plan.clone())?
.swap_plans()
.next()
.expect("swap plan must be present")
.swap_plaintext
.clone();

// 5.2. Get authorization data for the transaction from pclientd (signing).
let auth_data = custody_client
Expand Down
4 changes: 1 addition & 3 deletions crates/core/app/src/action_handler/actions/submit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ use penumbra_proto::{DomainType, StateWriteProto as _};
use penumbra_sct::component::clock::EpochRead;
use penumbra_sct::component::tree::SctRead;
use penumbra_shielded_pool::component::SupplyWrite;
use penumbra_transaction::plan::TransactionPlan;
use penumbra_transaction::Transaction;
use penumbra_transaction::{AuthorizationData, WitnessData};
use penumbra_transaction::{AuthorizationData, Transaction, TransactionPlan, WitnessData};

use crate::action_handler::ActionHandler;
use crate::community_pool_ext::CommunityPoolStateWriteExt;
Expand Down
4 changes: 2 additions & 2 deletions crates/core/transaction/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! This crate defines data structures that provide modeling of shielded
//! transactions through their entire lifecycle:
//!
//! * the [`TransactionPlan`](plan::TransactionPlan) type completely describes a
//! * the [`TransactionPlan`](TransactionPlan) type completely describes a
//! planned transaction before it is created;
//!
//! * the [`Transaction`] type represents the shielded transaction itself;
Expand Down Expand Up @@ -37,7 +37,7 @@ pub use detection_data::DetectionData;
pub use error::Error;
pub use is_action::IsAction;
pub use parameters::TransactionParameters;
pub use plan::ActionPlan;
pub use plan::{ActionPlan, TransactionPlan};
pub use transaction::{Transaction, TransactionBody};
pub use view::{ActionView, MemoPlaintextView, MemoView, TransactionPerspective, TransactionView};
pub use witness_data::WitnessData;
Expand Down
2 changes: 1 addition & 1 deletion crates/core/transaction/src/plan/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use rand::{CryptoRng, RngCore};

use penumbra_keys::keys::SpendKey;

use crate::{plan::TransactionPlan, AuthorizationData};
use crate::{AuthorizationData, TransactionPlan};

impl TransactionPlan {
/// Authorize this [`TransactionPlan`] with the provided [`SpendKey`].
Expand Down
2 changes: 1 addition & 1 deletion crates/custody/src/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub enum AuthPolicy {
/// This policy should be combined with an `AllowList` to prevent sending
/// funds outside of the relayer account.
OnlyIbcRelay,
/// Require specific pre-authorizations for submitted [`TransactionPlan`](penumbra_transaction::plan::TransactionPlan)s.
/// Require specific pre-authorizations for submitted [`TransactionPlan`](penumbra_transaction::TransactionPlan)s.
PreAuthorization(PreAuthorizationPolicy),
}

Expand Down
2 changes: 1 addition & 1 deletion crates/custody/src/pre_auth.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use penumbra_proto::{custody::v1 as pb, DomainType};
use penumbra_transaction::plan::TransactionPlan;
use penumbra_transaction::TransactionPlan;
use serde::{Deserialize, Serialize};

/// A pre-authorization packet. This allows a custodian to delegate (partial)
Expand Down
2 changes: 1 addition & 1 deletion crates/custody/src/request.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use penumbra_proto::{custody::v1 as pb, DomainType};
use penumbra_transaction::plan::TransactionPlan;
use penumbra_transaction::TransactionPlan;

use crate::PreAuthorization;

Expand Down
2 changes: 1 addition & 1 deletion crates/custody/src/soft_kms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl SoftKms {
Self { config }
}

/// Attempt to authorize the requested [`TransactionPlan`](penumbra_transaction::plan::TransactionPlan).
/// Attempt to authorize the requested [`TransactionPlan`](penumbra_transaction::TransactionPlan).
#[tracing::instrument(skip(self, request), name = "softhsm_sign")]
pub fn sign(&self, request: &AuthorizeRequest) -> anyhow::Result<AuthorizationData> {
tracing::debug!(?request.plan);
Expand Down
2 changes: 1 addition & 1 deletion crates/custody/src/threshold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use tonic::{async_trait, Request, Response, Status};

use penumbra_keys::{keys::AddressIndex, Address, FullViewingKey};
use penumbra_proto::{custody::v1 as pb, DomainType};
use penumbra_transaction::{plan::TransactionPlan, AuthorizationData};
use penumbra_transaction::{AuthorizationData, TransactionPlan};

use crate::AuthorizeRequest;

Expand Down
2 changes: 1 addition & 1 deletion crates/custody/src/threshold/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use rand_core::CryptoRngCore;
use decaf377_frost as frost;
use frost::round1::SigningCommitments;
use penumbra_proto::{penumbra::custody::threshold::v1 as pb, DomainType, Message};
use penumbra_transaction::{plan::TransactionPlan, AuthorizationData};
use penumbra_transaction::{AuthorizationData, TransactionPlan};
use penumbra_txhash::EffectHash;

use super::config::Config;
Expand Down
3 changes: 1 addition & 2 deletions crates/view/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ use penumbra_proto::view::v1::{
use penumbra_sct::Nullifier;
use penumbra_shielded_pool::{fmd, note};
use penumbra_stake::IdentityKey;
use penumbra_transaction::AuthorizationData;
use penumbra_transaction::{
plan::TransactionPlan, txhash::TransactionId, Transaction, WitnessData,
txhash::TransactionId, AuthorizationData, Transaction, TransactionPlan, WitnessData,
};

use crate::{SpendableNoteRecord, StatusStreamResponse, SwapRecord, TransactionInfo};
Expand Down
2 changes: 1 addition & 1 deletion crates/view/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ use penumbra_proto::{
use penumbra_stake::rate::RateData;
use penumbra_tct::{Proof, StateCommitment};
use penumbra_transaction::{
plan::TransactionPlan, AuthorizationData, Transaction, TransactionPerspective, WitnessData,
AuthorizationData, Transaction, TransactionPerspective, TransactionPlan, WitnessData,
};

use crate::{Planner, Storage, Worker};
Expand Down
2 changes: 1 addition & 1 deletion crates/wallet/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use anyhow::Result;

use penumbra_custody::{AuthorizeRequest, CustodyClient};
use penumbra_keys::FullViewingKey;
use penumbra_transaction::{plan::TransactionPlan, AuthorizationData, Transaction};
use penumbra_transaction::{AuthorizationData, Transaction, TransactionPlan};
use penumbra_view::ViewClient;

pub async fn build_transaction<V, C>(
Expand Down
2 changes: 1 addition & 1 deletion crates/wallet/src/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use penumbra_num::Amount;
use penumbra_proto::view::v1::NotesRequest;
use penumbra_stake::rate::RateData;
use penumbra_stake::validator;
use penumbra_transaction::{memo::MemoPlaintext, plan::TransactionPlan, TransactionParameters};
use penumbra_transaction::{memo::MemoPlaintext, TransactionParameters, TransactionPlan};
pub use penumbra_view::Planner;
use penumbra_view::{SpendableNoteRecord, ViewClient};

Expand Down

0 comments on commit 6b99c0e

Please sign in to comment.