Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EIP 140: adding REVERT instruction #242

Closed
wants to merge 4 commits into from
Closed

Conversation

pirapira
Copy link
Member

@pirapira pirapira commented Feb 21, 2017

This pull-request implements ethereum/EIPs#206 . Merging this requires the community's consensus on the EIP.

Fixes #232

@pirapira
Copy link
Member Author

@axic and @chriseth might be interested.

@@ -898,7 +908,7 @@ \subsubsection{Exceptional Halting}
\end{array}
\end{equation}

This states that the execution is in an exceptional halting state if there is insufficient gas, if the instruction is invalid (and therefore its $\delta$ subscript is undefined), if there are insufficient stack items, if a {\small JUMP}/{\small JUMPI} destination is invalid or the new stack size would be larger then 1024. The astute reader will realise that this implies that no instruction can, through its execution, cause an exceptional halt.
This states that the execution is in an exceptional halting state if there is insufficient gas, if the instruction is invalid (and therefore its $\delta$ subscript is undefined), if there are insufficient stack items, if a {\small JUMP}/{\small JUMPI} destination is invalid or the new stack size would be larger then 1024.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to this change, but perhaps worth mentioning that:

if the instruction is invalid (including {\small INVALID}...

@@ -767,14 +772,19 @@ \section{Message Call} \label{ch:call}
\end{cases}
\end{equation}

The account's associated code (identified as the fragment whose Keccak hash is $\boldsymbol{\sigma}[c]_c$) is executed according to the execution model (see section \ref{ch:model}). Just as with contract creation, if the execution halts in an exceptional fashion (i.e. due to an exhausted gas supply, stack underflow, invalid jump destination or invalid instruction), then no gas is refunded to the caller and the state is reverted to the point immediately prior to balance transfer (i.e. $\boldsymbol{\sigma}$).
The account's associated code (identified as the fragment whose Keccak hash is $\boldsymbol{\sigma}[c]_c$) is executed according to the execution model (see section \ref{ch:model}). Just as with contract creation, if the execution halts in an exceptional fashion (i.e. due to an exhausted gas supply, stack underflow, invalid jump destination or invalid instruction), then no gas is refunded to the caller and the state is reverted to the point immediately prior to balance transfer (i.e. $\boldsymbol{\sigma}$). However, if the execution halted by a {\small REVERT} instruction, the remaining gas (if any) is paid back although the state is reverted.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could have a proper list of "exceptional halts" somewhere.

@pirapira pirapira changed the title EIP 140: adding REVERT instruction [WIP] EIP 140: adding REVERT instruction Feb 23, 2017
@pirapira
Copy link
Member Author

I just realized that, I still need to update the way CALL calculates its return value. Currently it just uses the exceptional halting function Z.

@pirapira pirapira mentioned this pull request Feb 24, 2017
@pirapira pirapira changed the title [WIP] EIP 140: adding REVERT instruction EIP 140: adding REVERT instruction Feb 24, 2017
@pirapira
Copy link
Member Author

I fixed the return values of CALL, CREATE and so.

@pirapira pirapira mentioned this pull request Mar 9, 2017
12 tasks
@pirapira
Copy link
Member Author

@gavofyork 's suggestion was to implement this as another clause in the definition of \Xi (where exceptional halting is detected). Closing for now.

@pirapira pirapira closed this Mar 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants