trufflesuite / ganache-ui

Personal blockchain for Ethereum development
https://www.trufflesuite.com/ganache
MIT License
4.65k stars 797 forks source link

Where does the code launch/configure Ganache core? #1019

Closed roschler closed 5 years ago

roschler commented 5 years ago

Up until recently I was using this repo's app, the Ganache GUI client. However, my smart contracts now require the AllowUnlimitedContractSize flag to deploy to Ganache otherwise I get an out-of-gas error during deployment. I don't want to use the solc optimizer because then I can't use the Truffle debugger since it does not work optimized code.

So lately I've gone back to the Ganache CLI client with the AllowUnlimitedContractSize flag on the command line. Before I did that I did fork this repo so and tried making that change myself. However, I am not skilled with electron forge apps.

I don't know if it's because this app is an electron forge app or because of browserify or something else, but the code I see in the Chrome debugger sources tab when the app runs doesn't look much like the code I see the WebStorme IDE. In other words, the code I see in IDE, before it runs and is transpiled/browserified/electronified/etc., has different file names and content from that which I see in the Chrome debugger. Because of this I'm having a tough time trying to figure out where to poke around in the code so I can change it to pass the AllowUnlimitedContractSize flag to Ganache core.

Can someone tell me where in the repo source files I can find the code that I need to change? I really would like to go back to using the GUI client.

mikeseese commented 5 years ago

Hey @roschler, this is kind of an "advanced, undocumented workaround" for enabling ganache-cli features that haven't been added in ganache UI yet:

There is a settings file which you can find here:

The file is essentially a JSON object; in there you'll find a child object called server. This is the options object passed to ganache-core (you can see the documentation here).

So you can add something to make it look something like

{
  ...,
  server: {
    ...,
    allowUnlimitedContractSize: true
  }
}

I will make a a new issue referring this one to ad the flag to the config screen in Ganache UI

Thanks for filing this issue! Let me know if that doesn't help.

mikeseese commented 5 years ago

Oh and you'll need to restart Ganache for the changes to get loaded

roschler commented 5 years ago

@seesemichaelj Thanks! That worked great. For those that find this issue the full format for the line in the Settings to activate unlimited contract size support is:

  "server": {
    "allowUnlimitedContractSize": true,
    ...
}
roschler commented 5 years ago

@seesemichaelj At some time I'd still like to know how to poke around the Ganache GUI source as per my original post. I very badly want to add the ability to filter certain API calls by name. Most of us work with tools like Metamask and clients like that ping the network repeatedly (about once a second in Chrome) with eth_blockNumber calls, which clutters up the Ganache logs when you're trying to debug a transaction issue. If I could modify the code, I'd add a simple multi-line text box where you could list all the API calls you'd like filtered from the logs, one per line. Under that text box would be a checkbox that would turn filtering on and off.

Thanks again!

mikeseese commented 5 years ago

Building is as simple as doing an npm install and npm start

We're pushing out a 2.0 release (potentially a beta release) soon, so the develop branch is the best branch to make changes on.

A good place for that would maybe be the Advanced config screen here: https://github.com/trufflesuite/ganache/blob/develop/src/renderer/screens/config/ConfigScreens/AdvancedScreen.js

you probably could add something to the config redux state to see what gets logged to the logs sreen (located here: https://github.com/trufflesuite/ganache/blob/develop/src/renderer/screens/logs/LogContainer.js)

you'd need change export default connect(LogContainer, "logs") to export default connect(LogContainer, "logs", "config") to get this.props.config redux state in that screen

Unfortunately i dont have a lot of time to go through all of this haha, but we try to structure the code to be able to help people figure out how it works

roschler commented 5 years ago

Just an addition to path locations given by @seesemichaelj above for the Settings file. If you end up plinking around the Ganache source code while inside an IDE like WebStorm, the location of the Settings file changes to the following, at least under Linux:

~/.config/Electron/default/Settings