@@ -55,7 +55,7 @@ pub fn merkle_hash(depth: usize, lhs: &[u8; 32], rhs: &[u8; 32]) -> [u8; 32] {
55
55
tmp
56
56
} ;
57
57
58
- jubjub :: ExtendedPoint :: from ( pedersen_hash (
58
+ ironfish_jubjub :: ExtendedPoint :: from ( pedersen_hash (
59
59
Personalization :: MerkleTree ( depth) ,
60
60
lhs. iter ( )
61
61
. copied ( )
@@ -134,7 +134,7 @@ lazy_static! {
134
134
/// Create the spendAuthSig for a Sapling SpendDescription.
135
135
pub fn spend_sig < R : RngCore + CryptoRng > (
136
136
ask : PrivateKey ,
137
- ar : jubjub :: Fr ,
137
+ ar : ironfish_jubjub :: Fr ,
138
138
sighash : & [ u8 ; 32 ] ,
139
139
rng : & mut R ,
140
140
) -> Signature {
@@ -143,7 +143,7 @@ pub fn spend_sig<R: RngCore + CryptoRng>(
143
143
144
144
pub ( crate ) fn spend_sig_internal < R : RngCore > (
145
145
ask : PrivateKey ,
146
- ar : jubjub :: Fr ,
146
+ ar : ironfish_jubjub :: Fr ,
147
147
sighash : & [ u8 ; 32 ] ,
148
148
rng : & mut R ,
149
149
) -> Signature {
@@ -165,20 +165,20 @@ pub(crate) fn spend_sig_internal<R: RngCore>(
165
165
#[ derive( Clone ) ]
166
166
pub struct ValueCommitment {
167
167
pub value : u64 ,
168
- pub randomness : jubjub :: Fr ,
168
+ pub randomness : ironfish_jubjub :: Fr ,
169
169
}
170
170
171
171
impl ValueCommitment {
172
- pub fn commitment ( & self ) -> jubjub :: SubgroupPoint {
173
- ( * constants:: VALUE_COMMITMENT_VALUE_GENERATOR * jubjub :: Fr :: from ( self . value ) )
172
+ pub fn commitment ( & self ) -> ironfish_jubjub :: SubgroupPoint {
173
+ ( * constants:: VALUE_COMMITMENT_VALUE_GENERATOR * ironfish_jubjub :: Fr :: from ( self . value ) )
174
174
+ ( * constants:: VALUE_COMMITMENT_RANDOMNESS_GENERATOR * self . randomness )
175
175
}
176
176
}
177
177
178
178
#[ derive( Clone ) ]
179
179
pub struct ProofGenerationKey {
180
- pub ak : jubjub :: SubgroupPoint ,
181
- pub nsk : jubjub :: Fr ,
180
+ pub ak : ironfish_jubjub :: SubgroupPoint ,
181
+ pub nsk : ironfish_jubjub :: Fr ,
182
182
}
183
183
184
184
impl ProofGenerationKey {
@@ -192,12 +192,12 @@ impl ProofGenerationKey {
192
192
193
193
#[ derive( Debug , Clone ) ]
194
194
pub struct ViewingKey {
195
- pub ak : jubjub :: SubgroupPoint ,
196
- pub nk : jubjub :: SubgroupPoint ,
195
+ pub ak : ironfish_jubjub :: SubgroupPoint ,
196
+ pub nk : ironfish_jubjub :: SubgroupPoint ,
197
197
}
198
198
199
199
impl ViewingKey {
200
- pub fn rk ( & self , ar : jubjub :: Fr ) -> jubjub :: SubgroupPoint {
200
+ pub fn rk ( & self , ar : ironfish_jubjub :: Fr ) -> ironfish_jubjub :: SubgroupPoint {
201
201
self . ak + * constants:: SPENDING_KEY_GENERATOR * ar
202
202
}
203
203
@@ -217,7 +217,7 @@ impl ViewingKey {
217
217
// Drop the most significant five bits, so it can be interpreted as a scalar.
218
218
h[ 31 ] &= 0b0000_0111 ;
219
219
220
- SaplingIvk ( jubjub :: Fr :: from_repr ( h) . unwrap ( ) )
220
+ SaplingIvk ( ironfish_jubjub :: Fr :: from_repr ( h) . unwrap ( ) )
221
221
}
222
222
223
223
pub fn to_payment_address ( & self , diversifier : Diversifier ) -> Option < PaymentAddress > {
@@ -226,7 +226,7 @@ impl ViewingKey {
226
226
}
227
227
228
228
#[ derive( Debug , Clone ) ]
229
- pub struct SaplingIvk ( pub jubjub :: Fr ) ;
229
+ pub struct SaplingIvk ( pub ironfish_jubjub :: Fr ) ;
230
230
231
231
impl SaplingIvk {
232
232
pub fn to_payment_address ( & self , diversifier : Diversifier ) -> Option < PaymentAddress > {
@@ -246,7 +246,7 @@ impl SaplingIvk {
246
246
pub struct Diversifier ( pub [ u8 ; 11 ] ) ;
247
247
248
248
impl Diversifier {
249
- pub fn g_d ( & self ) -> Option < jubjub :: SubgroupPoint > {
249
+ pub fn g_d ( & self ) -> Option < ironfish_jubjub :: SubgroupPoint > {
250
250
group_hash ( & self . 0 , constants:: KEY_DIVERSIFICATION_PERSONALIZATION )
251
251
}
252
252
}
@@ -259,7 +259,7 @@ impl Diversifier {
259
259
/// and not the identity).
260
260
#[ derive( Clone , Debug ) ]
261
261
pub struct PaymentAddress {
262
- pk_d : jubjub :: SubgroupPoint ,
262
+ pk_d : ironfish_jubjub :: SubgroupPoint ,
263
263
diversifier : Diversifier ,
264
264
}
265
265
@@ -273,7 +273,7 @@ impl PaymentAddress {
273
273
/// Constructs a PaymentAddress from a diversifier and a Jubjub point.
274
274
///
275
275
/// Returns None if `pk_d` is the identity.
276
- pub fn from_parts ( diversifier : Diversifier , pk_d : jubjub :: SubgroupPoint ) -> Option < Self > {
276
+ pub fn from_parts ( diversifier : Diversifier , pk_d : ironfish_jubjub :: SubgroupPoint ) -> Option < Self > {
277
277
if pk_d. is_identity ( ) . into ( ) {
278
278
None
279
279
} else {
@@ -287,7 +287,7 @@ impl PaymentAddress {
287
287
#[ cfg( test) ]
288
288
pub ( crate ) fn from_parts_unchecked (
289
289
diversifier : Diversifier ,
290
- pk_d : jubjub :: SubgroupPoint ,
290
+ pk_d : ironfish_jubjub :: SubgroupPoint ,
291
291
) -> Self {
292
292
PaymentAddress { pk_d, diversifier }
293
293
}
@@ -302,7 +302,7 @@ impl PaymentAddress {
302
302
// Check that the diversifier is valid
303
303
diversifier. g_d ( ) ?;
304
304
305
- let pk_d = jubjub :: SubgroupPoint :: from_bytes ( bytes[ 11 ..43 ] . try_into ( ) . unwrap ( ) ) ;
305
+ let pk_d = ironfish_jubjub :: SubgroupPoint :: from_bytes ( bytes[ 11 ..43 ] . try_into ( ) . unwrap ( ) ) ;
306
306
if pk_d. is_some ( ) . into ( ) {
307
307
PaymentAddress :: from_parts ( diversifier, pk_d. unwrap ( ) )
308
308
} else {
@@ -324,11 +324,11 @@ impl PaymentAddress {
324
324
}
325
325
326
326
/// Returns `pk_d` for this `PaymentAddress`.
327
- pub fn pk_d ( & self ) -> & jubjub :: SubgroupPoint {
327
+ pub fn pk_d ( & self ) -> & ironfish_jubjub :: SubgroupPoint {
328
328
& self . pk_d
329
329
}
330
330
331
- pub fn g_d ( & self ) -> Option < jubjub :: SubgroupPoint > {
331
+ pub fn g_d ( & self ) -> Option < ironfish_jubjub :: SubgroupPoint > {
332
332
self . diversifier . g_d ( )
333
333
}
334
334
@@ -349,7 +349,7 @@ impl PaymentAddress {
349
349
/// both the note commitment trapdoor `rcm` and the ephemeral private key `esk`.
350
350
#[ derive( Copy , Clone , Debug ) ]
351
351
pub enum Rseed {
352
- BeforeZip212 ( jubjub :: Fr ) ,
352
+ BeforeZip212 ( ironfish_jubjub :: Fr ) ,
353
353
AfterZip212 ( [ u8 ; 32 ] ) ,
354
354
}
355
355
@@ -404,9 +404,9 @@ pub struct Note {
404
404
/// The value of the note
405
405
pub value : u64 ,
406
406
/// The diversified base of the address, GH(d)
407
- pub g_d : jubjub :: SubgroupPoint ,
407
+ pub g_d : ironfish_jubjub :: SubgroupPoint ,
408
408
/// The public key of the address, g_d^ivk
409
- pub pk_d : jubjub :: SubgroupPoint ,
409
+ pub pk_d : ironfish_jubjub :: SubgroupPoint ,
410
410
/// rseed
411
411
pub rseed : Rseed ,
412
412
}
@@ -428,7 +428,7 @@ impl Note {
428
428
}
429
429
430
430
/// Computes the note commitment, returning the full point.
431
- fn cm_full_point ( & self ) -> jubjub :: SubgroupPoint {
431
+ fn cm_full_point ( & self ) -> ironfish_jubjub :: SubgroupPoint {
432
432
// Calculate the note contents, as bytes
433
433
let mut note_contents = vec ! [ ] ;
434
434
@@ -462,7 +462,7 @@ impl Note {
462
462
pub fn nf ( & self , viewing_key : & ViewingKey , position : u64 ) -> Nullifier {
463
463
// Compute rho = cm + position.G
464
464
let rho = self . cm_full_point ( )
465
- + ( * constants:: NULLIFIER_POSITION_GENERATOR * jubjub :: Fr :: from ( position) ) ;
465
+ + ( * constants:: NULLIFIER_POSITION_GENERATOR * ironfish_jubjub :: Fr :: from ( position) ) ;
466
466
467
467
// Compute nf = BLAKE2s(nk | rho)
468
468
Nullifier :: from_slice (
@@ -482,36 +482,36 @@ impl Note {
482
482
pub fn cmu ( & self ) -> blstrs:: Scalar {
483
483
// The commitment is in the prime order subgroup, so mapping the
484
484
// commitment to the u-coordinate is an injective encoding.
485
- jubjub :: ExtendedPoint :: from ( self . cm_full_point ( ) )
485
+ ironfish_jubjub :: ExtendedPoint :: from ( self . cm_full_point ( ) )
486
486
. to_affine ( )
487
487
. get_u ( )
488
488
}
489
489
490
- pub fn rcm ( & self ) -> jubjub :: Fr {
490
+ pub fn rcm ( & self ) -> ironfish_jubjub :: Fr {
491
491
match self . rseed {
492
492
Rseed :: BeforeZip212 ( rcm) => rcm,
493
493
Rseed :: AfterZip212 ( rseed) => {
494
- jubjub :: Fr :: from_bytes_wide ( prf_expand ( & rseed, & [ 0x04 ] ) . as_array ( ) )
494
+ ironfish_jubjub :: Fr :: from_bytes_wide ( prf_expand ( & rseed, & [ 0x04 ] ) . as_array ( ) )
495
495
}
496
496
}
497
497
}
498
498
499
- pub fn generate_or_derive_esk < R : RngCore + CryptoRng > ( & self , rng : & mut R ) -> jubjub :: Fr {
499
+ pub fn generate_or_derive_esk < R : RngCore + CryptoRng > ( & self , rng : & mut R ) -> ironfish_jubjub :: Fr {
500
500
self . generate_or_derive_esk_internal ( rng)
501
501
}
502
502
503
- pub ( crate ) fn generate_or_derive_esk_internal < R : RngCore > ( & self , rng : & mut R ) -> jubjub :: Fr {
503
+ pub ( crate ) fn generate_or_derive_esk_internal < R : RngCore > ( & self , rng : & mut R ) -> ironfish_jubjub :: Fr {
504
504
match self . derive_esk ( ) {
505
- None => jubjub :: Fr :: random ( rng) ,
505
+ None => ironfish_jubjub :: Fr :: random ( rng) ,
506
506
Some ( esk) => esk,
507
507
}
508
508
}
509
509
510
510
/// Returns the derived `esk` if this note was created after ZIP 212 activated.
511
- pub fn derive_esk ( & self ) -> Option < jubjub :: Fr > {
511
+ pub fn derive_esk ( & self ) -> Option < ironfish_jubjub :: Fr > {
512
512
match self . rseed {
513
513
Rseed :: BeforeZip212 ( _) => None ,
514
- Rseed :: AfterZip212 ( rseed) => Some ( jubjub :: Fr :: from_bytes_wide (
514
+ Rseed :: AfterZip212 ( rseed) => Some ( ironfish_jubjub :: Fr :: from_bytes_wide (
515
515
prf_expand ( & rseed, & [ 0x05 ] ) . as_array ( ) ,
516
516
) ) ,
517
517
}
0 commit comments