From dc1ee577dbe1ddd2a4318082805ed28ed58272ad Mon Sep 17 00:00:00 2001 From: onibakuchi Date: Wed, 5 Jun 2024 01:53:36 +0400 Subject: [PATCH] edit comments --- README.md | 2 +- src/GrimReaper.huff | 1 + src/OptimizedGrimReaper.sol | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0e011d7..c1ee012 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ For more information on how to use Foundry, check out the [Foundry Github Reposi - [ ] Approve once on contract deployment instead of every liquidation - Replace `jumpi` with other operations - [x] Use `mload(type(uint256).max)` for `jumpi` if-else-revert pattern (`GrimReaperHuff`) -- [x] Abuse `returndatasize`, `calldatasize`, `chainid` and `msize` for `push` operations +- [x] Abuse `returndatasize`, `calldatasize`, `chainid` and `msize` for `push` operations (`GrimReaperHuff`) ## Acknowledgements diff --git a/src/GrimReaper.huff b/src/GrimReaper.huff index cfac977..13972db 100644 --- a/src/GrimReaper.huff +++ b/src/GrimReaper.huff @@ -145,6 +145,7 @@ /// @dev Read memory at 0x00 will trigger a memory expansion if the memory location is not already allocated. +/// @dev Consumes all gas if the condition `success` is false. #define macro IF_FALSE_REVERT_BY_BURNING_GAS() = takes (1) returns (1) { // [success] 0x01 swap1 sub // [0 (if true), type(uint256).max (if false)] diff --git a/src/OptimizedGrimReaper.sol b/src/OptimizedGrimReaper.sol index 76ceb77..e863590 100644 --- a/src/OptimizedGrimReaper.sol +++ b/src/OptimizedGrimReaper.sol @@ -35,6 +35,7 @@ contract OptimizedGrimReaper { /// @dev function liquidationCall(address collateralAsset,address debtAsset,address user,uint256 debtToCover,bool receiveAToken) bytes4 internal constant LIQUIDATION_CALL_ID = 0x00a718a9; + /// @dev Dispatching function calls manually saves tiny gas. It's not much worth it. fallback() external payable virtual { assembly { // only the owner of this contract is allowed to call this function