From de4ed8bf2b70712db1bf5eaed3b2cd4c2156e317 Mon Sep 17 00:00:00 2001 From: Mattie Conover Date: Tue, 6 Dec 2022 10:07:16 -0800 Subject: [PATCH] More post v2 cleanup (#1388) * Removed code files that are not part of project anymore * Removed unused metric * Refactor some obj names * Update string constants for outbox and inbox * Update comments * Changes for PR review * Fix typo --- rust/agents/relayer/src/main.rs | 7 +- .../msg/gelato_submitter/sponsored_call_op.rs | 2 +- rust/agents/relayer/src/msg/processor.rs | 2 +- .../relayer/src/msg/serial_submitter.rs | 19 +- rust/agents/relayer/src/relayer.rs | 4 +- .../m20221122_000004_create_table_message.rs | 2 +- rust/agents/scraper/src/chain_scraper/sync.rs | 2 +- rust/agents/scraper/src/db/message.rs | 4 +- rust/agents/validator/src/main.rs | 2 +- rust/chains/hyperlane-ethereum/src/inbox.rs | 240 ------------------ .../hyperlane-ethereum/src/interchain_gas.rs | 2 +- rust/chains/hyperlane-ethereum/src/lib.rs | 2 +- rust/chains/hyperlane-ethereum/src/mailbox.rs | 2 +- rust/ethers-prometheus/src/middleware/mod.rs | 2 +- .../src/contract_sync/mailbox.rs | 8 +- .../src/contract_sync/schema.rs | 4 +- rust/hyperlane-base/src/lib.rs | 2 +- rust/hyperlane-base/src/metrics/core.rs | 28 +- rust/hyperlane-base/src/settings/chains.rs | 10 +- rust/hyperlane-base/src/settings/mod.rs | 8 +- rust/hyperlane-core/src/db/mod.rs | 2 +- rust/hyperlane-core/src/lib.rs | 2 +- rust/hyperlane-core/src/traits/indexer.rs | 7 +- rust/hyperlane-test/src/test_utils.rs | 8 +- rust/utils/run-locally/src/main.rs | 7 +- 25 files changed, 57 insertions(+), 321 deletions(-) delete mode 100644 rust/chains/hyperlane-ethereum/src/inbox.rs diff --git a/rust/agents/relayer/src/main.rs b/rust/agents/relayer/src/main.rs index 4259fb1e4..d9d14887d 100644 --- a/rust/agents/relayer/src/main.rs +++ b/rust/agents/relayer/src/main.rs @@ -1,7 +1,8 @@ -//! The relayer forwards signed checkpoints from the outbox to chain to inboxes +//! The relayer forwards signed checkpoints from the current chain's mailbox to +//! the other chains' mailboxes //! -//! At a regular interval, the relayer polls Outbox for signed checkpoints and -//! submits them as checkpoints on the inbox. +//! At a regular interval, the relayer polls the current chain's mailbox for +//! signed checkpoints and submits them as checkpoints on the remote mailbox. #![forbid(unsafe_code)] #![warn(missing_docs)] diff --git a/rust/agents/relayer/src/msg/gelato_submitter/sponsored_call_op.rs b/rust/agents/relayer/src/msg/gelato_submitter/sponsored_call_op.rs index a3272a9de..a576248c9 100644 --- a/rust/agents/relayer/src/msg/gelato_submitter/sponsored_call_op.rs +++ b/rust/agents/relayer/src/msg/gelato_submitter/sponsored_call_op.rs @@ -163,7 +163,7 @@ impl SponsoredCallOp { loop { sleep(self.opts.poll_interval).await; - // Check if the message has been processed. Checking with the Inbox directly + // Check if the message has been processed. Checking with the Mailbox directly // is the best source of truth, and is the only way in which a message can be // marked as processed. if let Ok(true) = self.message_delivered().await { diff --git a/rust/agents/relayer/src/msg/processor.rs b/rust/agents/relayer/src/msg/processor.rs index 5bba5c4d5..88dad0c32 100644 --- a/rust/agents/relayer/src/msg/processor.rs +++ b/rust/agents/relayer/src/msg/processor.rs @@ -118,7 +118,7 @@ impl MessageProcessor { return Ok(()); }; - // Skip if for different inbox. + // Skip if for different domain. if message.destination != self.destination_mailbox.domain() { debug!( id=?message.id(), diff --git a/rust/agents/relayer/src/msg/serial_submitter.rs b/rust/agents/relayer/src/msg/serial_submitter.rs index a208160dc..5540814d8 100644 --- a/rust/agents/relayer/src/msg/serial_submitter.rs +++ b/rust/agents/relayer/src/msg/serial_submitter.rs @@ -165,7 +165,7 @@ impl SerialSubmitter { } /// Tick represents a single round of scheduling wherein we will process each queue and - /// await at most one message submission. It is extracted from the main loop to allow for + /// await at most one message submission. It is extracted from the main loop to allow for /// testing the state of the scheduler at particular points without having to worry about /// concurrent access. async fn tick(&mut self) -> Result<()> { @@ -185,7 +185,7 @@ impl SerialSubmitter { } // TODO(webbhorn): Scan verification queue, dropping messages that have been confirmed - // processed by the inbox indexer observing it. For any still-unverified messages that + // processed by the mailbox indexer observing it. For any still-unverified messages that // have been in the verification queue for > threshold_time, move them back to the wait // queue for further processing. @@ -237,16 +237,15 @@ impl SerialSubmitter { } /// Returns the message's status. If the message is processed, either by a transaction - /// in this fn or by a view call to the Inbox contract discovering the message has already - /// been processed, Ok(MessageStatus::Processed) is returned. If this message is unable to + /// in this fn or by a view call to the Mailbox contract discovering the message has already + /// been processed, Ok(true) is returned. If this message is unable to /// be processed, either due to failed gas estimation or an insufficient gas payment, - /// Ok(MessageStatus::None) is returned. + /// Ok(false) is returned. #[instrument(skip(self, msg), fields(msg_nonce=msg.message.nonce))] async fn process_message(&self, msg: &SubmitMessageArgs) -> Result { - // If the message has already been processed according to message_status call on - // inbox, e.g. due to another relayer having already processed, then mark it as - // already-processed, and move on to the next tick. - // TODO(webbhorn): Make this robust to re-orgs on inbox. + // If the message has already been processed, e.g. due to another relayer having already + // processed, then mark it as already-processed, and move on to the next tick. + // TODO(webbhorn): Make this robust to re-orgs on mailbox. if self.mailbox.delivered(msg.message.id()).await? { info!("Message already processed"); return Ok(true); @@ -297,7 +296,7 @@ impl SerialSubmitter { .await; match process_result { // TODO(trevor): Instead of immediately marking as processed, move to a verification - // queue, which will wait for finality and indexing by the inbox indexer and then mark + // queue, which will wait for finality and indexing by the mailbox indexer and then mark // as processed (or eventually retry if no confirmation is ever seen). // Only mark the message as processed if the transaction didn't revert. diff --git a/rust/agents/relayer/src/relayer.rs b/rust/agents/relayer/src/relayer.rs index 61b82f6f7..88d664e04 100644 --- a/rust/agents/relayer/src/relayer.rs +++ b/rust/agents/relayer/src/relayer.rs @@ -263,10 +263,10 @@ impl Relayer { let process_fut = message_processor.spawn(); tokio::spawn(async move { let res = tokio::try_join!(submit_fut, process_fut)?; - info!(?res, "try_join finished for inbox"); + info!(?res, "try_join finished for mailbox"); Ok(()) }) - .instrument(info_span!("run inbox")) + .instrument(info_span!("run mailbox")) } } diff --git a/rust/agents/scraper/migration/src/m20221122_000004_create_table_message.rs b/rust/agents/scraper/migration/src/m20221122_000004_create_table_message.rs index 43d68befc..41a56f004 100644 --- a/rust/agents/scraper/migration/src/m20221122_000004_create_table_message.rs +++ b/rust/agents/scraper/migration/src/m20221122_000004_create_table_message.rs @@ -134,7 +134,7 @@ pub enum Message { Origin, /// Domain ID of the destination chain Destination, - /// Nonce of this message in the merkle tree of the outbox + /// Nonce of this message in the merkle tree of the mailbox Nonce, /// Address of the message sender on the origin chain (not necessarily the /// transaction signer) diff --git a/rust/agents/scraper/src/chain_scraper/sync.rs b/rust/agents/scraper/src/chain_scraper/sync.rs index 67b47d367..011d41760 100644 --- a/rust/agents/scraper/src/chain_scraper/sync.rs +++ b/rust/agents/scraper/src/chain_scraper/sync.rs @@ -218,7 +218,7 @@ impl Syncer { from, to, message_count = sorted_messages.len(), - "Filtered any messages already indexed for outbox." + "Filtered any messages already indexed for mailbox" ); Ok((sorted_messages, deliveries)) diff --git a/rust/agents/scraper/src/db/message.rs b/rust/agents/scraper/src/db/message.rs index d102b1a77..34fd0deef 100644 --- a/rust/agents/scraper/src/db/message.rs +++ b/rust/agents/scraper/src/db/message.rs @@ -55,7 +55,7 @@ impl ScraperDb { .map(|idx| idx as u32)) } - /// Store deliveries from an inbox into the database (or update an existing + /// Store deliveries from a mailbox into the database (or update an existing /// one). #[instrument(skip_all)] pub async fn store_deliveries( @@ -96,7 +96,7 @@ impl ScraperDb { Ok(()) } - /// Store messages from an outbox into the database (or update an existing + /// Store messages from a mailbox into the database (or update an existing /// one). #[instrument(skip_all)] pub async fn store_messages( diff --git a/rust/agents/validator/src/main.rs b/rust/agents/validator/src/main.rs index 14c4d11db..7ce9db827 100644 --- a/rust/agents/validator/src/main.rs +++ b/rust/agents/validator/src/main.rs @@ -1,4 +1,4 @@ -//! The validator signs Outbox checkpoints that have reached finality. +//! The validator signs Mailbox checkpoints that have reached finality. #![forbid(unsafe_code)] #![warn(missing_docs)] diff --git a/rust/chains/hyperlane-ethereum/src/inbox.rs b/rust/chains/hyperlane-ethereum/src/inbox.rs deleted file mode 100644 index 7d3411ea2..000000000 --- a/rust/chains/hyperlane-ethereum/src/inbox.rs +++ /dev/null @@ -1,240 +0,0 @@ -#![allow(clippy::enum_variant_names)] -#![allow(missing_docs)] - -use std::collections::HashMap; -use std::fmt::{self, Debug, Display}; -use std::sync::Arc; - -use async_trait::async_trait; -use ethers::prelude::*; -use eyre::Result; -use tracing::instrument; - -use hyperlane_core::{ - HyperlaneAbi, HyperlaneChain, HyperlaneCommon, HyperlaneContract, Address, ChainCommunicationError, - ContractLocator, Inbox, InboxIndexer, Indexer, MessageStatus, -}; - -use crate::contracts::inbox::{Inbox as EthereumInboxInternal, INBOX_ABI}; -use crate::trait_builder::MakeableWithProvider; - -impl Display for EthereumInboxInternal -where - M: Middleware, -{ - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{:?}", self) - } -} - -pub struct InboxBuilder {} - -#[async_trait] -impl MakeableWithProvider for InboxBuilder { - type Output = Box; - - async fn make_with_provider( - &self, - provider: M, - locator: &ContractLocator, - ) -> Self::Output { - Box::new(EthereumInbox::new(Arc::new(provider), locator).await) - } -} - -pub struct InboxIndexerBuilder { - pub finality_blocks: u32, -} - -#[async_trait] -impl MakeableWithProvider for InboxIndexerBuilder { - type Output = Box; - - async fn make_with_provider( - &self, - provider: M, - locator: &ContractLocator, - ) -> Self::Output { - Box::new(EthereumInboxIndexer::new( - Arc::new(provider), - locator, - self.finality_blocks, - )) - } -} - -#[derive(Debug)] -pub struct EthereumInboxIndexer -where - M: Middleware, -{ - contract: Arc>, - provider: Arc, - finality_blocks: u32, -} - -impl EthereumInboxIndexer -where - M: Middleware + 'static, -{ - pub fn new(provider: Arc, locator: &ContractLocator, finality_blocks: u32) -> Self { - let contract = Arc::new(EthereumInboxInternal::new( - &locator.address, - provider.clone(), - )); - Self { - contract, - provider, - finality_blocks, - } - } -} - -#[async_trait] -impl Indexer for EthereumInboxIndexer -where - M: Middleware + 'static, -{ - async fn get_finalized_block_number(&self) -> Result { - Ok(self - .provider - .get_block_number() - .await? - .as_u32() - .saturating_sub(self.finality_blocks)) - } -} - -#[async_trait] -impl InboxIndexer for EthereumInboxIndexer -where - M: Middleware + 'static, -{ - #[instrument(err, skip(self))] - async fn fetch_processed_messages( - &self, - from: u32, - to: u32, - ) -> Result> { - Ok(self - .contract - .process_filter() - .from_block(from) - .to_block(to) - .query_with_meta() - .await? - .into_iter() - .map(|(event, meta)| (H256::from(event.message_hash), meta.into())) - .collect()) - } -} - -/// A struct that provides access to an Ethereum inbox contract -#[derive(Debug)] -pub struct EthereumInbox -where - M: Middleware, -{ - contract: Arc>, - remote_domain: u32, - chain_name: String, - local_domain: u32, -} - -impl EthereumInbox -where - M: Middleware, -{ - /// Create a reference to a inbox at a specific Ethereum address on some - /// chain - pub async fn new( - provider: Arc, - ContractLocator { - chain_name, - domain, - address, - }: &ContractLocator, - ) -> Self { - let contract = Arc::new(EthereumInboxInternal::new(address, provider)); - let remote_domain = contract - .remote_domain() - .call() - .await - .expect("Failed to get inbox's local_domain"); - debug_assert_eq!( - contract - .local_domain() - .call() - .await - .expect("Failed to get inbox's remote_domain"), - *domain - ); - Self { - contract, - remote_domain, - local_domain: *domain, - chain_name: chain_name.to_owned(), - } - } -} - -impl HyperlaneChain for EthereumInbox -where - M: Middleware + 'static, -{ - fn chain_name(&self) -> &str { - &self.chain_name - } - - fn local_domain(&self) -> u32 { - self.local_domain - } -} - -impl HyperlaneContract for EthereumInbox -where - M: Middleware + 'static, -{ - fn address(&self) -> H256 { - self.contract.address().into() - } -} - -#[async_trait] -impl HyperlaneCommon for EthereumInbox -where - M: Middleware + 'static, -{ - #[tracing::instrument(err)] - async fn validator_manager(&self) -> Result { - Ok(self.contract.validator_manager().call().await?.into()) - } -} - -#[async_trait] -impl Inbox for EthereumInbox -where - M: Middleware + 'static, -{ - fn remote_domain(&self) -> u32 { - self.remote_domain - } - - #[tracing::instrument(err)] - async fn message_status(&self, leaf: H256) -> Result { - let status = self.contract.messages(leaf.into()).call().await?; - Ok(MessageStatus::try_from(status).expect("Bad status from solidity")) - } - - fn contract_address(&self) -> Address { - self.contract.address().into() - } -} - -pub struct EthereumInboxAbi; - -impl HyperlaneAbi for EthereumInboxAbi { - fn fn_map() -> HashMap { - super::extract_fn_map(&INBOX_ABI) - } -} diff --git a/rust/chains/hyperlane-ethereum/src/interchain_gas.rs b/rust/chains/hyperlane-ethereum/src/interchain_gas.rs index e8ea1e966..fde575259 100644 --- a/rust/chains/hyperlane-ethereum/src/interchain_gas.rs +++ b/rust/chains/hyperlane-ethereum/src/interchain_gas.rs @@ -167,7 +167,7 @@ impl EthereumInterchainGasPaymaster where M: Middleware + 'static, { - /// Create a reference to a outbox at a specific Ethereum address on some + /// Create a reference to a mailbox at a specific Ethereum address on some /// chain pub fn new(provider: Arc, locator: &ContractLocator) -> Self { Self { diff --git a/rust/chains/hyperlane-ethereum/src/lib.rs b/rust/chains/hyperlane-ethereum/src/lib.rs index f286dcae3..0fce7d59d 100644 --- a/rust/chains/hyperlane-ethereum/src/lib.rs +++ b/rust/chains/hyperlane-ethereum/src/lib.rs @@ -20,7 +20,7 @@ pub use crate::{interchain_gas::*, mailbox::*, multisig_ism::*, provider::*, tra #[cfg(not(doctest))] mod tx; -/// Outbox abi +/// Mailbox abi #[cfg(not(doctest))] mod mailbox; diff --git a/rust/chains/hyperlane-ethereum/src/mailbox.rs b/rust/chains/hyperlane-ethereum/src/mailbox.rs index 495acdb05..ca32dd04f 100644 --- a/rust/chains/hyperlane-ethereum/src/mailbox.rs +++ b/rust/chains/hyperlane-ethereum/src/mailbox.rs @@ -152,7 +152,7 @@ impl MakeableWithProvider for MailboxBuilder { } } -/// A reference to an Mailbox contract on some Ethereum chain +/// A reference to a Mailbox contract on some Ethereum chain #[derive(Debug)] pub struct EthereumMailbox where diff --git a/rust/ethers-prometheus/src/middleware/mod.rs b/rust/ethers-prometheus/src/middleware/mod.rs index f0c5f7632..ffabbd390 100644 --- a/rust/ethers-prometheus/src/middleware/mod.rs +++ b/rust/ethers-prometheus/src/middleware/mod.rs @@ -68,7 +68,7 @@ pub struct WalletInfo { #[cfg_attr(feature = "serde", serde(tag = "type", rename_all = "camelCase"))] pub struct ContractInfo { /// A human-friendly name for the contract. This should be a short string - /// like "inbox". + /// like "mailbox". pub name: Option, /// Mapping from function selectors to human readable names. pub functions: HashMap, diff --git a/rust/hyperlane-base/src/contract_sync/mailbox.rs b/rust/hyperlane-base/src/contract_sync/mailbox.rs index 1bbfc774f..57e062d70 100644 --- a/rust/hyperlane-base/src/contract_sync/mailbox.rs +++ b/rust/hyperlane-base/src/contract_sync/mailbox.rs @@ -6,7 +6,7 @@ use hyperlane_core::{ }; use crate::contract_sync::last_message::validate_message_continuity; -use crate::{contract_sync::schema::OutboxContractSyncDB, ContractSync}; +use crate::{contract_sync::schema::MailboxContractSyncDB, ContractSync}; const MESSAGES_LABEL: &str = "messages"; @@ -244,7 +244,7 @@ mod test { use hyperlane_test::test_utils; use crate::contract_sync::mailbox::MOCK_CURSOR; - use crate::contract_sync::schema::OutboxContractSyncDB; + use crate::contract_sync::schema::MailboxContractSyncDB; use crate::contract_sync::IndexSettings; use crate::ContractSync; use crate::{ContractSyncMetrics, CoreMetrics}; @@ -387,7 +387,7 @@ mod test { }); } - let hyperlane_db = HyperlaneDB::new("outbox_1", db); + let hyperlane_db = HyperlaneDB::new("mailbox_1", db); // Set the latest valid message range start block hyperlane_db @@ -406,7 +406,7 @@ mod test { let sync_metrics = ContractSyncMetrics::new(metrics); let contract_sync = ContractSync::new( - "outbox_1".into(), + "mailbox_1".into(), hyperlane_db.clone(), indexer, IndexSettings { diff --git a/rust/hyperlane-base/src/contract_sync/schema.rs b/rust/hyperlane-base/src/contract_sync/schema.rs index bb2bb5f98..49c12540f 100644 --- a/rust/hyperlane-base/src/contract_sync/schema.rs +++ b/rust/hyperlane-base/src/contract_sync/schema.rs @@ -10,12 +10,12 @@ use hyperlane_core::db::HyperlaneDB; static LATEST_VALID_MESSAGE_RANGE_START_BLOCK: &str = "latest_valid_message_range_start_block"; static LATEST_INDEXED_GAS_PAYMENT_BLOCK: &str = "latest_indexed_gas_payment_block"; -pub(crate) trait OutboxContractSyncDB { +pub(crate) trait MailboxContractSyncDB { fn store_latest_valid_message_range_start_block(&self, block_num: u32) -> Result<(), DbError>; fn retrieve_latest_valid_message_range_start_block(&self) -> Option; } -impl OutboxContractSyncDB for HyperlaneDB { +impl MailboxContractSyncDB for HyperlaneDB { fn store_latest_valid_message_range_start_block(&self, block_num: u32) -> Result<(), DbError> { self.store_encodable("", LATEST_VALID_MESSAGE_RANGE_START_BLOCK, &block_num) } diff --git a/rust/hyperlane-base/src/lib.rs b/rust/hyperlane-base/src/lib.rs index 03edfc091..8e50e5387 100644 --- a/rust/hyperlane-base/src/lib.rs +++ b/rust/hyperlane-base/src/lib.rs @@ -2,7 +2,7 @@ //! It has common utils and tools for configuring the app, interacting with the //! smart contracts, etc. //! -//! Implementations of the `Outbox` and `Inbox` traits on different chains +//! Implementations of the `Mailbox` traits on different chains //! ought to live here. // Forbid unsafe code outside of tests diff --git a/rust/hyperlane-base/src/metrics/core.rs b/rust/hyperlane-base/src/metrics/core.rs index f6b698aab..9842a7fa4 100644 --- a/rust/hyperlane-base/src/metrics/core.rs +++ b/rust/hyperlane-base/src/metrics/core.rs @@ -48,7 +48,6 @@ pub struct CoreMetrics { messages_processed_count: IntCounterVec, - outbox_state: IntGaugeVec, latest_checkpoint: IntGaugeVec, /// Set of metrics that tightly wrap the JsonRpcClient for use with the @@ -146,20 +145,10 @@ impl CoreMetrics { registry )?; - let outbox_state = register_int_gauge_vec_with_registry!( - opts!( - namespaced!("outbox_state"), - "Outbox contract state value", - const_labels_ref - ), - &["chain"], - registry - )?; - let latest_checkpoint = register_int_gauge_vec_with_registry!( opts!( namespaced!("latest_checkpoint"), - "Outbox latest checkpoint", + "Mailbox latest checkpoint", const_labels_ref ), &["phase", "chain"], @@ -192,7 +181,6 @@ impl CoreMetrics { messages_processed_count, - outbox_state, latest_checkpoint, json_rpc_client_metrics: OnceCell::new(), @@ -305,7 +293,7 @@ impl CoreMetrics { /// the nonces are contiguous by origin not remote. /// /// The following phases are implemented: - /// - `dispatch`: Highest nonce which has been indexed on the outbox + /// - `dispatch`: Highest nonce which has been indexed on the mailbox /// contract syncer and stored in the relayer DB. /// - `signed_offchain_checkpoint`: Highest nonce of a checkpoint which is /// known to have been signed by a quorum of validators. @@ -325,21 +313,11 @@ impl CoreMetrics { self.validator_checkpoint_index.clone() } - /// Gauge for reporting the current outbox state. This is either 0 (for - /// UnInitialized), 1 (for Active), or 2 (for Failed). These are from the - /// outbox contract States enum. - /// - /// Labels: - /// - `chain`: The chain the outbox is for. - pub fn outbox_state(&self) -> IntGaugeVec { - self.outbox_state.clone() - } - /// Latest message nonce in the validator. /// /// Phase: /// - `validator_observed`: When the validator has observed the checkpoint - /// on the outbox contract. + /// on the mailbox contract. /// - `validator_processed`: When the validator has written this checkpoint. pub fn latest_checkpoint(&self) -> IntGaugeVec { self.latest_checkpoint.clone() diff --git a/rust/hyperlane-base/src/settings/chains.rs b/rust/hyperlane-base/src/settings/chains.rs index 68fcb947d..897ce48a4 100644 --- a/rust/hyperlane-base/src/settings/chains.rs +++ b/rust/hyperlane-base/src/settings/chains.rs @@ -53,7 +53,7 @@ pub struct GelatoConf { pub sponsorapikey: String, } -/// Addresses for outbox chain contracts +/// Addresses for mailbox chain contracts #[derive(Clone, Debug, Deserialize, Default)] #[serde(rename_all = "camelCase")] pub struct CoreContractAddresses { @@ -65,14 +65,14 @@ pub struct CoreContractAddresses { pub interchain_gas_paymaster: String, } -/// Outbox indexing settings +/// Indexing settings #[derive(Debug, Deserialize, Default, Clone)] #[serde(rename_all = "camelCase")] pub struct IndexSettings { /// The height at which to start indexing the Outbox contract pub from: Option, /// The number of blocks to query at once at which to start indexing the - /// Outbox contract + /// Mailbox contract pub chunk: Option, } @@ -94,8 +94,8 @@ impl IndexSettings { } } -/// A chain setup is a domain ID, an address on that chain (where the outbox or -/// inbox is deployed) and details for connecting to the chain API. +/// A chain setup is a domain ID, an address on that chain (where the mailbox is deployed) and +/// details for connecting to the chain API. #[derive(Clone, Debug, Deserialize, Default)] #[serde(rename_all = "camelCase")] pub struct ChainSetup { diff --git a/rust/hyperlane-base/src/settings/mod.rs b/rust/hyperlane-base/src/settings/mod.rs index e03cee2ee..2eb3c6322 100644 --- a/rust/hyperlane-base/src/settings/mod.rs +++ b/rust/hyperlane-base/src/settings/mod.rs @@ -4,8 +4,8 @@ //! //! Hyperlane Agents have a shared core, which contains connection info for rpc, //! relevant contract addresses on each chain, etc. In addition, each agent has -//! agent-specific settings. Be convention, we represent these as a base config -//! per-Outbox contract, and a "partial" config per agent. On bootup, the agent +//! agent-specific settings. By convention above, we represent these as a base config +//! per-Mailbox contract, and a "partial" config per agent. On bootup, the agent //! loads the configuration, establishes RPC connections, and monitors each //! configured chain. //! @@ -41,7 +41,7 @@ //! { //! "environment": "test", //! "signers": {}, -//! "inboxes": { +//! "chains": { //! "test2": { //! "domain": "13372", //! ... @@ -52,7 +52,7 @@ //! ``` //! //! and an environment variable is supplied which defines -//! `HYP_BASE_INBOXES_TEST3_DOMAIN=1`, then the `decl_settings` macro in +//! `HYP_BASE_CHAINS_TEST2_DOMAIN=1`, then the `decl_settings` macro in //! `rust/hyperlane-base/src/macros.rs` will directly override the 'domain' //! field found in the json config to be `1`, since the fields in the //! environment variable name describe the path traversal to arrive at this diff --git a/rust/hyperlane-core/src/db/mod.rs b/rust/hyperlane-core/src/db/mod.rs index 2a328c3dc..aa5327efc 100644 --- a/rust/hyperlane-core/src/db/mod.rs +++ b/rust/hyperlane-core/src/db/mod.rs @@ -10,7 +10,7 @@ pub mod iterator; mod typed_db; pub use typed_db::*; -/// DB operations tied to specific Outbox +/// DB operations tied to specific Mailbox mod hyperlane_db; pub use hyperlane_db::*; diff --git a/rust/hyperlane-core/src/lib.rs b/rust/hyperlane-core/src/lib.rs index 559ea82d8..0818c86bc 100644 --- a/rust/hyperlane-core/src/lib.rs +++ b/rust/hyperlane-core/src/lib.rs @@ -9,7 +9,7 @@ /// Accumulator management pub mod accumulator; -/// Async Traits for Outboxes & Inboxes for use in applications +/// Async Traits for contract instances for use in applications mod traits; use ethers_signers::WalletError; pub use traits::*; diff --git a/rust/hyperlane-core/src/traits/indexer.rs b/rust/hyperlane-core/src/traits/indexer.rs index 5d75a4564..0aeff7abb 100644 --- a/rust/hyperlane-core/src/traits/indexer.rs +++ b/rust/hyperlane-core/src/traits/indexer.rs @@ -2,10 +2,7 @@ //! event-data to another entity (e.g. a `ContractSync`). For example, the only //! way to retrieve data such as the chain's latest block number or a list of //! checkpoints/messages emitted within a certain block range by calling out to -//! a chain-specific library and provider (e.g. ethers::provider). A -//! chain-specific mailbox or inbox should implement one or both of the Indexer -//! traits (CommonIndexer or MailboxIndexer) to provide an common interface -//! which other entities can retrieve this chain-specific info. +//! a chain-specific library and provider (e.g. ethers::provider). use std::fmt::Debug; @@ -25,7 +22,7 @@ pub trait Indexer: Send + Sync + Debug { } /// Interface for Mailbox contract indexer. Interface for allowing other -/// entities to retrieve chain-specific data from an mailbox. +/// entities to retrieve chain-specific data from a mailbox. #[async_trait] #[auto_impl(Box, Arc)] pub trait MailboxIndexer: Indexer { diff --git a/rust/hyperlane-test/src/test_utils.rs b/rust/hyperlane-test/src/test_utils.rs index 8d2d00949..d09b12733 100644 --- a/rust/hyperlane-test/src/test_utils.rs +++ b/rust/hyperlane-test/src/test_utils.rs @@ -39,8 +39,8 @@ mod test { #[tokio::test] async fn db_stores_and_retrieves_messages() { run_test_db(|db| async move { - let outbox_name = "outbox_1".to_owned(); - let db = HyperlaneDB::new(outbox_name, db); + let mailbox_name = "mailbox_1".to_owned(); + let db = HyperlaneDB::new(mailbox_name, db); let m = HyperlaneMessage { nonce: 100, @@ -72,8 +72,8 @@ mod test { #[tokio::test] async fn db_stores_and_retrieves_proofs() { run_test_db(|db| async move { - let outbox_name = "outbox_1".to_owned(); - let db = HyperlaneDB::new(outbox_name, db); + let mailbox_name = "mailbox_1".to_owned(); + let db = HyperlaneDB::new(mailbox_name, db); let proof = Proof { leaf: H256::from_low_u64_be(15), diff --git a/rust/utils/run-locally/src/main.rs b/rust/utils/run-locally/src/main.rs index 7fa704a33..5b52a4906 100644 --- a/rust/utils/run-locally/src/main.rs +++ b/rust/utils/run-locally/src/main.rs @@ -439,15 +439,16 @@ fn assert_termination_invariants(num_expected_messages_processed: u32) { "Could not find message_processed phase metric" ); // The max index is one less than the number delivered messages, since it is an index into the - // outbox merkle tree leafs. Since the metric is parameterized by inbox, and the test - // non-deterministically selects the destination inbox between test2 and test3 for the highest + // mailbox merkle tree leafs. Since the metric is parameterized by mailbox, and the test + // non-deterministically selects the destination mailbox between test2 and test3 for the highest // message, we take the max over the metric vector. assert_eq!( msg_processed_max_index.into_iter().max().unwrap(), num_expected_messages_processed - 1 ); - // Also ensure the counter is as expected (total number of messages), summed across all inboxes. + // Also ensure the counter is as expected (total number of messages), summed across all + // mailboxes. let msg_processed_count: Vec<_> = ureq::get("http://127.0.0.1:9092/metrics") .call() .unwrap()