Browse Source

fix: update requestV2 methods to return provider address only in interface

Co-Authored-By: Jayant <jayant@dourolabs.xyz>
Devin AI 5 months ago
parent
commit
17d5b598c5

+ 9 - 8
target_chains/ethereum/contracts/contracts/entropy/Entropy.sol

@@ -290,7 +290,8 @@ abstract contract Entropy is IEntropy, EntropyState {
         returns (uint64 sequenceNumber, address providerAddress)
         returns (uint64 sequenceNumber, address providerAddress)
     {
     {
         address provider = getDefaultProvider();
         address provider = getDefaultProvider();
-        (sequenceNumber, ) = requestV2(provider, random(), 0);
+        uint64 seq = requestV2(provider, random(), 0);
+        sequenceNumber = seq;
         providerAddress = provider;
         providerAddress = provider;
     }
     }
 
 
@@ -303,7 +304,8 @@ abstract contract Entropy is IEntropy, EntropyState {
         returns (uint64 sequenceNumber, address providerAddress)
         returns (uint64 sequenceNumber, address providerAddress)
     {
     {
         address provider = getDefaultProvider();
         address provider = getDefaultProvider();
-        (sequenceNumber, ) = requestV2(provider, random(), gasLimit);
+        uint64 seq = requestV2(provider, random(), gasLimit);
+        sequenceNumber = seq;
         providerAddress = provider;
         providerAddress = provider;
     }
     }
 
 
@@ -316,7 +318,8 @@ abstract contract Entropy is IEntropy, EntropyState {
         override
         override
         returns (uint64 sequenceNumber, address providerAddress)
         returns (uint64 sequenceNumber, address providerAddress)
     {
     {
-        (sequenceNumber, ) = requestV2(provider, random(), gasLimit);
+        uint64 seq = requestV2(provider, random(), gasLimit);
+        sequenceNumber = seq;
         providerAddress = provider;
         providerAddress = provider;
     }
     }
 
 
@@ -358,12 +361,11 @@ abstract contract Entropy is IEntropy, EntropyState {
         address provider,
         address provider,
         bytes32 userContribution
         bytes32 userContribution
     ) public payable override returns (uint64) {
     ) public payable override returns (uint64) {
-        (uint64 sequenceNumber, ) = requestV2(
+        return requestV2(
             provider,
             provider,
             userContribution,
             userContribution,
             0 // Passing 0 will assign the request the provider's default gas limit
             0 // Passing 0 will assign the request the provider's default gas limit
         );
         );
-        return sequenceNumber;
     }
     }
 
 
     function requestV2(
     function requestV2(
@@ -374,7 +376,7 @@ abstract contract Entropy is IEntropy, EntropyState {
         public
         public
         payable
         payable
         override
         override
-        returns (uint64 sequenceNumber, address providerAddress)
+        returns (uint64)
     {
     {
         EntropyStructsV2.Request storage req = requestHelper(
         EntropyStructsV2.Request storage req = requestHelper(
             provider,
             provider,
@@ -402,8 +404,7 @@ abstract contract Entropy is IEntropy, EntropyState {
             uint32(req.gasLimit10k) * TEN_THOUSAND,
             uint32(req.gasLimit10k) * TEN_THOUSAND,
             bytes("")
             bytes("")
         );
         );
-        sequenceNumber = req.sequenceNumber;
-        providerAddress = provider;
+        return req.sequenceNumber;
     }
     }
 
 
     // This method validates the provided user's revelation and provider's revelation against the corresponding
     // This method validates the provided user's revelation and provider's revelation against the corresponding

+ 3 - 3
target_chains/ethereum/contracts/forge-test/Entropy.t.sol

@@ -1759,7 +1759,7 @@ contract EntropyTest is Test, EntropyTestUtils, EntropyEvents, EntropyEventsV2 {
             bytes("")
             bytes("")
         );
         );
         vm.prank(user1);
         vm.prank(user1);
-        (uint64 sequenceNumber, ) = random.requestV2{value: fee}(
+        uint64 sequenceNumber = random.requestV2{value: fee}(
             provider1,
             provider1,
             userRandomNumber,
             userRandomNumber,
             gasLimit
             gasLimit
@@ -1953,7 +1953,7 @@ contract EntropyConsumer is IEntropyConsumer {
         bytes32 randomNumber
         bytes32 randomNumber
     ) public payable returns (uint64 sequenceNumber) {
     ) public payable returns (uint64 sequenceNumber) {
         address _provider = IEntropy(entropy).getDefaultProvider();
         address _provider = IEntropy(entropy).getDefaultProvider();
-        (sequenceNumber, ) = IEntropy(entropy).requestV2{value: msg.value}(
+        sequenceNumber = IEntropy(entropy).requestV2{value: msg.value}(
             _provider,
             _provider,
             randomNumber,
             randomNumber,
             0
             0
@@ -1965,7 +1965,7 @@ contract EntropyConsumer is IEntropyConsumer {
         uint32 gasLimit
         uint32 gasLimit
     ) public payable returns (uint64 sequenceNumber) {
     ) public payable returns (uint64 sequenceNumber) {
         address _provider = IEntropy(entropy).getDefaultProvider();
         address _provider = IEntropy(entropy).getDefaultProvider();
-        (sequenceNumber, ) = IEntropy(entropy).requestV2{value: msg.value}(
+        sequenceNumber = IEntropy(entropy).requestV2{value: msg.value}(
             _provider,
             _provider,
             randomNumber,
             randomNumber,
             gasLimit
             gasLimit

+ 2 - 3
target_chains/ethereum/entropy_sdk/solidity/IEntropyV2.sol

@@ -87,8 +87,7 @@ interface IEntropyV2 is EntropyEventsV2 {
     /// @param provider The address of the provider to request from
     /// @param provider The address of the provider to request from
     /// @param userRandomNumber A random number provided by the user for additional entropy
     /// @param userRandomNumber A random number provided by the user for additional entropy
     /// @param gasLimit The gas limit for the callback function. Pass 0 to get a sane default value -- see note below.
     /// @param gasLimit The gas limit for the callback function. Pass 0 to get a sane default value -- see note below.
-    /// @return sequenceNumber A unique identifier for this request
-    /// @return providerAddress The address of the provider that handled the request
+    /// @return A unique identifier for this request
     /// @dev The address calling this function should be a contract that inherits from the IEntropyConsumer interface.
     /// @dev The address calling this function should be a contract that inherits from the IEntropyConsumer interface.
     /// The `entropyCallback` method on that interface will receive a callback with the returned sequence number and
     /// The `entropyCallback` method on that interface will receive a callback with the returned sequence number and
     /// the generated random number.
     /// the generated random number.
@@ -104,7 +103,7 @@ interface IEntropyV2 is EntropyEventsV2 {
         address provider,
         address provider,
         bytes32 userRandomNumber,
         bytes32 userRandomNumber,
         uint32 gasLimit
         uint32 gasLimit
-    ) external payable returns (uint64 sequenceNumber, address providerAddress);
+    ) external payable returns (uint64);
 
 
     /// @notice Get information about a specific entropy provider
     /// @notice Get information about a specific entropy provider
     /// @param provider The address of the provider to query
     /// @param provider The address of the provider to query

+ 1 - 6
target_chains/ethereum/entropy_sdk/solidity/abis/IEntropyV2.json

@@ -633,13 +633,8 @@
     "outputs": [
     "outputs": [
       {
       {
         "internalType": "uint64",
         "internalType": "uint64",
-        "name": "sequenceNumber",
+        "name": "",
         "type": "uint64"
         "type": "uint64"
-      },
-      {
-        "internalType": "address",
-        "name": "providerAddress",
-        "type": "address"
       }
       }
     ],
     ],
     "stateMutability": "payable",
     "stateMutability": "payable",