Replace `boxed_trait` macro (#467)

* remove macro

* Cleanup

* refactoring

* Cleanup

* Minor refactor

* minor cleanup

* more refactoring

* dedup a bit

* Attempt to fix pipeline
pull/482/head
Mattie Conover 3 years ago committed by GitHub
parent 87909f397c
commit 36cb6296ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 92
      rust/abacus-base/src/settings/chains.rs
  2. 50
      rust/abacus-base/src/settings/mod.rs
  3. 72
      rust/chains/abacus-ethereum/src/inbox.rs
  4. 45
      rust/chains/abacus-ethereum/src/lib.rs
  5. 48
      rust/chains/abacus-ethereum/src/macros.rs
  6. 93
      rust/chains/abacus-ethereum/src/outbox.rs
  7. 69
      rust/chains/abacus-ethereum/src/trait_builder.rs
  8. 47
      rust/chains/abacus-ethereum/src/validator_manager.rs

@ -2,7 +2,9 @@ use eyre::Report;
use serde::Deserialize;
use abacus_core::{ContractLocator, Signers};
use abacus_ethereum::{make_inbox, make_inbox_validator_manager, make_outbox, Connection};
use abacus_ethereum::{
Connection, InboxBuilder, InboxValidatorManagerBuilder, MakeableWithProvider, OutboxBuilder,
};
use crate::{
InboxValidatorManagerVariants, InboxValidatorManagers, InboxVariants, Inboxes, OutboxVariants,
@ -66,20 +68,21 @@ impl ChainSetup<OutboxAddresses> {
pub async fn try_into_outbox(&self, signer: Option<Signers>) -> Result<Outboxes, Report> {
match &self.chain {
ChainConf::Ethereum(conf) => Ok(OutboxVariants::Ethereum(
make_outbox(
conf.clone(),
&ContractLocator {
name: self.name.clone(),
domain: self.domain.parse().expect("invalid uint"),
address: self
.addresses
.outbox
.parse::<ethers::types::Address>()?
.into(),
},
signer,
)
.await?,
OutboxBuilder {}
.make_with_connection(
conf.clone(),
&ContractLocator {
name: self.name.clone(),
domain: self.domain.parse().expect("invalid uint"),
address: self
.addresses
.outbox
.parse::<ethers::types::Address>()?
.into(),
},
signer,
)
.await?,
)
.into()),
}
@ -91,20 +94,21 @@ impl ChainSetup<InboxAddresses> {
pub async fn try_into_inbox(&self, signer: Option<Signers>) -> Result<Inboxes, Report> {
match &self.chain {
ChainConf::Ethereum(conf) => Ok(InboxVariants::Ethereum(
make_inbox(
conf.clone(),
&ContractLocator {
name: self.name.clone(),
domain: self.domain.parse().expect("invalid uint"),
address: self
.addresses
.inbox
.parse::<ethers::types::Address>()?
.into(),
},
signer,
)
.await?,
InboxBuilder {}
.make_with_connection(
conf.clone(),
&ContractLocator {
name: self.name.clone(),
domain: self.domain.parse().expect("invalid uint"),
address: self
.addresses
.inbox
.parse::<ethers::types::Address>()?
.into(),
},
signer,
)
.await?,
)
.into()),
}
@ -119,21 +123,21 @@ impl ChainSetup<InboxAddresses> {
let inbox_address = self.addresses.inbox.parse::<ethers::types::Address>()?;
match &self.chain {
ChainConf::Ethereum(conf) => Ok(InboxValidatorManagerVariants::Ethereum(
make_inbox_validator_manager(
conf.clone(),
&ContractLocator {
name: self.name.clone(),
domain: self.domain.parse().expect("invalid uint"),
address: self
.addresses
.validator_manager
.parse::<ethers::types::Address>()?
.into(),
},
signer,
inbox_address,
)
.await?,
InboxValidatorManagerBuilder { inbox_address }
.make_with_connection(
conf.clone(),
&ContractLocator {
name: self.name.clone(),
domain: self.domain.parse().expect("invalid uint"),
address: self
.addresses
.validator_manager
.parse::<ethers::types::Address>()?
.into(),
},
signer,
)
.await?,
)
.into()),
}

@ -36,37 +36,37 @@
//! intended to be used by a specific agent.
//! E.g. `export OPT_KATHY_CHAT_TYPE="static message"`
use crate::{
AbacusAgentCore, AbacusCommonIndexers, CachingInbox, CachingOutbox, InboxContracts,
InboxValidatorManagers, OutboxIndexers,
};
use abacus_core::{
db::{AbacusDB, DB},
utils::HexString,
AbacusCommon, ContractLocator, Signers,
};
use abacus_ethereum::{make_inbox_indexer, make_outbox_indexer};
use std::{collections::HashMap, env, sync::Arc};
use config::{Config, ConfigError, Environment, File};
use ethers::prelude::AwsSigner;
use eyre::{bail, Report};
use once_cell::sync::OnceCell;
use rusoto_core::{credential::EnvironmentProvider, HttpClient};
use rusoto_kms::KmsClient;
use serde::Deserialize;
use std::{collections::HashMap, env, sync::Arc};
use tracing::instrument;
use abacus_core::{
db::{AbacusDB, DB},
utils::HexString,
AbacusCommon, ContractLocator, Signers,
};
use abacus_ethereum::{InboxIndexerBuilder, MakeableWithProvider, OutboxIndexerBuilder};
pub use chains::{ChainConf, ChainSetup, InboxAddresses, OutboxAddresses};
use crate::settings::trace::TracingConfig;
use crate::{
AbacusAgentCore, AbacusCommonIndexers, CachingInbox, CachingOutbox, InboxContracts,
InboxValidatorManagers, OutboxIndexers,
};
/// Chain configuartion
pub mod chains;
pub use chains::{ChainConf, ChainSetup, InboxAddresses, OutboxAddresses};
/// Tracing subscriber management
pub mod trace;
use crate::settings::trace::TracingConfig;
use once_cell::sync::OnceCell;
static KMS_CLIENT: OnceCell<KmsClient> = OnceCell::new();
/// Ethereum signer types
@ -279,7 +279,11 @@ impl Settings {
match &self.outbox.chain {
ChainConf::Ethereum(conn) => Ok(OutboxIndexers::Ethereum(
make_outbox_indexer(
OutboxIndexerBuilder {
from_height: self.index.from(),
chunk_size: self.index.chunk_size(),
}
.make_with_connection(
conn.clone(),
&ContractLocator {
name: self.outbox.name.clone(),
@ -292,8 +296,6 @@ impl Settings {
.into(),
},
signer,
self.index.from(),
self.index.chunk_size(),
)
.await?,
)),
@ -309,7 +311,11 @@ impl Settings {
match &setup.chain {
ChainConf::Ethereum(conn) => Ok(AbacusCommonIndexers::Ethereum(
make_inbox_indexer(
InboxIndexerBuilder {
from_height: self.index.from(),
chunk_size: self.index.chunk_size(),
}
.make_with_connection(
conn.clone(),
&ContractLocator {
name: setup.name.clone(),
@ -321,8 +327,6 @@ impl Settings {
.into(),
},
signer,
self.index.from(),
self.index.chunk_size(),
)
.await?,
)),

@ -5,16 +5,17 @@ use std::{error::Error as StdError, sync::Arc};
use async_trait::async_trait;
use ethers::contract::abigen;
use ethers::core::types::{H256, U256};
use ethers::prelude::*;
use eyre::Result;
use tracing::instrument;
use abacus_core::{accumulator::merkle::Proof, MessageStatus, *};
use abacus_core::{
AbacusCommon, AbacusCommonIndexer, AbacusMessage, ChainCommunicationError, Checkpoint,
CheckpointMeta, CheckpointWithMeta, ContractLocator, Inbox, TxOutcome,
accumulator::merkle::Proof, AbacusCommon, AbacusCommonIndexer, AbacusMessage,
ChainCommunicationError, Checkpoint, CheckpointMeta, CheckpointWithMeta, ContractLocator,
Encode, Inbox, MessageStatus, TxOutcome,
};
use crate::trait_builder::MakeableWithProvider;
use crate::tx::report_tx;
abigen!(
@ -28,18 +29,40 @@ abigen!(
impl<M> std::fmt::Display for EthereumInboxInternal<M>
where
M: ethers::providers::Middleware,
M: Middleware,
{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self)
}
}
pub struct InboxIndexerBuilder {
pub from_height: u32,
pub chunk_size: u32,
}
impl MakeableWithProvider for InboxIndexerBuilder {
type Output = Box<dyn AbacusCommonIndexer>;
fn make_with_provider<M: Middleware + 'static>(
&self,
provider: M,
locator: &ContractLocator,
) -> Self::Output {
Box::new(EthereumInboxIndexer::new(
Arc::new(provider),
locator,
self.from_height,
self.chunk_size,
))
}
}
#[derive(Debug)]
/// Struct that retrieves indexes event data for Ethereum inbox
pub struct EthereumInboxIndexer<M>
where
M: ethers::providers::Middleware,
M: Middleware,
{
contract: Arc<EthereumInboxInternal<M>>,
provider: Arc<M>,
@ -51,21 +74,20 @@ where
impl<M> EthereumInboxIndexer<M>
where
M: ethers::providers::Middleware + 'static,
M: Middleware + 'static,
{
/// Create new EthereumInboxIndexer
pub fn new(
provider: Arc<M>,
ContractLocator {
name: _,
domain: _,
address,
}: &ContractLocator,
locator: &ContractLocator,
from_height: u32,
chunk_size: u32,
) -> Self {
Self {
contract: Arc::new(EthereumInboxInternal::new(address, provider.clone())),
contract: Arc::new(EthereumInboxInternal::new(
&locator.address,
provider.clone(),
)),
provider,
from_height,
chunk_size,
@ -76,7 +98,7 @@ where
#[async_trait]
impl<M> AbacusCommonIndexer for EthereumInboxIndexer<M>
where
M: ethers::providers::Middleware + 'static,
M: Middleware + 'static,
{
#[instrument(err, skip(self))]
async fn get_block_number(&self) -> Result<u32> {
@ -128,11 +150,25 @@ where
}
}
pub struct InboxBuilder {}
impl MakeableWithProvider for InboxBuilder {
type Output = Box<dyn Inbox>;
fn make_with_provider<M: Middleware + 'static>(
&self,
provider: M,
locator: &ContractLocator,
) -> Self::Output {
Box::new(EthereumInbox::new(Arc::new(provider), locator))
}
}
/// A struct that provides access to an Ethereum inbox contract
#[derive(Debug)]
pub struct EthereumInbox<M>
where
M: ethers::providers::Middleware,
M: Middleware,
{
contract: Arc<EthereumInboxInternal<M>>,
domain: u32,
@ -142,7 +178,7 @@ where
impl<M> EthereumInbox<M>
where
M: ethers::providers::Middleware,
M: Middleware,
{
/// Create a reference to a inbox at a specific Ethereum address on some
/// chain
@ -166,7 +202,7 @@ where
#[async_trait]
impl<M> AbacusCommon for EthereumInbox<M>
where
M: ethers::providers::Middleware + 'static,
M: Middleware + 'static,
{
fn local_domain(&self) -> u32 {
self.domain
@ -230,7 +266,7 @@ where
#[async_trait]
impl<M> Inbox for EthereumInbox<M>
where
M: ethers::providers::Middleware + 'static,
M: Middleware + 'static,
{
async fn remote_domain(&self) -> Result<u32, ChainCommunicationError> {
Ok(self.contract.remote_domain().call().await?)

@ -4,10 +4,7 @@
#![warn(missing_docs)]
#![warn(unused_extern_crates)]
use std::sync::Arc;
use ethers::providers::Middleware;
use ethers::types::{Address, BlockId, BlockNumber, NameOrAddress, H160};
use ethers::prelude::*;
use eyre::Result;
use num::Num;
@ -15,17 +12,18 @@ use abacus_core::*;
pub use retrying::{RetryingProvider, RetryingProviderError};
#[cfg(not(doctest))]
pub use crate::{inbox::*, outbox::*, validator_manager::*};
pub use crate::{inbox::*, outbox::*, trait_builder::*, validator_manager::*};
#[cfg(not(doctest))]
mod tx;
#[macro_use]
mod macros;
/// Outbox abi
#[cfg(not(doctest))]
mod outbox;
#[cfg(not(doctest))]
mod trait_builder;
/// Inbox abi
#[cfg(not(doctest))]
mod inbox;
@ -65,35 +63,12 @@ impl Default for Connection {
/// A live connection to an ethereum-compatible chain.
pub struct Chain {
creation_metadata: Connection,
ethers: ethers::providers::Provider<ethers::providers::Http>,
ethers: Provider<Http>,
}
boxed_trait!(
make_outbox_indexer,
EthereumOutboxIndexer,
OutboxIndexer,
from_height: u32,
chunk_size: u32
);
boxed_trait!(
make_inbox_indexer,
EthereumInboxIndexer,
AbacusCommonIndexer,
from_height: u32,
chunk_size: u32
);
boxed_trait!(make_outbox, EthereumOutbox, Outbox,);
boxed_trait!(make_inbox, EthereumInbox, Inbox,);
boxed_trait!(
make_inbox_validator_manager,
EthereumInboxValidatorManager,
InboxValidatorManager,
inbox_address: Address
);
#[async_trait::async_trait]
impl abacus_core::Chain for Chain {
async fn query_balance(&self, addr: abacus_core::Address) -> Result<abacus_core::Balance> {
async fn query_balance(&self, addr: abacus_core::Address) -> Result<Balance> {
let balance = format!(
"{:x}",
self.ethers
@ -104,8 +79,6 @@ impl abacus_core::Chain for Chain {
.await?
);
Ok(abacus_core::Balance(num::BigInt::from_str_radix(
&balance, 16,
)?))
Ok(Balance(num::BigInt::from_str_radix(&balance, 16)?))
}
}

@ -1,48 +0,0 @@
macro_rules! boxed_trait {
(@finish $provider:expr, $abi:ident, $signer:ident, $($tail:tt)*) => {{
if let Some(signer) = $signer {
// If there's a provided signer, we want to manage every aspect
// locally
// First set the chain ID locally
let provider_chain_id = $provider.get_chainid().await?;
let signer = ethers::signers::Signer::with_chain_id(signer, provider_chain_id.as_u64());
// Manage the nonce locally
let address = ethers::prelude::Signer::address(&signer);
let provider =
ethers::middleware::nonce_manager::NonceManagerMiddleware::new($provider, address);
// Manage signing locally
let signing_provider = ethers::middleware::SignerMiddleware::new(provider, signer);
Box::new(crate::$abi::new(signing_provider.into(), $($tail)*))
} else {
Box::new(crate::$abi::new($provider, $($tail)*))
}
}};
(@ws $url:expr, $($tail:tt)*) => {{
let ws = ethers::providers::Ws::connect($url).await?;
let provider = Arc::new(ethers::providers::Provider::new(ws));
boxed_trait!(@finish provider, $($tail)*)
}};
(@http $url:expr, $($tail:tt)*) => {{
let provider: crate::RetryingProvider<ethers::providers::Http> = $url.parse()?;
let provider = Arc::new(ethers::providers::Provider::new(provider));
boxed_trait!(@finish provider, $($tail)*)
}};
($name:ident, $abi:ident, $trait:ident, $($n:ident:$t:ty),*) => {
#[doc = "Cast a contract locator to a live contract handle"]
pub async fn $name(conn: Connection, locator: &ContractLocator, signer: Option<Signers>, $($n:$t),*) -> eyre::Result<Box<dyn $trait>> {
let b: Box<dyn $trait> = match conn {
Connection::Http { url } => {
boxed_trait!(@http url, $abi, signer, locator, $($n),*)
}
Connection::Ws { url } => {
boxed_trait!(@ws url, $abi, signer, locator, $($n),*)
}
};
Ok(b)
}
};
}

@ -5,13 +5,17 @@ use std::{error::Error as StdError, sync::Arc};
use async_trait::async_trait;
use ethers::contract::abigen;
use ethers::core::types::H256;
use ethers::prelude::*;
use eyre::Result;
use tracing::instrument;
use abacus_core::*;
use abacus_core::{ChainCommunicationError, Message, RawCommittedMessage, TxOutcome};
use abacus_core::{
AbacusCommon, AbacusCommonIndexer, ChainCommunicationError, Checkpoint, CheckpointMeta,
CheckpointWithMeta, ContractLocator, Message, Outbox, OutboxIndexer, RawCommittedMessage,
State, TxOutcome,
};
use crate::trait_builder::MakeableWithProvider;
use crate::tx::report_tx;
abigen!(
@ -21,18 +25,40 @@ abigen!(
impl<M> std::fmt::Display for EthereumOutboxInternal<M>
where
M: ethers::providers::Middleware,
M: Middleware,
{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self)
}
}
pub struct OutboxIndexerBuilder {
pub from_height: u32,
pub chunk_size: u32,
}
impl MakeableWithProvider for OutboxIndexerBuilder {
type Output = Box<dyn OutboxIndexer>;
fn make_with_provider<M: Middleware + 'static>(
&self,
provider: M,
locator: &ContractLocator,
) -> Self::Output {
Box::new(EthereumOutboxIndexer::new(
Arc::new(provider),
locator,
self.from_height,
self.chunk_size,
))
}
}
#[derive(Debug)]
/// Struct that retrieves event data for an Ethereum outbox
pub struct EthereumOutboxIndexer<M>
where
M: ethers::providers::Middleware,
M: Middleware,
{
contract: Arc<EthereumOutboxInternal<M>>,
provider: Arc<M>,
@ -44,21 +70,20 @@ where
impl<M> EthereumOutboxIndexer<M>
where
M: ethers::providers::Middleware + 'static,
M: Middleware + 'static,
{
/// Create new EthereumOutboxIndexer
pub fn new(
provider: Arc<M>,
ContractLocator {
name: _,
domain: _,
address,
}: &ContractLocator,
locator: &ContractLocator,
from_height: u32,
chunk_size: u32,
) -> Self {
Self {
contract: Arc::new(EthereumOutboxInternal::new(address, provider.clone())),
contract: Arc::new(EthereumOutboxInternal::new(
&locator.address,
provider.clone(),
)),
provider,
from_height,
chunk_size,
@ -69,7 +94,7 @@ where
#[async_trait]
impl<M> AbacusCommonIndexer for EthereumOutboxIndexer<M>
where
M: ethers::providers::Middleware + 'static,
M: Middleware + 'static,
{
#[instrument(err, skip(self))]
async fn get_block_number(&self) -> Result<u32> {
@ -124,7 +149,7 @@ where
#[async_trait]
impl<M> OutboxIndexer for EthereumOutboxIndexer<M>
where
M: ethers::providers::Middleware + 'static,
M: Middleware + 'static,
{
#[instrument(err, skip(self))]
async fn fetch_sorted_messages(&self, from: u32, to: u32) -> Result<Vec<RawCommittedMessage>> {
@ -148,11 +173,25 @@ where
}
}
pub struct OutboxBuilder {}
impl MakeableWithProvider for OutboxBuilder {
type Output = Box<dyn Outbox>;
fn make_with_provider<M: Middleware + 'static>(
&self,
provider: M,
locator: &ContractLocator,
) -> Self::Output {
Box::new(EthereumOutbox::new(Arc::new(provider), locator))
}
}
/// A reference to an Outbox contract on some Ethereum chain
#[derive(Debug)]
pub struct EthereumOutbox<M>
where
M: ethers::providers::Middleware,
M: Middleware,
{
contract: Arc<EthereumOutboxInternal<M>>,
domain: u32,
@ -162,22 +201,18 @@ where
impl<M> EthereumOutbox<M>
where
M: ethers::providers::Middleware + 'static,
M: Middleware + 'static,
{
/// Create a reference to a outbox at a specific Ethereum address on some
/// chain
pub fn new(
provider: Arc<M>,
ContractLocator {
name,
domain,
address,
}: &ContractLocator,
) -> Self {
pub fn new(provider: Arc<M>, locator: &ContractLocator) -> Self {
Self {
contract: Arc::new(EthereumOutboxInternal::new(address, provider.clone())),
domain: *domain,
name: name.to_owned(),
contract: Arc::new(EthereumOutboxInternal::new(
&locator.address,
provider.clone(),
)),
domain: locator.domain,
name: locator.name.to_owned(),
provider,
}
}
@ -186,7 +221,7 @@ where
#[async_trait]
impl<M> AbacusCommon for EthereumOutbox<M>
where
M: ethers::providers::Middleware + 'static,
M: Middleware + 'static,
{
fn local_domain(&self) -> u32 {
self.domain
@ -249,7 +284,7 @@ where
#[async_trait]
impl<M> Outbox for EthereumOutbox<M>
where
M: ethers::providers::Middleware + 'static,
M: Middleware + 'static,
{
#[tracing::instrument(err, skip(self))]
async fn dispatch(&self, message: &Message) -> Result<TxOutcome, ChainCommunicationError> {

@ -0,0 +1,69 @@
use std::sync::Arc;
use async_trait::async_trait;
use ethers::prelude::*;
use abacus_core::{ContractLocator, Signers};
use crate::Connection;
/// A trait for dynamic trait creation with provider initialization.
#[async_trait]
pub trait MakeableWithProvider {
/// The type that will be created.
type Output;
/// Construct a new instance of the associated trait using a connection config.
async fn make_with_connection(
&self,
conn: Connection,
locator: &ContractLocator,
signer: Option<Signers>,
) -> eyre::Result<Self::Output> {
Ok(match conn {
Connection::Http { url } => {
let provider: crate::RetryingProvider<Http> = url.parse()?;
let provider = Arc::new(Provider::new(provider));
if let Some(signer) = signer {
let signing_provider = make_signing_provider(provider, signer).await?;
self.make_with_provider(signing_provider, locator)
} else {
self.make_with_provider(provider, locator)
}
}
Connection::Ws { url } => {
let ws = Ws::connect(url).await?;
let provider = Arc::new(Provider::new(ws));
if let Some(signer) = signer {
let signing_provider = make_signing_provider(provider, signer).await?;
self.make_with_provider(signing_provider, locator)
} else {
self.make_with_provider(provider, locator)
}
}
})
}
/// Construct a new instance of the associated trait using a provider.
fn make_with_provider<M: Middleware + 'static>(
&self,
provider: M,
locator: &ContractLocator,
) -> Self::Output;
}
async fn make_signing_provider<M: Middleware>(
provider: M,
signer: Signers,
) -> Result<SignerMiddleware<NonceManagerMiddleware<M>, Signers>, M::Error> {
let provider_chain_id = provider.get_chainid().await?;
let signer = ethers::signers::Signer::with_chain_id(signer, provider_chain_id.as_u64());
let address = ethers::prelude::Signer::address(&signer);
let provider = NonceManagerMiddleware::new(provider, address);
let signing_provider = SignerMiddleware::new(provider, signer);
Ok(signing_provider)
}

@ -5,12 +5,13 @@ use std::sync::Arc;
use async_trait::async_trait;
use ethers::contract::abigen;
use ethers::core::types::Address;
use ethers::prelude::*;
use eyre::Result;
use abacus_core::{ChainCommunicationError, ContractLocator, TxOutcome};
use abacus_core::{InboxValidatorManager, MultisigSignedCheckpoint};
use crate::trait_builder::MakeableWithProvider;
use crate::tx::report_tx;
abigen!(
@ -20,18 +21,38 @@ abigen!(
impl<M> std::fmt::Display for EthereumInboxValidatorManagerInternal<M>
where
M: ethers::providers::Middleware,
M: Middleware,
{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self)
}
}
pub struct InboxValidatorManagerBuilder {
pub inbox_address: Address,
}
impl MakeableWithProvider for InboxValidatorManagerBuilder {
type Output = Box<dyn InboxValidatorManager>;
fn make_with_provider<M: Middleware + 'static>(
&self,
provider: M,
locator: &ContractLocator,
) -> Self::Output {
Box::new(EthereumInboxValidatorManager::new(
Arc::new(provider),
locator,
self.inbox_address,
))
}
}
/// A struct that provides access to an Ethereum InboxValidatorManager contract
#[derive(Debug)]
pub struct EthereumInboxValidatorManager<M>
where
M: ethers::providers::Middleware,
M: Middleware,
{
contract: Arc<EthereumInboxValidatorManagerInternal<M>>,
#[allow(unused)]
@ -45,26 +66,18 @@ where
impl<M> EthereumInboxValidatorManager<M>
where
M: ethers::providers::Middleware,
M: Middleware,
{
/// Create a reference to a inbox at a specific Ethereum address on some
/// chain
pub fn new(
provider: Arc<M>,
ContractLocator {
name,
domain,
address,
}: &ContractLocator,
inbox_address: Address,
) -> Self {
pub fn new(provider: Arc<M>, locator: &ContractLocator, inbox_address: Address) -> Self {
Self {
contract: Arc::new(EthereumInboxValidatorManagerInternal::new(
address,
&locator.address,
provider.clone(),
)),
domain: *domain,
name: name.to_owned(),
domain: locator.domain,
name: locator.name.to_owned(),
provider,
inbox_address,
}
@ -74,7 +87,7 @@ where
#[async_trait]
impl<M> InboxValidatorManager for EthereumInboxValidatorManager<M>
where
M: ethers::providers::Middleware + 'static,
M: Middleware + 'static,
{
#[tracing::instrument(err, skip(self))]
async fn submit_checkpoint(

Loading…
Cancel
Save