-
Notifications
You must be signed in to change notification settings - Fork 84
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
Simulate timelock operations on fork #2375
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2375 +/- ##
=======================================
Coverage 51.00% 51.00%
=======================================
Files 92 92
Lines 4515 4515
Branches 1198 1198
=======================================
Hits 2303 2303
Misses 2209 2209
Partials 3 3 ☔ View full report in Codecov by Sentry. |
main.skip = () => true; | ||
} else if (isFork) { | ||
const networkName = isForkTest ? "hardhat" : "localhost"; | ||
const migrations = require(`./../deployments/${networkName}/.migrations.json`); |
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 think we should also check the fork's block number. If some older block number is set in the contracts/.env
then skipping the file isn't such a good idea.
Should we soft enforce that users need to have at least a week / 2 weeks old block number in env file fork the forkend environment to run? Which can be force overridable ofc
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.
That's a good point. But I don't think hardhat migrations would work if you use an older block. I know for sure that the blocknumber is encoded into all the artifacts, so will have to nuke them all and remove the entries from migrations.json
file manually to do that. If we are gonna have to remove the entries from migrations.json manually, it'll have a newer timestamp when it runs again on fork from the block number you forked.
But if there's any other usecase that I'm missing here, let me know, I can see what our options are
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 might be understanding this incorrectly. Lets say I have a month old Block number in .env
file. And that there were migrations that happened after that. Won't all the migrations that are younger than my block number, but older than 14 days from today be skipped? Ideally all would need to be applied.
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.
Won't all the migrations that are younger than my block number, but older than 14 days from today be skipped?
This is true. Yes. However, hardhat wouldn't run those migrations either unless we remove the entries from .migrations.json
(or give it a different name, like overriding main.id
to be something new).
This piece of code doesn't skip older migrations but more like it forces hardhat to rerun migrations that happened in the last 14 days (so that we can figure out if it has a proposal that needs to be simulated). This is where that happens: https://github.com/OriginProtocol/origin-dollar/blob/shah/base-simulation-timelock-ops/contracts/utils/deploy-l2.js#L430
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'm gonna merge this in, since the change might cause several merge conflict if left open for long. But happy to address your concerns in a new PR or branch when we make a decision there
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.
this is clever. I like how we are now storing the Safe json files for the Timelock schedule and execute batch in the repo.
Code Change Checklist
To be completed before internal review begins:
Internal review:
Deploy checklist
Two reviewers complete the following checklist: