Skip to content

Commit

Permalink
Rename forge to mint
Browse files Browse the repository at this point in the history
  • Loading branch information
WhatisRT committed Nov 19, 2020
1 parent 9f2dcf4 commit a6e45f1
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 39 deletions.
14 changes: 7 additions & 7 deletions shelley-ma/formal-spec/mps-language.tex
Expand Up @@ -19,7 +19,7 @@ \section{Script Constructors and Evaluation}

We have updated the
$\fun{validateScripts}$ function, to allow for the validation of both the
multi-signature scripts and forging policy scripts, calling the appropriate
multi-signature scripts and minting policy scripts, calling the appropriate
evaluator for each type of script, see Figure~\ref{fig:functions-validate}.

\begin{note}
Expand Down Expand Up @@ -108,9 +108,9 @@ \section{Script Constructors and Evaluation}
% & \text {checks the msig script}\\~\\
% %
% & \fun{evalFPS}
% ~\type{DoForge}~\var{pid}~ \var{slot}~\var{vhks} ~\var{txb}~\var{spentouts} \\
% &~~~~ =~ \var{pid} \notin \dom~(\fun{forge}~\var{txb}) \\
% & \text {checks that script hash of this script is not an asset ID being forged by tx} \\~\\
% ~\type{DoMint}~\var{pid}~ \var{slot}~\var{vhks} ~\var{txb}~\var{spentouts} \\
% &~~~~ =~ \var{pid} \notin \dom~(\fun{mint}~\var{txb}) \\
% & \text {checks that script hash of this script is not an asset ID being minted by tx} \\~\\
% %
% & \fun{evalFPS}
% ~\type{SignedByPIDToken}~\var{pid}~ \var{slot}~\var{vhks} ~\var{txb}~\var{spentouts} \\
Expand Down Expand Up @@ -180,12 +180,12 @@ \section{Script Constructors and Evaluation}
% & \fun{whitelist} \in\ScriptMSig\to\Script \\~\\
% %
% & \type{whitelist} ~\var{msig}~ =~ \type{RequireOr}~
% (\type{RequireAll}~(\type{DoForge};~\type{JustMSig}~\var{msig});~\\
% (\type{RequireAll}~(\type{DoMint};~\type{JustMSig}~\var{msig});~\\
% &~~~~~~ \type{RequireAll}~(\type{AssetToAddress}~\Nothing~\Nothing ;\\
% &~~~~~~ (\type{Not}~\type{DoForge});~\type{SignedByPIDToken})) \\
% &~~~~~~ (\type{Not}~\type{DoMint});~\type{SignedByPIDToken})) \\
% %
% & \text{msig is some MSig script containing signatures of some accreditation authority} \\
% & \text{i.e. this authority can do any forging or spending of this token} \\~\\
% & \text{i.e. this authority can do any minting or spending of this token} \\~\\
% %
% & (\fun{hashScript}~(\type{SpendsCur}~(\fun{hashScript}~(\type{whitelist}~\var{msig}))),~ \var{tkns}) \\
% & \text{an example of an output spending which requires to be on a whitelist made by msig authority}
Expand Down
24 changes: 12 additions & 12 deletions shelley-ma/formal-spec/transactions.tex
Expand Up @@ -29,7 +29,7 @@
& \powerset{\TxIn} & \fun{txinputs}& \text{inputs}\\
&\times ~(\Ix \mapsto \TxOut) & \fun{txouts}& \text{outputs}\\
& \times~ \seqof{\DCert} & \fun{txcerts}& \text{certificates}\\
& \times ~\hldiff{\Value} & \hldiff{\fun{forge}} &\text{value forged}\\
& \times ~\hldiff{\Value} & \hldiff{\fun{mint}} &\text{value minted}\\
& \times ~\Coin & \fun{txfee} &\text{non-script fee}\\
& \times ~\hldiff{\Slot^? \times \Slot^?} & \hldiff{\fun{txvldt}} & \text{validity interval}\\
& \times~ \Wdrl & \fun{txwdrls} &\text{reward withdrawals}\\
Expand Down Expand Up @@ -80,29 +80,29 @@ \subsection*{New Script Type}
\item output-locking scripts,
\item certificate validation,
\item reward withdrawals, or
\item as forging scripts (see below).
\item as minting scripts (see below).
\end{itemize}

\subsection*{The Forge Field}
\subsection*{The Mint Field}

