From cc5b418497e757c7f309ba35e74950cffa714d6f Mon Sep 17 00:00:00 2001 From: Vivek Arte <46618816+vivek-arte@users.noreply.github.com> Date: Tue, 4 Feb 2025 23:47:17 +0530 Subject: [PATCH] Moving the Burn information into the Action Group (#97) This shifts the information pertaining to the burning of assets into the OrchardZSA Action Group -- this occurs both in the Transaction Format and the computation of the TxID digest. --- rendered/zip-0226.html | 44 ++++++++++++++++++------------------------ rendered/zip-0230.html | 26 ++++++++++++------------- zips/zip-0226.rst | 32 +++++++++++------------------- zips/zip-0230.rst | 12 ++++++------ 4 files changed, 49 insertions(+), 65 deletions(-) diff --git a/rendered/zip-0226.html b/rendered/zip-0226.html index 5a48dc80b..df0e652d3 100644 --- a/rendered/zip-0226.html +++ b/rendered/zip-0226.html @@ -474,7 +474,6 @@

The

T.4: orchard_digest

When OrchardZSA Actions Groups are present in the transaction, this digest is a BLAKE2b-256 hash of the following values:

T.4a: orchard_action_groups_digest   (32-byte hash output)          [ADDED FOR ZSA]
-T.4b: orchard_zsa_burn_digest        (32-byte hash output)          [ADDED FOR ZSA]
 T.4c: valueBalanceOrchard            (64-bit signed little-endian)

The personalization field of this hash is the same as in ZIP 244 15

"ZTxIdOrchardHash"
@@ -482,12 +481,13 @@

The
BLAKE2b-256("ZTxIdOrchardHash", [])
T.4a: orchard_action_groups_digest

A BLAKE2b-256 hash of the subset of OrchardZSA Action Groups information for all OrchardZSA Action Groups belonging to the transaction. For each Action Group, the following elements are included in the hash:

-
T.4a.i  : orchard_actions_compact_digest      (32-byte hash output)
-T.4a.ii : orchard_actions_memos_digest        (32-byte hash output)
-T.4a.iii: orchard_actions_noncompact_digest   (32-byte hash output)
-T.4a.iv : flagsOrchard                        (1 byte)
-T.4a.v  : anchorOrchard                       (32 bytes)
-T.4a.vi : nAGExpiryHeight                     (4 bytes)
+
T.4a.i   : orchard_actions_compact_digest      (32-byte hash output)
+T.4a.ii  : orchard_actions_memos_digest        (32-byte hash output)
+T.4a.iii : orchard_actions_noncompact_digest   (32-byte hash output)
+T.4a.iv  : orchard_zsa_burn_digest             (32-byte hash output)
+T.4a.v   : flagsOrchard                        (1 byte)
+T.4a.vi  : anchorOrchard                       (32 bytes)
+T.4a.vii : nAGExpiryHeight                     (4 bytes)

The personalization field of this hash is set to:

"ZTxIdOrcActGHash"
T.4a.i: orchard_actions_compact_digest
@@ -514,24 +514,18 @@

The

The personalization field of this hash is defined identically to ZIP 244:

"ZTxIdOrcActNHash"

-
-
T.4b: orchard_zsa_burn_digest
-

A BLAKE2b-256 hash of the data from the burn fields of the transaction. For each tuple in the - \(\mathsf{assetBurn}\) - set, the following elements are included in the hash:

-
T.4b.i : assetBase    (field encoding bytes)
-T.4b.ii: valueBurn    (field encoding bytes)
-

The personalization field of this hash is set to:

-
"ZTxIdOrcBurnHash"
-

In case the transaction does not perform the burning of any Assets (i.e. the - \(\mathsf{assetBurn}\) - set is empty), the ''orchard_zsa_burn_digest'' is:

-
BLAKE2b-256("ZTxIdOrcBurnHash", [])
-
T.4b.i: assetBase
-

The Asset Base being burnt encoded as the 32-byte representation of a point on the Pallas curve.

-
-
T.4b.ii: valueBurn
-

Value of the Asset Base being burnt encoded as little-endian 8-byte representation of 64-bit unsigned integer (e.g. u64 in Rust) raw value.

+
T.4a.iv: orchard_zsa_burn_digest
+

A BLAKE2b-256 hash of the data from the burn fields of the transaction. For each tuple in the + \(\mathsf{assetBurn}\) + set, the following elements are included in the hash:

+
T.4a.iv.1 : assetBase    (field encoding bytes)
+T.4a.iv.2 : valueBurn    (field encoding bytes)
+

The personalization field of this hash is set to:

+
"ZTxIdOrcBurnHash"
+

In case the transaction does not perform the burning of any Assets (i.e. the + \(\mathsf{assetBurn}\) + set is empty), the ''orchard_zsa_burn_digest'' is:

+
BLAKE2b-256("ZTxIdOrcBurnHash", [])
diff --git a/rendered/zip-0230.html b/rendered/zip-0230.html index c10ed734c..9ae8b7b18 100644 --- a/rendered/zip-0230.html +++ b/rendered/zip-0230.html @@ -232,18 +232,6 @@ int64 The net value of Orchard spends minus outputs. - - varies - nAssetBurn - compactSize - The number of Assets burnt. - - - 40 * nAssetBurn - vAssetBurn - AssetBurn[nAssetBurn] - A sequence of Asset Burn descriptions, encoded per OrchardZSA Asset Burn Description. - 64 bindingSigOrchard @@ -448,9 +436,21 @@ byte[64 * nActionsOrchard] Authorizing signatures for each Action of the Action Group in a transaction. + + varies + nAssetBurn + compactSize + The number of Assets burnt. + + + 40 * nAssetBurn + vAssetBurn + AssetBurn[nAssetBurn] + A sequence of Asset Burn descriptions, encoded per OrchardZSA Asset Burn Description. + -

The encoding of OrchardZSAAction is described below.

+

The encodings of OrchardZSAAction and AssetBurn are described below.

  • The proofs aggregated in proofsOrchardZSA, and the elements of vSpendAuthSigsOrchard, each have a 1:1 correspondence to the elements of vActionsOrchard and MUST be ordered such that the proof or signature at a given index corresponds to the OrchardZSAAction at the same index.
diff --git a/zips/zip-0226.rst b/zips/zip-0226.rst index 99403c73a..9ee04c57f 100644 --- a/zips/zip-0226.rst +++ b/zips/zip-0226.rst @@ -368,7 +368,6 @@ T.4: orchard_digest When OrchardZSA Actions Groups are present in the transaction, this digest is a BLAKE2b-256 hash of the following values:: T.4a: orchard_action_groups_digest (32-byte hash output) [ADDED FOR ZSA] - T.4b: orchard_zsa_burn_digest (32-byte hash output) [ADDED FOR ZSA] T.4c: valueBalanceOrchard (64-bit signed little-endian) The personalization field of this hash is the same as in ZIP 244 [#zip-0244]_ :: @@ -385,12 +384,13 @@ T.4a: orchard_action_groups_digest A BLAKE2b-256 hash of the subset of OrchardZSA Action Groups information for all OrchardZSA Action Groups belonging to the transaction. For each Action Group, the following elements are included in the hash:: - T.4a.i : orchard_actions_compact_digest (32-byte hash output) - T.4a.ii : orchard_actions_memos_digest (32-byte hash output) - T.4a.iii: orchard_actions_noncompact_digest (32-byte hash output) - T.4a.iv : flagsOrchard (1 byte) - T.4a.v : anchorOrchard (32 bytes) - T.4a.vi : nAGExpiryHeight (4 bytes) + T.4a.i : orchard_actions_compact_digest (32-byte hash output) + T.4a.ii : orchard_actions_memos_digest (32-byte hash output) + T.4a.iii : orchard_actions_noncompact_digest (32-byte hash output) + T.4a.iv : orchard_zsa_burn_digest (32-byte hash output) + T.4a.v : flagsOrchard (1 byte) + T.4a.vi : anchorOrchard (32 bytes) + T.4a.vii : nAGExpiryHeight (4 bytes) The personalization field of this hash is set to:: @@ -447,14 +447,14 @@ The personalization field of this hash is defined identically to ZIP 244:: "ZTxIdOrcActNHash" -T.4b: orchard_zsa_burn_digest -''''''''''''''''''''''''''''' +T.4a.iv: orchard_zsa_burn_digest +................................ A BLAKE2b-256 hash of the data from the burn fields of the transaction. For each tuple in the $\mathsf{assetBurn}$ set, the following elements are included in the hash:: - T.4b.i : assetBase (field encoding bytes) - T.4b.ii: valueBurn (field encoding bytes) + T.4a.iv.1 : assetBase (field encoding bytes) + T.4a.iv.2 : valueBurn (field encoding bytes) The personalization field of this hash is set to:: @@ -465,16 +465,6 @@ $\mathsf{assetBurn}$ set is empty), the ''orchard_zsa_burn_digest'' is:: BLAKE2b-256("ZTxIdOrcBurnHash", []) -T.4b.i: assetBase -................. -The Asset Base being burnt encoded as the 32-byte representation of a point on the -Pallas curve. - -T.4b.ii: valueBurn -.................. -Value of the Asset Base being burnt encoded as little-endian 8-byte representation -of 64-bit unsigned integer (e.g. u64 in Rust) raw value. - T.5: issuance_digest ```````````````````` diff --git a/zips/zip-0230.rst b/zips/zip-0230.rst index df7948497..0a213531f 100644 --- a/zips/zip-0230.rst +++ b/zips/zip-0230.rst @@ -178,11 +178,6 @@ Transaction Format +------------------------------------+--------------------------+--------------------------------------------------+---------------------------------------------------------------------------+ |``8`` |``valueBalanceOrchard`` |``int64`` |The net value of Orchard spends minus outputs. | +------------------------------------+--------------------------+--------------------------------------------------+---------------------------------------------------------------------------+ -| ``varies`` | ``nAssetBurn`` | ``compactSize`` | The number of Assets burnt. | -+------------------------------------+--------------------------+--------------------------------------------------+---------------------------------------------------------------------------+ -| ``40 * nAssetBurn`` | ``vAssetBurn`` | ``AssetBurn[nAssetBurn]`` | A sequence of Asset Burn descriptions, | -| | | | encoded per `OrchardZSA Asset Burn Description`_. | -+------------------------------------+--------------------------+--------------------------------------------------+---------------------------------------------------------------------------+ |``64`` |``bindingSigOrchard`` |``byte[64]`` |An OrchardZSA binding signature on the SIGHASH transaction hash. | +------------------------------------+--------------------------+--------------------------------------------------+---------------------------------------------------------------------------+ | **OrchardZSA Issuance Fields** | @@ -300,8 +295,13 @@ The OrchardZSA Action Group Description is encoded in a transaction as an instan |``64 * nActionsOrchard`` |``vSpendAuthSigsOrchard`` |``byte[64 * nActionsOrchard]`` |Authorizing signatures for each Action of the Action Group in a | | | | |transaction. | +------------------------------------+--------------------------+--------------------------------------------------+---------------------------------------------------------------------+ +| ``varies`` | ``nAssetBurn`` | ``compactSize`` | The number of Assets burnt. | ++------------------------------------+--------------------------+--------------------------------------------------+---------------------------------------------------------------------+ +| ``40 * nAssetBurn`` | ``vAssetBurn`` | ``AssetBurn[nAssetBurn]`` | A sequence of Asset Burn descriptions, encoded per | +| | | | `OrchardZSA Asset Burn Description`_. | ++------------------------------------+--------------------------+--------------------------------------------------+---------------------------------------------------------------------+ -The encoding of ``OrchardZSAAction`` is described below. +The encodings of ``OrchardZSAAction`` and ``AssetBurn`` are described below. * The proofs aggregated in ``proofsOrchardZSA``, and the elements of ``vSpendAuthSigsOrchard``, each have a 1:1 correspondence to the elements of