The question

Hello everyone, could anyone explain to me the consequences of: VM Exception while processing transaction: invalid opcode.

The context

I'm passing in an integer in web3js that is not mapped to an enum in my solidity contract - I have 2 elements in the enum and I'm intentionally passing in an index of 2, expecting the transaction to fail. The transaction does fail , however I expected a revert and not an invalid opcode. Should I handle parameter sanitisaton in some way?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.