Skip to content

Commit

Permalink
Update doc comments for clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
joncinque committed Oct 30, 2024
1 parent f23917a commit 4b190a1
Show file tree
Hide file tree
Showing 13 changed files with 73 additions and 58 deletions.
1 change: 1 addition & 0 deletions governance/program/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(clippy::arithmetic_side_effects)]
#![allow(clippy::doc_lazy_continuation)]
#![deny(missing_docs)]
//! A Governance program for the Solana blockchain.

Expand Down
3 changes: 1 addition & 2 deletions libraries/type-length-value/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,7 @@ impl<'data> TlvStateMut<'data> {

/// Packs the default TLV data into the first open slot in the data buffer.
/// Handles repetition based on the boolean arg provided:
/// * `true`: If extension is already found in the buffer,
/// it returns an error.
/// * `true`: If extension is already found in the buffer, it returns an error.
/// * `false`: Will add a new entry to the next open slot.
pub fn init_value<V: SplDiscriminate + Pod + Default>(
&mut self,
Expand Down
28 changes: 18 additions & 10 deletions stake-pool/program/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,14 @@ pub enum StakePoolInstruction {
/// 11. `[]` Stake Config sysvar
/// 12. `[]` System program
/// 13. `[]` Stake program
/// userdata: amount of lamports to increase on the given validator.
/// The actual amount split into the transient stake account is:
/// `lamports + stake_rent_exemption`
/// The rent-exemption of the stake account is withdrawn back to the
/// reserve after it is merged.
///
/// userdata: amount of lamports to increase on the given validator.
///
/// The actual amount split into the transient stake account is:
/// `lamports + stake_rent_exemption`.
///
/// The rent-exemption of the stake account is withdrawn back to the
/// reserve after it is merged.
IncreaseValidatorStake {
/// amount of lamports to increase on the given validator
lamports: u64,
Expand Down Expand Up @@ -329,6 +332,7 @@ pub enum StakePoolInstruction {
/// 10. `[]` Sysvar clock account (required)
/// 11. `[]` Pool token program id
/// 12. `[]` Stake program id,
///
/// userdata: amount of pool tokens to withdraw
WithdrawStake(u64),

Expand Down Expand Up @@ -463,11 +467,14 @@ pub enum StakePoolInstruction {
/// 11. `[]` Stake Config sysvar
/// 12. `[]` System program
/// 13. `[]` Stake program
/// userdata: amount of lamports to increase on the given validator.
/// The actual amount split into the transient stake account is:
/// `lamports + stake_rent_exemption`
/// The rent-exemption of the stake account is withdrawn back to the
/// reserve after it is merged.
///
/// userdata: amount of lamports to increase on the given validator.
///
/// The actual amount split into the transient stake account is:
/// `lamports + stake_rent_exemption`.
///
/// The rent-exemption of the stake account is withdrawn back to the
/// reserve after it is merged.
IncreaseAdditionalValidatorStake {
/// amount of lamports to increase on the given validator
lamports: u64,
Expand Down Expand Up @@ -674,6 +681,7 @@ pub enum StakePoolInstruction {
/// 10. `[]` Sysvar clock account (required)
/// 11. `[]` Pool token program id
/// 12. `[]` Stake program id,
///
/// userdata: amount of pool tokens to withdraw
WithdrawStakeWithSlippage {
/// Pool tokens to burn in exchange for lamports
Expand Down
18 changes: 9 additions & 9 deletions token-lending/program/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ pub enum LendingInstruction {
///
/// 0. `[writable]` Obligation account.
/// 1. `[]` Clock sysvar.
/// .. `[]` Collateral deposit reserve accounts - refreshed, all, in order.
/// .. `[]` Liquidity borrow reserve accounts - refreshed, all, in order.
/// 2. .. `[]` Collateral deposit reserve accounts - refreshed, all, in order.
/// 3. .. `[]` Liquidity borrow reserve accounts - refreshed, all, in order.
RefreshObligation,

// 8
Expand Down Expand Up @@ -302,8 +302,8 @@ pub enum LendingInstruction {
/// 8. `[]` Flash loan receiver program id. Must implement an instruction
/// that has tag of 0 and a signature of `(amount: u64)` This
/// instruction must return the amount to the source liquidity account.
/// .. `[any]` Additional accounts expected by the receiving program's
/// `ReceiveFlashLoan` instruction.
/// 9. .. `[any]` Additional accounts expected by the receiving program's
/// `ReceiveFlashLoan` instruction.
///
/// The flash loan receiver program that is to be invoked should contain
/// an instruction with tag `0` and accept the total amount (including
Expand All @@ -318,11 +318,11 @@ pub enum LendingInstruction {
/// 1. `[writable]` Destination liquidity (matching the source from
/// above).
/// 2. `[]` Token program id
/// .. `[any]` Additional accounts provided to the lending program's
/// `FlashLoan` instruction above. ReceiveFlashLoan {
/// // Amount that must be repaid by the receiver program
/// amount: u64
/// }
/// 3. .. `[any]` Additional accounts provided to the lending program's
/// `FlashLoan` instruction above. ReceiveFlashLoan {
/// // Amount that must be repaid by the receiver program
/// amount: u64
/// }
FlashLoan {
/// The amount that is to be borrowed - u64::MAX for up to 100% of
/// available liquidity
Expand Down
4 changes: 2 additions & 2 deletions token-lending/program/tests/helpers/flash_loan_receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ pub enum FlashLoanReceiverInstruction {
/// 1. `[writable]` Destination liquidity (matching the source from
/// above).
/// 2. `[]` Token program id
/// .. `[any]` Additional accounts provided to the lending program's
/// `FlashLoan` instruction above.
/// 3. ..`[any]` Additional accounts provided to the lending program's
/// `FlashLoan` instruction above.
ReceiveFlashLoan {
/// The amount that is loaned
amount: u64,
Expand Down
5 changes: 2 additions & 3 deletions token-metadata/interface/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,9 @@ pub enum TokenMetadataInstruction {
/// By the end of the instruction, the metadata account must be properly
/// resized based on the new size of the TLV entry.
/// * If the new size is larger, the program must first reallocate to
/// avoid
/// overwriting other TLV entries.
/// avoid overwriting other TLV entries.
/// * If the new size is smaller, the program must reallocate at the end
/// so that it's possible to iterate over TLV entries
/// so that it's possible to iterate over TLV entries
///
/// Accounts expected by this instruction:
///
Expand Down
2 changes: 2 additions & 0 deletions token-swap/program/src/curve/offset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ pub struct OffsetCurve {
impl CurveCalculator for OffsetCurve {
/// Constant product swap ensures token a * (token b + offset) = constant
/// This is guaranteed to work for all values such that:
///
/// - 1 <= source_amount <= u64::MAX
/// - 1 <= (swap_source_amount * (swap_destination_amount +
/// token_b_offset)) <= u128::MAX
///
/// If the offset and token B are both close to u64::MAX, there can be
/// overflow errors with the invariant.
fn swap_without_fees(
Expand Down
4 changes: 2 additions & 2 deletions token-swap/program/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ pub enum SwapInstruction {
/// 4. `[writable]` Pool Token Mint. Must be empty, owned by swap
/// authority.
/// 5. `[]` Pool Token Account to deposit trading and withdraw fees.
/// Must be empty, not owned by swap authority
/// Must be empty, not owned by swap authority
/// 6. `[writable]` Pool Token Account to deposit the initial pool token
/// supply. Must be empty, not owned by swap authority.
/// supply. Must be empty, not owned by swap authority.
/// 7. `[]` Pool Token program id
Initialize(Initialize),

Expand Down
8 changes: 4 additions & 4 deletions token-wrap/program/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ pub enum TokenWrapInstruction {
/// 6. `[]` SPL Token program for unwrapped mint
/// 7. `[]` SPL Token program for wrapped mint
/// 8. `[signer]` Transfer authority on unwrapped token account
/// 8..8+M. `[signer]` (Optional) M multisig signers on unwrapped token
/// account
/// 9. ..8+M. `[signer]` (Optional) M multisig signers on unwrapped token
/// account
///
/// Data expected by this instruction:
/// * little-endian u64 representing the amount to wrap
Expand All @@ -72,8 +72,8 @@ pub enum TokenWrapInstruction {
/// 6. `[]` SPL Token program for wrapped mint
/// 7. `[]` SPL Token program for unwrapped mint
/// 8. `[signer]` Transfer authority on wrapped token account
/// 8..8+M. `[signer]` (Optional) M multisig signers on wrapped token
/// account
/// 9. ..8+M. `[signer]` (Optional) M multisig signers on wrapped token
/// account
///
/// Data expected by this instruction:
/// * little-endian u64 representing the amount to unwrap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ pub enum ConfidentialTransferInstruction {
/// 3. `[]` (Optional) Record account if the accompanying proof is to be
/// read from a record account.
/// 4. `[]` The multisig source account owner.
/// 5.. `[signer]` Required M signer accounts for the SPL Token Multisig
/// account.
/// 5. .. `[signer]` Required M signer accounts for the SPL Token Multisig
/// account.
///
/// Data expected by this instruction:
/// `ConfigureAccountInstructionData`
Expand Down Expand Up @@ -166,8 +166,8 @@ pub enum ConfidentialTransferInstruction {
/// 2. `[]` (Optional) Record account if the accompanying proof is to be
/// read from a record account.
/// 3. `[]` The multisig account owner.
/// 4.. `[signer]` Required M signer accounts for the SPL Token Multisig
/// account.
/// 4. .. `[signer]` Required M signer accounts for the SPL Token Multisig
/// account.
///
/// Data expected by this instruction:
/// `EmptyAccountInstructionData`
Expand All @@ -194,8 +194,8 @@ pub enum ConfidentialTransferInstruction {
/// 0. `[writable]` The SPL Token account.
/// 1. `[]` The token mint.
/// 2. `[]` The multisig account owner or delegate.
/// 3.. `[signer]` Required M signer accounts for the SPL Token Multisig
/// account.
/// 3. .. `[signer]` Required M signer accounts for the SPL Token Multisig
/// account.
///
/// Data expected by this instruction:
/// `DepositInstructionData`
Expand All @@ -207,8 +207,10 @@ pub enum ConfidentialTransferInstruction {
/// In order for this instruction to be successfully processed, it must be
/// accompanied by the following list of `zk_elgamal_proof` program
/// instructions:
///
/// - `VerifyCiphertextCommitmentEquality`
/// - `VerifyBatchedRangeProofU64`
///
/// These instructions can be accompanied in the same transaction or can be
/// pre-verified into a context state account, in which case, only their
/// context state account address need to be provided.
Expand Down Expand Up @@ -241,8 +243,8 @@ pub enum ConfidentialTransferInstruction {
/// 4. `[]` (Optional) Range proof record account or context state
/// account.
/// 5. `[]` The multisig source account owner.
/// 6.. `[signer]` Required M signer accounts for the SPL Token Multisig
/// account.
/// 6. .. `[signer]` Required M signer accounts for the SPL Token Multisig
/// account.
///
/// Data expected by this instruction:
/// `WithdrawInstructionData`
Expand All @@ -253,9 +255,11 @@ pub enum ConfidentialTransferInstruction {
/// In order for this instruction to be successfully processed, it must be
/// accompanied by the following list of `zk_elgamal_proof` program
/// instructions:
///
/// - `VerifyCiphertextCommitmentEquality`
/// - `VerifyBatchedGroupedCiphertext3HandlesValidity`
/// - `VerifyBatchedRangeProofU128`
///
/// These instructions can be accompanied in the same transaction or can be
/// pre-verified into a context state account, in which case, only their
/// context state account addresses need to be provided.
Expand Down Expand Up @@ -291,8 +295,8 @@ pub enum ConfidentialTransferInstruction {
/// 7. `[]` (Optional) Range proof record account or context state
/// account.
/// 8. `[]` The multisig source account owner.
/// 9.. `[signer]` Required M signer accounts for the SPL Token Multisig
/// account.
/// 9. .. `[signer]` Required M signer accounts for the SPL Token Multisig
/// account.
///
/// Data expected by this instruction:
/// `TransferInstructionData`
Expand All @@ -319,8 +323,8 @@ pub enum ConfidentialTransferInstruction {
/// * Multisignature owner/delegate
/// 0. `[writable]` The SPL Token account.
/// 1. `[]` The multisig account owner.
/// 2.. `[signer]` Required M signer accounts for the SPL Token Multisig
/// account.
/// 2. .. `[signer]` Required M signer accounts for the SPL Token Multisig
/// account.
///
/// Data expected by this instruction:
/// `ApplyPendingBalanceData`
Expand All @@ -338,8 +342,8 @@ pub enum ConfidentialTransferInstruction {
/// * Multisignature owner/delegate
/// 0. `[writable]` The SPL Token account.
/// 1. `[]` Multisig authority.
/// 2.. `[signer]` Required M signer accounts for the SPL Token Multisig
/// account.
/// 2. .. `[signer]` Required M signer accounts for the SPL Token Multisig
/// account.
///
/// Data expected by this instruction:
/// None
Expand All @@ -363,8 +367,8 @@ pub enum ConfidentialTransferInstruction {
/// * Multisignature owner/delegate
/// 0. `[writable]` The SPL Token account.
/// 1. `[]` The multisig account owner.
/// 2.. `[signer]` Required M signer accounts for the SPL Token Multisig
/// account.
/// 2. .. `[signer]` Required M signer accounts for the SPL Token Multisig
/// account.
///
/// Data expected by this instruction:
/// None
Expand All @@ -382,8 +386,8 @@ pub enum ConfidentialTransferInstruction {
/// * Multisignature owner/delegate
/// 0. `[writable]` The SPL Token account.
/// 1. `[]` The multisig account owner.
/// 2.. `[signer]` Required M signer accounts for the SPL Token Multisig
/// account.
/// 2. .. `[signer]` Required M signer accounts for the SPL Token Multisig
/// account.
///
/// Data expected by this instruction:
/// None
Expand All @@ -404,8 +408,8 @@ pub enum ConfidentialTransferInstruction {
/// * Multisignature owner/delegate
/// 0. `[writable]` The SPL Token account.
/// 1. `[]` The multisig account owner.
/// 2.. `[signer]` Required M signer accounts for the SPL Token Multisig
/// account.
/// 2. .. `[signer]` Required M signer accounts for the SPL Token Multisig
/// account.
///
/// Data expected by this instruction:
/// None
Expand All @@ -416,12 +420,14 @@ pub enum ConfidentialTransferInstruction {
/// In order for this instruction to be successfully processed, it must be
/// accompanied by the following list of `zk_elgamal_proof` program
/// instructions:
///
/// - `VerifyCiphertextCommitmentEquality`
/// - `VerifyBatchedGroupedCiphertext3HandlesValidity` (transfer amount
/// ciphertext)
/// - `VerifyPercentageWithFee`
/// - `VerifyBatchedGroupedCiphertext2HandlesValidity` (fee ciphertext)
/// - `VerifyBatchedRangeProofU256`
///
/// These instructions can be accompanied in the same transaction or can be
/// pre-verified into a context state account, in which case, only their
/// context state account addresses need to be provided.
Expand Down Expand Up @@ -467,7 +473,7 @@ pub enum ConfidentialTransferInstruction {
/// 9. `[]` (Optional) Range proof record account or context state
/// account.
/// 10. `[]` The multisig source account owner.
/// 11.. `[signer]` Required M signer accounts for the SPL Token Multisig
/// 11. .. `[signer]` Required M signer accounts for the SPL Token Multisig
///
/// Data expected by this instruction:
/// `TransferWithFeeInstructionData`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub enum ConfidentialTransferFeeInstruction {
/// 3. `[]` (Optional) Record account if the accompanying proof is to be
/// read from a record account.
/// 4. `[]` The mint's multisig `withdraw_withheld_authority`.
/// 5. ..3+M `[signer]` M signer accounts.
/// 5. ..5+M `[signer]` M signer accounts.
///
/// Data expected by this instruction:
/// WithdrawWithheldTokensFromMintData
Expand Down Expand Up @@ -158,7 +158,7 @@ pub enum ConfidentialTransferFeeInstruction {
/// read from a record account.
/// 4. `[]` The mint's multisig `withdraw_withheld_authority`.
/// 5. ..5+M `[signer]` M signer accounts.
/// 5+M+1. ..5+M+N `[writable]` The source accounts to withdraw from.
/// 6. 5+M+1..5+M+N `[writable]` The source accounts to withdraw from.
///
/// Data expected by this instruction:
/// WithdrawWithheldTokensFromAccountsData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pub enum TransferFeeInstruction {
/// 1. `[writable]` The destination account.
/// 2. `[]` The mint's multisig `withdraw_withheld_authority`.
/// 3. ..3+M `[signer]` M signer accounts.
/// 3+M+1. ..3+M+N `[writable]` The source accounts to withdraw from.
/// 4. 3+M+1..3+M+N `[writable]` The source accounts to withdraw from.
WithdrawWithheldTokensFromAccounts {
/// Number of token accounts harvested
num_token_accounts: u8,
Expand Down
4 changes: 2 additions & 2 deletions token/transfer-hook/interface/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ pub enum TransferHookInstruction {
/// 2. `[]` Destination account
/// 3. `[]` Source account's owner/delegate
/// 4. `[]` (Optional) Validation account
/// 5..5+M `[]` `M` optional additional accounts, written in validation
/// account data
/// 5. ..5+M `[]` `M` optional additional accounts, written in validation
/// account data
Execute {
/// Amount of tokens to transfer
amount: u64,
Expand Down

0 comments on commit 4b190a1

Please sign in to comment.