@@ -79,14 +79,12 @@ impl InterceptorCranker {
7979 }
8080
8181 pub async fn start ( & self ) {
82- info ! ( "Starting InterceptorCranker service" ) ;
8382 let mut interval_timer = time:: interval ( self . interval ) ;
8483 let mut tick: u64 = 0 ;
85- info ! ( "Set interval timer to {} seconds" , self . interval. as_secs( ) ) ;
8684
8785 loop {
8886 interval_timer. tick ( ) . await ;
89- info ! ( "Tick: Starting new processing cycle " ) ;
87+ info ! ( "Cranker tick tick={tick} " ) ;
9088 match emit_heartbeat ( self . rpc_client . clone ( ) , tick, & self . cluster_name ) . await {
9189 Ok ( _) => tick += 1 ,
9290 Err ( e) => emit_error ( format ! ( "Failed to emit heartbeat: {e}" ) , & self . cluster_name ) ,
@@ -108,19 +106,18 @@ impl InterceptorCranker {
108106 }
109107
110108 match self . process_expired_receipts ( ) . await {
111- Ok ( _) => info ! ( "Successfully processed expired receipts" ) ,
109+ Ok ( _) => info ! ( "Processed expired receipts tick={tick} " ) ,
112110 Err ( e) => emit_error (
113- format ! ( "Error processing receipts: {e}" ) ,
111+ format ! ( "Failed to process expired receipts: {e}" ) ,
114112 & self . cluster_name ,
115113 ) ,
116114 }
117115 }
118116 }
119117
120118 async fn process_expired_receipts ( & self ) -> Result < ( ) , CrankerError > {
121- info ! ( "Starting to process expired receipts" ) ;
122119 let receipts = self . get_deposit_receipts ( ) . await ?;
123- info ! ( "Found {} deposit receipts" , receipts. len( ) ) ;
120+ info ! ( "Fetched deposit receipts count={} " , receipts. len( ) ) ;
124121
125122 let now = SystemTime :: now ( )
126123 . duration_since ( UNIX_EPOCH )
@@ -133,52 +130,41 @@ impl InterceptorCranker {
133130 let mut claimed_receipts: u64 = 0 ;
134131
135132 for receipt in receipts {
136- // Get raw bytes using bytemuck and interpret as little-endian
137133 let deposit_time = u64:: from ( receipt. deposit_time ) ;
138134 let cool_down = u64:: from ( receipt. cool_down_seconds ) ;
139135
140136 info ! (
141- "Receipt {} raw bytes:\n \
142- Interpreted values:\n \
143- deposit_time: {}\n \
144- cool_down: {}\n \
145- current_time: {}",
137+ "Processing deposit receipt base={} deposit_time={} cool_down={} now={}" ,
146138 receipt. base, deposit_time, cool_down, now
147139 ) ;
148140 emit_deposit_receipt ( & receipt, & self . cluster_name ) ;
149141
150142 if deposit_time > now {
151143 info ! (
152- "Receipt {} not yet expired (future deposit time). Current time: {}, Deposit time: {}" ,
153- receipt. base,
154- now,
155- deposit_time
156- ) ;
144+ "Skipping receipt status=future_deposit base={} deposit_time={} now={}" ,
145+ receipt. base, deposit_time, now
146+ ) ;
157147 future_deposits += 1 ;
158148 continue ;
159149 }
160150
161- // Safe addition check
162151 match deposit_time. checked_add ( cool_down) {
163152 Some ( expiry_time) => {
164153 if now > expiry_time {
165154 info ! (
166- "Receipt {} is expired. Current time: {}, Expiry time: {}" ,
167- receipt. base, now , expiry_time
155+ "Receipt expired base= {} expiry_time={} now= {}" ,
156+ receipt. base, expiry_time , now
168157 ) ;
169158 match self . claim_pool_tokens ( & receipt) . await {
170159 Ok ( _) => {
171- info ! ( "Successfully claimed tokens for receipt {}" , receipt. base) ;
160+ info ! ( "Claimed pool tokens base= {}" , receipt. base) ;
172161 let mut metrics = self . metrics . lock ( ) . unwrap ( ) ;
173162 metrics. successful_claims += 1 ;
174163 claimed_receipts += 1 ;
175164 }
176165 Err ( e) => {
177166 emit_error (
178- format ! (
179- "Failed to claim tokens for receipt {}: {}" ,
180- receipt. base, e
181- ) ,
167+ format ! ( "Failed to claim pool tokens base={}: {}" , receipt. base, e) ,
182168 & self . cluster_name ,
183169 ) ;
184170 let mut metrics = self . metrics . lock ( ) . unwrap ( ) ;
@@ -187,19 +173,20 @@ impl InterceptorCranker {
187173 }
188174 } else {
189175 info ! (
190- "Receipt {} not yet expired. Current time: {}, Expiry time: {}" ,
191- receipt. base, now , expiry_time
176+ "Skipping receipt status=not_yet_expired base= {} expiry_time={} now= {}" ,
177+ receipt. base, expiry_time , now
192178 ) ;
193179 not_yet_expired_receipts += 1 ;
194180 }
195181 }
196182 None => {
197- emit_error ( format ! (
198- "Receipt {} has invalid timing values - would overflow. Deposit time: {}, Cool down: {}" ,
199- receipt. base,
200- deposit_time,
201- cool_down
202- ) , & self . cluster_name ) ;
183+ emit_error (
184+ format ! (
185+ "Skipping receipt status=overflow base={} deposit_time={} cool_down={}" ,
186+ receipt. base, deposit_time, cool_down
187+ ) ,
188+ & self . cluster_name ,
189+ ) ;
203190 }
204191 }
205192 }
@@ -217,7 +204,6 @@ impl InterceptorCranker {
217204
218205 async fn get_deposit_receipts ( & self ) -> Result < Vec < DepositReceipt > , CrankerError > {
219206 let discriminator = StakeDepositInterceptorDiscriminators :: DepositReceipt as u8 ;
220- info ! ( "Searching for deposit receipts" ) ;
221207
222208 let accounts = self
223209 . rpc_client
@@ -239,7 +225,7 @@ impl InterceptorCranker {
239225 . await
240226 . map_err ( CrankerError :: RpcError ) ?;
241227
242- info ! ( "Found {} raw accounts" , accounts. len( ) ) ;
228+ info ! ( "Fetched program accounts count={} " , accounts. len( ) ) ;
243229
244230 Ok ( accounts
245231 . into_iter ( )
@@ -248,11 +234,7 @@ impl InterceptorCranker {
248234 match DepositReceipt :: try_from_slice_unchecked ( account_data. as_slice ( ) ) {
249235 Ok ( receipt) => {
250236 info ! (
251- "Found receipt:\n \
252- Account pubkey: {}\n \
253- Receipt base: {}\n \
254- Receipt stake pool: {}\n \
255- Derived PDA: {}",
237+ "Decoded deposit receipt account={} base={} stake_pool={} derived_pda={}" ,
256238 pubkey,
257239 receipt. base,
258240 receipt. stake_pool,
@@ -263,12 +245,11 @@ impl InterceptorCranker {
263245 )
264246 . 0
265247 ) ;
266-
267248 Some ( * receipt)
268249 }
269250 Err ( e) => {
270251 emit_error (
271- format ! ( "Failed to deserialize receipt for {pubkey}: {e}" ) ,
252+ format ! ( "Failed to deserialize receipt account= {pubkey}: {e}" ) ,
272253 & self . cluster_name ,
273254 ) ;
274255 None
@@ -279,7 +260,7 @@ impl InterceptorCranker {
279260 }
280261
281262 async fn claim_pool_tokens ( & self , receipt : & DepositReceipt ) -> Result < ( ) , CrankerError > {
282- info ! ( "Starting detailed claim debug for receipt {}" , receipt. base) ;
263+ info ! ( "Claiming pool tokens base= {}" , receipt. base) ;
283264
284265 let stake_pool_deposit_authority = self
285266 . get_stake_pool_deposit_authority ( & receipt. stake_pool_deposit_stake_authority )
@@ -288,13 +269,12 @@ impl InterceptorCranker {
288269 let owner_ata =
289270 get_associated_token_address ( & receipt. owner , & stake_pool_deposit_authority. pool_mint ) ;
290271
291- // Check if account exists
292272 match self . rpc_client . get_account ( & owner_ata) . await {
293273 Ok ( _) => {
294- info ! ( "Owner token account exists: {owner_ata}" ) ;
274+ info ! ( "Owner token account exists ata= {owner_ata}" ) ;
295275 }
296276 Err ( _) => {
297- info ! ( "Creating owner token account: {owner_ata}" ) ;
277+ info ! ( "Creating owner token account ata= {owner_ata}" ) ;
298278 let create_ata_ix = create_associated_token_account (
299279 & self . payer . pubkey ( ) ,
300280 & receipt. owner ,
@@ -313,7 +293,7 @@ impl InterceptorCranker {
313293 self . rpc_client
314294 . send_and_confirm_transaction ( & create_ata_tx)
315295 . await ?;
316- info ! ( "Created owner ata token account" ) ;
296+ info ! ( "Created owner token account ata={owner_ata} " ) ;
317297 }
318298 }
319299
@@ -322,19 +302,12 @@ impl InterceptorCranker {
322302 & stake_pool_deposit_authority. pool_mint ,
323303 ) ;
324304
325- // Check if account exists
326305 match self . rpc_client . get_account ( & fee_wallet_token_account) . await {
327306 Ok ( _) => {
328- info ! (
329- "Fee wallet token account exists: {}" ,
330- fee_wallet_token_account
331- ) ;
307+ info ! ( "Fee wallet token account exists ata={fee_wallet_token_account}" ) ;
332308 }
333309 Err ( _) => {
334- info ! (
335- "Creating fee wallet token account: {}" ,
336- fee_wallet_token_account
337- ) ;
310+ info ! ( "Creating fee wallet token account ata={fee_wallet_token_account}" ) ;
338311 let create_ata_ix = create_associated_token_account (
339312 & self . payer . pubkey ( ) ,
340313 & stake_pool_deposit_authority. fee_wallet ,
@@ -353,7 +326,7 @@ impl InterceptorCranker {
353326 self . rpc_client
354327 . send_and_confirm_transaction ( & create_ata_tx)
355328 . await ?;
356- info ! ( "Created fee wallet token account" ) ;
329+ info ! ( "Created fee wallet token account ata={fee_wallet_token_account} " ) ;
357330 }
358331 }
359332
@@ -388,18 +361,12 @@ impl InterceptorCranker {
388361 . await
389362 {
390363 Ok ( sig) => {
391- info ! (
392- "Successfully claimed pool tokens for receipt {}. Transaction signature: {}" ,
393- receipt. base, sig
394- ) ;
364+ info ! ( "Claimed pool tokens base={} signature={}" , receipt. base, sig) ;
395365 Ok ( ( ) )
396366 }
397367 Err ( e) => {
398368 emit_error (
399- format ! (
400- "Failed to claim pool tokens for receipt {}. Error: {}" ,
401- receipt. base, e
402- ) ,
369+ format ! ( "Failed to claim pool tokens base={}: {}" , receipt. base, e) ,
403370 & self . cluster_name ,
404371 ) ;
405372 Err ( CrankerError :: RpcError ( e) )
0 commit comments