From 7c83d6d6766cc996a8eafbb7d6b7d39e3b7362fa Mon Sep 17 00:00:00 2001 From: Taylor Hornby Date: Thu, 5 May 2022 12:37:43 -0600 Subject: [PATCH 1/2] Label consensus rules in orchard --- src/bundle.rs | 2 ++ src/bundle/batch.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/bundle.rs b/src/bundle.rs index c70ca635..fab0c700 100644 --- a/src/bundle.rs +++ b/src/bundle.rs @@ -111,6 +111,7 @@ impl Flags { /// /// [txencoding]: https://zips.z.cash/protocol/protocol.pdf#txnencoding pub fn from_byte(value: u8) -> Option { + // TCR:bad-txns-v5-reserved-bits-nonzero if value & FLAGS_EXPECTED_UNSET == 0 { Some(Self::from_parts( value & FLAG_SPENDS_ENABLED != 0, @@ -371,6 +372,7 @@ impl> Bundle { /// This can be used to validate the [`Authorized::binding_signature`] returned from /// [`Bundle::authorization`]. pub fn binding_validating_key(&self) -> redpallas::VerificationKey { + // *TCR:bad-txns-orchard-binding-signature-invalid (self .actions .iter() diff --git a/src/bundle/batch.rs b/src/bundle/batch.rs index c60d0cd5..b41a96fd 100644 --- a/src/bundle/batch.rs +++ b/src/bundle/batch.rs @@ -67,6 +67,8 @@ impl BatchValidator { /// figure out which of the accumulated bundles might be invalid; if that information /// is desired, construct separate [`BatchValidator`]s for sub-batches of the bundles. pub fn validate(self, vk: &VerifyingKey, rng: R) -> bool { + // *TCR:bad-txns-orchard-binding-signature-invalid + if self.signatures.is_empty() { // An empty batch is always valid, but is not free to run; skip it. // Note that a transaction has at least a binding signature, so if From 2d15aeaa6950a30899374fa36fa1bf65cdf9c001 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Thu, 21 Jul 2022 21:43:00 +0100 Subject: [PATCH 2/2] Update to new annotation syntax. Signed-off-by: Daira Hopwood --- src/bundle.rs | 4 ++-- src/bundle/batch.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bundle.rs b/src/bundle.rs index fab0c700..98c1bd49 100644 --- a/src/bundle.rs +++ b/src/bundle.rs @@ -111,7 +111,7 @@ impl Flags { /// /// [txencoding]: https://zips.z.cash/protocol/protocol.pdf#txnencoding pub fn from_byte(value: u8) -> Option { - // TCR:bad-txns-v5-reserved-bits-nonzero + // https://p.z.cash/TCR:bad-txns-v5-reserved-bits-nonzero if value & FLAGS_EXPECTED_UNSET == 0 { Some(Self::from_parts( value & FLAG_SPENDS_ENABLED != 0, @@ -372,7 +372,7 @@ impl> Bundle { /// This can be used to validate the [`Authorized::binding_signature`] returned from /// [`Bundle::authorization`]. pub fn binding_validating_key(&self) -> redpallas::VerificationKey { - // *TCR:bad-txns-orchard-binding-signature-invalid + // https://p.z.cash/TCR:bad-txns-orchard-binding-signature-invalid?partial (self .actions .iter() diff --git a/src/bundle/batch.rs b/src/bundle/batch.rs index b41a96fd..6626b916 100644 --- a/src/bundle/batch.rs +++ b/src/bundle/batch.rs @@ -67,7 +67,7 @@ impl BatchValidator { /// figure out which of the accumulated bundles might be invalid; if that information /// is desired, construct separate [`BatchValidator`]s for sub-batches of the bundles. pub fn validate(self, vk: &VerifyingKey, rng: R) -> bool { - // *TCR:bad-txns-orchard-binding-signature-invalid + // https://p.z.cash/TCR:bad-txns-orchard-binding-signature-invalid?partial if self.signatures.is_empty() { // An empty batch is always valid, but is not free to run; skip it.