-
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
BLOCKDATA redesign #19
Open
OlivierBBB
wants to merge
16
commits into
main
Choose a base branch
from
18-blockdata-redesign
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
4dd8f61
ras: copy of old BLOCK_DATA
OlivierBBB 0deb2dc
fix: first notes on BLOCKDATA redesign
OlivierBBB 707ba73
wip
OlivierBBB 1b50cc2
feat: graphical representation
OlivierBBB 9ea6a85
more progress
OlivierBBB 4ae8767
more progress
OlivierBBB 0f209af
ras
OlivierBBB fe504ca
ras
OlivierBBB 3a8fd53
fix: HUB -> BLOCKDATA lookup
OlivierBBB 01b5db1
fix: TXN_DATA -> BLOCKDATA lookup
OlivierBBB e94d96c
fix: make it compile
OlivierBBB 0078ab1
fix: add missing \isBasefee column to list of binary columns
OlivierBBB cc7fde3
Merge branch 'main' into 18-blockdata-redesign
OlivierBBB 18cd1e4
fix: BLOCKDATA no longer provides data from last block of previous co…
OlivierBBB 3422553
fix: more shorthands for more explicit constraints
OlivierBBB 40388b7
fix: more stuff
OlivierBBB File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
\input{_local} | ||
|
||
\section{Block data module} | ||
\subsection{Introduction} \label{block data: intro} \input{intro} | ||
\subsection{Columns} \label{block data: columns} \input{columns} | ||
\subsection{Introduction} \label{block data: intro} \input{intro} | ||
\subsection{Columns} \label{block data: columns} \input{columns} | ||
\subsection{Module call macros} \label{block data: module calls} \input{calls} | ||
|
||
\section{Constraints} | ||
\subsection{Heartbeat} \label{block data: heartbeat} \input{heartbeat} | ||
\subsection{Constancies} \label{block data: constancies} \input{constancies} | ||
\subsection{Bytehood and byte decomposition constraints} \label{block data: byte decomposition} \input{byteDec} | ||
\subsection{Value Constraints} \label{block data: value constraints} \input{value_constraint} | ||
\subsection{Shorthands} \label{block data: shorthands} \input{shorthands} | ||
\subsection{Binary constraints} \label{block data: binarities} \input{binarities} | ||
\subsection{Unconditional constraints} \label{block data: unconditional} \input{unconditional} | ||
\subsection{Constancies} \label{block data: constancies} \input{constancies} | ||
\subsection{Heartbeat} \label{block data: heartbeat} \input{heartbeat} | ||
\subsection{Representation} \label{block data: representation} \input{representation} | ||
|
||
\section{Lookups} \label{block data: lookups} \input{lookups/_inputs} | ||
\section{Computations and checks} \label{block data: computations and checks} \input{computations/_inputs} | ||
|
||
\section{Lookups} \label{block data: lookups} \input{lookups/_inputs} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
\def\rOne {\redm{1}} | ||
|
||
\def\locIsCoinbase {\col{is\_CB}} | ||
\def\locIsTimestamp {\col{is\_TS}} | ||
\def\locIsNumber {\col{is\_NB}} | ||
\def\locIsDifficulty {\col{is\_DF}} | ||
\def\locIsGaslimit {\col{is\_GL}} | ||
\def\locIsChainid {\col{is\_ID}} | ||
\def\locIsBasefee {\col{is\_BF}} | ||
|
||
\def\locIsCurrConf {\col{is\_curr}} | ||
\def\locIsPrevConf {\col{is\_prev}} | ||
\def\locPrevCurrWghtSum {\col{curr\_prev\_wght\_sum}} | ||
|
||
\def\locFlagSum {\col{flag\_sum}} | ||
\def\locWghtSum {\col{wght\_sum}} | ||
\def\locInstSum {\col{inst\_sum}} | ||
\def\locMaxCtSum {\col{ct\_max\_sum}} | ||
\def\locPhaseEntry {\col{phase\_entry}} | ||
\def\locSamePhase {\col{same\_phase}} | ||
\def\locLegalTransitions {\col{allowable\_transitions}} | ||
\def\locExtractor {\col{extractor}} | ||
|
||
\def\ctMaxCoinbase {\redm{\texttt{nRows}_{\texttt{cb}}}} | ||
\def\ctMaxTimestamp {\redm{\texttt{nRows}_{\texttt{ts}}}} | ||
\def\ctMaxNumber {\redm{\texttt{nRows}_{\texttt{nb}}}} | ||
\def\ctMaxDifficulty {\redm{\texttt{nRows}_{\texttt{df}}}} | ||
\def\ctMaxGaslimit {\redm{\texttt{nRows}_{\texttt{gl}}}} | ||
\def\ctMaxChainid {\redm{\texttt{nRows}_{\texttt{id}}}} | ||
\def\ctMaxBasefee {\redm{\texttt{nRows}_{\texttt{bf}}}} | ||
\def\kappaDots {\redm{\texttt{nRows}_{\texttt{xx}}}} | ||
\def\blockDataDepth {\redm{\texttt{depth}}} | ||
|
||
\def\exoInstruction {\col{EXO\_}\instruction} | ||
\def\previousGasLimit {\col{prev\_gas\_limit}} | ||
\def\maxDeviation {\col{max\_deviation}} | ||
|
||
\def\locFirstBlockIsGenesisBlock {\col{first\_block\_is\_genesis\_block}} | ||
\def\ethereumMinBlockGasLimit {\red{\texttt{ETHEREUM\_MIN\_BLOCK\_GAS\_LIMIT}}} | ||
\def\lineaMinBlockGasLimit {\red{\texttt{LINEA\_MIN\_BLOCK\_GAS\_LIMIT}}} | ||
\def\lineaMaxBlockGasLimit {\red{\texttt{LINEA\_MAX\_BLOCK\_GAS\_LIMIT}}} | ||
\def\ethereumMinBlockGasLimitValue {\texttt{5\_000}} | ||
\def\lineaMinBlockGasLimitValue {\texttt{61\_000\_000}} | ||
\def\lineaMaxBlockGasLimitValue {\texttt{2\_000\_000\_000}} | ||
\def\ethereumGasLimitAdjustmentFactor {\red{\texttt{GAS\_LIMIT\_ADJUSTMENT\_FACTOR}}} | ||
\def\ethereumGasLimitAdjustmentFactorValue {\texttt{1024}} | ||
|
||
\def\locIsFirstBlock {\col{is\_first\_block}} | ||
\def\locIsntFirstBlock {\col{isnt\_first\_block}} | ||
\def\currDataHi {\col{curr\_data\_hi}} | ||
\def\currDataLo {\col{curr\_data\_lo}} | ||
\def\prevDataHi {\col{prev\_data\_hi}} | ||
\def\prevDataLo {\col{prev\_data\_lo}} | ||
|
||
\def\currBaseFeeHi {\col{curr\_BASEFEE\_hi}} | ||
\def\currBaseFeeLo {\col{curr\_BASEFEE\_lo}} | ||
\def\prevBaseFeeHi {\col{prev\_BASEFEE\_hi}} | ||
\def\prevBaseFeeLo {\col{prev\_BASEFEE\_lo}} | ||
|
||
\def\currChainIdHi {\col{curr\_CHAINID\_hi}} | ||
\def\currChainIdLo {\col{curr\_CHAINID\_lo}} | ||
\def\prevChainIdHi {\col{prev\_CHAINID\_hi}} | ||
\def\prevChainIdLo {\col{prev\_CHAINID\_lo}} | ||
|
||
\def\currCoinbaseHi {\col{curr\_COINBASE\_hi}} | ||
\def\currCoinbaseLo {\col{curr\_COINBASE\_lo}} | ||
\def\prevCoinbaseHi {\col{prev\_COINBASE\_hi}} | ||
\def\prevCoinbaseLo {\col{prev\_COINBASE\_lo}} | ||
|
||
\def\currDifficultyHi {\col{curr\_DIFFICULTY\_hi}} | ||
\def\currDifficultyLo {\col{curr\_DIFFICULTY\_lo}} | ||
\def\prevDifficultyHi {\col{prev\_DIFFICULTY\_hi}} | ||
\def\prevDifficultyLo {\col{prev\_DIFFICULTY\_lo}} | ||
|
||
\def\currGasLimitHi {\col{curr\_GASLIMIT\_hi}} | ||
\def\currGasLimitLo {\col{curr\_GASLIMIT\_lo}} | ||
\def\prevGasLimitHi {\col{prev\_GASLIMIT\_hi}} | ||
\def\prevGasLimitLo {\col{prev\_GASLIMIT\_lo}} | ||
|
||
\def\currNumberHi {\col{curr\_NUMBER\_hi}} | ||
\def\currNumberLo {\col{curr\_NUMBER\_lo}} | ||
\def\prevNumberHi {\col{prev\_NUMBER\_hi}} | ||
\def\prevNumberLo {\col{prev\_NUMBER\_lo}} | ||
|
||
\def\currTimeStampHi {\col{curr\_TIMESTAMP\_hi}} | ||
\def\currTimeStampLo {\col{curr\_TIMESTAMP\_lo}} | ||
\def\prevTimeStampHi {\col{prev\_TIMESTAMP\_hi}} | ||
\def\prevTimeStampLo {\col{prev\_TIMESTAMP\_lo}} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
We impose \textbf{binary} constraints on the following columns: | ||
\begin{multicols}{3} | ||
\begin{enumerate} | ||
\item $\iomf$ | ||
\item $\isCoinbase$ | ||
\item $\isTimestamp$ | ||
\item $\isNumber$ | ||
\item $\isDifficulty$ | ||
\item $\isGaslimit$ | ||
\item $\isChainid$ | ||
\item $\isBasefee$ | ||
\end{enumerate} | ||
\end{multicols} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
We define several simple constraint systems to simplify the writing of constraints. | ||
\[ | ||
\left\{ \begin{array}{lcl} | ||
\wcpCallToLt { | ||
anchorRow = i , | ||
relOffset = \relof , | ||
argOneHi = \col{a\_hi} , | ||
argOneLo = \col{a\_lo} , | ||
argTwoHi = \col{b\_hi} , | ||
argTwoLo = \col{b\_lo} , | ||
} & \define & | ||
\left\{ \begin{array}{lcl} | ||
\wcpFlag _{i + \relof} & = & \rOne \\ | ||
\exoInstruction _{i + \relof} & = & \inst{LT} \\ | ||
\argOneHi _{i + \relof} & = & \col{a\_hi} \\ | ||
\argOneLo _{i + \relof} & = & \col{a\_lo} \\ | ||
\argTwoHi _{i + \relof} & = & \col{b\_hi} \\ | ||
\argTwoLo _{i + \relof} & = & \col{b\_lo} \\ | ||
\res _{i + \relof} & = & 1 \\ | ||
\end{array} \right. \vspace{2mm} \\ | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
\wcpCallToGt { | ||
anchorRow = i , | ||
relOffset = \relof , | ||
argOneHi = \col{a\_hi} , | ||
argOneLo = \col{a\_lo} , | ||
argTwoHi = \col{b\_hi} , | ||
argTwoLo = \col{b\_lo} , | ||
} & \define & | ||
\left\{ \begin{array}{lcl} | ||
\wcpFlag _{i + \relof} & = & \rOne \\ | ||
\exoInstruction _{i + \relof} & = & \inst{GT} \\ | ||
\argOneHi _{i + \relof} & = & \col{a\_hi} \\ | ||
\argOneLo _{i + \relof} & = & \col{a\_lo} \\ | ||
\argTwoHi _{i + \relof} & = & \col{b\_hi} \\ | ||
\argTwoLo _{i + \relof} & = & \col{b\_lo} \\ | ||
\res _{i + \relof} & = & 1 \\ | ||
\end{array} \right. \vspace{2mm} \\ | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
\wcpCallToLeq { | ||
anchorRow = i , | ||
relOffset = \relof , | ||
argOneHi = \col{a\_hi} , | ||
argOneLo = \col{a\_lo} , | ||
argTwoHi = \col{b\_hi} , | ||
argTwoLo = \col{b\_lo} , | ||
} & \define & | ||
\left\{ \begin{array}{lcl} | ||
\wcpFlag _{i + \relof} & = & \rOne \\ | ||
\exoInstruction _{i + \relof} & = & \inst{LEQ} \\ | ||
\argOneHi _{i + \relof} & = & \col{a\_hi} \\ | ||
\argOneLo _{i + \relof} & = & \col{a\_lo} \\ | ||
\argTwoHi _{i + \relof} & = & \col{b\_hi} \\ | ||
\argTwoLo _{i + \relof} & = & \col{b\_lo} \\ | ||
\res _{i + \relof} & = & 1 \\ | ||
\end{array} \right. \vspace{2mm} \\ | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
\wcpCallToGeq { | ||
anchorRow = i , | ||
relOffset = \relof , | ||
argOneHi = \col{a\_hi} , | ||
argOneLo = \col{a\_lo} , | ||
argTwoHi = \col{b\_hi} , | ||
argTwoLo = \col{b\_lo} , | ||
} & \define & | ||
\left\{ \begin{array}{lcl} | ||
\wcpFlag _{i + \relof} & = & \rOne \\ | ||
\exoInstruction _{i + \relof} & = & \inst{GEQ} \\ | ||
\argOneHi _{i + \relof} & = & \col{a\_hi} \\ | ||
\argOneLo _{i + \relof} & = & \col{a\_lo} \\ | ||
\argTwoHi _{i + \relof} & = & \col{b\_hi} \\ | ||
\argTwoLo _{i + \relof} & = & \col{b\_lo} \\ | ||
\res _{i + \relof} & = & 1 \\ | ||
\end{array} \right. \vspace{2mm} \\ | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
\wcpCallToIszero { | ||
anchorRow = i , | ||
relOffset = \relof , | ||
argOneHi = \col{a\_hi} , | ||
argOneLo = \col{a\_lo} , | ||
} & \define & | ||
\left\{ \begin{array}{lcl} | ||
\wcpFlag _{i + \relof} & = & \rOne \\ | ||
\exoInstruction _{i + \relof} & = & \inst{ISZERO} \\ | ||
\argOneHi _{i + \relof} & = & \col{a\_hi} \\ | ||
\argOneLo _{i + \relof} & = & \col{a\_lo} \\ | ||
\argTwoHi _{i + \relof} & = & 0 \\ | ||
\argTwoLo _{i + \relof} & = & 0 \\ | ||
\res _{i + \relof} & = & \relevantValue \\ | ||
\end{array} \right. \vspace{2mm} \\ | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
\eucCall { | ||
anchorRow = i , | ||
relOffset = \relof , | ||
argOne = \col{a} , | ||
argTwo = \col{b} , | ||
} & \define & | ||
\left\{ \begin{array}{lcl} | ||
\eucFlag _{i + \relof} & = & \rOne \\ | ||
\argOneLo _{i + \relof} & = & \col{a} \\ | ||
\argTwoLo _{i + \relof} & = & \col{b} \\ | ||
\end{array} \right. \\ | ||
\end{array} \right. | ||
\] | ||
\saNote{} | ||
The result of all comparisons is required to be \texttt{true} except for \inst{ISZERO}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
\subsection{For \inst{COINBASE }} \label{block data: computations and checks: coinbase} \input{computations/coinbase} | ||
\subsection{For \inst{TIMESTAMP }} \label{block data: computations and checks: timestamp} \input{computations/timestamp} | ||
\subsection{For \inst{NUMBER }} \label{block data: computations and checks: number} \input{computations/number} | ||
\subsection{For \inst{DIFFICULTY}} \label{block data: computations and checks: difficulty} \input{computations/difficulty} | ||
\subsection{For \inst{GASLIMIT }} \label{block data: computations and checks: gaslimit} \input{computations/gaslimit} | ||
\subsection{For \inst{CHAINID }} \label{block data: computations and checks: chainid} \input{computations/chainid} | ||
\subsection{For \inst{BASEFEE }} \label{block data: computations and checks: basefee} \input{computations/basefee} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
\begin{center} | ||
\boxed{\text{% | ||
The following constraints assume that | ||
$\left\{ \begin{array}{lcl} | ||
\isBasefee _{i - 1} & = & 0 \\ | ||
\isBasefee _{i} & = & 1 \\ | ||
\end{array} \right.$}} | ||
\end{center} | ||
We use the following shorthand | ||
\[ | ||
\left\{ \begin{array}{lc l} | ||
\currBaseFeeHi & \define & \currDataHi \\ | ||
\currBaseFeeLo & \define & \currDataLo \\ | ||
\end{array} \right. | ||
\] | ||
We impose the following constraints | ||
\begin{description} | ||
\item[\underline{\underline{Horizontalization of \inst{BASEFEE}:}}] | ||
we impose | ||
\[ | ||
\left\{ \begin{array}{lcl} | ||
\currBaseFeeHi & = & 0 \\ | ||
\currBaseFeeLo & = & \basefee _{i} \\ | ||
\end{array} \right. | ||
\] | ||
\saNote{} | ||
Implementations may further impose, by means of a constraint, the value returned by the \inst{BASEFEE} opcode to some network constant | ||
$\lineaBaseFee{}$. | ||
\item[\underline{\underline{\inst{BASEFEE} bound:}}] | ||
\def\rowOffset{\yellowm{0}} | ||
we impose | ||
\[ | ||
\wcpCallToGeq{ | ||
anchorRow = i , | ||
relOffset = \rowOffset , | ||
argOneHi = \currBaseFeeHi , | ||
argOneLo = \currBaseFeeLo , | ||
argTwoHi = 0 , | ||
argTwoLo = 0 , | ||
} | ||
\] | ||
\saNote{} | ||
The above ensures that $\basefee _{i} \geq 0$ is well formed (in terms of its high and low parts being $\llarge$-byte integers.) | ||
\end{description} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
IS_BASEFEE
is missing.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.
Indeed, fixed.