mirror of https://github.com/status-im/EIPs.git
Some clarifications.
This commit is contained in:
parent
793f88b6ab
commit
efd2333c80
|
@ -22,11 +22,19 @@ Currently this is not possible. There are two practical ways to revert a transac
|
|||
|
||||
## Specification
|
||||
|
||||
The `REVERT` instruction is introduced at `0xfd`. Execution is aborted, considered as failed, and state changes are rolled back.
|
||||
The `REVERT` instruction is introduced at `0xfd`. It expects two stack items, the top item is the `memory_offset` followed by `memory_length`. It does not return anything because it stops execution.
|
||||
|
||||
It expects two stack items, the top item is the `memory_offset` followed by `memory_length`. Both of these can equal to zero. The cost of the `REVERT` instruction equals to that of the `RETURN` instruction.
|
||||
The semantics of `REVERT` with respect to memory and memory cost are identical to those of `RETURN`. The sequence of bytes given by `memory_offset` and `memory_length` is called "error message" in the following.
|
||||
|
||||
In case there is not enough gas left to cover the cost of `REVERT` or there is a stack underflow, the effect of the `REVERT` instruction will equal to that of a regular out of gas exception.
|
||||
The effect of `REVERT` is that execution is aborted, considered as failed, and state changes are rolled back. The error message will be available to the caller in the returndata buffer and will also be copied to the output area, i.e. it is handled in the same way as the regular return data is handled.
|
||||
|
||||
The cost of the `REVERT` instruction equals to that of the `RETURN` instruction, i.e. the rollback itself does not consume all gas, the contract only has to pay for memory.
|
||||
|
||||
In case there is not enough gas left to cover the cost of `REVERT` or there is a stack underflow, the effect of the `REVERT` instruction will equal to that of a regular out of gas exception, i.e. it will consume all gas.
|
||||
|
||||
In the same way as all other failures, the calling opcode returns `1` on the stack following a `REVERT` opcode in the callee.
|
||||
|
||||
In case `REVERT` is used in the context of a `CREATE` or `CREATE2` call, no code is deployed, `1` is put on the stack and the error message is available in the returndata buffer.
|
||||
|
||||
The content of the optionally provided memory section is not defined by this EIP, but is a candidate for another Informational EIP.
|
||||
|
||||
|
|
Loading…
Reference in New Issue