Skip to content

Commit 7ed5c2a

Browse files
committed
fix: use publisher latest slot for staleness based pricing
1 parent bdcd1c1 commit 7ed5c2a

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
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 = "2.3.0"
3+
version = "2.3.1"
44
edition = "2021"
55

66
[[bin]]

src/agent/solana/exporter.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ impl Default for Config {
154154
compute_unit_limit: 40000,
155155
compute_unit_price_micro_lamports: None,
156156
dynamic_compute_unit_pricing_enabled: false,
157-
maximum_total_compute_fee_micro_lamports: 1_000_000_000_000,
158-
maximum_slot_gap_for_dynamic_compute_unit_price: 25,
157+
maximum_total_compute_fee_micro_lamports: 100_000_000_000,
158+
maximum_slot_gap_for_dynamic_compute_unit_price: 30,
159159
}
160160
}
161161
}
@@ -722,12 +722,20 @@ impl Exporter {
722722

723723
let result = result_rx.await??;
724724

725-
// Calculate the maximum slot difference between aggregate slot and
725+
// Calculate the maximum slot difference between the publisher latest slot and
726726
// current slot amongst all the accounts. Here, the aggregate slot is
727727
// used instead of the publishers latest update to avoid overpaying.
728728
let oldest_slot = result
729729
.values()
730-
.map(|account| account.last_slot)
730+
.flat_map(|account| {
731+
account
732+
.comp
733+
.iter()
734+
.filter(|c| c.publisher == publish_keypair.pubkey())
735+
.collect::<Vec<_>>()
736+
.get(0)
737+
.map(|c| c.latest.pub_slot)
738+
})
731739
.min()
732740
.ok_or(anyhow!("No price accounts"))?;
733741

0 commit comments

Comments
 (0)