Skip to content

Instantly share code, notes, and snippets.

@novaknole
Created January 28, 2023 11:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save novaknole/5f761849cba2f076d8b89bc78a137af8 to your computer and use it in GitHub Desktop.
Save novaknole/5f761849cba2f076d8b89bc78a137af8 to your computer and use it in GitHub Desktop.
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract BadGuy {
function youveActivateMyTrapCard() external pure returns (bytes memory) {
assembly{
revert(0, 10000000000000000000000)
}
}
}
contract Mark {
uint public a = 5;
function oops(address badGuy) public {
bool success;
bytes memory ret;
// Mark pays a lot of gas for this copy 😬😬😬
(success, ret) = badGuy.call{gas: 30000}(
abi.encodeWithSelector(
BadGuy.youveActivateMyTrapCard.selector
)
);
// Still succeeds
a = 10;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment