goldfinch-eng/mono

ProviderError: max code size exceeded

Opened this issue · 2 comments

Getting this error on both AVAX and Aurora networks, when trying to run the tests.

 |  TranchedPool                               ·     24.504  ·               │
 ··············································|·············|················
 |  StakingRewards                             ·     24.549  ·               │

TranchedPool and StakingRewards exceed the smart contract size limit, so they cannot be deployed on neither of these networks. Can we have the contracts reduced in size so they can be deployed on the network?

Full error:

     ERROR processing /Users/constantindogaru/weavik/mono/packages/protocol/deploy/baseDeploy.ts:
ProviderError: max code size exceeded
    at HttpProvider.request (/Users/constantindogaru/weavik/mono/packages/protocol/node_modules/hardhat/src/internal/core/providers/http.ts:74:19)
    at HDWalletProvider.request (/Users/constantindogaru/weavik/mono/packages/protocol/node_modules/hardhat/src/internal/core/providers/accounts.ts:188:34)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

If you comment allowUnlimitedContractSize: true from hardhat.config.base.ts, you will get a similar error inside the tests:

Error: Transaction reverted: trying to deploy a contract whose code is too large

You are just hiding the problem by using allowUnlimitedContractSize: true. The contract sizes for TranchedPool and StakingRewards should be reduced.