Skip to content

Commit

Permalink
Removing non-zero check for tx.gasprice
Browse files Browse the repository at this point in the history
- Removed a non-zero check for transaction gas price, because the fixed
has been merged in go-ethereum ethereum/go-ethereum#20189
  • Loading branch information
dimpar committed Jan 27, 2020
1 parent 6c4848c commit a47a105
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
8 changes: 1 addition & 7 deletions contracts/solidity/contracts/KeepRandomBeaconOperator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -384,13 +384,7 @@ contract KeepRandomBeaconOperator is ReentrancyGuard {
* be returned to the DKG fee pool of the service contract which triggered the DKG.
*/
function reimburseDkgSubmitter() internal {
uint256 gasPrice = priceFeedEstimate;
// We need to check if tx.gasprice is non-zero as a workaround to a bug
// in go-ethereum:
// https://github.com/ethereum/go-ethereum/pull/20189
if (tx.gasprice > 0 && tx.gasprice < priceFeedEstimate) {
gasPrice = tx.gasprice;
}
uint256 gasPrice = tx.gasprice < priceFeedEstimate ? tx.gasprice : priceFeedEstimate;

uint256 reimbursementFee = dkgGasEstimate.mul(gasPrice);
address payable magpie = stakingContract.magpieOf(msg.sender);
Expand Down
12 changes: 1 addition & 11 deletions contracts/solidity/contracts/KeepRandomBeaconServiceImplV1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -333,18 +333,8 @@ contract KeepRandomBeaconServiceImplV1 is DelayedWithdrawal, ReentrancyGuard {
)(abi.encodeWithSignature(_callbacks[requestId].callbackMethod, entry));
uint256 gasSpent = gasBeforeCallback.sub(gasleft()).add(21000); // Also reimburse 21000 gas (ethereum transaction minimum gas)

uint256 gasPrice = _priceFeedEstimate;
// We need to check if tx.gasprice is non-zero as a workaround to a bug
// in go-ethereum:
// https://github.com/ethereum/go-ethereum/pull/20189
if (tx.gasprice > 0 && tx.gasprice < _priceFeedEstimate) {
gasPrice = tx.gasprice;
}

// Obtain the actual callback gas expenditure and refund the surplus.
// uint256 callbackFee = gasSpent.mul(gasPrice);
uint256 gasPrice = tx.gasprice < _priceFeedEstimate ? tx.gasprice : _priceFeedEstimate;

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

0 comments on commit a47a105

Please sign in to comment.