monorepo icon indicating copy to clipboard operation
monorepo copied to clipboard

[dapps, playground, node] Add support for local playground testing with Ganache

Open cf19drofxots opened this issue 5 years ago • 5 comments

Currently the playground only supports running against the Kovan test network.

This means local development is unnecessarily bottlenecked by the test net's throughput.

Action item: Local development should have a local test net (such as Ganache) to alleviate the mentioned problem.

cf19drofxots avatar Apr 01 '19 21:04 cf19drofxots

Things that come to mind:

  • There is a UI element that shows if network is not Kovan; need to change that
  • Ganache does not progress blocks on its own unlike Kovan, so we will need a background process which just mines blocks every couple seconds (this is called an autominer). I think ganache-cli actually has a -b flag which allows you to specify a number of seconds interval per block that you can use. Make sure this flag is only set for the Playground demo though, not for all test cases etc

snario avatar Apr 01 '19 22:04 snario

the weird part about setting up a local blockchain for the playground demo is that these addresses need to be dynamically updated

https://github.com/counterfactual/monorepo/blob/master/packages/playground-server/registry.local.json#L6-L7

snario avatar Apr 15 '19 22:04 snario

We should revisit this as part of a better development environment @snario, updating the discussion with the current stack.

joelalejandro avatar Aug 15 '19 05:08 joelalejandro

The main issue that made this tricky to work with is when spinning up a ganache server and deploying the contracts for the dApps, there was no clean / straightforward way of injecting the dApp contract addresses into the various spots that they were getting used.

cf19drofxots avatar Aug 15 '19 05:08 cf19drofxots

What if we add a table to the hub DB called "dapps" that acts as a place to keep these addresses?

We could then read them through some MM command such as "counterfactual:request:contractAddresses" passing a contract name.

joelalejandro avatar Aug 15 '19 12:08 joelalejandro