Skip to content

Commit dd923bd

Browse files
authored
feat: drop jito bundle size and improve packing (#2940)
* feat: drop jito bundle size and improve packing * add alt * comment
1 parent 7af416e commit dd923bd

File tree

7 files changed

+18
-20
lines changed

7 files changed

+18
-20
lines changed

apps/price_pusher/config.solana.mainnet.sample.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
"endpoint": "https://api.mainnet-beta.solana.com",
33
"keypair-file": "./id.json",
44
"shard-id": 1,
5-
"jito-endpoint": "mainnet.block-engine.jito.wtf",
5+
"jito-endpoints": "mainnet.block-engine.jito.wtf,amsterdam.mainnet.block-engine.jito.wtf",
66
"jito-keypair-file": "./jito.json",
77
"jito-tip-lamports": "100000",
88
"dynamic-jito-tips": true,
9-
"jito-bundle-size": "5",
109
"updates-per-jito-bundle": "6",
1110
"price-config-file": "./price-config.stable.sample.yaml",
1211
"price-service-endpoint": "https://hermes.pyth.network/",
1312
"pyth-contract-address": "pythWSnswVUd12oZpeFP8e9CVaEqJg25g1Vtc2biRsT",
14-
"pushing-frequency": "30"
13+
"pushing-frequency": "30",
14+
"address-lookup-table-account":"GgPa1XHhkqvdJHjQpHaqxThwejgHW8qeW4k4jKVS4Lod"
1515
}

apps/price_pusher/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/price-pusher",
3-
"version": "9.3.6",
3+
"version": "10.0.0",
44
"description": "Pyth Price Pusher",
55
"homepage": "https://pyth.network",
66
"main": "lib/index.js",

apps/price_pusher/src/solana/command.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ export default {
122122
jitoTipLamports,
123123
dynamicJitoTips,
124124
maxJitoTipLamports,
125-
jitoBundleSize,
126125
updatesPerJitoBundle,
127126
addressLookupTableAccount,
128127
treasuryId,
@@ -230,7 +229,6 @@ export default {
230229
dynamicJitoTips,
231230
maxJitoTipLamports,
232231
jitoClients,
233-
jitoBundleSize,
234232
updatesPerJitoBundle,
235233
// Set max retry time to pushing frequency, since we want to stop retrying before the next push attempt
236234
pushingFrequency * 1000,

apps/price_pusher/src/solana/solana.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ export class SolanaPricePusherJito implements IPricePusher {
167167
private dynamicJitoTips: boolean,
168168
private maxJitoTipLamports: number,
169169
private searcherClients: SearcherClient[],
170-
private jitoBundleSize: number,
171170
private updatesPerJitoBundle: number,
172171
private maxRetryTimeMs: number,
173172
private addressLookupTableAccount?: AddressLookupTableAccount,
@@ -237,7 +236,6 @@ export class SolanaPricePusherJito implements IPricePusher {
237236
const transactions = await transactionBuilder.buildVersionedTransactions({
238237
jitoTipLamports: cappedJitoTip,
239238
tightComputeBudget: true,
240-
jitoBundleSize: this.jitoBundleSize,
241239
});
242240

243241
await sendTransactionsJito(

target_chains/solana/sdk/js/pyth_solana_receiver/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/pyth-solana-receiver",
3-
"version": "0.10.2",
3+
"version": "0.11.0",
44
"description": "Pyth solana receiver SDK",
55
"homepage": "https://pyth.network",
66
"main": "lib/index.js",

target_chains/solana/sdk/js/solana_utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/solana-utils",
3-
"version": "0.4.5",
3+
"version": "0.5.0",
44
"description": "Utility functions for Solana",
55
"homepage": "https://pyth.network",
66
"main": "lib/index.js",

target_chains/solana/sdk/js/solana_utils/src/transaction.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ export const DEFAULT_COMPUTE_BUDGET_UNITS = 200000;
2626
export const PACKET_DATA_SIZE_WITH_ROOM_FOR_COMPUTE_BUDGET =
2727
PACKET_DATA_SIZE - 52;
2828

29+
/**
30+
* The maximum number of transactions in a Jito bundle.
31+
*/
32+
export const JITO_BUNDLE_SIZE = 5;
33+
2934
/**
3035
* An instruction with some extra information that will be used to build transactions.
3136
*/
@@ -46,7 +51,6 @@ export type PriorityFeeConfig = {
4651
computeUnitPriceMicroLamports?: number;
4752
tightComputeBudget?: boolean;
4853
jitoTipLamports?: number;
49-
jitoBundleSize?: number;
5054
};
5155

5256
/**
@@ -188,7 +192,11 @@ export class TransactionBuilder {
188192
this.transactionInstructions.length - 1
189193
].instructions,
190194
instruction,
191-
buildJitoTipInstruction(this.payer, 1),
195+
this.transactionInstructions.length % JITO_BUNDLE_SIZE === 0 // This transaction may be the first of a Jito bundle, so we leave room for a Jito tip transfer.
196+
? buildJitoTipInstruction(this.payer, 1)
197+
: ComputeBudgetProgram.setComputeUnitPrice({
198+
microLamports: 1,
199+
}),
192200
ComputeBudgetProgram.setComputeUnitLimit({ units: 1 }),
193201
],
194202
true,
@@ -232,9 +240,6 @@ export class TransactionBuilder {
232240
await this.connection.getLatestBlockhash({ commitment: "confirmed" })
233241
).blockhash;
234242

235-
const jitoBundleSize =
236-
args.jitoBundleSize || this.transactionInstructions.length;
237-
238243
return this.transactionInstructions.map(
239244
({ instructions, signers, computeUnits }, index) => {
240245
const instructionsWithComputeBudget: TransactionInstruction[] = [
@@ -255,7 +260,7 @@ export class TransactionBuilder {
255260
}),
256261
);
257262
}
258-
if (args.jitoTipLamports && index % jitoBundleSize === 0) {
263+
if (args.jitoTipLamports && index % JITO_BUNDLE_SIZE === 0) {
259264
instructionsWithComputeBudget.push(
260265
buildJitoTipInstruction(this.payer, args.jitoTipLamports),
261266
);
@@ -297,9 +302,6 @@ export class TransactionBuilder {
297302
buildLegacyTransactions(
298303
args: PriorityFeeConfig,
299304
): { tx: Transaction; signers: Signer[] }[] {
300-
const jitoBundleSize =
301-
args.jitoBundleSize || this.transactionInstructions.length;
302-
303305
return this.transactionInstructions.map(
304306
({ instructions, signers, computeUnits }, index) => {
305307
const instructionsWithComputeBudget: TransactionInstruction[] = [
@@ -320,7 +322,7 @@ export class TransactionBuilder {
320322
}),
321323
);
322324
}
323-
if (args.jitoTipLamports && index % jitoBundleSize === 0) {
325+
if (args.jitoTipLamports && index % JITO_BUNDLE_SIZE === 0) {
324326
instructionsWithComputeBudget.push(
325327
buildJitoTipInstruction(this.payer, args.jitoTipLamports),
326328
);

0 commit comments

Comments
 (0)