I kept on getting this error. 9/10 of my deployment will fail. But out of the sudden it will be success without any reason.
I have checked the transaction receipt and indeed it had reaches the gas limit. The weird thing is, no matter how high I set, the limit will always be hit (until it reaches the block gas limit)
Saving successful migration to network...
... 0x4767ac8dbe6496fad283fd0185557f1fa56bd8772f9e6e727a385a31938d7179
... 0xeab261e0b015da89e96607cc20de26678a1d75c88fc1d5307ac526aad539d15d
Saving artifacts...
(node:7376) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: The contract code couldn't be stored, please check your gas amount.
(node:7376) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
truffle Configuration
development: {
host: "localhost",
port: 8545,
from: "0xc8caa71c16299b40b8579742a27ee53162886040",
gas: "900000000",
gasPrice: "3000000000",
network_id: "*" // Match any network id
},
The ciritcal part of the migration script:
deployer.deploy(V);
deployer.deploy(L).then(async () => {
deployer.deploy(X, L.address);
});
The X is failing. It's constructor is depending on the address of L. If your earlier guess is correct, then most likely this is the part that gives error.