Skip to content

Commit

Permalink
fix reward distributor to bubble failures
Browse files Browse the repository at this point in the history
in the simplest possible way, fix a bug which prevents reward
distribution from getting sent to L2 due to internal OOG gas logic in
optimism contract (normally if you are OOG then the remaining code in
RewardsDistribution would also fail, but optimism deliberately consumes
an excessive amount of gas in a way that causes only the internal call
to fail)

in accordance with [SIP-2036](https://sips-go29dg4x3-synthetixio.vercel.app/sips/sip-2036/)

note: if you are wondering why I didnt just call the rewards
distribution receiver contract normally and continue to be using hte low
level call, the reason is im trying to keep changes to a minimal and
this change basically ended up being a 1 line changes.
  • Loading branch information
dbeal-eth committed Oct 13, 2023
1 parent 5860850 commit 1b92aaa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions contracts/RewardsDistribution.sol
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,13 @@ contract RewardsDistribution is Owned, IRewardsDistribution {
bytes memory payload = abi.encodeWithSignature("notifyRewardAmount(uint256)", distributions[i].amount);

// solhint-disable avoid-low-level-calls
(bool success, ) = distributions[i].destination.call(payload);
(bool success, bytes result) = distributions[i].destination.call(payload);

if (!success) {
// Note: we're ignoring the return value as it will fail for contracts that do not implement RewardsDistributionRecipient.sol
// if the error was emitted by the destination contract, bubble
assembly {
revert(add(result, 0x20), len)
}
}
}
}
Expand Down

0 comments on commit 1b92aaa

Please sign in to comment.