[PASSED] OP-PIP-10: Optimize Pyth oracle program


This proposal upgrades the Pyth oracle program on Pythnet to optimize its performance.


Pythnet processes more than 3000 price updates per second and is expected to grow further. To ensure the network can handle this load, the Pyth oracle program requires continuous optimization for performance.


This proposal upgrades the Pyth oracle program with the following changes:

  • Use a sorted list of publishers to reduce the time to lookup a publisher - PR

  • Remove rent checks because they are enforced by the network - PR. Storage rent is a locked fee mechanism for storage space in Solana that ensures storage is used efficiently in the network.

It is expected that these changes will decrease the compute unit usage of price updates by 10-30%.

Implementation Plan

Proposal id: Bj7w9MB37a3su9hYD6DPbYjXwBBoCywqcX4SM3SKy1GT

Verify the implementation following the guide below:

  1. Make sure you have git, Docker and sha256sum.

  2. git: install git from here

  3. Docker: install it from here

  4. sha256sum: if on Mac you can install it as a part of coreutils with brew install coreutils

  5. Clone the pyth-client repo (git clone)

  6. Go to the pyth-client directory and run the following command: docker build -f docker/Dockerfile --platform=linux/x86_64 --progress=plain .

  7. Upon a successful build, you should see the following messages containing the hash digest of the program:

sha256sum ./target/deploy/pyth_oracle.so
<hash-digest> ./target/deploy/pyth_oracle.so
  1. Check that the hash digest matches the hash digest of the buffer deployed on Pythnet. Get the buffer account from the proposal
    and fetch the digest of the program in the buffer account by running the following command:
solana -u https://api2.pythnet.pyth.network program dump <BUFFER> temp_file
sha256sum temp_file
rm temp_file
  1. Make sure the hash from step 4 and from step 5 match

  2. Make sure the buffer authority is the oracle authority. You can verify the authority by going to the solana explorer with https://api2.pythnet.pyth.network as a custom RPC and check the oracle program (FsJ3A3u2vn5cTVofAjvy6y5kwABJAqYWpe4975bi2epH) and the buffer.


Hey Guillermo

Thanks a lot for the work here ; it is paramount to keep improving Pythnet and the solutions put forward meet this goal

After reviewing the PRs and checking verification, all looks good to me so i’ll proceed to sign on this OP-PIP


I am personally excited to see such an optimization. Go Pyth contributors!


Verifying is paramount to the security of the network, thanks for the hard work councilor.


Awesome contribution Guillermo!

Does the 10-30% optimization in compute mean we’re able to increase the current 3000 price updates per second by roughly the same amount?

1 Like

There’s a limit to how many Compute Units can be processed per block so an optimization like this can definitely help increase the number of price updates per second.


Optimization is always good if possible :slight_smile: