@@ -52,7 +52,6 @@ pub struct EventSignatureWithTopics {
5252}
5353
5454impl EventSignatureWithTopics {
55- #[ allow( dead_code) ]
5655 pub fn new (
5756 address : Option < Address > ,
5857 signature : B256 ,
@@ -73,7 +72,6 @@ impl EventSignatureWithTopics {
7372 /// If self.address is None, it's considered a wildcard match.
7473 /// Otherwise, it must match the provided address.
7574 /// It must also match the topics if they are Some
76- #[ allow( dead_code) ]
7775 pub fn matches ( & self , address : Option < & Address > , sig : B256 , topics : & [ B256 ] ) -> bool {
7876 // If self.address is None, it's considered a wildcard match. Otherwise, it must match the provided address.
7977 let address_matches = match self . address {
@@ -146,11 +144,11 @@ enum LogFilterNode {
146144/// Corresponds to an `eth_getLogs` call.
147145#[ derive( Clone , Debug ) ]
148146pub 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 > > ,
154152}
155153
156154impl EthGetLogsFilter {
@@ -175,7 +173,7 @@ impl EthGetLogsFilter {
175173 filter_builder
176174 }
177175
178- fn from_contract ( address : alloy :: primitives :: Address ) -> Self {
176+ fn from_contract ( address : Address ) -> Self {
179177 EthGetLogsFilter {
180178 contracts : vec ! [ address] ,
181179 event_signatures : vec ! [ ] ,
@@ -185,7 +183,7 @@ impl EthGetLogsFilter {
185183 }
186184 }
187185
188- fn from_event ( event : alloy :: primitives :: B256 ) -> Self {
186+ fn from_event ( event : B256 ) -> Self {
189187 EthGetLogsFilter {
190188 contracts : vec ! [ ] ,
191189 event_signatures : vec ! [ event] ,
@@ -225,7 +223,7 @@ impl fmt::Display for EthGetLogsFilter {
225223 } ;
226224
227225 // 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 {
229227 topics. as_ref ( ) . map_or_else (
230228 || "None" . to_string ( ) ,
231229 |ts| {
@@ -451,49 +449,6 @@ impl EthereumLogFilter {
451449 false
452450 }
453451
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-
497452 pub fn from_data_sources < ' a > ( iter : impl IntoIterator < Item = & ' a DataSource > ) -> Self {
498453 let mut this = EthereumLogFilter :: default ( ) ;
499454 for ds in iter {
@@ -596,7 +551,7 @@ impl EthereumLogFilter {
596551 filters. extend (
597552 self . wildcard_events
598553 . into_keys ( )
599- . map ( |event| EthGetLogsFilter :: from_event ( event ) ) ,
554+ . map ( EthGetLogsFilter :: from_event) ,
600555 ) ;
601556
602557 // Handle events with topic filters.
@@ -649,9 +604,7 @@ impl EthereumLogFilter {
649604 }
650605 filter. contracts . push ( address) ;
651606 }
652- LogFilterNode :: Event ( event_sig) => {
653- filter. event_signatures . push ( event_sig) ;
654- }
607+ LogFilterNode :: Event ( event_sig) => filter. event_signatures . push ( event_sig) ,
655608 }
656609 }
657610
@@ -1214,15 +1167,15 @@ pub trait EthereumAdapter: Send + Sync + 'static {
12141167 async fn get_balance (
12151168 & self ,
12161169 logger : & Logger ,
1217- address : alloy :: primitives :: Address ,
1170+ address : Address ,
12181171 block_ptr : BlockPtr ,
12191172 ) -> Result < alloy:: primitives:: U256 , EthereumRpcError > ;
12201173
12211174 // Returns the compiled bytecode of a smart contract
12221175 async fn get_code (
12231176 & self ,
12241177 logger : & Logger ,
1225- address : alloy :: primitives :: Address ,
1178+ address : Address ,
12261179 block_ptr : BlockPtr ,
12271180 ) -> Result < alloy:: primitives:: Bytes , EthereumRpcError > ;
12281181}
@@ -1807,14 +1760,10 @@ fn complete_log_filter() {
18071760
18081761 // Test a few combinations of complete graphs.
18091762 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 ( ) ;
18131764
18141765 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 ( ) ;
18181767
18191768 // Construct the complete bipartite graph with i events and j contracts.
18201769 let mut contracts_and_events_graph = GraphMap :: new ( ) ;
0 commit comments