Skip to content

feat: support multiple JITO endpoints with round-robin retry #2664

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

devin-ai-integration[bot]
Copy link
Contributor

Multiple JITO Endpoints Support

This PR adds support for multiple JITO endpoints in the Solana price pusher with a round-robin retry mechanism.

Changes:

  • Modified sendTransactionsJito to accept a list of SearcherClients
  • Updated SolanaPricePusherJito class to accept multiple endpoints
  • Modified command handler to process comma-separated JITO endpoints
  • Updated RPC selector script to write multiple healthy endpoints

Implementation details:

  • Uses first successful endpoint
  • Maintains dynamic JITO tips feature
  • Implements time-based retry mechanism that cycles through endpoints
  • Logs warnings when cycling through endpoints

Link to Devin run: https://app.devin.ai/sessions/4b444e4e547842658001b352436f6970
Requested by: Ali Behjati (ali@dourolabs.xyz)

Co-Authored-By: Ali Behjati <ali@dourolabs.xyz>
@devin-ai-integration devin-ai-integration bot requested a review from a team as a code owner May 8, 2025 12:20
Copy link

vercel bot commented May 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 9, 2025 7:39pm
component-library ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 9, 2025 7:39pm
developer-hub ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 9, 2025 7:39pm
entropy-debugger ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 9, 2025 7:39pm
entropy-explorer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 9, 2025 7:39pm
insights ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 9, 2025 7:39pm
proposals ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 9, 2025 7:39pm
staking ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 9, 2025 7:39pm

Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@@ -50,7 +50,7 @@ export default {
default: 50000,
} as Options,
"jito-endpoint": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename this param to jito-endpoints for clarity

Comment on lines +85 to +95
while (Date.now() - startTime < maxRetryTimeMs) {
const currentClient = clients[clientIndex];
try {
await currentClient.sendBundle(bundle);
return firstTransactionSignature;
} catch (err: any) {
lastError = err;
clientIndex = (clientIndex + 1) % clients.length;
await new Promise((resolve) => setTimeout(resolve, 500));
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(aside) @guibescos do you know how many jito endpoints we can round robin against? the ratelimit retry logic is a little funky here if there are only 2 or 3.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(aside) cc @ali-bahjati

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have never experimented with multiple jito endpoints so I don't have a good take on this!

Co-Authored-By: Ali Behjati <ali@dourolabs.xyz>
Copy link
Contributor Author

Closing due to inactivity for more than 7 days.

Copy link
Contributor

@tejasbadadare tejasbadadare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a log line when attempting sendTransactionsJito to indicate which jito endpoint is being used

@tejasbadadare
Copy link
Contributor

(aside) okay devin is ignoring me -- will test this out manually and make any updates necessary

} else {
throw err;
try {
this.logger.info("Sending Jito transactions...");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you mean to leave these extra logs here?

} catch (err: any) {
lastError = err;
clientIndex = (clientIndex + 1) % clients.length;
await new Promise((resolve) => setTimeout(resolve, 500));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to wait between different endpoints

let lastError: Error | null = null;
let clientIndex = 0;

while (Date.now() - startTime < maxRetryTimeMs) {
Copy link
Contributor

@guibescos guibescos Jun 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the pushing frequency is 5 seconds in the production deployment, the scheduler will try to push a fresher bundle 5 seconds after.
60 seconds retry time seems too much, after 5 seconds the current bundle is stale and the current task should terminate

{ maxRetryTimeMs: this.maxRetryTimeMs },
);
} catch (err: any) {
if (err.code === 8 && err.details?.includes("Rate limit exceeded")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh this "timeout" code path was added as an ducttape fix by ayaz so feel free to rework it into some more principled

Copy link
Contributor

@guibescos guibescos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will probably take some trial and error. Approving to not slow you down

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.

3 participants