Skip to content

Commit aac0584

Browse files
authored
fix(apps/price_pusher/solana): make priceUpdates per bundle configurable (#1757)
* fix(apps/price_pusher/solana): make priceUpdates per bundle configurable We are using a fixed priceUpdate per bundle constant but it might need to be changed as the price proof size increases. This change makes it configurable. * chore: update sample config
1 parent 29afb2a commit aac0584

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"jito-keypair-file": "./jito.json",
77
"jito-tip-lamports": "100000",
88
"jito-bundle-size": "5",
9+
"updates-per-jito-bundle": "6",
910
"price-config-file": "./price-config.yaml",
1011
"price-service-endpoint": "https://hermes.pyth.network/",
1112
"pyth-contract-address": "pythWSnswVUd12oZpeFP8e9CVaEqJg25g1Vtc2biRsT",

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": "7.0.0",
3+
"version": "7.0.1",
44
"description": "Pyth Price Pusher",
55
"homepage": "https://pyth.network",
66
"main": "lib/index.js",

apps/price_pusher/src/solana/command.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ export default {
6666
type: "number",
6767
default: 2,
6868
} as Options,
69+
"updates-per-jito-bundle": {
70+
description: "Number of transactions in each bundle",
71+
type: "number",
72+
default: 6,
73+
} as Options,
6974
...options.priceConfigFile,
7075
...options.priceServiceEndpoint,
7176
...options.pythContractAddress,
@@ -90,6 +95,7 @@ export default {
9095
jitoKeypairFile,
9196
jitoTipLamports,
9297
jitoBundleSize,
98+
updatesPerJitoBundle,
9399
logLevel,
94100
priceServiceConnectionLogLevel,
95101
controllerLogLevel,
@@ -143,7 +149,8 @@ export default {
143149
shardId,
144150
jitoTipLamports,
145151
jitoClient,
146-
jitoBundleSize
152+
jitoBundleSize,
153+
updatesPerJitoBundle
147154
);
148155

149156
onBundleResult(jitoClient, logger.child({ module: "JitoClient" }));

apps/price_pusher/src/solana/solana.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ export class SolanaPricePusher implements IPricePusher {
130130
}
131131
}
132132

133-
const UPDATES_PER_JITO_BUNDLE = 7;
134-
135133
export class SolanaPricePusherJito implements IPricePusher {
136134
constructor(
137135
private pythSolanaReceiver: PythSolanaReceiver,
@@ -140,7 +138,8 @@ export class SolanaPricePusherJito implements IPricePusher {
140138
private shardId: number,
141139
private jitoTipLamports: number,
142140
private searcherClient: SearcherClient,
143-
private jitoBundleSize: number
141+
private jitoBundleSize: number,
142+
private updatesPerJitoBundle: number
144143
) {}
145144

146145
async updatePriceFeed(
@@ -158,7 +157,7 @@ export class SolanaPricePusherJito implements IPricePusher {
158157
return;
159158
}
160159

161-
for (let i = 0; i < priceIds.length; i += UPDATES_PER_JITO_BUNDLE) {
160+
for (let i = 0; i < priceIds.length; i += this.updatesPerJitoBundle) {
162161
const transactionBuilder = this.pythSolanaReceiver.newTransactionBuilder({
163162
closeUpdateAccounts: true,
164163
});
@@ -167,7 +166,7 @@ export class SolanaPricePusherJito implements IPricePusher {
167166
return sliceAccumulatorUpdateData(
168167
Buffer.from(x, "base64"),
169168
i,
170-
i + UPDATES_PER_JITO_BUNDLE
169+
i + this.updatesPerJitoBundle
171170
).toString("base64");
172171
}),
173172
this.shardId

0 commit comments

Comments
 (0)