Skip to content

Commit 8e8172d

Browse files
devin-ai-integration[bot]Jayant
andauthored
docs: add deprecation warnings to IEntropy.sol interface (#3001)
* docs: add deprecation warnings to IEntropy.sol interface - Add deprecation warning at top of interface directing users to IEntropyV2 - Warn that request() method does NOT invoke callbacks, recommend requestV2 - Mark requestWithCallback() as deprecated, recommend requestV2 from IEntropyV2 This addresses user confusion where calling request() instead of requestWithCallback() results in no callback being invoked, helping users understand the correct methods to use. Co-Authored-By: Jayant <[email protected]> * fix: apply forge formatting to IEntropy.sol Apply Solidity formatting rules to fix CI test failure Co-Authored-By: Jayant <[email protected]> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Jayant <[email protected]>
1 parent b4f68e2 commit 8e8172d

File tree

1 file changed

+33
-43
lines changed

1 file changed

+33
-43
lines changed

target_chains/ethereum/entropy_sdk/solidity/IEntropy.sol

Lines changed: 33 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import "./EntropyEventsV2.sol";
66
import "./EntropyStructsV2.sol";
77
import "./IEntropyV2.sol";
88

9+
/// @notice DEPRECATED: This interface is deprecated. Please use IEntropyV2 instead for new implementations.
10+
/// IEntropyV2 provides better callback handling and improved functionality.
911
interface IEntropy is EntropyEvents, EntropyEventsV2, IEntropyV2 {
1012
// Register msg.sender as a randomness provider. The arguments are the provider's configuration parameters
1113
// and initial commitment. Re-registering the same provider rotates the provider's commitment (and updates
@@ -38,17 +40,22 @@ interface IEntropy is EntropyEvents, EntropyEventsV2, IEntropyV2 {
3840
// their chosen provider (the exact method for doing so will depend on the provider) to retrieve the provider's
3941
// number. The user should then call fulfillRequest to construct the final random number.
4042
//
43+
// WARNING: This method does NOT invoke a user callback. If you need callback functionality,
44+
// use requestV2 from the IEntropyV2 interface instead.
45+
//
4146
// This method will revert unless the caller provides a sufficient fee (at least getFee(provider)) as msg.value.
4247
// Note that excess value is *not* refunded to the caller.
43-
function request(
44-
address provider,
45-
bytes32 userCommitment,
46-
bool useBlockHash
47-
) external payable returns (uint64 assignedSequenceNumber);
48+
function request(address provider, bytes32 userCommitment, bool useBlockHash)
49+
external
50+
payable
51+
returns (uint64 assignedSequenceNumber);
4852

4953
// Request a random number. The method expects the provider address and a secret random number
5054
// in the arguments. It returns a sequence number.
5155
//
56+
// DEPRECATED: This method is deprecated. Please use requestV2 from the IEntropyV2 interface instead,
57+
// which provides better callback handling and gas limit control.
58+
//
5259
// The address calling this function should be a contract that inherits from the IEntropyConsumer interface.
5360
// The `entropyCallback` method on that interface will receive a callback with the generated random number.
5461
// `entropyCallback` will be run with the provider's default gas limit (see `getProviderInfo(provider).defaultGasLimit`).
@@ -57,10 +64,10 @@ interface IEntropy is EntropyEvents, EntropyEventsV2, IEntropyV2 {
5764
//
5865
// This method will revert unless the caller provides a sufficient fee (at least `getFee(provider)`) as msg.value.
5966
// Note that excess value is *not* refunded to the caller.
60-
function requestWithCallback(
61-
address provider,
62-
bytes32 userRandomNumber
63-
) external payable returns (uint64 assignedSequenceNumber);
67+
function requestWithCallback(address provider, bytes32 userRandomNumber)
68+
external
69+
payable
70+
returns (uint64 assignedSequenceNumber);
6471

6572
// Fulfill a request for a random number. This method validates the provided userRandomness and provider's proof
6673
// against the corresponding commitments in the in-flight request. If both values are validated, this function returns
@@ -69,12 +76,9 @@ interface IEntropy is EntropyEvents, EntropyEventsV2, IEntropyV2 {
6976
// Note that this function can only be called once per in-flight request. Calling this function deletes the stored
7077
// request information (so that the contract doesn't use a linear amount of storage in the number of requests).
7178
// If you need to use the returned random number more than once, you are responsible for storing it.
72-
function reveal(
73-
address provider,
74-
uint64 sequenceNumber,
75-
bytes32 userRevelation,
76-
bytes32 providerRevelation
77-
) external returns (bytes32 randomNumber);
79+
function reveal(address provider, uint64 sequenceNumber, bytes32 userRevelation, bytes32 providerRevelation)
80+
external
81+
returns (bytes32 randomNumber);
7882

7983
// Fulfill a request for a random number. This method validates the provided userRandomness
8084
// and provider's revelation against the corresponding commitment in the in-flight request. If both values are validated
@@ -93,30 +97,22 @@ interface IEntropy is EntropyEvents, EntropyEventsV2, IEntropyV2 {
9397
bytes32 providerRevelation
9498
) external;
9599

96-
function getProviderInfo(
97-
address provider
98-
) external view returns (EntropyStructs.ProviderInfo memory info);
100+
function getProviderInfo(address provider) external view returns (EntropyStructs.ProviderInfo memory info);
99101

100-
function getRequest(
101-
address provider,
102-
uint64 sequenceNumber
103-
) external view returns (EntropyStructs.Request memory req);
102+
function getRequest(address provider, uint64 sequenceNumber)
103+
external
104+
view
105+
returns (EntropyStructs.Request memory req);
104106

105107
// Get the fee charged by provider for a request with the default gasLimit (`request` or `requestWithCallback`).
106108
// If you are calling any of the `requestV2` methods, please use `getFeeV2`.
107109
function getFee(address provider) external view returns (uint128 feeAmount);
108110

109-
function getAccruedPythFees()
110-
external
111-
view
112-
returns (uint128 accruedPythFeesInWei);
111+
function getAccruedPythFees() external view returns (uint128 accruedPythFeesInWei);
113112

114113
function setProviderFee(uint128 newFeeInWei) external;
115114

116-
function setProviderFeeAsFeeManager(
117-
address provider,
118-
uint128 newFeeInWei
119-
) external;
115+
function setProviderFeeAsFeeManager(address provider, uint128 newFeeInWei) external;
120116

121117
function setProviderUri(bytes calldata newUri) external;
122118

@@ -135,19 +131,13 @@ interface IEntropy is EntropyEvents, EntropyEventsV2, IEntropyV2 {
135131

136132
// Advance the provider commitment and increase the sequence number.
137133
// This is used to reduce the `numHashes` required for future requests which leads to reduced gas usage.
138-
function advanceProviderCommitment(
139-
address provider,
140-
uint64 advancedSequenceNumber,
141-
bytes32 providerRevelation
142-
) external;
134+
function advanceProviderCommitment(address provider, uint64 advancedSequenceNumber, bytes32 providerRevelation)
135+
external;
143136

144-
function constructUserCommitment(
145-
bytes32 userRandomness
146-
) external pure returns (bytes32 userCommitment);
137+
function constructUserCommitment(bytes32 userRandomness) external pure returns (bytes32 userCommitment);
147138

148-
function combineRandomValues(
149-
bytes32 userRandomness,
150-
bytes32 providerRandomness,
151-
bytes32 blockHash
152-
) external pure returns (bytes32 combinedRandomness);
139+
function combineRandomValues(bytes32 userRandomness, bytes32 providerRandomness, bytes32 blockHash)
140+
external
141+
pure
142+
returns (bytes32 combinedRandomness);
153143
}

0 commit comments

Comments
 (0)