Skip to content

Commit e930e7c

Browse files
committed
Add accumulator to snapshot
As close to cardano-scaling/hydra#2324 as possible
1 parent 269c871 commit e930e7c

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

src/Hydra/Protocol/Figures/offchain-protocol.tex

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
$\Uinit \gets \bigcup_{j=1}^{n} U_j$ \;
4949
% $\Out~(\hpSnap,(0,U_0))$ \;
5050
$\hatmL \gets \Uinit$ \;
51-
$\bar{\mc S} \gets \Sno(0, 0, [], \Uinit, \emptyset , \emptyset)$ \;
51+
$\bar{\mc S} \gets \Sno(0, 0, [], \Uinit, \emptyset , \emptyset, \textcolor{red}{\accUTxO(\Uinit)})$ \;
5252
$\hatv, \hats \gets 0$ \;
5353
$\hatmT \gets \emptyset$ \;
5454
$\tx_\omega \gets \bot$ \;
@@ -165,17 +165,18 @@
165165
$\msCSig \gets \msComb(\hydraKeys^{setup}, \hatSigma)$ \;
166166

167167
% TODO: DRY message creation
168-
\textcolor{red}{$\eta \gets \accUTxO(\hatmU)$} \;
168+
\textcolor{red}{$A \gets \bar{\mc S}.A$} \;
169+
\textcolor{red}{$\eta \gets \bar{\mc S}.U$} \;
169170

