-
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
Conversation
- exceptional CREATE's consume all gas - aborted CREATE's consume only the upfront gas cost - CREATE's that raise the Failure Condition F consume the upfront gas cost + the 63/64ths given to the child context which they don't get back - CREATE's with empty init code get those 63/64ths back immediately so from the zkevm POV don't pay for it at all - CREATE's with nonempty init code consume the upfront ga cost + the 63/64th's which they provide to the child context (and may et back in part)
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 comment
The 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 \scenCreateNoContextChange
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.
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.
\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 \\ |
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
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.
LGTM
Co-authored-by: Olivier Bégassat <[email protected]>
Was merged locally. |
CREATE
's consume all gasCREATE
's consume only the upfront gas costCREATE
's that raise the Failure Condition F consume the upfront gas cost + the63/64ths
given to the child context which they don't get backCREATE
's with empty init code get those63/64ths
back immediately so from the zkevm POV don't pay for it at allCREATE
's with nonempty init code consume theupfront_gas_cost + 63/64ths
which they provide to the child context (and may et back in part)