Deployment Failed: “Migrations” exceeded the block limit

Error: *** Deployment Failed ***

“Migrations” exceeded the block limit (with a gas value you set).

  • Block limit: 6721975 (0x6691b7)
  • Gas sent: 17592186044415 (0xfffffffffff)
  • Try:
    • Sending less gas.
    • Setting a higher network block limit if you are on a
      private network or test client (like ganache).

I would be happy if someone can help me out how to set.

development: {

 host: "127.0.0.1",     // Localhost (default: none)

 port: 8545,            // Standard Ethereum port (default: none)

 network_id: "*",       // Any network (default: none)

 gas: 0xfffffffffff,  // <-- Use this high gas value

 gasPrice: 0x01,  // <-- Use this low gas price

 BlockLimit: 0x6691b7  

},
1 Like

Hi @Madison_Gagnon,

You didn't say why you were trying to set such a high gas value?
If you comment out or remove the gas limit you should then be able to migrate.


BlockLimit isn't a configuration option so will be ignored. See: https://www.trufflesuite.com/docs/truffle/reference/configuration#networks

Instead you could set a different limit in ganache-cli (assuming you are deploying to `ganache-cli) using:

-l or --gasLimit: The block gas limit (defaults to 0x6691b7)

See: https://github.com/trufflesuite/ganache-cli#options

...
    development: {
     host: "127.0.0.1",     // Localhost (default: none)
     port: 8545,            // Standard Ethereum port (default: none)
     network_id: "*",       // Any network (default: none)
     //gas: 0xfffffffffff,  // <-- Use this high gas value
     gasPrice: 0x01,  // <-- Use this low gas price
     //BlockLimit: 0x6691b7 
    },
...

Also not working I set it to 10000000 also and try again its looks like same every time.
ran out of gas (using a value you set in your network config or deployment parameters.)

  • Block limit: 6721975 (0x6691b7)
  • Gas sent: 6721975 (0x6691b7)

My file maybe too long how can I solve this problem. Cant split my contract.

Try add some extra config in the truffle-config.js:

module.exports = {
    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

No, it’s not the solution because of the contract size but I made it done thank you so much.

1 Like

Glad to hear that you have solved your problems, and could you please write down your solution, so others may find a solution in it.

1 Like