Daniel Savu 11 months ago committed by GitHub
parent 1f651b7afc
commit 8e44bc1b81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .github/workflows/test.yml
  2. 658
      rust/Cargo.lock
  3. 3
      rust/Cargo.toml
  4. 2
      rust/agents/scraper/src/db/message.rs
  5. 2
      rust/chains/hyperlane-cosmos/Cargo.toml
  6. 2
      rust/chains/hyperlane-cosmos/src/libs/address.rs
  7. 2
      rust/chains/hyperlane-cosmos/src/providers/grpc.rs
  8. 2
      rust/chains/hyperlane-ethereum/tests/signer_output.rs
  9. 2
      rust/chains/hyperlane-sealevel/src/mailbox.rs
  10. 27
      rust/chains/hyperlane-sealevel/src/merkle_tree_hook.rs
  11. 13
      rust/config/test-sealevel-keys/test_deployer-account.json
  12. 1
      rust/config/test-sealevel-keys/test_deployer-keypair.json
  13. 48
      rust/config/test_sealevel_config.json
  14. 2
      rust/hyperlane-base/src/db/rocks/test_utils.rs
  15. 16
      rust/hyperlane-base/src/settings/chains.rs
  16. 3
      rust/hyperlane-base/src/settings/mod.rs
  17. 1
      rust/hyperlane-core/src/metrics/agent.rs
  18. 17
      rust/hyperlane-core/src/types/message.rs
  19. 2
      rust/hyperlane-core/src/types/mod.rs
  20. 58
      rust/sealevel/client/src/main.rs
  21. 2
      rust/sealevel/client/src/serde.rs
  22. 2
      rust/sealevel/libraries/account-utils/src/lib.rs
  23. 34
      rust/sealevel/libraries/hyperlane-sealevel-token/src/instruction.rs
  24. 96
      rust/sealevel/libraries/hyperlane-sealevel-token/src/processor.rs
  25. 2
      rust/sealevel/libraries/serializable-account-meta/src/lib.rs
  26. 18
      rust/sealevel/libraries/test-utils/src/igp.rs
  27. 16
      rust/sealevel/programs/helloworld/src/instruction.rs
  28. 64
      rust/sealevel/programs/helloworld/src/processor.rs
  29. 74
      rust/sealevel/programs/hyperlane-sealevel-igp-test/src/functional.rs
  30. 48
      rust/sealevel/programs/hyperlane-sealevel-igp/src/instruction.rs
  31. 68
      rust/sealevel/programs/hyperlane-sealevel-igp/src/processor.rs
  32. 10
      rust/sealevel/programs/hyperlane-sealevel-token-collateral/src/instruction.rs
  33. 30
      rust/sealevel/programs/hyperlane-sealevel-token-collateral/src/plugin.rs
  34. 106
      rust/sealevel/programs/hyperlane-sealevel-token-collateral/src/processor.rs
  35. 74
      rust/sealevel/programs/hyperlane-sealevel-token-collateral/tests/functional.rs
  36. 2
      rust/sealevel/programs/hyperlane-sealevel-token-native/src/instruction.rs
  37. 10
      rust/sealevel/programs/hyperlane-sealevel-token-native/src/plugin.rs
  38. 86
      rust/sealevel/programs/hyperlane-sealevel-token-native/src/processor.rs
  39. 54
      rust/sealevel/programs/hyperlane-sealevel-token-native/tests/functional.rs
  40. 4
      rust/sealevel/programs/hyperlane-sealevel-token/src/instruction.rs
  41. 20
      rust/sealevel/programs/hyperlane-sealevel-token/src/plugin.rs
  42. 98
      rust/sealevel/programs/hyperlane-sealevel-token/src/processor.rs
  43. 64
      rust/sealevel/programs/hyperlane-sealevel-token/tests/functional.rs
  44. 10
      rust/sealevel/programs/ism/test-ism/src/program.rs
  45. 8
      rust/sealevel/programs/ism/test-ism/src/test_client.rs
  46. 32
      rust/sealevel/programs/mailbox-test/src/functional.rs
  47. 14
      rust/sealevel/programs/mailbox-test/src/utils.rs
  48. 6
      rust/sealevel/programs/mailbox/src/instruction.rs
  49. 54
      rust/sealevel/programs/mailbox/src/processor.rs
  50. 34
      rust/sealevel/programs/test-send-receiver/src/program.rs
  51. 26
      rust/sealevel/programs/test-send-receiver/src/test_client.rs
  52. 6
      rust/sealevel/programs/validator-announce/src/instruction.rs
  53. 16
      rust/sealevel/programs/validator-announce/src/processor.rs
  54. 16
      rust/sealevel/programs/validator-announce/tests/functional.rs
  55. 4
      rust/utils/run-locally/Cargo.toml
  56. 2
      rust/utils/run-locally/src/cosmos/mod.rs
  57. 18
      rust/utils/run-locally/src/invariants.rs
  58. 78
      rust/utils/run-locally/src/main.rs
  59. 17
      rust/utils/run-locally/src/solana.rs

