@@ -52,7 +52,6 @@ pub struct EventSignatureWithTopics {
52
52
}
53
53
54
54
impl EventSignatureWithTopics {
55
- #[ allow( dead_code) ]
56
55
pub fn new (
57
56
address : Option < Address > ,
58
57
signature : B256 ,
@@ -73,7 +72,6 @@ impl EventSignatureWithTopics {
73
72
/// If self.address is None, it's considered a wildcard match.
74
73
/// Otherwise, it must match the provided address.
75
74
/// It must also match the topics if they are Some
76
- #[ allow( dead_code) ]
77
75
pub fn matches ( & self , address : Option < & Address > , sig : B256 , topics : & [ B256 ] ) -> bool {
78
76
// If self.address is None, it's considered a wildcard match. Otherwise, it must match the provided address.
79
77
let address_matches = match self . address {
@@ -146,11 +144,11 @@ enum LogFilterNode {
146
144
/// Corresponds to an `eth_getLogs` call.
147
145
#[ derive( Clone , Debug ) ]
148
146
pub struct EthGetLogsFilter {
149
- pub contracts : Vec < alloy :: primitives :: Address > ,
150
- pub event_signatures : Vec < alloy :: primitives :: B256 > ,
151
- pub topic1 : Option < Vec < alloy :: primitives :: B256 > > ,
152
- pub topic2 : Option < Vec < alloy :: primitives :: B256 > > ,
153
- pub topic3 : Option < Vec < alloy :: primitives :: B256 > > ,
147
+ pub contracts : Vec < Address > ,
148
+ pub event_signatures : Vec < B256 > ,
149
+ pub topic1 : Option < Vec < B256 > > ,
150
+ pub topic2 : Option < Vec < B256 > > ,
151
+ pub topic3 : Option < Vec < B256 > > ,
154
152
}
155
153
156
154
impl EthGetLogsFilter {
@@ -175,7 +173,7 @@ impl EthGetLogsFilter {
175
173
filter_builder
176
174
}
177
175
178
- fn from_contract ( address : alloy :: primitives :: Address ) -> Self {
176
+ fn from_contract ( address : Address ) -> Self {
179
177
EthGetLogsFilter {
180
178
contracts : vec ! [ address] ,
181
179
event_signatures : vec ! [ ] ,
@@ -185,7 +183,7 @@ impl EthGetLogsFilter {
185
183
}
186
184
}
187
185
188
- fn from_event ( event : alloy :: primitives :: B256 ) -> Self {
186
+ fn from_event ( event : B256 ) -> Self {
189
187
EthGetLogsFilter {
190
188
contracts : vec ! [ ] ,
191
189
event_signatures : vec ! [ event] ,
@@ -225,7 +223,7 @@ impl fmt::Display for EthGetLogsFilter {
225
223
} ;
226
224
227
225
// Helper to format topics as strings
228
- let format_topics = |topics : & Option < Vec < alloy :: primitives :: B256 > > | -> String {
226
+ let format_topics = |topics : & Option < Vec < B256 > > | -> String {
229
227
topics. as_ref ( ) . map_or_else (
230
228
|| "None" . to_string ( ) ,
231
229
|ts| {
@@ -451,49 +449,6 @@ impl EthereumLogFilter {
451
449
false
452
450
}
453
451
454
- /// Similar to [`matches`], checks if a transaction receipt is required for this log filter.
455
- pub fn requires_transaction_receipt_alloy (
456
- & self ,
457
- event_signature : & alloy:: primitives:: B256 ,
458
- contract_address : Option < & alloy:: primitives:: Address > ,
459
- topics : & [ alloy:: primitives:: B256 ] ,
460
- ) -> bool {
461
- // Check for wildcard events first.
462
- if self . wildcard_events . get ( event_signature) == Some ( & true ) {
463
- return true ;
464
- }
465
-
466
- // Next, check events with topic filters.
467
- if self
468
- . events_with_topic_filters
469
- . iter ( )
470
- . any ( |( event_with_topics, & requires_receipt) | {
471
- requires_receipt
472
- && event_with_topics. matches ( contract_address, * event_signature, topics)
473
- } )
474
- {
475
- return true ;
476
- }
477
-
478
- // Finally, check the contracts_and_events_graph if a contract address is specified.
479
- if let Some ( address) = contract_address {
480
- let contract_node = LogFilterNode :: Contract ( * address) ;
481
- let event_node = LogFilterNode :: Event ( * event_signature) ;
482
-
483
- // Directly iterate over all edges and return true if a matching edge that requires a receipt is found.
484
- for ( s, t, & r) in self . contracts_and_events_graph . all_edges ( ) {
485
- if r && ( ( s == contract_node && t == event_node)
486
- || ( t == contract_node && s == event_node) )
487
- {
488
- return true ;
489
- }
490
- }
491
- }
492
-
493
- // If none of the conditions above match, return false.
494
- false
495
- }
496
-
497
452
pub fn from_data_sources < ' a > ( iter : impl IntoIterator < Item = & ' a DataSource > ) -> Self {
498
453
let mut this = EthereumLogFilter :: default ( ) ;
499
454
for ds in iter {
@@ -596,7 +551,7 @@ impl EthereumLogFilter {
596
551
filters. extend (
597
552
self . wildcard_events
598
553
. into_keys ( )
599
- . map ( |event| EthGetLogsFilter :: from_event ( event ) ) ,
554
+ . map ( EthGetLogsFilter :: from_event) ,
600
555
) ;
601
556
602
557
// Handle events with topic filters.
@@ -649,9 +604,7 @@ impl EthereumLogFilter {
649
604
}
650
605
filter. contracts . push ( address) ;
651
606
}
652
- LogFilterNode :: Event ( event_sig) => {
653
- filter. event_signatures . push ( event_sig) ;
654
- }
607
+ LogFilterNode :: Event ( event_sig) => filter. event_signatures . push ( event_sig) ,
655
608
}
656
609
}
657
610
@@ -1214,15 +1167,15 @@ pub trait EthereumAdapter: Send + Sync + 'static {
1214
1167
async fn get_balance (
1215
1168
& self ,
1216
1169
logger : & Logger ,
1217
- address : alloy :: primitives :: Address ,
1170
+ address : Address ,
1218
1171
block_ptr : BlockPtr ,
1219
1172
) -> Result < alloy:: primitives:: U256 , EthereumRpcError > ;
1220
1173
1221
1174
// Returns the compiled bytecode of a smart contract
1222
1175
async fn get_code (
1223
1176
& self ,
1224
1177
logger : & Logger ,
1225
- address : alloy :: primitives :: Address ,
1178
+ address : Address ,
1226
1179
block_ptr : BlockPtr ,
1227
1180
) -> Result < alloy:: primitives:: Bytes , EthereumRpcError > ;
1228
1181
}
@@ -1807,14 +1760,10 @@ fn complete_log_filter() {
1807
1760
1808
1761
// Test a few combinations of complete graphs.
1809
1762
for i in [ 1 , 2 ] {
1810
- let events: BTreeSet < _ > = ( 0 ..i)
1811
- . map ( |n| alloy:: primitives:: B256 :: from ( [ n as u8 ; 32 ] ) )
1812
- . collect ( ) ;
1763
+ let events: BTreeSet < _ > = ( 0 ..i) . map ( |n| B256 :: from ( [ n as u8 ; 32 ] ) ) . collect ( ) ;
1813
1764
1814
1765
for j in [ 1 , 1000 , 2000 , 3000 ] {
1815
- let contracts: BTreeSet < _ > = ( 0 ..j)
1816
- . map ( |n| alloy:: primitives:: Address :: from ( [ n as u8 ; 20 ] ) )
1817
- . collect ( ) ;
1766
+ let contracts: BTreeSet < _ > = ( 0 ..j) . map ( |n| Address :: from ( [ n as u8 ; 20 ] ) ) . collect ( ) ;
1818
1767
1819
1768
// Construct the complete bipartite graph with i events and j contracts.
1820
1769
let mut contracts_and_events_graph = GraphMap :: new ( ) ;
0 commit comments