Skip to content

Commit a116b2c

Browse files
WhatisRTJaredCorduan
authored andcommitted
Fix some issues pointed out in the Babbage audit
In particular, I've removed the rounding from checking the balancing of the collateral since if n is a natural number and x is a rational (or real) number, n >= x is equivalent to n >= ceil x. Without the rounding it's way more obvious that you can just multiply the equation by 100 without changing the semantics.
1 parent 157eed3 commit a116b2c

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

eras/babbage/formal-spec/remove-overlay.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ \section{Removal of the Overlay Schedule}
7676
'decentralized' case and drop all the unnecessary variables from its environment.
7777
It is invoked in $\mathsf{CHAIN}$, which needs to be adjusted accordingly.
7878

79-
As there is now only a singe VRF check, slight modifications are needed for the
79+
As there is now only a single VRF check, slight modifications are needed for the
8080
definition of the block header body \text{BHBody} type and the function \text{vrfChecks}.
8181
The Shelley era accessor functions $\fun{bleader}$ and $\fun{bnonce}$ are replaced with new functions
8282
which make use of the VRF range extension as described in \cite{vrf-range-extension}[4.1],
83-
to re-use the singe VRF value.
83+
to re-use the single VRF value.
8484

8585
\begin{figure*}[htb]
8686
%

eras/babbage/formal-spec/rewards.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ \section{Forgo Reward Calculation Prefilter}
2121
& ~~~\where \\
2222
& ~~~~~~~\ldots \\
2323
& ~~~~~~~\hldiff{\var{rewards}} =
24-
\var{mRewards} \cup
24+
\var{mRewards} \unionoverridePlus
2525
\{(\fun{poolRAcnt}~\var{pool})\mapsto\var{lReward}\} \\
2626
\end{align*}
2727
\caption{Reward Calculation Helper Function}

eras/babbage/formal-spec/utxo.tex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ \section{UTxO}
3333
& \fun{feesOK} : \PParams \to \Tx \to \UTxO \to \Bool \\
3434
& \fun{feesOK}~\var{pp}~tx~utxo = \\
3535
&~~ \minfee{pp}{tx} \leq \txfee{tx} \wedge (\fun{txrdmrs}~tx \neq \Nothing \Rightarrow \\
36-
&~~~~~~~~~~\forall (a, \wcard, \wcard) \in \fun{range}~(\fun{collInputs}~tx \restrictdom \var{utxo}), a \in \AddrVKey \\
36+
&~~~~~~~~~~\forall (a, \wcard, \wcard, \wcard) \in \fun{range}~(\fun{collInputs}~tx \restrictdom \var{utxo}), a \in \AddrVKey \\
3737
&~~~~~~\wedge \fun{adaOnly}~\var{balance} \\
38-
&~~~~~~\wedge \var{balance} \geq \hldiff{\lceil \txfee{txb} * \fun{collateralPercent}~pp / 100 \rceil} \\
38+
&~~~~~~\wedge \var{balance} \geq \hldiff{\txfee{txb} * \fun{collateralPercent}~pp / 100} \\
3939
&~~~~~~\wedge \hldiff{(\fun{txcoll}~tx \neq \Nothing) \Rightarrow \var{balance} = \fun{txcoll}~tx} \\
4040
&~~~~~~\wedge \fun{collInputs}~{tx} \neq \emptyset) \\
4141
&~~ \where \\
@@ -196,8 +196,8 @@ \section{UTxO}
196196
\forall txout \in \hldiff{\fun{allOuts}~txb},\\
197197
\fun{serSize}~(\fun{getValue}~txout) \leq \fun{maxValSize}~pp \\~
198198
\\
199-
\forall (\wcard\mapsto (a,~\wcard)) \in \hldiff{\fun{allOuts}~txb}, a \in \AddrBS \Rightarrow \fun{bootstrapAttrsSize}~a \leq 64 \\
200-
\forall (\wcard\mapsto (a,~\wcard)) \in \hldiff{\fun{allOuts}~txb}, \fun{netId}~a = \NetworkId
199+
\forall (\wcard\mapsto (a,~\wcard, \wcard, \wcard)) \in \hldiff{\fun{allOuts}~txb}, a \in \AddrBS \Rightarrow \fun{bootstrapAttrsSize}~a \leq 64 \\
200+
\forall (\wcard\mapsto (a,~\wcard, \wcard, \wcard)) \in \hldiff{\fun{allOuts}~txb}, \fun{netId}~a = \NetworkId
201201
\\
202202
\forall (a\mapsto\wcard) \in \txwdrls{txb}, \fun{netId}~a = \NetworkId \\
203203
(\fun{txnetworkid}~\var{txb} = \NetworkId) \vee (\fun{txnetworkid}~\var{txb} = \Nothing)
@@ -290,7 +290,7 @@ \section{UTxO}
290290
\var{inputHashes}\leteq \left\{ h \,\middle|
291291
{
292292
\begin{array}{l}
293-
(a, \_, h) \in \range(\var{utxo}|_{\fun{spendInputs}~tx}) \\
293+
(a, \_, h, \_) \in \range(\var{utxo}|_{\fun{spendInputs}~tx}) \\
294294
\fun{isTwoPhaseScriptAddress}~tx~\hldiff{utxo}~a \\
295295
\end{array}
296296
}
@@ -299,7 +299,7 @@ \section{UTxO}
299299
\forall \var{s} \in (\fun{txscripts}~txw~\hldiff{utxo~\var{neededHashes}}) \cap \ScriptPhOne,
300300
\fun{validateScript}~\var{s}~\var{tx}\\~\\
301301
\var{neededHashes} - \hldiff{\dom (\fun{refScripts}~tx~utxo)} = \dom (\fun{txwitscripts}~txw) \\~\\
302-
\var{inputHashes} \subseteq_{\{h \mid (\wcard, \wcard, h)\in\fun{allOuts}~tx \cup \hldiff{\var{utxo}~(\fun{refInputs}~{tx})}\}} \dom (\fun{txdats}~{txw}) \\~\\
302+
\var{inputHashes} \subseteq_{\{h \mid (\wcard, \wcard, h, \wcard)\in\fun{allOuts}~tx \cup \hldiff{\var{utxo}~(\fun{refInputs}~{tx})}\}} \dom (\fun{txdats}~{txw}) \\~\\
303303
\\~\\
304304
\dom (\fun{txrdmrs}~tx) = \left\{ \fun{rdptr}~txb~sp \,\middle|
305305
{

0 commit comments

Comments
 (0)