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
buidler-deployments plugin #381
Comments
Hey, I am starting to look at buidler to see if i could implement the same functionality in plugins but I am not sure yet rocketh supports the following thing :
|
Oh forgot to mention that it also support a keepRunning mode (running ganache or geth) using these features with the extra possibility of exporting the contract info (abi, address, [bytecode]) to an external file (path specified by user) Very useful for local webapp development as you run it and then your contract are deployed and the info is available to your webapp |
This feature is the main thing gating my project moving from Truffle over to Buidler. |
Some thoughts on this. Addresses locationOne open question is where the addresses will be saved. I guess saving them in the const networks = require('my/project/networks.json')
console.log(networks["MyContract"]["1"].address Of course, this can also be done with artifacts if you commit and publish them. Multiple instancesThe other question I have is how to manage multiple instances of the same contract. In the current proposal, it seems like each new address is added to an array. My problem with that is that working with that seems a little cumbersome: you are relaying on the order in which your original deploy script was written. The other problem with this, in my opinion, is that it defaults to a complex object when in most cases contracts have only one instance. So I think a nice alternative approach would be using some kind of map, and returning a single address for the given key: let token = await deployments.getDeployedContracts(Token);
if (token === undefined) {
token = await Token.new();
await deployments.saveDeployedContract(token);
}
let anotherToken = await deployments.getDeployedContracts(Token, 'otherToken');
if (token === undefined) {
anotherToken = await Token.new();
await deployments.saveDeployedContract(anotherToken, 'otherToken');
} (This is just to illustrate the idea; I don't like that API for a couple of reasons that I won't detail because this is getting long enough already.) The next question here is how to represent this on the artifacts/networks file. TruffleThere's a feature request for this in Truffle since 2016, see trufflesuite/truffle#237. They are also working on a proposal to solve this and other related issues. I haven't read this document in depth; the analysis looks interesting, but the proposal seems unnecessarily complex. I think the approach proposed in this issue covers a lot of ground and it's flexible enough. |
I started to work on a deployment plugin that already have most of the feature https://rocketh.io had : It override the builtin task to provide extra features. See github repo for more details It is still work in progress and would be happy to get feedback, |
The "Deploying your Contracts" page of the Hardhat site says "When it comes to deploying, there are no plugins that implement a deployment system for Hardhat yet..." This is misleading as you list Hardhat-deploy under the list of available Plugins. |
Yes it almost makes it seem like Hardhat is discouraging the use of hardhat-deploy because it's so prevalent yet they act like it doesn't exist. |
Well I found that deploying contracts with ethers was fairly easy. So far I like how hardhat works with ethers. So I think it would only be a matter of passing the contract name down the line. I'm looking for a complete solution from compiling => deploying => verifying as well. |
I totally missed this, @nfurfaro, sorry about that. A lot changed since we first wrote that, and never updated it. How wants to send a PR updating it? |
So is the consensus to use hardhat-deploy? |
Addresses Issue comment #381 (comment)
The Truffle migrations page was out of date, incorrectly claiming that no plugins yet exist which implement a deployment system for Hardhat. However since that was written, hardhat-deploy has emerged, and the same text in /guides/deploying.md was already updated accordingly. So update the paragraph in truffle-migration.md to match, and cross-link to /guides/deploying.md. This is relevant to the discussion in NomicFoundation#381.
The Truffle migrations page was out of date, incorrectly claiming that no plugins yet exist which implement a deployment system for Hardhat. However since that was written, hardhat-deploy has emerged, and the same text in /guides/deploying.md was already updated accordingly. So update the paragraph in truffle-migration.md to match, and cross-link to /guides/deploying.md. This is relevant to the discussion in NomicFoundation#381.
@hashparty1 commented on April 6, 2021 5:28 AM:
Yes, this seems a bit odd to me too. I've submitted #1852 to fix the Truffle migrations guide to be consistent with @feuGeneA's change in 953f21f, but I think it would make more sense if the docs were changed to recommend using |
Also, can we rename this issue to "hardhat-deployments plugin"? |
The Truffle migrations page was out of date, incorrectly claiming that no plugins yet exist which implement a deployment system for Hardhat. However since that was written, hardhat-deploy has emerged, and the same text in /guides/deploying.md was already updated accordingly. So update the paragraph in truffle-migration.md to match, and cross-link to /guides/deploying.md. This is relevant to the discussion in #381.
I would have said the consensus is to not use hardhat-deploy. |
@banshee commented on March 4, 2022 7:09 PM:
Which consensus are you referring to - within Nomic Foundation, or from a community perspective? hardhat-deploy is the only reasonable solution I'm personally aware of. |
Hi everyone, thanks a lot for all the comments here, they've been really useful! We are going to close this issue now because we are already working on Ignition, which we think will satisfy this need. If someone is interested in Ignition and wants to participate as an early tester or contribute in any other way (feedback about the design, feature requests, etc.), please DM me or leave a comment here. |
@fvictorio I took a look at https://github.com/NomicFoundation/hardhat-ignition , and there haven't been any commits since July 2021. There is only a single release on npm https://www.npmjs.com/package/hardhat-ignition from a year ago. Is there another repository or package I am unaware of? I think it's really sad that This is an opportunity to work with creators of existing tools, and also create a clear migration path for users who have already chosen to use If I'm blowing this out of proportion then some clearer messaging on the current status of Ignition would be nice. |
That was an early prototype, the current version is in a private repository for now. We should hide that other repo because it's not the first time that it's confusing for someone, sorry about that!
I don't think we are actively shunning it,
We are on really good terms with @wighawag (or at least I would like to think we are!) and he has contributed some very useful feedback for Ignition from his experience with
It's not our plan to leave that part of the community behind. We are going to have both clear migration guides, and also Ignition is being developed in a way that should let anyone build on top of it, so there's a possibility that I know we've not done a great job at communicating our relationship with |
Just wanted to point out that the |
By the way probably these two pages of Hardhat documentation need to be combined, or at least the first one should reference the other: |
Hello, I am a newbie in blockchain, I need to deploy contracts to different networks, and when I switch networks in the project, I can automatically switch to use different abi and json files. Can I use |
@fvictorio would love to try out Ignition! |
We should offer some functionality to preserve deployments' information between Buidler executions.
One possible solution is to create a plugin that extends the Buidler Runtime Environment with an object containing (at least) these two methods:
getDeployedContracts
: Receives a TruffleContract and returns an array of contract instances. This method should warn if the deployed contract's bytecode doesn't match the local's one.saveDeployedContract
: Receives a contract instance, and saves its address. This method should warn if the contract was deployed to a testing/temporal network.Under the hood, these methods should work with a JSON file looking something like this:
Any operation involving reading & updating that file has to be synchronous, and, if possible, atomic.
Once we have this plugin, deployment scripts could be written in this fashion:
Writing them this way has the advantage of the scripts being resumable. If, for example, deploying
Other
fails because123
wasn't a valid parameter, you can correct it and re-run the script without having to re-deploy the
Token`.Finally, other things that we should consider:
The text was updated successfully, but these errors were encountered: