Filter by outbox address (#820)

pull/859/head
Trevor Porter 2 years ago committed by GitHub
parent f0c45a1068
commit f24aa96a0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      rust/abacus-base/src/settings/mod.rs
  2. 20
      rust/chains/abacus-ethereum/abis/InterchainGasPaymaster.abi.json
  3. 6
      rust/chains/abacus-ethereum/src/interchain_gas.rs
  4. 16
      rust/utils/run-locally/src/main.rs

@ -391,6 +391,11 @@ impl Settings {
match &self.outbox.chain { match &self.outbox.chain {
ChainConf::Ethereum(conn) => Ok(InterchainGasPaymasterIndexers::Ethereum( ChainConf::Ethereum(conn) => Ok(InterchainGasPaymasterIndexers::Ethereum(
InterchainGasPaymasterIndexerBuilder { InterchainGasPaymasterIndexerBuilder {
outbox_address: self
.outbox
.addresses
.outbox
.parse::<ethers::types::Address>()?,
from_height: self.index.from(), from_height: self.index.from(),
chunk_size: self.index.chunk_size(), chunk_size: self.index.chunk_size(),
finality_blocks: self.outbox.finality_blocks(), finality_blocks: self.outbox.finality_blocks(),

@ -29,6 +29,19 @@
"name": "GasPayment", "name": "GasPayment",
"type": "event" "type": "event"
}, },
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint8",
"name": "version",
"type": "uint8"
}
],
"name": "Initialized",
"type": "event"
},
{ {
"anonymous": false, "anonymous": false,
"inputs": [ "inputs": [
@ -55,6 +68,13 @@
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "function" "type": "function"
}, },
{
"inputs": [],
"name": "initialize",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{ {
"inputs": [], "inputs": [],
"name": "owner", "name": "owner",

@ -30,6 +30,7 @@ where
} }
pub struct InterchainGasPaymasterIndexerBuilder { pub struct InterchainGasPaymasterIndexerBuilder {
pub outbox_address: H160,
pub from_height: u32, pub from_height: u32,
pub chunk_size: u32, pub chunk_size: u32,
pub finality_blocks: u32, pub finality_blocks: u32,
@ -46,6 +47,7 @@ impl MakeableWithProvider for InterchainGasPaymasterIndexerBuilder {
Box::new(EthereumInterchainGasPaymasterIndexer::new( Box::new(EthereumInterchainGasPaymasterIndexer::new(
Arc::new(provider), Arc::new(provider),
locator, locator,
self.outbox_address,
self.from_height, self.from_height,
self.chunk_size, self.chunk_size,
self.finality_blocks, self.finality_blocks,
@ -61,6 +63,7 @@ where
{ {
contract: Arc<EthereumInterchainGasPaymasterInternal<M>>, contract: Arc<EthereumInterchainGasPaymasterInternal<M>>,
provider: Arc<M>, provider: Arc<M>,
outbox_address: H160,
#[allow(unused)] #[allow(unused)]
from_height: u32, from_height: u32,
#[allow(unused)] #[allow(unused)]
@ -76,6 +79,7 @@ where
pub fn new( pub fn new(
provider: Arc<M>, provider: Arc<M>,
locator: &ContractLocator, locator: &ContractLocator,
outbox_address: H160,
from_height: u32, from_height: u32,
chunk_size: u32, chunk_size: u32,
finality_blocks: u32, finality_blocks: u32,
@ -86,6 +90,7 @@ where
provider.clone(), provider.clone(),
)), )),
provider, provider,
outbox_address,
from_height, from_height,
chunk_size, chunk_size,
finality_blocks, finality_blocks,
@ -123,6 +128,7 @@ where
let events = self let events = self
.contract .contract
.gas_payment_filter() .gas_payment_filter()
.topic1(self.outbox_address)
.from_block(from_block) .from_block(from_block)
.to_block(to_block) .to_block(to_block)
.query_with_meta() .query_with_meta()

@ -456,6 +456,22 @@ fn assert_termination_invariants(num_expected_messages_processed: u32) {
num_expected_messages_processed, num_expected_messages_processed,
msg_processed_count.into_iter().sum::<u32>() msg_processed_count.into_iter().sum::<u32>()
); );
let gas_payment_events_count = ureq::get("http://127.0.0.1:9092/metrics")
.call()
.unwrap()
.into_string()
.unwrap()
.lines()
.filter(|l| l.starts_with("abacus_contract_sync_stored_events"))
.filter(|l| l.contains(r#"data_type="gas_payments""#))
.map(|l| l.rsplit_once(' ').unwrap().1.parse::<u32>().unwrap())
.next()
.unwrap();
assert!(
gas_payment_events_count >= num_expected_messages_processed,
"Synced gas payment event count is less than the number of messages"
);
} }
/// Basically `tail -f file | grep <FILTER>` but also has to write to the file (writes to file all /// Basically `tail -f file | grep <FILTER>` but also has to write to the file (writes to file all

Loading…
Cancel
Save