Skip to content

Commit

Permalink
docs: fix cargo doc warnings
Browse files Browse the repository at this point in the history
Fixes 16 warnings about broken links, etc.

also makes GlobalState::create_transaction() pub again, and removes
  • Loading branch information
dan-da committed Jan 22, 2025
1 parent 3afe283 commit a24b647
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/job_queue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//! This is much like tokio::sync::mpsc::unbounded except:
//! 1. it supports prioritizing channel events (jobs)
//! 2. order of events with same priority is undefined.
//! see: https://github.com/rmcgibbo/async-priority-channel/issues/75
//! see: <https://github.com/rmcgibbo/async-priority-channel/issues/75>
//!
//! Using an unbounded channel means that there is no backpressure and no
//! upper limit on the number of jobs. (except RAM).
Expand Down
4 changes: 2 additions & 2 deletions src/models/blockchain/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ use crate::util_types::mutator_set::mutator_set_accumulator::MutatorSetAccumulat
/// onchain asymmetric-key public announcements
/// offchain expected-utxos
///
/// See [PublicAnnouncement], [UtxoNotification], [ExpectedUtxo]
/// See [PublicAnnouncement], [ExpectedUtxo]
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct AnnouncedUtxo {
pub utxo: Utxo,
Expand Down Expand Up @@ -101,7 +101,7 @@ impl AnnouncedUtxo {
/// initially these are used for transmitting encrypted secrets necessary
/// for a utxo recipient to identify and claim it.
///
/// See [Transaction], [UtxoNotification]
/// See [Transaction]
#[derive(
Clone, Debug, Serialize, Deserialize, PartialEq, Eq, GetSize, BFieldCodec, Default, TasmObject,
)]
Expand Down
2 changes: 1 addition & 1 deletion src/models/proof_abstractions/tasm/builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ pub fn verify_stark(stark_parameters: Stark, claim: &Claim, proof: &Proof) {
/// MMR accumulators.
///
/// Removes the [`MmrSuccessorProof`]'s authentication path from the
/// [environment](super::environment)'s [`NonDeterminism`].
/// environment's [`NonDeterminism`].
///
/// # Panics
///
Expand Down
13 changes: 3 additions & 10 deletions src/models/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ impl GlobalState {
/// generates [TxOutputList] from a list of address:amount pairs (outputs).
///
/// This is a helper method for generating the `TxOutputList` that
/// is required by [Self::create_transaction()] and [Self::create_raw_transaction()].
/// is required by [Self::create_transaction()].
///
/// Each output may use either `OnChain` or `OffChain` notifications. See documentation of
/// of [TxOutput::auto()] for a description of the logic and the
Expand Down Expand Up @@ -625,14 +625,11 @@ impl GlobalState {
/// creates a Transaction.
///
/// This API provides a simple-to-use interface for creating a transaction.
/// [Utxo] inputs are automatically chosen and a change output is
/// [Utxo](crate::models::blockchain::transaction::utxo::Utxo) inputs are automatically chosen and a change output is
/// automatically created, such that:
///
/// change = sum(inputs) - sum(outputs) - fee.
///
/// When finer control is required, [Self::create_raw_transaction()]
/// can be used instead.
///
/// The `tx_outputs` parameter should normally be generated with
/// [Self::generate_tx_outputs()] which determines which outputs should be
/// `OnChain` or `OffChain`.
Expand Down Expand Up @@ -702,8 +699,7 @@ impl GlobalState {
/// .await?;
/// }
/// ```
#[allow(dead_code)]
pub(crate) async fn create_transaction(

This comment has been minimized.

Copy link
@jan-ferdinand

jan-ferdinand Jan 22, 2025

Member

Out of curiosity: does this fix a dead link somewhere?

pub async fn create_transaction(
&self,
tx_outputs: TxOutputList,
change_key: SpendingKey,
Expand All @@ -712,9 +708,6 @@ impl GlobalState {
timestamp: Timestamp,
triton_vm_job_queue: &TritonVmJobQueue,
) -> Result<(Transaction, Option<TxOutput>)> {
// TODO: function not used because all callers got through its
// equivalent method `create_transaction_with_prover_capability`,
// for testing purposes. Consider deleting or fixing this somehow.
self.create_transaction_with_prover_capability(
tx_outputs,
change_key,
Expand Down
10 changes: 5 additions & 5 deletions src/models/state/wallet/address/address_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ impl ReceivingAddress {
/// the secret-key. As such, great care must be taken and it should
/// never be used for display purposes.
///
/// For most uses, prefer [Self::to_diplay_bech32m()] instead.
/// For most uses, prefer [Self::to_display_bech32m()] instead.
pub fn to_bech32m(&self, network: Network) -> Result<String> {
match self {
Self::Generation(k) => k.to_bech32m(network),
Expand Down Expand Up @@ -266,8 +266,8 @@ impl ReceivingAddress {
/// [ReceivingAddress] if provided as input to [Self::from_bech32m()]. For
/// that, [Self::to_bech32m()] should be used instead.
///
/// For [generation::Generation] keys, this is equivalent to calling [Self::to_bech32m()].
/// For [symmetric::Symmetric] keys, this returns the privacy_preimage hash bech32m encoded
/// For [Self::Generation] keys, this is equivalent to calling [Self::to_bech32m()].
/// For [Self::Symmetric] keys, this returns the privacy_preimage hash bech32m encoded
/// instead of the key itself.
pub fn to_display_bech32m(&self, network: Network) -> anyhow::Result<String> {
match self {
Expand Down Expand Up @@ -423,9 +423,9 @@ impl SpendingKey {
}
}

/// scans public announcements in a [Transaction] and finds any that match this key
/// scans public announcements in a `Transaction` and finds any that match this key
///
/// note that a single [Transaction] may represent an entire block
/// note that a single `Transaction` may represent an entire block
///
/// returns an iterator over [AnnouncedUtxo]
///
Expand Down
2 changes: 1 addition & 1 deletion src/models/state/wallet/expected_utxo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ use crate::util_types::mutator_set::commit;
/// See issue #176.
/// <https://github.com/Neptune-Crypto/neptune-core/issues/176>
///
/// see [AnnouncedUtxo](crate::models::blockchain::transaction::AnnouncedUtxo), [UtxoNotification](crate::models::blockchain::transaction::UtxoNotification)
/// see [AnnouncedUtxo](crate::models::blockchain::transaction::AnnouncedUtxo), [UtxoNotificationPayLoad](crate::models::state::wallet::utxo_notification::UtxoNotificationPayload)
#[derive(Clone, Debug, Hash, GetSize, Serialize, Deserialize)]
pub struct ExpectedUtxo {
pub utxo: Utxo,
Expand Down
2 changes: 1 addition & 1 deletion src/models/state/wallet/wallet_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ impl WalletState {
/// n = number of ExpectedUtxo in database. (all-time)
/// m = number of transaction outputs.
///
/// see https://github.com/Neptune-Crypto/neptune-core/pull/175#issuecomment-2302511025
/// see <https://github.com/Neptune-Crypto/neptune-core/pull/175#issuecomment-2302511025>
///
/// Returns an iterator of [AnnouncedUtxo]. (addition record, UTXO, sender randomness, receiver_preimage)
pub async fn scan_addition_records_for_expected_utxos<'a>(
Expand Down
4 changes: 2 additions & 2 deletions src/rpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ pub trait RPC {
///
/// `owned_utxo_notify_method` specifies how our wallet will be notified of
/// any outputs destined for it. This includes the change output if one is
/// necessary. [UtxoNotifyMethod] defines `OnChain` and `OffChain` delivery
/// necessary. [UtxoNotificationMedium] defines `OnChain` and `OffChain` delivery
/// of notifications.
///
/// `OffChain` delivery requires less blockchain space and may result in a
Expand All @@ -423,7 +423,7 @@ pub trait RPC {
/// should be sent to the transaction receiver in case `Offchain` notifications are used.
///
/// future work: add `unowned_utxo_notify_medium` param.
/// see comment for [TxOutput::auto()](crate::models::blockchain::transaction::TxOutput::auto())
/// see comment for [TxOutput::auto()](crate::models::state::wallet::transaction_output::TxOutput::auto())
async fn send_to_many(
token: rpc_auth::Token,
outputs: Vec<(ReceivingAddress, NeptuneCoins)>,
Expand Down

0 comments on commit a24b647

Please sign in to comment.