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

**URL:** <https://forum.pyth.network/t/passed-op-pip-10-optimize-pyth-oracle-program/119>\
**Category:** Proposals\
**Tags:** operational-pip\
**Created:** [May 14, 2024, 2:37pm UTC](https://forum.pyth.network/t/passed-op-pip-10-optimize-pyth-oracle-program/119 "2024-05-14T14:37:23Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![guibescos](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.pyth.network/guibescos/32/24_2.png) [@guibescos](https://forum.pyth.network/u/guibescos)\
**Post date:** [May 14, 2024, 2:37pm UTC](https://forum.pyth.network/t/passed-op-pip-10-optimize-pyth-oracle-program/119/1 "2024-05-14T14:37:23Z")

</div>

### **Abstract**

* * *

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

### **Rationale**

* * *

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.

### **Description**

* * *

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](https://github.com/pyth-network/pyth-client/pull/402)

- Remove rent checks because they are enforced by the network - [PR](https://github.com/pyth-network/pyth-client/pull/403). [Storage rent](https://solana.com/docs/intro/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](https://proposals.pyth.network/?tab=proposals&proposal=Bj7w9MB37a3su9hYD6DPbYjXwBBoCywqcX4SM3SKy1GT)

Verify the implementation following the guide below:

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

2. git: install `git` from [here](https://git-scm.com/downloads)

3. Docker: install it from [here](https://www.docker.com/products/docker-desktop/)

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](https://github.com/pyth-network/pyth-client.git))

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:

```jsx
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:

```jsx
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](https://api2.pythnet.pyth.network) as a custom RPC and check the oracle program (`FsJ3A3u2vn5cTVofAjvy6y5kwABJAqYWpe4975bi2epH`) and the buffer.

---

<div class="post-metadata">

**Author:** ![KemarTiti](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.pyth.network/kemartiti/32/5_2.png) [@KemarTiti](https://forum.pyth.network/u/KemarTiti)\
**Post date:** [May 14, 2024, 4:08pm UTC](https://forum.pyth.network/t/passed-op-pip-10-optimize-pyth-oracle-program/119/2 "2024-05-14T16:08:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ed\_pyth](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.pyth.network/ed_pyth/32/12_2.png) [@ed\_pyth](https://forum.pyth.network/u/ed_pyth)\
**Post date:** [May 15, 2024, 6:18am UTC](https://forum.pyth.network/t/passed-op-pip-10-optimize-pyth-oracle-program/119/3 "2024-05-15T06:18:21Z")

</div>

> [@guibescos](#):
>
> will decrease the compute unit usage of price updates by 10-30%.

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

---

<div class="post-metadata">

**Author:** ![guibescos](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.pyth.network/guibescos/32/24_2.png) [@guibescos](https://forum.pyth.network/u/guibescos)\
**Post date:** [May 15, 2024, 4:02pm UTC](https://forum.pyth.network/t/passed-op-pip-10-optimize-pyth-oracle-program/119/4 "2024-05-15T16:02:26Z")

</div>

> [@KemarTiti](#):
>
> After reviewing the PRs and checking verification

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

---

<div class="post-metadata">

**Author:** ![Chop](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.pyth.network/chop/32/49_2.png) [@Chop](https://forum.pyth.network/u/Chop)\
**Post date:** [May 17, 2024, 12:16am UTC](https://forum.pyth.network/t/passed-op-pip-10-optimize-pyth-oracle-program/119/5 "2024-05-17T00:16:32Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![guibescos](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.pyth.network/guibescos/32/24_2.png) [@guibescos](https://forum.pyth.network/u/guibescos)\
**Post date:** [May 17, 2024, 12:29pm UTC](https://forum.pyth.network/t/passed-op-pip-10-optimize-pyth-oracle-program/119/6 "2024-05-17T12:29:25Z")

</div>

> [@Chop](#):
>
> 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?

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.

---

<div class="post-metadata">

**Author:** ![Pekarthebaker](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.pyth.network/pekarthebaker/32/68_2.png) [@Pekarthebaker](https://forum.pyth.network/u/Pekarthebaker)\
**Post date:** [May 29, 2024, 12:08pm UTC](https://forum.pyth.network/t/passed-op-pip-10-optimize-pyth-oracle-program/119/7 "2024-05-29T12:08:02Z")

</div>

Optimization is always good if possible 🙂

---

<div class="post-metadata">

**Author:** ![Pyth-DAO](https://avatars.discourse-cdn.com/v4/letter/p/edb3f5/32.png) [@Pyth-DAO](https://forum.pyth.network/u/Pyth-DAO)\
**Post date:** [June 4, 2024, 1:13pm UTC](https://forum.pyth.network/t/passed-op-pip-10-optimize-pyth-oracle-program/119/8 "2024-06-04T13:13:18Z")

</div>


