-
Notifications
You must be signed in to change notification settings - Fork 37
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
Updating deployment process for better external use of the project #489
Conversation
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.
Smallish comments.
package.json
Outdated
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@gnosis.pm/dex-contracts", | |||
"version": "0.1.3", | |||
"version": "0.1.4", |
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.
Should the version bump be its own commit?
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 also notice that 0.1.4
tag was pushed and auto-deployed to NPM. I think we should include a check deploy will fail if the tag is not on master
.
Should I yank the version from NPM?
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.
How would I test the deployment scripts for
https://github.com/gnosis/dex-contracts-integration-example, I need the package in there... Having it published only locally makes it testable for me, but not for the others.
Should I do a manual 0.1.4-dev npm release?
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 like the changes, but I wonder if we have to fix our dependencies to make this work. We might have to include the solidity libraries as dependencies as well as truffle contract.
src/migration/utilities.js
Outdated
@@ -1,14 +1,32 @@ | |||
function getDependency(artifacts, network, deployer, path) { | |||
function initializeContract(path, deployer, accounts) { | |||
const contract = require("truffle-contract") |
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 think we might need to add truffle-contract
to the dependencies or peerDependencies? That might be a "heavy" dependency that we were trying to avoid. @anxolin what do you think?
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.
Yeah, I tried to avoid it and put it all just in the npm package.json of
https://github.com/gnosis/dex-contracts-integration-example
While this is not "very clean", it keeps the size down of dex-contracts npm package.
For which applications is the small size important?
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.
Yes, agree with Nick.
@josojo , super nice that you are doing an example on how to deploy the contracts from another project.
I expect that many projects won't even do this, and they will just use an interface or the original contract and use the rinkeby/mainnet deployments. Sometimes that approach is more straightforward.
Alex, for https://github.com/gnosis/dex-contracts-integration-example I think it would be better if you define the steps in the README to add it to any project.
npm install dex-contracts
npm install <dependencies like truffle>
...
This way is more explicit what we depend on.
WDYT?
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 disagree.
For every other project, owl-token, solidity-datastructures, etc, we always create the npm modules, such that later on others can easily build on them.
And we benefit from that a lot. For example, imagine the OWL contracts, all libraries, and all the other things are would be in this dex-contracts project. Then it would be harder to navigate for sure.
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 expect that many projects won't even do this, and they will just use an interface or the original contract and use the rinkeby/mainnet deployments. Sometimes that approach is more straightforward.
If you wanna write any meaningful tests, then you need to have the deployment scripts etc...
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've got a bit lost.
My understanding is that we want to decide if we add the dependencies: For example truffle-contracts
in our dependencies.
I would say to not do this, even as peerDependencies. A simplistic integration might be interested ONLY in the networks.json and the ABI, so we don't want to bring all the dependencies.
This is why, I thought of adding additional manual npm install. An alternative would be to create another npm-package or using yarn workspaces to create a package that depends on dex-contracts
and all the other stuff
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.
If you wanna write any meaningful tests, then you need to have the deployment scripts etc..
I agree, for some people.
Other people can be happy with dex-contracts
tests already (nice job), so in their project, they just mock dFusion contracts, and test their own and the interactions with the mocked dFusion contracts
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.
Okay, @anxolin :) then we are on the same page. Sorry, I was also a little bit confused. But actually we were in favor of the same thing!
I will not list all the dependencies in a readme in https://github.com/gnosis/dex-contracts-integration-example, they just go into the package.json of the dex-contracts-integration-example.
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.
Looks pretty good. I wouldn't mind seeing some comments in the scripts describing what is happening in some places.
I have tried to run the test plan on the example repo as follows;
And have run into several problems: missing truffle dependency, no mention of need for ganache in readme, some other missing dependencies required by truffle-config (i.e. |
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 can't compile dex-contracts-integration-example, otherwise it looks good.
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@gnosis.pm/dex-contracts", | |||
"version": "0.1.3", | |||
"version": "0.1.5-dev", |
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 pretty annoying having to publish versions to test this PR that are then public for the rest of time. Can we not use something like https://stackoverflow.com/questions/15806241/how-to-specify-local-modules-as-npm-package-dependencies to test this locally without publicly pushing new versions?
Can we please revert and delete those releases?
#489 introduced that change Version bumps should always happen in their own PR (and once that PR is merged to master, it should be tagged with the version). Moreover this skipped v0.1.4 and was likely just merged to master by accident.
In the last PR: #489 a bug was introduced as the for nonDevelopment networks, also the BatchExchange as a dependency would be tried to be pulled, although we have to get it from the usual build artifacts.
This PR modifies the way artifacts are handled in the migration process. This enables the batch exchange deployment from external projects, without publishing the contracts in the npm package.
closes: #449
An example of how this repo can be used for an external project can be found here:
https://github.com/gnosis/dex-contracts-integration-example
testplan:
Run the commands from the readme on
https://github.com/gnosis/dex-contracts-integration-example