# \[PASSED\] OP-PIP-23: Upgrade Entropy contracts on all the mainnet chains

**URL:** <https://forum.pyth.network/t/passed-op-pip-23-upgrade-entropy-contracts-on-all-the-mainnet-chains/1712>\
**Category:** Proposals\
**Tags:** operational-pip\
**Created:** [August 27, 2024, 7:01am UTC](https://forum.pyth.network/t/passed-op-pip-23-upgrade-entropy-contracts-on-all-the-mainnet-chains/1712 "2024-08-27T07:01:57Z")\
**Posts on this page:** 2\
**Page:** 1

<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:** [August 27, 2024, 7:01am UTC](https://forum.pyth.network/t/passed-op-pip-23-upgrade-entropy-contracts-on-all-the-mainnet-chains/1712/1 "2024-08-27T07:01:57Z")

</div>

## Abstract

Upgrade the Entropy (mainnet) contracts to add additional functionality for reducing gas costs on reveal transactions.  
This proposal follows the successful testnet proposals [OP-PIP-21](https://forum.pyth.network/t/passed-op-pip-21-upgrade-entropy-contracts-on-all-the-testnet-chains/1698).

## Rationale

The upgrade aims to reduce the number of hashes required for each reveal by allowing the provider to advance their commitment to a a more recent sequence number that is already used.

## Description

The new feature implemented in the Entropy contracts is accompanied by the changes in Fortuna service that periodically checks the on-chain state and advances the commitment if necessary.

## Implementation Plan

- Relevant commits:
  - [feat(entropy): Limit number of hashes (#1822) · pyth-network/pyth-crosschain@8966444 · GitHub](https://github.com/pyth-network/pyth-crosschain/commit/89664442760fd358dd2743ecfebcb8d9e9f18182)

Proposal ID: [https://proposals.pyth.network/?tab=proposals&proposal=5YCsbprm2XQBLHfCXHpsiXnbMwgto7vvVsWq3f4fd1iF](https://proposals.pyth.network/?tab=proposals&proposal=5YCsbprm2XQBLHfCXHpsiXnbMwgto7vvVsWq3f4fd1iF)

- Verify the implementation following the guide below:

1. Make sure you have node-js, forge and jq installed.  
a. node-js: install `nvm` from [here](https://github.com/nvm-sh/nvm). Install node-js 18 (`nvm install 18; nvm use 18`).  
b. forge: install it from [here](https://getfoundry.sh/)  
c. jq: install it from [here](https://jqlang.github.io/jq/)
2. Clone the `pyth-crosschain` repo (`git clone https://github.com/pyth-network/pyth-crosschain.git`). Go to the `pyth-crosschain` directory and run the following command: `pnpm i && npx lerna run build`
3. Get the on-chain implementation code digest by going to the `contract_manager` directory and running `npx ts-node scripts/check_proposal.ts --cluster mainnet-beta --proposal <proposal id>`
4. Get the source code digest by going to the `target_chains/ethereum/contracts` directory and running `npx truffle compile --all && cat build/contracts/EntropyUpgradable.json | jq -r .deployedBytecode | tr -d '\r\n' | cast keccak`
5. Check the hash digest from the on-chain implementation (from step 3) matches the hash digest from the source code (from step 4).

---

<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:** [October 2, 2024, 8:58am UTC](https://forum.pyth.network/t/passed-op-pip-23-upgrade-entropy-contracts-on-all-the-mainnet-chains/1712/2 "2024-10-02T08:58:36Z")

</div>


