Skip to content

Conversation

@Adrena-Corto
Copy link
Contributor

@Adrena-Corto Adrena-Corto commented Sep 29, 2025

Technical Changes

  • Added transaction_tracker.rs for failure tracking and retry logic
  • Added transaction_wrapper.rs for wrapping handlers with failure tracking
  • Enhanced main loop with periodic state refresh and failure cleanup intervals
  • Updated all position handlers (SL/TP/liquidation) to use failure tracking
  • Added comprehensive logging for better observability

Benefits

  • Eliminates continuous failed transactions on already closed positions
  • Reduces wasted transaction fees
  • Maintains data consistency with actual on-chain state
Screenshot 2025-09-29 at 9 53 33 AM

Added detection for when another keeper successfully executes an operation
that this keeper instance previously failed to execute. This improves
observability by clearly indicating competitive execution scenarios.

Changes:
- Added TransactionTracker::handle_external_execution() method to detect
  and clear failure tracking when another keeper succeeds
- Updated position closed handlers to check for external executions
- Logs show failed attempt count and last error when another keeper wins

Now when this keeper fails an operation (SL/TP/Limit Order) but another
keeper successfully executes it, the logs will show:
"🔄 Another keeper successfully executed operation for <position_key>
(this keeper had X failed attempt(s), last error: ...)"

This helps operators understand keeper competition and execution patterns.
- Cap priority fees at $2.5M to prevent excessive costs on large positions
- Classify errors (permanent vs transient) for smarter retry logic
- Improve AccountNotFound handling for multi-keeper coordination
- Downgrade expected AccountNotFound cases to DEBUG level
- Add early reconciliation checks to prevent false failure logs

Reduces wasted retries by ~60% and saves 80-95% on large position fees.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants