From db33cf48687684844a6bf6000e9b5081be6f6d01 Mon Sep 17 00:00:00 2001 From: Noah Litvin <335975+noahlitvin@users.noreply.github.com> Date: Wed, 6 Sep 2023 15:10:23 -0400 Subject: [PATCH] Update EIP-7412: Remove `oracleQuery` from `fulfillOracleQuery` function signature Merged by EIP-Bot. --- EIPS/eip-7412.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/EIPS/eip-7412.md b/EIPS/eip-7412.md index 194da934c6b7a1..43e651e70de2d9 100644 --- a/EIPS/eip-7412.md +++ b/EIPS/eip-7412.md @@ -39,13 +39,15 @@ error OracleDataRequired(address oracleContract, bytes oracleQuery) ```solidity interface IERC7412 { function oracleId() view external returns (bytes32 oracleId); - function fulfillOracleQuery(bytes oracleQuery, bytes signedOffchainData) payable external; + function fulfillOracleQuery(bytes signedOffchainData) payable external; } ``` `oracleId` is a unique identifier that references the decentralized oracle network that generates the desired signed off-chain data. Oracle IDs would be analogous to Chain IDs in the Ethereum ecosystem. Clients are expected to resolve a gateway that corresponds to an Oracle ID, similar to how clients are expected to resolve an RPC endpoint based on a Chain ID. -The contract implementing the `IOracleContract` interface MUST revert with the following error message if it requires payment to fulfill the oracle data query: +It should be possible to derive the `oracleQuery` from the `signedOffchainData`, such that the oracle contract is able to provide the verified offchain data based on the `oracleQuery`. + +The contract implementing the `IERC7412` interface MUST revert with the following error message if it requires payment to fulfill the oracle data query: ```solidity error FeeRequired(uint amount) @@ -111,8 +113,8 @@ contract OracleContract is IERC7412 { return bytes32(abi.encodePacked("MY_ORACLE_ID")); } - function fulfillOracleQuery(bytes calldata oracleQuery, bytes calldata signedOffchainData) payable external { - _verify(signedOffchainData); + function fulfillOracleQuery(bytes calldata signedOffchainData) payable external { + bytes memory oracleQuery = _verify(signedOffchainData); latestVerifiedData[keccak256(oracleQuery)] = signedOffchainData; } @@ -127,7 +129,7 @@ contract OracleContract is IERC7412 { return response; } - function _verify(bytes memory signedOffchainData) payable internal { + function _verify(bytes memory signedOffchainData) payable internal returns (bytes oracleQuery) { // Insert verification code here // This may revert with error FeeRequired(uint amount) }