pull/1311/head
Asa Oines 2 years ago
parent cba25f30e0
commit e6a3373979
  1. 17
      rust/abacus-base/src/contract_sync/mailbox.rs
  2. 2
      rust/abacus-core/src/traits/mod.rs
  3. 9
      rust/agents/scraper/src/chain_scraper/sync.rs
  4. 2
      solidity/contracts/middleware/InterchainAccountRouter.sol
  5. 4
      solidity/contracts/middleware/InterchainQueryRouter.sol
  6. 2
      solidity/interfaces/IInterchainAccountRouter.sol
  7. 2
      solidity/interfaces/IInterchainQueryRouter.sol

@ -2,8 +2,7 @@ use tracing::{debug, info, info_span, warn};
use tracing::{instrument::Instrumented, Instrument};
use abacus_core::{
name_from_domain_id, CommittedMessage, Indexer, ListValidity, OutboxIndexer,
SyncBlockRangeCursor,
name_from_domain_id, Indexer, ListValidity, MailboxIndexer, SyncBlockRangeCursor,
};
use crate::contract_sync::last_message::validate_message_continuity;
@ -16,7 +15,9 @@ where
I: MailboxIndexer + Clone + 'static,
{
/// Sync dispatched messages
pub fn sync_dispatched_messages(&self) -> Instrumented<tokio::task::JoinHandle<Result<()>>> {
pub fn sync_dispatched_messages(
&self,
) -> Instrumented<tokio::task::JoinHandle<eyre::Result<()>>> {
let span = info_span!("MessageContractSync");
let db = self.db.clone();
@ -238,11 +239,13 @@ mod test {
use tokio::time::{interval, sleep, timeout};
use abacus_core::{db::AbacusDB, AbacusMessage, LogMeta};
use abacus_test::mocks::cursor::MockSyncBlockRangeCursor;
use abacus_test::mocks::indexer::MockAbacusIndexer;
use abacus_test::test_utils;
use crate::contract_sync::mailbox::MOCK_CURSOR;
use crate::contract_sync::schema::OutboxContractSyncDB;
use crate::contract_sync::IndexSettings;
use crate::ContractSync;
use crate::{ContractSyncMetrics, CoreMetrics};
@ -267,6 +270,12 @@ mod test {
};
let messages = (0..10).map(message_gen).collect::<Vec<AbacusMessage>>();
let m0 = messages[0].clone();
let m1 = messages[1].clone();
let m2 = messages[2].clone();
let m3 = messages[3].clone();
let m4 = messages[4].clone();
let m5 = messages[5].clone();
let meta = || LogMeta {
address: Default::default(),
@ -306,7 +315,7 @@ mod test {
}
macro_rules! expect_fetches_range {
($expected_from:literal, $expected_to:literal, $return_messages:expr) => {
let messages: &[&RawCommittedMessage] = $return_messages;
let messages: &[&AbacusMessage] = $return_messages;
let messages = messages.iter().map(|&msg| (msg.clone(), meta())).collect();
mock_cursor
.expect__next_range()

@ -10,7 +10,6 @@ use ethers::{
providers::{Middleware, ProviderError},
};
pub use common::*;
pub use cursor::*;
pub use encode::*;
pub use indexer::*;
@ -21,7 +20,6 @@ pub use provider::*;
use crate::{db::DbError, AbacusError};
mod common;
mod cursor;
mod encode;
mod indexer;

@ -10,9 +10,7 @@ use prometheus::{IntCounter, IntGauge, IntGaugeVec};
use tracing::{debug, info, instrument, warn};
use abacus_base::last_message::validate_message_continuity;
use abacus_core::{
name_from_domain_id, CommittedMessage, ListValidity, OutboxIndexer, SyncBlockRangeCursor,
};
use abacus_core::{name_from_domain_id, ListValidity, MailboxIndexer, SyncBlockRangeCursor};
use crate::chain_scraper::{AbacusMessageWithMeta, Delivery, SqlChainScraper, TxnWithIdAndTime};
@ -32,7 +30,7 @@ pub(super) struct Syncer {
stored_deliveries: IntCounter,
missed_messages: IntCounter,
message_nonce: IntGaugeVec,
sync_cursor: RateLimitedSyncBlockRangeCursor<Arc<dyn OutboxIndexer>>,
sync_cursor: RateLimitedSyncBlockRangeCursor<Arc<dyn MailboxIndexer>>,
last_valid_range_start_block: u32,
last_nonce: u32,
@ -85,7 +83,7 @@ impl Syncer {
let last_nonce = scraper.last_message_nonce().await?.unwrap_or(0);
let sync_cursor = RateLimitedSyncBlockRangeCursor::new(
scraper.local.indexer.clone(),
scraper.contracts.indexer.clone(),
chunk_size,
initial_height,
)
@ -114,7 +112,6 @@ impl Syncer {
self.indexed_deliveries_height.set(start_block as i64);
loop {
debug_assert_eq!(self.local.outbox.local_domain(), self.local_domain());
let start_block = self.sync_cursor.current_position();
let (from, to) = match self.sync_cursor.next_range().await {
Ok(range) => range,

@ -49,7 +49,7 @@ contract InterchainAccountRouter is Router, IInterchainAccountRouter {
uint32 _destinationDomain,
address target,
bytes calldata data
) external returns (uint256) {
) external returns (bytes32) {
Call[] memory calls = new Call[](1);
calls[0] = Call({to: target, data: data});
return _dispatch(_destinationDomain, abi.encode(msg.sender, calls));

@ -55,13 +55,13 @@ contract InterchainQueryRouter is
address target,
bytes calldata queryData,
bytes calldata callback
) external returns (uint256 leafIndex) {
) external returns (bytes32 messageId) {
// TODO: fix this ugly arrayification
Call[] memory calls = new Call[](1);
calls[0] = Call({to: target, data: queryData});
bytes[] memory callbacks = new bytes[](1);
callbacks[0] = callback;
leafIndex = query(_destinationDomain, calls, callbacks);
messageId = query(_destinationDomain, calls, callbacks);
}
/**

@ -12,7 +12,7 @@ interface IInterchainAccountRouter {
uint32 _destinationDomain,
address target,
bytes calldata data
) external returns (uint256);
) external returns (bytes32);
function getInterchainAccount(uint32 _originDomain, address _sender)
external

@ -9,7 +9,7 @@ interface IInterchainQueryRouter {
address target,
bytes calldata queryData,
bytes calldata callback
) external returns (uint256);
) external returns (bytes32);
function query(
uint32 _destinationDomain,

Loading…
Cancel
Save