170-
\textcolor{red}{$\eta_\alpha \gets \accUTxO(U_\alpha)$} \;
171+
\textcolor{red}{$\eta_\alpha \gets \bar{\mc S}.U_\alpha$} \;
171172
$U_\omega \gets \mathsf{outputs}(\tx_\omega)$ \;
172-
\textcolor{red}{$\eta_\omega \gets \accUTxO(U_\omega)$} \;
173+
\textcolor{red}{$\eta_\omega \gets \bar{\mc S}.U_\omega$} \;
173174
% NOTE: Implementation differs here and
174175
% below as it stores seen version in seen
175176
% snapshot and uses that to verify
176177
\Req{} $\msVfy(\hydraKeysAgg, (\cid || \hatv || \hats || \eta || \eta_\alpha || \eta_\omega), \msCSig)$ \;
177178
% create confirmed snapshot for later reference
178-
$\bar{\mc S} \gets \Sno(\hatv, \hats, \hatmT, \hatmU, U_\alpha, U_\omega)$ \;
179+
$\bar{\mc S} \gets \Sno(\hatv, \hats, \hatmT, \hatmU, U_\alpha, U_\omega, \bar{\mc S}.A)$ \;
179180
$\bar{\mc S}.\sigma \gets \msCSig$ \;
180181
%$\Out~(\hpSnap,(\bar{\mc S}.s,\bar{\mc S}.U))$ \;
181182
$\forall \tx \in \mT_{\mathsf{req}} : \Out (\hpConf,\tx)$ \;
@@ -261,9 +262,9 @@
261262
\begin{walgo}{0.6}
262263
% CLOSE from client
263264
\On{$(\hpClose)$ from client}{
264-
\textcolor{red}{$\eta \gets \accUTxO(\bar{\mc S}.U)$} \;
265-
\textcolor{red}{$\eta_\alpha \gets \accUTxO(\bar{\mc S}.U_\alpha$)} \;
266-
\textcolor{red}{$\eta_\omega \gets \accUTxO(\bar{\mc S}.U_\omega)$} \;
265+
\textcolor{red}{$\eta \gets \hash(\bar{\mc S}.A)$} \;
266+
\textcolor{red}{$\eta_\alpha \gets \hash(\accUTxO(\bar{\mc S}.U_\alpha))$} \;
267+
\textcolor{red}{$\eta_\omega \gets \hash(\accUTxO(\bar{\mc S}.U_\omega))$} \;
267268
$\xi \gets \bar{\mc S}.\sigma$ \;
268269
% XXX: \hatv needed to distinguish between CloseType redeemer, explain how exactly?
269270
$\PostTx{}~(\mtxClose, \hatv, \bar{\mc S}.v, \bar{\mc S}.s, \eta , \eta_\alpha, \eta_\omega, \xi)$ \;
@@ -275,9 +276,9 @@
275276
% CLOSE TX
276277
\On{$(\gcChainClose, \eta) \lor (\gcChainContest, s_{c}, \eta)$ from chain}{
277278
\If{$\bar{\mc S}.s > s_{c}$}{
278-
\textcolor{red}{$\eta \gets \accUTxO(\bar{\mc S}.U)$} \;
279-
\textcolor{red}{$\eta_\alpha \gets \accUTxO(\bar{\mc S}.U_\alpha$)} \;
280-
\textcolor{red}{$\eta_\omega \gets \accUTxO({\bar{\mc S}.U_\omega})$} \;
279+
\textcolor{red}{$\eta \gets \hash(\bar{\mc S}.A)$} \;
280+
\textcolor{red}{$\eta_\alpha \gets \hash(\accUTxO(\bar{\mc S}.U_\alpha))$} \;
281+
\textcolor{red}{$\eta_\omega \gets \hash(\accUTxO(\bar{\mc S}.U_\omega))$} \;
281282
$\xi \gets \bar{\mc S}.\sigma$ \;
282283
% XXX: \hatv needed to distinguish between CloseType redeemer, explain how exactly?
283284
$\PostTx{}~(\mtxContest, \hatv, \bar{\mc S}.v, \bar{\mc S}.s, \eta , \eta_\alpha, \eta_\omega , \xi)$ \;

src/Hydra/Protocol/OffChain.tex

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,13 @@ \subsection{Variables}
143143
$\bar{\mc S}.U$ & snapshotted UTxO set \\ \hline
144144
$\bar{\mc S}.U_\alpha$ & pending UTxO to increment \\ \hline
145145
$\bar{\mc S}.U_\omega$ & pending UTxO to decrement \\ \hline
146+
\textcolor{red}{$\bar{\mc S}.A$} & \textcolor{red}{BLS accumulator of the UTxO set} \\ \hline
146147
$\bar{\mc S}.\sigma$ & multisignature \\ \hline
147148
\end{tabular}
148149
\end{center}
149150
\end{itemize}
150151

151-
where constructor $\text{snObj}(v, n, T, U, U_\alpha, U_\omega)$ initializes a
152+
where constructor $\text{snObj}(v, n, T, U, U_\alpha, U_\omega, \textcolor{red}{A})$ initializes a
152153
new snapshot object with $\bar{\mathcal{S}}.\sigma = \emptyset$. \\
153154

154155
Additionally, deposit objects are created using
@@ -191,7 +192,7 @@ \subsubsection{Initializing the head}
191192
$\hatv = 0$, as well as snapshot number $\hats = 0$. No deposit transaction
192193
$\tx_{\alpha} = \bot$ and no decrement transaction $\tx_{\omega} = \bot$ are
193194
pending, and the last confirmed snapshot is initialized accordingly
194-
$\bar{\mc S} \gets \blue{\Sno(0, 0, [], \Uinit, \emptyset, \emptyset)}$.
195+
$\bar{\mc S} \gets \blue{\Sno(0, 0, [], \Uinit, \emptyset, \emptyset, \accUTxO(\Uinit))}$.
195196

196197
\subsubsection{Processing transactions off-chain}
197198

@@ -287,8 +288,8 @@ \subsubsection{Processing transactions off-chain}
287288
multisignature $\msCSig$ and $\Req$ it to be valid (constructing the signed
288289
message as in $\hpRS$). If everything is fine, the snapshot can be considered
289290
confirmed by creating the snapshot object
290-
$\bar{\mc S} \gets \Sno(\hatv, \hats, \hatmT, \hatmU, U_{\alpha}, \mathsf{outputs}(\tx_{\omega}))$
291-
and storing the multi-signature $\msCSig$ in it for later reference. In case
291+
$\bar{\mc S} \gets \Sno(\hatv, \hats, \hatmT, \hatmU, U_{\alpha}, \mathsf{outputs}(\tx_{\omega}), \textcolor{red}{A})$
292+
where \textcolor{red}{$A = \accUTxO(\hatmU)$ is the accumulator of the UTxO set}, and storing the multi-signature $\msCSig$ in it for later reference. In case
292293
there is a pending decommit, any participant can now submit a \mtxDecrement{}
293294
transaction by providing the just confirmed snapshot with its digests of the
294295
active UTxO set $\eta$ and the to be removed UTxO set $\eta_{\omega}$. If, however, there

0 commit comments

Comments
 (0)