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

Merged
merged 7 commits into from
Jun 11, 2025

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 ([email protected])

@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 ↗︎

8 Skipped Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Skipped (Inspect) Jun 11, 2025 11:55pm
component-library ⬜️ Skipped (Inspect) Jun 11, 2025 11:55pm
developer-hub ⬜️ Skipped (Inspect) Jun 11, 2025 11:55pm
entropy-debugger ⬜️ Skipped (Inspect) Jun 11, 2025 11:55pm
entropy-explorer ⬜️ Skipped (Inspect) Jun 11, 2025 11:55pm
insights ⬜️ Skipped (Inspect) Jun 11, 2025 11:55pm
proposals ⬜️ Skipped (Inspect) Jun 11, 2025 11:55pm
staking ⬜️ Skipped (Inspect) Jun 11, 2025 11:55pm

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!

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?

Copy link
Contributor

Choose a reason for hiding this comment

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

improved the logging

} 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

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah true we don't, will remove

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point -- we can just use pushing frequency as the max timeout since we should stop retrying once the next interval comes around.

{ 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

Choose a reason for hiding this comment

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

yeah, and we'll actually only hit this if we're ratelimited across all endpoints which is pretty unlikely. i'll improve and simplify this.

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

@vercel vercel bot temporarily deployed to Preview – staking June 11, 2025 23:55 Inactive
@vercel vercel bot temporarily deployed to Preview – insights June 11, 2025 23:55 Inactive
@vercel vercel bot temporarily deployed to Preview – component-library June 11, 2025 23:55 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-debugger June 11, 2025 23:55 Inactive
@vercel vercel bot temporarily deployed to Preview – api-reference June 11, 2025 23:55 Inactive
@vercel vercel bot temporarily deployed to Preview – developer-hub June 11, 2025 23:55 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-explorer June 11, 2025 23:55 Inactive
@vercel vercel bot temporarily deployed to Preview – proposals June 11, 2025 23:55 Inactive
@tejasbadadare tejasbadadare merged commit 20df3a3 into main Jun 11, 2025
13 checks passed
@tejasbadadare tejasbadadare deleted the devin/1746706324-solana-jito-multiple-endpoints branch June 11, 2025 23:55
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