The body of a transaction with multi-asset support contains one additional
field, the $\fun{forge}$ field.
The $\fun{forge}$ field is a term of type $\Value$, which contains
field, the $\fun{mint}$ field.
The $\fun{mint}$ field is a term of type $\Value$, which contains
tokens the transaction is putting into or taking out of
circulation. Here, by "circulation", we mean specifically "the UTxO on the
ledger". Since the administrative fields cannot contain tokens other than Ada,
and Ada cannot be forged (this is enforced by the UTxO rule, see Figure~\ref{fig:rules:utxo-shelley}),
they are not affected in any way by forging.
and Ada cannot be minted (this is enforced by the UTxO rule, see Figure~\ref{fig:rules:utxo-shelley}),
they are not affected in any way by minting.

Putting tokens into circulation is done with positive values in the $\Quantity$
fields $\fun{forge}$ field, and taking tokens out of circulation can be done
fields $\fun{mint}$ field, and taking tokens out of circulation can be done
with negative quantities.

A transaction cannot simply forge arbitrary tokens. Restrictions on
A transaction cannot simply mint arbitrary tokens. Restrictions on
Multi-Asset tokens are imposed, for each asset with ID $\var{pid}$, by a script
with the hash $\var{pid}$. Whether a given transaction adheres to the restrictions
prescribed by its script is verified as part of the processing of the transaction.
The forging mechanism is detailed in Section~\ref{sec:utxo}.
The minting mechanism is detailed in Section~\ref{sec:utxo}.

\subsection*{Transaction Body}

Expand All @@ -111,12 +111,12 @@ \subsection*{Transaction Body}
\begin{itemize}
\item a change in the type of $\TxOut$ --- instead of
$\Coin$, the transaction outputs now have type $\Value$.
\item the addition of the $\fun{forge}$ field to the transaction body
\item the addition of the $\fun{mint}$ field to the transaction body
\item the time-to-live slot number (which had the accessor $\fun{txttl}$),
has been replaced with a validity interval with accessor $\fun{txvldt}$,
both endpoints of which are optional
\end{itemize}

The only change to the types related to transaction witnessing is the addition
of forging policy scripts to the underlying $\Script$ type, so we do not include the
of minting policy scripts to the underlying $\Script$ type, so we do not include the
whole $\Tx$ type here.
38 changes: 19 additions & 19 deletions shelley-ma/formal-spec/utxo.tex
Expand Up @@ -38,7 +38,7 @@ \subsection*{UTxO Helper Functions}
\begin{align*}
& \fun{consumed} \in \PParams \to \UTxO \to \TxBody \to \hldiff{\Value} \\
& \consumed{pp}{utxo}{txb} = \\
& ~~\ubalance{(\txins{txb} \restrictdom \var{utxo})} ~+~ \hldiff{\fun{forge}~\var{txb}} \\
& ~~\ubalance{(\txins{txb} \restrictdom \var{utxo})} ~+~ \hldiff{\fun{mint}~\var{txb}} \\
&~~+~\hldiff{\fun{coinToValue}}(\fun{wbalance}~(\fun{txwdrls}~{txb})~+~ \keyRefunds{pp}{txb})
\nextdef
& \fun{produced} \in \PParams \to \StakePools \to \TxBody \to \hldiff{\Value} \\
Expand Down Expand Up @@ -70,38 +70,38 @@ \subsection*{UTxO Helper Functions}
\item The $\fun{consumed}$ and $\fun{produced}$ calculations are similar to their Shelley
counterparts, with the following changes: 1) They return elements of $\Value$, which
the administrative fields of type $\Coin$ have to be converted to, via $\fun{coinToValue}$.
2) $\fun{consumed}$ also contains the $\fun{forge}$ field of the transaction.
2) $\fun{consumed}$ also contains the $\fun{mint}$ field of the transaction.
This is explained below.
\end{itemize}

\subsection*{Forging and the Preservation of Value}
\subsection*{Minting and the Preservation of Value}
What does it mean to preserve the value of non-Ada tokens, since they
are put in and taken out of circulation by the users themselves?

For the following discussion, we focus on a single arbitrary
$\var{pid}$ that is not $\mathsf{adaPolicy}$. If a transaction $\var{tx}$
does not forge any tokens with policy ID $\var{pid}$, the preservation
does not mint any tokens with policy ID $\var{pid}$, the preservation
of value reduces to an equation that the sum of inputs and the sum of
outputs are equal, which is exactly the same condition as for Shelley,
except that there are no administrative fields. If a transactions
forges tokens of that policy ID, then the sum of inputs and the sum of
mints tokens of that policy ID, then the sum of inputs and the sum of
outputs will differ, and that difference has to be exactly the value
of the $\fun{forge}$ field. Note that this means that the
$\fun{forge}$ field can also contain negative quantities.
of the $\fun{mint}$ field. Note that this means that the
$\fun{mint}$ field can also contain negative quantities.

