solady
solady copied to clipboard
✨ New CWIA
Background
OZ is making their own implementation of CWIA which uses the extcodecopy pattern.
To bypass the 4337 storage restrictions.
Also, cuz of that 2771 meta-transactions thingy.
Clone with immutable args
This will be simply an ERC1167 / z0age minimal proxy with the immutable arguments appended to the end of the bytecode.
As of the time of writing, both ERC1167 and z0age minimal proxies don't have Etherscan auto-verification support.
We'll use 1167, cuz OZ will probably ask Etherscan to add auto-verification support, and we wanna ride on their coattails. ;)
In the new simplified CWIA, there will not be a emit ReceiveETH(uint256) event on receive (which is from the CWIA variant that 0xSplits is using).
Then Clone.sol will be removed, and replaced with a few simple functions in LibClone.
The immutable args reading functions will use extcodecopy to read the immutable arguments.
Rationale
100 gas for the extcodecopy + 100 gas for the extcodesize isn't that big a dealbreaker, especially when gwei is already sub 10.
The extcodecopy pattern will also be much safer.
ERC1967 with immutable args
This will also use the same extcodecopy pattern.
Immutable args reading functions
/// @dev Returns the immutable arguments on `target`.
/// The `target` MUST be deployed via the clone with immutable args functions in this library.
/// Otherwise, the behavior is undefined.
function argsOnClone(address target) internal pure returns (bytes memory args);
/// @dev Returns the immutable arguments on `target`.
/// The `target` MUST be deployed via the ERC1967 functions in this library.
/// Otherwise, the behavior is undefined.
function argsOnERC1967(address target) internal pure returns (bytes memory args);
This is all we'll need. As extcodecopy burns 100 gas, it doesn't make sense to have the getArgUint256 functions. We'll just force users to retrieve all the arguments in a single call.
Etherscan auto-verification support
At the time of writing:
- Solady ERC1967 minimal proxy with immutable args [YES]
- ERC1167 clone with immutable args [NO]
Problems
The main problem is that there are already downstream dependents that use Solady's CWIA.
We will need to alert everyone who use Solady's CWIA.
We will have a legacy folder that places the old LibCWIA.sol (i.e. LibClone.sol with only the CWIA functions) and CWIA.sol (i.e. Clone.sol).
src/utils/LibClone.sol (only CWIA functions) -> src/utils/legacy/LibCWIA.sol
src/utils/Clone.sol -> src/utils/legacy/CWIA.sol
@clabby @wminshew @zobront