Skip to content

Commit c743548

Browse files
committed
initial commit: gas limit in request
1 parent 5da7aef commit c743548

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

target_chains/ethereum/contracts/contracts/entropy/Entropy.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ abstract contract Entropy is IEntropy, EntropyState {
369369
req.requester,
370370
req.sequenceNumber,
371371
userRandomNumber,
372+
uint32(req.gasLimit10k) * TEN_THOUSAND,
372373
bytes("")
373374
);
374375
return req.sequenceNumber;

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

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,7 @@ contract EntropyTest is Test, EntropyTestUtils, EntropyEvents, EntropyEventsV2 {
825825
user1,
826826
providerInfo.sequenceNumber,
827827
userRandomNumber,
828+
0,
828829
bytes("")
829830
);
830831
vm.roll(1234);
@@ -1018,6 +1019,15 @@ contract EntropyTest is Test, EntropyTestUtils, EntropyEvents, EntropyEventsV2 {
10181019
uint fee = random.getFee(provider1);
10191020
EntropyConsumer consumer = new EntropyConsumer(address(random), false);
10201021
vm.deal(user1, fee);
1022+
vm.expectEmit(false, false, false, true, address(random));
1023+
emit EntropyEventsV2.Requested(
1024+
provider1,
1025+
user1,
1026+
0,
1027+
userRandomNumber,
1028+
100000,
1029+
bytes("")
1030+
);
10211031
vm.prank(user1);
10221032
uint64 assignedSequenceNumber = consumer.requestEntropy{value: fee}(
10231033
userRandomNumber
@@ -1718,9 +1728,18 @@ contract EntropyTest is Test, EntropyTestUtils, EntropyEvents, EntropyEventsV2 {
17181728
gasLimit
17191729
);
17201730

1721-
uint128 startingAccruedProviderFee = random
1722-
.getProviderInfoV2(provider1)
1723-
.accruedFeesInWei;
1731+
EntropyStructsV2.ProviderInfo memory providerInfo = random.getProviderInfoV2(provider1);
1732+
1733+
uint128 startingAccruedProviderFee = providerInfo.accruedFeesInWei;
1734+
vm.expectEmit(false, false, false, true, address(random));
1735+
emit EntropyEventsV2.Requested(
1736+
provider1,
1737+
user1,
1738+
providerInfo.sequenceNumber,
1739+
userRandomNumber,
1740+
uint32(expectedGasLimit10k) * 10000,
1741+
bytes("")
1742+
);
17241743
vm.prank(user1);
17251744
uint64 sequenceNumber = random.requestWithCallbackAndGasLimit{
17261745
value: fee

target_chains/ethereum/entropy_sdk/solidity/EntropyEventsV2.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ interface EntropyEventsV2 {
2424
* @param caller The address of the user requesting the random number
2525
* @param sequenceNumber A unique identifier for this request
2626
* @param userRandomNumber A random number provided by the user for additional entropy
27+
* @param gasLimit The gas limit for the callback.
2728
* @param extraArgs A field for extra data for forward compatibility.
2829
*/
2930
event Requested(
3031
address indexed provider,
3132
address indexed caller,
3233
uint64 indexed sequenceNumber,
3334
bytes32 userRandomNumber,
35+
uint32 gasLimit,
3436
bytes extraArgs
3537
);
3638

0 commit comments

Comments
 (0)