@ -219,7 +219,7 @@ jobs:
working-directory: ./rust
- name: agent tests with CosmWasm
run: RUST_BACKTRACE=1 cargo test --package run-locally --bin run-locally -- cosmos::test --nocapture
run: RUST_BACKTRACE=1 cargo test --package run-locally --bin run-locally --features cosmos -- cosmos::test --nocapture
working-directory: ./rust
- name: agent tests excluding CosmWasm

658
rust/Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -77,7 +77,7 @@ derive_builder = "0.12"
derive_more = "0.99"
ed25519-dalek = "~1.0"
enum_dispatch = "0.3"
eyre = "0.6"
eyre = "=0.6.8"
fixed-hash = "0.8.0"
fuels = "0.38"
fuels-code-gen = "0.38"
@ -93,6 +93,7 @@ hpl-interface = "=0.0.6-rc3"
hyper = "0.14"
hyper-tls = "0.5.0"
itertools = "0.11.0"
jobserver = "=0.1.26"
jsonrpc-core = "18.0"
k256 = { version = "0.13.1", features = ["std", "ecdsa"] }
log = "0.4"

@ -79,7 +79,7 @@ impl ScraperDb {
{
Ok(Some(HyperlaneMessage {
// We do not write version to the DB.
version: 0,
version: 3,
origin: message.origin as u32,
destination: message.destination as u32,
nonce: message.nonce as u32,

@ -1,3 +1,5 @@
cargo-features = ["workspace-inheritance"]
[package]
name = "hyperlane-cosmos"
documentation = { workspace = true }

@ -22,7 +22,7 @@ pub struct CosmosAddress {
impl CosmosAddress {
/// Returns a Bitcoin style address: RIPEMD160(SHA256(pubkey))
/// Source: https://github.com/cosmos/cosmos-sdk/blob/177e7f45959215b0b4e85babb7c8264eaceae052/crypto/keys/secp256k1/secp256k1.go#L154
/// Source: `<https://github.com/cosmos/cosmos-sdk/blob/177e7f45959215b0b4e85babb7c8264eaceae052/crypto/keys/secp256k1/secp256k1.go#L154>`
pub fn from_pubkey(pubkey: PublicKey, prefix: &str) -> ChainResult<Self> {
// Get the inner type
let tendermint_pubkey = TendermintPublicKey::from(pubkey);

@ -89,7 +89,7 @@ pub struct WasmGrpcProvider {
/// Signer for transactions.
signer: Option<Signer>,
/// GRPC Channel that can be cheaply cloned.
/// See https://docs.rs/tonic/latest/tonic/transport/struct.Channel.html#multiplexing-requests
/// See `<https://docs.rs/tonic/latest/tonic/transport/struct.Channel.html#multiplexing-requests>`
channel: Channel,
}

@ -22,7 +22,7 @@ use hyperlane_core::{
pub fn output_message() {
let hyperlane_message = HyperlaneMessage {
nonce: 0,
version: 0,
version: 3,
origin: 1000,
sender: H256::from(H160::from_str("0x1111111111111111111111111111111111111111").unwrap()),
destination: 2000,

@ -633,7 +633,7 @@ impl SealevelMailboxIndexer {
impl SequenceIndexer<HyperlaneMessage> for SealevelMailboxIndexer {
#[instrument(err, skip(self))]
async fn sequence_and_tip(&self) -> ChainResult<(Option<u32>, u32)> {
let tip = Indexer::<HyperlaneMessage>::get_finalized_block_number(self as _).await?;
let tip = Indexer::<HyperlaneMessage>::get_finalized_block_number(self).await?;
// TODO: need to make sure the call and tip are at the same height?
let count = Mailbox::count(&self.mailbox, None).await?;
Ok((Some(count), tip))

@ -4,13 +4,14 @@ use async_trait::async_trait;
use derive_new::new;
use hyperlane_core::{
accumulator::incremental::IncrementalMerkle, ChainCommunicationError, ChainResult, Checkpoint,
HyperlaneChain, Indexer, LogMeta, MerkleTreeHook, MerkleTreeInsertion, SequenceIndexer,
HyperlaneChain, HyperlaneMessage, Indexer, LogMeta, MerkleTreeHook, MerkleTreeInsertion,
SequenceIndexer,
};
use hyperlane_sealevel_mailbox::accounts::OutboxAccount;
use solana_sdk::commitment_config::CommitmentConfig;
use tracing::instrument;
use crate::SealevelMailbox;
use crate::{SealevelMailbox, SealevelMailboxIndexer};
#[async_trait]
impl MerkleTreeHook for SealevelMailbox {
@ -76,26 +77,38 @@ impl MerkleTreeHook for SealevelMailbox {
}
/// Struct that retrieves event data for a Sealevel merkle tree hook contract
/// For now it's just a wrapper around the SealevelMailboxIndexer
#[derive(Debug, new)]
pub struct SealevelMerkleTreeHookIndexer {}
pub struct SealevelMerkleTreeHookIndexer(SealevelMailboxIndexer);
#[async_trait]
impl Indexer<MerkleTreeInsertion> for SealevelMerkleTreeHookIndexer {
async fn fetch_logs(
&self,
_range: RangeInclusive<u32>,
range: RangeInclusive<u32>,
) -> ChainResult<Vec<(MerkleTreeInsertion, LogMeta)>> {
Ok(vec![])
let messages = Indexer::<HyperlaneMessage>::fetch_logs(&self.0, range).await?;
let merkle_tree_insertions = messages
.into_iter()
.map(|(m, meta)| (message_to_merkle_tree_insertion(&m), meta))
.collect();
Ok(merkle_tree_insertions)
}
async fn get_finalized_block_number(&self) -> ChainResult<u32> {
Ok(0)
Indexer::<HyperlaneMessage>::get_finalized_block_number(&self.0).await
}
}
#[async_trait]
impl SequenceIndexer<MerkleTreeInsertion> for SealevelMerkleTreeHookIndexer {
async fn sequence_and_tip(&self) -> ChainResult<(Option<u32>, u32)> {
Ok((None, 0))
SequenceIndexer::<HyperlaneMessage>::sequence_and_tip(&self.0).await
}
}
fn message_to_merkle_tree_insertion(message: &HyperlaneMessage) -> MerkleTreeInsertion {
let leaf_index = message.nonce;
let message_id = message.id();
MerkleTreeInsertion::new(leaf_index, message_id)
}

@ -0,0 +1,13 @@
{
"pubkey": "E9VrvAdGRvCguN2XgXsgu9PNmMM3vZsU8LSUrM68j8ty",
"account": {
"lamports": 500000000000000000,
"data": [
"",
"base64"
],
"owner": "11111111111111111111111111111111",
"executable": false,
"rentEpoch": 0
}
}

@ -0,0 +1 @@
[137,43,246,148,154,244,35,62,98,248,84,203,54,24,188,26,62,227,52,29,199,26,218,8,196,213,222,202,35,154,207,79,195,85,53,151,7,182,83,94,59,5,131,252,40,75,87,11,243,118,71,59,195,222,212,148,179,233,253,121,97,210,114,98]

@ -0,0 +1,48 @@
{
"chains": {
"sealeveltest1": {
"name": "sealeveltest1",
"chainId": 13375,
"domainId": 13375,
"mailbox": "692KZJaoe2KRcD6uhCQDLLXnLNA5ZLnfvdqjE4aX9iu1",
"interchainGasPaymaster": "DrFtxirPPsfdY4HQiNZj2A9o4Ux7JaL3gELANgAoihhp",
"validatorAnnounce": "DH43ae1LwemXAboWwSh8zc9pG8j72gKUEXNi57w8fEnn",
"protocol": "sealevel",
"blocks": {
"reorgPeriod": 0,
"confirmations": 0
},
"rpcUrls": [
{
"http": "http://localhost:8899"
}
],
"index": {
"from": 1,
"mode": "sequence"
}
},
"sealeveltest2": {
"name": "sealeveltest2",
"chainId": 13376,
"domainId": 13376,
"mailbox": "9tCUWNjpqcf3NUSrtp7vquYVCwbEByvLjZUrhG5dgvhj",
"interchainGasPaymaster": "G5rGigZBL8NmxCaukK2CAKr9Jq4SUfAhsjzeri7GUraK",
"validatorAnnounce": "3Uo5j2Bti9aZtrDqJmAyuwiFaJFPFoNL5yxTpVCNcUhb",
"protocol": "sealevel",
"blocks": {
"reorgPeriod": 0,
"confirmations": 0
},
"rpcUrls": [
{
"http": "http://localhost:8899"
}
],
"index": {
"from": 1,
"mode": "sequence"
}
}
}
}

@ -49,7 +49,7 @@ mod test {
let m = HyperlaneMessage {
nonce: 100,
version: 0,
version: 3,
origin: 10,
sender: H256::from_low_u64_be(4),
destination: 12,

@ -111,16 +111,18 @@ impl ChainConf {
metrics: &CoreMetrics,
) -> Result<Box<dyn HyperlaneProvider>> {
let ctx = "Building provider";
let locator = self.locator(H256::zero());
match &self.connection {
ChainConnectionConf::Ethereum(conf) => {
let locator = self.locator(H256::zero());
self.build_ethereum(conf, &locator, metrics, h_eth::HyperlaneProviderBuilder {})
.await
}
ChainConnectionConf::Fuel(_) => todo!(),
ChainConnectionConf::Sealevel(_) => todo!(),
ChainConnectionConf::Sealevel(conf) => Ok(Box::new(h_sealevel::SealevelProvider::new(
locator.domain.clone(),
conf,
)) as Box<dyn HyperlaneProvider>),
ChainConnectionConf::Cosmos(conf) => {
let locator = self.locator(H256::zero());
let provider = CosmosProvider::new(
locator.domain.clone(),
conf.clone(),
@ -385,8 +387,12 @@ impl ChainConf {
.await
}
ChainConnectionConf::Fuel(_) => todo!(),
ChainConnectionConf::Sealevel(_) => {
let indexer = Box::new(h_sealevel::SealevelMerkleTreeHookIndexer::new());
ChainConnectionConf::Sealevel(conf) => {
let mailbox_indexer =
Box::new(h_sealevel::SealevelMailboxIndexer::new(conf, locator)?);
let indexer = Box::new(h_sealevel::SealevelMerkleTreeHookIndexer::new(
*mailbox_indexer,
));
Ok(indexer as Box<dyn SequenceIndexer<MerkleTreeInsertion>>)
}
ChainConnectionConf::Cosmos(conf) => {

@ -14,8 +14,7 @@
//! each configured chain.
//!
//! All agents share the [`Settings`] struct in this crate, and then define any
//! additional `Settings` in their own crate. By convention this is done in
//! `settings.rs` using the [`decl_settings!`] macro.
//! additional `Settings` in their own crate.
//!
//! ### Configuration
//!

@ -1,6 +1,7 @@
use crate::HyperlaneDomainProtocol;
use std::time::Duration;
#[cfg(feature = "float")]
use crate::U256;
const ETHEREUM_DECIMALS: u8 = 18;

@ -21,7 +21,7 @@ impl From<&HyperlaneMessage> for RawHyperlaneMessage {
}
/// A full Hyperlane message between chains
#[derive(Default, Clone, Eq, PartialEq)]
#[derive(Clone, Eq, PartialEq)]
pub struct HyperlaneMessage {
/// 1 Hyperlane version number
pub version: u8,
@ -39,6 +39,21 @@ pub struct HyperlaneMessage {
pub body: Vec<u8>,
}
impl Default for HyperlaneMessage {
fn default() -> Self {
Self {
// Use version 3 now that Hyperlane V3 is the default
version: 3,
nonce: 0,
origin: 0,
sender: H256::zero(),
destination: 0,
recipient: H256::zero(),
body: vec![],
}
}
}
impl Sequenced for HyperlaneMessage {
fn sequence(&self) -> u32 {
self.nonce

@ -230,7 +230,7 @@ pub struct TxCostEstimate {
/// covering L1 costs and the L2 gas limit.
/// Only present for Arbitrum Nitro chains, where the gas amount
/// is used to cover L1 and L2 costs. For details:
/// https://medium.com/offchainlabs/understanding-arbitrum-2-dimensional-fees-fd1d582596c9
/// `<https://medium.com/offchainlabs/understanding-arbitrum-2-dimensional-fees-fd1d582596c9>`
pub l2_gas_limit: Option<U256>,
}

@ -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::<CollateralPlugin>::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),

@ -24,7 +24,7 @@ pub(crate) mod serde_pubkey {
}
}
/// For serializing and deserializing Option<Pubkey>
/// For serializing and deserializing `Option<Pubkey>`
pub(crate) mod serde_option_pubkey {
use borsh::BorshDeserialize;
use serde::{Deserialize, Deserializer, Serializer};

@ -193,7 +193,7 @@ where
/// Creates associated token account using Program Derived Address for the given seeds.
/// Required to allow PDAs to be created even if they already have a lamport balance.
///
/// Borrowed from https://github.com/solana-labs/solana-program-library/blob/cf77ed0c187d1becd0db56edff4491c28f18dfc8/associated-token-account/program/src/tools/account.rs#L18
/// Borrowed from `<https://github.com/solana-labs/solana-program-library/blob/cf77ed0c187d1becd0db56edff4491c28f18dfc8/associated-token-account/program/src/tools/account.rs#L18>`
pub fn create_pda_account<'a>(
payer: &AccountInfo<'a>,
rent: &Rent,

@ -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),

@ -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
/// 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.
/// 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],

@ -29,7 +29,7 @@ impl From<SerializableAccountMeta> for AccountMeta {
}
}
/// A ridiculous workaround for https://github.com/solana-labs/solana/issues/31391,
/// A ridiculous workaround for `<https://github.com/solana-labs/solana/issues/31391>`,
/// which is a bug where if a simulated transaction's return data ends with zero byte(s),
/// they end up being incorrectly truncated.
/// As a workaround, we can (de)serialize data with a trailing non-zero byte.

@ -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 }),

@ -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),

@ -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],

@ -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<T: DiscriminatorPrefixedData + AccessContr
let new_owner = new_funded_keypair(banks_client, payer, 1000000000).await;
// Accounts:
// 0. [] The IGP or Overhead IGP.
// 1. [signer] The owner of the account.
// 0. `[]` The IGP or Overhead IGP.
// 1. `[signer]` The owner of the account.
let instruction = Instruction::new_with_borsh(
program_id,
&transfer_ownership_instruction(Some(new_owner.pubkey())),

@ -117,9 +117,9 @@ pub fn init_instruction(
let ixn = Instruction::Init;
// Accounts:
// 0. [executable] The system program.
// 1. [signer] The payer account.
// 2. [writeable] The program data PDA account.
// 0. `[executable]` The system program.
// 1. `[signer]` The payer account.
// 2. `[writeable]` The program data PDA account.
let accounts = vec![
AccountMeta::new_readonly(solana_program::system_program::id(), false),
AccountMeta::new_readonly(payer, true),
@ -154,9 +154,9 @@ pub fn init_igp_instruction(
});
// 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 accounts = vec![
AccountMeta::new_readonly(solana_program::system_program::id(), false),
AccountMeta::new_readonly(payer, true),
@ -187,9 +187,9 @@ pub fn init_overhead_igp_instruction(
let ixn = Instruction::InitOverheadIgp(InitOverheadIgp { salt, owner, inner });
// 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 accounts = vec![
AccountMeta::new_readonly(solana_program::system_program::id(), false),
AccountMeta::new_readonly(payer, true),
@ -215,9 +215,9 @@ pub fn set_destination_gas_overheads(
let ixn = Instruction::SetDestinationGasOverheads(overhead_gas_amounts);
// 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 accounts = vec![
AccountMeta::new_readonly(solana_program::system_program::id(), false),
AccountMeta::new(overhead_igp, false),
@ -243,9 +243,9 @@ pub fn set_gas_oracle_configs_instruction(
let ixn = Instruction::SetGasOracleConfigs(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 accounts = vec![
AccountMeta::new_readonly(solana_program::system_program::id(), false),
AccountMeta::new(igp, false),
@ -289,13 +289,13 @@ pub fn pay_for_gas_instruction(
});
// 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).
let mut accounts = vec![
AccountMeta::new_readonly(solana_program::system_program::id(), false),
AccountMeta::new(payer, true),
@ -335,8 +335,8 @@ pub fn transfer_igp_account_ownership_instruction(
),
};
// 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.
let instruction = SolanaInstruction {
program_id,
data: instruction.try_to_vec()?,

@ -89,9 +89,9 @@ pub fn process_instruction(
/// Initializes the program.
///
/// Accounts:
/// 0. [executable] The system program.
/// 1. [signer] The payer account.
/// 2. [writeable] The program data PDA account.
/// 0. `[executable]` The system program.
/// 1. `[signer]` The payer account.
/// 2. `[writeable]` The program data PDA account.
fn init(program_id: &Pubkey, accounts: &[AccountInfo]) -> 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<T: account_utils::DiscriminatorPrefixedData + SizedData>(
/// 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<T: account_utils::DiscriminatorPrefixedData + AccessControl>(
program_id: &Pubkey,
accounts: &[AccountInfo],
@ -506,8 +506,8 @@ fn transfer_igp_variant_ownership<T: account_utils::DiscriminatorPrefixedData +
/// Gets an IGP variant and verifies the owner.
///
/// Accounts:
/// 0. [] The IGP variant.
/// 1. [signer] The owner of the IGP variant.
/// 0. `[]` The IGP variant.
/// 1. `[signer]` The owner of the IGP variant.
fn get_igp_variant_and_verify_owner<
'a,
'b,
@ -536,9 +536,9 @@ fn get_igp_variant_and_verify_owner<
/// Sends funds accrued in an IGP to its beneficiary.
///
/// 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.
fn claim(program_id: &Pubkey, accounts: &[AccountInfo]) -> 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],

@ -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);

@ -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<Self>,
@ -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<Self>,

@ -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::<CollateralPlugin>::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<Pubkey>.
///
/// Accounts:
/// 0. [] The token PDA account.
/// 0. `[]` The token PDA account.
fn interchain_security_module(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult {
HyperlaneSealevelToken::<CollateralPlugin>::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],

@ -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,

@ -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);

@ -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<Self>,
@ -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<Self>,

@ -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::<NativePlugin>::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<Pubkey>.
///
/// Accounts:
/// 0. [] The token PDA account.
/// 0. `[]` The token PDA account.
fn interchain_security_module(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult {
HyperlaneSealevelToken::<NativePlugin>::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],

@ -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,

@ -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);

@ -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<Self>,
@ -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<Self>,

@ -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::<SyntheticPlugin>::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<Pubkey>.
///
/// Accounts:
/// 0. [] The token PDA account.
/// 0. `[]` The token PDA account.
fn interchain_security_module(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult {
HyperlaneSealevelToken::<SyntheticPlugin>::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],

@ -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),

@ -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();

@ -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),
],
};

@ -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),

@ -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),

@ -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()?,

@ -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,16 +164,16 @@ 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.
// 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+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+1. `[executable]` Recipient program.
// M+2..K. [??] Accounts required to invoke the recipient's Handle instruction.
fn inbox_process(
program_id: &Pubkey,
@ -414,8 +414,8 @@ 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.
/// 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.
@ -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();

@ -37,7 +37,7 @@ pub enum TestSendReceiverError {
/// that the Mailbox can handle different ISM getter return data.
#[derive(BorshSerialize, BorshDeserialize, Debug)]
pub enum IsmReturnDataMode {
/// Encodes the ISM as an Option<Pubkey>.
/// Encodes the ISM as an `Option<Pubkey>`.
EncodeOption,
/// Returns no data.
ReturnNothing,
@ -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],

@ -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),

@ -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),

@ -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],

@ -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),

@ -13,6 +13,7 @@ version.workspace = true
hyperlane-core = { path = "../../hyperlane-core", features = ["float"]}
toml_edit.workspace = true
k256.workspace = true
jobserver.workspace = true
ripemd.workspace = true
sha2.workspace = true
serde.workspace = true
@ -29,3 +30,6 @@ macro_rules_attribute.workspace = true
regex.workspace = true
hpl-interface.workspace = true
cosmwasm-schema.workspace = true
[features]
cosmos = []

@ -609,7 +609,7 @@ fn termination_invariants_met(
Ok(true)
}
#[cfg(test)]
#[cfg(feature = "cosmos")]
mod test {
use super::*;

@ -1,24 +1,26 @@
// use std::path::Path;
use std::path::Path;
use crate::config::Config;
use crate::metrics::agent_balance_sum;
use maplit::hashmap;
use crate::logging::log;
use crate::solana::solana_termination_invariants_met;
use crate::{fetch_metric, ZERO_MERKLE_INSERTION_KATHY_MESSAGES};
// use crate::solana::solana_termination_invariants_met;
// This number should be even, so the messages can be split into two equal halves
// sent before and after the relayer spins up, to avoid rounding errors.
pub const SOL_MESSAGES_EXPECTED: u32 = 0;
pub const SOL_MESSAGES_EXPECTED: u32 = 20;
/// Use the metrics to check if the relayer queues are empty and the expected
/// number of messages have been sent.
pub fn termination_invariants_met(
config: &Config,
starting_relayer_balance: f64,
// solana_cli_tools_path: &Path,
// solana_config_path: &Path,
solana_cli_tools_path: &Path,
solana_config_path: &Path,
) -> eyre::Result<bool> {
let eth_messages_expected = (config.kathy_messages / 2) as u32 * 2;
let total_messages_expected = eth_messages_expected + SOL_MESSAGES_EXPECTED;
@ -74,10 +76,10 @@ pub fn termination_invariants_met(
return Ok(false);
}
// if !solana_termination_invariants_met(solana_cli_tools_path, solana_config_path) {
// log!("Solana termination invariants not met");
// return Ok(false);
// }
if !solana_termination_invariants_met(solana_cli_tools_path, solana_config_path) {
log!("Solana termination invariants not met");
return Ok(false);
}
let dispatched_messages_scraped = fetch_metric(
"9093",

@ -29,7 +29,7 @@ use tempfile::tempdir;
use crate::{
config::Config,
ethereum::start_anvil,
invariants::termination_invariants_met,
invariants::{termination_invariants_met, SOL_MESSAGES_EXPECTED},
metrics::agent_balance_sum,
solana::*,
utils::{concat_path, make_static, stop_child, AgentHandles, ArbitraryData, TaskHandle},
@ -54,9 +54,9 @@ const RELAYER_KEYS: &[&str] = &[
// test3
"0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356",
// sealeveltest1
// "0x892bf6949af4233e62f854cb3618bc1a3ee3341dc71ada08c4d5deca239acf4f",
// // sealeveltest2
// "0x892bf6949af4233e62f854cb3618bc1a3ee3341dc71ada08c4d5deca239acf4f",
"0x892bf6949af4233e62f854cb3618bc1a3ee3341dc71ada08c4d5deca239acf4f",
// sealeveltest2
"0x892bf6949af4233e62f854cb3618bc1a3ee3341dc71ada08c4d5deca239acf4f",
];
/// These private keys are from hardhat/anvil's testing accounts.
/// These must be consistent with the ISM config for the test.
@ -66,15 +66,13 @@ const VALIDATOR_KEYS: &[&str] = &[
"0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba",
"0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e",
// sealevel
// "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d",
"0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d",
];
const VALIDATOR_ORIGIN_CHAINS: &[&str] = &["test1", "test2", "test3"];
// const VALIDATOR_ORIGIN_CHAINS: &[&str] = &["test1", "test2", "test3", "sealeveltest1"];
const VALIDATOR_ORIGIN_CHAINS: &[&str] = &["test1", "test2", "test3", "sealeveltest1"];
const AGENT_BIN_PATH: &str = "target/debug";
const INFRA_PATH: &str = "../typescript/infra";
// const TS_SDK_PATH: &str = "../typescript/sdk";
const MONOREPO_ROOT_PATH: &str = "../";
const ZERO_MERKLE_INSERTION_KATHY_MESSAGES: u32 = 10;
@ -92,6 +90,7 @@ struct State {
watchers: Vec<Box<dyn TaskHandle<Output = ()>>>,
data: Vec<Box<dyn ArbitraryData>>,
}
impl State {
fn push_agent(&mut self, handles: AgentHandles) {
self.agents.push((handles.0, handles.1));
@ -100,6 +99,7 @@ impl State {
self.data.push(handles.4);
}
}
impl Drop for State {
fn drop(&mut self) {
SHUTDOWN.store(true, Ordering::Relaxed);
@ -137,11 +137,11 @@ fn main() -> ExitCode {
let config = Config::load();
// let solana_checkpoint_path = Path::new(SOLANA_CHECKPOINT_LOCATION);
// fs::remove_dir_all(solana_checkpoint_path).unwrap_or_default();
let checkpoints_dirs: Vec<DynPath> = (0..VALIDATOR_COUNT)
let solana_checkpoint_path = Path::new(SOLANA_CHECKPOINT_LOCATION);
fs::remove_dir_all(solana_checkpoint_path).unwrap_or_default();
let checkpoints_dirs: Vec<DynPath> = (0..VALIDATOR_COUNT - 1)
.map(|_| Box::new(tempdir().unwrap()) as DynPath)
// .chain([Box::new(solana_checkpoint_path) as DynPath])
.chain([Box::new(solana_checkpoint_path) as DynPath])
.collect();
let rocks_db_dir = tempdir().unwrap();
let relayer_db = concat_path(&rocks_db_dir, "relayer");
@ -173,8 +173,8 @@ fn main() -> ExitCode {
.hyp_env("DB", relayer_db.to_str().unwrap())
.hyp_env("CHAINS_TEST1_SIGNER_KEY", RELAYER_KEYS[0])
.hyp_env("CHAINS_TEST2_SIGNER_KEY", RELAYER_KEYS[1])
// .hyp_env("CHAINS_SEALEVELTEST1_SIGNER_KEY", RELAYER_KEYS[3])
// .hyp_env("CHAINS_SEALEVELTEST2_SIGNER_KEY", RELAYER_KEYS[4])
.hyp_env("CHAINS_SEALEVELTEST1_SIGNER_KEY", RELAYER_KEYS[3])
.hyp_env("CHAINS_SEALEVELTEST2_SIGNER_KEY", RELAYER_KEYS[4])
.hyp_env("RELAYCHAINS", "invalidchain,otherinvalid")
.hyp_env("ALLOWLOCALCHECKPOINTSYNCERS", "true")
.hyp_env(
@ -201,8 +201,7 @@ fn main() -> ExitCode {
.arg("defaultSigner.key", RELAYER_KEYS[2])
.arg(
"relayChains",
"test1,test2,test3",
// "test1,test2,test3,sealeveltest1,sealeveltest2",
"test1,test2,test3,sealeveltest1,sealeveltest2",
);
let base_validator_env = common_agent_env
@ -274,9 +273,9 @@ fn main() -> ExitCode {
// Ready to run...
//
// let (solana_path, solana_path_tempdir) = install_solana_cli_tools().join();
// state.data.push(Box::new(solana_path_tempdir));
// let solana_program_builder = build_solana_programs(solana_path.clone());
let (solana_path, solana_path_tempdir) = install_solana_cli_tools().join();
state.data.push(Box::new(solana_path_tempdir));
let solana_program_builder = build_solana_programs(solana_path.clone());
// this task takes a long time in the CI so run it in parallel
log!("Building rust...");
@ -287,13 +286,13 @@ fn main() -> ExitCode {
.arg("bin", "validator")
.arg("bin", "scraper")
.arg("bin", "init-db")
// .arg("bin", "hyperlane-sealevel-client")
.arg("bin", "hyperlane-sealevel-client")
.filter_logs(|l| !l.contains("workspace-inheritance"))
.run();
let start_anvil = start_anvil(config.clone());
// let solana_program_path = solana_program_builder.join();
let solana_program_path = solana_program_builder.join();
log!("Running postgres db...");
let postgres = Program::new("docker")
@ -308,15 +307,15 @@ fn main() -> ExitCode {
build_rust.join();
// let solana_ledger_dir = tempdir().unwrap();
// let start_solana_validator = start_solana_test_validator(
// solana_path.clone(),
// solana_program_path,
// solana_ledger_dir.as_ref().to_path_buf(),
// );
let solana_ledger_dir = tempdir().unwrap();
let start_solana_validator = start_solana_test_validator(
solana_path.clone(),
solana_program_path,
solana_ledger_dir.as_ref().to_path_buf(),
);
// let (_solana_config_path, solana_validator) = start_solana_validator.join();
// state.push_agent(solana_validator);
let (solana_config_path, solana_validator) = start_solana_validator.join();
state.push_agent(solana_validator);
state.push_agent(start_anvil.join());
// spawn 1st validator before any messages have been sent to test empty mailbox
@ -362,9 +361,9 @@ fn main() -> ExitCode {
kathy_env_double_insertion.clone().run().join();
// Send some sealevel messages before spinning up the agents, to test the backward indexing cursor
// for _i in 0..(SOL_MESSAGES_EXPECTED / 2) {
// initiate_solana_hyperlane_transfer(solana_path.clone(), solana_config_path.clone()).join();
// }
for _i in 0..(SOL_MESSAGES_EXPECTED / 2) {
initiate_solana_hyperlane_transfer(solana_path.clone(), solana_config_path.clone()).join();
}
// spawn the rest of the validators
for (i, validator_env) in validator_envs.into_iter().enumerate().skip(1) {
@ -375,9 +374,9 @@ fn main() -> ExitCode {
state.push_agent(relayer_env.spawn("RLY"));
// Send some sealevel messages after spinning up the relayer, to test the forward indexing cursor
// for _i in 0..(SOL_MESSAGES_EXPECTED / 2) {
// initiate_solana_hyperlane_transfer(solana_path.clone(), solana_config_path.clone()).join();
// }
for _i in 0..(SOL_MESSAGES_EXPECTED / 2) {
initiate_solana_hyperlane_transfer(solana_path.clone(), solana_config_path.clone()).join();
}
log!("Setup complete! Agents running in background...");
log!("Ctrl+C to end execution...");
@ -395,8 +394,13 @@ fn main() -> ExitCode {
while !SHUTDOWN.load(Ordering::Relaxed) {
if config.ci_mode {
// for CI we have to look for the end condition.
if termination_invariants_met(&config, starting_relayer_balance)
// if termination_invariants_met(&config, &solana_path, &solana_config_path)
// if termination_invariants_met(&config, starting_relayer_balance)
if termination_invariants_met(
&config,
starting_relayer_balance,
&solana_path,
&solana_config_path,
)
.unwrap_or(false)
{
// end condition reached successfully

@ -282,10 +282,10 @@ pub fn start_solana_test_validator(
}
#[apply(as_task)]
pub fn _initiate_solana_hyperlane_transfer(
pub fn initiate_solana_hyperlane_transfer(
solana_cli_tools_path: PathBuf,
solana_config_path: PathBuf,
) {
) -> String {
let sender = Program::new(concat_path(&solana_cli_tools_path, "solana"))
.arg("config", solana_config_path.to_str().unwrap())
.arg("keypair", SOLANA_KEYPAIR)
@ -309,21 +309,20 @@ pub fn _initiate_solana_hyperlane_transfer(
.run_with_output()
.join();
let message_id = _get_message_id_from_logs(output);
if let Some(message_id) = message_id {
let message_id = get_message_id_from_logs(output).expect("failed to get message id from logs");
sealevel_client(&solana_cli_tools_path, &solana_config_path)
.cmd("igp")
.cmd("pay-for-gas")
.arg("program-id", "GwHaw8ewMyzZn9vvrZEnTEAAYpLdkGYs195XWcLDCN4U")
.arg("message-id", message_id)
.arg("message-id", message_id.clone())
.arg("destination-domain", SOLANA_REMOTE_CHAIN_ID)
.arg("gas", "100000")
.run()
.join();
}
message_id
}
fn _get_message_id_from_logs(logs: Vec<String>) -> Option<String> {
fn get_message_id_from_logs(logs: Vec<String>) -> Option<String> {
let message_id_regex = Regex::new(r"Dispatched message to \d+, ID 0x([0-9a-fA-F]+)").unwrap();
for log in logs {
// Use the regular expression to capture the ID
@ -337,7 +336,7 @@ fn _get_message_id_from_logs(logs: Vec<String>) -> Option<String> {
None
}
pub fn _solana_termination_invariants_met(
pub fn solana_termination_invariants_met(
solana_cli_tools_path: &Path,
solana_config_path: &Path,
) -> bool {
@ -349,7 +348,7 @@ pub fn _solana_termination_invariants_met(
// This value was gotten by observing the relayer logs.
// TODO: get the actual message-id so we don't have to hardcode it
"message-id",
"0x7b8ba684e5ce44f898c5fa81785c83a00e32b5bef3412e648eb7a17bec497685",
"0x89c76191bd40b1858b7957e35bf3455122826e4737c5540b9dc5a555370d78c5",
)
.arg("program-id", "9tCUWNjpqcf3NUSrtp7vquYVCwbEByvLjZUrhG5dgvhj")
.run_with_output()

Loading…
Cancel
Save