question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I’m opening this issue to continue our conversation from #115.

I tried running this reporter with Buidler, and got into these issues:

  1. It requires web3, so it would only work in projects using buidler-web3. I think this is a reasonable requirement, and I haven’t checked yet how difficult it would be to make it more general.

  2. It assumes that artifacts from truffle is available. I workarounded this by installing buidler-truffle5.

  3. It only works if web3 supports sync calls. Those aren’t supported by Buidler, and I think they aren’t by web3 1.0. I saw this PR, so I commented out this check, but I’m getting this error now:

pato@pmbp:gas% npx buidler test --show-stack-traces
Compiling...
An unexpected error occurred: Cannot read property 'url' of undefined

TypeError: Cannot read property 'url' of undefined
    at Object.request (/private/tmp/gas/node_modules/eth-gas-reporter/sync.js:57:10)
    at Object.getLatestBlock (/private/tmp/gas/node_modules/eth-gas-reporter/sync.js:21:17)
    at Object.mapMethodsToContracts (/private/tmp/gas/node_modules/eth-gas-reporter/gasStats.js:353:22)
    at Runner.Gas.runner.on (/private/tmp/gas/node_modules/eth-gas-reporter/index.js:143:65)
    at emitNone (events.js:111:20)
    at Runner.emit (events.js:208:7)
    at start (/private/tmp/gas/node_modules/mocha/lib/runner.js:848:10)
    at Runner.run (/private/tmp/gas/node_modules/mocha/lib/runner.js:876:5)
    at Mocha.run (/private/tmp/gas/node_modules/mocha/lib/mocha.js:612:17)
    at Promise (/private/tmp/gas/node_modules/@nomiclabs/buidler/src/builtin-tasks/test.ts:51:13)
    at new Promise (<anonymous>)
    at SimpleTaskDefinition.config_env_1.internalTask.addOptionalVariadicPositionalParam.setAction [as action] (/private/tmp/gas/node_modules/@nomiclabs/buidler/src/builtin-tasks/test.ts:50:24)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)

It expects a connection field from web3. I have no idea what that is. Do you?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
alcuadradocommented, May 23, 2019

@cgewecke here’s the sample project using ethers: https://github.com/alcuadrado/example-buidler-ethers

It has a super basic contract with a few tests, but it may be enough as a test case. Let me know if it’s not.

I also installed typescript in that project, to have it as an example of how to do it, and cause having autocomplete may help you as buidler-ethers is not that well documented yet.

the ‘deep reach’ is in lib/config.js for the moment.

If buidler-ethers is installed, you can do this with ethers.provider._buidlerProvider.provider.host. Or you can use ethereum.provider.host in any Buidler project.

1reaction
alcuadradocommented, May 11, 2019

Do you mean the mocha process?

I think I mean the client. For example in truffle if you try to supply ganache as a provider directly to main process through truffle’s network configurations, web3 0.x’s sync calls freeze the execution thread. I believe sync-request would cause the same problem although it sounds like you’re anticipating this already with:

This is interesting. I restricted the provider’s config a little to prevent users from passing web3-provider-engine backed providers. I don’t think that is stable enough, and I don’t like that it works as a service (i.e. you need to start and stop it) without any clear reason. As Buidler also works as a library, there isn’t a single place to start/stop it.

Also, I have plans for an in-process provider, so not sure if the sync-request through HTTP would work in the future.

we don’t have a concept equivalent to migrations

Oh good. The only issue there is whether people consume pre-deployed contracts in their tests and want data about what those deployments cost. If not it doesn’t matter.

I see! I’ll try to avoid doing that. I guess it was an optimization, but it gets things really confusing. At least for tools developers.

I think this should be fairly easy once we got the above things working.

Agree. Have a clear idea of what needs to be configurable now - thanks so much for all your help here.

Let me know if you need help with anything else 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Builder Support
We're here to help empower our customers and make Builder the best product possible. ... You can also always email us at support@builder.io....
Read more >
e-Builder Support
e-Builder's elite Professional Services team assists with System Deployment and Implementation across various industries and projects. Request a demo today!
Read more >
Builder Support - Van's Aircraft Total Performance RV Kit ...
An extensive support network exists to help you with building your RV. Van's Technical Support. Every RV builder has access to official technical...
Read more >
Beaver Builder Support
We take great pride in offering outstanding support. If you have a question or problem, our expert support team is waiting to help...
Read more >
LG Builder: Support | LG US Business
Create a space your clients will love. Explore LG's builder appliances, packages and discounts – and find the perfect appliances for any project....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found