Skip to content

Commit

Permalink
Closes safe-global#274: Revert on failure with safeTxGas 0 (safe-glob…
Browse files Browse the repository at this point in the history
  • Loading branch information
rmeissner authored Mar 23, 2021
1 parent a1db639 commit ee28b7d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions GnosisSafe.sol
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ contract GnosisSafe
// We only substract 2500 (compared to the 3000 before) to ensure that the amount passed is still higher than safeTxGas
success = execute(to, value, data, operation, gasPrice == 0 ? (gasleft() - 2500) : safeTxGas);
gasUsed = gasUsed.sub(gasleft());
// If no safeTxGas and no gasPrice was set (e.g. both are 0), then the internal tx is required to be successful
// This makes it possible to use `estimateGas` without issues, as it searches for the minimum gas where the tx doesn't revert
require(success || safeTxGas != 0 || gasPrice != 0, "GS013");
// We transfer the calculated tx costs to the tx.origin to avoid sending it to intermediate contracts that have made calls
uint256 payment = 0;
if (gasPrice > 0) {
Expand Down

0 comments on commit ee28b7d

Please sign in to comment.