I am trying to figure out what is wrong with the following code as it does deploy successfully on remix.
pragma solidity ^0.5.11;
contract MyContract {
// Storage
address contractOwner;
address[] userFilesList;
mapping ( string => address ) private accountAddressesByProfile;
address[] public accountList;
bytes16[] accountTypes;
mapping(bytes16 => bool) accountTypesMap;
constructor() public {
contractOwner = msg.sender;
bytes16[5] memory initialAccountTypes = [
bytes16("Account1"),
bytes16("Account2"),
bytes16("Account3"),
bytes16("Account4"),
bytes16("Account5")
];
for (uint8 i = 0; i < initialAccountTypes.length; i++ ) {
bytes16 accountType = initialAccountTypes[i];
accountTypes.push(accountType);
accountTypesMap[accountType] = true;
}
}
}
The issue is it refuses to deploy from remix when pointed to a remote node(in my case a parity node running of Azure proof of authority consortium).
I get the following error when I try to deploy on remix
Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
"message" must be a nonempty string
And when I deploy anyway it fails with error 0x0 Transaction mined but execution failed
.
However if I changed the pragma version to say 0.4.26
it deploys successfully. Im trying to understand what’s going on or see if perhaps it’s not good practice to implement the loop in the constructor.