Ver Fonte

add 50% overhead to gas for cross-contract calls

Daniel Chew há 10 meses atrás
pai
commit
32494cc7fa

+ 2 - 2
target_chains/ethereum/contracts/contracts/pulse/Pulse.sol

@@ -81,8 +81,8 @@ abstract contract Pulse is IPulse, PulseState {
                 SafeCast.toUint64(req.publishTime)
             );
 
-        // Check if enough gas remains for the callback
-        if (gasleft() < req.callbackGasLimit) {
+        // Check if enough gas remains for the callback plus 50% overhead for cross-contract call (uses integer arithmetic to avoid floating point)
+        if (gasleft() < (req.callbackGasLimit * 3) / 2) {
             revert InsufficientGas();
         }