|
|
@ -8,17 +8,16 @@ use ethers_prometheus::middleware::{ |
|
|
|
ChainInfo, ContractInfo, PrometheusMiddlewareConf, WalletInfo, |
|
|
|
ChainInfo, ContractInfo, PrometheusMiddlewareConf, WalletInfo, |
|
|
|
}; |
|
|
|
}; |
|
|
|
use hyperlane_core::{ |
|
|
|
use hyperlane_core::{ |
|
|
|
ContractLocator, HyperlaneAbi, HyperlaneDomain, HyperlaneDomainProtocol, HyperlaneProvider, |
|
|
|
utils::StrOrInt, ContractLocator, HyperlaneAbi, HyperlaneDomain, HyperlaneDomainProtocol, |
|
|
|
HyperlaneSigner, InterchainGasPaymaster, InterchainGasPaymasterIndexer, Mailbox, |
|
|
|
HyperlaneProvider, HyperlaneSigner, InterchainGasPaymaster, InterchainGasPaymasterIndexer, |
|
|
|
MailboxIndexer, MultisigIsm, ValidatorAnnounce, H256, |
|
|
|
Mailbox, MailboxIndexer, MultisigIsm, ValidatorAnnounce, H256, |
|
|
|
}; |
|
|
|
}; |
|
|
|
use hyperlane_ethereum::{ |
|
|
|
use hyperlane_ethereum::{ |
|
|
|
self as h_eth, BuildableWithProvider, EthereumInterchainGasPaymasterAbi, EthereumMailboxAbi, |
|
|
|
self as h_eth, BuildableWithProvider, EthereumInterchainGasPaymasterAbi, EthereumMailboxAbi, |
|
|
|
}; |
|
|
|
}; |
|
|
|
use hyperlane_fuel::{self as h_fuel, prelude::*}; |
|
|
|
use hyperlane_fuel::{self as h_fuel, prelude::*}; |
|
|
|
|
|
|
|
|
|
|
|
use crate::settings::signers::BuildableWithSignerConf; |
|
|
|
use crate::{settings::signers::BuildableWithSignerConf, CoreMetrics, SignerConf}; |
|
|
|
use crate::{CoreMetrics, SignerConf}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// A connection to _some_ blockchain.
|
|
|
|
/// A connection to _some_ blockchain.
|
|
|
|
///
|
|
|
|
///
|
|
|
@ -84,10 +83,10 @@ pub struct CoreContractAddresses { |
|
|
|
#[serde(rename_all = "camelCase")] |
|
|
|
#[serde(rename_all = "camelCase")] |
|
|
|
pub struct IndexSettings { |
|
|
|
pub struct IndexSettings { |
|
|
|
/// The height at which to start indexing the Outbox contract
|
|
|
|
/// The height at which to start indexing the Outbox contract
|
|
|
|
pub from: Option<String>, |
|
|
|
pub from: Option<StrOrInt>, |
|
|
|
/// The number of blocks to query at once at which to start indexing the
|
|
|
|
/// The number of blocks to query at once at which to start indexing the
|
|
|
|
/// Mailbox contract
|
|
|
|
/// Mailbox contract
|
|
|
|
pub chunk: Option<String>, |
|
|
|
pub chunk: Option<StrOrInt>, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl IndexSettings { |
|
|
|
impl IndexSettings { |
|
|
@ -95,7 +94,7 @@ impl IndexSettings { |
|
|
|
pub fn from(&self) -> u32 { |
|
|
|
pub fn from(&self) -> u32 { |
|
|
|
self.from |
|
|
|
self.from |
|
|
|
.as_ref() |
|
|
|
.as_ref() |
|
|
|
.and_then(|s| s.parse::<u32>().ok()) |
|
|
|
.and_then(|s| s.try_into().ok()) |
|
|
|
.unwrap_or_default() |
|
|
|
.unwrap_or_default() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -103,24 +102,24 @@ impl IndexSettings { |
|
|
|
pub fn chunk_size(&self) -> u32 { |
|
|
|
pub fn chunk_size(&self) -> u32 { |
|
|
|
self.chunk |
|
|
|
self.chunk |
|
|
|
.as_ref() |
|
|
|
.as_ref() |
|
|
|
.and_then(|s| s.parse::<u32>().ok()) |
|
|
|
.and_then(|s| s.try_into().ok()) |
|
|
|
.unwrap_or(1999) |
|
|
|
.unwrap_or(1999) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// A chain setup is a domain ID, an address on that chain (where the mailbox is
|
|
|
|
/// 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.
|
|
|
|
/// deployed) and details for connecting to the chain API.
|
|
|
|
#[derive(Clone, Debug, Deserialize, Default)] |
|
|
|
#[derive(Clone, Debug, Deserialize)] |
|
|
|
#[serde(rename_all = "camelCase")] |
|
|
|
#[serde(rename_all = "camelCase")] |
|
|
|
pub struct ChainSetup { |
|
|
|
pub struct ChainSetup { |
|
|
|
/// Chain name
|
|
|
|
/// Chain name
|
|
|
|
pub name: String, |
|
|
|
pub name: String, |
|
|
|
/// Chain domain identifier
|
|
|
|
/// Chain domain identifier
|
|
|
|
pub domain: String, |
|
|
|
pub domain: StrOrInt, |
|
|
|
/// Signer configuration for this chain
|
|
|
|
/// Signer configuration for this chain
|
|
|
|
pub signer: Option<SignerConf>, |
|
|
|
pub signer: Option<SignerConf>, |
|
|
|
/// Number of blocks until finality
|
|
|
|
/// Number of blocks until finality
|
|
|
|
pub finality_blocks: String, |
|
|
|
pub finality_blocks: StrOrInt, |
|
|
|
/// Addresses of contracts on the chain
|
|
|
|
/// Addresses of contracts on the chain
|
|
|
|
pub addresses: CoreContractAddresses, |
|
|
|
pub addresses: CoreContractAddresses, |
|
|
|
/// The chain connection details
|
|
|
|
/// The chain connection details
|
|
|
@ -313,14 +312,18 @@ impl ChainSetup { |
|
|
|
|
|
|
|
|
|
|
|
/// Get the domain for this chain setup
|
|
|
|
/// Get the domain for this chain setup
|
|
|
|
pub fn domain(&self) -> Result<HyperlaneDomain> { |
|
|
|
pub fn domain(&self) -> Result<HyperlaneDomain> { |
|
|
|
HyperlaneDomain::from_config_strs(&self.domain, &self.name, self.chain.protocol()) |
|
|
|
HyperlaneDomain::from_config( |
|
|
|
|
|
|
|
(&self.domain).try_into().context("Invalid domain id")?, |
|
|
|
|
|
|
|
&self.name, |
|
|
|
|
|
|
|
self.chain.protocol(), |
|
|
|
|
|
|
|
) |
|
|
|
.map_err(|e| eyre!("{e}")) |
|
|
|
.map_err(|e| eyre!("{e}")) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Get the number of blocks until finality
|
|
|
|
/// Get the number of blocks until finality
|
|
|
|
fn finality_blocks(&self) -> u32 { |
|
|
|
fn finality_blocks(&self) -> u32 { |
|
|
|
self.finality_blocks |
|
|
|
(&self.finality_blocks) |
|
|
|
.parse::<u32>() |
|
|
|
.try_into() |
|
|
|
.expect("could not parse finality_blocks") |
|
|
|
.expect("could not parse finality_blocks") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|