Questions tagged [revert-opcode]

Questions about Solidity's `revert()` or the REVERT opcode.

Filter by
Sorted by
Tagged with
77
votes
4answers
26k views

Difference between require and assert and the difference between revert and throw

I was looking at the docs and Im looking for clarification on the difference between require and assert and throw and revert. assert(bool condition): abort execution and revert state changes if ...
21
votes
3answers
6k views

how to catch “revert” error in truffle test javascript?

How can I catch "revert" error in truffle test written in javascript? Error: VM Exception while processing transaction: revert Here is part of test contract, function doRevert() public { ...
38
votes
2answers
12k views

How do I detect a failed transaction after the Byzantium fork as the REVERT opcode does not consume all gas?

Pre Byzantium fork, I could use gas == gasUsed to detect when a transaction has failed (further details in How can the transaction status from a thrown error be detected when gas can be exactly the ...
8
votes
1answer
3k views

Returning an error code with revert

According to the newest version of the yellow paper and Solidity assembly specification, revert opcode can return an error code. http://solidity.readthedocs.io/en/develop/assembly.html revert(p, s)...
3
votes
1answer
727 views

Difference between STOP and INVALID opcode

STOP halts execution and according to this mentions INVALID is used as an abort. Is the difference between these opcodes purely semantical?
6
votes
2answers
2k views

Getting error message from require()

I know that the latest Solidity supports error messages in require/revert (require(stuff, "problem")). Are there any clients that can get this message? Will I be able to see it if I execute the ...
4
votes
3answers
1k views

How to catch solidity contract revert message using web3j

Is there any way to catch solidity revert message like Remix Javascript VM in web3j Revert message(Remix) transact to Erecruitment.issueNewAdmitCard errored: VM error: revert. revert The ...
4
votes
1answer
400 views

Will existing contracts behave differently when REVERT is implemented by Metropolis?

Solidity v0.4.10 introduced the revert() and require() functions, along with support for the REVERT opcode. As far as I can tell, this means that any contract compiled using ^0.4.10 will express ...
2
votes
1answer
19 views

What is the purpose of a `// dev:` comment after a revert or require statement?

What does it mean when a Solidity contract includes a comment starting with // dev: after a revert or require statement? For example: contract Example { function greet(){ revert(); // ...