Strcmp Invalid Read of Size 1 0xf Is Not Stacked

Error: VM Exception while processing transaction: revert.

A Guide to Problem-Solving in Solidity.

          Error: VM Exception while processing transaction: revert Market registered
at getResult … json-rpc-provider.js:40:21)
at exports.XMLHttpRequest.request … web.js:111:xxx)
at exports.XMLHttpRequest.dispatchEvent … XMLHttpRequest.js:591:25)
at setState … XMLHttpRequest.js:610:14)
at IncomingMessage.<anonymous> … XMLHttpRequest.js:447:13)
at IncomingMessage.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1081:12)
at process._tickCallback (internal/procedure/next_tick.js:63:19)
          at YourContract…the error…YourContract.sol:              111:21            )        

Solidity errors and what they mean.

Glossary:

Counter from google
  • OUT_OF_GAS: "out of gas" ⇐ Your contract call used too much gas. At that place are a couple of reasons this could occur, such as a recursive telephone call (office A calls office B and and so office B calls function A…), your function is doing a adding that is besides complex, as well as calling a chain of functions that is too long.
  • STACK_UNDERFLOW: "stack underflow"⇐ A number wrapped under and is now at its max value. The minimum value of a uint8 is of grade 0, and the max is 255. So if we have a uint8 number that is 0 and we minus i, information technology will underflow to the max value. I.eastward:
          uint8 goingToUnderflow = 0;
goingToUnderflow - 1;
goingToUnderflow is now equal to 255.
  • STACK_OVERFLOW: "stack overflow" ⇐ A number somewhere wrapped over and is now at its minimum value. The max value of a uint8 is 255. So if nosotros have a uint8 set to 255 and we add together 1, information technology will underflow and the value will exist 1. E.m:
          uint8 goingToOverflow = 255;
goingToOverflow + i;
goingToOverflow is now equal to 1.
  • INVALID_JUMP: "invalid JUMP" ⇐ Invalid jumps burn down all remaining gas similar an assert(). This error happens when a function call jumps out of bounds (e.g assortment out of bounds). This is done to punish the caller for attempting to do something they weren't supposed to do. "Jump" is an assembly term for going from one section of code to another. The error is basically a function phone call that is invalid at an associates level.
  • INVALID_OPCODE: "invalid opcode" ⇐ Somewhere yous are trying to execute opcode that does non be. The opcode tin be a function that does not exist or a revert (reverts execute a not-existent opcode).
  • REVERT: "revert"⇐ Something somewhere broke. This revert will render the remaining gas. The most common error.
  • STATIC_STATE_CHANGE: "static state change" ⇐ If you have a view function and you endeavor to alter a land value you lot volition become this error.

All promise is lost. Where to offset?

  1. Flatten your contract by running the control: truffle-flattener.\contracts\YourContracts.sol >> flatContract.txt on your contract. The >> flatContract.txt will save the flattened contract in the .txt file. If you don't do this it volition print the apartment contract in the console.
  2. Put your flattened contracts into Remix. A elementary copy paste, and naming the file.
  3. Connect your Remix to your local blockchain. In the run tab, select environment and ensure that it is set up to Web3 provider. A popular up volition appear that will ask you if you are sure (you are) and ask for the local host port, the default is 8545.
  4. Deploy your contract. In the run tab there is a driblet down under the value field, where you can select your contract and then either enter the constructor fields (besides the deploy button is a driblet down which makes it easier) or enter the address if your contract is deployed on a exam cyberspace (make sure you lot are connected to the test net and that you lot have the code).

  1. Add an error message to your reverts. This should go without saying but your reverts should all have error messages. Don't forget to re-deploy your contract subsequently every code alter. E.g: revert(theCheck, "The check is failing").
  2. If you have any asserts, comment them out. If your assert is failing (and they should never be) at that place is a nice problems somewhere waiting for yous. Nosotros can accept a improve wait at this in the debugging phase. Remember what you change so that y'all tin re-implement information technology if it's not what's making the contract telephone call fail.
  3. Running out of gas? Running out of gas means something, somewhere in your contracts function is either being called over and over until it finishes your allocated gas, or a function call is doing something horribly incorrect and is eating all the gas. Whatever the cause, something is doing something it shouldn't. Information technology will virtually likely become apparent in the debugging.
  4. Check the obvious: values and modifiers. If y'all have a modifier, are you certain that information technology's not failing? Check that all of your involved values are what you expect them to be by making them public.

Time to jump into a debugger to figure this out.

  1. Re-implement all the code that you accept previously removed. If none of it was making the function fail and so it should go back in. Run the declining function again and grab the transaction hash from Remix.

If all else fail.

Good (bug) hunting!

Tools

Resources:

stewartphim1981.blogspot.com

Source: https://medium.com/linum-labs/error-vm-exception-while-processing-transaction-revert-8cd856633793

0 Response to "Strcmp Invalid Read of Size 1 0xf Is Not Stacked"

ارسال یک نظر

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel