Error when trying to use tests for Governor contract from official OpenZeppelin github repo

Hey everybody, I got this error

 1) Contract: Governor
       "before each" hook for "deployment check":
     Error: Returned error: VM Exception while processing transaction: out of gas
      at GovernorHelper.delegate (test/OpenZeppelinGovernance/governance.js:26:90)
      at Context.<anonymous> (test/OpenZeppelinGovernance/GovernorTest.js:44:27)
      at processTicksAndRejections (internal/process/task_queues.js:95:5)

when trying to run this test from OpenZeppelin repo:
Official OpenZeppelin Governor contract tests

My guess is that I should somehow increase gas limit inside of delegate() func of GovernorHelper ( OpenZeppelin governance.js ) but my attempts fail.

I also read that it may be a result of smart contract being greater than 24K, but my ganache-cli has the following params:
ganache-cli -p 8546 -e 200 -g 1 -l 972197500000 --allowUnlimitedContractSize
Found similar and quite recent topic at OpenZeppelin github ( OpenZeppelin/openzeppelin-contracts/issues/3235 ), unfortunately there is still no response from OpenZeppelin team.

Help wanted and needed! Appreciate your efforts :slightly_smiling_face:

Can you share a repository with code to reproduce the problem?

@frangio
Thank you very much for such a prompt response.
Sure thing, I am more than happy to share, here is the repo
Please notice there is zero of my code, all the files are copy-paste from official repo of OpenZeppelin.

Commands sequence is:
ganache-cli -p 8546 -e 200 -g 1 -l 972197500000 --allowUnlimitedContractSize
truffle test ./test/GovernorTest.js

Output:

 Contract: Governor

    1) "before each" hook for "deployment check"

ยท----------------------------------------|---------------------------|-------------|----------------------------ยท
|  Solc version: 0.8.15+commit.e14f2714  ยท  Optimizer enabled: true  ยท  Runs: 200  ยท  Block limit: 6718946 gas  โ”‚
ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท
|  Methods                                                                                                      โ”‚
ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
|  Contract           ยท  Method          ยท  Min        ยท  Max        ยท  Avg        ยท  # calls     ยท  eur (avg)  โ”‚
ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
|  Deployments                           ยท                                         ยท  % of limit  ยท             โ”‚
ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
|  CallReceiverMock                      ยท          -  ยท          -  ยท     372017  ยท       5.5 %  ยท          -  โ”‚
ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
|  ERC20VotesMock                        ยท          -  ยท          -  ยท    1750431  ยท      26.1 %  ยท          -  โ”‚
ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
|  GovernorMock                          ยท          -  ยท          -  ยท    2842934  ยท      42.3 %  ยท          -  โ”‚
ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
|  Migrations                            ยท          -  ยท          -  ยท     153922  ยท       2.3 %  ยท          -  โ”‚
ยท----------------------------------------|-------------|-------------|-------------|--------------|-------------ยท

  0 passing (18s)
  1 failing

  1) Contract: Governor
       "before each" hook for "deployment check":
     Error: Returned error: VM Exception while processing transaction: out of gas
      at GovernorHelper.delegate (test/governance.js:26:90)
      at Context.<anonymous> (test/GovernorTest.js:44:27)
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (internal/process/task_queues.js:95:5)

I am on
MacOS 10.14.6 (18G9323)

@frangio
Hey, appreciate your quick response again.
I figured out where it was a problem - it appears that ganache params is not enough, one should also update a gas limit at truffle-config* Did that and now it works.
Magic power of forum helped me out :slightly_smiling_face:
Thanks a lot!

1 Like