Skip to content

Commit b447b84

Browse files
committed
feat: add shared prc address range, an case of OOB flag in shared.tex, specify malformed data from ecdata
1 parent c4c3e41 commit b447b84

File tree

7 files changed

+17
-35
lines changed

7 files changed

+17
-35
lines changed

hub/columns/context.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
When an execution context resumes after a child context finishes executing it receives return data%
8080
\footnote{Said return data may be empty e.g. after a successful deployment, if the child context ended on a \inst{STOP} or a \inst{SELFDESTRUCT}, if the child context ended on a \inst{RETURN}/\inst{REVERT} with empty data, if the child context terminated on an exception, when returning from a \inst{CALL} to a precompile which triggered an internal error, \dots} That data lives in the child context's RAM (whose \cn{} will be stored \cnReturner{}) starting at some offset (stored in \cnRdo{}) and comprising a number of bytes (stored in \cnRds{}.) Contrary to the offset / size parameters introduced previously these parameters need not be context-constant. They are updated every time execution of the present context resumes after a message call or deployment.
8181

82-
\saNote{} The above will hold true for \inst{CALL}'s to precompiled contracts, too. \inst{CALL}'s to these contracts \emph{do not} produce tangible execution contexts in the present arithmetization i.e. the \hubMod{} module never enters an execution context with $\cnCodeAddress \in \{ 1, 2, \dots, 9 \}$. Yet \textsc{ram} may have to undergo modifications. Typically (and along the happy path)
82+
\saNote{} The above will hold true for \inst{CALL}'s to precompiled contracts, too. \inst{CALL}'s to these contracts \emph{do not} produce tangible execution contexts in the present arithmetization i.e. the \hubMod{} module never enters an execution context with $\cnCodeAddress \in $ \prcAddressRange. Yet \textsc{ram} may have to undergo modifications. Typically (and along the happy path)
8383
(\emph{a})
8484
extraction of a slice of bytes from the current execution context's \textsc{ram} to be stored in some dedicated \col{DATA} module (e.g.
8585
\ecDataMod{},

hub/columns/scenarios/call.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
\end{enumerate}
1212
The columns below pertain to unexceptional, unaborted \inst{CALL}-type instructions i.e. \inst{CALL}'s that are entered.
1313
For the sake of clarity we provide our working definition of \textbf{precompiles}, \textbf{externally owned accounts} and \textbf{smart contracts}.
14-
A \textbf{precompile} is an account whose address is in the range $\{\texttt{0x01},\texttt{0x02},\dots, \texttt{0x17} \cup \texttt{0x100}\}$.
14+
A \textbf{precompile} is an account whose address is in the range \prcAddressRange.
1515
A \textbf{smart contract} is any account with nonempty bytecode.
1616
An \textbf{externally owned account} is any account that is neither a \textbf{precompile} nor a \textbf{smart contract}.
1717
This includes accounts that were created through deployments but whose bytecode is empty.

hub/columns/shared.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
(\emph{a}) \inst{CALLDATALOAD} where the comparison is done against the call data size;
7979
(\emph{b}) \inst{RETURNDATALOAD} where the comparison is done against the return data size;
8080
(\emph{c}) \inst{JUMP} and \inst{JUMPI} where the comparison is done against the code size;
81+
(\emph(d)) \inst{CALL} when it is targeting a precompile, the comparison is done against the call data size;
8182
\ob{TODO: make sure list is exhaustive}
8283
\begin{enumerate}[resume]
8384
\item $\cn{}$ and $\cn{}\new$:

hub/instruction_handling/call/precompiles/_local.tex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,13 @@
320320
\def\prcModexpSuccessPartialCopyOfResultsRowOffset {\roffConstYellow{11}}
321321
\def\prcModexpSuccessUpdatingCallerReturnData {\roffConstYellow{12}}
322322

323-
\def\locImposedCallDataSizeForBlsPrecompiles {\loc{imposed\_cds}}
323+
\def\locImposedCallDataSizeForBlsPrecompiles {\loc{imposed\_bls\_cds}}
324+
\def\locImposedCallDataSizeForEcPrecompiles {\loc{imposed\_ec\_cds}}
324325
\def\locCallDataSizeModulusForBlsPrecompiles {\loc{cds\_modulus}}
325326

326327
\def\locBlsPrecompileFailureReasonGas {({\color{draculaorange}\texttt{gas}})}
327328
\def\locBlsPrecompileFailureReasonEmpty {({\color{draculaorange}\texttt{empty}})}
328329
\def\locBlsPrecompileFailureReasonSize {({\color{draculaorange}\texttt{size}})}
329330
\def\locBlsPrecompileFailureReasonMod {({\color{draculaorange}\texttt{mod}})}
330-
\def\locBlsPrecompileFailureReasonData {({\color{draculared}\texttt{data}})}
331+
\def\locBlsPrecompileFailureReasonData {({\color{draculared}\texttt{blsdata}})}
332+
\def\locEcPrecompileFailureReasonData {({\color{draculared}\texttt{ecdata}})}

