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

**URL:** <https://forum.pyth.network/t/passed-op-pip-8-upgrade-entropy-contracts-on-all-the-mainnet-chains/36>\
**Category:** Proposals\
**Tags:** operational-pip\
**Created:** [May 9, 2024, 3:39pm UTC](https://forum.pyth.network/t/passed-op-pip-8-upgrade-entropy-contracts-on-all-the-mainnet-chains/36 "2024-05-09T15:39:59Z")\
**Posts on this page:** 2\
**Page:** 1

<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:** [May 9, 2024, 3:39pm UTC](https://forum.pyth.network/t/passed-op-pip-8-upgrade-entropy-contracts-on-all-the-mainnet-chains/36/1 "2024-05-09T15:39:59Z")

</div>

## Abstract

Upgrade the Entropy contracts to allow users to register a callback when requesting random numbers. This callback is invoked once the request is fulfilled.

## Rationale

The upgrade enhances the developer experience by reducing the interaction to a single transaction.

## Description

The new feature implemented in the Entropy contracts enables users to register a callback when they request for a random number. This callback is automatically called by the Entropy contracts once the request is fulfilled, streamlining the process and improving the developer experience by necessitating only a single transaction.

## Implementation Plan

- Discuss [Proposal](https://proposals.pyth.network/?tab=proposals&proposal=7SK1LwYSxspoE8ub2x3PTi6JbEr3C6sa8gjutC4Mb3SD): `7SK1LwYSxspoE8ub2x3PTi6JbEr3C6sa8gjutC4Mb3SD` with Pyth community.
- Relevant commits:
  - [feat(entropy-v2): request with callback (#1342) · pyth-network/pyth-crosschain@e7bf47a · GitHub](https://github.com/pyth-network/pyth-crosschain/commit/e7bf47a18e2d9a9d983214342540691c1bada52e)
  - [feat(entropy-v2): add provider parameter to entropy callback (#1389) · pyth-network/pyth-crosschain@d821e01 · GitHub](https://github.com/pyth-network/pyth-crosschain/commit/d821e01109df9bad1f17c8e4e7d3d76bd9131747)
  - [feat(entropy\_contracts): don't call an address if it is an Eoa in rev… · pyth-network/pyth-crosschain@02e196e · GitHub](https://github.com/pyth-network/pyth-crosschain/commit/02e196e9242d258d43056f7f2c3762d95bf285d3)

- Proposal Ids:
  - [`7SK1LwYSxspoE8ub2x3PTi6JbEr3C6sa8gjutC4Mb3SD`](https://proposals.pyth.network/?tab=proposals&proposal=7SK1LwYSxspoE8ub2x3PTi6JbEr3C6sa8gjutC4Mb3SD)

- Verify the implementation following the guide below:

1. Make sure you have node-js, forge and jq installed.  
node-js: install `nvm` from [here](https://github.com/nvm-sh/nvm). Install node-js 18 (`nvm install 18; nvm use 18`).  
forge: install it from [here](https://getfoundry.sh/)  
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: `npm ci && 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:** [May 9, 2024, 3:40pm UTC](https://forum.pyth.network/t/passed-op-pip-8-upgrade-entropy-contracts-on-all-the-mainnet-chains/36/2 "2024-05-09T15:40:02Z")

</div>


