I have the following migration files with 50 contracts' deployment and their setup (calling each other functions like privileges, access and so on):
On the development network everything works fine. When I change network to ropsten it cancels migration at totally random time. Once it's at "2", once at "13". It's totally randomness. To be clear: it's not the contracts' problem, because thair gas limit is below 4867350 limit. The message that comes with cancel is:
Returned values aren't valid, did it run Out of Gas?
If I continue migration it throws errors like contract not deployed or it won't call functions. It's weird, I know, but that happened to me moment ago. The only way is to perform migration over again with --reset param or deleted build folder. It's really lucky for me to finish the migration with success. I have already lost a lot of ropsten's ether (fortunately free), but I'm really afraid I could lose ether on mainnet, because the whole migration costs over 2 ether.
Here is my truffle config for ropsten:
gas: 4867350, gasPrice: 10000000000, confirmations: 2, timeoutBlocks: 200, skipDryRun: true
What can I do to make ropsten working correctly?