Skip to content

Commit

Permalink
Add doc CI lint (#1479)
Browse files Browse the repository at this point in the history
* add doc lint

* needs libudev apparently

* fix all docs
  • Loading branch information
DaughterOfMars authored Oct 20, 2023
1 parent cb2e6f9 commit 3a5f642
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 16 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,30 @@ jobs:
- name: Run cargo-license-template
run: cargo ci-license

check-docs:
name: Check Documentation
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -D warnings

steps:
- name: Checkout the Source Code
uses: actions/checkout@v3

- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
toolchain: nightly
components: rustfmt

- name: Install Required Dependencies
run: |
sudo apt-get update
sudo apt-get install libudev-dev libusb-1.0-0-dev
- name: Run cargo-doc
run: cargo ci-doc

audit:
name: Perform Security Audit
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl<'a> ClientBlockBuilder<'a> {
}

/// Searches inputs for provided outputs, by requesting the outputs from the account addresses or for
/// alias/foundry/nft outputs get the latest state with their alias/nft id. Forwards to [try_select_inputs()].
/// alias/foundry/nft outputs get the latest state with their alias/nft id. Forwards to input selection.
pub(crate) async fn get_inputs(&self, protocol_parameters: &ProtocolParameters) -> Result<Selected> {
log::debug!("[get_inputs]");

Expand Down
2 changes: 1 addition & 1 deletion sdk/src/client/api/block_builder/input_selection/manual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use crate::{
impl<'a> ClientBlockBuilder<'a> {
/// If custom inputs are provided we check if they are unspent, get the balance and search the Ed25519 addresses for
/// them with the provided input_range so we can later sign them.
/// Forwards to [try_select_inputs()] with all inputs in `mandatory_inputs`, so they will all be included in the
/// Forwards to input selection with all inputs in `mandatory_inputs`, so they will all be included in the
/// transaction, even if not required for the provided outputs.
pub(crate) async fn get_custom_inputs(
&self,
Expand Down
17 changes: 10 additions & 7 deletions sdk/src/client/stronghold/secret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@ impl SecretManagerConfig for StrongholdAdapter {

/// Private methods for the secret manager implementation.
impl StrongholdAdapter {
/// Execute [Procedure::BIP39Recover] in Stronghold to put a mnemonic into the Stronghold vault.
/// Execute [BIP39Recover](procedures::BIP39Recover) procedure in Stronghold to put a mnemonic into the Stronghold
/// vault.
async fn bip39_recover(&self, mnemonic: Mnemonic, passphrase: Passphrase, output: Location) -> Result<(), Error> {
self.stronghold
.lock()
Expand All @@ -339,7 +340,8 @@ impl StrongholdAdapter {
Ok(())
}

/// Execute [Procedure::SLIP10Derive] in Stronghold to derive a SLIP-10 private key in the Stronghold vault.
/// Execute [Slip10Derive](procedures::Slip10Derive) procedure in Stronghold to derive a SLIP-10 private key in the
/// Stronghold vault.
async fn slip10_derive(
&self,
curve: Curve,
Expand Down Expand Up @@ -386,7 +388,7 @@ impl StrongholdAdapter {
Ok(())
}

/// Execute [Procedure::PublicKey] in Stronghold to get an Ed25519 public key from the SLIP-10
/// Execute [PublicKey](procedures::PublicKey) procedure in Stronghold to get an Ed25519 public key from the SLIP-10
/// private key located in `private_key`.
async fn ed25519_public_key(&self, private_key: Location) -> Result<ed25519::PublicKey, Error> {
Ok(ed25519::PublicKey::try_from_bytes(
Expand All @@ -403,7 +405,8 @@ impl StrongholdAdapter {
)?)
}

/// Execute [Procedure::Ed25519Sign] in Stronghold to sign `msg` with `private_key` stored in the Stronghold vault.
/// Execute [Ed25519Sign](procedures::Ed25519Sign) procedure in Stronghold to sign `msg` with `private_key` stored
/// in the Stronghold vault.
async fn ed25519_sign(&self, private_key: Location, msg: &[u8]) -> Result<ed25519::Signature, Error> {
Ok(ed25519::Signature::from_bytes(
self.stronghold
Expand All @@ -417,8 +420,8 @@ impl StrongholdAdapter {
))
}

/// Execute [Procedure::Secp256k1EcdsaSign] in Stronghold to sign `msg` with `private_key` stored in the Stronghold
/// vault.
/// Execute [Secp256k1EcdsaSign](procedures::Secp256k1EcdsaSign) procedure in Stronghold to sign `msg` with
/// `private_key` stored in the Stronghold vault.
async fn secp256k1_ecdsa_sign(
&self,
private_key: Location,
Expand All @@ -438,7 +441,7 @@ impl StrongholdAdapter {
)?)
}

/// Execute [Procedure::PublicKey] in Stronghold to get a Secp256k1Ecdsa public key from the
/// Execute [PublicKey](procedures::PublicKey) procedure in Stronghold to get a Secp256k1Ecdsa public key from the
/// SLIP-10 private key located in `private_key`.
async fn secp256k1_ecdsa_public_key(&self, private_key: Location) -> Result<secp256k1_ecdsa::PublicKey, Error> {
let bytes = self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl ReceiptMilestoneOption {
&self.funds
}

/// The [`TreasuryTransactionPayload`](crate::types::block::payload::treasury_transaction::TreasuryTransactionPayload) used
/// The [`TreasuryTransactionPayload`] used
/// to fund the funds of a [`ReceiptMilestoneOption`].
pub fn transaction(&self) -> &TreasuryTransactionPayload {
if let Payload::TreasuryTransaction(ref transaction) = self.transaction {
Expand Down
10 changes: 5 additions & 5 deletions sdk/src/types/block/rand/output/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub fn rand_treasury_output(token_supply: u64) -> TreasuryOutput {
TreasuryOutput::new(rand_number_range(0..token_supply), token_supply).unwrap()
}

/// Generates a random [`BasicOutput`](BasicOutput).
/// Generates a random [`BasicOutput`].
pub fn rand_basic_output(token_supply: u64) -> BasicOutput {
// TODO: Add `NativeTokens`
BasicOutput::build_with_amount(rand_number_range(Output::AMOUNT_MIN..token_supply))
Expand All @@ -53,12 +53,12 @@ pub fn rand_basic_output(token_supply: u64) -> BasicOutput {
.unwrap()
}

/// Generates a random [`AliasId`](AliasId).
/// Generates a random [`AliasId`].
pub fn rand_alias_id() -> AliasId {
AliasId::from(rand_bytes_array())
}

/// Generates a random [`AliasOutput`](AliasOutput).
/// Generates a random [`AliasOutput`].
pub fn rand_alias_output(token_supply: u64) -> AliasOutput {
// We need to make sure that `AliasId` and `Address` don't match.
let alias_id = rand_alias_id();
Expand All @@ -80,7 +80,7 @@ pub fn rand_token_scheme() -> TokenScheme {
TokenScheme::Simple(SimpleTokenScheme::new(minted, melted, max).unwrap())
}

/// Generates a random [`FoundryOutput`](FoundryOutput).
/// Generates a random [`FoundryOutput`].
pub fn rand_foundry_output(token_supply: u64) -> FoundryOutput {
FoundryOutput::build_with_amount(
rand_number_range(Output::AMOUNT_MIN..token_supply),
Expand All @@ -93,7 +93,7 @@ pub fn rand_foundry_output(token_supply: u64) -> FoundryOutput {
.unwrap()
}

/// Generates a random [`NftOutput`](NftOutput).
/// Generates a random [`NftOutput`].
pub fn rand_nft_output(token_supply: u64) -> NftOutput {
// We need to make sure that `NftId` and `Address` don't match.
let nft_id = NftId::from(rand_bytes_array());
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/wallet/account/operations/syncing/addresses/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ where
{
/// Get the addresses that should be synced with the current known unspent output ids
/// Also adds alias and nft addresses from unspent alias or nft outputs that have no Timelock, Expiration or
/// StorageDepositReturn [`UnlockCondition`]
/// StorageDepositReturn [`UnlockCondition`](crate::types::block::output::UnlockCondition)
pub(crate) async fn get_addresses_to_sync(
&self,
options: &SyncOptions,
Expand Down

0 comments on commit 3a5f642

Please sign in to comment.