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.

Support testing with an in-process ethereum provider

See original GitHub issue

🧐 Motivation

solidity-coverage is being rewritten so that it has fewer quirks and problems. One element of the new design is that it listens to the ethereumjs-vm opcode step emitter of an in-process ganache instance. In Truffle terms, it runs on a network which looks like:

const ganache = require("ganache-cli")

modules.exports = {
  networks: {
    ganache: {
      provider: ganache.provider(options),
      network_id: "*"
    }
  }
}

Have been testing it on Zeppelin and the only issue is that some GSN tests rely on an oz-gsn utility run in test.sh which connects to ganache-cli as a stand-alone server.

I’m wondering if anyone has any views are about moving away from test.sh towards an in-process provider approach.

I think the main changes this would involve are:

  • Putting the accounts keys and balances into their own file so they can be JS required.
  • Writing an oz-gsn deploy relay hub test helper that uses an in-process provider
  • Launching the tests with ganache.provider by default.

Pros

  • Less shell script
  • There are interesting tools written to consume the client this way
    • NomicLabs is actively working on some…
    • 0xProject tooling

Cons/Caveats

  • It runs a little more slowly. (ganache-core 481 requests info about this)
  • Maintaining compatibility with a solution for #355?

Happy to help with PRs etc if this is something you’re interested in.

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
cgeweckecommented, Sep 13, 2019

from our discussion here and my understanding of the proposed API it seems to me like it shouldn’t be hard to get ganache-core and the new solidity-coverage bundled together in the fashion I described above. We could do this ourselves if needed.

Ok well you’ve persuaded me this is likely necessary anyway. If you’d like to collaborate in some way I’d be very happy to.

2reactions
nventurocommented, Sep 12, 2019

It seems to me though that it should be possible to have a sort of ā€˜coverage-node’, a stand-alone process that wraps ganache and exposes the instrument and report functions to the network. I imagine all the truffle plugin does is hook those functions to mocha’s before and after blocks, which could be replicated this way.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hardhat: networks and providers - HackMD
Using a testnet for local development is slow, and you need to get test ether from a faucet. An easier and faster alternative...
Read more >
Alternatives for Truffle for running and writing tests
Below is my original Truffle + TypeScript test translated to OpenZeppelin + Jest + ... Hardhat supports localhost and in-process blockchain.
Read more >
Hardhat Network | Ethereum development environment for ...
When Hardhat executes your tests, scripts or tasks, an in-process Hardhat Network node is started automatically, and all of Hardhat'sĀ ...
Read more >
Top 4 Ethereum testnets for testing smart contracts
Let's compare four of the top Ethereum testnets — Rinkeby, Kovan, Ropsten, and Goerli — and review the key features of each testnet....
Read more >
Truffle vs. Hardhat - Breaking down the difference between ...
Truffle, on the other hand, also supports writing tests in TypeScript. ... you can test, debug, and deploy your contracts directly to the...
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