Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZSA Protocol: Transfer, Issuance and Burn: ZIPs 226, 227, and 230 #960

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

This merges in the changes from upstream post the merging of our PR#854
to upstream.
This makes a few changes to the usage of terminology such as the use
of the capital MUST terms in the specification.
…ock boundary (#81)

This completes the changes needed to make sure the finalization comes
into effect immediately. A part of this was done in
#75, the remainder is covered here.

This solves zcash#958.
This removes the tables with the encoding of the issuance action
description and issuance bundle from ZIP 227. This same material has
been included in ZIP 230 as part of the V6 transaction format, and thus
it is simpler to have it defined in a single place.

ZIP 227 has been updated with references to the relevant sections of ZIP
230 where necessary.
zips/zip-0226.rst Outdated Show resolved Hide resolved
zips/zip-0227.rst Outdated Show resolved Hide resolved
zips/zip-0227.rst Outdated Show resolved Hide resolved
zips/zip-0227.rst Outdated Show resolved Hide resolved
zips/zip-0227.rst Outdated Show resolved Hide resolved
zips/zip-0227.rst Outdated Show resolved Hide resolved
This changes the encoding of the transaction format to add Action
Groups to TxV6.
The motivation is to avoid the need of a further transaction format
upgrade while introducing Asset Swaps for ZSAs in a subsequent upgrade.
It also makes some consistency improvements to the ZIPs, and updates
outdated references.
This PR adds an explicit upper bound of $$2^{64} - 1$$ to the total
supply of issued assets in the specification of ZIP 227.

It also does a major rewrite of the consensus rule changes, bringing
them more in line with the protocol specification, and using MUST
terminology where necessary.

Furthermore, these changes make explicit the order of processing fields
within a transaction, and the order of updates to the issuance state.
This PR moves the description of the fees required for OrchardZSA
issuance and transfer to ZIP 227. This is a more contextual place to
have the material, compared to ZIP 230, which specifies the V6
transaction format.
vivek-arte and others added 7 commits December 18, 2024 03:13
This updates the `zsa1` branch with the changes from upstream, and
resolves conflicts.
This adds the explicit specification (with types) for the Issue Note.
This defines a new function and uses it to derive the value of the
$\rho$ field in Issue Notes. It also updates the consensus rules
accordingly and makes some typographical improvements.
This simplifies the encoding of the $\mathsf{nf}$ argument in the
computation of $\rho$, so that it avoids the double use of
$\mathsf{LEBS2OSP(I2LEOSP(...))}$.
This adjusts the type and specification of the notes to mirror the
implementation, specifically that the Asset Base occurs in the middle of
the tuple, and not at the end.
This adds the specification of reference notes, which are to be
created at the time of first issuance of a Custom Asset. Alongside, we
also update the issuance state and consensus rules to account for these
changes.
The issuance state, that is, the $\mathsf{issued\_assets}$ map, MUST be updated by a node during the processing of any transaction that contains burn information, or an issuance bundle.
The issuance state is chained as follows:

- The issuance state for the first block post the activation of the OrchardZSA protocol is the empty map.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: The first block post the activation of the OrchardZSA protocol is the second block that could have issuance or burn actions.

Suggested change
- The issuance state for the first block post the activation of the OrchardZSA protocol is the empty map.
- The input issuance state for the activation block of the OrchardZSA protocol is the empty map.

- The $\mathsf{assetBurn}$ set MUST satisfy the consensus rules specified in ZIP 226 [#zip-0226-assetburn]_.
- It MUST be the case that for all $(\mathsf{AssetBase}, \mathsf{v}) \in \mathsf{assetBurn}$, $\mathsf{issued\_assets}_{\mathsf{OUT}}(\mathsf{AssetBase}).\mathsf{balance} \geq \mathsf{v}$. The node then MUST update $\mathsf{issued\_assets}_{\mathsf{OUT}}(\mathsf{AssetBase})$ prior to processing the issuance bundle in the following manner. For every $(\mathsf{AssetBase}, \mathsf{v}) \in \mathsf{AssetBurn}$, $\mathsf{issued\_assets}_{\mathsf{OUT}}(\mathsf{AssetBase}).\mathsf{balance} = \mathsf{issued\_assets}_{\mathsf{OUT}}(\mathsf{AssetBase}).\mathsf{balance} - \mathsf{v}$.
- Let $\mathsf{SigHash}$ be the SIGHASH transaction hash of this transaction, as defined in §4.10 of the protocol specification [#protocol-sighash]_ with the modifications described in ZIP 226 [#zip-0226-txiddigest]_, using $\mathsf{SIGHASH\_ALL}$.
- If the transaction contains an Issuance Bundle, it MUST also contain at least one OrchardZSA Action.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this currently be at least one, or exactly one?

It is necessary to ensure that the balance of any issued Custom Asset never becomes negative within a shielded pool, along the lines of ZIP 209 [#zip-0209]_.
However, unlike for the shielded ZEC pools, there is no individual transaction field that directly corresponds to both the issued and burnt amounts for a given Asset.
Therefore, we require that all nodes maintain a record of the current amount in circulation for every issued Custom Asset, and update this record based on the issuance and burn transactions processed.
This allows for efficient detection of balance violations for any Asset, in which scenario we specify a consensus rule to reject the transaction or block.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick/Optional:

Suggested change
This allows for efficient detection of balance violations for any Asset, in which scenario we specify a consensus rule to reject the transaction or block.
This allows for efficient detection of balance violations for any Asset, in which case we specify a consensus rule to reject the transaction or block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants