Skip to content

Commit

Permalink
don't screw up mumbai
Browse files Browse the repository at this point in the history
  • Loading branch information
tkporter committed Mar 16, 2024
1 parent 07a3616 commit 3d21893
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
11 changes: 9 additions & 2 deletions rust/chains/hyperlane-ethereum/src/interchain_gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use ethers::prelude::Middleware;
use hyperlane_core::{
ChainCommunicationError, ChainResult, ContractLocator, HyperlaneAbi, HyperlaneChain,
HyperlaneContract, HyperlaneDomain, HyperlaneProvider, Indexer, InterchainGasPaymaster,
InterchainGasPayment, LogMeta, SequenceAwareIndexer, H160, H256,
InterchainGasPayment, KnownHyperlaneDomain, LogMeta, SequenceAwareIndexer, H160, H256,
};
use tracing::instrument;

Expand Down Expand Up @@ -60,6 +60,7 @@ where
contract: Arc<EthereumInterchainGasPaymasterInternal<M>>,
provider: Arc<M>,
reorg_period: u32,
domain: HyperlaneDomain,
}

impl<M> EthereumInterchainGasPaymasterIndexer<M>
Expand All @@ -75,6 +76,7 @@ where
)),
provider,
reorg_period,
domain: locator.domain.clone(),
}
}
}
Expand All @@ -91,7 +93,12 @@ where
range: RangeInclusive<u32>,
) -> ChainResult<Vec<(InterchainGasPayment, LogMeta)>> {
let mut filter = self.contract.gas_payment_filter();
filter.filter.address = None;
if !matches!(
self.domain,
HyperlaneDomain::Known(KnownHyperlaneDomain::Mumbai)
) {
filter.filter.address = None;
}

let events = filter
// let events = self
Expand Down
17 changes: 15 additions & 2 deletions rust/chains/hyperlane-ethereum/src/mailbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use async_trait::async_trait;
use ethers::abi::AbiEncode;
use ethers::prelude::Middleware;
use ethers_contract::builders::ContractCall;
use hyperlane_core::KnownHyperlaneDomain;
use tracing::instrument;

use hyperlane_core::{
Expand Down Expand Up @@ -85,6 +86,7 @@ where
contract: Arc<EthereumMailboxInternal<M>>,
provider: Arc<M>,
reorg_period: u32,
domain: HyperlaneDomain,
}

impl<M> EthereumMailboxIndexer<M>
Expand All @@ -101,6 +103,7 @@ where
contract,
provider,
reorg_period,
domain: locator.domain.clone(),
}
}

Expand Down Expand Up @@ -132,7 +135,12 @@ where
range: RangeInclusive<u32>,
) -> ChainResult<Vec<(HyperlaneMessage, LogMeta)>> {
let mut filter = self.contract.dispatch_filter();
filter.filter.address = None;
if !matches!(
self.domain,
HyperlaneDomain::Known(KnownHyperlaneDomain::Mumbai)
) {
filter.filter.address = None;
}
let mut events: Vec<(HyperlaneMessage, LogMeta)> = filter
// let mut events: Vec<(HyperlaneMessage, LogMeta)> = self
// .contract
Expand Down Expand Up @@ -176,7 +184,12 @@ where
#[instrument(err, skip(self))]
async fn fetch_logs(&self, range: RangeInclusive<u32>) -> ChainResult<Vec<(H256, LogMeta)>> {
let mut filter = self.contract.process_id_filter();
filter.filter.address = None;
if !matches!(
self.domain,
HyperlaneDomain::Known(KnownHyperlaneDomain::Mumbai)
) {
filter.filter.address = None;
}

Ok(filter
.from_block(*range.start())
Expand Down
14 changes: 11 additions & 3 deletions rust/chains/hyperlane-ethereum/src/merkle_tree_hook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use tracing::instrument;

use hyperlane_core::{
ChainCommunicationError, ChainResult, Checkpoint, ContractLocator, HyperlaneChain,
HyperlaneContract, HyperlaneDomain, HyperlaneProvider, Indexer, LogMeta, MerkleTreeHook,
MerkleTreeInsertion, SequenceAwareIndexer, H256,
HyperlaneContract, HyperlaneDomain, HyperlaneProvider, Indexer, KnownHyperlaneDomain, LogMeta,
MerkleTreeHook, MerkleTreeInsertion, SequenceAwareIndexer, H256,
};

use crate::contracts::merkle_tree_hook::{MerkleTreeHook as MerkleTreeHookContract, Tree};
Expand Down Expand Up @@ -81,6 +81,7 @@ where
contract: Arc<MerkleTreeHookContract<M>>,
provider: Arc<M>,
reorg_period: u32,
domain: HyperlaneDomain,
}

impl<M> EthereumMerkleTreeHookIndexer<M>
Expand All @@ -96,6 +97,7 @@ where
)),
provider,
reorg_period,
domain: locator.domain.clone(),
}
}
}
Expand All @@ -112,7 +114,13 @@ where
range: RangeInclusive<u32>,
) -> ChainResult<Vec<(MerkleTreeInsertion, LogMeta)>> {
let mut filter = self.contract.inserted_into_tree_filter();
filter.filter.address = None;
if !matches!(
self.domain,
HyperlaneDomain::Known(KnownHyperlaneDomain::Mumbai)
) {
filter.filter.address = None;
}

let events = filter
.from_block(*range.start())
.to_block(*range.end())
Expand Down

0 comments on commit 3d21893

Please sign in to comment.