-
Notifications
You must be signed in to change notification settings - Fork 18
EIP 3860: Limit and meter initcode #144
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
base: main
Are you sure you want to change the base?
Conversation
|
For deployments: - enforce init_code_size ≤ 49152 - compute R(||init_code||) - update upfrontGasCost accordingly
OOB_INST_XCREATE no longer produces "HUB predictions".
This instruction now implicitly and silently verifies that init_code_size ≤ 49152
- new CREATE(2) maxcsx diagram - include stack/MAXCSX into case analysis - include stack/MAXCSX case in high level diagram
\Then $\stackIcpx _{i} = 0$ | ||
\item | ||
\If $\stackInst _{i} \neq \inst{RETURN}$ \et $\stackCreateFlag _{i} = 0$ | ||
\Then $\stackMaxcsx _{i} = 0$ |
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.
Previously only RETURN could trigger invalidCodePrefixException
and maxCodeSizeException
. Now CREATE(2)
can trigger maxCodeSizeException
, too. So split analysis.
@@ -38,6 +39,8 @@ | |||
\def\locMxpMtntop {\col{\mxpMod\_mtntop}} | |||
% | |||
\def\locTriggerOob {\col{trigger\_\oobMod}} | |||
\def\locTriggerOobX {\col{trigger\_\oobMod\_X}} | |||
\def\locTriggerOobU {\col{trigger\_\oobMod\_U}} |
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.
Two different OOB module triggers to keep things clean.
U stands for unexeptional
X stands for exceptional
\item \oobDataCol{k}, for $k = 1, 2, \dots, 9$: \godGiven{} | ||
\item | ||
\godGiven{} | ||
\oobDataCol{k}, for $k = 1, 2, \dots, 10$: |
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.
10th OOB data column
\subsection{For $\oobInstDeployment$} \label{oob: populating: opcodes: deployment} \input{opcodes/deployment} | ||
\subsection{For $\oobInstXcall$} \label{oob: populating: opcodes: exceptional calls} \input{opcodes/xcall} | ||
\subsection{For $\oobInstCall$} \label{oob: populating: opcodes: call} \input{opcodes/call} | ||
\subsection{For $\oobInstXcreate$} \label{oob: populating: opcodes: xcreate} \input{opcodes/xcreate} |
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.
New OOB instruction + formatting
+ & \peekingSumStandardPrefix \\ | ||
+ & \peekContext _{i + \createExceptionCallerContextRowOffset} \\ | ||
\end{array} \right] | ||
\] |
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.
We don't break the mould for exceptional CREATE
's. It is inefficient (one does not need the current context row) but it simplifies everything not to differentiate.
@@ -6,6 +6,7 @@ | |||
\locIsCreate & \define & \decFlag{1} _{i - \createFirstStackRowOffset} \\ | |||
\locIsCreateTwo & \define & \decFlag{2} _{i - \createFirstStackRowOffset} \\ | |||
\locStaticx & \define & \stackStaticx _{i - \createFirstStackRowOffset} \\ | |||
\locMaxcsx & \define & \stackMaxcsx _{i - \createFirstStackRowOffset} \\ |
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.
new shorthand
\item \locTriggerMmu{} | ||
\item \locTriggerOob{} | ||
\item \locTriggerOobX{} | ||
\item \locTriggerOobU{} |
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.
trigger_OOB
now split in two (trigger_OOB_X
and trigger_OOB_U
) as explained earlier:
- e
X
cecptional U
nexceptional
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.
Important: definition of the two OOB module triggers.
hub/misc/oob/opcodes/xcreate.tex
Outdated
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.
New HUB -> OOB
interface for OOB_INST_XCREATE
instruction.
@@ -22,11 +22,12 @@ | |||
\locAbortingCondition & \define & \oobDataCol {7} _{i} & \prediction \\ | |||
\locFailureCondition & \define & \oobDataCol {8} _{i} & \prediction \\ | |||
\locCreatorNonce & \define & \oobDataCol {9} _{i} \\ | |||
\locInitCodeSize & \define & \oobDataCol {10} _{i} \\ |
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.
New 10th parameter of OOB_INST_CREATE
instruction
oob/opcodes/deployment.tex
Outdated
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.
RAS: new macros
oob/opcodes/xcall.tex
Outdated
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.
ras: typo
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.
Inclusion of XCREATE
flag into shorthands.
@@ -215,10 +219,11 @@ | |||
\oobCtMaxCdl & \define & 0 \\ | |||
\oobCtMaxXcall & \define & 0 \\ | |||
\oobCtMaxCall & \define & 2 \\ | |||
\oobCtMaxCreate & \define & 3 \\ | |||
\oobCtMaxXcreate & \define & 0 \\ | |||
\oobCtMaxCreate & \define & 4 \\ |
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.
1 more row due to new comparison for OOB_INST_CREATE
\newcommand{\maxCtTypeTwo} {\redm{8}} | ||
\newcommand{\maxCtTypeZero} {\redm{9}} | ||
\newcommand{\maxCtTypeOne} {\redm{10}} | ||
\newcommand{\maxCtTypeTwo} {\redm{10}} |
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.
Didn't carefully count, may have to figure out during implementation.
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.
shoukd be ok, you added only two calls so ...
% | ||
\input{computations/init_code_does_not_exceed_max_size} | ||
\input{computations/init_code_pricing} | ||
% |
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.
New Pricing rows
+ \!\!\! & \locIsDep & \!\!\! \cdot \!\!\! & G_{\text{txcreate}} \\ | ||
+ \!\!\! & \locIsDep & \!\!\! \cdot \!\!\! & \locInitCodeCost \\ | ||
+ \!\!\! & & & G_{\text{transaction}} \\ |
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.
Extra pricing cost
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.
Valid (deployment) transactions must enforce init_code_size ≤ 49152
.
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.
Transactions pay an extra
oob/opcodes/xcreate.tex
Outdated
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.
New OOB_INST_XCREATE
instruction. Enforces that init_code_size (which at this point may still be huge, whence the hi/lo parts) be > 49152 bytes long
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
\newcommand{\maxCtTypeTwo} {\redm{8}} | ||
\newcommand{\maxCtTypeZero} {\redm{9}} | ||
\newcommand{\maxCtTypeOne} {\redm{10}} | ||
\newcommand{\maxCtTypeTwo} {\redm{10}} |
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.
shoukd be ok, you added only two calls so ...
Implementation of #59.