Skip to content

Commit

Permalink
fix(apps/price_pusher/solana): make priceUpdates per bundle configura…
Browse files Browse the repository at this point in the history
…ble (#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
  • Loading branch information
ali-bahjati authored Jul 5, 2024
1 parent 29afb2a commit aac0584
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions apps/price_pusher/config.solana.mainnet.sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"jito-keypair-file": "./jito.json",
"jito-tip-lamports": "100000",
"jito-bundle-size": "5",
"updates-per-jito-bundle": "6",
"price-config-file": "./price-config.yaml",
"price-service-endpoint": "https://hermes.pyth.network/",
"pyth-contract-address": "pythWSnswVUd12oZpeFP8e9CVaEqJg25g1Vtc2biRsT",
Expand Down
2 changes: 1 addition & 1 deletion apps/price_pusher/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pythnetwork/price-pusher",
"version": "7.0.0",
"version": "7.0.1",
"description": "Pyth Price Pusher",
"homepage": "https://pyth.network",
"main": "lib/index.js",
Expand Down
9 changes: 8 additions & 1 deletion apps/price_pusher/src/solana/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ export default {
type: "number",
default: 2,
} as Options,
"updates-per-jito-bundle": {
description: "Number of transactions in each bundle",
type: "number",
default: 6,
} as Options,
...options.priceConfigFile,
...options.priceServiceEndpoint,
...options.pythContractAddress,
Expand All @@ -90,6 +95,7 @@ export default {
jitoKeypairFile,
jitoTipLamports,
jitoBundleSize,
updatesPerJitoBundle,
logLevel,
priceServiceConnectionLogLevel,
controllerLogLevel,
Expand Down Expand Up @@ -143,7 +149,8 @@ export default {
shardId,
jitoTipLamports,
jitoClient,
jitoBundleSize
jitoBundleSize,
updatesPerJitoBundle
);

onBundleResult(jitoClient, logger.child({ module: "JitoClient" }));
Expand Down
9 changes: 4 additions & 5 deletions apps/price_pusher/src/solana/solana.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ export class SolanaPricePusher implements IPricePusher {
}
}

const UPDATES_PER_JITO_BUNDLE = 7;

export class SolanaPricePusherJito implements IPricePusher {
constructor(
private pythSolanaReceiver: PythSolanaReceiver,
Expand All @@ -140,7 +138,8 @@ export class SolanaPricePusherJito implements IPricePusher {
private shardId: number,
private jitoTipLamports: number,
private searcherClient: SearcherClient,
private jitoBundleSize: number
private jitoBundleSize: number,
private updatesPerJitoBundle: number
) {}

async updatePriceFeed(
Expand All @@ -158,7 +157,7 @@ export class SolanaPricePusherJito implements IPricePusher {
return;
}

for (let i = 0; i < priceIds.length; i += UPDATES_PER_JITO_BUNDLE) {
for (let i = 0; i < priceIds.length; i += this.updatesPerJitoBundle) {
const transactionBuilder = this.pythSolanaReceiver.newTransactionBuilder({
closeUpdateAccounts: true,
});
Expand All @@ -167,7 +166,7 @@ export class SolanaPricePusherJito implements IPricePusher {
return sliceAccumulatorUpdateData(
Buffer.from(x, "base64"),
i,
i + UPDATES_PER_JITO_BUNDLE
i + this.updatesPerJitoBundle
).toString("base64");
}),
this.shardId
Expand Down

0 comments on commit aac0584

Please sign in to comment.