-
Notifications
You must be signed in to change notification settings - Fork 111
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
Return the address when deploying a mastercopy #98
Conversation
Also, add a `computeTargetAddress` function that can be used to get the address of an already deployed mastercopy
Before I submit my review, a quick clarification @manboy-eth File mastercopyDeployer, line 109, there's the assumption that a targetAddress AddressZero would correspond to an already deployed contract. However, the call in line 94 (singletonFactory.deploy) internally uses create2, and this is specified to throw on address already occupied or address non zero nonce. See ethereum/EIPs#684 IT feels like the zero address assumption for already deployed is wrong. Thoughts? |
It seems to be working as expected. Also, reading about it here says, that it fails without reverting:
Perhaps [ethereum/EIPs#684] was closed without being implemented? |
Very interesting. Ok makes sense. Lets proceed assuming that the function does not revert and returns Zero if already deployed |
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.
Looks good, thank you for taking the time to improve the functions!
Left a bunch of low impact (mostly stylistic) comments
Incorporating review comments from @cristovaoth ++
computedTargetAddress, | ||
"The computed address does not match the target address." | ||
); | ||
|
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 did not know this assert variation.
Usually I import from "assert"
And then simply do assert(a === b)
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.
Looks good, let's merge
Also, add a
computeTargetAddress
function that can be used to get the address of an already deployed mastercopy