Skip to content

Commit

Permalink
feat: support batch publish
Browse files Browse the repository at this point in the history
  • Loading branch information
Riateche committed Sep 2, 2024
1 parent 2fb3775 commit a8e1056
Show file tree
Hide file tree
Showing 7 changed files with 164 additions and 62 deletions.
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ tracing-opentelemetry = "0.24.0"
opentelemetry = "0.23.0"
opentelemetry_sdk = { version = "0.23.0", features = ["rt-tokio"]}
opentelemetry-otlp = { version = "0.16.0" }
pyth-price-publisher = { git = "https://github.com/pyth-network/pyth-crosschain", branch = "add-publisher-program" }
bytemuck = "1.13.0"

[dev-dependencies]
tokio-util = { version = "0.7.10", features = ["full"] }
Expand Down
3 changes: 2 additions & 1 deletion src/agent/services/exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ mod exporter {
&network_state_rx,
key_store.accumulator_key,
&publish_keypair,
key_store.program_key,
key_store.oracle_program_key,
key_store.publish_program_key,
config.exporter.max_batch_size,
config.exporter.staleness_threshold,
config.exporter.compute_unit_limit,
Expand Down
2 changes: 1 addition & 1 deletion src/agent/services/oracle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ where
config.clone(),
network,
state.clone(),
key_store.program_key,
key_store.oracle_program_key,
)
.await
{
Expand Down
25 changes: 18 additions & 7 deletions src/agent/solana.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,17 @@ pub mod key_store {
/// The public key of the Oracle program
#[serde(
serialize_with = "pubkey_string_ser",
deserialize_with = "pubkey_string_de"
deserialize_with = "pubkey_string_de",
alias = "program_key" // for compatibility
)]
pub oracle_program_key: Pubkey,
/// The public key of the Publish program
#[serde(
serialize_with = "opt_pubkey_string_ser",
deserialize_with = "opt_pubkey_string_de",
default
)]
pub program_key: Pubkey,
pub publish_program_key: Option<Pubkey>,
/// The public key of the root mapping account
#[serde(
serialize_with = "pubkey_string_ser",
Expand All @@ -114,13 +122,15 @@ pub mod key_store {
/// The keypair used to publish price updates. When None,
/// publishing will not start until a new keypair is supplied
/// via the remote loading endpoint
pub publish_keypair: Option<Keypair>,
pub publish_keypair: Option<Keypair>,
/// Public key of the Oracle program
pub program_key: Pubkey,
pub oracle_program_key: Pubkey,
/// Public key of the Publish program
pub publish_program_key: Option<Pubkey>,
/// Public key of the root mapping account
pub mapping_key: Pubkey,
pub mapping_key: Pubkey,
/// Public key of the accumulator program (if provided)
pub accumulator_key: Option<Pubkey>,
pub accumulator_key: Option<Pubkey>,
}

impl KeyStore {
Expand All @@ -139,7 +149,8 @@ pub mod key_store {

Ok(KeyStore {
publish_keypair,
program_key: config.program_key,
oracle_program_key: config.oracle_program_key,
publish_program_key: config.publish_program_key,
mapping_key: config.mapping_key,
accumulator_key: config.accumulator_key,
})
Expand Down
Loading

0 comments on commit a8e1056

Please sign in to comment.