Skip to content

Commit 3bf50bf

Browse files
authored
Request compute units per price update instruction (#44)
* Request compute units per price update instruction * pr comments * fix bug
1 parent 4fc696c commit 3bf50bf

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pyth-agent"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
edition = "2021"
55

66
[[bin]]

config/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ key_store.root_path = "/path/to/keystore"
4141
# Maximum size of a batch
4242
# exporter.max_batch_size = 12
4343

44-
# Maximum number of compute units requested by each update_price transaction
44+
# Number of compute units requested per update_price instruction within the transaction.
4545
# exporter.compute_unit_limit = 20000
4646

4747
# Price per compute unit offered for update_price transactions

src/agent/solana/exporter.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ pub struct Config {
103103
pub inflight_transactions_channel_capacity: usize,
104104
/// Configuration for the Transaction Monitor
105105
pub transaction_monitor: transaction_monitor::Config,
106-
/// Maximum number of compute units requested by each update_price transaction
106+
/// Number of compute units requested per update_price instruction within the transaction
107+
/// (i.e., requested units equals `n * compute_unit_limit`, where `n` is the number of update_price
108+
/// instructions)
107109
pub compute_unit_limit: u32,
108110
/// Price per compute unit offered for update_price transactions
109111
pub compute_unit_price_micro_lamports: Option<u64>,
@@ -383,7 +385,7 @@ impl Exporter {
383385

384386
// Pay priority fees, if configured
385387
instructions.push(ComputeBudgetInstruction::set_compute_unit_limit(
386-
self.config.compute_unit_limit,
388+
self.config.compute_unit_limit * instructions.len() as u32,
387389
));
388390
if let Some(compute_unit_price_micro_lamports) =
389391
self.config.compute_unit_price_micro_lamports

0 commit comments

Comments
 (0)