@@ -514,16 +514,20 @@ func (k Keeper) InsertUBDQueue(ctx context.Context, ubd types.UnbondingDelegatio
514514
515515 timeSlice , err := k .GetUBDQueueTimeSlice (ctx , completionTime )
516516 if err != nil {
517+ k .Logger (ctx ).Error ("[DELEGATION_QUEUE] Failed to get UBD queue timeslice" , "completionTime" , completionTime , "error" , err )
517518 return err
518519 }
519520
520521 if len (timeSlice ) == 0 {
522+ k .Logger (ctx ).Info ("[DELEGATION_QUEUE] Inserting first UBD into queue" , "completionTime" , completionTime , "delegator" , ubd .DelegatorAddress , "validator" , ubd .ValidatorAddress )
521523 if err = k .SetUBDQueueTimeSlice (ctx , completionTime , []types.DVPair {dvPair }); err != nil {
524+ k .Logger (ctx ).Error ("[DELEGATION_QUEUE] Failed to set UBD queue timeslice" , "completionTime" , completionTime , "error" , err )
522525 return err
523526 }
524527 return nil
525528 }
526529
530+ k .Logger (ctx ).Info ("[DELEGATION_QUEUE] Appending UBD to existing queue" , "completionTime" , completionTime , "existingCount" , len (timeSlice ), "delegator" , ubd .DelegatorAddress , "validator" , ubd .ValidatorAddress )
527531 timeSlice = append (timeSlice , dvPair )
528532 return k .SetUBDQueueTimeSlice (ctx , completionTime , timeSlice )
529533}
@@ -545,9 +549,12 @@ func (k Keeper) UBDQueueIteratorAll(ctx context.Context) (corestore.Iterator, er
545549func (k Keeper ) DequeueAllMatureUBDQueue (ctx context.Context , currTime time.Time ) (matureUnbonds []types.DVPair , err error ) {
546550 unbondingDelegations , err := k .GetUBDs (ctx , currTime )
547551 if err != nil {
552+ k .Logger (ctx ).Error ("[DELEGATION_QUEUE] Failed to get unbonding delegations" , "error" , err , "currTime" , currTime )
548553 return matureUnbonds , err
549554 }
550555
556+ k .Logger (ctx ).Info ("[DELEGATION_QUEUE] Dequeuing mature unbonding delegations" , "currTime" , currTime , "totalEntries" , len (unbondingDelegations ))
557+
551558 keys := make ([]string , 0 , len (unbondingDelegations ))
552559
553560 for key := range unbondingDelegations {
@@ -561,27 +568,32 @@ func (k Keeper) DequeueAllMatureUBDQueue(ctx context.Context, currTime time.Time
561568 for _ , key := range keys {
562569 t , err := sdk .ParseTime (key )
563570 if err != nil {
571+ k .Logger (ctx ).Error ("[DELEGATION_QUEUE] Failed to parse time key" , "key" , key , "error" , err )
564572 return matureUnbonds , err
565573 }
566574
567575 if nonMature := t .After (currTime ); nonMature {
576+ k .Logger (ctx ).Info ("[DELEGATION_QUEUE] Reached non-mature unbonding delegations" , "time" , t , "currTime" , currTime , "processedCount" , len (matureUnbonds ))
568577 return matureUnbonds , nil
569578 }
570579 pairs := unbondingDelegations [key ]
580+ k .Logger (ctx ).Info ("[DELEGATION_QUEUE] Processing mature unbonding delegation timeslice" , "time" , t , "pairsCount" , len (pairs ))
571581 matureUnbonds = append (matureUnbonds , pairs ... )
572582
573583 err = store .Delete (types .GetUnbondingDelegationTimeKey (t ))
574584 if err != nil {
585+ k .Logger (ctx ).Error ("[DELEGATION_QUEUE] Failed to delete unbonding delegation time key from store" , "time" , t , "error" , err )
575586 return matureUnbonds , err
576587 }
577588
578589 if k .cache != nil {
579590 if err := k .cache .DeleteUnbondingDelegationQueueEntry (ctx , key ); err != nil {
580- k .Logger (ctx ).Error ("DeleteUnbondingDelegationQueueEntry in cache failed" , "error" , err )
591+ k .Logger (ctx ).Error ("[DELEGATION_QUEUE] DeleteUnbondingDelegationQueueEntry in cache failed" , "error" , err , "key" , key )
581592 }
582593 }
583594 }
584595
596+ k .Logger (ctx ).Info ("[DELEGATION_QUEUE] Completed dequeuing mature unbonding delegations" , "totalMature" , len (matureUnbonds ))
585597 return matureUnbonds , nil
586598}
587599
@@ -991,7 +1003,7 @@ func (k Keeper) DequeueAllMatureRedelegationQueue(ctx context.Context, currTime
9911003
9921004 if k .cache != nil {
9931005 if err := k .cache .DeleteRedelegationsQueueEntry (ctx , key ); err != nil {
994- k .Logger (ctx ).Error ("DeleteRedelegationsQueueEntry in cache failed" , "error" , err )
1006+ k .Logger (ctx ).Error ("[DELEGATION_QUEUE] DeleteRedelegationsQueueEntry in cache failed" , "error" , err , "key" , key )
9951007 }
9961008 }
9971009 }
0 commit comments