Context
Most of the nonReentrant functions currently swallow all ETH transfer errors (including non-reentrancy) and replace it with a generic error (e.g. "Pool: ETH transfer failed")
This is problematic as we cannot correctly verify if the function indeed reverted with non-reentrancy error or something else. Due to this, the tests will pass if the functions revert for ANY reason (including re-entrancy) which is not ideal
Options
- upgrade the Pool.sol contract to make sure the re-entrancy error bubbles up
- use hardhat-tracer or a similar tool that will let us validate if the trace contains the re-entrancy error
Call validation that does NOT swallow errors
this should probably be in a lib so that we can re-use it and make it a pattern when doing a call (internal/external)
(bool ok, bytes memory result) = target.call(data);
if (!ok) {
uint length = result.length;
// 0 length returned from empty revert() / require(false)
if (length == 0) {
revert RevertedWithoutReason();
}
assembly {
revert(add(result, 0x20), length)
}
}
Context
Most of the
nonReentrantfunctions currently swallow all ETH transfer errors (including non-reentrancy) and replace it with a generic error (e.g."Pool: ETH transfer failed")This is problematic as we cannot correctly verify if the function indeed reverted with non-reentrancy error or something else. Due to this, the tests will pass if the functions revert for ANY reason (including re-entrancy) which is not ideal
Options
Call validation that does NOT swallow errors
this should probably be in a lib so that we can re-use it and make it a pattern when doing a call (internal/external)