Skip to content

Commit 30fb3eb

Browse files
committed
feat: support batch publish
1 parent 2fb3775 commit 30fb3eb

File tree

7 files changed

+162
-62
lines changed

7 files changed

+162
-62
lines changed

Cargo.lock

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ tracing-opentelemetry = "0.24.0"
5656
opentelemetry = "0.23.0"
5757
opentelemetry_sdk = { version = "0.23.0", features = ["rt-tokio"]}
5858
opentelemetry-otlp = { version = "0.16.0" }
59+
pyth-price-publisher = { git = "https://github.com/pyth-network/pyth-crosschain", branch = "add-publisher-program" }
60+
bytemuck = "1.13.0"
5961

6062
[dev-dependencies]
6163
tokio-util = { version = "0.7.10", features = ["full"] }

src/agent/services/exporter.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ mod exporter {
268268
&network_state_rx,
269269
key_store.accumulator_key,
270270
&publish_keypair,
271-
key_store.program_key,
271+
key_store.oracle_program_key,
272+
key_store.publish_program_key,
272273
config.exporter.max_batch_size,
273274
config.exporter.staleness_threshold,
274275
config.exporter.compute_unit_limit,

src/agent/services/oracle.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ where
7373
config.clone(),
7474
network,
7575
state.clone(),
76-
key_store.program_key,
76+
key_store.oracle_program_key,
7777
)
7878
.await
7979
{

src/agent/solana.rs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,17 @@ pub mod key_store {
9292
/// The public key of the Oracle program
9393
#[serde(
9494
serialize_with = "pubkey_string_ser",
95-
deserialize_with = "pubkey_string_de"
95+
deserialize_with = "pubkey_string_de",
96+
alias = "program_key" // for compatibility
97+
)]
98+
pub oracle_program_key: Pubkey,
99+
/// The public key of the Publish program
100+
#[serde(
101+
serialize_with = "opt_pubkey_string_ser",
102+
deserialize_with = "opt_pubkey_string_de",
103+
default
96104
)]
97-
pub program_key: Pubkey,
105+
pub publish_program_key: Option<Pubkey>,
98106
/// The public key of the root mapping account
99107
#[serde(
100108
serialize_with = "pubkey_string_ser",
@@ -114,13 +122,15 @@ pub mod key_store {
114122
/// The keypair used to publish price updates. When None,
115123
/// publishing will not start until a new keypair is supplied
116124
/// via the remote loading endpoint
117-
pub publish_keypair: Option<Keypair>,
125+
pub publish_keypair: Option<Keypair>,
118126
/// Public key of the Oracle program
119-
pub program_key: Pubkey,
127+
pub oracle_program_key: Pubkey,
128+
/// Public key of the Publish program
129+
pub publish_program_key: Option<Pubkey>,
120130
/// Public key of the root mapping account
121-
pub mapping_key: Pubkey,
131+
pub mapping_key: Pubkey,
122132
/// Public key of the accumulator program (if provided)
123-
pub accumulator_key: Option<Pubkey>,
133+
pub accumulator_key: Option<Pubkey>,
124134
}
125135

126136
impl KeyStore {
@@ -139,7 +149,8 @@ pub mod key_store {
139149

140150
Ok(KeyStore {
141151
publish_keypair,
142-
program_key: config.program_key,
152+
oracle_program_key: config.oracle_program_key,
153+
publish_program_key: config.publish_program_key,
143154
mapping_key: config.mapping_key,
144155
accumulator_key: config.accumulator_key,
145156
})

0 commit comments

Comments
 (0)