@ -10,13 +10,13 @@ use hyperlane_core::{
config ::OperationBatchConfig , AggregationIsm , CcipReadIsm , ContractLocator , HyperlaneAbi ,
config ::OperationBatchConfig , AggregationIsm , CcipReadIsm , ContractLocator , HyperlaneAbi ,
HyperlaneDomain , HyperlaneDomainProtocol , HyperlaneMessage , HyperlaneProvider , IndexMode ,
HyperlaneDomain , HyperlaneDomainProtocol , HyperlaneMessage , HyperlaneProvider , IndexMode ,
InterchainGasPaymaster , InterchainGasPayment , InterchainSecurityModule , Mailbox ,
InterchainGasPaymaster , InterchainGasPayment , InterchainSecurityModule , Mailbox ,
MerkleTreeHook , MerkleTreeInsertion , MultisigIsm , RoutingIsm , SequenceAwareIndexer ,
MerkleTreeHook , MerkleTreeInsertion , MultisigIsm , ReorgPeriod , RoutingIsm ,
ValidatorAnnounce , H256 ,
SequenceAwareIndexer , ValidatorAnnounce , H256 ,
} ;
} ;
use hyperlane_cosmos as h_cosmos ;
use hyperlane_cosmos as h_cosmos ;
use hyperlane_ethereum ::{
use hyperlane_ethereum ::{
self as h_eth , BuildableWithProvider , EthereumInterchainGasPaymasterAbi , EthereumMailboxAbi ,
self as h_eth , BuildableWithProvider , EthereumInterchainGasPaymasterAbi , EthereumMailboxAbi ,
EthereumValidatorAnnounceAbi ,
EthereumReorgPeriod , Ethereum ValidatorAnnounceAbi ,
} ;
} ;
use hyperlane_fuel as h_fuel ;
use hyperlane_fuel as h_fuel ;
use hyperlane_sealevel as h_sealevel ;
use hyperlane_sealevel as h_sealevel ;
@ -45,7 +45,7 @@ pub struct ChainConf {
/// Signer configuration for this chain
/// Signer configuration for this chain
pub signer : Option < SignerConf > ,
pub signer : Option < SignerConf > ,
/// The reorg period of the chain, i.e. the number of blocks until finality
/// The reorg period of the chain, i.e. the number of blocks until finality
pub reorg_period : u32 ,
pub reorg_period : ReorgPeriod ,
/// 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
@ -272,13 +272,13 @@ impl ChainConf {
match & self . connection {
match & self . connection {
ChainConnectionConf ::Ethereum ( conf ) = > {
ChainConnectionConf ::Ethereum ( conf ) = > {
let reorg_period =
EthereumReorgPeriod ::try_from ( & self . reorg_period ) . context ( ctx ) ? ;
self . build_ethereum (
self . build_ethereum (
conf ,
conf ,
& locator ,
& locator ,
metrics ,
metrics ,
h_eth ::SequenceIndexerBuilder {
h_eth ::SequenceIndexerBuilder { reorg_period } ,
reorg_period : self . reorg_period ,
} ,
)
)
. await
. await
}
}
@ -289,11 +289,12 @@ impl ChainConf {
}
}
ChainConnectionConf ::Cosmos ( conf ) = > {
ChainConnectionConf ::Cosmos ( conf ) = > {
let signer = self . cosmos_signer ( ) . await . context ( ctx ) ? ;
let signer = self . cosmos_signer ( ) . await . context ( ctx ) ? ;
let reorg_period = self . reorg_period . as_blocks ( ) . context ( ctx ) ? ;
let indexer = Box ::new ( h_cosmos ::CosmosMailboxDispatchIndexer ::new (
let indexer = Box ::new ( h_cosmos ::CosmosMailboxDispatchIndexer ::new (
conf . clone ( ) ,
conf . clone ( ) ,
locator ,
locator ,
signer ,
signer ,
self . reorg_period ,
reorg_period ,
) ? ) ;
) ? ) ;
Ok ( indexer as Box < dyn SequenceAwareIndexer < HyperlaneMessage > > )
Ok ( indexer as Box < dyn SequenceAwareIndexer < HyperlaneMessage > > )
}
}
@ -311,13 +312,13 @@ impl ChainConf {
match & self . connection {
match & self . connection {
ChainConnectionConf ::Ethereum ( conf ) = > {
ChainConnectionConf ::Ethereum ( conf ) = > {
let reorg_period =
EthereumReorgPeriod ::try_from ( & self . reorg_period ) . context ( ctx ) ? ;
self . build_ethereum (
self . build_ethereum (
conf ,
conf ,
& locator ,
& locator ,
metrics ,
metrics ,
h_eth ::DeliveryIndexerBuilder {
h_eth ::DeliveryIndexerBuilder { reorg_period } ,
reorg_period : self . reorg_period ,
} ,
)
)
. await
. await
}
}
@ -328,11 +329,12 @@ impl ChainConf {
}
}
ChainConnectionConf ::Cosmos ( conf ) = > {
ChainConnectionConf ::Cosmos ( conf ) = > {
let signer = self . cosmos_signer ( ) . await . context ( ctx ) ? ;
let signer = self . cosmos_signer ( ) . await . context ( ctx ) ? ;
let reorg_period = self . reorg_period . as_blocks ( ) . context ( ctx ) ? ;
let indexer = Box ::new ( h_cosmos ::CosmosMailboxDeliveryIndexer ::new (
let indexer = Box ::new ( h_cosmos ::CosmosMailboxDeliveryIndexer ::new (
conf . clone ( ) ,
conf . clone ( ) ,
locator ,
locator ,
signer ,
signer ,
self . reorg_period ,
reorg_period ,
) ? ) ;
) ? ) ;
Ok ( indexer as Box < dyn SequenceAwareIndexer < H256 > > )
Ok ( indexer as Box < dyn SequenceAwareIndexer < H256 > > )
}
}
@ -389,13 +391,15 @@ impl ChainConf {
match & self . connection {
match & self . connection {
ChainConnectionConf ::Ethereum ( conf ) = > {
ChainConnectionConf ::Ethereum ( conf ) = > {
let reorg_period =
EthereumReorgPeriod ::try_from ( & self . reorg_period ) . context ( ctx ) ? ;
self . build_ethereum (
self . build_ethereum (
conf ,
conf ,
& locator ,
& locator ,
metrics ,
metrics ,
h_eth ::InterchainGasPaymasterIndexerBuilder {
h_eth ::InterchainGasPaymasterIndexerBuilder {
mailbox_address : self . addresses . mailbox . into ( ) ,
mailbox_address : self . addresses . mailbox . into ( ) ,
reorg_period : self . reorg_period ,
reorg_period ,
} ,
} ,
)
)
. await
. await
@ -408,10 +412,11 @@ impl ChainConf {
Ok ( indexer as Box < dyn SequenceAwareIndexer < InterchainGasPayment > > )
Ok ( indexer as Box < dyn SequenceAwareIndexer < InterchainGasPayment > > )
}
}
ChainConnectionConf ::Cosmos ( conf ) = > {
ChainConnectionConf ::Cosmos ( conf ) = > {
let reorg_period = self . reorg_period . as_blocks ( ) . context ( ctx ) ? ;
let indexer = Box ::new ( h_cosmos ::CosmosInterchainGasPaymasterIndexer ::new (
let indexer = Box ::new ( h_cosmos ::CosmosInterchainGasPaymasterIndexer ::new (
conf . clone ( ) ,
conf . clone ( ) ,
locator ,
locator ,
self . reorg_period ,
reorg_period ,
) ? ) ;
) ? ) ;
Ok ( indexer as Box < dyn SequenceAwareIndexer < InterchainGasPayment > > )
Ok ( indexer as Box < dyn SequenceAwareIndexer < InterchainGasPayment > > )
}
}
@ -429,13 +434,13 @@ impl ChainConf {
match & self . connection {
match & self . connection {
ChainConnectionConf ::Ethereum ( conf ) = > {
ChainConnectionConf ::Ethereum ( conf ) = > {
let reorg_period =
EthereumReorgPeriod ::try_from ( & self . reorg_period ) . context ( ctx ) ? ;
self . build_ethereum (
self . build_ethereum (
conf ,
conf ,
& locator ,
& locator ,
metrics ,
metrics ,
h_eth ::MerkleTreeHookIndexerBuilder {
h_eth ::MerkleTreeHookIndexerBuilder { reorg_period } ,
reorg_period : self . reorg_period ,
} ,
)
)
. await
. await
}
}
@ -450,12 +455,13 @@ impl ChainConf {
}
}
ChainConnectionConf ::Cosmos ( conf ) = > {
ChainConnectionConf ::Cosmos ( conf ) = > {
let signer = self . cosmos_signer ( ) . await . context ( ctx ) ? ;
let signer = self . cosmos_signer ( ) . await . context ( ctx ) ? ;
let reorg_period = self . reorg_period . as_blocks ( ) . context ( ctx ) ? ;
let indexer = Box ::new ( h_cosmos ::CosmosMerkleTreeHookIndexer ::new (
let indexer = Box ::new ( h_cosmos ::CosmosMerkleTreeHookIndexer ::new (
conf . clone ( ) ,
conf . clone ( ) ,
locator ,
locator ,
// TODO: remove signer requirement entirely
// TODO: remove signer requirement entirely
signer ,
signer ,
self . reorg_period ,
reorg_period ,
) ? ) ;
) ? ) ;
Ok ( indexer as Box < dyn SequenceAwareIndexer < MerkleTreeInsertion > > )
Ok ( indexer as Box < dyn SequenceAwareIndexer < MerkleTreeInsertion > > )
}
}