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.
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 fact that it still create a new object will cause issue with plugin that modify the network object before this is called.
It is better to simply modify the network object
Uh oh!
There was an error while loading. Please reload this page.
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 using the fork with this fork and seems to be working well with hardhat deploy :)
If they modify it before, it shouldn't be an issue since we first set all previous object values then only override the needed ones
...env.network.If you meant using
Object.assignI believe the main difference would only be that setters are called on the object. According to a random SO answer: "spread operator will not copy the the source object’s prototype to the target object"How would you suggest this be implemented? Glad to iterate on it or take a PR heh
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.
Plugins could have copied the reference to hre.network before and will later modify an unrelated object. Modifying the network object would be safer. I proposed this in that comment: wighawag/hardhat-deploy#132 (comment)
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.
Object.assign retains the reference to the original object too. I think that is more conventional. But simplicity is always good so maybe @wighawag solution of just doing inplace modifications (env.network.name = networkName etc.) is better.