Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Allow tweaking underlying ganache's configuration #31

Open
spalladino opened this issue Dec 12, 2019 · 9 comments
Open

Allow tweaking underlying ganache's configuration #31

spalladino opened this issue Dec 12, 2019 · 9 comments
Labels
enhancement New feature or request
Milestone

Comments

@spalladino
Copy link
Contributor

spalladino commented Dec 12, 2019

We should allow tweaking ganache's configuration when running the tests. We currently only support block gas limit and accounts initial ETH, but we should also cover:

  • EVM: to test how code will behave in a future fork (this includes upgrading the underlying ganache-core version)
  • Forking: to support testing upgrades or other actions that would be run on mainnet
  • Unlocked accounts: which allows using accounts without knowing their private key, in a forking scenario.
  • Errors on RPC response: to test an app's behaviour upon reverts in a more realistic setting (noVMErrorsOnRPCResponse)
  • Port: to have a consistent port in case the user wants to attach another process to ganache to monitor the transactions being run
  • Blocktime: to check how the app behaves without instant seal

We can either do this by allowing the user to spin up their own ganache and attach to it (instead of using the one provided by test-env) or by adding more options to the configuration.

@frangio
Copy link
Contributor

frangio commented Dec 12, 2019

We should also support "unlocked accounts", which allows using accounts without knowing their private key. What I've heard is that they're useful when forking.

@spalladino
Copy link
Contributor Author

Thanks Fran, added to the body of the issue!

@mds1
Copy link
Contributor

mds1 commented Jan 10, 2020

Hey there, just curious what kind of timeline is expected for this issue? Really looking forward to using the OpenZeppelin Test Environment in my project, but am waiting for a few of these settings to be supported.

@spalladino
Copy link
Contributor Author

Hey @mds1! Unfortunately this is not scheduled for the upcoming weeks, so I cannot give a precise answer. We would certainly welcome a PR with the feature if you are interested, though!

@mds1
Copy link
Contributor

mds1 commented Jan 10, 2020

Got it, thanks. Probably won't get to it for a few weeks, but would be willing to take a shot at the PR then!

@abcoathup abcoathup added the enhancement New feature or request label Jan 31, 2020
@abcoathup
Copy link
Contributor

abcoathup commented Mar 10, 2020

Request on the community forum for support testing on a forked ganache: https://forum.openzeppelin.com/t/testing-on-ganache-fork/2434

Also requested on Telegram: https://t.me/zeppelinos/10819

@frangio
Copy link
Contributor

frangio commented Mar 20, 2020

@knarz has submitted #55 enabling support for allowUnlimitedContractSize. Rather than adding ad-hoc suport for specific options I think we should add generic support for forwarding an object with arbitrary options. What does everyone think about this? I don't see this specifically mentioned in the comments above.

More specifically, I am proposing adding a field to our configuration file like:

module.exports = {
  accounts: {
    amount: 10, // Number of unlocked accounts
    ether: 100, // Initial balance of unlocked accounts (in ether)
  },

  node: {
    allowUnlimitedContractSize: true,
  },
};

where the object under node is forwarded as options to Ganache. I'm proposing node in case we introduce support for other nodes in the future (e.g. Geth) and the same option forwarding could take place. Alternatively we could just name it ganache for now.

There are some options we would not support, like custom account configuration. We would have to detect those and possibly throw an error or simply ignore them.

@ylv-io ylv-io added this to the 2020 Q2 milestone Mar 30, 2020
@ylv-io
Copy link
Contributor

ylv-io commented Apr 1, 2020

Agree with @frangio on the grouping. Accounts are also a part of Ganache/Node grouping because eventually Ethereum client is holding them.

@frangio
Copy link
Contributor

frangio commented Apr 1, 2020

I disagree with putting accounts inside the ganache/node object because there is a "preprocesing" step done by test-env. I would expect everything inside that object to be forwarded without any changes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants