Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(svm): format docstrings #853

Merged
merged 2 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions programs/svm-spoke/src/instructions/token_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,28 @@ pub struct BridgeTokensToHubPool<'info> {
pub token_messenger_minter_sender_authority: UncheckedAccount<'info>,

/// CHECK: MessageTransmitter is checked in CCTP. Seeds must be \["message_transmitter"\] (CCTP Message Transmitter
/// program).
// program).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turning these into double slashes doesn't remove them from docs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should remove them from the docs, aren't they?

Copy link
Contributor

@md0x md0x Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, yes, before your change, Anchor was adding program). to the documentation.
Now, it doesn’t add documentation for this account (expected behavior).

Before your fix:

        {
          "name": "message_transmitter",
          "docs": [
            "program)."
          ],
          "writable": true
        },

After fix:

        {
          "name": "message_transmitter",
          "writable": true
        },

All good!

#[account(mut)]
pub message_transmitter: UncheckedAccount<'info>,

/// CHECK: TokenMessenger is checked in CCTP. Seeds must be \["token_messenger"\] (CCTP Token Messenger Minter
/// program).
// program).
pub token_messenger: UncheckedAccount<'info>,

/// CHECK: RemoteTokenMessenger is checked in CCTP. Seeds must be \["remote_token_messenger"\,
/// remote_domain.to_string()] (CCTP Token Messenger Minter program).
// remote_domain.to_string()] (CCTP Token Messenger Minter program).
pub remote_token_messenger: UncheckedAccount<'info>,

/// CHECK: TokenMinter is checked in CCTP. Seeds must be \["token_minter"\] (CCTP Token Messenger Minter program).
pub token_minter: UncheckedAccount<'info>,

/// CHECK: LocalToken is checked in CCTP. Seeds must be \["local_token", mint\] (CCTP Token Messenger Minter
/// program).
// program).
#[account(mut)]
pub local_token: UncheckedAccount<'info>,

/// CHECK: EventAuthority is checked in CCTP. Seeds must be \["__event_authority"\] (CCTP Token Messenger Minter
/// program).
// program).
pub cctp_event_authority: UncheckedAccount<'info>,

