Skip to content

Sapling: fix dummy address generation

Merged as part of !2712 (merged)

Context

An income viewing key (ivk) is a number between 0 and 2^251 - 1. It is encoded in little endian on 32 bytes in the code. Hence, it does require the last 5 bits (as we deal with little endianness) to be zero. The dummy address generator was setting the first 5 bits to 0. Adding tests to ivk_to_pkd at the same time as the ivk is encoded in a scalar of the Jubjub curve (which is of order prime on 252 bits).

Here the sapling spec: https://github.com/zcash/zips/blob/master/protocol/sapling.pdf

Manually testing the MR

cd src/lib_sapling && dune exec test/test_rustzcash.exe

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • Provide automatic testing (see the testing guide).
  • Add item in the Development Version section of CHANGES.md (only for new features and bug fixes).

Reviewers

@MarcBeunardeau @paracetamolo

Edited by Clément Hurlin

Merge request reports