Skip to content

Commit b1048f4

Browse files
authored
feat: DIFFICULTY -> PREVRANDAO (#151)
1 parent f34dc48 commit b1048f4

11 files changed

+76
-75
lines changed

block_data/_local.tex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
\def\locIsCoinbase {\col{is\_CB}}
44
\def\locIsTimestamp {\col{is\_TS}}
55
\def\locIsNumber {\col{is\_NB}}
6-
\def\locIsDifficulty {\col{is\_DF}}
6+
\def\locIsPrevRandao {\col{is\_PR}}
77
\def\locIsGaslimit {\col{is\_GL}}
88
\def\locIsChainid {\col{is\_ID}}
99
\def\locIsBasefee {\col{is\_BF}}
@@ -24,7 +24,7 @@
2424
\def\ctMaxCoinbase {\redm{\texttt{nRows}_{\texttt{cb}}}}
2525
\def\ctMaxTimestamp {\redm{\texttt{nRows}_{\texttt{ts}}}}
2626
\def\ctMaxNumber {\redm{\texttt{nRows}_{\texttt{nb}}}}
27-
\def\ctMaxDifficulty {\redm{\texttt{nRows}_{\texttt{df}}}}
27+
\def\ctMaxPrevRandao {\redm{\texttt{nRows}_{\texttt{pr}}}}
2828
\def\ctMaxGaslimit {\redm{\texttt{nRows}_{\texttt{gl}}}}
2929
\def\ctMaxChainid {\redm{\texttt{nRows}_{\texttt{id}}}}
3030
\def\ctMaxBasefee {\redm{\texttt{nRows}_{\texttt{bf}}}}
@@ -67,10 +67,10 @@
6767
\def\prevCoinbaseHi {\col{prev\_COINBASE\_hi}}
6868
\def\prevCoinbaseLo {\col{prev\_COINBASE\_lo}}
6969

70-
\def\currDifficultyHi {\col{curr\_DIFFICULTY\_hi}}
71-
\def\currDifficultyLo {\col{curr\_DIFFICULTY\_lo}}
72-
\def\prevDifficultyHi {\col{prev\_DIFFICULTY\_hi}}
73-
\def\prevDifficultyLo {\col{prev\_DIFFICULTY\_lo}}
70+
\def\currPrevRandaoHi {\col{curr\_PREVRANDAO\_hi}}
71+
\def\currPrevRandaoLo {\col{curr\_PREVRANDAO\_lo}}
72+
\def\prevPrevRandaoHi {\col{prev\_PREVRANDAO\_hi}}
73+
\def\prevPrevRandaoLo {\col{prev\_PREVRANDAO\_lo}}
7474

7575
\def\currGasLimitHi {\col{curr\_GASLIMIT\_hi}}
7676
\def\currGasLimitLo {\col{curr\_GASLIMIT\_lo}}

block_data/binarities.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
\item $\isCoinbase$
88
\item $\isTimestamp$
99
\item $\isNumber$
10-
\item $\isDifficulty$
10+
\item $\isPrevRandao$
1111
\item $\isGaslimit$
1212
\item $\isChainid$
1313
\item $\isBasefee$

block_data/columns.tex

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
We introduce some binary columns linked to the instructions that the present module deals with:
1212
\begin{multicols}{3}
1313
\begin{enumerate}[resume]
14-
\item $\isCoinbase$
15-
\item $\isTimestamp$
16-
\item $\isNumber$
17-
\item $\isDifficulty$
18-
\item $\isGaslimit$
19-
\item $\isChainid$
20-
\item $\isBasefee$
21-
\end{enumerate}
14+
\item $\isCoinbase$
15+
\item $\isTimestamp$
16+
\item $\isNumber$
17+
\item $\isPrevRandao$
18+
\item $\isGaslimit$
19+
\item $\isChainid$
20+
\item $\isBasefee$
21+
\end{enumerate}
2222
\end{multicols}
2323
\noindent The following columns contain data which is reflected in the \txnDataMod{} module.
2424
\begin{enumerate}[resume, start=13]

block_data/computations/_inputs.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
\subsection{For \inst{COINBASE }} \label{block data: computations and checks: coinbase} \input{computations/coinbase}
22
\subsection{For \inst{TIMESTAMP }} \label{block data: computations and checks: timestamp} \input{computations/timestamp}
33
\subsection{For \inst{NUMBER }} \label{block data: computations and checks: number} \input{computations/number}
4-
\subsection{For \inst{DIFFICULTY}} \label{block data: computations and checks: difficulty} \input{computations/difficulty}
4+
\subsection{For \inst{PREVRANDAO}} \label{block data: computations and checks: prevrandao} \input{computations/prevrandao}
55
\subsection{For \inst{GASLIMIT }} \label{block data: computations and checks: gaslimit} \input{computations/gaslimit}
66
\subsection{For \inst{CHAINID }} \label{block data: computations and checks: chainid} \input{computations/chainid}
77
\subsection{For \inst{BASEFEE }} \label{block data: computations and checks: basefee} \input{computations/basefee}

block_data/computations/difficulty.tex renamed to block_data/computations/prevrandao.tex

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,38 @@
22
\boxed{\text{%
33
The following constraints assume that
44
$\left\{ \begin{array}{lcl}
5-
\isDifficulty _{i - 1} & = & 0 \\
6-
\isDifficulty _{i} & = & 1 \\
5+
\isPrevRandao _{i - 1} & = & 0 \\
6+
\isPrevRandao _{i} & = & 1 \\
77
\end{array} \right.$}}
88
\end{center}
99
We use the following shorthand
1010
\[
1111
\left\{ \begin{array}{lcl}
12-
\currDifficultyHi & \define & \currDataHi \\
13-
\currDifficultyLo & \define & \currDataLo \\
12+
\currPrevRandaoHi & \define & \currDataHi \\
13+
\currPrevRandaoLo & \define & \currDataLo \\
1414
\end{array} \right.
1515
\]
1616
And we impose the following constraints
1717
\begin{description}
18-
\item[\underline{\underline{Setting \inst{DIFFICULTY}:}}]
19-
we cannot \emph{a priori} constrain \inst{DIFFICULTY};
18+
\item[\underline{\underline{Setting \inst{PREVRANDAO}:}}]
19+
we cannot \emph{a priori} constrain \inst{PREVRANDAO};
2020

2121
\saNote{}
22-
Implementations may impose the value returned by the \inst{DIFFICULTY} opcode to some network constant,
23-
e.g. $\lineaDifficulty= 2$.
24-
\item[\underline{\underline{\inst{DIFFICULTY} bound:}}]
22+
Implementations may impose the value returned by the \inst{PREVRANDAO} opcode to some network constant,
23+
e.g. $\lineaPrevRandao= 2$.
24+
\item[\underline{\underline{\inst{PREVRANDAO} bound:}}]
2525
\def\rowOffset{\yellowm{0}}
2626
we impose
2727
\[
2828
\wcpCallToGeq{
2929
anchorRow = i ,
3030
relOffset = \rowOffset ,
31-
argOneHi = \currDifficultyHi ,
32-
argOneLo = \currDifficultyLo ,
31+
argOneHi = \currPrevRandaoHi ,
32+
argOneLo = \currPrevRandaoLo ,
3333
argTwoHi = 0 ,
3434
argTwoLo = 0 ,
3535
}
3636
\]
3737
\saNote{}
38-
The above ensures that $\inst{DIFFICULTY} \geq 0$ is well formed (in terms of its high and low parts being $\llarge$-byte integers.)
38+
The above ensures that $\inst{PREVRANDAO} \geq 0$ is well formed (in terms of its high and low parts being $\llarge$-byte integers.)
3939
\end{description}

block_data/intro.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
\item \inst{COINBASE}
66
\item \inst{TIMESTAMP}
77
\item \inst{NUMBER}
8-
\item \inst{DIFFICULTY}
8+
\item \inst{PREVRANDAO}
99
\item \inst{GASLIMIT}
1010
\item \inst{CHAINID}
1111
\item \inst{BASEFEE}

block_data/lookups/prover_data_extraction.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
+ & (1 - \locIsCoinbase _{i - 1}) & \cdot & \locIsCoinbase _{i} \\
99
+ & (1 - \locIsTimestamp _{i - 1}) & \cdot & \locIsTimestamp _{i} \\
1010
+ & (1 - \locIsNumber _{i - 1}) & \cdot & \locIsNumber _{i} \\
11-
+ & (1 - \locIsDifficulty _{i - 1}) & \cdot & \locIsDifficulty _{i} \\
11+
+ & (1 - \locIsPrevRandao _{i - 1}) & \cdot & \locIsPrevRandao _{i} \\
1212
+ & (1 - \locIsGaslimit _{i - 1}) & \cdot & \locIsGaslimit _{i} \\
1313
+ & (1 - \locIsChainid _{i - 1}) & \cdot & \locIsChainid _{i} \\
1414
+ & (1 - \locIsBasefee _{i - 1}) & \cdot & \locIsBasefee _{i} \\

block_data/lua/flags_and_ct.lua.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
| 1 | | | 1 | | | | | 1 | 0 | NUMBER | 1 |
6060
| 1 | | | 1 | | | | | 1 | 1 | NUMBER | 1 |
6161
|------+-------+-------+-------+-------+-------+-------+-------+--------+----+------------+----------|
62-
| 1 | | | | 1 | | | | 0 | 0 | DIFFICULTY | 1 |
62+
| 1 | | | | 1 | | | | 0 | 0 | PREVRANDAO | 1 |
6363
|------+-------+-------+-------+-------+-------+-------+-------+--------+----+------------+----------|
6464
| 1 | | | | | 1 | | | 4 | 0 | GASLIMIT | 1 |
6565
| 1 | | | | | 1 | | | 4 | 1 | GASLIMIT | 1 |
@@ -79,7 +79,7 @@
7979
| 1 | | | 1 | | | | | 1 | 0 | NUMBER | 2 |
8080
| 1 | | | 1 | | | | | 1 | 1 | NUMBER | 2 |
8181
|------+-------+-------+-------+-------+-------+-------+-------+--------+----+------------+----------|
82-
| 1 | | | | 1 | | | | 0 | 0 | DIFFICULTY | 2 |
82+
| 1 | | | | 1 | | | | 0 | 0 | PREVRANDAO | 2 |
8383
|------+-------+-------+-------+-------+-------+-------+-------+--------+----+------------+----------|
8484
| 1 | | | | | 1 | | | 4 | 0 | GASLIMIT | 2 |
8585
| 1 | | | | | 1 | | | 4 | 1 | GASLIMIT | 2 |

block_data/notes.md

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,40 @@ Data that will emanate from the BLOCKDATA module
33
- COINBASE
44
- CHAINID
55
- NUMBER
6-
- DIFFICULTY
6+
- PREVRANDAO
77
- GASLIMIT
88
- BASEFEE
99

10-
| IOMF | REL_BLOCK_NUMBER | INST | DATA_HI | DATA_LO |
11-
|------+------------------+-----------+---------+-------------------|
12-
| 0 | 0 | 0 | 0 | 0 |
13-
|------+------------------+-----------+---------+-------------------|
14-
| 1 | 1 | TIMESTAMP | 0 | <unix time stamp> |
15-
| 1 | 1 | COINBASE | 4B | 16 B |
16-
| 1 | 1 | CHAINID | 0 | <chain id> |
17-
| 1 | 1 | NUMBER | | |
18-
| 1 | 1 | DIFFICUL | | |
19-
| 1 | 1 | GASLIMIT | | |
20-
| 1 | 1 | BASEFEE | | |
21-
|------+------------------+-----------+---------+-------------------|
22-
| 1 | 2 | TIMESTAMP | 0 | <unix time stamp> |
23-
| 1 | 2 | COINBASE | 4B | 16 B |
24-
| 1 | 2 | CHAINID | | |
25-
| 1 | 2 | NUMBER | | |
26-
| 1 | 2 | DIFFICUL | | |
27-
| 1 | 2 | GASLIMIT | | |
28-
| 1 | 2 | BASEFEE | | |
29-
|------+------------------+-----------+---------+-------------------|
30-
| 1 | 3 | TIMESTAMP | 0 | <unix time stamp> |
31-
| 1 | 3 | COINBASE | 4B | 16 B |
32-
| 1 | 3 | CHAINID | | |
33-
| 1 | 3 | NUMBER | | |
34-
| 1 | 3 | DIFFICUL | | |
35-
| 1 | 3 | GASLIMIT | | |
36-
| 1 | 3 | BASEFEE | | |
10+
11+
| IOMF | REL_BLOCK_NUMBER | INST | DATA_HI | DATA_LO |
12+
|------|------------------|------------|---------|-------------------|
13+
| 0 | 0 | 0 | 0 | 0 |
14+
|------|------------------|------------|---------|-------------------|
15+
| 1 | 1 | TIMESTAMP | 0 | <unix time stamp> |
16+
| 1 | 1 | COINBASE | 4B | 16 B |
17+
| 1 | 1 | CHAINID | 0 | <chain id> |
18+
| 1 | 1 | NUMBER | | |
19+
| 1 | 1 | PREVRANDAO | | |
20+
| 1 | 1 | GASLIMIT | | |
21+
| 1 | 1 | BASEFEE | | |
22+
|------|------------------|------------|---------|-------------------|
23+
| 1 | 2 | TIMESTAMP | 0 | <unix time stamp> |
24+
| 1 | 2 | COINBASE | 4B | 16 B |
25+
| 1 | 2 | CHAINID | | |
26+
| 1 | 2 | NUMBER | | |
27+
| 1 | 2 | PREVRANDAO | | |
28+
| 1 | 2 | GASLIMIT | | |
29+
| 1 | 2 | BASEFEE | | |
30+
|------|------------------|------------|---------|-------------------|
31+
| 1 | 3 | TIMESTAMP | 0 | <unix time stamp> |
32+
| 1 | 3 | COINBASE | 4B | 16 B |
33+
| 1 | 3 | CHAINID | | |
34+
| 1 | 3 | NUMBER | | |
35+
| 1 | 3 | PREVRANDAO | | |
36+
| 1 | 3 | GASLIMIT | | |
37+
| 1 | 3 | BASEFEE | | |
38+
|------|------------------|------------|---------|-------------------|
39+
3740

3841
We keep
3942
- FIRST_ABSOLUTE_BLOCK_NUMBER

block_data/shorthands.tex

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
\isCoinbase & \longleftrightarrow & \locIsCoinbase \\
55
\isTimestamp & \longleftrightarrow & \locIsTimestamp \\
66
\isNumber & \longleftrightarrow & \locIsNumber \\
7-
\isDifficulty & \longleftrightarrow & \locIsDifficulty \\
7+
\isPrevRandao & \longleftrightarrow & \locIsPrevRandao \\
88
\isGaslimit & \longleftrightarrow & \locIsGaslimit \\
99
\isChainid & \longleftrightarrow & \locIsChainid \\
1010
\isBasefee & \longleftrightarrow & \locIsBasefee \\
@@ -18,7 +18,7 @@
1818
+ & \locIsCoinbase _{i} \\
1919
+ & \locIsTimestamp _{i} \\
2020
+ & \locIsNumber _{i} \\
21-
+ & \locIsDifficulty _{i} \\
21+
+ & \locIsPrevRandao _{i} \\
2222
+ & \locIsGaslimit _{i} \\
2323
+ & \locIsChainid _{i} \\
2424
+ & \locIsBasefee _{i} \\
@@ -28,7 +28,7 @@
2828
+ & 1 & \cdot & \locIsCoinbase _{i} \\
2929
+ & 2 & \cdot & \locIsTimestamp _{i} \\
3030
+ & 3 & \cdot & \locIsNumber _{i} \\
31-
+ & 4 & \cdot & \locIsDifficulty _{i} \\
31+
+ & 4 & \cdot & \locIsPrevRandao _{i} \\
3232
+ & 5 & \cdot & \locIsGaslimit _{i} \\
3333
+ & 6 & \cdot & \locIsChainid _{i} \\
3434
+ & 7 & \cdot & \locIsBasefee _{i} \\
@@ -43,7 +43,7 @@
4343
+ & \inst{COINBASE} & \cdot & \locIsCoinbase _{i} \\
4444
+ & \inst{TIMESTAMP} & \cdot & \locIsTimestamp _{i} \\
4545
+ & \inst{NUMBER} & \cdot & \locIsNumber _{i} \\
46-
+ & \inst{DIFFICULTY} & \cdot & \locIsDifficulty _{i} \\
46+
+ & \inst{PREVRANDAO} & \cdot & \locIsPrevRandao _{i} \\
4747
+ & \inst{GASLIMIT} & \cdot & \locIsGaslimit _{i} \\
4848
+ & \inst{CHAINID} & \cdot & \locIsChainid _{i} \\
4949
+ & \inst{BASEFEE} & \cdot & \locIsBasefee _{i} \\
@@ -53,7 +53,7 @@
5353
+ & (\ctMaxCoinbase - 1) & \cdot & \locIsCoinbase _{i} \\
5454
+ & (\ctMaxTimestamp - 1) & \cdot & \locIsTimestamp _{i} \\
5555
+ & (\ctMaxNumber - 1) & \cdot & \locIsNumber _{i} \\
56-
+ & (\ctMaxDifficulty - 1) & \cdot & \locIsDifficulty _{i} \\
56+
+ & (\ctMaxPrevRandao - 1) & \cdot & \locIsPrevRandao _{i} \\
5757
+ & (\ctMaxGaslimit - 1) & \cdot & \locIsGaslimit _{i} \\
5858
+ & (\ctMaxChainid - 1) & \cdot & \locIsChainid _{i} \\
5959
+ & (\ctMaxBasefee - 1) & \cdot & \locIsBasefee _{i} \\
@@ -66,7 +66,7 @@
6666
\ctMaxCoinbase & \define & \yellowm{1} \\
6767
\ctMaxTimestamp & \define & \yellowm{2} \\
6868
\ctMaxNumber & \define & \yellowm{2} \\
69-
\ctMaxDifficulty & \define & \yellowm{1} \\
69+
\ctMaxPrevRandao & \define & \yellowm{1} \\
7070
\end{array} \right.
7171
\quad\text{and}\quad
7272
\left\{ \begin{array}{lcl}
@@ -83,7 +83,7 @@
8383
+ & (1 - \locIsCoinbase _{i}) & \cdot & \locIsCoinbase _{i + 1} \\
8484
+ & (1 - \locIsTimestamp _{i}) & \cdot & \locIsTimestamp _{i + 1} \\
8585
+ & (1 - \locIsNumber _{i}) & \cdot & \locIsNumber _{i + 1} \\
86-
+ & (1 - \locIsDifficulty _{i}) & \cdot & \locIsDifficulty _{i + 1} \\
86+
+ & (1 - \locIsPrevRandao _{i}) & \cdot & \locIsPrevRandao _{i + 1} \\
8787
+ & (1 - \locIsGaslimit _{i}) & \cdot & \locIsGaslimit _{i + 1} \\
8888
+ & (1 - \locIsChainid _{i}) & \cdot & \locIsChainid _{i + 1} \\
8989
+ & (1 - \locIsBasefee _{i}) & \cdot & \locIsBasefee _{i + 1} \\
@@ -94,7 +94,7 @@
9494
+ & \locIsCoinbase _{i} & \cdot & \locIsCoinbase _{i + 1} \\
9595
+ & \locIsTimestamp _{i} & \cdot & \locIsTimestamp _{i + 1} \\
9696
+ & \locIsNumber _{i} & \cdot & \locIsNumber _{i + 1} \\
97-
+ & \locIsDifficulty _{i} & \cdot & \locIsDifficulty _{i + 1} \\
97+
+ & \locIsPrevRandao _{i} & \cdot & \locIsPrevRandao _{i + 1} \\
9898
+ & \locIsGaslimit _{i} & \cdot & \locIsGaslimit _{i + 1} \\
9999
+ & \locIsChainid _{i} & \cdot & \locIsChainid _{i + 1} \\
100100
+ & \locIsBasefee _{i} & \cdot & \locIsBasefee _{i + 1} \\
@@ -106,8 +106,8 @@
106106
\left[ \begin{array}{clcl}
107107
+ & \locIsCoinbase _{i} & \cdot & \locIsTimestamp _{i + 1} \\
108108
+ & \locIsTimestamp _{i} & \cdot & \locIsNumber _{i + 1} \\
109-
+ & \locIsNumber _{i} & \cdot & \locIsDifficulty _{i + 1} \\
110-
+ & \locIsDifficulty _{i} & \cdot & \locIsGaslimit _{i + 1} \\
109+
+ & \locIsNumber _{i} & \cdot & \locIsPrevRandao _{i + 1} \\
110+
+ & \locIsPrevRandao _{i} & \cdot & \locIsGaslimit _{i + 1} \\
111111
+ & \locIsGaslimit _{i} & \cdot & \locIsChainid _{i + 1} \\
112112
+ & \locIsChainid _{i} & \cdot & \locIsBasefee _{i + 1} \\
113113
+ & \locIsBasefee _{i} & \cdot & \locIsCoinbase _{i + 1} \\

pkg/block_data.sty

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,27 @@
55

66
\newcommand{\relBlockNum} {\col{BLOCK\_NUM}}
77

8-
%\newcommand{\coinbase} {\col{COINBASE}}
98
\newcommand{\blockGasLimit} {\col{BLOCK\_GAS\_LIMIT}}
109
\newcommand{\basefee} {\col{BASEFEE}}
1110

1211
\newcommand{\lineaChainId} {\redm{\texttt{LINEA\_CHAIN\_ID}}}
1312
\newcommand{\lineaBaseFee} {\redm{\texttt{LINEA\_BASE\_FEE}}}
14-
\newcommand{\lineaDifficulty} {\redm{\texttt{LINEA\_DIFFICULTY}}}
13+
\newcommand{\lineaPrevRandao} {\redm{\texttt{LINEA\_PREVRANDAO}}}
1514

1615
\newcommand{\maxCtBtcData} {\redm{6}}
1716

1817
\newcommand{\rowShiftCoinbase} {\redm{0}}
1918
\newcommand{\rowShiftTimestamp} {\redm{1}}
2019
\newcommand{\rowShiftNumber} {\redm{2}}
21-
\newcommand{\rowShiftDifficulty} {\redm{3}}
22-
\newcommand{\rowShiftPrevandao} {\redm{3}}
20+
\newcommand{\rowShiftPrevRandao} {\redm{3}}
2321
\newcommand{\rowShiftGaslimit} {\redm{4}}
2422
\newcommand{\rowShiftChainId} {\redm{5}}
2523
\newcommand{\rowShiftBaseFee} {\redm{6}}
2624

2725
\newcommand{\isCoinbase} {\col{IS\_COINBASE}}
2826
\newcommand{\isTimestamp} {\col{IS\_TIMESTAMP}}
2927
\newcommand{\isNumber} {\col{IS\_NUMBER}}
30-
\newcommand{\isDifficulty} {\col{IS\_DIFFICULTY}}
28+
\newcommand{\isPrevRandao} {\col{IS\_PREVRANDAO}}
3129
\newcommand{\isGaslimit} {\col{IS\_GASLIMIT}}
3230
\newcommand{\isChainid} {\col{IS\_CHAINID}}
3331
\newcommand{\isBasefee} {\col{IS\_BASEFEE}}

0 commit comments

Comments
 (0)