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

♻️ Add extra protection for ERC6551 #1364

Merged
merged 4 commits into from
Feb 26, 2025
Merged

♻️ Add extra protection for ERC6551 #1364

merged 4 commits into from
Feb 26, 2025

Conversation

Vectorized
Copy link
Owner

Description

In case the owner isn't trusted.

Checklist

Ensure you completed all of the steps below before submitting your pull request:

  • Ran forge fmt?
  • Ran forge test?

Pull requests with an incomplete checklist will be thrown out.

@Vectorized Vectorized merged commit 6d8cea5 into main Feb 26, 2025
13 checks passed
@Vectorized Vectorized deleted the 6551-proxy-stuff branch February 26, 2025 20:09
address selfImplementation = _selfImplementation();
/// @solidity memory-safe-assembly
assembly {
extcodecopy(address(), 0x2c, 0x0a, 0x14) // Assumes the upper 20 bytes at 0x40 are zero.
Copy link

Choose a reason for hiding this comment

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

This means upper 12 bytes, right?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Oh yes.

{
_updateState();
}

/// @dev Guards `_authorizeUpgrade` such that it must be used via an ERC6551Proxy.
modifier onlyViaERC6551Proxy() virtual {
Copy link

Choose a reason for hiding this comment

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

It seems like what this is really doing is notViaERC6551Clone(). It might be worth renaming, because this will pass in all situations except that, even if not a proxy. I'm not sure if it would ever matter.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Ok, I think it’s a good rename suggestion.

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