Skip to content

Commit

Permalink
Reflect changes of multiple commits in specification
Browse files Browse the repository at this point in the history
The picture for commitTx was not yet updated in this.
  • Loading branch information
ch1bo committed May 25, 2023
1 parent eaec528 commit 15de32c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
42 changes: 21 additions & 21 deletions spec/onchain.tex
Expand Up @@ -127,30 +127,29 @@ \subsection{Init transaction}\label{sec:init-tx}
\subsection{Commit Transaction}\label{sec:commit-tx}

A \mtxCom{} transaction may be submitted by each participant
$\forall i \in \{1 \dots \nop\}$ to commit a UTxO into the head or acknowledge
to not commit anything. The transaction is depicted in Figure~\ref{fig:commitTx}
and has the following structure:
$\forall i \in \{1 \dots \nop\}$ to commit some UTxO into the head or
acknowledge to not commit anything. The transaction is depicted in
Figure~\ref{fig:commitTx} and has the following structure:
\begin{itemize}
\item One input spending from $\nuInitial$ with datum $\datumInitial{}$,
where value $\valInitial{i}$ holds a $\pt_i$, and the redeemer
$\redeemerInitial{} \in \tyOutRef^{?}$ is an optional output
reference to be committed,
\item zero or one input with reference $\txOutRef_{\mathsf{committed}}$
spending output $o_{\mathsf{committed}}$ with
$\val_{\mathsf{committed}}$, and
\item zero or more inputs with reference $\txOutRef_{\mathsf{committed}_{j}}$
spending output $o_{\mathsf{committed}_{j}}$ with
$\val_{\mathsf{committed}_{j}}$,
\item one output paying to $\nuCommit$ with value $\valCommit{i}$ and datum $\datumCommit{}$.
\end{itemize}

\noindent The $\nuInitial$ validator with $\datumInitial{} = \cid$ and
$\redeemerInitial{} = \txOutRef_{\mathsf{committed}}^{?}$ ensures that:
$\redeemerInitial{} = \underline{\txOutRef}_{\mathsf{committed}}$ ensures that:
\begin{menumerate}
\item Committed value is in the output
$\valCommit{i} = \valInitial{i} \cup \val_{\mathsf{committed}}$
\item Currency id and committed output are recorded in the
output datum $\datumCommit{} = (\cid, C_{i})$ where
$C_{i} = (\txOutRef_{\mathsf{committed}},\bytes(o_{\mathsf{committed}}))$ if
$\txOutRef_{\mathsf{committed}}$ was given, or $C_{i} = (\Diamond, \emptyset)$
if nothing committed.
\item All committed value is in the output
$\valCommit{i} = \valInitial{i} \cup (\bigcup_{j=1}^{m} \val_{\mathsf{committed}_{j}})$
\item Currency id and committed outputs are recorded in the output datum
$\datumCommit{} = (\cid, C_{i})$, where
$C_{i} = \forall j \in \{1 \dots m\} : [(\txOutRef_{\mathsf{committed}_{j}},\bytes(o_{\mathsf{committed}_{j}}))]$
is a list of all committed UTxO recorded as tuples on-chain.
\item Transaction is signed by the right participant
$\exists \{\cid \mapsto \keyHash_{i} \mapsto 1\} \in \valInitial{} \Rightarrow \keyHash_{i} \in \txKeys$
\item No minting or burning $\txMint = \varnothing$
Expand All @@ -166,6 +165,7 @@ \subsection{Commit Transaction}\label{sec:commit-tx}
\caption{\mtxCom{} transaction spending an initial output and a single
committed output, and producing a commit output.}\label{fig:commitTx}
\end{figure}
\todo{update with multiple commits}

\subsection{CollectCom Transaction}\label{sec:collect-tx}

Expand Down Expand Up @@ -195,16 +195,16 @@ \subsection{CollectCom Transaction}\label{sec:collect-tx}
U^{\#} = \combine([C_{1}, \dots, C_{\nop}])
\]
\[
\combine(\underline{C}) = \hash(\mathsf{concat}({\sortOn(1, \underline{C})}^{\downarrow2}))
\combine(\underline{C}) = \hash(\mathsf{concat}({\sortOn(1, \mathsf{concat}(\underline{C}))}^{\downarrow2}))
\]
% TODO: mention in off-chain that it is limited what we can fan out, so size
% & complexity of U needs to be contained, especially off-chain.
That is, given a list of commits $\underline{C}$, where each element is a
pair of an output reference and the serialised representation of what was
committed $C_{i} \in (\tyOutRef \times \tyBytes)$, $\combine$ sorts this
list by the output references, concatenates all bytes and hashes the
result\footnote{Sorting is required to ensure a canonical representation
which can also be reproduced from the UTxO set later in the fanout.}.
That is, given a list of committed UTxO $\underline{C}$, where each element is
a list of output references and the serialised representation of what was
committed, $\combine$ first concatenates all commits together, sorts this list
by the output references, concatenates all bytes and hashes the
result\footnote{Sorting is required to ensure a canonical representation which
can also be reproduced from the UTxO set later in the fanout.}.

\item All committed value captured and no value is extracted
$\valHead' = \valHead \cup (\bigcup_{i=1}^{n} \valCommit{i})$.
Expand Down
6 changes: 3 additions & 3 deletions spec/prel.tex
Expand Up @@ -43,7 +43,7 @@ \subsection{Notation}
\item Lists of values $l \in \mathcal{A}^{*}$ are written as
$l = [x_{1}, \ldots, x_{n}]$. Empty lists are denoted by $[]$, the $i$th
element $x_{i}$ is also written $l[i]$ and the length of the list is
$|l| = n$. An underscore is also used to indicate al ist of values
$|l| = n$. An underscore is also used to indicate a list of values
$\underline{x} = l$. Projection on lists are mapped to their elements,
i.e.
$\underline{x}^{\downarrow1} = [x_{1}^{\downarrow1}, \dots, x_{n}^{\downarrow1}]$.
Expand All @@ -63,7 +63,7 @@ \subsection{Public key multi-signature scheme}\label{sec:multisig}
\item $\msSig \gets \msSign(\msParams,\msSK,\msMsg)$ signs a message $\msMsg$
using key $\msSK$,
\item $\msCVK \gets \msCombVK(\msParams,\msVKL)$ aggregates a list of
verification keys $\msVKL$ into a single, aggregate key $\msCVK$,
verification keys $\msVKL$ into a single, aggregate key $\msCVK$,
\item $\msCSig \gets \msComb(\msParams,\msMsg,\msVKL,\msSigL)$ aggregates a
list of signatures $\msSigL$ about message $m$ into a single, aggregate
signature~$\msCSig$.
Expand Down Expand Up @@ -220,7 +220,7 @@ \subsubsection{Transactions}
validity bounds where $\txValidityMin <= \txValidityMax$, and
$\txKeys \in \mathcal{K}$ is the set of verification keys which signed the
transaction.
% TODO: \tyValidity undefined, define time, periods and intervals?
% TODO: \tyValidity undefined, define time, periods and intervals?
\end{definition}

Informally, scripts are evaluated by the ledger when it applies a transaction to
Expand Down

0 comments on commit 15de32c

Please sign in to comment.