Wipe deployment state if hardhat-network has been restarted #653
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the past, we've had the intention of keeping ignition-core agnostic of hardhat, however, with this issue, while we do need to store this piece of data (
instanceId
) somewhere to compare against future runs and journal does seem like the most appropriate place, that would also require breaking that separation of intent between ignition-core and hardhat asinstanceId
is a hardhat-specific piece of data. we would also need to add a hardhat-specific method toJsonRpcClient
to retrieve theinstanceId
To maintain that separation, I went a different direction with this implementation. The logic for this feature exists entirely inside
hardhat-plugin
, but it does require adding one new (small) file to theignition/deployments
directory to map deployment IDs to hardhat instance IDs. I think this approach is preferable since this is a hardhat-specific feature to begin with.This implementation does have one caveat, and that's in the case of a user
deploymentId
deploymentId
If those criteria are met, the existing deployment to a non-hardhat chain would be wiped. I think this is a bit of a contrived edge case, so I'm okay with leaving that possibility if needed, but any suggestions on removing that possibility would be more than welcome as well.
resolves #650