From ce6c5c36ff6d799a449d8f4ac27e4482a8182ee7 Mon Sep 17 00:00:00 2001 From: Dmitry Demin Date: Mon, 11 Nov 2024 21:27:27 +0100 Subject: [PATCH] Fix the orchard::ShieldedData serialization/deserialization functions to use the correct order of the asset burn field in V6 transaction as it's defined in ZIP 230 --- zebra-chain/src/transaction/serialize.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/zebra-chain/src/transaction/serialize.rs b/zebra-chain/src/transaction/serialize.rs index 42743881b..b3ed12ebd 100644 --- a/zebra-chain/src/transaction/serialize.rs +++ b/zebra-chain/src/transaction/serialize.rs @@ -376,13 +376,13 @@ impl ZcashSerialize for orchard::ShieldedData { // Denoted as `vSpendAuthSigsOrchard` in the spec. zcash_serialize_external_count(&sigs, &mut writer)?; - // Denoted as `bindingSigOrchard` in the spec. - self.binding_sig.zcash_serialize(&mut writer)?; - #[cfg(feature = "tx-v6")] // Denoted as `vAssetBurn` in the spec (ZIP 230). self.burn.zcash_serialize(&mut writer)?; + // Denoted as `bindingSigOrchard` in the spec. + self.binding_sig.zcash_serialize(&mut writer)?; + Ok(()) } } @@ -434,6 +434,10 @@ impl ZcashDeserialize for Option> let sigs: Vec> = zcash_deserialize_external_count(actions.len(), &mut reader)?; + // TODO: FIXME: add a proper comment + #[cfg(feature = "tx-v6")] + let burn = (&mut reader).zcash_deserialize_into()?; + // Denoted as `bindingSigOrchard` in the spec. let binding_sig: Signature = (&mut reader).zcash_deserialize_into()?; @@ -448,10 +452,6 @@ impl ZcashDeserialize for Option> let actions: AtLeastOne> = authorized_actions.try_into()?; - // TODO: FIXME: add a proper comment - #[cfg(feature = "tx-v6")] - let burn = (&mut reader).zcash_deserialize_into()?; - Ok(Some(orchard::ShieldedData:: { flags, value_balance,