-
Notifications
You must be signed in to change notification settings - Fork 12
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
Bugfix for GAS_NEXT
of CREATE
's
#15
Changes from 1 commit
e48ea04
0247696
071a464
654bd27
280e984
a76fb76
df7eb19
a303358
021cd1d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
\scenCreateSum _{i} & = & 1 \\ | ||
\end{array} \right.} | ||
\end{center} | ||
The present section deals with generalities pertaining to \inst{CREATE}-type instructions. These constraints hold regardless of anything else. | ||
The present section deals with generalities pertaining to \inst{CREATE}-type instructions. These constraints hold regardless of anything else. | ||
\begin{description} | ||
\item[\underline{Setting the stack pattern:}] | ||
we impose $\createSP_{i - \createFirstStackRowOffset}\big[ \locIsCreateTwo \big]$; | ||
|
@@ -47,7 +47,7 @@ | |
\[ | ||
\locStaticx = \locIsStatic | ||
\] | ||
\item[\underline{Setting the module flags of miscellaneous-row $n^°(i + \createMiscRowOffset)$::}] | ||
\item[\underline{Setting the module flags of miscellaneous-row $n^°(i + \createMiscRowOffset)$::}] | ||
every processing path for \inst{CREATE}-type instructions contains a single \textbf{miscellaneous-row} | ||
\[ | ||
\weightedMiscFlagSum | ||
|
@@ -129,12 +129,12 @@ | |
where we define the following shorthands: | ||
\[ | ||
\left\{ \begin{array}{lclc} | ||
\If \locTriggerRlpAddr = 0 ~ \Then | ||
\If \locTriggerRlpAddr = 0 ~ \Then | ||
\left\{ \begin{array}{lclc} | ||
\locCreateeNonce & = & 0 \\ | ||
\locCreateeHasCode & = & 0 \\ | ||
\end{array} \right. \\ | ||
\If \locTriggerRlpAddr = 1 ~ \Then | ||
\If \locTriggerRlpAddr = 1 ~ \Then | ||
\left\{ \begin{array}{lclc} | ||
\locCreateeNonce & = & \accNonce _{i + \createFirstCreateeAccountRowOffset} \\ | ||
\locCreateeHasCode & = & \accHasCode _{i + \createFirstCreateeAccountRowOffset} \\ | ||
|
@@ -199,23 +199,23 @@ | |
\] | ||
where we have used the following (as of yet undefined) shorthands \locTgtId{}, \locAuxId{} and \locExoSum{} which we define as follows: | ||
\begin{enumerate} | ||
\item \If $\locHashInitCode = 1$ \Then | ||
\item \If $\locHashInitCode = 1$ \Then | ||
\[ | ||
\left\{ \begin{array}{lcl} | ||
\locTgtId & \define & \nothing \\ | ||
\locAuxId & \define & 1 + \hubStamp_{i} \\ | ||
\locExoSum & \define & \exoWeightKec \\ | ||
\end{array} \right. | ||
\] | ||
\item \If $\locHashInitCodeAndSendToRom = 1$ \Then | ||
\item \If $\locHashInitCodeAndSendToRom = 1$ \Then | ||
\[ | ||
\left\{ \begin{array}{lcl} | ||
\locTgtId & \define & \locDepCfi \\ | ||
\locAuxId & \define & 1 + \hubStamp_{i} \\ | ||
\locExoSum & \define & \exoWeightRom + \exoWeightKec \\ | ||
\end{array} \right. | ||
\] | ||
\item \If $\locSendInitCodeToRom = 1$ \Then | ||
\item \If $\locSendInitCodeToRom = 1$ \Then | ||
\[ | ||
\left\{ \begin{array}{lcl} | ||
\locTgtId & \define & \locDepCfi \\ | ||
|
@@ -234,24 +234,41 @@ | |
\If \scenCreateExecutionNonEmptyInitCode _{i} = 1 & \Then & \nextContextIsNew _{i} \\ | ||
\end{array} \right. | ||
\] | ||
\end{description} | ||
Let us define the following shorthands: | ||
\[ | ||
\left\{ \begin{array}{lcl} | ||
\locCreateUpfrontGasCost & \define & G_\text{create} + \locMxpGas \\ | ||
\locCreateFullGasCost & \define & \locCreateUpfrontGasCost + \locStpGasPoop \\ | ||
\end{array} \right. | ||
\] | ||
\begin{description} | ||
\item[\underline{Setting the \gasCost{}:}] | ||
we impose | ||
\begin{enumerate} | ||
\item \If $\locStaticx + \locMxpx = 1$ \Then $\gasCost _{i} = 0$ | ||
\item \If $\locOogx + \scenCreateUnexceptional = 1$ \Then $\gasCost _{i} = G_\text{create} + \locMxpGas$ | ||
\item \If $\locOogx + \scenCreateUnexceptional = 1$ \Then $\gasCost _{i} = \locCreateUpfrontGasCost$ | ||
\end{enumerate} | ||
\item[\underline{Setting the \gasNext{}:}] | ||
we impose | ||
\begin{enumerate} | ||
\item \If $\scenCreateException _{i} = 1$ \Then $\gasNext_{i} = 0$ (\trash) | ||
\item \If $\scenCreateNoContextChange _{i} = 1$ \Then $\gasNext_{i} = \gasActual_{i} - \gasCost_{i}$ | ||
\item \If $\scenCreateExecutionNonEmptyInitCode _{i} = 1$ \Then | ||
\[ | ||
\gasNext_{i} = \gasActual_{i} - | ||
\left[ \begin{array}{cl} | ||
+ & \gasCost_{i} \\ | ||
+ & \locStpGasPoop \\ | ||
\end{array} \right] | ||
\] | ||
\end{enumerate} | ||
\[ | ||
\hspace*{-0.5cm} | ||
\left\{ \begin{array}{lcl} | ||
\If \scenCreateException _{i} = 1 & \Then & \gasNext _{i} = 0 ~ (\trash) \\ | ||
\If \scenCreateAbort _{i} = 1 & \Then & \gasNext _{i} = \gasActual _{i} - \locCreateUpfrontGasCost \\ | ||
\If \scenCreateFCond _{i} = 1 & \Then & \gasNext _{i} = \gasActual _{i} - \locCreateFullGasCost \\ | ||
\If \scenCreateExecutionEmptyInitCode _{i} = 1 & \Then & \gasNext _{i} = \gasActual _{i} - \locCreateUpfrontGasCost \\ | ||
\If \scenCreateExecutionNonEmptyInitCode _{i} = 1 & \Then & \gasNext _{i} = \gasActual _{i} - \locCreateFullGasCost \\ | ||
\end{array} \right. | ||
\] | ||
\saNote{} | ||
We provide some details. | ||
Exceptional \inst{CREATE}-type instructions, like any exceptional instruction, fully consume the currently available gas. | ||
Aborted \inst{CREATE}-type instructions only pay for the \locCreateUpfrontGasCost{} (and there is no child context.) | ||
\inst{CREATE}-type instructions that raise the \textbf{Failure Condition $\bm{F}$} pay the \locCreateFullGasCost{}, including the ``\texttt{(63/64)-ths}'' to the child context, and don't get any of it back. | ||
\inst{CREATE}-type instructions that lead to execution pay for \locCreateFullGasCost{}. | ||
However, if the provided initialization code is \emph{empty}, then the execution context doesn't change and gets the entire ``\texttt{(63/64)-ths}'' back immediately. | ||
The effective gas cost is therefore the \locCreateUpfrontGasCost{}. | ||
If the provided initialization code is \emph{nonempty} then the execution context pays the \locCreateFullGasCost{}. | ||
It \emph{may} get some of it back later down the line. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the fix. The issue was with Failure Condition F raising CREATE's not following the same pattern as other scenarios in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
\end{description} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line right here is the bug fix:
scenario/CREATE_FAILURE_CONDITION
had wrong gas comuptation