To balance the preservation of value equation, the $\fun{forge}$ field
To balance the preservation of value equation, the $\fun{mint}$ field
could be included in either $\fun{consumed}$ or $\fun{produced}$, with
the only difference being the sign of the $\fun{forge}$ field. We
the only difference being the sign of the $\fun{mint}$ field. We
include it on the $\fun{consumed}$ side, because this means that
forging a positive quantity increases the amount of tokens on the
ledger, and forging a negative quantity reduces the amount of tokens on
minting a positive quantity increases the amount of tokens on the
ledger, and minting a negative quantity reduces the amount of tokens on
the ledger.

Note that the UTXO rule specifically forbids the forging of Ada, and
Note that the UTXO rule specifically forbids the minting of Ada, and
thus in the case of Ada, the preservation of value equation is exactly
the same as in Shelley.

The forging scripts themselves are not evaluated at part of the UTXO, but instead
The minting scripts themselves are not evaluated at part of the UTXO, but instead
as part of witnessing, i.e. in the UTXOW rule, see Figure~\ref{fig:functions-witnesses}.

\subsection*{The UTXO Transition Rule}
Expand All @@ -114,9 +114,9 @@ \subsection*{The UTXO Transition Rule}
slot is replaced with the check that the current slot is inside the validity interval

\item In the preservation of value calculation (which looks the same as in
Shelley), the value in the $\fun{forge}$ field is taken into account.
Shelley), the value in the $\fun{mint}$ field is taken into account.

\item The transaction is not forging any Ada.
\item The transaction is not minting any Ada.

\item The $\Value$ of each output is constrained from below by a
$\Value$ that contains the product of $\var{adaPerUTxOByte}$ and the
Expand Down Expand Up @@ -155,7 +155,7 @@ \subsection*{The UTXO Transition Rule}
\\
~
\\
\hldiff{\mathsf{adaPolicy}~\notin \supp{\fun{forge}~txb}} \\
\hldiff{\mathsf{adaPolicy}~\notin \supp{\fun{mint}~txb}} \\
~\\
\hldiff{\forall txout \in \txouts{txb},} \\
\hldiff{txout \geq \fun{coinToValue}(\fun{outputSize}~{txout} * \fun{adaPerUTxOByte}~pp)} \\~
Expand Down Expand Up @@ -217,7 +217,7 @@ \subsection*{Witnessing}
\cup & ~~\{ \fun{stakeCred_{r}}~\var{a} \mid a \in \dom (\AddrRWDScr
\restrictdom \fun{txwdrls}~\var{txb}) \} \\
\cup & ~~(\AddrScr \cap \fun{certWitsNeeded}~{txb}) \\
\cup & ~~\hldiff{\supp~(\fun{forge}~\var{txb})} \\
\cup & ~~\hldiff{\supp~(\fun{mint}~\var{txb})} \\
& \where \\
& ~~~~~~~ \var{txb}~=~\txbody{tx}
\end{align*}
Expand All @@ -227,7 +227,7 @@ \subsection*{Witnessing}

Figure~\ref{fig:functions-witnesses} contains the changed definition
of the function $\fun{scriptsNeeded}$, to also collect the scripts
necessary for forging.
necessary for minting.

Recall here that the $\Script$ type has changed to include
not just multi-signature script type $\ScriptMSig$, but also another native (i.e. evaluated
Expand All @@ -238,6 +238,6 @@ \subsection*{Witnessing}

Note that, same as in Shelley, the validation function called by the
UTXOW rule, which checks a given script, does not know the purpose of the script
(forging, output-locking, etc.).
(minting, output-locking, etc.).
All scripts are run in the same way, with $\fun{validateScript}$ being responsible
for calling the evaluator appropriate for the specific type of script.
2 changes: 1 addition & 1 deletion shelley-ma/formal-spec/value.tex
Expand Up @@ -86,7 +86,7 @@ \subsection*{Representing Multi-asset Types and Values}
\emph{token bundles}.

\item $\mathsf{adaPolicy}$ and $\mathsf{adaName}$ are the $\PolicyID$ and $\AssetName$ of Ada respectively.
It is not possible to forge any token with the $\PolicyID$ $\mathsf{adaPolicy}$, which means that every
It is not possible to mint any token with the $\PolicyID$ $\mathsf{adaPolicy}$, which means that every
token in the UTxO belonging to $\mathsf{adaPolicy}$ will have $\AssetName$ $\mathsf{adaName}$.

\item $\fun{coinToValue}$ and $\fun{valueToCoin}$ convert between the two types,
Expand Down

0 comments on commit a6e45f1

Please sign in to comment.