Skip to main content
14 events
when toggle format what by license comment
Aug 11, 2020 at 2:26 comment added user63058 @goodvibration BTW, Also, I am using Solidity 5.0.0 and web3 1.2.9. Could the "invalid opcode" be due to the web3 or solidity version ?
Aug 11, 2020 at 2:26 comment added user63058 @goodvibration I did not include the whole smart contract. However, please note that is an "Add" function that is usually called before the "Track" function. This "Add" function has multiple "push" operations, which are added above in update#2 for your reference.
Aug 11, 2020 at 2:17 history edited user63058 CC BY-SA 4.0
added 125 characters in body
Aug 11, 2020 at 2:02 history edited user63058 CC BY-SA 4.0
added 352 characters in body
Aug 10, 2020 at 17:47 comment added hrkrshnn A generic way to see if the opcode invalid is in the code is to look at the assembly output of the function. You can do this by solc --asm. The output should have comments that denote entry point of your function.
Aug 10, 2020 at 17:44 comment added goodvibration However, I do not see any of these two possible runtime operation - I could not find a single occurrence of push in your code (and in this entire webpage to be honest, except for the one that i just mentioned). So obviously every storage array in your code is of length 0. Thus, obviously any attempt to access any of the arrays in your contract would result with an invalid opcode, exactly as stated in the 2nd bullet in the answer that you've quoted!
Aug 10, 2020 at 16:48 comment added user63058 Added them above . mapping(address => mapping(address => string[])) public patientToDoctorRecordHashes; mapping(address => mapping(uint256 => address[])) public patientRecordListOfDoctors; mapping(address => string[]) public patientRecordHashes;
Aug 10, 2020 at 16:47 history edited user63058 CC BY-SA 4.0
added 395 characters in body
Aug 10, 2020 at 6:30 comment added goodvibration As to your question: The state-variables patientRecordHashes and patientRecordListOfDoctors are missing in your code. We have no idea what they are (arrays or mappings) and how they are initialized. Obviously, your question cannot be answered without this information!
Aug 10, 2020 at 6:20 comment added goodvibration BTW, as the user who wrote that answer about invalid opcodes, I can tell you that there is yet one more trigger that can cause them: calling a function which receives an enum parameter as input, and passing it a value larger than that enum's max value. This is a rather poor decision of the Solidity compiler development team, but it is nevertheless the current behavior.
Aug 10, 2020 at 6:16 history edited goodvibration CC BY-SA 4.0
added 72 characters in body
Aug 9, 2020 at 18:42 history edited user63058 CC BY-SA 4.0
added 341 characters in body
Aug 9, 2020 at 17:27 review First posts
Aug 10, 2020 at 3:48
Aug 9, 2020 at 17:24 history asked user63058 CC BY-SA 4.0