Document the consensus rules for Section 3.6 (#3338)
This commit is contained in:
parent
9101e9a815
commit
a1f4cec0de
|
@ -171,6 +171,20 @@ impl ZcashSerialize for Spend<PerSpendAnchor> {
|
|||
}
|
||||
|
||||
impl ZcashDeserialize for Spend<PerSpendAnchor> {
|
||||
/// # Consensus
|
||||
///
|
||||
/// > The anchor of each Spend description MUST refer to some earlier
|
||||
/// > block’s final Sapling treestate. The anchor is encoded separately in
|
||||
/// > each Spend description for v4 transactions, or encoded once and shared
|
||||
/// > between all Spend descriptions in a v5 transaction.
|
||||
///
|
||||
/// <https://zips.z.cash/protocol/protocol.pdf#spendsandoutputs>
|
||||
///
|
||||
/// This rule is also implemented in
|
||||
/// [`zebra_state::service::check::anchor`] and
|
||||
/// [`zebra_chain::transaction::serialize`].
|
||||
///
|
||||
/// The "anchor encoding for v4 transactions" is implemented here.
|
||||
fn zcash_deserialize<R: io::Read>(mut reader: R) -> Result<Self, SerializationError> {
|
||||
Ok(Spend {
|
||||
cv: commitment::NotSmallOrderValueCommitment::zcash_deserialize(&mut reader)?,
|
||||
|
|
|
@ -224,6 +224,21 @@ impl ZcashDeserialize for Option<sapling::ShieldedData<SharedAnchor>> {
|
|||
.collect();
|
||||
|
||||
// Create transfers
|
||||
//
|
||||
// # Consensus
|
||||
//
|
||||
// > The anchor of each Spend description MUST refer to some earlier
|
||||
// > block’s final Sapling treestate. The anchor is encoded separately
|
||||
// > in each Spend description for v4 transactions, or encoded once and
|
||||
// > shared between all Spend descriptions in a v5 transaction.
|
||||
//
|
||||
// <https://zips.z.cash/protocol/protocol.pdf#spendsandoutputs>
|
||||
//
|
||||
// This rule is also implemented in
|
||||
// [`zebra_state::service::check::anchor`] and
|
||||
// [`zebra_chain::sapling::spend`].
|
||||
//
|
||||
// The "anchor encoding for v5 transactions" is implemented here.
|
||||
let transfers = match shared_anchor {
|
||||
Some(shared_anchor) => sapling::TransferData::SpendsAndMaybeOutputs {
|
||||
shared_anchor,
|
||||
|
|
|
@ -798,6 +798,13 @@ where
|
|||
|
||||
let bvk = orchard_shielded_data.binding_verification_key();
|
||||
|
||||
// # Consensus
|
||||
//
|
||||
// > The Spend transfers and Action transfers of a transaction MUST be
|
||||
// > consistent with its vbalanceSapling value as specified in § 4.13
|
||||
// > ‘Balance and Binding Signature (Sapling)’ on p. 49.
|
||||
//
|
||||
// <https://zips.z.cash/protocol/protocol.pdf#spendsandoutputs>
|
||||
async_checks.push(
|
||||
primitives::redpallas::VERIFIER
|
||||
.clone()
|
||||
|
|
Loading…
Reference in New Issue