Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: pyth pull-based push oracle #1370

Merged
merged 24 commits into from
Apr 1, 2024
Merged

feat: pyth pull-based push oracle #1370

merged 24 commits into from
Apr 1, 2024

Conversation

guibescos
Copy link
Contributor

@guibescos guibescos commented Mar 18, 2024

It is a program that CPIs into the pyth solana receiver to post updates.
This program enforces that:

  • all the updates for a given price feed get posted to the same account (a PDA of the oracle instance)
  • the publish_time of the updates increases monotonically

The meat is in target_chains/solana/programs/pyth-push-oracle/src/lib.rs

Copy link

vercel bot commented Mar 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
example-oracle-amm ⬜️ Ignored (Inspect) Visit Preview Apr 1, 2024 1:25pm
xc-admin-frontend ⬜️ Ignored (Inspect) Visit Preview Apr 1, 2024 1:25pm

@guibescos guibescos changed the title Oracle instance feat: oracle instance program Mar 18, 2024
Copy link
Contributor

@jayantk jayantk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice this seems pretty straightforward to me. I left a few suggestions.

target_chains/solana/programs/oracle-instance/src/lib.rs Outdated Show resolved Hide resolved
target_chains/solana/cli/src/main.rs Outdated Show resolved Hide resolved
target_chains/solana/programs/oracle-instance/src/lib.rs Outdated Show resolved Hide resolved
target_chains/solana/programs/oracle-instance/src/lib.rs Outdated Show resolved Hide resolved
@@ -0,0 +1,28 @@
[package]
name = "common-test-utils"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I extracted this here to be able to use it in pyth-solana-receiver and pyth-push-oracle at the same time

@guibescos guibescos changed the title feat: oracle instance program feat: pyth pull-based pull oracle Mar 29, 2024
@guibescos guibescos marked this pull request as ready for review March 29, 2024 19:11
@guibescos guibescos changed the title feat: pyth pull-based pull oracle feat: pyth pull-based push oracle Mar 29, 2024
Copy link
Contributor

@jayantk jayantk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!

target_chains/solana/programs/pyth-push-oracle/src/lib.rs Outdated Show resolved Hide resolved

pub mod config;
pub mod error;
pub mod price_update;

declare_id!("rec5EKMGg6MxZYaMdyBfgwp4d5rB9T1VQH5pJv5LtFJ");

pub const PYTH_PUSH_ORACLE_ID: Pubkey = pubkey!("F9SP6tBXw9Af7BYauo7Y2R5Es2mpv8FP5aNCXMihp6Za");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is confusing to me. You have a separate sdk.rs above for the push oracle which has some useful methods in it. It seems like there should either be one sdk for users of both push/pull, or two different ones. At the moment, it seems like a mix of both options (?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • pyth-solana-receiver-sdk is for consuming price updates
  • pyth_solana_receiver::sdk is for posting price updates
  • pyth_push_oracle::sdk is for updating price feeds

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this program id, I need to put it here because otherwise there are some circular dependencies that break the code.

@guibescos guibescos merged commit 866b6a5 into main Apr 1, 2024
5 checks passed
@guibescos guibescos deleted the oracle-instance branch April 1, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants