Contract creation initialization returns data with length of more than 24576 bytes (EIP-170)

:computer: Environment

  • Truffle v5.1.48 (core: 5.1.48)
  • Solidity v0.5.16 (solc-js)
  • Node v12.18.4
  • Web3.js v1.2.1
  • @openzeppelin/contract-loader v0.6.1

:memo:Details

I find weird issue, I deploy a Governance contract source code using Remix, Truffle, and setupLoader from openzeppelin

Remix and Truffle failed to execute with error

Contract creation initialization returns data with length of more than 24576 bytes. The deployment will likely fails.
More info: eip-170

But why setupLoader from openzeppelin able to execute and deploy it?

:1234: Code to reproduce

1 Like

Hey, when I met this issue first time, I solved it by a new config, you can add the following config in the truffle-config.js:

module.exports = {
    // Configure your compilers
    compilers: {
        solc: {
            version: "0.5.15", // Fetch exact version from solc-bin (default: truffle's version)
            settings: { // See the solidity docs for advice about optimization and evmVersion
                optimizer: {
                    enabled: true,
                    runs: 200
                },
            }
        }
    },
}
2 Likes

Hi @Ela_Granata,

Welcome to the community :wave:

I tried compiling on Remix but remix was unresponsive. I suggest trying to compile as @Skyge advised with optimization enabled.