From b7a939a86857a647e176251c9d0308e506bd8519 Mon Sep 17 00:00:00 2001 From: Yoichi Hirai Date: Mon, 20 Feb 2017 17:18:23 +0100 Subject: [PATCH] Define REVERT instruction Fixes #232 --- Paper.tex | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/Paper.tex b/Paper.tex index 87ba3880..787fc40d 100644 --- a/Paper.tex +++ b/Paper.tex @@ -704,9 +704,13 @@ \section{Contract Creation} \label{ch:create} Code execution depletes gas, and gas may not go below zero, thus execution may exit before the code has come to a natural halting state. In this (and several other) exceptional cases we say an out-of-gas (OOG) exception has occurred: The evaluated state is defined as being the empty set, $\varnothing$, and the entire create operation should have no effect on the state, effectively leaving it as it was immediately prior to attempting the creation. If the initialization code completes successfully, a final contract-creation cost is paid, the code-deposit cost, $c$, proportional to the size of the created contract's code: -\begin{equation} -c \equiv G_{codedeposit} \times |\mathbf{o}| -\end{equation} +\begin{eqnarray} + c & \equiv & + \begin{cases} + G_{codedeposit} \times |\mathbf{o}| & \text{if}\quad \boldsymbol{\sigma}^{**} \neq \varnothing \\ + 0 & \text{otherwise} + \end{cases} +\end{eqnarray} If there is not enough gas remaining to pay this, \ie $g^{**} < c$, then we also declare an out-of-gas exception. @@ -716,7 +720,8 @@ \section{Contract Creation} \label{ch:create} \begin{align} \quad g' &\equiv \begin{cases} -0 & \text{if} \quad \boldsymbol{\sigma}^{**} = \varnothing \\ +0 & \text{if} \quad \boldsymbol{\sigma}^{**} = \varnothing \wedge \mathbf{o} = \varnothing \\ +g^{**} & \text{if} \quad \boldsymbol{\sigma}^{**} = \varnothing \wedge \mathbf{o} \neq \varnothing \\ g^{**} & \text{if} \quad g^{**}