From e7a09c20abf923dd4cf8fa2fa6244f935c8107de Mon Sep 17 00:00:00 2001 From: Daniel Savu <23065004+daniel-savu@users.noreply.github.com> Date: Tue, 19 Dec 2023 11:00:35 +0000 Subject: [PATCH] This reverts commit 2da8b19dd37a51098017b9f4991b6c66b8e8879d. fix: solana format rustdoc --- rust/sealevel/client/src/main.rs | 58 +++++----- .../src/instruction.rs | 34 +++--- .../hyperlane-sealevel-token/src/processor.rs | 98 ++++++++-------- rust/sealevel/libraries/test-utils/src/igp.rs | 18 +-- .../programs/helloworld/src/instruction.rs | 16 +-- .../programs/helloworld/src/processor.rs | 64 +++++------ .../src/functional.rs | 74 ++++++------ .../hyperlane-sealevel-igp/src/instruction.rs | 48 ++++---- .../hyperlane-sealevel-igp/src/processor.rs | 68 +++++------ .../src/instruction.rs | 10 +- .../src/plugin.rs | 30 ++--- .../src/processor.rs | 106 +++++++++--------- .../tests/functional.rs | 74 ++++++------ .../src/instruction.rs | 2 +- .../src/plugin.rs | 10 +- .../src/processor.rs | 86 +++++++------- .../tests/functional.rs | 54 ++++----- .../src/instruction.rs | 4 +- .../hyperlane-sealevel-token/src/plugin.rs | 20 ++-- .../hyperlane-sealevel-token/src/processor.rs | 98 ++++++++-------- .../tests/functional.rs | 64 +++++------ .../src/instruction.rs | 30 ++--- .../multisig-ism-message-id/src/processor.rs | 16 +-- .../programs/ism/test-ism/src/program.rs | 10 +- .../programs/ism/test-ism/src/test_client.rs | 8 +- .../programs/mailbox-test/src/functional.rs | 32 +++--- .../programs/mailbox-test/src/utils.rs | 14 +-- .../programs/mailbox/src/instruction.rs | 10 +- .../programs/mailbox/src/processor.rs | 66 +++++------ .../test-send-receiver/src/program.rs | 32 +++--- .../test-send-receiver/src/test_client.rs | 26 ++--- .../validator-announce/src/instruction.rs | 6 +- .../validator-announce/src/processor.rs | 16 +-- .../validator-announce/tests/functional.rs | 16 +-- 34 files changed, 659 insertions(+), 659 deletions(-) diff --git a/rust/sealevel/client/src/main.rs b/rust/sealevel/client/src/main.rs index 511d7265c9..4275de08d9 100644 --- a/rust/sealevel/client/src/main.rs +++ b/rust/sealevel/client/src/main.rs @@ -991,23 +991,23 @@ fn process_token_cmd(ctx: Context, cmd: TokenCmd) { // Burns the tokens from the sender's associated token account and // then dispatches a message to the remote recipient. // - // 0. `executable` The system program. - // 1. `executable` The spl_noop program. - // 2. `` The token PDA account. - // 3. `executable` The mailbox program. - // 4. `writeable` The mailbox outbox account. - // 5. `` Message dispatch authority. - // 6. `signer` The token sender and mailbox payer. - // 7. `signer` Unique message / gas payment account. - // 8. `writeable` Message storage PDA. + // 0. `[executable]` The system program. + // 1. `[executable]` The spl_noop program. + // 2. `[]` The token PDA account. + // 3. `[executable]` The mailbox program. + // 4. `[writeable]` The mailbox outbox account. + // 5. `[]` Message dispatch authority. + // 6. `[signer]` The token sender and mailbox payer. + // 7. `[signer]` Unique message / gas payment account. + // 8. `[writeable]` Message storage PDA. // ---- If using an IGP ---- - // 9. `executable` The IGP program. - // 10. `writeable` The IGP program data. - // 11. `writeable` Gas payment PDA. - // 12. `` OPTIONAL - The Overhead IGP program, if the configured IGP is an Overhead IGP. - // 13. `writeable` The IGP account. + // 9. `[executable]` The IGP program. + // 10. `[writeable]` The IGP program data. + // 11. `[writeable]` Gas payment PDA. + // 12. `[]` OPTIONAL - The Overhead IGP program, if the configured IGP is an Overhead IGP. + // 13. `[writeable]` The IGP account. // ---- End if ---- - // 14..N `??..??` Plugin-specific accounts. + // 14..N [??..??] Plugin-specific accounts. let mut accounts = vec![ AccountMeta::new_readonly(system_program::id(), false), AccountMeta::new_readonly(spl_noop::id(), false), @@ -1059,8 +1059,8 @@ fn process_token_cmd(ctx: Context, cmd: TokenCmd) { match xfer.token_type { TokenType::Native => { - // 5. `executable` The system program. - // 6. `writeable` The native token collateral PDA account. + // 5. `[executable]` The system program. + // 6. `[writeable]` The native token collateral PDA account. let (native_collateral_account, _native_collateral_bump) = Pubkey::find_program_address( hyperlane_token_native_collateral_pda_seeds!(), @@ -1072,9 +1072,9 @@ fn process_token_cmd(ctx: Context, cmd: TokenCmd) { ]); } TokenType::Synthetic => { - // 5. `executable` The spl_token_2022 program. - // 6. `writeable` The mint / mint authority PDA account. - // 7. `writeable` The token sender's associated token account, from which tokens will be burned. + // 5. `[executable]` The spl_token_2022 program. + // 6. `[writeable]` The mint / mint authority PDA account. + // 7. `[writeable]` The token sender's associated token account, from which tokens will be burned. let (mint_account, _mint_bump) = Pubkey::find_program_address( hyperlane_token_mint_pda_seeds!(), &xfer.program_id, @@ -1092,10 +1092,10 @@ fn process_token_cmd(ctx: Context, cmd: TokenCmd) { ]); } TokenType::Collateral => { - // 5. `executable` The SPL token program for the mint. - // 6. `writeable` The mint. - // 7. `writeable` The token sender's associated token account, from which tokens will be sent. - // 8. `writeable` The escrow PDA account. + // 5. `[executable]` The SPL token program for the mint. + // 6. `[writeable]` The mint. + // 7. `[writeable]` The token sender's associated token account, from which tokens will be sent. + // 8. `[writeable]` The escrow PDA account. let token = HyperlaneTokenAccount::::fetch( &mut &fetched_token_account.data[..], ) @@ -1266,11 +1266,11 @@ fn process_validator_announce_cmd(ctx: Context, cmd: ValidatorAnnounceCmd) { let ixn = ValidatorAnnounceInstruction::Announce(announce_instruction); // Accounts: - // 0. `signer` The payer. - // 1. `executable` The system program. - // 2. `` The ValidatorAnnounce PDA account. - // 3. `writeable` The validator-specific ValidatorStorageLocationsAccount PDA account. - // 4. `writeable` The ReplayProtection PDA account specific to the announcement being made. + // 0. `[signer]` The payer. + // 1. `[executable]` The system program. + // 2. `[]` The ValidatorAnnounce PDA account. + // 3. `[writeable]` The validator-specific ValidatorStorageLocationsAccount PDA account. + // 4. `[writeable]` The ReplayProtection PDA account specific to the announcement being made. let accounts = vec![ AccountMeta::new_readonly(ctx.payer_pubkey, true), AccountMeta::new_readonly(system_program::id(), false), diff --git a/rust/sealevel/libraries/hyperlane-sealevel-token/src/instruction.rs b/rust/sealevel/libraries/hyperlane-sealevel-token/src/instruction.rs index da4a89a9b7..cecd3828f5 100644 --- a/rust/sealevel/libraries/hyperlane-sealevel-token/src/instruction.rs +++ b/rust/sealevel/libraries/hyperlane-sealevel-token/src/instruction.rs @@ -89,11 +89,11 @@ pub fn init_instruction( let ixn = Instruction::Init(init); // Accounts: - // 0. `executable` The system program. - // 1. `writable` The token PDA account. - // 2. `writable` The dispatch authority PDA account. - // 3. `signer` The payer and access control owner. - // 4..N `??..??` Plugin-specific accounts. + // 0. `[executable]` The system program. + // 1. `[writable]` The token PDA account. + // 2. `[writable]` The dispatch authority PDA account. + // 3. `[signer]` The payer and access control owner. + // 4..N [??..??] Plugin-specific accounts. let accounts = vec![ AccountMeta::new_readonly(solana_program::system_program::id(), false), AccountMeta::new(token_key, false), @@ -123,9 +123,9 @@ pub fn enroll_remote_routers_instruction( let ixn = Instruction::EnrollRemoteRouters(configs); // Accounts: - // 0. `executable` The system program. - // 1. `writeable` The token PDA account. - // 2. `signer` The owner. + // 0. `[executable]` The system program. + // 1. `[writeable]` The token PDA account. + // 2. `[signer]` The owner. let accounts = vec![ AccountMeta::new_readonly(solana_program::system_program::id(), false), AccountMeta::new(token_key, false), @@ -154,9 +154,9 @@ pub fn set_destination_gas_configs( let ixn = Instruction::SetDestinationGasConfigs(configs); // Accounts: - // 0. `executable` The system program. - // 1. `writeable` The token PDA account. - // 2. `signer` The owner. + // 0. `[executable]` The system program. + // 1. `[writeable]` The token PDA account. + // 2. `[signer]` The owner. let accounts = vec![ AccountMeta::new_readonly(solana_program::system_program::id(), false), AccountMeta::new(token_key, false), @@ -185,8 +185,8 @@ pub fn transfer_ownership_instruction( let ixn = Instruction::TransferOwnership(new_owner); // Accounts: - // 0. `writeable` The token PDA account. - // 1. `signer` The current owner. + // 0. `[writeable]` The token PDA account. + // 1. `[signer]` The current owner. let accounts = vec![ AccountMeta::new(token_key, false), AccountMeta::new_readonly(owner_payer, true), @@ -214,8 +214,8 @@ pub fn set_interchain_security_module_instruction( let ixn = Instruction::SetInterchainSecurityModule(new_interchain_security_module); // Accounts: - // 0. `writeable` The token PDA account. - // 1. `signer` The current owner. + // 0. `[writeable]` The token PDA account. + // 1. `[signer]` The current owner. let accounts = vec![ AccountMeta::new(token_key, false), AccountMeta::new_readonly(owner_payer, true), @@ -243,8 +243,8 @@ pub fn set_igp_instruction( let ixn = Instruction::SetInterchainGasPaymaster(igp_program_and_account); // Accounts: - // 0. `writeable` The token PDA account. - // 1. `signer` The current owner. + // 0. `[writeable]` The token PDA account. + // 1. `[signer]` The current owner. let accounts = vec![ AccountMeta::new(token_key, false), AccountMeta::new_readonly(owner_payer, true), diff --git a/rust/sealevel/libraries/hyperlane-sealevel-token/src/processor.rs b/rust/sealevel/libraries/hyperlane-sealevel-token/src/processor.rs index 4ba67d64e2..132aac935d 100644 --- a/rust/sealevel/libraries/hyperlane-sealevel-token/src/processor.rs +++ b/rust/sealevel/libraries/hyperlane-sealevel-token/src/processor.rs @@ -138,11 +138,11 @@ where /// Initializes the program. /// /// Accounts: - /// 0. `executable` The system program. - /// 1. `writable` The token PDA account. - /// 2. `writable` The dispatch authority PDA account. - /// 3. `signer` The payer and access control owner. - /// 4..N `??..??` Plugin-specific accounts. + /// 0. `[executable]` The system program. + /// 1. `[writable]` The token PDA account. + /// 2. `[writable]` The dispatch authority PDA account. + /// 3. `[signer]` The payer and access control owner. + /// 4..N [??..??] Plugin-specific accounts. pub fn initialize(program_id: &Pubkey, accounts: &[AccountInfo], init: Init) -> ProgramResult { let accounts_iter = &mut accounts.iter(); @@ -255,23 +255,23 @@ where /// then dispatches a message to the remote recipient. /// /// Accounts: - /// 0. `executable` The system program. - /// 1. `executable` The spl_noop program. - /// 2. `` The token PDA account. - /// 3. `executable` The mailbox program. - /// 4. `writeable` The mailbox outbox account. - /// 5. `` Message dispatch authority. - /// 6. `signer` The token sender and mailbox payer. - /// 7. `signer` Unique message / gas payment account. - /// 8. `writeable` Message storage PDA. + /// 0. `[executable]` The system program. + /// 1. `[executable]` The spl_noop program. + /// 2. `[]` The token PDA account. + /// 3. `[executable]` The mailbox program. + /// 4. `[writeable]` The mailbox outbox account. + /// 5. `[]` Message dispatch authority. + /// 6. `[signer]` The token sender and mailbox payer. + /// 7. `[signer]` Unique message / gas payment account. + /// 8. `[writeable]` Message storage PDA. /// ---- If using an IGP ---- - /// 9. `executable` The IGP program. - /// 10. `writeable` The IGP program data. - /// 11. `writeable` Gas payment PDA. - /// 12. `` OPTIONAL - The Overhead IGP program, if the configured IGP is an Overhead IGP. - /// 13. `writeable` The IGP account. + /// 9. `[executable]` The IGP program. + /// 10. `[writeable]` The IGP program data. + /// 11. `[writeable]` Gas payment PDA. + /// 12. `[]` OPTIONAL - The Overhead IGP program, if the configured IGP is an Overhead IGP. + /// 13. `[writeable]` The IGP account. /// ---- End if ---- - /// 14..N `??..??` Plugin-specific accounts. + /// 14..N [??..??] Plugin-specific accounts. pub fn transfer_remote( program_id: &Pubkey, accounts: &[AccountInfo], @@ -362,13 +362,13 @@ where // Accounts expected by the IGP's `PayForGas` instruction: // - // 0. `executable` The system program. - // 1. `signer` The payer. - // 2. `writeable` The IGP program data. - // 3. `signer` Unique gas payment account. - // 4. `writeable` Gas payment PDA. - // 5. `writeable` The IGP account. - // 6. `` Overhead IGP account (optional). + // 0. `[executable]` The system program. + // 1. `[signer]` The payer. + // 2. `[writeable]` The IGP program data. + // 3. `[signer]` Unique gas payment account. + // 4. `[writeable]` Gas payment PDA. + // 5. `[writeable]` The IGP account. + // 6. `[]` Overhead IGP account (optional). let mut igp_payment_account_metas = vec![ AccountMeta::new_readonly(solana_program::system_program::id(), false), @@ -491,11 +491,11 @@ where } /// Accounts: - /// 0. `signer` Mailbox processor authority specific to this program. - /// 1. `executable` system_program - /// 2. `` hyperlane_token storage - /// 3. `depends on plugin` recipient wallet address - /// 4..N `??..??` Plugin-specific accounts. + /// 0. `[signer]` Mailbox processor authority specific to this program. + /// 1. `[executable]` system_program + /// 2. `[]` hyperlane_token storage + /// 3. [depends on plugin] recipient wallet address + /// 4..N [??..??] Plugin-specific accounts. pub fn transfer_from_remote( program_id: &Pubkey, accounts: &[AccountInfo], @@ -575,7 +575,7 @@ where /// serializes them, and sets them as return data. /// /// Accounts: - /// 0. `` The token PDA, which is the PDA with the seeds `HANDLE_ACCOUNT_METAS_PDA_SEEDS`. + /// 0. `[]` The token PDA, which is the PDA with the seeds `HANDLE_ACCOUNT_METAS_PDA_SEEDS`. pub fn transfer_from_remote_account_metas( program_id: &Pubkey, accounts: &[AccountInfo], @@ -621,9 +621,9 @@ where /// Enrolls a remote router. /// /// Accounts: - /// 0. `executable` The system program. - /// 1. `writeable` The token PDA account. - /// 2. `signer` The owner. + /// 0. `[executable]` The system program. + /// 1. `[writeable]` The token PDA account. + /// 2. `[signer]` The owner. pub fn enroll_remote_router( program_id: &Pubkey, accounts: &[AccountInfo], @@ -670,9 +670,9 @@ where /// Enrolls remote routers. /// /// Accounts: - /// 0. `executable` The system program. - /// 1. `writeable` The token PDA account. - /// 2. `signer` The owner. + /// 0. `[executable]` The system program. + /// 1. `[writeable]` The token PDA account. + /// 2. `[signer]` The owner. pub fn enroll_remote_routers( program_id: &Pubkey, accounts: &[AccountInfo], @@ -719,8 +719,8 @@ where /// Transfers ownership. /// /// Accounts: - /// 0. `writeable` The token PDA account. - /// 1. `signer` The current owner. + /// 0. `[writeable]` The token PDA account. + /// 1. `[signer]` The current owner. pub fn transfer_ownership( program_id: &Pubkey, accounts: &[AccountInfo], @@ -747,7 +747,7 @@ where /// Gets the interchain security module. /// /// Accounts: - /// 0. `` The token PDA account. + /// 0. `[]` The token PDA account. pub fn interchain_security_module( program_id: &Pubkey, accounts: &[AccountInfo], @@ -792,8 +792,8 @@ where /// Lets the owner set the interchain security module. /// /// Accounts: - /// 0. `writeable` The token PDA account. - /// 1. `signer` The access control owner. + /// 0. `[writeable]` The token PDA account. + /// 1. `[signer]` The access control owner. pub fn set_interchain_security_module( program_id: &Pubkey, accounts: &[AccountInfo], @@ -820,9 +820,9 @@ where /// Lets the owner set destination gas configs. /// /// Accounts: - /// 0. `executable` The system program. - /// 1. `writeable` The token PDA account. - /// 2. `signer` The access control owner. + /// 0. `[executable]` The system program. + /// 1. `[writeable]` The token PDA account. + /// 2. `[signer]` The access control owner. pub fn set_destination_gas_configs( program_id: &Pubkey, accounts: &[AccountInfo], @@ -860,8 +860,8 @@ where /// Lets the owner set the interchain gas paymaster. /// /// Accounts: - /// 0. `writeable` The token PDA account. - /// 1. `signer` The access control owner. + /// 0. `[writeable]` The token PDA account. + /// 1. `[signer]` The access control owner. pub fn set_interchain_gas_paymaster( program_id: &Pubkey, accounts: &[AccountInfo], diff --git a/rust/sealevel/libraries/test-utils/src/igp.rs b/rust/sealevel/libraries/test-utils/src/igp.rs index 629f73ad69..70e5100067 100644 --- a/rust/sealevel/libraries/test-utils/src/igp.rs +++ b/rust/sealevel/libraries/test-utils/src/igp.rs @@ -74,9 +74,9 @@ pub async fn initialize_igp_program( Pubkey::find_program_address(igp_program_data_pda_seeds!(), &program_id); // Accounts: - // 0. `executable` The system program. - // 1. `signer` The payer account. - // 2. `writeable` The program data account. + // 0. `[executable]` The system program. + // 1. `[signer]` The payer account. + // 2. `[writeable]` The program data account. let init_instruction = Instruction::new_with_borsh( program_id, &IgpInstruction::Init, @@ -104,9 +104,9 @@ pub async fn initialize_igp( let (igp_key, igp_bump_seed) = Pubkey::find_program_address(igp_pda_seeds!(salt), &program_id); // Accounts: - // 0. `executable` The system program. - // 1. `signer` The payer account. - // 2. `writeable` The IGP account to initialize. + // 0. `[executable]` The system program. + // 1. `[signer]` The payer account. + // 2. `[writeable]` The IGP account to initialize. let init_instruction = Instruction::new_with_borsh( program_id, &IgpInstruction::InitIgp(InitIgp { @@ -139,9 +139,9 @@ pub async fn initialize_overhead_igp( Pubkey::find_program_address(overhead_igp_pda_seeds!(salt), &program_id); // Accounts: - // 0. `executable` The system program. - // 1. `signer` The payer account. - // 2. `writeable` The Overhead IGP account to initialize. + // 0. `[executable]` The system program. + // 1. `[signer]` The payer account. + // 2. `[writeable]` The Overhead IGP account to initialize. let init_instruction = Instruction::new_with_borsh( program_id, &IgpInstruction::InitOverheadIgp(InitOverheadIgp { salt, owner, inner }), diff --git a/rust/sealevel/programs/helloworld/src/instruction.rs b/rust/sealevel/programs/helloworld/src/instruction.rs index 0458d1a756..4b3bbb6596 100644 --- a/rust/sealevel/programs/helloworld/src/instruction.rs +++ b/rust/sealevel/programs/helloworld/src/instruction.rs @@ -71,9 +71,9 @@ pub fn init_instruction( }; // Accounts: - // 0. `executable` System program. - // 1. `signer` Payer. - // 2. `writeable` Storage PDA. + // 0. `[executable]` System program. + // 1. `[signer]` Payer. + // 2. `[writeable]` Storage PDA. let accounts = vec![ AccountMeta::new_readonly(solana_program::system_program::id(), false), AccountMeta::new_readonly(payer, true), @@ -100,9 +100,9 @@ pub fn enroll_remote_routers_instruction( .ok_or(ProgramError::InvalidSeeds)?; // Accounts: - // 0. `executable` System program. - // 1. `signer` Payer. - // 2. `writeable` Storage PDA. + // 0. `[executable]` System program. + // 1. `[signer]` Payer. + // 2. `[writeable]` Storage PDA. let accounts = vec![ AccountMeta::new_readonly(solana_program::system_program::id(), false), AccountMeta::new(program_storage_account, false), @@ -129,8 +129,8 @@ pub fn set_interchain_security_module_instruction( .ok_or(ProgramError::InvalidSeeds)?; // Accounts: - // 0. `writeable` Storage PDA account. - // 1. `signer` Owner. + // 0. `[writeable]` Storage PDA account. + // 1. `[signer]` Owner. let accounts = vec![ AccountMeta::new(program_storage_account, false), AccountMeta::new(owner, true), diff --git a/rust/sealevel/programs/helloworld/src/processor.rs b/rust/sealevel/programs/helloworld/src/processor.rs index c15c7ad03d..48ca4119fb 100644 --- a/rust/sealevel/programs/helloworld/src/processor.rs +++ b/rust/sealevel/programs/helloworld/src/processor.rs @@ -103,9 +103,9 @@ pub fn process_instruction( /// Creates the storage PDA. /// /// Accounts: -/// 0. `executable` System program. -/// 1. `signer` Payer. -/// 2. `writeable` Storage PDA. +/// 0. `[executable]` System program. +/// 1. `[signer]` Payer. +/// 2. `[writeable]` Storage PDA. fn init(program_id: &Pubkey, accounts: &[AccountInfo], init: Init) -> ProgramResult { let accounts_iter = &mut accounts.iter(); @@ -155,22 +155,22 @@ fn init(program_id: &Pubkey, accounts: &[AccountInfo], init: Init) -> ProgramRes /// Dispatches a message using the dispatch authority. /// /// Accounts: -/// 0. `writeable` Program storage. -/// 1. `executable` The Mailbox program. -/// 2. `writeable` Outbox PDA. -/// 3. `` This program's dispatch authority. -/// 4. `executable` System program. -/// 5. `executable` SPL Noop program. -/// 6. `signer` Payer. -/// 7. `signer` Unique message account. -/// 8. `writeable` Dispatched message PDA. An empty message PDA relating to the seeds +/// 0. `[writeable]` Program storage. +/// 1. `[executable]` The Mailbox program. +/// 2. `[writeable]` Outbox PDA. +/// 3. `[]` This program's dispatch authority. +/// 4. `[executable]` System program. +/// 5. `[executable]` SPL Noop program. +/// 6. `[signer]` Payer. +/// 7. `[signer]` Unique message account. +/// 8. `[writeable]` Dispatched message PDA. An empty message PDA relating to the seeds /// `mailbox_dispatched_message_pda_seeds` where the message contents will be stored. /// ---- if an IGP is configured ---- -/// 9. `executable` The IGP program. -/// 10. `writeable` The IGP program data. -/// 11. `writeable` The gas payment PDA. -/// 12. `` OPTIONAL - The Overhead IGP program, if the configured IGP is an Overhead IGP. -/// 13. `writeable` The IGP account. +/// 9. `[executable]` The IGP program. +/// 10. `[writeable]` The IGP program data. +/// 11. `[writeable]` The gas payment PDA. +/// 12. `[]` OPTIONAL - The Overhead IGP program, if the configured IGP is an Overhead IGP. +/// 13. `[writeable]` The IGP account. /// ---- end if an IGP is configured ---- fn send_hello_world( program_id: &Pubkey, @@ -261,13 +261,13 @@ fn send_hello_world( // Accounts expected by the IGP's `PayForGas` instruction: // - // 0. `executable` The system program. - // 1. `signer` The payer. - // 2. `writeable` The IGP program data. - // 3. `signer` Unique gas payment account. - // 4. `writeable` Gas payment PDA. - // 5. `writeable` The IGP account. - // 6. `` Overhead IGP account (optional). + // 0. `[executable]` The system program. + // 1. `[signer]` The payer. + // 2. `[writeable]` The IGP program data. + // 3. `[signer]` Unique gas payment account. + // 4. `[writeable]` Gas payment PDA. + // 5. `[writeable]` The IGP account. + // 6. `[]` Overhead IGP account (optional). let mut igp_payment_account_metas = vec![ AccountMeta::new_readonly(solana_program::system_program::id(), false), @@ -355,8 +355,8 @@ fn send_hello_world( /// Handles a message. /// /// Accounts: -/// 0. `writeable` Process authority specific to this program. -/// 1. `` Storage PDA account. +/// 0. `[writeable]` Process authority specific to this program. +/// 1. `[]` Storage PDA account. pub fn handle( program_id: &Pubkey, accounts: &[AccountInfo], @@ -412,8 +412,8 @@ pub fn handle( } /// Accounts: -/// 0. `writeable` Storage PDA account. -/// 1. `signer` Owner. +/// 0. `[writeable]` Storage PDA account. +/// 1. `[signer]` Owner. fn set_interchain_security_module( program_id: &Pubkey, accounts: &[AccountInfo], @@ -445,7 +445,7 @@ fn set_interchain_security_module( } /// Accounts: -/// 0. `` Storage PDA account. +/// 0. `[]` Storage PDA account. fn get_interchain_security_module(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult { let accounts_iter = &mut accounts.iter(); @@ -491,9 +491,9 @@ fn set_account_meta_return_data(program_id: &Pubkey) -> ProgramResult { /// Enrolls remote routers. /// /// Accounts: -/// 0. `executable` System program. -/// 1. `writeable` Storage PDA account. -/// 2. `signer` Owner. +/// 0. `[executable]` System program. +/// 1. `[writeable]` Storage PDA account. +/// 2. `[signer]` Owner. fn enroll_remote_routers( program_id: &Pubkey, accounts: &[AccountInfo], diff --git a/rust/sealevel/programs/hyperlane-sealevel-igp-test/src/functional.rs b/rust/sealevel/programs/hyperlane-sealevel-igp-test/src/functional.rs index 99553887aa..a7820019ac 100644 --- a/rust/sealevel/programs/hyperlane-sealevel-igp-test/src/functional.rs +++ b/rust/sealevel/programs/hyperlane-sealevel-igp-test/src/functional.rs @@ -66,9 +66,9 @@ async fn initialize( Pubkey::find_program_address(igp_program_data_pda_seeds!(), &program_id); // Accounts: - // 0. `executable` The system program. - // 1. `signer` The payer account. - // 2. `writeable` The program data account. + // 0. `[executable]` The system program. + // 1. `[signer]` The payer account. + // 2. `[writeable]` The program data account. let init_instruction = Instruction::new_with_borsh( program_id, &IgpInstruction::Init, @@ -96,9 +96,9 @@ async fn initialize_igp( let (igp_key, igp_bump_seed) = Pubkey::find_program_address(igp_pda_seeds!(salt), &program_id); // Accounts: - // 0. `executable` The system program. - // 1. `signer` The payer account. - // 2. `writeable` The IGP account to initialize. + // 0. `[executable]` The system program. + // 1. `[signer]` The payer account. + // 2. `[writeable]` The IGP account to initialize. let init_instruction = Instruction::new_with_borsh( program_id, &IgpInstruction::InitIgp(InitIgp { @@ -131,9 +131,9 @@ async fn initialize_overhead_igp( Pubkey::find_program_address(overhead_igp_pda_seeds!(salt), &program_id); // Accounts: - // 0. `executable` The system program. - // 1. `signer` The payer account. - // 2. `writeable` The Overhead IGP account to initialize. + // 0. `[executable]` The system program. + // 1. `[signer]` The payer account. + // 2. `[writeable]` The Overhead IGP account to initialize. let init_instruction = Instruction::new_with_borsh( program_id, &IgpInstruction::InitOverheadIgp(InitOverheadIgp { salt, owner, inner }), @@ -438,9 +438,9 @@ async fn test_set_gas_oracle_configs() { ]; // Accounts: - // 0. `executable` The system program. - // 1. `writeable` The IGP. - // 2. `signer` The IGP owner. + // 0. `[executable]` The system program. + // 1. `[writeable]` The IGP. + // 2. `[signer]` The IGP owner. let instruction = Instruction::new_with_borsh( program_id, &IgpInstruction::SetGasOracleConfigs(configs.clone()), @@ -536,9 +536,9 @@ async fn test_set_gas_oracle_configs_errors_if_owner_not_signer() { }]; // Accounts: - // 0. `executable` The system program. - // 1. `writeable` The IGP. - // 2. `signer` The IGP owner. + // 0. `[executable]` The system program. + // 1. `[writeable]` The IGP. + // 2. `[signer]` The IGP owner. // Try with the correct owner passed in, but it's not a signer let instruction = Instruction::new_with_borsh( @@ -600,9 +600,9 @@ async fn test_set_destination_gas_overheads() { ]; // Accounts: - // 0. `executable` The system program. - // 1. `writeable` The Overhead IGP. - // 2. `signer` The Overhead IGP owner. + // 0. `[executable]` The system program. + // 1. `[writeable]` The Overhead IGP. + // 2. `[signer]` The Overhead IGP owner. let instruction = Instruction::new_with_borsh( program_id, &IgpInstruction::SetDestinationGasOverheads(configs.clone()), @@ -698,9 +698,9 @@ async fn test_set_destination_gas_overheads_errors_if_owner_not_signer() { }]; // Accounts: - // 0. `executable` The system program. - // 1. `writeable` The Overhead IGP. - // 2. `signer` The Overhead IGP owner. + // 0. `[executable]` The system program. + // 1. `[writeable]` The Overhead IGP. + // 2. `[signer]` The Overhead IGP owner. // Try with the correct owner passed in, but it's not a signer let instruction = Instruction::new_with_borsh( @@ -986,13 +986,13 @@ async fn pay_for_gas( &program_id, ); - // 0. `executable` The system program. - // 1. `signer` The payer. - // 2. `writeable` The IGP program data. - // 3. `signer` Unique gas payment account. - // 4. `writeable` Gas payment PDA. - // 5. `writeable` The IGP account. - // 6. `` Overhead IGP account (optional). + // 0. `[executable]` The system program. + // 1. `[signer]` The payer. + // 2. `[writeable]` The IGP program data. + // 3. `[signer]` Unique gas payment account. + // 4. `[writeable]` Gas payment PDA. + // 5. `[writeable]` The IGP account. + // 6. `[]` Overhead IGP account (optional). let mut accounts = vec![ AccountMeta::new_readonly(system_program::id(), false), AccountMeta::new(payer.pubkey(), true), @@ -1301,9 +1301,9 @@ async fn test_claim() { let beneficiary_balance_before = banks_client.get_balance(payer.pubkey()).await.unwrap(); // Accounts: - // 0. `executable` The system program. - // 1. `writeable` The IGP. - // 2. `writeable` The IGP beneficiary. + // 0. `[executable]` The system program. + // 1. `[writeable]` The IGP. + // 2. `[writeable]` The IGP beneficiary. process_instruction( &mut banks_client, Instruction::new_with_borsh( @@ -1357,8 +1357,8 @@ async fn test_set_igp_beneficiary() { let new_beneficiary = Pubkey::new_unique(); // Accounts: - // 0. `` The IGP. - // 1. `signer` The owner of the IGP account. + // 0. `[]` The IGP. + // 1. `[signer]` The owner of the IGP account. let instruction = Instruction::new_with_borsh( program_id, &IgpInstruction::SetIgpBeneficiary(new_beneficiary), @@ -1403,8 +1403,8 @@ async fn test_set_igp_beneficiary_errors_if_owner_not_signer() { .unwrap(); // Accounts: - // 0. `` The IGP. - // 1. `signer` The owner of the IGP account. + // 0. `[]` The IGP. + // 1. `[signer]` The owner of the IGP account. // Try with the right owner passed in, but it's not a signer let instruction = Instruction::new_with_borsh( @@ -1448,8 +1448,8 @@ async fn run_transfer_ownership_tests ProgramResult { let accounts_iter = &mut accounts.iter(); @@ -147,9 +147,9 @@ fn init(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult { /// Initialize a new IGP account. /// /// Accounts: -/// 0. `executable` The system program. -/// 1. `signer` The payer account. -/// 2. `writeable` The IGP account to initialize. +/// 0. `[executable]` The system program. +/// 1. `[signer]` The payer account. +/// 2. `[writeable]` The IGP account to initialize. fn init_igp(program_id: &Pubkey, accounts: &[AccountInfo], data: InitIgp) -> ProgramResult { let igp_key = init_igp_variant( program_id, @@ -175,9 +175,9 @@ fn init_igp(program_id: &Pubkey, accounts: &[AccountInfo], data: InitIgp) -> Pro /// Initialize a new overhead IGP account. /// /// Accounts: -/// 0. `executable` The system program. -/// 1. `signer` The payer account. -/// 2. `writeable` The Overhead IGP account to initialize. +/// 0. `[executable]` The system program. +/// 1. `[signer]` The payer account. +/// 2. `[writeable]` The Overhead IGP account to initialize. fn init_overhead_igp( program_id: &Pubkey, accounts: &[AccountInfo], @@ -258,13 +258,13 @@ fn init_igp_variant( /// Pay for gas. /// /// Accounts: -/// 0. `executable` The system program. -/// 1. `signer` The payer. -/// 2. `writeable` The IGP program data. -/// 3. `signer` Unique gas payment account. -/// 4. `writeable` Gas payment PDA. -/// 5. `writeable` The IGP account. -/// 6. `` Overhead IGP account (optional). +/// 0. `[executable]` The system program. +/// 1. `[signer]` The payer. +/// 2. `[writeable]` The IGP program data. +/// 3. `[signer]` Unique gas payment account. +/// 4. `[writeable]` Gas payment PDA. +/// 5. `[writeable]` The IGP account. +/// 6. `[]` Overhead IGP account (optional). fn pay_for_gas(program_id: &Pubkey, accounts: &[AccountInfo], payment: PayForGas) -> ProgramResult { let accounts_iter = &mut accounts.iter(); @@ -407,9 +407,9 @@ fn pay_for_gas(program_id: &Pubkey, accounts: &[AccountInfo], payment: PayForGas /// Quotes the required payment for a given gas amount and destination domain. /// /// Accounts: -/// 0. `executable` The system program. -/// 1. `` The IGP account. -/// 2. `` The overhead IGP account (optional). +/// 0. `[executable]` The system program. +/// 1. `[]` The IGP account. +/// 2. `[]` The overhead IGP account (optional). fn quote_gas_payment( program_id: &Pubkey, accounts: &[AccountInfo], @@ -463,8 +463,8 @@ fn quote_gas_payment( /// Sets the beneficiary of an IGP. /// /// Accounts: -/// 0. `` The IGP. -/// 1. `signer` The owner of the IGP account. +/// 0. `[]` The IGP. +/// 1. `[signer]` The owner of the IGP account. fn set_igp_beneficiary( program_id: &Pubkey, accounts: &[AccountInfo], @@ -485,8 +485,8 @@ fn set_igp_beneficiary( /// Transfers ownership of an IGP variant. /// /// Accounts: -/// 0. `writeable` The IGP or OverheadIGP. -/// 1. `signer` The owner of the IGP account. +/// 0. `[writeable]` The IGP or OverheadIGP. +/// 1. `[signer]` The owner of the IGP account. fn transfer_igp_variant_ownership( program_id: &Pubkey, accounts: &[AccountInfo], @@ -506,8 +506,8 @@ fn transfer_igp_variant_ownership ProgramResult { let accounts_iter = &mut accounts.iter(); @@ -583,9 +583,9 @@ fn claim(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult { /// Sets destination gas overheads for an OverheadIGP. /// /// Accounts: -/// 0. `executable` The system program. -/// 1. `writeable` The OverheadIGP. -/// 2. `signer` The OverheadIGP owner. +/// 0. `[executable]` The system program. +/// 1. `[writeable]` The OverheadIGP. +/// 2. `[signer]` The OverheadIGP owner. fn set_destination_gas_overheads( program_id: &Pubkey, accounts: &[AccountInfo], @@ -629,9 +629,9 @@ fn set_destination_gas_overheads( /// Sets gas oracle configs for an IGP. /// /// Accounts: -/// 0. `executable` The system program. -/// 1. `writeable` The IGP. -/// 2. `signer` The IGP owner. +/// 0. `[executable]` The system program. +/// 1. `[writeable]` The IGP. +/// 2. `[signer]` The IGP owner. fn set_gas_oracle_configs( program_id: &Pubkey, accounts: &[AccountInfo], diff --git a/rust/sealevel/programs/hyperlane-sealevel-token-collateral/src/instruction.rs b/rust/sealevel/programs/hyperlane-sealevel-token-collateral/src/instruction.rs index ff828d625a..3f3d0af86d 100644 --- a/rust/sealevel/programs/hyperlane-sealevel-token-collateral/src/instruction.rs +++ b/rust/sealevel/programs/hyperlane-sealevel-token-collateral/src/instruction.rs @@ -23,11 +23,11 @@ pub fn init_instruction( let mut instruction = lib_init_instruction(program_id, payer, init)?; // Add additional account metas: - // 0. `executable` The SPL token program for the mint, i.e. either SPL token program or the 2022 version. - // 1. `` The mint. - // 2. `executable` The Rent sysvar program. - // 3. `writable` The escrow PDA account. - // 4. `writable` The ATA payer PDA account. + // 0. `[executable]` The SPL token program for the mint, i.e. either SPL token program or the 2022 version. + // 1. `[]` The mint. + // 2. `[executable]` The Rent sysvar program. + // 3. `[writable]` The escrow PDA account. + // 4. `[writable]` The ATA payer PDA account. let (escrow_key, _escrow_bump) = Pubkey::find_program_address(hyperlane_token_escrow_pda_seeds!(), &program_id); diff --git a/rust/sealevel/programs/hyperlane-sealevel-token-collateral/src/plugin.rs b/rust/sealevel/programs/hyperlane-sealevel-token-collateral/src/plugin.rs index 13566dcd93..0fc224667e 100644 --- a/rust/sealevel/programs/hyperlane-sealevel-token-collateral/src/plugin.rs +++ b/rust/sealevel/programs/hyperlane-sealevel-token-collateral/src/plugin.rs @@ -100,11 +100,11 @@ impl HyperlaneSealevelTokenPlugin for CollateralPlugin { /// Initializes the plugin. /// /// Accounts: - /// 0. `executable` The SPL token program for the mint, i.e. either SPL token program or the 2022 version. - /// 1. `` The mint. - /// 2. `executable` The Rent sysvar program. - /// 3. `writable` The escrow PDA account. - /// 4. `writable` The ATA payer PDA account. + /// 0. `[executable]` The SPL token program for the mint, i.e. either SPL token program or the 2022 version. + /// 1. `[]` The mint. + /// 2. `[executable]` The Rent sysvar program. + /// 3. `[writable]` The escrow PDA account. + /// 4. `[writable]` The ATA payer PDA account. fn initialize<'a, 'b>( program_id: &Pubkey, system_program: &'a AccountInfo<'b>, @@ -232,10 +232,10 @@ impl HyperlaneSealevelTokenPlugin for CollateralPlugin { /// Burns the tokens from the sender's associated token account. /// /// Accounts: - /// 0. `executable` The SPL token program for the mint. - /// 1. `writeable` The mint. - /// 2. `writeable` The token sender's associated token account, from which tokens will be sent. - /// 3. `writeable` The escrow PDA account. + /// 0. `[executable]` The SPL token program for the mint. + /// 1. `[writeable]` The mint. + /// 2. `[writeable]` The token sender's associated token account, from which tokens will be sent. + /// 3. `[writeable]` The escrow PDA account. fn transfer_in<'a, 'b>( _program_id: &Pubkey, token: &HyperlaneToken, @@ -308,12 +308,12 @@ impl HyperlaneSealevelTokenPlugin for CollateralPlugin { /// result of a transfer to this chain from a remote chain. /// /// Accounts: - /// 0. `executable` SPL token for the mint. - /// 1. `executable` SPL associated token account. - /// 2. `writeable` Mint account. - /// 3. `writeable` Recipient associated token account. - /// 4. `writeable` ATA payer PDA account. - /// 5. `writeable` Escrow account. + /// 0. `[executable]` SPL token for the mint. + /// 1. `[executable]` SPL associated token account. + /// 2. `[writeable]` Mint account. + /// 3. `[writeable]` Recipient associated token account. + /// 4. `[writeable]` ATA payer PDA account. + /// 5. `[writeable]` Escrow account. fn transfer_out<'a, 'b>( program_id: &Pubkey, token: &HyperlaneToken, diff --git a/rust/sealevel/programs/hyperlane-sealevel-token-collateral/src/processor.rs b/rust/sealevel/programs/hyperlane-sealevel-token-collateral/src/processor.rs index ef492f6927..e9dff90ee0 100644 --- a/rust/sealevel/programs/hyperlane-sealevel-token-collateral/src/processor.rs +++ b/rust/sealevel/programs/hyperlane-sealevel-token-collateral/src/processor.rs @@ -89,15 +89,15 @@ pub fn process_instruction( /// Initializes the program. /// /// Accounts: -/// 0. `executable` The system program. -/// 1. `writable` The token PDA account. -/// 2. `writable` The dispatch authority PDA account. -/// 3. `signer` The payer and access control owner of the program. -/// 4. `executable` The SPL token program for the mint, i.e. either SPL token program or the 2022 version. -/// 5. `` The mint. -/// 6. `executable` The Rent sysvar program. -/// 7. `writable` The escrow PDA account. -/// 8. `writable` The ATA payer PDA account. +/// 0. `[executable]` The system program. +/// 1. `[writable]` The token PDA account. +/// 2. `[writable]` The dispatch authority PDA account. +/// 3. `[signer]` The payer and access control owner of the program. +/// 4. `[executable]` The SPL token program for the mint, i.e. either SPL token program or the 2022 version. +/// 5. `[]` The mint. +/// 6. `[executable]` The Rent sysvar program. +/// 7. `[writable]` The escrow PDA account. +/// 8. `[writable]` The ATA payer PDA account. fn initialize(program_id: &Pubkey, accounts: &[AccountInfo], init: Init) -> ProgramResult { HyperlaneSealevelToken::::initialize(program_id, accounts, init) } @@ -107,26 +107,26 @@ fn initialize(program_id: &Pubkey, accounts: &[AccountInfo], init: Init) -> Prog /// then dispatches a message to the remote recipient. /// /// Accounts: -/// 0. `executable` The system program. -/// 1. `executable` The spl_noop program. -/// 2. `` The token PDA account. -/// 3. `executable` The mailbox program. -/// 4. `writeable` The mailbox outbox account. -/// 5. `` Message dispatch authority. -/// 6. `signer` The token sender and mailbox payer. -/// 7. `signer` Unique message / gas payment account. -/// 8. `writeable` Message storage PDA. +/// 0. `[executable]` The system program. +/// 1. `[executable]` The spl_noop program. +/// 2. `[]` The token PDA account. +/// 3. `[executable]` The mailbox program. +/// 4. `[writeable]` The mailbox outbox account. +/// 5. `[]` Message dispatch authority. +/// 6. `[signer]` The token sender and mailbox payer. +/// 7. `[signer]` Unique message / gas payment account. +/// 8. `[writeable]` Message storage PDA. /// ---- If using an IGP ---- -/// 9. `executable` The IGP program. -/// 10. `writeable` The IGP program data. -/// 11. `writeable` Gas payment PDA. -/// 12. `` OPTIONAL - The Overhead IGP program, if the configured IGP is an Overhead IGP. -/// 13. `writeable` The IGP account. +/// 9. `[executable]` The IGP program. +/// 10. `[writeable]` The IGP program data. +/// 11. `[writeable]` Gas payment PDA. +/// 12. `[]` OPTIONAL - The Overhead IGP program, if the configured IGP is an Overhead IGP. +/// 13. `[writeable]` The IGP account. /// ---- End if ---- -/// 14. `executable` The SPL token program for the mint. -/// 15. `writeable` The mint. -/// 16. `writeable` The token sender's associated token account, from which tokens will be sent. -/// 17. `writeable` The escrow PDA account. +/// 14. `[executable]` The SPL token program for the mint. +/// 15. `[writeable]` The mint. +/// 16. `[writeable]` The token sender's associated token account, from which tokens will be sent. +/// 17. `[writeable]` The escrow PDA account. fn transfer_remote( program_id: &Pubkey, accounts: &[AccountInfo], @@ -136,16 +136,16 @@ fn transfer_remote( } // Accounts: -// 0. `signer` Mailbox process authority specific to this program. -// 1. `executable` system_program -// 2. `` hyperlane_token storage -// 3. `` recipient wallet address -// 4. `executable` SPL token 2022 program. -// 5. `executable` SPL associated token account. -// 6. `writeable` Mint account. -// 7. `writeable` Recipient associated token account. -// 8. `writeable` ATA payer PDA account. -// 9. `writeable` Escrow account. +// 0. `[signer]` Mailbox process authority specific to this program. +// 1. `[executable]` system_program +// 2. `[]` hyperlane_token storage +// 3. `[]` recipient wallet address +// 4. `[executable]` SPL token 2022 program. +// 5. `[executable]` SPL associated token account. +// 6. `[writeable]` Mint account. +// 7. `[writeable]` Recipient associated token account. +// 8. `[writeable]` ATA payer PDA account. +// 9. `[writeable]` Escrow account. fn transfer_from_remote( program_id: &Pubkey, accounts: &[AccountInfo], @@ -171,9 +171,9 @@ fn transfer_from_remote_account_metas( /// Enrolls a remote router. /// /// Accounts: -/// 0. `executable` The system program. -/// 1. `writeable` The token PDA account. -/// 2. `signer` The owner. +/// 0. `[executable]` The system program. +/// 1. `[writeable]` The token PDA account. +/// 2. `[signer]` The owner. fn enroll_remote_router( program_id: &Pubkey, accounts: &[AccountInfo], @@ -185,9 +185,9 @@ fn enroll_remote_router( /// Enrolls remote routers. /// /// Accounts: -/// 0. `executable` The system program. -/// 1. `writeable` The token PDA account. -/// 2. `signer` The owner. +/// 0. `[executable]` The system program. +/// 1. `[writeable]` The token PDA account. +/// 2. `[signer]` The owner. fn enroll_remote_routers( program_id: &Pubkey, accounts: &[AccountInfo], @@ -199,9 +199,9 @@ fn enroll_remote_routers( /// Sets the destination gas configs. /// /// Accounts: -/// 0. `executable` The system program. -/// 1. `writeable` The token PDA account. -/// 2. `signer` The owner. +/// 0. `[executable]` The system program. +/// 1. `[writeable]` The token PDA account. +/// 2. `[signer]` The owner. fn set_destination_gas_configs( program_id: &Pubkey, accounts: &[AccountInfo], @@ -215,8 +215,8 @@ fn set_destination_gas_configs( /// Transfers ownership. /// /// Accounts: -/// 0. `writeable` The token PDA account. -/// 1. `signer` The current owner. +/// 0. `[writeable]` The token PDA account. +/// 1. `[signer]` The current owner. fn transfer_ownership( program_id: &Pubkey, accounts: &[AccountInfo], @@ -228,7 +228,7 @@ fn transfer_ownership( /// Gets the interchain security module, returning it as a serialized Option. /// /// Accounts: -/// 0. `` The token PDA account. +/// 0. `[]` The token PDA account. fn interchain_security_module(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult { HyperlaneSealevelToken::::interchain_security_module(program_id, accounts) } @@ -244,8 +244,8 @@ fn interchain_security_module_account_metas(program_id: &Pubkey) -> ProgramResul /// Lets the owner set the interchain security module. /// /// Accounts: -/// 0. `writeable` The token PDA account. -/// 1. `signer` The access control owner. +/// 0. `[writeable]` The token PDA account. +/// 1. `[signer]` The access control owner. fn set_interchain_security_module( program_id: &Pubkey, accounts: &[AccountInfo], @@ -259,8 +259,8 @@ fn set_interchain_security_module( /// Lets the owner set the interchain gas paymaster. /// /// Accounts: -/// 0. `writeable` The token PDA account. -/// 1. `signer` The access control owner. +/// 0. `[writeable]` The token PDA account. +/// 1. `[signer]` The access control owner. fn set_interchain_gas_paymaster( program_id: &Pubkey, accounts: &[AccountInfo], diff --git a/rust/sealevel/programs/hyperlane-sealevel-token-collateral/tests/functional.rs b/rust/sealevel/programs/hyperlane-sealevel-token-collateral/tests/functional.rs index 3303d7dad4..0f5e33f4df 100644 --- a/rust/sealevel/programs/hyperlane-sealevel-token-collateral/tests/functional.rs +++ b/rust/sealevel/programs/hyperlane-sealevel-token-collateral/tests/functional.rs @@ -299,15 +299,15 @@ async fn initialize_hyperlane_token( .encode() .unwrap(), vec![ - // 0. `executable` The system program. - // 1. `writable` The token PDA account. - // 2. `writable` The dispatch authority PDA account. - // 3. `signer` The payer. - // 4. `executable` The SPL token program for the mint, i.e. either SPL token program or the 2022 version. - // 5. `` The mint. - // 6. `executable` The Rent sysvar program. - // 7. `writable` The escrow PDA account. - // 8. `writable` The ATA payer PDA account. + // 0. `[executable]` The system program. + // 1. `[writable]` The token PDA account. + // 2. `[writable]` The dispatch authority PDA account. + // 3. `[signer]` The payer. + // 4. `[executable]` The SPL token program for the mint, i.e. either SPL token program or the 2022 version. + // 5. `[]` The mint. + // 6. `[executable]` The Rent sysvar program. + // 7. `[writable]` The escrow PDA account. + // 8. `[writable]` The ATA payer PDA account. AccountMeta::new_readonly(solana_program::system_program::id(), false), AccountMeta::new(token_account_key, false), AccountMeta::new(dispatch_authority_key, false), @@ -642,26 +642,26 @@ async fn test_transfer_remote(spl_token_program_id: Pubkey) { }) .encode() .unwrap(), - // 0. `executable` The system program. - // 1. `executable` The spl_noop program. - // 2. `` The token PDA account. - // 3. `executable` The mailbox program. - // 4. `writeable` The mailbox outbox account. - // 5. `` Message dispatch authority. - // 6. `signer` The token sender and mailbox payer. - // 7. `signer` Unique message account. - // 8. `writeable` Message storage PDA. + // 0. `[executable]` The system program. + // 1. `[executable]` The spl_noop program. + // 2. `[]` The token PDA account. + // 3. `[executable]` The mailbox program. + // 4. `[writeable]` The mailbox outbox account. + // 5. `[]` Message dispatch authority. + // 6. `[signer]` The token sender and mailbox payer. + // 7. `[signer]` Unique message account. + // 8. `[writeable]` Message storage PDA. // ---- If using an IGP ---- - // 9. `executable` The IGP program. - // 10. `writeable` The IGP program data. - // 11. `writeable` Gas payment PDA. - // 12. `` OPTIONAL - The Overhead IGP program, if the configured IGP is an Overhead IGP. - // 13. `writeable` The IGP account. + // 9. `[executable]` The IGP program. + // 10. `[writeable]` The IGP program data. + // 11. `[writeable]` Gas payment PDA. + // 12. `[]` OPTIONAL - The Overhead IGP program, if the configured IGP is an Overhead IGP. + // 13. `[writeable]` The IGP account. // ---- End if ---- - // 14. `executable` The spl_token_2022 program. - // 15. `writeable` The mint. - // 16. `writeable` The token sender's associated token account, from which tokens will be sent. - // 17. `writeable` The escrow PDA account. + // 14. `[executable]` The spl_token_2022 program. + // 15. `[writeable]` The mint. + // 16. `[writeable]` The token sender's associated token account, from which tokens will be sent. + // 17. `[writeable]` The escrow PDA account. vec![ AccountMeta::new_readonly(solana_program::system_program::id(), false), AccountMeta::new_readonly(spl_noop::id(), false), @@ -1084,16 +1084,16 @@ async fn test_transfer_from_remote_errors_if_process_authority_not_signer() { .unwrap(), vec![ // Recipient.handle accounts - // 0. `signer` Mailbox process authority - // 1. `executable` system_program - // 2. `` hyperlane_token storage - // 3. `` recipient wallet address - // 4. `executable` SPL token 2022 program. - // 5. `executable` SPL associated token account. - // 6. `writeable` Mint account. - // 7. `writeable` Recipient associated token account. - // 8. `writeable` ATA payer PDA account. - // 9. `writeable` Escrow account. + // 0. `[signer]` Mailbox process authority + // 1. `[executable]` system_program + // 2. `[]` hyperlane_token storage + // 3. `[]` recipient wallet address + // 4. `[executable]` SPL token 2022 program. + // 5. `[executable]` SPL associated token account. + // 6. `[writeable]` Mint account. + // 7. `[writeable]` Recipient associated token account. + // 8. `[writeable]` ATA payer PDA account. + // 9. `[writeable]` Escrow account. AccountMeta::new_readonly( hyperlane_token_accounts.mailbox_process_authority, false, diff --git a/rust/sealevel/programs/hyperlane-sealevel-token-native/src/instruction.rs b/rust/sealevel/programs/hyperlane-sealevel-token-native/src/instruction.rs index 9ab71c1ef3..2cc12149f7 100644 --- a/rust/sealevel/programs/hyperlane-sealevel-token-native/src/instruction.rs +++ b/rust/sealevel/programs/hyperlane-sealevel-token-native/src/instruction.rs @@ -19,7 +19,7 @@ pub fn init_instruction( let mut instruction = lib_init_instruction(program_id, payer, init)?; // Add additional account metas: - // 0. `writable` The native collateral PDA account. + // 0. `[writable]` The native collateral PDA account. let (native_collateral_key, _native_collatera_bump) = Pubkey::find_program_address(hyperlane_token_native_collateral_pda_seeds!(), &program_id); diff --git a/rust/sealevel/programs/hyperlane-sealevel-token-native/src/plugin.rs b/rust/sealevel/programs/hyperlane-sealevel-token-native/src/plugin.rs index 4c3d5d90a9..8c553058c0 100644 --- a/rust/sealevel/programs/hyperlane-sealevel-token-native/src/plugin.rs +++ b/rust/sealevel/programs/hyperlane-sealevel-token-native/src/plugin.rs @@ -76,7 +76,7 @@ impl HyperlaneSealevelTokenPlugin for NativePlugin { /// Initializes the plugin. /// /// Accounts: - /// 0. `writable` The native collateral PDA account. + /// 0. `[writable]` The native collateral PDA account. fn initialize<'a, 'b>( program_id: &Pubkey, system_program: &'a AccountInfo<'b>, @@ -115,8 +115,8 @@ impl HyperlaneSealevelTokenPlugin for NativePlugin { /// Burns the tokens from the sender's associated token account. /// /// Accounts: - /// 0. `executable` The system program. - /// 1. `writeable` The native token collateral PDA account. + /// 0. `[executable]` The system program. + /// 1. `[writeable]` The native token collateral PDA account. fn transfer_in<'a, 'b>( program_id: &Pubkey, token: &HyperlaneToken, @@ -145,8 +145,8 @@ impl HyperlaneSealevelTokenPlugin for NativePlugin { /// result of a transfer to this chain from a remote chain. /// /// Accounts: - /// 0. `executable` The system program. - /// 1. `writeable` The native token collateral PDA account. + /// 0. `[executable]` The system program. + /// 1. `[writeable]` The native token collateral PDA account. fn transfer_out<'a, 'b>( program_id: &Pubkey, token: &HyperlaneToken, diff --git a/rust/sealevel/programs/hyperlane-sealevel-token-native/src/processor.rs b/rust/sealevel/programs/hyperlane-sealevel-token-native/src/processor.rs index 069a24dd78..1cbfd072dd 100644 --- a/rust/sealevel/programs/hyperlane-sealevel-token-native/src/processor.rs +++ b/rust/sealevel/programs/hyperlane-sealevel-token-native/src/processor.rs @@ -89,11 +89,11 @@ pub fn process_instruction( /// Initializes the program. /// /// Accounts: -/// 0. `executable` The system program. -/// 1. `writable` The token PDA account. -/// 2. `writable` The dispatch authority PDA account. -/// 3. `signer` The payer and mailbox payer. -/// 4. `writable` The native collateral PDA account. +/// 0. `[executable]` The system program. +/// 1. `[writable]` The token PDA account. +/// 2. `[writable]` The dispatch authority PDA account. +/// 3. `[signer]` The payer and mailbox payer. +/// 4. `[writable]` The native collateral PDA account. fn initialize(program_id: &Pubkey, accounts: &[AccountInfo], init: Init) -> ProgramResult { HyperlaneSealevelToken::::initialize(program_id, accounts, init) } @@ -103,24 +103,24 @@ fn initialize(program_id: &Pubkey, accounts: &[AccountInfo], init: Init) -> Prog /// then dispatches a message to the remote recipient. /// /// Accounts: -/// 0. `executable` The system program. -/// 1. `executable` The spl_noop program. -/// 2. `` The token PDA account. -/// 3. `executable` The mailbox program. -/// 4. `writeable` The mailbox outbox account. -/// 5. `` Message dispatch authority. -/// 6. `signer` The token sender and mailbox payer. -/// 7. `signer` Unique message / gas payment account. -/// 8. `writeable` Message storage PDA. +/// 0. `[executable]` The system program. +/// 1. `[executable]` The spl_noop program. +/// 2. `[]` The token PDA account. +/// 3. `[executable]` The mailbox program. +/// 4. `[writeable]` The mailbox outbox account. +/// 5. `[]` Message dispatch authority. +/// 6. `[signer]` The token sender and mailbox payer. +/// 7. `[signer]` Unique message / gas payment account. +/// 8. `[writeable]` Message storage PDA. /// ---- If using an IGP ---- -/// 9. `executable` The IGP program. -/// 10. `writeable` The IGP program data. -/// 11. `writeable` Gas payment PDA. -/// 12. `` OPTIONAL - The Overhead IGP program, if the configured IGP is an Overhead IGP. -/// 13. `writeable` The IGP account. +/// 9. `[executable]` The IGP program. +/// 10. `[writeable]` The IGP program data. +/// 11. `[writeable]` Gas payment PDA. +/// 12. `[]` OPTIONAL - The Overhead IGP program, if the configured IGP is an Overhead IGP. +/// 13. `[writeable]` The IGP account. /// ---- End if ---- -/// 14. `executable` The system program. -/// 15. `writeable` The native token collateral PDA account. +/// 14. `[executable]` The system program. +/// 15. `[writeable]` The native token collateral PDA account. fn transfer_remote( program_id: &Pubkey, accounts: &[AccountInfo], @@ -130,12 +130,12 @@ fn transfer_remote( } /// Accounts: -/// 0. `signer` Mailbox processor authority specific to this program. -/// 1. `executable` system_program -/// 2. `` hyperlane_token storage -/// 3. `writeable` recipient wallet address -/// 4. `executable` The system program. -/// 5. `writeable` The native token collateral PDA account. +/// 0. `[signer]` Mailbox processor authority specific to this program. +/// 1. `[executable]` system_program +/// 2. `[]` hyperlane_token storage +/// 3. `[writeable]` recipient wallet address +/// 4. `[executable]` The system program. +/// 5. `[writeable]` The native token collateral PDA account. fn transfer_from_remote( program_id: &Pubkey, accounts: &[AccountInfo], @@ -161,9 +161,9 @@ fn transfer_from_remote_account_metas( /// Enrolls a remote router. /// /// Accounts: -/// 0. `executable` The system program. -/// 1. `writeable` The token PDA account. -/// 2. `signer` The owner. +/// 0. `[executable]` The system program. +/// 1. `[writeable]` The token PDA account. +/// 2. `[signer]` The owner. fn enroll_remote_router( program_id: &Pubkey, accounts: &[AccountInfo], @@ -175,9 +175,9 @@ fn enroll_remote_router( /// Enrolls remote routers. /// /// Accounts: -/// 0. `executable` The system program. -/// 1. `writeable` The token PDA account. -/// 2. `signer` The owner. +/// 0. `[executable]` The system program. +/// 1. `[writeable]` The token PDA account. +/// 2. `[signer]` The owner. fn enroll_remote_routers( program_id: &Pubkey, accounts: &[AccountInfo], @@ -189,9 +189,9 @@ fn enroll_remote_routers( /// Sets the destination gas configs. /// /// Accounts: -/// 0. `executable` The system program. -/// 1. `writeable` The token PDA account. -/// 2. `signer` The owner. +/// 0. `[executable]` The system program. +/// 1. `[writeable]` The token PDA account. +/// 2. `[signer]` The owner. fn set_destination_gas_configs( program_id: &Pubkey, accounts: &[AccountInfo], @@ -205,8 +205,8 @@ fn set_destination_gas_configs( /// Transfers ownership. /// /// Accounts: -/// 0. `writeable` The token PDA account. -/// 1. `signer` The current owner. +/// 0. `[writeable]` The token PDA account. +/// 1. `[signer]` The current owner. fn transfer_ownership( program_id: &Pubkey, accounts: &[AccountInfo], @@ -218,7 +218,7 @@ fn transfer_ownership( /// Gets the interchain security module, returning it as a serialized Option. /// /// Accounts: -/// 0. `` The token PDA account. +/// 0. `[]` The token PDA account. fn interchain_security_module(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult { HyperlaneSealevelToken::::interchain_security_module(program_id, accounts) } @@ -234,8 +234,8 @@ fn interchain_security_module_account_metas(program_id: &Pubkey) -> ProgramResul /// Lets the owner set the interchain security module. /// /// Accounts: -/// 0. `writeable` The token PDA account. -/// 1. `signer` The access control owner. +/// 0. `[writeable]` The token PDA account. +/// 1. `[signer]` The access control owner. fn set_interchain_security_module( program_id: &Pubkey, accounts: &[AccountInfo], @@ -249,8 +249,8 @@ fn set_interchain_security_module( /// Lets the owner set the interchain gas paymaster. /// /// Accounts: -/// 0. `writeable` The token PDA account. -/// 1. `signer` The access control owner. +/// 0. `[writeable]` The token PDA account. +/// 1. `[signer]` The access control owner. fn set_interchain_gas_paymaster( program_id: &Pubkey, accounts: &[AccountInfo], diff --git a/rust/sealevel/programs/hyperlane-sealevel-token-native/tests/functional.rs b/rust/sealevel/programs/hyperlane-sealevel-token-native/tests/functional.rs index a32faa25fc..1863f5b14a 100644 --- a/rust/sealevel/programs/hyperlane-sealevel-token-native/tests/functional.rs +++ b/rust/sealevel/programs/hyperlane-sealevel-token-native/tests/functional.rs @@ -148,11 +148,11 @@ async fn initialize_hyperlane_token( .encode() .unwrap(), vec![ - // 0. `executable` The system program. - // 1. `writable` The token PDA account. - // 2. `writable` The dispatch authority PDA account. - // 3. `signer` The payer and mailbox payer. - // 4. `writable` The native collateral PDA account. + // 0. `[executable]` The system program. + // 1. `[writable]` The token PDA account. + // 2. `[writable]` The dispatch authority PDA account. + // 3. `[signer]` The payer and mailbox payer. + // 4. `[writable]` The native collateral PDA account. AccountMeta::new_readonly(solana_program::system_program::id(), false), AccountMeta::new(token_account_key, false), AccountMeta::new(dispatch_authority_key, false), @@ -416,24 +416,24 @@ async fn test_transfer_remote() { }) .encode() .unwrap(), - // 0. `executable` The system program. - // 1. `executable` The spl_noop program. - // 2. `` The token PDA account. - // 3. `executable` The mailbox program. - // 4. `writeable` The mailbox outbox account. - // 5. `` Message dispatch authority. - // 6. `signer` The token sender and mailbox payer. - // 7. `signer` Unique message / gas payment account. - // 8. `writeable` Message storage PDA. + // 0. `[executable]` The system program. + // 1. `[executable]` The spl_noop program. + // 2. `[]` The token PDA account. + // 3. `[executable]` The mailbox program. + // 4. `[writeable]` The mailbox outbox account. + // 5. `[]` Message dispatch authority. + // 6. `[signer]` The token sender and mailbox payer. + // 7. `[signer]` Unique message / gas payment account. + // 8. `[writeable]` Message storage PDA. // ---- If using an IGP ---- - // 9. `executable` The IGP program. - // 10. `writeable` The IGP program data. - // 11. `writeable` Gas payment PDA. - // 12. `` OPTIONAL - The Overhead IGP program, if the configured IGP is an Overhead IGP. - // 13. `writeable` The IGP account. + // 9. `[executable]` The IGP program. + // 10. `[writeable]` The IGP program data. + // 11. `[writeable]` Gas payment PDA. + // 12. `[]` OPTIONAL - The Overhead IGP program, if the configured IGP is an Overhead IGP. + // 13. `[writeable]` The IGP account. // ---- End if ---- - // 14. `executable` The system program. - // 15. `writeable` The native token collateral PDA account. + // 14. `[executable]` The system program. + // 15. `[writeable]` The native token collateral PDA account. vec![ AccountMeta::new_readonly(solana_program::system_program::id(), false), AccountMeta::new_readonly(spl_noop::id(), false), @@ -762,12 +762,12 @@ async fn test_transfer_from_remote_errors_if_process_authority_not_signer() { .unwrap(), vec![ // Recipient.handle accounts - // 0. `signer` Mailbox processor authority specific to this program. - // 1. `executable` system_program - // 2. `` hyperlane_token storage - // 3. `writeable` recipient wallet address - // 4. `executable` The system program. - // 5. `writeable` The native token collateral PDA account. + // 0. `[signer]` Mailbox processor authority specific to this program. + // 1. `[executable]` system_program + // 2. `[]` hyperlane_token storage + // 3. `[writeable]` recipient wallet address + // 4. `[executable]` The system program. + // 5. `[writeable]` The native token collateral PDA account. AccountMeta::new_readonly( hyperlane_token_accounts.mailbox_process_authority, false, diff --git a/rust/sealevel/programs/hyperlane-sealevel-token/src/instruction.rs b/rust/sealevel/programs/hyperlane-sealevel-token/src/instruction.rs index 46d4466a99..0bfab1f334 100644 --- a/rust/sealevel/programs/hyperlane-sealevel-token/src/instruction.rs +++ b/rust/sealevel/programs/hyperlane-sealevel-token/src/instruction.rs @@ -19,8 +19,8 @@ pub fn init_instruction( let mut instruction = lib_init_instruction(program_id, payer, init)?; // Add additional account metas: - // 0. `writable` The mint / mint authority PDA account. - // 1. `writable` The ATA payer PDA account. + // 0. `[writable]` The mint / mint authority PDA account. + // 1. `[writable]` The ATA payer PDA account. let (mint_key, _mint_bump) = Pubkey::find_program_address(hyperlane_token_mint_pda_seeds!(), &program_id); diff --git a/rust/sealevel/programs/hyperlane-sealevel-token/src/plugin.rs b/rust/sealevel/programs/hyperlane-sealevel-token/src/plugin.rs index d94fd921a5..c5029f9423 100644 --- a/rust/sealevel/programs/hyperlane-sealevel-token/src/plugin.rs +++ b/rust/sealevel/programs/hyperlane-sealevel-token/src/plugin.rs @@ -121,8 +121,8 @@ impl HyperlaneSealevelTokenPlugin for SyntheticPlugin { /// instruction initializing the mint with the SPL token 2022 program. /// /// Accounts: - /// 0. `writable` The mint / mint authority PDA account. - /// 1. `writable` The ATA payer PDA account. + /// 0. `[writable]` The mint / mint authority PDA account. + /// 1. `[writable]` The ATA payer PDA account. fn initialize<'a, 'b>( program_id: &Pubkey, system_program: &'a AccountInfo<'b>, @@ -187,9 +187,9 @@ impl HyperlaneSealevelTokenPlugin for SyntheticPlugin { /// Burns the tokens from the sender's associated token account. /// /// Accounts: - /// 0. `executable` The spl_token_2022 program. - /// 1. `writeable` The mint / mint authority PDA account. - /// 2. `writeable` The token sender's associated token account, from which tokens will be burned. + /// 0. `[executable]` The spl_token_2022 program. + /// 1. `[writeable]` The mint / mint authority PDA account. + /// 2. `[writeable]` The token sender's associated token account, from which tokens will be burned. fn transfer_in<'a, 'b>( program_id: &Pubkey, token: &HyperlaneToken, @@ -244,11 +244,11 @@ impl HyperlaneSealevelTokenPlugin for SyntheticPlugin { /// result of a transfer to this chain from a remote chain. /// /// Accounts: - /// 0. `executable` SPL token 2022 program - /// 1. `executable` SPL associated token account - /// 2. `writeable` Mint account - /// 3. `writeable` Recipient associated token account - /// 4. `writeable` ATA payer PDA account. + /// 0. `[executable]` SPL token 2022 program + /// 1. `[executable]` SPL associated token account + /// 2. `[writeable]` Mint account + /// 3. `[writeable]` Recipient associated token account + /// 4. `[writeable]` ATA payer PDA account. fn transfer_out<'a, 'b>( program_id: &Pubkey, token: &HyperlaneToken, diff --git a/rust/sealevel/programs/hyperlane-sealevel-token/src/processor.rs b/rust/sealevel/programs/hyperlane-sealevel-token/src/processor.rs index 6622bed9bc..f203a1e4e6 100644 --- a/rust/sealevel/programs/hyperlane-sealevel-token/src/processor.rs +++ b/rust/sealevel/programs/hyperlane-sealevel-token/src/processor.rs @@ -89,12 +89,12 @@ pub fn process_instruction( /// Initializes the program. /// /// Accounts: -/// 0. `executable` The system program. -/// 1. `writable` The token PDA account. -/// 2. `writable` The dispatch authority PDA account. -/// 3. `signer` The payer. -/// 4. `writable` The mint / mint authority PDA account. -/// 5. `writable` The ATA payer PDA account. +/// 0. `[executable]` The system program. +/// 1. `[writable]` The token PDA account. +/// 2. `[writable]` The dispatch authority PDA account. +/// 3. `[signer]` The payer. +/// 4. `[writable]` The mint / mint authority PDA account. +/// 5. `[writable]` The ATA payer PDA account. fn initialize(program_id: &Pubkey, accounts: &[AccountInfo], init: Init) -> ProgramResult { HyperlaneSealevelToken::::initialize(program_id, accounts, init) } @@ -104,26 +104,26 @@ fn initialize(program_id: &Pubkey, accounts: &[AccountInfo], init: Init) -> Prog /// then dispatches a message to the remote recipient. /// /// Accounts: -/// 0. `executable` The system program. -/// 1. `executable` The spl_noop program. -/// 2. `` The token PDA account. -/// 3. `executable` The mailbox program. -/// 4. `writeable` The mailbox outbox account. -/// 5. `` Message dispatch authority. -/// 6. `signer` The token sender and mailbox payer. -/// 7. `signer` Unique message / gas payment account. -/// 8. `writeable` Message storage PDA. +/// 0. `[executable]` The system program. +/// 1. `[executable]` The spl_noop program. +/// 2. `[]` The token PDA account. +/// 3. `[executable]` The mailbox program. +/// 4. `[writeable]` The mailbox outbox account. +/// 5. `[]` Message dispatch authority. +/// 6. `[signer]` The token sender and mailbox payer. +/// 7. `[signer]` Unique message / gas payment account. +/// 8. `[writeable]` Message storage PDA. /// ---- If using an IGP ---- -/// 9. `executable` The IGP program. -/// 10. `writeable` The IGP program data. -/// 11. `writeable` Gas payment PDA. -/// 12. `` OPTIONAL - The Overhead IGP program, if the configured IGP is an Overhead IGP. -/// 13. `writeable` The IGP account. +/// 9. `[executable]` The IGP program. +/// 10. `[writeable]` The IGP program data. +/// 11. `[writeable]` Gas payment PDA. +/// 12. `[]` OPTIONAL - The Overhead IGP program, if the configured IGP is an Overhead IGP. +/// 13. `[writeable]` The IGP account. /// ---- End if ---- -/// 14. `signer` The token sender. -/// 15. `executable` The spl_token_2022 program. -/// 16. `writeable` The mint / mint authority PDA account. -/// 17. `writeable` The token sender's associated token account, from which tokens will be burned. +/// 14. `[signer]` The token sender. +/// 15. `[executable]` The spl_token_2022 program. +/// 16. `[writeable]` The mint / mint authority PDA account. +/// 17. `[writeable]` The token sender's associated token account, from which tokens will be burned. fn transfer_remote( program_id: &Pubkey, accounts: &[AccountInfo], @@ -133,15 +133,15 @@ fn transfer_remote( } // Accounts: -// 0. `signer` Mailbox process authority specific to this program. -// 1. `executable` system_program -// 2. `` hyperlane_token storage -// 3. `` recipient wallet address -// 4. `executable` SPL token 2022 program -// 5. `executable` SPL associated token account -// 6. `writeable` Mint account -// 7. `writeable` Recipient associated token account -// 8. `writeable` ATA payer PDA account. +// 0. `[signer]` Mailbox process authority specific to this program. +// 1. `[executable]` system_program +// 2. `[]` hyperlane_token storage +// 3. `[]` recipient wallet address +// 4. `[executable]` SPL token 2022 program +// 5. `[executable]` SPL associated token account +// 6. `[writeable]` Mint account +// 7. `[writeable]` Recipient associated token account +// 8. `[writeable]` ATA payer PDA account. fn transfer_from_remote( program_id: &Pubkey, accounts: &[AccountInfo], @@ -164,9 +164,9 @@ fn transfer_from_remote_account_metas( /// Enrolls a remote router. /// /// Accounts: -/// 0. `executable` The system program. -/// 1. `writeable` The token PDA account. -/// 2. `signer` The owner. +/// 0. `[executable]` The system program. +/// 1. `[writeable]` The token PDA account. +/// 2. `[signer]` The owner. fn enroll_remote_router( program_id: &Pubkey, accounts: &[AccountInfo], @@ -178,9 +178,9 @@ fn enroll_remote_router( /// Enrolls remote routers. /// /// Accounts: -/// 0. `executable` The system program. -/// 1. `writeable` The token PDA account. -/// 2. `signer` The owner. +/// 0. `[executable]` The system program. +/// 1. `[writeable]` The token PDA account. +/// 2. `[signer]` The owner. fn enroll_remote_routers( program_id: &Pubkey, accounts: &[AccountInfo], @@ -192,9 +192,9 @@ fn enroll_remote_routers( /// Sets the destination gas configs. /// /// Accounts: -/// 0. `executable` The system program. -/// 1. `writeable` The token PDA account. -/// 2. `signer` The owner. +/// 0. `[executable]` The system program. +/// 1. `[writeable]` The token PDA account. +/// 2. `[signer]` The owner. fn set_destination_gas_configs( program_id: &Pubkey, accounts: &[AccountInfo], @@ -208,8 +208,8 @@ fn set_destination_gas_configs( /// Transfers ownership. /// /// Accounts: -/// 0. `writeable` The token PDA account. -/// 1. `signer` The current owner. +/// 0. `[writeable]` The token PDA account. +/// 1. `[signer]` The current owner. fn transfer_ownership( program_id: &Pubkey, accounts: &[AccountInfo], @@ -221,7 +221,7 @@ fn transfer_ownership( /// Gets the interchain security module, returning it as a serialized Option. /// /// Accounts: -/// 0. `` The token PDA account. +/// 0. `[]` The token PDA account. fn interchain_security_module(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult { HyperlaneSealevelToken::::interchain_security_module(program_id, accounts) } @@ -237,8 +237,8 @@ fn interchain_security_module_account_metas(program_id: &Pubkey) -> ProgramResul /// Lets the owner set the interchain security module. /// /// Accounts: -/// 0. `writeable` The token PDA account. -/// 1. `signer` The access control owner. +/// 0. `[writeable]` The token PDA account. +/// 1. `[signer]` The access control owner. fn set_interchain_security_module( program_id: &Pubkey, accounts: &[AccountInfo], @@ -252,8 +252,8 @@ fn set_interchain_security_module( /// Lets the owner set the interchain gas paymaster. /// /// Accounts: -/// 0. `writeable` The token PDA account. -/// 1. `signer` The access control owner. +/// 0. `[writeable]` The token PDA account. +/// 1. `[signer]` The access control owner. fn set_interchain_gas_paymaster( program_id: &Pubkey, accounts: &[AccountInfo], diff --git a/rust/sealevel/programs/hyperlane-sealevel-token/tests/functional.rs b/rust/sealevel/programs/hyperlane-sealevel-token/tests/functional.rs index b47d8a1bb3..73324efde2 100644 --- a/rust/sealevel/programs/hyperlane-sealevel-token/tests/functional.rs +++ b/rust/sealevel/programs/hyperlane-sealevel-token/tests/functional.rs @@ -165,12 +165,12 @@ async fn initialize_hyperlane_token( .encode() .unwrap(), vec![ - // 0. `executable` The system program. - // 1. `writable` The token PDA account. - // 2. `writable` The dispatch authority PDA account. - // 3. `signer` The payer. - // 4. `writable` The mint / mint authority PDA account. - // 5. `writable` The ATA payer PDA account. + // 0. `[executable]` The system program. + // 1. `[writable]` The token PDA account. + // 2. `[writable]` The dispatch authority PDA account. + // 3. `[signer]` The payer. + // 4. `[writable]` The mint / mint authority PDA account. + // 5. `[writable]` The ATA payer PDA account. AccountMeta::new_readonly(solana_program::system_program::id(), false), AccountMeta::new(token_account_key, false), AccountMeta::new(dispatch_authority_key, false), @@ -592,15 +592,15 @@ async fn test_transfer_from_remote_errors_if_process_authority_not_signer() { .unwrap(), vec![ // Recipient.handle accounts - // 0. `signer` Mailbox process authority specific to this program. - // 1. `executable` system_program - // 2. `` hyperlane_token storage - // 3. `` recipient wallet address - // 4. `executable` SPL token 2022 program - // 5. `executable` SPL associated token account - // 6. `writeable` Mint account - // 7. `writeable` Recipient associated token account - // 8. `writeable` ATA payer PDA account. + // 0. `[signer]` Mailbox process authority specific to this program. + // 1. `[executable]` system_program + // 2. `[]` hyperlane_token storage + // 3. `[]` recipient wallet address + // 4. `[executable]` SPL token 2022 program + // 5. `[executable]` SPL associated token account + // 6. `[writeable]` Mint account + // 7. `[writeable]` Recipient associated token account + // 8. `[writeable]` ATA payer PDA account. AccountMeta::new_readonly( hyperlane_token_accounts.mailbox_process_authority, false, @@ -710,25 +710,25 @@ async fn test_transfer_remote() { }) .encode() .unwrap(), - // 0. `executable` The system program. - // 1. `executable` The spl_noop program. - // 2. `` The token PDA account. - // 3. `executable` The mailbox program. - // 4. `writeable` The mailbox outbox account. - // 5. `` Message dispatch authority. - // 6. `signer` The token sender and mailbox payer. - // 7. `signer` Unique message account. - // 8. `writeable` Message storage PDA. + // 0. `[executable]` The system program. + // 1. `[executable]` The spl_noop program. + // 2. `[]` The token PDA account. + // 3. `[executable]` The mailbox program. + // 4. `[writeable]` The mailbox outbox account. + // 5. `[]` Message dispatch authority. + // 6. `[signer]` The token sender and mailbox payer. + // 7. `[signer]` Unique message account. + // 8. `[writeable]` Message storage PDA. // ---- If using an IGP ---- - // 9. `executable` The IGP program. - // 10. `writeable` The IGP program data. - // 11. `writeable` Gas payment PDA. - // 12. `` OPTIONAL - The Overhead IGP program, if the configured IGP is an Overhead IGP. - // 13. `writeable` The IGP account. + // 9. `[executable]` The IGP program. + // 10. `[writeable]` The IGP program data. + // 11. `[writeable]` Gas payment PDA. + // 12. `[]` OPTIONAL - The Overhead IGP program, if the configured IGP is an Overhead IGP. + // 13. `[writeable]` The IGP account. // ---- End if ---- - // 14. `executable` The spl_token_2022 program. - // 15. `writeable` The mint / mint authority PDA account. - // 16. `writeable` The token sender's associated token account, from which tokens will be burned. + // 14. `[executable]` The spl_token_2022 program. + // 15. `[writeable]` The mint / mint authority PDA account. + // 16. `[writeable]` The token sender's associated token account, from which tokens will be burned. vec![ AccountMeta::new_readonly(solana_program::system_program::id(), false), AccountMeta::new_readonly(spl_noop::id(), false), diff --git a/rust/sealevel/programs/ism/multisig-ism-message-id/src/instruction.rs b/rust/sealevel/programs/ism/multisig-ism-message-id/src/instruction.rs index b0851afb2b..7ddb9d0e44 100644 --- a/rust/sealevel/programs/ism/multisig-ism-message-id/src/instruction.rs +++ b/rust/sealevel/programs/ism/multisig-ism-message-id/src/instruction.rs @@ -17,17 +17,17 @@ pub enum Instruction { /// Initializes the program. /// /// Accounts: - /// 0. ``signer`` The new owner and payer of the access control PDA. - /// 1. ``writable`` The access control PDA account. - /// 2. ``executable`` The system program account. + /// 0. ``[signer]`` The new owner and payer of the access control PDA. + /// 1. ``[writable]`` The access control PDA account. + /// 2. ``[executable]`` The system program account. Initialize, /// Input: domain ID, validators, & threshold to set. /// /// Accounts: - /// 0. ``signer`` The access control owner and payer of the domain PDA. + /// 0. ``[signer]`` The access control owner and payer of the domain PDA. /// 1. `[]` The access control PDA account. - /// 2. ``writable`` The PDA relating to the provided domain. - /// 3. ``executable`` OPTIONAL - The system program account. Required if creating the domain PDA. + /// 2. ``[writable]`` The PDA relating to the provided domain. + /// 3. ``[executable]`` OPTIONAL - The system program account. Required if creating the domain PDA. SetValidatorsAndThreshold(Domained), /// Gets the owner from the access control data. /// @@ -37,7 +37,7 @@ pub enum Instruction { /// Sets the owner in the access control data. /// /// Accounts: - /// 0. ``signer`` The current access control owner. + /// 0. ``[signer]`` The current access control owner. /// 1. `[]` The access control PDA account. TransferOwnership(Option), } @@ -103,9 +103,9 @@ pub fn init_instruction( let ixn = Instruction::Initialize; // Accounts: - // 0. ``signer`` The new owner and payer of the access control PDA. - // 1. ``writable`` The access control PDA account. - // 2. ``executable`` The system program account. + // 0. ``[signer]`` The new owner and payer of the access control PDA. + // 1. ``[writable]`` The access control PDA account. + // 2. ``[executable]`` The system program account. let accounts = vec![ AccountMeta::new(payer, true), AccountMeta::new(access_control_pda_key, false), @@ -131,8 +131,8 @@ pub fn transfer_ownership_instruction( Pubkey::try_find_program_address(access_control_pda_seeds!(), &program_id) .ok_or(ProgramError::InvalidSeeds)?; - // 0. ``signer`` The current access control owner. - // 1. `[writeable]` The access control PDA account. + // 0. ``[signer]`` The current access control owner. + // 1. ``[writeable]`` The access control PDA account. let instruction = SolanaInstruction { program_id, data: Instruction::TransferOwnership(new_owner).encode()?, @@ -163,10 +163,10 @@ pub fn set_validators_and_threshold_instruction( }); // Accounts: - // 0. ``signer`` The access control owner and payer of the domain PDA. + // 0. ``[signer]`` The access control owner and payer of the domain PDA. // 1. `[]` The access control PDA account. - // 2. ``writable`` The PDA relating to the provided domain. - // 3. ``executable`` OPTIONAL - The system program account. Required if creating the domain PDA. + // 2. ``[writable]`` The PDA relating to the provided domain. + // 3. ``[executable]`` OPTIONAL - The system program account. Required if creating the domain PDA. let accounts = vec![ AccountMeta::new(owner_payer, true), AccountMeta::new_readonly(access_control_pda_key, false), diff --git a/rust/sealevel/programs/ism/multisig-ism-message-id/src/processor.rs b/rust/sealevel/programs/ism/multisig-ism-message-id/src/processor.rs index 68ce0b66e6..440a0329a8 100644 --- a/rust/sealevel/programs/ism/multisig-ism-message-id/src/processor.rs +++ b/rust/sealevel/programs/ism/multisig-ism-message-id/src/processor.rs @@ -171,9 +171,9 @@ pub fn process_instruction( /// Initializes the program, creating the access control PDA account. /// /// Accounts: -/// 0. ``signer`` The new owner and payer of the access control PDA. -/// 1. ``writable`` The access control PDA account. -/// 2. ``executable`` The system program account. +/// 0. ``[signer]`` The new owner and payer of the access control PDA. +/// 1. ``[writable]`` The access control PDA account. +/// 2. ``[executable]`` The system program account. fn initialize(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult { let accounts_iter = &mut accounts.iter(); @@ -356,10 +356,10 @@ fn validators_and_threshold( /// Set the validators and threshold for a given domain. /// /// Accounts: -/// 0. ``signer`` The access control owner and payer of the domain PDA. +/// 0. ``[signer]`` The access control owner and payer of the domain PDA. /// 1. `[]` The access control PDA account. -/// 2. ``writable`` The PDA relating to the provided domain. -/// 3. ``executable`` OPTIONAL - The system program account. Required if creating the domain PDA. +/// 2. ``[writable]`` The PDA relating to the provided domain. +/// 3. ``[executable]`` OPTIONAL - The system program account. Required if creating the domain PDA. fn set_validators_and_threshold( program_id: &Pubkey, accounts: &[AccountInfo], @@ -505,8 +505,8 @@ fn access_control_data( /// Transfers ownership to a new access control owner. /// /// Accounts: -/// 0. ``signer`` The current access control owner. -/// 1. `[writeable]` The access control PDA account. +/// 0. ``[signer]`` The current access control owner. +/// 1. ``[writeable]`` The access control PDA account. fn transfer_ownership( program_id: &Pubkey, accounts: &[AccountInfo], diff --git a/rust/sealevel/programs/ism/test-ism/src/program.rs b/rust/sealevel/programs/ism/test-ism/src/program.rs index 5269c19508..ef4914e650 100644 --- a/rust/sealevel/programs/ism/test-ism/src/program.rs +++ b/rust/sealevel/programs/ism/test-ism/src/program.rs @@ -101,9 +101,9 @@ pub fn process_instruction( /// Creates the storage PDA. /// /// Accounts: -/// 0. `executable` System program. -/// 1. `signer` Payer. -/// 2. `writeable` Storage PDA. +/// 0. `[executable]` System program. +/// 1. `[signer]` Payer. +/// 2. `[writeable]` Storage PDA. fn init(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult { let accounts_iter = &mut accounts.iter(); @@ -144,7 +144,7 @@ fn init(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult { } /// Accounts: -/// 0. `writeable` Storage PDA. +/// 0. `[writeable]` Storage PDA. fn set_accept(_program_id: &Pubkey, accounts: &[AccountInfo], accept: bool) -> ProgramResult { let accounts_iter = &mut accounts.iter(); @@ -160,7 +160,7 @@ fn set_accept(_program_id: &Pubkey, accounts: &[AccountInfo], accept: bool) -> P } /// Accounts: -/// 0. `` Storage PDA. +/// 0. `[]` Storage PDA. fn verify(_program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult { let accounts_iter = &mut accounts.iter(); diff --git a/rust/sealevel/programs/ism/test-ism/src/test_client.rs b/rust/sealevel/programs/ism/test-ism/src/test_client.rs index 4133247e70..d756dd41dc 100644 --- a/rust/sealevel/programs/ism/test-ism/src/test_client.rs +++ b/rust/sealevel/programs/ism/test-ism/src/test_client.rs @@ -38,9 +38,9 @@ impl TestIsmTestClient { program_id, data: TestIsmInstruction::Init.try_to_vec().unwrap(), accounts: vec![ - // 0. `executable` System program. - // 1. `signer` Payer. - // 2. `writeable` Storage PDA. + // 0. `[executable]` System program. + // 1. `[signer]` Payer. + // 2. `[writeable]` Storage PDA. AccountMeta::new_readonly(system_program::id(), false), AccountMeta::new(payer_pubkey, true), AccountMeta::new(Self::get_storage_pda_key(), false), @@ -66,7 +66,7 @@ impl TestIsmTestClient { program_id, data: TestIsmInstruction::SetAccept(accept).try_to_vec().unwrap(), accounts: vec![ - // 0. `writeable` Storage PDA. + // 0. `[writeable]` Storage PDA. AccountMeta::new(Self::get_storage_pda_key(), false), ], }; diff --git a/rust/sealevel/programs/mailbox-test/src/functional.rs b/rust/sealevel/programs/mailbox-test/src/functional.rs index f373f471e3..088dc7da74 100644 --- a/rust/sealevel/programs/mailbox-test/src/functional.rs +++ b/rust/sealevel/programs/mailbox-test/src/functional.rs @@ -411,13 +411,13 @@ async fn test_dispatch_returns_message_id() { .into_instruction_data() .unwrap(), accounts: vec![ - // 0. `writeable` Outbox PDA. - // 1. `signer` Message sender signer. - // 2. `executable` System program. - // 3. `executable` SPL Noop program. - // 4. `signer` Payer. - // 5. `signer` Unique message account. - // 6. `writeable` Dispatched message PDA. An empty message PDA relating to the seeds + // 0. `[writeable]` Outbox PDA. + // 1. `[signer]` Message sender signer. + // 2. `[executable]` System program. + // 3. `[executable]` SPL Noop program. + // 4. `[signer]` Payer. + // 5. `[signer]` Unique message account. + // 6. `[writeable]` Dispatched message PDA. An empty message PDA relating to the seeds // `mailbox_dispatched_message_pda_seeds` where the message contents will be stored. AccountMeta::new(mailbox_accounts.outbox, false), AccountMeta::new(payer.pubkey(), true), @@ -964,9 +964,9 @@ async fn test_inbox_set_default_ism() { .into_instruction_data() .unwrap(), accounts: vec![ - // 0. `writeable` - The Inbox PDA account. - // 1. `` - The Outbox PDA account. - // 2. `signer` - The owner of the Mailbox. + // 0. `[writeable]` - The Inbox PDA account. + // 1. `[]` - The Outbox PDA account. + // 2. `[signer]` - The owner of the Mailbox. AccountMeta::new(mailbox_accounts.inbox, false), AccountMeta::new_readonly(mailbox_accounts.outbox, false), AccountMeta::new(payer.pubkey(), true), @@ -1011,9 +1011,9 @@ async fn test_inbox_set_default_ism_errors_if_owner_not_signer() { .into_instruction_data() .unwrap(), accounts: vec![ - // 0. `writeable` - The Inbox PDA account. - // 1. `` - The Outbox PDA account. - // 2. `signer` - The owner of the Mailbox. + // 0. `[writeable]` - The Inbox PDA account. + // 1. `[]` - The Outbox PDA account. + // 2. `[signer]` - The owner of the Mailbox. AccountMeta::new(mailbox_accounts.inbox, false), AccountMeta::new_readonly(mailbox_accounts.outbox, false), AccountMeta::new_readonly(non_owner.pubkey(), true), @@ -1033,9 +1033,9 @@ async fn test_inbox_set_default_ism_errors_if_owner_not_signer() { .into_instruction_data() .unwrap(), accounts: vec![ - // 0. `writeable` - The Inbox PDA account. - // 1. `` - The Outbox PDA account. - // 2. `signer` - The owner of the Mailbox. + // 0. `[writeable]` - The Inbox PDA account. + // 1. `[]` - The Outbox PDA account. + // 2. `[signer]` - The owner of the Mailbox. AccountMeta::new(mailbox_accounts.inbox, false), AccountMeta::new_readonly(mailbox_accounts.outbox, false), AccountMeta::new_readonly(payer.pubkey(), false), diff --git a/rust/sealevel/programs/mailbox-test/src/utils.rs b/rust/sealevel/programs/mailbox-test/src/utils.rs index 9c44c325da..b4e2076668 100644 --- a/rust/sealevel/programs/mailbox-test/src/utils.rs +++ b/rust/sealevel/programs/mailbox-test/src/utils.rs @@ -42,13 +42,13 @@ pub async fn dispatch_from_payer( .into_instruction_data() .unwrap(), accounts: vec![ - // 0. `writeable` Outbox PDA. - // 1. `signer` Message sender signer. - // 2. `executable` System program. - // 3. `executable` SPL Noop program. - // 4. `signer` Payer. - // 5. `signer` Unique message account. - // 6. `writeable` Dispatched message PDA. An empty message PDA relating to the seeds + // 0. `[writeable]` Outbox PDA. + // 1. `[signer]` Message sender signer. + // 2. `[executable]` System program. + // 3. `[executable]` SPL Noop program. + // 4. `[signer]` Payer. + // 5. `[signer]` Unique message account. + // 6. `[writeable]` Dispatched message PDA. An empty message PDA relating to the seeds // `mailbox_dispatched_message_pda_seeds` where the message contents will be stored. AccountMeta::new(mailbox_accounts.outbox, false), AccountMeta::new(payer.pubkey(), true), diff --git a/rust/sealevel/programs/mailbox/src/instruction.rs b/rust/sealevel/programs/mailbox/src/instruction.rs index 2146dc7fca..075be83853 100644 --- a/rust/sealevel/programs/mailbox/src/instruction.rs +++ b/rust/sealevel/programs/mailbox/src/instruction.rs @@ -130,8 +130,8 @@ pub fn transfer_ownership_instruction( Pubkey::try_find_program_address(mailbox_outbox_pda_seeds!(), &program_id) .ok_or(ProgramError::InvalidSeeds)?; - // 0. `[writeable]` The Outbox PDA account. - // 1. ``signer`` The current owner. + // 0. ``[writeable]`` The Outbox PDA account. + // 1. ``[signer]`` The current owner. let instruction = SolanaInstruction { program_id, data: Instruction::TransferOwnership(new_owner).into_instruction_data()?, @@ -156,9 +156,9 @@ pub fn set_default_ism_instruction( Pubkey::try_find_program_address(mailbox_outbox_pda_seeds!(), &program_id) .ok_or(ProgramError::InvalidSeeds)?; - // 0. `writeable` - The Inbox PDA account. - // 1. `` - The Outbox PDA account. - // 2. `signer` - The owner of the Mailbox. + // 0. `[writeable]` - The Inbox PDA account. + // 1. `[]` - The Outbox PDA account. + // 2. `[signer]` - The owner of the Mailbox. let instruction = SolanaInstruction { program_id, data: Instruction::InboxSetDefaultIsm(default_ism).into_instruction_data()?, diff --git a/rust/sealevel/programs/mailbox/src/processor.rs b/rust/sealevel/programs/mailbox/src/processor.rs index 8b9af9e06a..3984d697a0 100644 --- a/rust/sealevel/programs/mailbox/src/processor.rs +++ b/rust/sealevel/programs/mailbox/src/processor.rs @@ -79,10 +79,10 @@ pub fn process_instruction( /// Initializes the Mailbox. /// /// Accounts: -/// 0. `executable` The system program. -/// 1. `signer, writable` The payer account and owner of the Mailbox. -/// 2. `writable` The inbox PDA account. -/// 3. `writable` The outbox PDA account. +/// 0. `[executable]` The system program. +/// 1. `[signer, writable]` The payer account and owner of the Mailbox. +/// 2. `[writable]` The inbox PDA account. +/// 3. `[writable]` The outbox PDA account. fn initialize(program_id: &Pubkey, accounts: &[AccountInfo], init: Init) -> ProgramResult { let accounts_iter = &mut accounts.iter(); @@ -164,17 +164,17 @@ fn initialize(program_id: &Pubkey, accounts: &[AccountInfo], init: Init) -> Prog /// Process a message. Non-reentrant through the use of a RefMut. /// // Accounts: -// 0. `signer` Payer account. This pays for the creation of the processed message PDA. -// 1. `executable` The system program. -// 2. `writable` Inbox PDA account. -// 3. `` Mailbox process authority specific to the message recipient. -// 4. `writable` Processed message PDA. -// 5..N `??` Accounts required to invoke the recipient's InterchainSecurityModule instruction. -// N+1. `executable` SPL noop -// N+2. `executable` ISM -// N+2..M. `??` Accounts required to invoke the ISM's Verify instruction. -// M+1. `executable` Recipient program. -// M+2..K. `??` Accounts required to invoke the recipient's Handle instruction. +// 0. `[signer]` Payer account. This pays for the creation of the processed message PDA. +// 1. `[executable]` The system program. +// 2. `[writable]` Inbox PDA account. +// 3. `[]` Mailbox process authority specific to the message recipient. +// 4. `[writable]` Processed message PDA. +// 5..N [??] Accounts required to invoke the recipient's InterchainSecurityModule instruction. +// N+1. `[executable]` SPL noop +// N+2. `[executable]` ISM +// N+2..M. [??] Accounts required to invoke the ISM's Verify instruction. +// M+1. `[executable]` Recipient program. +// M+2..K. [??] Accounts required to invoke the recipient's Handle instruction. fn inbox_process( program_id: &Pubkey, accounts: &[AccountInfo], @@ -414,9 +414,9 @@ fn inbox_process( /// Gets the ISM to use for a recipient program and sets it as return data. /// /// Accounts: -/// 0. `` - The Inbox PDA. -/// 1. `` - The recipient program. -/// 2..N. `??` - The accounts required to make the CPI into the recipient program. +/// 0. `[]` - The Inbox PDA. +/// 1. `[]` - The recipient program. +/// 2..N. [??] - The accounts required to make the CPI into the recipient program. /// These can be retrieved from the recipient using the /// `MessageRecipientInstruction::InterchainSecurityModuleAccountMetas` instruction. fn inbox_get_recipient_ism( @@ -505,9 +505,9 @@ fn get_recipient_ism( /// Sets the default ISM. /// /// Accounts: -/// 0. `writeable` - The Inbox PDA account. -/// 1. `` - The Outbox PDA account. -/// 2. `signer` - The owner of the Mailbox. +/// 0. `[writeable]` - The Inbox PDA account. +/// 1. `[]` - The Outbox PDA account. +/// 2. `[signer]` - The owner of the Mailbox. fn inbox_set_default_ism( program_id: &Pubkey, accounts: &[AccountInfo], @@ -549,13 +549,13 @@ fn inbox_set_default_ism( /// Sets the ID of the message as return data. /// /// Accounts: -/// 0. `writeable` Outbox PDA. -/// 1. `signer` Message sender signer. -/// 2. `executable` System program. -/// 3. `executable` SPL Noop program. -/// 4. `signer` Payer. -/// 5. `signer` Unique message account. -/// 6. `writeable` Dispatched message PDA. An empty message PDA relating to the seeds +/// 0. `[writeable]` Outbox PDA. +/// 1. `[signer]` Message sender signer. +/// 2. `[executable]` System program. +/// 3. `[executable]` SPL Noop program. +/// 4. `[signer]` Payer. +/// 5. `[signer]` Unique message account. +/// 6. `[writeable]` Dispatched message PDA. An empty message PDA relating to the seeds /// `mailbox_dispatched_message_pda_seeds` where the message contents will be stored. fn outbox_dispatch( program_id: &Pubkey, @@ -712,7 +712,7 @@ fn outbox_dispatch( /// Gets the number of dispatched messages as little endian encoded return data. /// /// Accounts: -/// 0. `` Outbox PDA account. +/// 0. `[]` Outbox PDA account. fn outbox_get_count(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult { let accounts_iter = &mut accounts.iter(); @@ -743,7 +743,7 @@ fn outbox_get_count(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramRes /// Gets the latest checkpoint as return data. /// /// Accounts: -/// 0. `` Outbox PDA account. +/// 0. `[]` Outbox PDA account. fn outbox_get_latest_checkpoint(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult { let accounts_iter = &mut accounts.iter(); @@ -779,7 +779,7 @@ fn outbox_get_latest_checkpoint(program_id: &Pubkey, accounts: &[AccountInfo]) - /// Gets the root as return data. /// /// Accounts: -/// 0. `` Outbox PDA account. +/// 0. `[]` Outbox PDA account. fn outbox_get_root(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult { let accounts_iter = &mut accounts.iter(); @@ -829,8 +829,8 @@ fn get_owner(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult { /// Transfers ownership. /// /// Accounts: -/// 0. `[writeable]` The Outbox PDA account. -/// 1. ``signer`` The current owner. +/// 0. ``[writeable]`` The Outbox PDA account. +/// 1. ``[signer]`` The current owner. fn transfer_ownership( program_id: &Pubkey, accounts: &[AccountInfo], diff --git a/rust/sealevel/programs/test-send-receiver/src/program.rs b/rust/sealevel/programs/test-send-receiver/src/program.rs index a7f216d0ec..46884ea400 100644 --- a/rust/sealevel/programs/test-send-receiver/src/program.rs +++ b/rust/sealevel/programs/test-send-receiver/src/program.rs @@ -161,9 +161,9 @@ pub fn process_instruction( /// Creates the storage PDA. /// /// Accounts: -/// 0. `executable` System program. -/// 1. `signer` Payer. -/// 2. `writeable` Storage PDA. +/// 0. `[executable]` System program. +/// 1. `[signer]` Payer. +/// 2. `[writeable]` Storage PDA. fn init(program_id: &Pubkey, accounts: &[AccountInfo], mailbox: Pubkey) -> ProgramResult { let accounts_iter = &mut accounts.iter(); @@ -211,15 +211,15 @@ fn init(program_id: &Pubkey, accounts: &[AccountInfo], mailbox: Pubkey) -> Progr /// Dispatches a message using the dispatch authority. /// /// Accounts: -/// 0. `executable` The Mailbox program. +/// 0. `[executable]` The Mailbox program. /// And now the accounts expected by the Mailbox's OutboxDispatch instruction: -/// 2. `writeable` Outbox PDA. -/// 3. `` This program's dispatch authority. -/// 4. `executable` System program. -/// 5. `executable` SPL Noop program. -/// 6. `signer` Payer. -/// 7. `signer` Unique message account. -/// 8. `writeable` Dispatched message PDA. An empty message PDA relating to the seeds +/// 2. `[writeable]` Outbox PDA. +/// 3. `[]` This program's dispatch authority. +/// 4. `[executable]` System program. +/// 5. `[executable]` SPL Noop program. +/// 6. `[signer]` Payer. +/// 7. `[signer]` Unique message account. +/// 8. `[writeable]` Dispatched message PDA. An empty message PDA relating to the seeds /// `mailbox_dispatched_message_pda_seeds` where the message contents will be stored. fn dispatch( program_id: &Pubkey, @@ -291,8 +291,8 @@ fn dispatch( /// Handles a message. /// /// Accounts: -/// 0. `writeable` Process authority specific to this program. -/// 1. `` Storage PDA account. +/// 0. `[writeable]` Process authority specific to this program. +/// 1. `[]` Storage PDA account. pub fn handle( program_id: &Pubkey, accounts: &[AccountInfo], @@ -367,7 +367,7 @@ pub fn handle( } /// Accounts: -/// 0. `writeable` Storage PDA account. +/// 0. `[writeable]` Storage PDA account. fn set_interchain_security_module( _program_id: &Pubkey, accounts: &[AccountInfo], @@ -392,7 +392,7 @@ fn set_interchain_security_module( } /// Accounts: -/// 0. `` Storage PDA account. +/// 0. `[]` Storage PDA account. fn get_interchain_security_module(_program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult { let accounts_iter = &mut accounts.iter(); @@ -424,7 +424,7 @@ fn get_interchain_security_module(_program_id: &Pubkey, accounts: &[AccountInfo] } /// Accounts: -/// 0. `writeable` Storage PDA account. +/// 0. `[writeable]` Storage PDA account. fn set_handle_mode( _program_id: &Pubkey, accounts: &[AccountInfo], diff --git a/rust/sealevel/programs/test-send-receiver/src/test_client.rs b/rust/sealevel/programs/test-send-receiver/src/test_client.rs index 34e70d35d0..2f1539d9fe 100644 --- a/rust/sealevel/programs/test-send-receiver/src/test_client.rs +++ b/rust/sealevel/programs/test-send-receiver/src/test_client.rs @@ -48,9 +48,9 @@ impl TestSendReceiverTestClient { .try_to_vec() .unwrap(), accounts: vec![ - // 0. `executable` System program. - // 1. `signer` Payer. - // 2. `writeable` Storage PDA. + // 0. `[executable]` System program. + // 1. `[signer]` Payer. + // 2. `[writeable]` Storage PDA. AccountMeta::new_readonly(system_program::id(), false), AccountMeta::new(payer_pubkey, true), AccountMeta::new(Self::get_storage_pda_key(), false), @@ -85,7 +85,7 @@ impl TestSendReceiverTestClient { .try_to_vec() .unwrap(), accounts: vec![ - // 0. `writeable` Storage PDA. + // 0. `[writeable]` Storage PDA. AccountMeta::new(Self::get_storage_pda_key(), false), ], }; @@ -114,7 +114,7 @@ impl TestSendReceiverTestClient { .try_to_vec() .unwrap(), accounts: vec![ - // 0. `writeable` Storage PDA. + // 0. `[writeable]` Storage PDA. AccountMeta::new(storage_pda_key, false), ], }; @@ -155,15 +155,15 @@ impl TestSendReceiverTestClient { .try_to_vec() .unwrap(), accounts: vec![ - // 0. `executable` The Mailbox program. + // 0. `[executable]` The Mailbox program. // And now the accounts expected by the Mailbox's OutboxDispatch instruction: - // 1. `writeable` Outbox PDA. - // 2. `` This program's dispatch authority. - // 3. `executable` System program. - // 4. `executable` SPL Noop program. - // 5. `signer` Payer. - // 6. `signer` Unique message account. - // 7. `writeable` Dispatched message PDA. An empty message PDA relating to the seeds + // 1. `[writeable]` Outbox PDA. + // 2. `[]` This program's dispatch authority. + // 3. `[executable]` System program. + // 4. `[executable]` SPL Noop program. + // 5. `[signer]` Payer. + // 6. `[signer]` Unique message account. + // 7. `[writeable]` Dispatched message PDA. An empty message PDA relating to the seeds // `mailbox_dispatched_message_pda_seeds` where the message contents will be stored. AccountMeta::new_readonly(mailbox_accounts.program, false), AccountMeta::new(mailbox_accounts.outbox, false), diff --git a/rust/sealevel/programs/validator-announce/src/instruction.rs b/rust/sealevel/programs/validator-announce/src/instruction.rs index 34f1c06d49..a94898fe3d 100644 --- a/rust/sealevel/programs/validator-announce/src/instruction.rs +++ b/rust/sealevel/programs/validator-announce/src/instruction.rs @@ -80,9 +80,9 @@ pub fn init_instruction( }); // Accounts: - // 0. `signer` The payer. - // 1. `executable` The system program. - // 2. `writable` The ValidatorAnnounce PDA account. + // 0. `[signer]` The payer. + // 1. `[executable]` The system program. + // 2. `[writable]` The ValidatorAnnounce PDA account. let accounts = vec![ AccountMeta::new_readonly(payer, true), AccountMeta::new_readonly(solana_program::system_program::id(), false), diff --git a/rust/sealevel/programs/validator-announce/src/processor.rs b/rust/sealevel/programs/validator-announce/src/processor.rs index bebd7d2c39..409dc29e78 100644 --- a/rust/sealevel/programs/validator-announce/src/processor.rs +++ b/rust/sealevel/programs/validator-announce/src/processor.rs @@ -49,9 +49,9 @@ pub fn process_instruction( /// Initializes the program. /// /// Accounts: -/// 0. `signer` The payer. -/// 1. `executable` The system program. -/// 2. `writable` The ValidatorAnnounce PDA account. +/// 0. `[signer]` The payer. +/// 1. `[executable]` The system program. +/// 2. `[writable]` The ValidatorAnnounce PDA account. pub fn process_init( program_id: &Pubkey, accounts: &[AccountInfo], @@ -115,11 +115,11 @@ pub fn process_init( /// Announces a validator. /// /// Accounts: -/// 0. `signer` The payer. -/// 1. `executable` The system program. -/// 2. `` The ValidatorAnnounce PDA account. -/// 3. `writeable` The validator-specific ValidatorStorageLocationsAccount PDA account. -/// 4. `writeable` The ReplayProtection PDA account specific to the announcement being made. +/// 0. `[signer]` The payer. +/// 1. `[executable]` The system program. +/// 2. `[]` The ValidatorAnnounce PDA account. +/// 3. `[writeable]` The validator-specific ValidatorStorageLocationsAccount PDA account. +/// 4. `[writeable]` The ReplayProtection PDA account specific to the announcement being made. fn process_announce( program_id: &Pubkey, accounts: &[AccountInfo], diff --git a/rust/sealevel/programs/validator-announce/tests/functional.rs b/rust/sealevel/programs/validator-announce/tests/functional.rs index 00a3f4f948..cf1b5f0f55 100644 --- a/rust/sealevel/programs/validator-announce/tests/functional.rs +++ b/rust/sealevel/programs/validator-announce/tests/functional.rs @@ -88,9 +88,9 @@ async fn initialize( Pubkey::find_program_address(validator_announce_pda_seeds!(), &program_id); // Accounts: - // 0. `signer` The payer. - // 1. `executable` The system program. - // 2. `writable` The ValidatorAnnounce PDA account. + // 0. `[signer]` The payer. + // 1. `[executable]` The system program. + // 2. `[writable]` The ValidatorAnnounce PDA account. let init_instruction = Instruction::new_with_borsh( program_id, &ValidatorAnnounceInstruction::Init(InitInstruction { @@ -194,11 +194,11 @@ async fn announce( Pubkey::find_program_address(replay_protection_pda_seeds!(replay_id), &program_id); // Accounts: - // 0. `signer` The payer. - // 1. `executable` The system program. - // 2. `` The ValidatorAnnounce PDA account. - // 3. `writeable` The validator-specific ValidatorStorageLocationsAccount PDA account. - // 4. `writeable` The ReplayProtection PDA account specific to the announcement being made. + // 0. `[signer]` The payer. + // 1. `[executable]` The system program. + // 2. `[]` The ValidatorAnnounce PDA account. + // 3. `[writeable]` The validator-specific ValidatorStorageLocationsAccount PDA account. + // 4. `[writeable]` The ReplayProtection PDA account specific to the announcement being made. let announce_instruction = Instruction::new_with_borsh( program_id, &ValidatorAnnounceInstruction::Announce(announce_instruction),