hardhat
hardhat copied to clipboard
Add support to dump and reload the state of `HardhatNode`
- [x] Because this PR includes a new feature, the change was previously discussed on an Issue or with someone from the team. (Discussed with Patricio)
Adds new RPC methods to the hardhat network: hardhat_dumpState
and hardhat_importState
.
Properties:
- On call to
dumpState
, generates an opaque data buffer with the full state of the hardhat network which can be saved to a file - On call to
loadState
, reads the data buffer created withdumpState
and merges the state into the existing hardhat network, overriding if an address conflict arises.
This feature was recently shown and presented on Cannon, an EthDenver 2022 project.
You can see the hacky code that this PR is inspired by. The code submitted here has been verified with Cannon downstream implementation with npm link
.
This PR was discussed with Patricio before submitting this change.
Notes:
- I had difficulty with some of the tests succeeding on my local node. Since I couldn't figure out how the failures were related to the code added by my PR, I left them be for now. Let me know what changes may be needed in order to correct the tests, if necessary.
⚠️ No Changeset found
Latest commit: a77dba82d0e695e2d53c0e1e4b40b802830ace24
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
If I'm forking off the wrong branch (ex. DefultStateManager rather than HardhatStateManager), please let me know, and I will rewrite my PR
Yes, the development
branch is a bit behind, and we have actually entirely removed HardhatStateManager
in the master
branch. Can you please re-write your PR against master
? :pray:
If I'm forking off the wrong branch (ex. DefultStateManager rather than HardhatStateManager), please let me know, and I will rewrite my PR
Yes, the
development
branch is a bit behind, and we have actually entirely removedHardhatStateManager
in themaster
branch. Can you please re-write your PR againstmaster
? pray
done!
One more note: I wanted to let you know that there is a failure that you will see, when running with a defined ALCHEMY_URL
, that is not the fault of this PR. It is regarding evm_increaseTime
, and you can see the details at https://github.com/NomicFoundation/hardhat/pull/2480#issuecomment-1065774245 .
Are those the failures you were talking about seeing on your local node? We'll definitely need to get those fixed.
No, they were different failures, but definitely something wrong here. Let me get that fixed.
the test failures that I was talking about earlier in my comment might have just been becuase I was on the development
branch. I will try running this again and it will probably work better :pray:
@feuGeneA if you could check this earlier this week that would be preferred, I will be limited availability starting next week. thanks :+1:
Hey @dbeal-eth! Thanks once again for implementing this! I'll make a quick high-level review early next week and get back to you.
@alcuadrado @feuGeneA any update on this? sorry been on vacation the last couple weeks but would love to get this finalized if you have a chance. ty
This PR was marked as stale because it didn't have any activity in the last 30 days. Please excuse us if we didn't have enough time to review it and get it merged. If you are still interested in getting these changes applied, please leave a comment indicating so. Otherwise, it will be closed in 7 days.
@alcuadrado since your team seems busy with the change to the rust hardhat network, will withhold this until its done.
Sorry for the delay and confusion, @dbeal-eth. We really want to get this merged. @fvictorio will resume the work on this after our current sprint (in ~1 week) and give you a better estimate about when will merge it. We'll probably get back to you with questions, but will fix/implement whatever is needed.
This PR was marked as stale because it didn't have any activity in the last 30 days. Please excuse us if we didn't have enough time to review it and get it merged. If you are still interested in getting these changes applied, please leave a comment indicating so. Otherwise, it will be closed in 7 days.
Not stale.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Updated |
---|---|---|---|
hardhat | ✅ Ready (Inspect) | Visit Preview | Jun 20, 2022 at 7:26PM (UTC) |
hardhat-storybook | ✅ Ready (Inspect) | Visit Preview | Jun 20, 2022 at 7:26PM (UTC) |
Hey @dbeal-eth, I'm going to close this PR in favor of https://github.com/NomicFoundation/hardhat/issues/3599, which describes what we need to do and explains why we can't do it right now.
I feel super bad about having had this PR open for a year and then closing it like this :disappointed: We'll try to make this feature a top priority after rethnet is ready.
hi @fvictorio thanks for your attention and concern on this issue. Happy to see this is still being tracked and planned soon.
Please let me know if you need any other information or support in developing this! The new issue appears to explain everything very well though so should be good :+1: