-
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
13
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.
+1,363
−117
Open
Changes from 12 commits
Commits
Show all changes
13 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 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,37 @@ | ||
\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\ctMaxCoinbase {\redm{\kappa_{\texttt{cb}}}} | ||
\def\ctMaxTimestamp {\redm{\kappa_{\texttt{ts}}}} | ||
\def\ctMaxNumber {\redm{\kappa_{\texttt{nb}}}} | ||
\def\ctMaxDifficulty {\redm{\kappa_{\texttt{df}}}} | ||
\def\ctMaxGaslimit {\redm{\kappa_{\texttt{gl}}}} | ||
\def\ctMaxChainid {\redm{\kappa_{\texttt{id}}}} | ||
\def\ctMaxBasefee {\redm{\kappa_{\texttt{bf}}}} | ||
\def\kappaDots {\redm{\kappa_{\texttt{xx}}}} | ||
\def\blockDataDepth {\redm{\kappa_{\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}} |
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,15 @@ | ||
We impose \textbf{binary} constraints on the following columns: | ||
\begin{multicols}{3} | ||
\begin{enumerate} | ||
\item $\iomf$ | ||
\item $\previousConflation$ | ||
\item $\currentConflation$ | ||
\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,37 @@ | ||
\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} | ||
|
||
\begin{description} | ||
\item[\underline{\underline{Setting \inst{BASEFEE}:}}] | ||
we impose | ||
\[ | ||
\left\{ \begin{array}{lcl} | ||
\blockDataHi _{i} & = & 0 \\ | ||
\blockDataLo _{i} & = & \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 = \blockDataHi _{i} , | ||
argOneLo = \blockDataLo _{i} , | ||
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} |
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,41 @@ | ||
\begin{center} | ||
\boxed{\text{% | ||
The following constraints assume that | ||
$\left\{ \begin{array}{lcl} | ||
\isChainid _{i - 1} & = & 0 \\ | ||
\isChainid _{i} & = & 1 \\ | ||
\end{array} \right.$}} | ||
\end{center} | ||
|
||
\begin{description} | ||
\item[\underline{\underline{Setting \inst{CHAINID}:}}] | ||
we cannot \emph{a priori} constrain \inst{CHAINID}; | ||
|
||
\saNote{} | ||
Implementations may impose the value returned by the \inst{CHAINID} opcode to some network constant | ||
$\lineaChainId$. | ||
\item[\underline{\underline{Permanence of \inst{CHAINID}:}}] | ||
\If $\locIsCurrConf _{i} = 1$ \Then | ||
we impose | ||
\[ | ||
\left\{ \begin{array}{lcl} | ||
\blockDataHi _{i} & = & \blockDataHi _{i - \blockDataDepth} \\ | ||
\blockDataLo _{i} & = & \blockDataLo _{i - \blockDataDepth} \\ | ||
\end{array} \right. | ||
\] | ||
\item[\underline{\underline{\inst{CHAINID} bound:}}] | ||
\def\rowOffset{\yellowm{0}} | ||
we impose | ||
\[ | ||
\wcpCallToGeq{ | ||
anchorRow = i , | ||
relOffset = \rowOffset , | ||
argOneHi = \blockDataHi _{i} , | ||
argOneLo = \blockDataLo _{i} , | ||
argTwoHi = 0 , | ||
argTwoLo = 0 , | ||
} | ||
\] | ||
\saNote{} | ||
The above ensures that $\inst{CHAINID} \geq 0$ is well formed (in terms of its high and low parts being $\llarge$-byte integers.) | ||
\end{description} |
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,33 @@ | ||
\begin{center} | ||
\boxed{\text{% | ||
The following constraints assume that | ||
$\left\{ \begin{array}{lcl} | ||
\isCoinbase _{i - 1} & = & 0 \\ | ||
\isCoinbase _{i} & = & 1 \\ | ||
\end{array} \right.$}} | ||
\end{center} | ||
\begin{description} | ||
\item[\underline{\underline{Setting \inst{COINBASE}:}}] | ||
we impose | ||
\[ | ||
\left\{ \begin{array}{lcl} | ||
\blockDataHi _{i} & = & \coinbase\high _{i} \\ | ||
\blockDataLo _{i} & = & \coinbase\low _{i} \\ | ||
\end{array} \right. | ||
\] | ||
\item[\underline{\underline{\inst{GASLIMIT} deviation lower bound:}}] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should it be ? |
||
\def\rowOffset{\yellowm{0}} | ||
\If $\locIsCurrConf _{i} = 1$ \Then | ||
\[ | ||
\wcpCallToLt{ | ||
anchorRow = i , | ||
relOffset = \rowOffset , | ||
argOneHi = \blockDataHi _{i} , | ||
argOneLo = \blockDataLo _{i} , | ||
argTwoHi = 256^\ssmall , | ||
argTwoLo = 0 , | ||
} | ||
\] | ||
\saNote{} | ||
The above ensures that \inst{COINBASE} fits in a $\addressSize$-byte integer. | ||
\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.