Ethereum Asked on November 18, 2021
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.
It very likely is a valid contract is too large error. One thing you can try is to add the optimizer to your solidity compiler config, which will be located in your truffle.js config file. This will run a process on the assembly code during compilation, making it more efficient.
You can find a more detailed explanation here
compilers: {
solc: {
version: "^0.5.0",
settings: {
optimizer: {
enabled: true,
runs: 200
}
}
}
}
Answered by shkfnly on November 18, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP