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

**URL:** <https://forum.openzeppelin.com/t/error-when-trying-to-use-tests-for-governor-contract-from-official-openzeppelin-github-repo/30596>\
**Category:** Contracts\
**Created:** [July 22, 2022, 5:21pm UTC](https://forum.openzeppelin.com/t/error-when-trying-to-use-tests-for-governor-contract-from-official-openzeppelin-github-repo/30596 "2022-07-22T17:21:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SAN](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/san/32/11786_2.png) [@SAN](https://forum.openzeppelin.com/u/SAN)\
**Post date:** [July 22, 2022, 5:21pm UTC](https://forum.openzeppelin.com/t/error-when-trying-to-use-tests-for-governor-contract-from-official-openzeppelin-github-repo/30596/1 "2022-07-22T17:21:02Z")

</div>

Hey everybody, I got this error

```auto
 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](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/test/governance/Governor.test.js)

My guess is that I should somehow increase gas limit inside of `delegate()` func of `GovernorHelper` ( [OpenZeppelin governance.js](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/test/helpers/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 🙂

---

<div class="post-metadata">

**Author:** ![frangio](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/frangio/32/15251_2.png) [@frangio](https://forum.openzeppelin.com/u/frangio)\
**Post date:** [July 22, 2022, 6:55pm UTC](https://forum.openzeppelin.com/t/error-when-trying-to-use-tests-for-governor-contract-from-official-openzeppelin-github-repo/30596/2 "2022-07-22T18:55:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SAN](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/san/32/11786_2.png) [@SAN](https://forum.openzeppelin.com/u/SAN)\
**Post date:** [July 22, 2022, 7:16pm UTC](https://forum.openzeppelin.com/t/error-when-trying-to-use-tests-for-governor-contract-from-official-openzeppelin-github-repo/30596/3 "2022-07-22T19:16:46Z")

</div>

@frangio  
Thank you very much for such a prompt response.  
Sure thing, I am more than happy to share, here is the [repo](https://github.com/andreysolovyev1976/oz_forum/tree/master)  
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:

```auto
 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)`

---

<div class="post-metadata">

**Author:** ![SAN](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/san/32/11786_2.png) [@SAN](https://forum.openzeppelin.com/u/SAN)\
**Post date:** [July 23, 2022, 9:13pm UTC](https://forum.openzeppelin.com/t/error-when-trying-to-use-tests-for-governor-contract-from-official-openzeppelin-github-repo/30596/4 "2022-07-23T21:13:44Z")

</div>

> [@SAN](#):
>
> 972197500000

@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 🙂  
Thanks a lot!
