-
Notifications
You must be signed in to change notification settings - Fork 212
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
Migrate to Buidler plugin #1131
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.
Couple more notes, mainly about using ganache.
The failing tests seem to point to ganache or the truffle integration with buidler being an issue, as the transaction or receipts aren't being handled well (testing with ganache seems to be really slow).
I'm not really sure what's going on, but somehow the coverage plugin is using ganache and:
- Is faster than vanilla ganache?
- Works correctly 🤷
Since all of these test environments are backed by ethereumjs-vm anyway, I think we'd only be able to hedge implementation risk by running tests against a real geth node anyway.
Finally, with solidity-coverage 0.7.x, I think we should be able to remove a bunch of options and/or use the new skip syntax. See upgrade nodes (note that some of these won't apply anymore because we can use the buidler plugin, which does a lot of this automatically).
"test:gas": "GAS_REPORTER=true npm test", | ||
"coverage": "npx truffle run coverage", | ||
"ganache-cli:test": "./node_modules/@aragon/contract-helpers-test/scripts/ganache-cli.sh", | ||
"abi:extract": "truffle-extract --output abi/ --keys abi", |
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.
Right, we may want to replace this with something else. Not sure if there's a buidler plugin to replicate this, but truffle-extract
supports a buildDir
input argument so we can switch to artifacts
.
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.
Maybe we can update it to be a super simple plugin? Otherwise, if I update this line as well: https://github.com/sohkai/truffle-extract/blob/master/index.js#L36 with npx buidler compile
the package keep working fine. I don't have a strong preference, do you?
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 decide to fork your package and publish a new version for buidler instead: https://github.com/0xGabi/buidler-extract
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.
Sounds good! Honestly not sure if this fits well as a small buidler plugin, but I can see it being useful!
I was thinking about this earlier, and in reality, we may actually want to have a tool that lets us configure what we publish. For most apps, there's a lot of extra fluff in the artifacts (e.g. Voting only needs Voting.json
, not all the other artifacts).
"coverage": "SOLIDITY_COVERAGE=true npm run ganache-cli:test", | ||
"ganache-cli:test": "./scripts/ganache-cli.sh" | ||
"test": "buidler test", | ||
"test:gas": "REPORT_GAS=true buidler test --network localhost", |
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.
Not sure, but I don't think the localhost
network exists anymore in the buidler config?
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.
As we are using the gas reporter with the buidlerevm and they don't yet handle the start and stop of the chain. We need to manually ran npx buidler node
and then connect to the chain with --network localhost
. As explained on:
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 include a comment to give more context about it: 1114631#diff-31b24dc429d79c5898460ef28314ee00R38
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.
Gotcha, so the --network local
flag would tell it to connect to the separately run buidlerevm
instance?
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. The buidlerevm
chain starts a JSON-RPC and WebSocket server and expose the gateway at http://localhost:8545
. Then the buidler default configuration object has the following format:
{
localhost: {
url: "http://127.0.0.1:8545"
},
buidlerevm: {
// See its defaults
}
}
That's why you can use --network localhost
. Maybe we should be explicit about localhost
network?
"coverage": "SOLIDITY_COVERAGE=true npm run ganache-cli:test", | ||
"ganache-cli:test": "./scripts/ganache-cli.sh" | ||
"test": "buidler test", | ||
"test:gas": "REPORT_GAS=true buidler test --network localhost", |
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.
Gotcha, so the --network local
flag would tell it to connect to the separately run buidlerevm
instance?
Co-authored-by: Brett Sun <[email protected]>
Add ganache as default network and include a few comments on each network
We have a green CI 🎉 @sohkai if you consider it's ok, we can merge. |
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.
Amazing, this is fantastic! Let's get this innnn 🍾!
@@ -734,11 +734,14 @@ module.exports = (agentName, { accounts, artifacts, web3 }) => { | |||
context('> Designated signer', () => { | |||
const ethSign = async (hash, signer) => { | |||
const packedSig = await web3.eth.sign(hash, signer) | |||
const chainId = await web3.eth.net.getId() | |||
// If we detect buidlerevm we don't use ganache encoding | |||
const offset = chainId === 31337 ? 0 : 27 |
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.
Ohhh interesting, are there docs for this? I'd like to leave a few more comments :).
We may also want to push something like this into the contract-helpers (we can do it later though)
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.
This was pointing out by Pato from buidler. He told me that ganache encodes the v value of the signature as 0 or 1, while it should be 27 or 28. But buidler uses the same values as geth.
Related discussions about the topic:
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.
Interesting, let's leave these in the inline code!
This PR introduces a vanilla setup of buidler development tool. It includes several network configurations both for local development and to interacts with real chains. It also has ganache configured to be used as an alternative local development chain (use with `--network ganache`). Note the gas reporter packages don't yet support handling the start and stop of the chain. We need to start it manually as explained in https://github.com/cgewecke/buidler-gas-reporter/tree/master#using-buidlerevm-warning. The changes include: - Support buidlerevm as default test chain. Depends on aragon/contract-helpers#55. - Make coverage work with buidler and update to latest solidity-coverage - Bump to use node 12 - Update `truffle-extract` to support buidler. As discussed in aragon/aragon-apps#1131 (comment).
This PR introduces a vanilla setup of buidler development tool. It includes several network configurations both for local development and to interacts with real chains. It also has ganache configured to be used as an alternative local development chain (use with `--network ganache`). Note the gas reporter packages don't yet support handling the start and stop of the chain. We need to start it manually as explained in https://github.com/cgewecke/buidler-gas-reporter/tree/master#using-buidlerevm-warning. The changes include: - Support buidlerevm as default test chain. Depends on aragon/contract-helpers#55. - Make coverage work with buidler and update to latest solidity-coverage - Bump to use node 12 - Update `truffle-extract` to support buidler. As discussed in aragon/aragon-apps#1131 (comment).
This PR introduces a vanilla setup of buidler development tool. It includes several network configurations both for local development and to interacts with real chains. It also has ganache configured to be used as an alternative local development chain (use with `--network ganache`). Note the gas reporter packages don't yet support handling the start and stop of the chain. We need to start it manually as explained in https://github.com/cgewecke/buidler-gas-reporter/tree/master#using-buidlerevm-warning. The changes include: - Support buidlerevm as default test chain. Depends on aragon/contract-helpers#55. - Make coverage work with buidler and update to latest solidity-coverage - Bump to use node 12 - Update `truffle-extract` to support buidler. As discussed in aragon/aragon-apps#1131 (comment).
This PR introduces a vanilla setup of buidler development tool. It includes several network configurations both for local development and to interacts with real chains. It also has ganache configured to be used as an alternative local development chain (use with `--network ganache`). Note the gas reporter packages don't yet support handling the start and stop of the chain. We need to start it manually as explained in https://github.com/cgewecke/buidler-gas-reporter/tree/master#using-buidlerevm-warning. The changes include: - Support buidlerevm as default test chain. Depends on aragon/contract-helpers#55. - Make coverage work with buidler and update to latest solidity-coverage - Bump to use node 12 - Update `truffle-extract` to support buidler. As discussed in aragon/aragon-apps#1131 (comment).
This PR introduces a vanilla setup of buidler development tool. It includes several network configurations both for local development and to interacts with real chains. It also has ganache configured to be used as an alternative local development chain (use with `--network ganache`). Note the gas reporter packages don't yet support handling the start and stop of the chain. We need to start it manually as explained in https://github.com/cgewecke/buidler-gas-reporter/tree/master#using-buidlerevm-warning. The changes include: - Support buidlerevm as default test chain. Depends on aragon/contract-helpers#55. - Make coverage work with buidler and update to latest solidity-coverage - Bump to use node 12 - Update `truffle-extract` to support buidler. As discussed in aragon#1131 (comment).
This PR introduces a vanilla setup of buidler development tool. It includes several network configurations both for local development and to interacts with real chains. It also has ganache configured to be used as an alternative local development chain (use with `--network ganache`). Note the gas reporter packages don't yet support handling the start and stop of the chain. We need to start it manually as explained in https://github.com/cgewecke/buidler-gas-reporter/tree/master#using-buidlerevm-warning. The changes include: - Support buidlerevm as default test chain. Depends on aragon/contract-helpers#55. - Make coverage work with buidler and update to latest solidity-coverage - Bump to use node 12 - Update `truffle-extract` to support buidler. As discussed in aragon/aragon-apps#1131 (comment).
Fixes #1111
This PR introduces a vanilla setup of buidler development tool. It includes several network configurations both for local development and interacts with real chains. It also has ganache configured to be use as an alternative local development chain (use with
--network ganache
).Note the gas reporter packages don't yet support handling the start and stop of the chain. We need to start it manually for now as explained in https://github.com/cgewecke/buidler-gas-reporter/tree/master#using-buidlerevm-warning.
TODO:
truffle-extract
to support buidler. As discussed in Migrate to Buidler plugin #1131 (comment).Move to address on a future PR: