Skip to content

Commit a47a105

Browse files
committed
Removing non-zero check for tx.gasprice
- Removed a non-zero check for transaction gas price, because the fixed has been merged in go-ethereum ethereum/go-ethereum#20189
1 parent 6c4848c commit a47a105

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

contracts/solidity/contracts/KeepRandomBeaconOperator.sol

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -384,13 +384,7 @@ contract KeepRandomBeaconOperator is ReentrancyGuard {
384384
* be returned to the DKG fee pool of the service contract which triggered the DKG.
385385
*/
386386
function reimburseDkgSubmitter() internal {
387-
uint256 gasPrice = priceFeedEstimate;
388-
// We need to check if tx.gasprice is non-zero as a workaround to a bug
389-
// in go-ethereum:
390-
// https://github.com/ethereum/go-ethereum/pull/20189
391-
if (tx.gasprice > 0 && tx.gasprice < priceFeedEstimate) {
392-
gasPrice = tx.gasprice;
393-
}
387+
uint256 gasPrice = tx.gasprice < priceFeedEstimate ? tx.gasprice : priceFeedEstimate;
394388

395389
uint256 reimbursementFee = dkgGasEstimate.mul(gasPrice);
396390
address payable magpie = stakingContract.magpieOf(msg.sender);

contracts/solidity/contracts/KeepRandomBeaconServiceImplV1.sol

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -333,18 +333,8 @@ contract KeepRandomBeaconServiceImplV1 is DelayedWithdrawal, ReentrancyGuard {
333333
)(abi.encodeWithSignature(_callbacks[requestId].callbackMethod, entry));
334334
uint256 gasSpent = gasBeforeCallback.sub(gasleft()).add(21000); // Also reimburse 21000 gas (ethereum transaction minimum gas)
335335

336-
uint256 gasPrice = _priceFeedEstimate;
337-
// We need to check if tx.gasprice is non-zero as a workaround to a bug
338-
// in go-ethereum:
339-
// https://github.com/ethereum/go-ethereum/pull/20189
340-
if (tx.gasprice > 0 && tx.gasprice < _priceFeedEstimate) {
341-
gasPrice = tx.gasprice;
342-
}
343-
344-
// Obtain the actual callback gas expenditure and refund the surplus.
345-
// uint256 callbackFee = gasSpent.mul(gasPrice);
336+
uint256 gasPrice = tx.gasprice < _priceFeedEstimate ? tx.gasprice : _priceFeedEstimate;
346337

347-
// revert("bbbb");
348338
address latestOperatorContract = _operatorContracts[_operatorContracts.length.sub(1)];
349339
OperatorContract(latestOperatorContract).reimburseCallback.value(gasSpent.mul(gasPrice))(
350340
_callbacks[requestId].callbackFee, submitter, _callbacks[requestId].surplusRecipient);

0 commit comments

Comments
 (0)