-
Notifications
You must be signed in to change notification settings - Fork 155
/
chain.tex
151 lines (138 loc) · 5.17 KB
/
chain.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
\section{Blockchain layer}
\label{sec:chain}
\newcommand{\Proof}{\type{Proof}}
\newcommand{\Seedl}{\mathsf{Seed}_\ell}
\newcommand{\Seede}{\mathsf{Seed}_\eta}
\newcommand{\activeSlotCoeff}[1]{\fun{activeSlotCoeff}~ \var{#1}}
\newcommand{\slotToSeed}[1]{\fun{slotToSeed}~ \var{#1}}
\newcommand{\isOverlaySlot}[3]{\fun{isOverlaySlot}~\var{#1}~\var{#2}~\var{#3}}
\newcommand{\T}{\type{T}}
\newcommand{\vrf}[3]{\fun{vrf}_{#1} ~ #2 ~ #3}
\newcommand{\verifyVrf}[4]{\fun{verifyVrf}_{#1} ~ #2 ~ #3 ~#4}
\newcommand{\HashHeader}{\type{HashHeader}}
\newcommand{\HashBBody}{\type{HashBBody}}
\newcommand{\bhHash}[1]{\fun{bhHash}~ \var{#1}}
\newcommand{\bHeaderSize}[1]{\fun{bHeaderSize}~ \var{#1}}
\newcommand{\bSize}[1]{\fun{bSize}~ \var{#1}}
\newcommand{\bBodySize}[1]{\fun{bBodySize}~ \var{#1}}
\newcommand{\OCert}{\type{OCert}}
\newcommand{\BHeader}{\type{BHeader}}
\newcommand{\BHBody}{\type{BHBody}}
\newcommand{\bheader}[1]{\fun{bheader}~\var{#1}}
\newcommand{\hsig}[1]{\fun{hsig}~\var{#1}}
\newcommand{\bprev}[1]{\fun{bprev}~\var{#1}}
\newcommand{\bhash}[1]{\fun{bhash}~\var{#1}}
\newcommand{\bvkcold}[1]{\fun{bvkcold}~\var{#1}}
\newcommand{\bseedl}[1]{\fun{bseed}_{\ell}~\var{#1}}
\newcommand{\bprfn}[1]{\fun{bprf}_{n}~\var{#1}}
\newcommand{\bseedn}[1]{\fun{bseed}_{n}~\var{#1}}
\newcommand{\bprfl}[1]{\fun{bprf}_{\ell}~\var{#1}}
\newcommand{\bocert}[1]{\fun{bocert}~\var{#1}}
\newcommand{\bnonce}[1]{\fun{bnonce}~\var{#1}}
\newcommand{\bleader}[1]{\fun{bleader}~\var{#1}}
\newcommand{\hBbsize}[1]{\fun{hBbsize}~\var{#1}}
\newcommand{\bbodyhash}[1]{\fun{bbodyhash}~\var{#1}}
\newcommand{\overlaySchedule}[4]{\fun{overlaySchedule}~\var{#1}~\var{#2}~{#3}~\var{#4}}
\newcommand{\PrtclState}{\type{PrtclState}}
\newcommand{\PrtclEnv}{\type{PrtclEnv}}
\newcommand{\OverlayEnv}{\type{OverlayEnv}}
\newcommand{\VRFState}{\type{VRFState}}
\newcommand{\NewEpochEnv}{\type{NewEpochEnv}}
\newcommand{\NewEpochState}{\type{NewEpochState}}
\newcommand{\PoolDistr}{\type{PoolDistr}}
\newcommand{\BBodyEnv}{\type{BBodyEnv}}
\newcommand{\BBodyState}{\type{BBodyState}}
\newcommand{\RUpdEnv}{\type{RUpdEnv}}
\newcommand{\ChainEnv}{\type{ChainEnv}}
\newcommand{\ChainState}{\type{ChainState}}
\newcommand{\ChainSig}{\type{ChainSig}}
\subsection{Block Body Transition}
\label{sec:block-body-trans}
Figure~\ref{fig:rules:bbody} includes an additional check that the sum of the
execution units of all transactions in a block does not exceed the maximum total units per
block (specified in a protocol parameter).
\begin{figure}[ht]
\begin{equation}\label{eq:bbody}
\inference[Block-Body]
{
\var{txs} \leteq \bbody{block}
&
\var{bhb} \leteq \bhbody{(\bheader{block})}
&
\var{hk} \leteq \hashKey{(\bvkcold{bhb})}
\\~\\
\bBodySize{txs} = \hBbsize{bhb}
&
\fun{bbodyhash}~{txs} = \bhash{bhb}
\\~\\
\\
\var{slot} \leteq \bslot{bhb}
&
\var{fSlot} \leteq \fun{firstSlot}~(\epoch{slot})
\\~\\
\hldiff{\sum_{tx\in txs} \fun{totExunits}~{tx} \leq \fun{maxBlockExUnits}~\var{pp}}
\\~\\
{
{\begin{array}{c}
\bslot{bhb} \\
\var{pp} \\
\var{acnt}
\end{array}}
\vdash
\var{ls} \\
\trans{\hyperref[fig:rules:ledger-sequence]{ledgers}}{\var{txs}}
\var{ls}' \\
}
}
{
{\begin{array}{c}
\var{pp} \\
\var{acnt}
\end{array}}
\vdash
{\left(\begin{array}{c}
\var{ls} \\
\var{b} \\
\end{array}\right)}
\trans{bbody}{\var{block}}
{\left(\begin{array}{c}
\varUpdate{\var{ls}'} \\
\varUpdate{\fun{incrBlocks}~{\left(\isOverlaySlot{fSlot}{(\fun{d}~pp)}{slot}\right)}~{hk}~{b}} \\
\end{array}\right)}
}
\end{equation}
\caption{BBody rules}
\label{fig:rules:bbody}
\end{figure}
We have also defined a function that transforms the Shelley ledger state into
the corresponding Alonzo one, see Figure~\ref{fig:functions:to-shelley}. We
refer to the Shelley-era protocol parameter type as $\ShelleyPParams$, and the corresponding Alonzo
type as $\PParams$. We use the notation $\var{chainstate}_{x}$ to represent
variable $x$ in the chain state. We do not specify the variables that
remain unchanged during the transition.
%%
%% Figure - Shelley to Alonzo Transition
%%
\begin{figure}[htb]
\emph{Types and Constants}
%
\begin{align*}
& \NewParams = (\Language \mapsto \CostMod) \times \Prices \times \ExUnits \times \ExUnits \\
& ~~~~~~~~ \times \N \times \Coin \times \N \times \N \\
& \text{the type of new parameters to add for Alonzo}
\nextdef
& \var{ivPP} \in \NewParams \\
& \text{the initial values for new Alonzo parameters}
\end{align*}
\emph{Shelley to Alonzo Transition Functions}
%
\begin{align*}
& \fun{toAlonzo} : \ShelleyChainState \to \ChainState \\
& \fun{toAlonzo}~\var{chainstate} =~\var{chainstate'} \\
&~~\where \\
&~~~~\var{chainstate'}_{pparams}~=~(\var{pp}\cup \var{ivPP})~ - ~\var{minUTxOValue}\\
& \text{transform Shelley chain state to Alonzo state}
\end{align*}
\caption{Shelley to Alonzo State Transtition}
\label{fig:functions:to-shelley}
\end{figure}