Generate dummy nullifiers with the same distribution as real ones

The x-coordinates of Pallas points are not uniformly distributed base field elements.

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
str4d 2021-04-22 13:54:17 +01:00 committed by GitHub
parent dbfbc66ac7
commit 4db3b54c8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -1,4 +1,4 @@
use ff::Field;
use group::Group;
use halo2::arithmetic::CurveExt;
use pasta_curves::pallas;
use rand::RngCore;
@ -27,7 +27,7 @@ impl Nullifier {
/// Instead of explicitly sampling for a unique nullifier, we rely here on the size of
/// the base field to make the chance of sapling a colliding nullifier negligible.
pub(crate) fn dummy(rng: &mut impl RngCore) -> Self {
Nullifier(pallas::Base::random(rng))
Nullifier(extract_p(&pallas::Point::random(rng)))
}
/// $DeriveNullifier$.