-
Notifications
You must be signed in to change notification settings - Fork 5
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
Not upgrading if bytecode and creation code have not changed #2
Comments
The thing is that in that case, your bytecode will have changed, that's why it's re-deploying. As a quick fix, you can add the parameter And I would love to make the script detecting storage layout changes smarter by parsing the ast output or performing some other more in-depth storage analysis, but for the moment I don't feel knowledgable enough to catch odd edge cases. That's why it's better to err on the cautious side, but I might look into that more. |
Thanks for pointing out the Here is my intuition - Currently because I wonder if it would be possible in pseudocode: function needsUpgrade() returns (bool) {
if (oldImplementationAddress == newImplementationAddress) return false;
console.log("Need upgrade");
if (oldBytecodeWithoutHash == newBytecodeWithoutHash && UPGRADE_SCRIPTS_SKIP_METADATA_CHANGE) {
console.log("Skipping upgrade because only metadata changed");
return false;
}
return true;
} Not sure if it's easily possible to get the bytecode of a contract without the hash inside upgrade scripts themselves. Does it make sense? |
That does make sense. |
Hey!
I was wondering if there is a way to prevent re-deployment of code that basically has not changed (e.g. reformatting, adding comments, or changing function order). Currently those can cause false-positive storage incompatibilities with
isUpgradeSafe
. However,implementation
address is the thing that is actually checked for a difference to know whether something is changed or not. There is no control over this, and a contract will get redeployed in this case.Is there a way to see if implementation bytecode is identical (even if solidity code has slight cosmetic changes), and opt out of upgrading a contract in that case? I think solidity outputs different bytecode if the source changes (a section towards the end of the bytecode), I'm assuming for verification purposes. Any way to check only the implementation bytecode and no anything that depends on the source?
The text was updated successfully, but these errors were encountered: