Skip to content

Commit d1aaa04

Browse files
committed
fix: import and provider issues in test
1 parent 1a4905a commit d1aaa04

File tree

3 files changed

+5
-47
lines changed

3 files changed

+5
-47
lines changed

tests/common/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ pub mod setup_scanner;
66
pub mod test_counter;
77

88
pub(crate) use setup_scanner::{
9-
LiveScannerSetup, setup_common, setup_historic_scanner, setup_latest_scanner,
9+
LiveScannerSetup, SyncScannerSetup, setup_common, setup_historic_scanner, setup_latest_scanner,
1010
setup_live_scanner, setup_sync_from_latest_scanner, setup_sync_scanner,
1111
};
12-
pub(crate) use test_counter::{TestCounter, TestCounterExt, deploy_counter};
12+
pub(crate) use test_counter::{TestCounter, deploy_counter};
1313

1414
use alloy::{network::Ethereum, providers::ProviderBuilder};
1515
use alloy_node_bindings::{Anvil, AnvilInstance};

tests/common/test_counter.rs

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use alloy::{network::Ethereum, primitives::U256, providers::Provider, sol};
2-
use event_scanner::test_utils::LogMetadata;
1+
use alloy::{network::Ethereum, sol};
32

43
// Shared test contract used across integration tests
54
sol! {
@@ -37,41 +36,3 @@ where
3736
let contract = TestCounter::deploy(provider).await?;
3837
Ok(contract)
3938
}
40-
41-
#[allow(dead_code)]
42-
pub(crate) trait TestCounterExt {
43-
async fn increase_and_get_meta(
44-
&self,
45-
) -> anyhow::Result<LogMetadata<TestCounter::CountIncreased>>;
46-
async fn decrease_and_get_meta(
47-
&self,
48-
) -> anyhow::Result<LogMetadata<TestCounter::CountDecreased>>;
49-
}
50-
51-
impl<P: Provider + Clone> TestCounterExt for TestCounter::TestCounterInstance<P> {
52-
async fn increase_and_get_meta(
53-
&self,
54-
) -> anyhow::Result<LogMetadata<TestCounter::CountIncreased>> {
55-
let receipt = self.increase().send().await?.get_receipt().await?;
56-
let tx_hash = receipt.transaction_hash;
57-
let new_count = receipt.decoded_log::<TestCounter::CountIncreased>().unwrap().data.newCount;
58-
Ok(LogMetadata {
59-
event: TestCounter::CountIncreased { newCount: U256::from(new_count) },
60-
address: *self.address(),
61-
tx_hash,
62-
})
63-
}
64-
65-
async fn decrease_and_get_meta(
66-
&self,
67-
) -> anyhow::Result<LogMetadata<TestCounter::CountDecreased>> {
68-
let receipt = self.decrease().send().await?.get_receipt().await?;
69-
let tx_hash = receipt.transaction_hash;
70-
let new_count = receipt.decoded_log::<TestCounter::CountDecreased>().unwrap().data.newCount;
71-
Ok(LogMetadata {
72-
event: TestCounter::CountDecreased { newCount: U256::from(new_count) },
73-
address: *self.address(),
74-
tx_hash,
75-
})
76-
}
77-
}

tests/latest_events/basic.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
use alloy::{
2-
eips::BlockNumberOrTag,
3-
primitives::U256,
4-
providers::{Provider, ext::AnvilApi},
5-
sol_types::SolEvent,
2+
eips::BlockNumberOrTag, primitives::U256, providers::ext::AnvilApi, sol_types::SolEvent,
63
};
74

85
use crate::common::{TestCounter, deploy_counter, setup_common, setup_latest_scanner};
@@ -341,7 +338,7 @@ async fn latest_scanner_large_gaps_and_empty_ranges() -> anyhow::Result<()> {
341338

342339
#[tokio::test]
343340
async fn latest_scanner_boundary_range_single_block() -> anyhow::Result<()> {
344-
let (anvil, _provider, contract, default_filter) = setup_common(None, None).await?;
341+
let (_anvil, provider, contract, default_filter) = setup_common(None, None).await?;
345342

346343
contract.increase().send().await?.watch().await?;
347344
let receipt = contract.increase().send().await?.get_receipt().await?;

0 commit comments

Comments
 (0)