Skip to content
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

refactor and clean up encoding #7

Merged
merged 1 commit into from
Dec 10, 2024
Merged

Conversation

wadealexc
Copy link
Contributor

No description provided.


// fn pointer indirection fools the compiler into letting us have
// an uninitialized storage pointer
function() pure returns (mapping(uint => MultisigCall[]) storage) fn;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you likey?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sol devs would rather do this than just contribute to the compiler LMAO

/// @dev Encodes a call to `ProxyAdmin.upgrade(proxy, impl)`
function upgrade(EncProxyAdmin, address proxy, address impl) internal pure returns (bytes memory) {
return abi.encodeCall(IProxyAdmin.upgrade, (ITransparentUpgradeableProxy(proxy), impl));
}
Copy link
Contributor

@jbrower95 jbrower95 Dec 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO nit but it feels like it would be more straightforward to leave abi.encodeCall(IProxyAdmin, to, params)

but make zDeployedProxy cast to ITransparentUpgradeableProxy by default...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im not super sure what you're asking for, but this is less about how ZeusScript uses it and more about how this works when writing upgrade scripts. for upgrade scripts this is much nicer.

i can share examples if you want

for (uint256 i = 0; i < calls.length; i++) {
packedCalls = abi.encodePacked(
packedCalls,
abi.encodePacked(uint8(0), calls[i].to, calls[i].value, uint256(calls[i].data.length), calls[i].data)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@jbrower95 jbrower95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure on the Encode piece but the rest LGTM

@wadealexc wadealexc merged commit b2005ec into master Dec 10, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants