Comments (3)
That does make sense.
https://docs.soliditylang.org/en/latest/metadata.html#encoding-of-the-metadata-hash-in-the-bytecode
I could match for that part and exclude it.
from upgrade-scripts.
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 keepExisting = true
to setUpContract
/ setUpProxy
and manually set it to false
once you want to explicitly have new deployments (or use the global var UPGRADE_SCRIPTS_KEEP_EXISTING=true
.
Also, be sure to compile the contracts without a metadata hash (foundry.toml setting: bytecode_hash = "none"
) which may change the bytecode due to comments being altered. Checking for functional equality of the code would be too hard to do.
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.
from upgrade-scripts.
Thanks for pointing out the bytecode_hash = "none"
option. Unfortunately we don't want to turn that off so that we can verify.
Here is my intuition - Currently because bytecode_hash = "ipfs"
for verification purposes, the "overall" bytecode changes even when there are cosmetic changes. However let's say that the "implementation" portion of the bytecode, what is essentially generated when bytecode_hash = "none"
, remains unchanged. In these cases, it doesn't make sense to redeploy the contract.
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?
from upgrade-scripts.
Related Issues (6)
- Running without --broadcast? HOT 1
- `vm.stopBroadcast` may now fail if there was no broadcast happening HOT 3
- Feature request: having a new flag that disable console.log outputs HOT 2
- Error when testing or deploying a contract containing a library function call. HOT 5
- Add support for transparent proxies HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from upgrade-scripts.