hub/instruction_handling/call/precompiles/classification.tex

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@
130130
\item
131131
\locBlsPrecompileFailureReasonData{}
132132
malformed call data;
133+
\locEcPrecompileFailureReasonData{}
134+
malformed call data;
133135
\end{itemize}
134136
\end{description}
135137
Conditions
@@ -141,13 +143,15 @@
141143
the \oobMod{} module carries out these preliminary checks and \scenPrcFailureKnownToHub{} records the outcome.
142144
Condition
143145
\locBlsPrecompileFailureReasonData,
146+
\locEcPrecompileFailureReasonData,
144147
on the other hand,
145148
requires retrieving the call data from \textsc{ram};
146-
the data is analyzed in a precompile specific manner in the \blsDataMod{} module,
149+
the data is analyzed in a precompile specific manner in the \blsDataMod{} and \ecDataMod{} modules respectively,
147150
with some ``data malformation'' detection steps delegated to outside circuits;
148151
the failure of this condition is recorded in \scenPrcFailureKnownToRam{}.
149152

150-
The next precompile was introduced in the \textsc{Cancun} hardfork, specifically with \cite{EIP-4788};
153+
154+
\noindent The next precompile was introduced in the \textsc{Cancun} hardfork, specifically with \cite{EIP-4788};
151155
\begin{description}
152156
\item[\instPointEvaluation:]
153157
can fail due to:
@@ -201,6 +205,6 @@
201205
\item[\instPVerify{}:]
202206
can fail due to:
203207
\locBlsPrecompileFailureReasonGas,
204-
\locBlsPrecompileFailureReasonSize, with $\locImposedCallDataSizeForBlsPrecompiles \equiv 160$,
205-
\locBlsPrecompileFailureReasonData;
208+
\locBlsPrecompileFailureReasonSize, with $\locImposedCallDataSizeForEcPrecompiles \equiv 160$,
209+
\locEcPrecompileFailureReasonData;
206210
\end{description}

pkg/oob.sty

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -120,33 +120,6 @@
120120
\newcommand{\oobInstBlsMapFpTwoToGTwo } {\oobInst{\prcNameBlsMapFpTwoToGTwo} }
121121
\newcommand{\oobInstPVerify } {\oobInst{\prcNamePVerify} }
122122

123-
\newcommand{\oobInstEcrecover } {\oobInst{ECRECOVER} }
124-
\newcommand{\oobInstShaTwo } {\oobInst{SHA2} }
125-
\newcommand{\oobInstRipemd } {\oobInst{RIPEMD} }
126-
\newcommand{\oobInstIdentity } {\oobInst{IDENTITY} }
127-
\newcommand{\oobInstEcadd } {\oobInst{ECADD} }
128-
\newcommand{\oobInstEcmul } {\oobInst{ECMUL} }
129-
\newcommand{\oobInstEcpairing } {\oobInst{ECPAIRING} }
130-
131-
\newcommand{\oobInstBlakeCds } {\oobInst{BLAKE\_CDS} }
132-
\newcommand{\oobInstBlakeParams } {\oobInst{BLAKE\_PARAMS} }
133-
134-
\newcommand{\oobInstModexpCds } {\oobInst{MODEXP\_CDS} }
135-
\newcommand{\oobInstModexpXbs } {\oobInst{MODEXP\_XBS} }
136-
\newcommand{\oobInstModexpLead } {\oobInst{MODEXP\_LEAD} }
137-
\newcommand{\oobInstModexpPricing } {\oobInst{MODEXP\_PRICING} }
138-
\newcommand{\oobInstModexpExtract } {\oobInst{MODEXP\_EXTRACT} }
139-
140-
\newcommand{\oobInstPointEvaluation } {\oobInst{POINT\_EVALUATION} }
141-
\newcommand{\oobInstBlsGOneAdd } {\oobInst{BLS\_G1ADD} }
142-
\newcommand{\oobInstBlsGOneMsm } {\oobInst{BLS\_G1MSM} }
143-
\newcommand{\oobInstBlsGTwoAdd } {\oobInst{BLS\_G2ADD} }
144-
\newcommand{\oobInstBlsGTwoMsm } {\oobInst{BLS\_G2MSM} }
145-
\newcommand{\oobInstBlsPairingCheck } {\oobInst{BLS\_PAIRING\_CHECK} }
146-
\newcommand{\oobInstBlsMapFpToGOne } {\oobInst{BLS\_MAP\_FP\_TO\_G1} }
147-
\newcommand{\oobInstBlsMapFpTwoToGTwo } {\oobInst{BLS\_MAP\_FP2\_TO\_G2}}
148-
\newcommand{\oobInstPVerify } {\oobInst{P256VERIFY} }
149-
150123
%
151124
\newcommand{\oxConst } [1] {\red{\texttt{0x\,#1}}}
152125
\newcommand{\oxXcall } {\oxConst{XCALL}}

pkg/prc.sty

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
\newcommand{\blakeRowsMO} {\redm{29}}
2626
\newcommand{\blakeRows} {\redm{30}}
2727

28+
\newcommand{\prcAddressRange} {$\{\texttt{0x01},\texttt{0x02},\dots, \texttt{0x11}\} \cup \{\texttt{0x100}\}$}
29+
2830

2931
% \newcommand{\flagSumShakira} {\col{flag\_sum}}
3032
% \newcommand{} {\col{}}

0 commit comments

Comments
 (0)