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:
7SK1LwYSxspoE8ub2x3PTi6JbEr3C6sa8gjutC4Mb3SD
with Pyth community. - Relevant commits:
- feat(entropy-v2): request with callback (#1342) · pyth-network/pyth-crosschain@e7bf47a · GitHub
- feat(entropy-v2): add provider parameter to entropy callback (#1389) · pyth-network/pyth-crosschain@d821e01 · GitHub
- feat(entropy_contracts): don't call an address if it is an Eoa in rev… · pyth-network/pyth-crosschain@02e196e · GitHub
- Proposal Ids:
- Verify the implementation following the guide below:
- Make sure you have node-js, forge and jq installed.
node-js: installnvm
from here. Install node-js 18 (nvm install 18; nvm use 18
).
forge: install it from here
jq: install it from here - Clone the
pyth-crosschain
repo (git clone https://github.com/pyth-network/pyth-crosschain.git
). Go to thepyth-crosschain
directory and run the following command:npm ci && npx lerna run build
- Get the on-chain implementation code digest by going to the
contract_manager
directory and runningnpx ts-node scripts/check_proposal.ts --cluster mainnet-beta --proposal <proposal id>
- Get the source code digest by going to the
target_chains/ethereum/contracts
directory and runningnpx truffle compile --all && cat build/contracts/EntropyUpgradable.json | jq -r .deployedBytecode | tr -d '\r\n' | cast keccak
- Check the hash digest from the on-chain implementation (from step 3) matches the hash digest from the source code (from step 4).