From 3b1821923850a7eed355c179b5f6b04d0ff19788 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Thu, 2 Mar 2017 17:24:51 +0100 Subject: [PATCH] Revert "Spurious dragon changes" --- Paper.tex | 126 +++++++++++++++++++----------------------------------- 1 file changed, 43 insertions(+), 83 deletions(-) diff --git a/Paper.tex b/Paper.tex index 58ea0f2d..28065c55 100644 --- a/Paper.tex +++ b/Paper.tex @@ -41,7 +41,7 @@ \newcommand*\ie{i.e.\@\xspace} %\renewcommand{\itemhook}{\setlength{\topsep}{0pt} \setlength{\itemsep}{0pt}\setlength{\leftmargin}{15pt}} -\title{Ethereum: A Secure Decentralised Generalised Transaction Ledger \\ {\smaller \textbf{EIP-155/160/161/170 revision (\YellowPaperVersionNumber{})}}} +\title{Ethereum: A Secure Decentralised Generalised Transaction Ledger \\ {\smaller \textbf{EIP-150 revision (\YellowPaperVersionNumber{})}}} \author{ Dr. Gavin Wood\\ Founder, Ethereum \& Ethcore\\ @@ -233,30 +233,6 @@ \subsection{World State} \label{ch:state} \quad v(x) \equiv x_n \in \mathbb{P}_{256} \wedge x_b \in \mathbb{P}_{256} \wedge x_s \in \mathbb{B}_{32} \wedge x_c \in \mathbb{B}_{32} \end{equation} -An account state is empty when it has no code, zero nonce and zero balance: -\begin{equation} -\mathtt{\tiny EMPTY}(\boldsymbol{\sigma}, a) -\quad\equiv\quad \boldsymbol{\sigma}[a]_c = \texttt{\small KEC}\big(()\big) -\wedge \boldsymbol{\sigma}[a]_n = 0 -\wedge \boldsymbol{\sigma}[a]_b = 0 -\end{equation} - -An account is dead when its account state is non-existent or empty: -\begin{equation} -\mathtt{\tiny DEAD}(\boldsymbol{\sigma}, a) -\quad\equiv\quad \boldsymbol{\sigma}[a] = \varnothing \vee \mathtt{\tiny EMPTY}(\boldsymbol{\sigma}, a) -\end{equation} - -We define the function that updates the balance of an account state but deletes the account state when it becomes empty: -\begin{equation} -\rho_b(\boldsymbol{\sigma}, a, x) \equiv -\begin{cases} -\varnothing \quad\text{if}\quad \boldsymbol{\sigma}[a]_n = 0 \wedge x = 0 \wedge \boldsymbol{\sigma}[a]_c = \texttt{\small KEC}\big(()\big) \\ -(\boldsymbol{\sigma}[a]_n, x, \boldsymbol{\sigma}[a]_s, \boldsymbol{\sigma}[a]_c) \quad \text{otherwise} -\end{cases} -\end{equation} -where $a \in \mathbb{B}_{20}$ and $x \in \mathbb{P}_{256}$. - \subsection{Homestead} \label{ch:homestead} A significant block number for compatibility with the public network is the block marking the transition between the {\it Frontier} and {\it Homestead} phases of the platform, which we denote with the symbol \firsthomesteadblock, defined thus @@ -571,14 +547,14 @@ \section{Transaction Execution} \label{ch:transactions} \subsection{Substate} Throughout transaction execution, we accrue certain information that is acted upon immediately following the transaction. We call this \textit{transaction substate}, and represent it as $A$, which is a tuple: \begin{equation} -A \equiv (A_\mathbf{s}, A_\mathbf{l}, A_\mathbf{t}, A_r) +A \equiv (A_\mathbf{s}, A_\mathbf{l}, A_r) \end{equation} -The tuple contents include $A_\mathbf{s}$, the self-destruct set: a set of accounts that will be discarded following the transaction's completion. $A_\mathbf{l}$ is the log series: this is a series of archived and indexable `checkpoints' in VM code execution that allow for contract-calls to be easily tracked by onlookers external to the Ethereum world (such as decentralised application front-ends). $A_\mathbf{t}$ is the set of touched accounts, of which the empty ones are deleted at the end of a transaction. Finally there is $A_r$, the refund balance, increased through using the {\small SSTORE} instruction in order to reset contract storage to zero from some non-zero value. Though not immediately refunded, it is allowed to partially offset the total execution costs. +The tuple contents include $A_\mathbf{s}$, the self-destruct set: a set of accounts that will be discarded following the transaction's completion. $A_\mathbf{l}$ is the log series: this is a series of archived and indexable `checkpoints' in VM code execution that allow for contract-calls to be easily tracked by onlookers external to the Ethereum world (such as decentralised application front-ends). Finally there is $A_r$, the refund balance, increased through using the {\small SSTORE} instruction in order to reset contract storage to zero from some non-zero value. Though not immediately refunded, it is allowed to partially offset the total execution costs. -For brevity, we define the initial substate $A^0$ to have no self-destructs, no logs, a set of touched accounts and a zero refund balance: +For brevity, we define the empty substate $A^0$ to have no self-destructs, no logs and a zero refund balance: \begin{equation} -A^0(T) \equiv (\varnothing, (), T, 0) \quad\text{for}\quad T \subseteq \mathbb{B}_{20} +A^0 \equiv (\varnothing, (), 0) \end{equation} \subsection{Execution} @@ -647,16 +623,15 @@ \subsection{Execution} The Ether for the gas is given to the miner, whose address is specified as the beneficiary of the present block $B$. So we define the pre-final state $\boldsymbol{\sigma}^*$ in terms of the provisional state $\boldsymbol{\sigma}_P$: \begin{eqnarray} \boldsymbol{\sigma}^* & \equiv & \boldsymbol{\sigma}_P \quad \text{except} \\ -\boldsymbol{\sigma}^*[S(T)] & \equiv & \rho_b(\boldsymbol{\sigma}_P, S(T), \boldsymbol{\sigma}_P[S(T)]_b + g^* T_p) \\ -\boldsymbol{\sigma}^*[m] & \equiv & \rho_b(\boldsymbol{\sigma}_P, m, \boldsymbol{\sigma}_P[m]_b + (T_g - g^*) T_p) \\ +\boldsymbol{\sigma}^*[S(T)]_b & \equiv & \boldsymbol{\sigma}_P[S(T)]_b + g^* T_p \\ +\boldsymbol{\sigma}^*[m]_b & \equiv & \boldsymbol{\sigma}_P[m]_b + (T_g - g^*) T_p \\ m & \equiv & {B_H}_c \end{eqnarray} -The final state, $\boldsymbol{\sigma}'$, is reached after deleting all accounts that either appear in the self-destruct list or are touched and empty: +The final state, $\boldsymbol{\sigma}'$, is reached after deleting all accounts that appear in the self-destruct set: \begin{eqnarray} \boldsymbol{\sigma}' & \equiv & \boldsymbol{\sigma}^* \quad \text{except} \\ -\forall i \in A_\mathbf{s}: \boldsymbol{\sigma}'[i] & \equiv & \varnothing \\ -\forall i \in A_\mathbf{t}: \boldsymbol{\sigma}'[i] & \equiv & \varnothing \quad\text{if}\quad \mathtt{\tiny DEAD}(\boldsymbol{\sigma}^*\kern -2pt, i) +\forall i \in A_\mathbf{s}: \boldsymbol{\sigma}'[i] & \equiv & \varnothing \end{eqnarray} And finally, we specify $\Upsilon^g$, the total gas used in this transaction and $\Upsilon^\mathbf{l}$, the logs created by this transaction: @@ -683,13 +658,13 @@ \section{Contract Creation} \label{ch:create} where $\mathtt{\tiny KEC}$ is the Keccak 256-bit hash function, $\mathtt{\tiny RLP}$ is the RLP encoding function, $\mathcal{B}_{a..b}(X)$ evaluates to binary value containing the bits of indices in the range $[a, b]$ of the binary data $X$ and $\boldsymbol{\sigma}[x]$ is the address state of $x$ or $\varnothing$ if none exists. Note we use one fewer than the sender's nonce value; we assert that we have incremented the sender account's nonce prior to this call, and so the value used is the sender's nonce at the beginning of the responsible transaction or VM operation. -The account's nonce is initially defined as one, the balance as the value passed, the storage as empty and the code hash as the Keccak 256-bit hash of the empty string; the sender's balance is also reduced by the value passed. Thus the mutated state becomes $\boldsymbol{\sigma}^*$: +The account's nonce is initially defined as zero, the balance as the value passed, the storage as empty and the code hash as the Keccak 256-bit hash of the empty string; the sender's balance is also reduced by the value passed. Thus the mutated state becomes $\boldsymbol{\sigma}^*$: \begin{equation} \boldsymbol{\sigma}^* \equiv \boldsymbol{\sigma} \quad \text{except:} \end{equation} \begin{eqnarray} -\boldsymbol{\sigma}^*[a] &\equiv& \big( 1, v + v', \mathtt{\tiny TRIE}(\varnothing), \mathtt{\tiny KEC}\big(()\big) \big) \\ -\boldsymbol{\sigma}^*[s] &\equiv& \rho_b(\boldsymbol{\sigma}, s, \boldsymbol{\sigma}[s]_b - v) +\boldsymbol{\sigma}^*[a] &\equiv& \big( 0, v + v', \mathtt{\tiny TRIE}(\varnothing), \mathtt{\tiny KEC}\big(()\big) \big) \\ +\boldsymbol{\sigma}^*[s]_b &\equiv& \boldsymbol{\sigma}[s]_b - v \end{eqnarray} where $v'$ is the account's pre-existing value, in the event it was previously in existence: @@ -705,7 +680,7 @@ \section{Contract Creation} \label{ch:create} Finally, the account is initialised through the execution of the initialising EVM code $\mathbf{i}$ according to the execution model (see section \ref{ch:model}). Code execution can effect several events that are not internal to the execution state: the account's storage can be altered, further accounts can be created and further message calls can be made. As such, the code execution function $\Xi$ evaluates to a tuple of the resultant state $\boldsymbol{\sigma}^{**}$, available gas remaining $g^{**}$, the accrued substate $A$ and the body code of the account $\mathbf{o}$. \begin{equation} -(\boldsymbol{\sigma}^{**}, g^{**}, A, \mathbf{o}) \equiv \Xi(\boldsymbol{\sigma}^*, g, I, \{s, a\}) \\ +(\boldsymbol{\sigma}^{**}, g^{**}, A, \mathbf{o}) \equiv \Xi(\boldsymbol{\sigma}^*, g, I) \\ \end{equation} where $I$ contains the parameters of the execution environment as defined in section \ref{ch:model}, that is: \begin{eqnarray} @@ -724,12 +699,9 @@ \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{align} -c \equiv \begin{cases} - 2^{256} - 1 & \text{if} \quad |\mathbf{o}| \le 24576 \\ - G_{codedeposit} \times |\mathbf{o}| & \text{otherwise} -\end{cases} -\end{align} +\begin{equation} +c \equiv G_{codedeposit} \times |\mathbf{o}| +\end{equation} If there is not enough gas remaining to pay this, \ie $g^{**} < c$, then we also declare an out-of-gas exception. @@ -747,8 +719,6 @@ \section{Contract Creation} \label{ch:create} \boldsymbol{\sigma} & \text{if} \quad \boldsymbol{\sigma}^{**} = \varnothing \\ \boldsymbol{\sigma}^{**} & \text{if} \quad g^{**}