@@ -90,52 +90,70 @@ pub fn termination_invariants_met(
9090 const TX_ID_INDEXING_LOG_MESSAGE : & str = "Found log(s) for tx id" ;
9191
9292 let relayer_logfile = File :: open ( log_file_path) ?;
93- let invariant_logs = & [
94- STORING_NEW_MESSAGE_LOG_MESSAGE ,
95- LOOKING_FOR_EVENTS_LOG_MESSAGE ,
96- GAS_EXPENDITURE_LOG_MESSAGE ,
97- HYPER_INCOMING_BODY_LOG_MESSAGE ,
98- TX_ID_INDEXING_LOG_MESSAGE ,
93+
94+ let storing_new_msg_line_filter = vec ! [ STORING_NEW_MESSAGE_LOG_MESSAGE ] ;
95+ let looking_for_events_line_filter = vec ! [ LOOKING_FOR_EVENTS_LOG_MESSAGE ] ;
96+ let gas_expenditure_line_filter = vec ! [ GAS_EXPENDITURE_LOG_MESSAGE ] ;
97+ let hyper_incoming_body_line_filter = vec ! [ HYPER_INCOMING_BODY_LOG_MESSAGE ] ;
98+ let tx_id_indexing_line_filter = vec ! [ TX_ID_INDEXING_LOG_MESSAGE ] ;
99+ let invariant_logs = vec ! [
100+ storing_new_msg_line_filter. clone( ) ,
101+ looking_for_events_line_filter. clone( ) ,
102+ gas_expenditure_line_filter. clone( ) ,
103+ hyper_incoming_body_line_filter. clone( ) ,
104+ tx_id_indexing_line_filter. clone( ) ,
99105 ] ;
100106 let log_counts = get_matching_lines ( & relayer_logfile, invariant_logs) ;
107+
101108 // Zero insertion messages don't reach `submit` stage where gas is spent, so we only expect these logs for the other messages.
102109 // TODO: Sometimes we find more logs than expected. This may either mean that gas is deducted twice for the same message due to a bug,
103110 // or that submitting the message transaction fails for some messages. Figure out which is the case and convert this check to
104111 // strict equality.
105112 // EDIT: Having had a quick look, it seems like there are some legitimate reverts happening in the confirm step
106113 // (`Transaction attempting to process message either reverted or was reorged`)
107114 // in which case more gas expenditure logs than messages are expected.
108- let gas_expenditure_log_count = log_counts. get ( GAS_EXPENDITURE_LOG_MESSAGE ) . unwrap ( ) ;
115+ let gas_expenditure_log_count = * log_counts
116+ . get ( & gas_expenditure_line_filter)
117+ . expect ( "Failed to get gas expenditure log count" ) ;
109118 assert ! (
110- gas_expenditure_log_count >= & total_messages_expected,
119+ gas_expenditure_log_count >= total_messages_expected,
111120 "Didn't record gas payment for all delivered messages. Got {} gas payment logs, expected at least {}" ,
112121 gas_expenditure_log_count,
113122 total_messages_expected
114123 ) ;
115124 // These tests check that we fixed https://github.com/hyperlane-xyz/hyperlane-monorepo/issues/3915, where some logs would not show up
125+
126+ let storing_new_msg_log_count = * log_counts
127+ . get ( & storing_new_msg_line_filter)
128+ . expect ( "Failed to get storing new msg log count" ) ;
116129 assert ! (
117- log_counts . get ( STORING_NEW_MESSAGE_LOG_MESSAGE ) . unwrap ( ) > & 0 ,
130+ storing_new_msg_log_count > 0 ,
118131 "Didn't find any logs about storing messages in db"
119132 ) ;
133+ let looking_for_events_log_count = * log_counts
134+ . get ( & looking_for_events_line_filter)
135+ . expect ( "Failed to get looking for events log count" ) ;
120136 assert ! (
121- log_counts . get ( LOOKING_FOR_EVENTS_LOG_MESSAGE ) . unwrap ( ) > & 0 ,
137+ looking_for_events_log_count > 0 ,
122138 "Didn't find any logs about looking for events in index range"
123139 ) ;
124- let total_tx_id_log_count = log_counts. get ( TX_ID_INDEXING_LOG_MESSAGE ) . unwrap ( ) ;
140+ let total_tx_id_log_count = * log_counts
141+ . get ( & tx_id_indexing_line_filter)
142+ . expect ( "Failed to get tx id indexing log count" ) ;
125143 assert ! (
126144 // there are 3 txid-indexed events:
127145 // - relayer: merkle insertion and gas payment
128146 // - scraper: gas payment
129147 // some logs are emitted for multiple events, so requiring there to be at least
130148 // `config.kathy_messages` logs is a reasonable approximation, since all three of these events
131149 // are expected to be logged for each message.
132- * total_tx_id_log_count as u64 >= config. kathy_messages,
150+ total_tx_id_log_count as u64 >= config. kathy_messages,
133151 "Didn't find as many tx id logs as expected. Found {} and expected {}" ,
134152 total_tx_id_log_count,
135153 config. kathy_messages
136154 ) ;
137155 assert ! (
138- log_counts. get( HYPER_INCOMING_BODY_LOG_MESSAGE ) . is_none( ) ,
156+ log_counts. get( & hyper_incoming_body_line_filter ) . is_none( ) ,
139157 "Verbose logs not expected at the log level set in e2e"
140158 ) ;
141159
0 commit comments