Skip to content

OOB: add constraint to disallow the BLS precompiles from EIP-2537: Precompile for BLS12-381 curve operations use in Cancun #179

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions oob/_local.tex
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@
\def\locPrcFlagSumBlake {\locPrcFlagSum\loc{\_blake}}
\def\locPrcFlagSumModexp {\locPrcFlagSum\loc{\_modexp}}
\def\locPrcFlagSumBls {\locPrcFlagSum\loc{\_bls}}
\def\locFlagSumEipBlobTransactions {\loc{flag\_sum\_eip\_blob\_transactions}}
\def\locFlagSumEipBlsTwelvePrecompiles {\loc{flag\_sum\_eip\_bls12\_precompiles}}

% common precompile shorthands
% \def\locCalleeGas {\loc{callee\_gas}}
Expand Down
48 changes: 39 additions & 9 deletions oob/shorthands.tex
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
+ & \oobInstIsEcadd _{i} \\
+ & \oobInstIsEcmul _{i} \\
+ & \oobInstIsEcpairing _{i} \\
+ & \oobInstIsPointEvaluation_{i}\\
+ & \locPrcFlagSumBls _{i} \\
\end{array} \right] \vspace{2mm} \\
\locPrcFlagSumBlake_{i} & \define &
Expand All @@ -39,7 +38,11 @@
+ & \oobInstIsModexpPricing _{i} \\
+ & \oobInstIsModexpExtract _{i} \\
\end{array} \right] \vspace{2mm} \\
\locPrcFlagSumBls_{i} & \define &
\locFlagSumEipBlobTransactions_{i} & \define &
\left[ \begin{array}{cl}
+ & \oobInstIsPointEvaluation_{i} \\
\end{array} \right] \vspace{2mm} \\
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you can remove the array (as we aren't summing anything, it's just one term.)

\locFlagSumEipBlsTwelvePrecompiles_{i} & \define &
\left[ \begin{array}{cl}
+ & \oobInstIsBlsGOneAdd _{i} \\
+ & \oobInstIsBlsGOneMsm _{i} \\
Expand All @@ -48,9 +51,18 @@
+ & \oobInstIsBlsPairingCheck _{i} \\
+ & \oobInstIsBlsMapFpToGOne _{i} \\
+ & \oobInstIsBlsMapFpTwoToGTwo_{i} \\
\end{array} \right]
\end{array} \right] \vspace{2mm} \\
\locPrcFlagSumBls_ {i} & \define &
\left[ \begin{array}{cl}
+ & \locFlagSumEipBlobTransactions_ {i} \\
+ & \locFlagSumEipBlsTwelvePrecompiles_ {i} \\
\end{array} \right] \vspace{2mm} \\
\end{array} \right.
\]
\saNote{}
If the Ethereum network configuration is at the Cancun hard fork, one may further impose $\locFlagSumEipBlsTwelvePrecompiles_{i} = 0$,
thereby not allowing \blsMod{} precompiles to be executed.