#[account(mut)]
Expand Down
50 changes: 25 additions & 25 deletions programs/svm-spoke/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ use utils::*;
pub mod svm_spoke {
use super::*;

/// **************************************
/// ADMIN FUNCTIONS *
/// *************************************
// **************************************
// ADMIN FUNCTIONS *
// *************************************

/// Initializes the state for the SVM Spoke Pool. Only callable once.
///
Expand Down Expand Up @@ -194,16 +194,16 @@ pub mod svm_spoke {
instructions::emergency_delete_root_bundle(ctx, root_bundle_id)
}

/// **************************************
/// DEPOSIT FUNCTIONS *
/// *************************************
// **************************************
// DEPOSIT FUNCTIONS *
// *************************************

/// Request to bridge input_token to a target chain and receive output_token.
///
/// The fee paid to relayers and the system is captured in the spread between the input and output amounts,
/// denominated in the input token. A relayer on the destination chain will send `output_amount` of `output_token`
/// to the recipient and receive `input_token` on a repayment chain of their choice. The fee accounts for:
/// Destination transaction costs, relayer's opportunity cost of capital while waiting for a refund during the
/// destination transaction costs, relayer's opportunity cost of capital while waiting for a refund during the
/// optimistic challenge window in the HubPool, and the system fee charged to the relayer.
///
/// On the destination chain, a unique hash of the deposit data is used to identify this deposit. Modifying any
Expand All @@ -225,7 +225,7 @@ pub mod svm_spoke {
/// ### Parameters
/// - depositor: The account credited with the deposit. Can be different from the signer.
/// - recipient: The account receiving funds on the destination chain. Depending on the output chain can be an ETH
/// address or a contract address or any other address type encoded as a bytes32 field.
/// address or a contract address or any other address type encoded as a bytes32 field.
/// - input_token: The token pulled from the caller's account and locked into this program's vault on deposit.
/// - output_token: The token that the relayer will send to the recipient on the destination chain.
/// - input_amount: The amount of input tokens to pull from the caller's account and lock into the vault. This
Expand Down Expand Up @@ -279,8 +279,8 @@ pub mod svm_spoke {
)
}

// Equivalent to deposit_v3 except quote_timestamp is set to the current time.
// The deposit `fill_deadline` is calculated as the current time plus `fill_deadline_offset`.
/// Equivalent to deposit_v3 except quote_timestamp is set to the current time.
/// The deposit `fill_deadline` is calculated as the current time plus `fill_deadline_offset`.
pub fn deposit_v3_now(
ctx: Context<DepositV3>,
depositor: Pubkey,
Expand Down Expand Up @@ -367,9 +367,9 @@ pub mod svm_spoke {
Ok(utils::get_unsafe_deposit_id(signer, depositor, deposit_nonce))
}

/// **************************************
/// RELAYER FUNCTIONS *
/// *************************************
// **************************************
// RELAYER FUNCTIONS *
// *************************************

/// Fulfill request to bridge cross chain by sending specified output tokens to recipient.
///
Expand Down Expand Up @@ -420,7 +420,7 @@ pub mod svm_spoke {
/// - message: The message to send to the recipient if the recipient is a contract that implements a
/// handle_v3_across_message() public function.
/// - repayment_chain_id: Chain of SpokePool where relayer wants to be refunded after the challenge window has
/// passed. Will receive input_amount of the equivalent token to input_token on the repayment chain.
/// passed. Will receive input_amount of the equivalent token to input_token on the repayment chain.
/// - repayment_address: The address of the recipient on the repayment chain that they want to be refunded to.
/// Note: relay_data, repayment_chain_id, and repayment_address are optional parameters. If None for any of these
/// is passed, the caller must load them via the instruction_params account.
Expand Down Expand Up @@ -483,9 +483,9 @@ pub mod svm_spoke {
instructions::create_token_accounts(ctx)
}

/// **************************************
/// BUNDLE FUNCTIONS *
/// *************************************
// **************************************
// BUNDLE FUNCTIONS *
// *************************************

/// Executes relayer refund leaf.
///
Expand Down Expand Up @@ -522,8 +522,7 @@ pub mod svm_spoke {
/// - token_program: The token program.
/// - system_program: The system program required for account creation.
///
/// execute_relayer_refund_leaf executes in mode (a) where refunds are sent to ATA directly.
/// execute_relayer_refund_leaf_deferred executes in mode (b) where refunds are allocated to the claim_account PDA.
/// execute_relayer_refund_leaf executes in mode where refunds are sent to ATA directly.
pub fn execute_relayer_refund_leaf<'c, 'info>(
ctx: Context<'_, '_, 'c, 'info, ExecuteRelayerRefundLeaf<'info>>,
) -> Result<()>
Expand All @@ -533,6 +532,7 @@ pub mod svm_spoke {
instructions::execute_relayer_refund_leaf(ctx, false)
}

/// Similar to execute_relayer_refund_leaf, but executes in mode where refunds are allocated to claim_account PDAs.
pub fn execute_relayer_refund_leaf_deferred<'c, 'info>(
ctx: Context<'_, '_, 'c, 'info, ExecuteRelayerRefundLeaf<'info>>,
) -> Result<()>
Expand Down Expand Up @@ -658,9 +658,9 @@ pub mod svm_spoke {
instructions::close_claim_account(ctx)
}

/// **************************************
/// SLOW FILL FUNCTIONS *
/// *************************************
// **************************************
// SLOW FILL FUNCTIONS *
// *************************************

/// Requests Across to send LP funds to this program to fulfill a slow fill.
///
Expand Down Expand Up @@ -743,9 +743,9 @@ pub mod svm_spoke {
instructions::execute_v3_slow_relay_leaf(ctx, slow_fill_leaf, proof)
}

/// **************************************
/// CCTP FUNCTIONS FUNCTIONS *
/// *************************************
// **************************************
// CCTP FUNCTIONS FUNCTIONS *
// *************************************

/// Handles cross-chain messages received from L1 Ethereum over CCTP.
///
Expand Down
Loading