Questions tagged [revert-opcode]

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

Filter by
Sorted by
Tagged with
2
votes
1answer
356 views

TypeError: Member “mint” not found or not visible after argument-dependent lookup in contract ERC20

token.mint(beneficiary, tokens) prevents code from fully compiling using Zeppelin 1.8. Casting your token as a MintableToken* solves this issue and allows your code to compile: MintableToken token = ...
4
votes
0answers
182 views

Is it possible to trace a function call hitting revert?

It is possible to trace a transaction with debug_traceTransaction. But it needs the transaction hash, requiring it to be a transaction in first place. I'm debugging a function call that generates a ...
0
votes
0answers
90 views

Sending ether from contract cause error

Hi In my contract I send ether from my contract to other address like address.transfer(winnerAmount);. It transfer ether successfully if my array have one address. If I have more than one address it ...
1
vote
1answer
5k views

what is [Reverted] during contract execution

I have sent ETH to a contract address, and it "failed" the transaction saying it is: Warning! Error encountered during contract execution [Reverted] contract address and transaction failure here: ...
0
votes
1answer
667 views

Transaction Error. Exception thrown in contract code. REVERT opcode when sending ETH to crowdsale

I wanted to follow the tutorial - https://blog.zeppelin.solutions/how-to-create-token-and-initial-coin-offering-contracts-using-truffle-openzeppelin-1b7a5dae99b6 - but there was a new release - https:/...
0
votes
2answers
205 views

How to intercept Metamask error to display a more user friendly message?

I have a Dapp with smart a contract that has a revert function that can only happen in a specific case. When the revert is triggered, Metamask shows the error like this: Is there a way to "intercept"...
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)...
1
vote
1answer
177 views

lost transaction — not back in my MEW

i sent a transaction to credits ico and it came back with a transaction failure due to a revert opcode. the credits team say they are not responsible i should take it up with ethereum. the ether-...
2
votes
2answers
169 views

Does ether transfer consume all gas in case of exception?

If addr.transfer() fails, does it use a revert- or throw-style exception? In other words, does a failed transfer consume all provided gas?
0
votes
2answers
833 views

Transaction Failures from MetaMask

I tried to send some Ether for an ICO (my first ever) but the transaction failed with error revert opcode. Please see below. https://etherscan.io/tx/...
3
votes
1answer
1k views

Truffle sendTransaction sending eth to contract address returns revert

I have a contract address not a deployed contract instance in which i want to send ETH to but it fails giving Error: VM Exception while processing transaction: revert MyContract.deployed() .then(...
1
vote
1answer
331 views

Is it good practice to use revert() in case a function does find a match in case of a search?

This Solidity function: function findSupplierByName(string supplierName) public view returns (address id, string name) { for (uint idx = 0; idx < supplierAddresses.length; idx++) { ...
3
votes
3answers
2k views

why do we use revert() in payable function?

I have seen this snippet in many online examples could you please explain what this is doing and why are we using it in a payable function? function () public payable { revert () ; }
0
votes
1answer
278 views

How to stop contract execution w/o losing events

Function revert() is supposed to stop contract execution and rollback every change on blockchain except events reported. That's exactly what I need, but it seems to me it is not working as expected. ...
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 ...
2
votes
0answers
225 views

Strange revert() behavior on Etherscan

I am testing my contract, which is for an auction. I've deployed it on the Rinkeby testnet. I have a payable function that calls revert() if the bid being placed isn't higher than the existing bid. ...
12
votes
3answers
5k views

Why do `throw` and `revert()` create different bytecodes?

throw and revert() are both compiling to the revert operation (opcode 0xfd). According to the docs: The throw keyword can also be used as an alternative to revert(). Why is it then that the ...
3
votes
0answers
122 views

Assuming EIP140, is remaining gas refunded when a called contract throws?

Under EIP140 (REVERT) and assuming Solidity ≥0.4.10. If I call from my contract to a function on an external contract, and this external function does an invalid jump, does my contract still call ...
6
votes
1answer
2k views

Will revert() refund all gas of the transaction or just the remaining gas?

According to the docs revert() will not consume any gas: Note that assert-style exceptions consume all gas available to the call, while revert-style exceptions will not consume any gas starting ...
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 ...
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 ...
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?

1
2