we also set
\[
\left\{ \begin{array}{lcl}
Expand All @@ -69,6 +81,7 @@
\]
and
\[
\hspace*{-1cm}
\left\{ \begin{array}{lcl}
\weightedFlagSumInst_{i} & \define &
\left[ \begin{array}{clcl}
Expand All @@ -92,7 +105,6 @@
+ & \oobInstEcadd & \cdot & \oobInstIsEcadd _{i} \\
+ & \oobInstEcmul & \cdot & \oobInstIsEcmul _{i} \\
+ & \oobInstEcpairing & \cdot & \oobInstIsEcpairing _{i} \\
+ & \oobInstPointEvaluation & \cdot & \oobInstIsPointEvaluation _{i} \\
+ & \weightedPrcFlagSumBls_{i} \\
\end{array} \right] \vspace{2mm} \\
\weightedPrcFlagSumBlake_{i} & \define &
Expand All @@ -108,7 +120,11 @@
+ & \oobInstModexpPricing & \cdot & \oobInstIsModexpPricing _{i} \\
+ & \oobInstModexpExtract & \cdot & \oobInstIsModexpExtract _{i} \\
\end{array} \right] \vspace{2mm} \\
\weightedPrcFlagSumBls_{i} & \define &
\weightedPrcEipBlobTransactions_{i} & \define &
\left[ \begin{array}{crcl}
+ & \oobInstPointEvaluation & \cdot & \oobInstIsPointEvaluation _{i} \\
\end{array} \right] \vspace{2mm} \\
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly here, no need for an array as it's a single term.

\weightedPrcEipBlsTwelvePrecompiles_{i} & \define &
\left[ \begin{array}{crcl}
+ & \oobInstBlsGOneAdd & \cdot & \oobInstIsBlsGOneAdd _{i} \\
+ & \oobInstBlsGOneMsm & \cdot & \oobInstIsBlsGOneMsm _{i} \\
Expand All @@ -117,6 +133,11 @@
+ & \oobInstBlsPairingCheck & \cdot & \oobInstIsBlsPairingCheck _{i} \\
+ & \oobInstBlsMapFpToGOne & \cdot & \oobInstIsBlsMapFpToGOne _{i} \\
+ & \oobInstBlsMapFpTwoToGTwo & \cdot & \oobInstIsBlsMapFpTwoToGTwo _{i} \\
\end{array} \right] \vspace{2mm} \\
\weightedPrcFlagSumBls_{i} & \define &
\left[ \begin{array}{cl}
+ & \weightedPrcEipBlobTransactions_ {i} \\
+ & \weightedPrcEipBlsTwelvePrecompiles_ {i} \\
\end{array} \right]
\end{array} \right.
\]
Expand Down Expand Up @@ -159,7 +180,6 @@
\oobInstEcadd & \define & \oxEcadd \\
\oobInstEcmul & \define & \oxEcmul \\
\oobInstEcpairing & \define & \oxEcpairing \\
\oobInstPointEvaluation & \define & \oxPointEvaluation \\
\oobInstBlakeCds & \define & \oxBlakeCds \\
\oobInstBlakeParams & \define & \oxBlakeParams \\
\end{array} \right.
Expand All @@ -177,6 +197,7 @@
and
\[
\left\{ \begin{array}{lclcr}
\oobInstPointEvaluation & \define & \oxPointEvaluation \\
\oobInstBlsGOneAdd & \define & \oxBlsGOneAdd \\
\oobInstBlsGOneMsm & \define & \oxBlsGOneMsm \\
\oobInstBlsGTwoAdd & \define & \oxBlsGTwoAdd \\
Expand All @@ -192,6 +213,7 @@

We further set
\[
\hspace*{-1cm}
\left\{ \begin{array}{lcl}
\maxCtFlagSumInst_{i} & \define &
\left[ \begin{array}{clcl}
Expand All @@ -215,7 +237,6 @@
+ & \oobCtMaxEcadd & \cdot & \oobInstIsEcadd _{i} \\
+ & \oobCtMaxEcmul & \cdot & \oobInstIsEcmul _{i} \\
+ & \oobCtMaxEcpairing & \cdot & \oobInstIsEcpairing _{i} \\
+ & \oobCtMaxPointEvaluation & \cdot & \oobInstIsPointEvaluation _{i} \\
+ & \maxCtFlagSumPrcBls_{i} \\
\end{array} \right] \vspace{2mm} \\
\maxCtFlagSumPrcBlake_{i} & \define &
Expand All @@ -231,7 +252,11 @@
+ & \oobCtMaxModexpPricing & \cdot & \oobInstIsModexpPricing _{i} \\
+ & \oobCtMaxModexpExtract & \cdot & \oobInstIsModexpExtract _{i} \\
\end{array} \right] \vspace{2mm} \\
\maxCtFlagSumPrcBls_{i} & \define &
\maxCtFlagSumPrcEipBlobTransactions_{i} & \define &
\left[ \begin{array}{crcl}
+ & \oobCtMaxPointEvaluation & \cdot & \oobInstIsPointEvaluation _{i} \\
\end{array} \right] \vspace{2mm} \\
\maxCtFlagSumPrcEipBlsTwelvePrecompiles_{i} & \define &
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same array comment

\left[ \begin{array}{crcl}
+ & \oobCtMaxBlsGOneAdd & \cdot & \oobInstIsBlsGOneAdd _{i} \\
+ & \oobCtMaxBlsGOneMsm & \cdot & \oobInstIsBlsGOneMsm _{i} \\
Expand All @@ -240,6 +265,11 @@
+ & \oobCtMaxBlsPairingCheck & \cdot & \oobInstIsBlsPairingCheck _{i} \\
+ & \oobCtMaxBlsMapFpToGOne & \cdot & \oobInstIsBlsMapFpToGOne _{i} \\
+ & \oobCtMaxBlsMapFpTwoToGTwo & \cdot & \oobInstIsBlsMapFpTwoToGTwo _{i} \\
\end{array} \right] \vspace{2mm} \\
\maxCtFlagSumPrcBls_{i} & \define &
\left[ \begin{array}{cl}
+ & \maxCtFlagSumPrcEipBlobTransactions_ {i} \\
+ & \maxCtFlagSumPrcEipBlsTwelvePrecompiles_ {i} \\
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be

\macroName _{i}

\end{array} \right]
\end{array} \right.
\]
Expand Down Expand Up @@ -283,7 +313,6 @@
\oobCtMaxEcadd & \define & 2 \\
\oobCtMaxEcmul & \define & 2 \\
\oobCtMaxEcpairing & \define & 4 \\
\oobCtMaxPointEvaluation & \define & 3 \\
\end{array} \right. \\
\left\{ \begin{array}{lcl}
\oobCtMaxBlakeCds & \define & 1 \\
Expand All @@ -298,6 +327,7 @@
\oobCtMaxModexpExtract & \define & 3 \\
\end{array} \right. \\
\left\{ \begin{array}{lcl}
\oobCtMaxPointEvaluation & \define & 3 \\
\oobCtMaxBlsGOneAdd & \define & 3 \\
\oobCtMaxBlsGOneMsm & \define & 6 \\
\oobCtMaxBlsGTwoAdd & \define & 3 \\
Expand Down
1 change: 1 addition & 0 deletions oob/specialized.tex
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
We define a series of simple parametrized constraint systems for instructions that are sent to the \addMod{} module, the \modMod{} module and the \wcpMod{} module.
Let $\relof$ be a small nonnegative integer.
\[
\hspace*{-0.5cm}
\left\{ \begin{array}{lcl}
\oobCallToAdd
{i}{\relof}
Expand Down
49 changes: 28 additions & 21 deletions pkg/precompiles.sty
Original file line number Diff line number Diff line change
Expand Up @@ -299,27 +299,34 @@
\newcommand{\modArgTwoLo} {\col{MOD\_ARG2\_LO}}
\newcommand{\modRes} {\col{MOD\_RES}}

\newcommand{\GQuadDivisor} {G_{\text{quaddivisor}}}
\newcommand{\GQuadDivisorValue} {3}
\newcommand{\cycleModexp} {\redm{15}}
\newcommand{\cycleNotModexp} {\redm{3}}
\newcommand{\weightedPhaseFlagSum} {\loc{phase\_sum}}
\newcommand{\indexMaxFlagSum} {\loc{index\_max\_sum}}
\newcommand{\flagSum} {\loc{flag\_sum}}
\newcommand{\weightedFlagSum} {\loc{wght\_sum}}
\newcommand{\weightedFlagSumInst} {\weightedFlagSum\loc{\_inst}}
\newcommand{\weightedPrcFlagSum} {\weightedFlagSum\loc{\_prc}}
\newcommand{\weightedPrcFlagSumCommon} {\weightedPrcFlagSum\loc{\_common}}
\newcommand{\weightedPrcFlagSumBlake} {\weightedPrcFlagSum\loc{\_blake}}
\newcommand{\weightedPrcFlagSumModexp} {\weightedPrcFlagSum\loc{\_modexp}}
\newcommand{\weightedPrcFlagSumBls} {\weightedPrcFlagSum\loc{\_bls}}
\newcommand{\maxCtFlagSum} {\loc{ct\_max\_sum}}
\newcommand{\maxCtFlagSumInst} {\maxCtFlagSum\loc{\_inst}}
\newcommand{\maxCtFlagSumPrc} {\maxCtFlagSum\loc{\_prc}}
\newcommand{\maxCtFlagSumPrcCommon} {\maxCtFlagSumPrc\loc{\_common}}
\newcommand{\maxCtFlagSumPrcBlake} {\maxCtFlagSumPrc\loc{\_blake}}
\newcommand{\maxCtFlagSumPrcModexp} {\maxCtFlagSumPrc\loc{\_modexp}}
\newcommand{\maxCtFlagSumPrcBls} {\maxCtFlagSumPrc\loc{\_bls}}
\newcommand{\GQuadDivisor} {G_{\text{quaddivisor}}}
\newcommand{\GQuadDivisorValue} {3}
\newcommand{\cycleModexp} {\redm{15}}
\newcommand{\cycleNotModexp} {\redm{3}}
\newcommand{\weightedPhaseFlagSum} {\loc{phase\_sum}}
\newcommand{\indexMaxFlagSum} {\loc{index\_max\_sum}}
\newcommand{\flagSum} {\loc{flag\_sum}}
\newcommand{\weightedFlagSum} {\loc{wght\_sum}}
\newcommand{\weightedFlagSumInst} {\weightedFlagSum\loc{\_inst}}
\newcommand{\weightedPrcFlagSum} {\weightedFlagSum\loc{\_prc}}
\newcommand{\weightedPrcFlagSumCommon} {\weightedPrcFlagSum\loc{\_common}}
\newcommand{\weightedPrcFlagSumBlake} {\weightedPrcFlagSum\loc{\_blake}}
\newcommand{\weightedPrcFlagSumModexp} {\weightedPrcFlagSum\loc{\_modexp}}
\newcommand{\weightedPrcFlagSumBls} {\weightedPrcFlagSum\loc{\_bls}}

\newcommand{\weightedPrcEipBlobTransactions} {\weightedPrcFlagSum\loc{\_eip\_blob\_transactions}}
\newcommand{\weightedPrcEipBlsTwelvePrecompiles} {\weightedPrcFlagSum\loc{\_eip\_bls12\_precompiles}}

\newcommand{\maxCtFlagSum} {\loc{ct\_max\_sum}}
\newcommand{\maxCtFlagSumInst} {\maxCtFlagSum\loc{\_inst}}
\newcommand{\maxCtFlagSumPrc} {\maxCtFlagSum\loc{\_prc}}
\newcommand{\maxCtFlagSumPrcCommon} {\maxCtFlagSumPrc\loc{\_common}}
\newcommand{\maxCtFlagSumPrcBlake} {\maxCtFlagSumPrc\loc{\_blake}}
\newcommand{\maxCtFlagSumPrcModexp} {\maxCtFlagSumPrc\loc{\_modexp}}
\newcommand{\maxCtFlagSumPrcBls} {\maxCtFlagSumPrc\loc{\_bls}}

\newcommand{\maxCtFlagSumPrcEipBlobTransactions} {\maxCtFlagSumPrc\loc{\_eip\_blob\_transactions}}
\newcommand{\maxCtFlagSumPrcEipBlsTwelvePrecompiles} {\maxCtFlagSumPrc\loc{\_eip\_bls12\_precompiles}}

\newcommand{\hubMmuMmioEcDataPrediction} {\colorbox{solarized-orange}{\textbf{~~$\hubMod \rightarrow \mmuMod \rightarrow \mmioMod \rightarrow \ecDataMod$ prediction~~}}}
\newcommand{\hubMmuMmioBlsPrediction} {\colorbox{solarized-orange}{\textbf{~~$\hubMod \rightarrow \mmuMod \rightarrow \mmioMod \rightarrow \blsMod$ prediction~~}}}
Expand Down