-
Notifications
You must be signed in to change notification settings - Fork 41
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
feat(contracts): numerous improvements to deploy scripts (+). #1108
Conversation
Tolerating null rounds. Filecoin chains will occasionally produce null rounds. Ethers' transaction monitoring cannot handle skipped block heights. It will try to request intermediate blocks that don't exist. Lotus returns a JSON-RPC error when calling eth_getBlock* with a height corresponding to a null round. Ethers reacts with an exception, and this aborts the deployment process. To overcome this situation, we inject a custom provider that catches this specific error, and returns an artificial empty block instead of an error. With this, hardhat-ethers can now cope with null rounds. Major refactors and cleanups. - Adopted the hardhat-deploy plugin, which keeps track of deployments for us. - Removed hand-rolled deployment tracking and codegen. We no longer codegen scripts; any script can resolve any contract now. - All the mess under ops/deploy*.sh is now gone. - Refactored all Hardhat tasks, simplified aggressively, deduplicated code, deleted dead code, and removed tons of cruft. - Adopted Typescript typing. - Upgrade scripts are also massively overhauled for simplicity.
contracts/extensions.ts
Outdated
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.
@cryptoAtwill @gvelez17 @avichalp here's the extension that injects a custom provider to deal with null rounds through the RPC.
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.
@xBalbinus @rk-rishikesh I'll submit this to the Hardhat FEVM kit so Filecoin devs can also benefit.
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.
The diamond stuff is so simple... it's insane how overcomplicated and dirty it was before.
activeValidatorsLimit: 100, | ||
majorityPercentage: 66, | ||
networkName: { | ||
root: undefined, // Will be set later. |
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.
As in the program will auto set it for you?
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.
It's done below.
(selector) => !current[selector], | ||
) | ||
|
||
const addressToSelectors = _.groupBy(selectorsToAdd, (selector) => needed[selector]) |
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.
curious, why not use import {groupBy} from "lodash"
(or is it supported) but use _
?
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.
It's just a preference. I tend to dislike importing external functions in ways that lose the namespace at the usage sites.
56401a5
to
4a58a4d
Compare
Tolerating null rounds
Filecoin chains will occasionally produce null rounds. Ethers' transaction monitoring cannot handle skipped block heights. It will try to request intermediate blocks that don't exist. Lotus returns a JSON-RPC error when calling eth_getBlock* with a height corresponding to a null round. Ethers reacts with an exception, and this aborts the deployment process.
To overcome this situation, we inject a custom provider that catches this specific error, and returns an artificial empty block instead of an error. With this, hardhat-ethers can now cope with null rounds.
Major refactors and cleanups for easier maintenance
TODO
Next steps