@@ -369,6 +369,7 @@ abstract contract Entropy is IEntropy, EntropyState {
369
369
req.requester,
370
370
req.sequenceNumber,
371
371
userRandomNumber,
372
+ uint32 (req.gasLimit10k) * TEN_THOUSAND,
372
373
bytes ("" )
373
374
);
374
375
return req.sequenceNumber;
@@ -543,16 +544,13 @@ abstract contract Entropy is IEntropy, EntropyState {
543
544
revert EntropyErrors.InvalidRevealCall ();
544
545
}
545
546
546
- bytes32 blockHash;
547
547
bytes32 randomNumber;
548
- (randomNumber, blockHash ) = revealHelper (
548
+ (randomNumber, ) = revealHelper (
549
549
req,
550
550
userRandomNumber,
551
551
providerRevelation
552
552
);
553
553
554
- address callAddress = req.requester;
555
-
556
554
// If the request has an explicit gas limit, then run the new callback failure state flow.
557
555
//
558
556
// Requests that haven't been invoked yet will be invoked safely (catching reverts), and
@@ -567,7 +565,7 @@ abstract contract Entropy is IEntropy, EntropyState {
567
565
bool success;
568
566
bytes memory ret;
569
567
uint256 startingGas = gasleft ();
570
- (success, ret) = callAddress .excessivelySafeCall (
568
+ (success, ret) = req.requester .excessivelySafeCall (
571
569
// Warning: the provided gas limit below is only an *upper bound* on the gas provided to the call.
572
570
// At most 63/64ths of the current context's gas will be provided to a call, which may be less
573
571
// than the indicated gas limit. (See CALL opcode docs here https://www.evm.codes/?fork=cancun#f1)
@@ -582,6 +580,7 @@ abstract contract Entropy is IEntropy, EntropyState {
582
580
randomNumber
583
581
)
584
582
);
583
+ uint32 gasUsed = SafeCast.toUint32 (startingGas - gasleft ());
585
584
// Reset status to not started here in case the transaction reverts.
586
585
req.callbackStatus = EntropyStatusConstants.CALLBACK_NOT_STARTED;
587
586
@@ -599,6 +598,7 @@ abstract contract Entropy is IEntropy, EntropyState {
599
598
randomNumber,
600
599
false ,
601
600
ret,
601
+ SafeCast.toUint32 (gasUsed),
602
602
bytes ("" )
603
603
);
604
604
clearRequest (provider, sequenceNumber);
@@ -628,6 +628,7 @@ abstract contract Entropy is IEntropy, EntropyState {
628
628
randomNumber,
629
629
true ,
630
630
ret,
631
+ SafeCast.toUint32 (gasUsed),
631
632
bytes ("" )
632
633
);
633
634
req.callbackStatus = EntropyStatusConstants.CALLBACK_FAILED;
@@ -655,13 +656,15 @@ abstract contract Entropy is IEntropy, EntropyState {
655
656
randomNumber,
656
657
false ,
657
658
bytes ("" ),
659
+ 0 , // gas usage not tracked in the old no-gas-limit flow.
658
660
bytes ("" )
659
661
);
660
662
661
663
clearRequest (provider, sequenceNumber);
662
664
663
- // Check if the callAddress is a contract account.
665
+ // Check if the requester is a contract account.
664
666
uint len;
667
+ address callAddress = req.requester;
665
668
assembly {
666
669
len := extcodesize (callAddress)
667
670
}
0 commit comments