Merge pull request #176 from zcash/doc-cmx-canon

ExtractedNoteCommitment::from_bytes: Document cmx canonicity.
This commit is contained in:
str4d 2021-08-09 18:33:03 +01:00 committed by GitHub
commit c4fb1efb1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -66,6 +66,11 @@ pub struct ExtractedNoteCommitment(pub(super) pallas::Base);
impl ExtractedNoteCommitment {
/// Deserialize the extracted note commitment from a byte array.
///
/// This method enforces the [consensus rule][cmxcanon] that the
/// byte representation of cmx MUST be canonical.
///
/// [cmxcanon]: https://zips.z.cash/protocol/protocol.pdf#actionencodingandconsensus
pub fn from_bytes(bytes: &[u8; 32]) -> CtOption<Self> {
pallas::Base::from_bytes(bytes).map(ExtractedNoteCommitment)
}