@@ -17,10 +17,7 @@ use crate::{
1717
1818pub use zip32:: ChildIndex ;
1919
20- /// Personalization for the master extended spending key
2120const ZIP32_ORCHARD_PERSONALIZATION : & [ u8 ; 16 ] = b"ZcashIP32Orchard" ;
22- /// Personalization for the master extended issuance key
23- const ZIP32_ORCHARD_ISSUANCE_PERSONALIZATION : & [ u8 ; 16 ] = b"ZcashSA_Issue_V1" ;
2421const ZIP32_ORCHARD_FVFP_PERSONALIZATION : & [ u8 ; 16 ] = b"ZcashOrchardFVFP" ;
2522
2623/// Errors produced in derivation of extended spending keys
@@ -30,8 +27,6 @@ pub enum Error {
3027 InvalidSpendingKey ,
3128 /// A child index in a derivation path exceeded 2^31
3229 InvalidChildIndex ( u32 ) ,
33- /// A non zero account when deriving an Orchard-ZSA issuance key
34- NonZeroAccount ,
3530}
3631
3732impl fmt:: Display for Error {
@@ -126,37 +121,28 @@ impl KeyIndex {
126121}
127122
128123#[ derive( Clone , Copy , Debug ) ]
129- pub ( crate ) struct Orchard ;
124+ struct Orchard ;
130125
131126impl hardened_only:: Context for Orchard {
132127 const MKG_DOMAIN : [ u8 ; 16 ] = * ZIP32_ORCHARD_PERSONALIZATION ;
133128 const CKD_DOMAIN : PrfExpand < ( [ u8 ; 32 ] , [ u8 ; 4 ] , [ u8 ; 1 ] , VariableLengthSlice ) > =
134129 PrfExpand :: ORCHARD_ZIP32_CHILD ;
135130}
136131
137- #[ derive( Clone , Copy , Debug ) ]
138- pub ( crate ) struct Issuance ;
139-
140- impl hardened_only:: Context for Issuance {
141- const MKG_DOMAIN : [ u8 ; 16 ] = * ZIP32_ORCHARD_ISSUANCE_PERSONALIZATION ;
142- const CKD_DOMAIN : PrfExpand < ( [ u8 ; 32 ] , [ u8 ; 4 ] , [ u8 ; 1 ] , VariableLengthSlice ) > =
143- PrfExpand :: ORCHARD_ZIP32_CHILD ;
144- }
145-
146132/// An Orchard extended spending key.
147133///
148134/// Defined in [ZIP32: Orchard extended keys][orchardextendedkeys].
149135///
150136/// [orchardextendedkeys]: https://zips.z.cash/zip-0032#orchard-extended-keys
151137#[ derive( Debug , Clone ) ]
152- pub ( crate ) struct ExtendedSpendingKey < C : hardened_only :: Context > {
138+ pub ( crate ) struct ExtendedSpendingKey {
153139 depth : u8 ,
154140 parent_fvk_tag : FvkTag ,
155141 child_index : KeyIndex ,
156- inner : HardenedOnlyKey < C > ,
142+ inner : HardenedOnlyKey < Orchard > ,
157143}
158144
159- impl < C : hardened_only :: Context > ConstantTimeEq for ExtendedSpendingKey < C > {
145+ impl ConstantTimeEq for ExtendedSpendingKey {
160146 fn ct_eq ( & self , rhs : & Self ) -> Choice {
161147 self . depth . ct_eq ( & rhs. depth )
162148 & self . parent_fvk_tag . 0 . ct_eq ( & rhs. parent_fvk_tag . 0 )
@@ -166,7 +152,7 @@ impl<C: hardened_only::Context> ConstantTimeEq for ExtendedSpendingKey<C> {
166152}
167153
168154#[ allow( non_snake_case) ]
169- impl < C : hardened_only :: Context > ExtendedSpendingKey < C > {
155+ impl ExtendedSpendingKey {
170156 /// Returns the spending key of the child key corresponding to
171157 /// the path derived from the master key
172158 ///
@@ -250,7 +236,7 @@ mod tests {
250236 #[ test]
251237 fn derive_child ( ) {
252238 let seed = [ 0 ; 32 ] ;
253- let xsk_m = ExtendedSpendingKey :: < Orchard > :: master ( & seed) . unwrap ( ) ;
239+ let xsk_m = ExtendedSpendingKey :: master ( & seed) . unwrap ( ) ;
254240
255241 let i_5 = ChildIndex :: hardened ( 5 ) ;
256242 let xsk_5 = xsk_m. derive_child ( i_5) ;
@@ -261,18 +247,18 @@ mod tests {
261247 #[ test]
262248 fn path ( ) {
263249 let seed = [ 0 ; 32 ] ;
264- let xsk_m = ExtendedSpendingKey :: < Orchard > :: master ( & seed) . unwrap ( ) ;
250+ let xsk_m = ExtendedSpendingKey :: master ( & seed) . unwrap ( ) ;
265251
266252 let xsk_5h = xsk_m. derive_child ( ChildIndex :: hardened ( 5 ) ) . unwrap ( ) ;
267253 assert ! ( bool :: from(
268- ExtendedSpendingKey :: < Orchard > :: from_path( & seed, & [ ChildIndex :: hardened( 5 ) ] , )
254+ ExtendedSpendingKey :: from_path( & seed, & [ ChildIndex :: hardened( 5 ) ] , )
269255 . unwrap( )
270256 . ct_eq( & xsk_5h)
271257 ) ) ;
272258
273259 let xsk_5h_7 = xsk_5h. derive_child ( ChildIndex :: hardened ( 7 ) ) . unwrap ( ) ;
274260 assert ! ( bool :: from(
275- ExtendedSpendingKey :: < Orchard > :: from_path(
261+ ExtendedSpendingKey :: from_path(
276262 & seed,
277263 & [ ChildIndex :: hardened( 5 ) , ChildIndex :: hardened( 7 ) ] ,
278264 )
@@ -294,9 +280,9 @@ mod tests {
294280 let i2h = ChildIndex :: hardened ( 2 ) ;
295281 let i3h = ChildIndex :: hardened ( 3 ) ;
296282
297- let m = ExtendedSpendingKey :: < Orchard > :: master ( & seed) . unwrap ( ) ;
283+ let m = ExtendedSpendingKey :: master ( & seed) . unwrap ( ) ;
298284 let m_1h = m. derive_child ( i1h) . unwrap ( ) ;
299- let m_1h_2h = ExtendedSpendingKey :: < Orchard > :: from_path ( & seed, & [ i1h, i2h] ) . unwrap ( ) ;
285+ let m_1h_2h = ExtendedSpendingKey :: from_path ( & seed, & [ i1h, i2h] ) . unwrap ( ) ;
300286 let m_1h_2h_3h = m_1h_2h. derive_child ( i3h) . unwrap ( ) ;
301287
302288 let xsks = [ m, m_1h, m_1h_2h, m_1h_2h_3h] ;
0 commit comments