Abstract
Upgrade the Entropy testnet contracts to fix a bug in the callback gas handling logic. This fix ensures that callbacks are only marked as failed when sufficient gas was provided, regardless of the revert code returned.
If successful, a similar proposal will be raised for Entropy mainnets.
Rationale
The previous implementation would mark callbacks as failed based on the return value (ret.length > 0) or gas consumption. However, some user contracts catch out-of-gas errors and revert with a different error message, which could lead to incorrect failure marking.
Description
The bug fix modifies the Entropy contract’s callback handling logic to remove the dependency on the revert return data (ret.length). Instead, it relies solely on whether sufficient gas was provided to the callback execution.
Key changes:
- Removed the
ret.length > 0condition from the callback failure check - Now only checks if
(startingGas * 31) / 32 > uint256(req.gasLimit10k) * TEN_THOUSANDto determine if enough gas was provided - This ensures consistent behavior regardless of how user contracts handle out-of-gas conditions
This change prevents false positives where callbacks might be incorrectly marked as failed when user contracts catch and re-throw errors with different messages.
Implementation Plan
-
Relevant commits:
-
Pull Request:
-
Proposal Id:
2QYUeYCanUZeMPEHTxqAAMwpxSTrqWWUWPn115hQx5UD -
Verify the implementation following the guide below:
- Make sure you have node-js, forge and jq installed.
- Clone the
pyth-crosschainrepo (git clone <https://github.com/pyth-network/pyth-crosschain.git>). Go to thepyth-crosschaindirectory and run the following command:pnpm i && pnpm turbo build - Get the on-chain implementation code digest by going to the
contract_managerdirectory and runningnpx ts-node scripts/check_proposal.ts --cluster mainnet-beta --proposal2QYUeYCanUZeMPEHTxqAAMwpxSTrqWWUWPn115hQx5UD - Get the source code digest by going to the
target_chains/ethereum/contractsdirectory and runningforge build && cat
out/EntropyUpgradable.sol/EntropyUpgradable.json | jq -r .deployedBytecode.object | 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).