-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Proxy Direct #111
[WIP] Proxy Direct #111
Conversation
This patch is an attempt at making the proxy even more slimmed down (by ignoring the niceties of the Solidity `delegatecall` contract) but otherwise keeping things in Solidity. We also are working on compiler settings to remove metadata, etc, to make the contract even smaller. Note: for observation, I've also added the optimized yul output.
LGTM on the Solidity part 👍 |
if succ { | ||
return(0, retSz) | ||
} | ||
|
||
revert(0, retSz) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we check the return data is 0?
Seems OZ's approach check the return data.
like: https://github.com/compound-finance/quark/pull/108/files
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these two code blocks are equivalent right? If succ == 0, revert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yeah that's right.
just saw oz explicitly mentioning checking zero, but works the same as bool.
address public immutable signer; | ||
|
||
/// @notice Address of the executor contract, if any, empowered to direct-execute unsigned operations for this wallet | ||
address public immutable executor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct me if I'm wrong.
When proxy delegate call, the immutable reads will reads the value from implementations immutable instead of proxy's ? (I think I ran into that issues before when integrating proxy into test suites)
So I assume this route, will also require changes to implementation contract to have special getter?
or in here we won't have this kind of issue 🤔 ? (something special in assembly?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the implementation contract will read the value from the proxy using a call. The proxy has built-in, public getters for these immutables.
This patch is an attempt at making the proxy even more slimmed down (by ignoring the niceties of the Solidity
delegatecall
contract) but otherwise keeping things in Solidity. We also are working on compiler settings to remove metadata, etc, to make the contract even smaller. Note: for observation, I've also added the optimized yul output.Note: forge is quite a bit broken when you want to deviate from the norm for different Solidity files, so to build this, I suggest
solc --optimize --optimize-runs 1 --no-cbor-metadata --bin-runtime src-proxy/ProxyDirect.sol