@@ -5,6 +5,7 @@ pub mod verifier;
55use crate :: account:: state:: NUM_GENERATORS ;
66use crate :: account:: { AccountCommitmentKeyTrait , AccountState , AccountStateCommitment } ;
77use crate :: auth_proofs:: account:: AuthProofAffirmation ;
8+ use crate :: dst;
89use crate :: leg:: { LegEncryptionCore , PartyEphemeralPublicKey } ;
910use crate :: util:: {
1011 BPProof , generate_sigma_responses_for_common_state_change,
@@ -82,9 +83,8 @@ pub struct CommonStateChangeProofPartial<
8283 pub resp_null : PartialPokDiscreteLog < Affine < G0 > > ,
8384 /// Commitment to initial rho, old and current rho, old and current randomness
8485 pub comm_bp_randomness_relations : Affine < G0 > ,
85- /// Commitment to randomness for proving knowledge of rho and commitment randomness (step 1 of Schnorr)
86- pub t_bp_randomness_relations : Affine < G0 > ,
87- /// Response for proving knowledge of rho and commitment randomness (step 3 of Schnorr)
86+ /// Response for proving knowledge of rho and commitment randomness (step 3 of Schnorr).
87+ /// Carries the commitment to randomness `t` from step 1.
8888 pub resp_bp_randomness_relations : PartialSchnorrResponse < Affine < G0 > > ,
8989}
9090
@@ -98,13 +98,11 @@ pub struct CommonStateChangeProof<
9898 G1 : SWCurveConfig < ScalarField = F1 , BaseField = F0 > + Clone + Copy ,
9999> {
100100 pub partial : CommonStateChangeProofPartial < F0 , F1 , G0 , G1 , { L } > ,
101- /// Commitment to randomness for proving knowledge of re-randomized leaf using Schnorr protocol (step 1 of Schnorr)
102- pub t_acc_old : Affine < G0 > ,
103- /// Commitment to randomness for proving knowledge of new account commitment (which becomes new leaf) using Schnorr protocol (step 1 of Schnorr)
104- pub t_acc_new : Affine < G0 > ,
105- /// Response for proving knowledge of re-randomized account commitment (leaf) using Schnorr protocol (step 3 of Schnorr)
101+ /// Response for proving knowledge of re-randomized account commitment (leaf) using Schnorr
102+ /// protocol (step 3 of Schnorr). Carries the commitment to randomness `t` from step 1.
106103 pub resp_acc_old : SchnorrResponse < Affine < G0 > > ,
107- /// Response for proving knowledge of new account commitment using Schnorr protocol (step 3 of Schnorr)
104+ /// Response for proving knowledge of new account commitment using Schnorr protocol (step 3
105+ /// of Schnorr). Carries the commitment to randomness `t` from step 1.
108106 pub resp_acc_new : PartialSchnorrResponse < Affine < G0 > > ,
109107 pub resp_leg_link : Vec < LegAccountLink < G0 > > ,
110108}
@@ -532,11 +530,8 @@ impl<
532530 re_randomized_path : self . re_randomized_path . clone ( ) ,
533531 resp_null,
534532 comm_bp_randomness_relations : self . comm_bp_randomness_relations ,
535- t_bp_randomness_relations : self . t_bp_randomness_relations . t ,
536533 resp_bp_randomness_relations,
537534 } ,
538- t_acc_old : self . t_acc_old . t ,
539- t_acc_new : self . t_acc_new . t ,
540535 resp_acc_old,
541536 resp_acc_new,
542537 resp_leg_link,
@@ -548,18 +543,18 @@ impl<
548543/// Does NOT include sk or sk_enc.
549544#[ derive( Clone , Debug , CanonicalSerialize , CanonicalDeserialize ) ]
550545pub struct AccountCommitmentsHostProof < G : SWCurveConfig + Clone + Copy > {
551- pub t_acc_old : Affine < G > ,
552- pub t_acc_new : Affine < G > ,
553- /// Full response for old re-randomized account
546+ /// Full response for old re-randomized account (carries its commitment `t`)
554547 pub resp_acc_old : SchnorrResponse < Affine < G > > ,
555- /// Partial response for new account
548+ /// Partial response for new account (carries its commitment `t`)
556549 pub resp_acc_new : PartialSchnorrResponse < Affine < G > > ,
557550}
558551
559552impl < G : SWCurveConfig + Clone + Copy > AccountCommitmentsHostProof < G > {
560553 pub fn challenge_contribution < W : Write > ( & self , writer : & mut W ) -> Result < ( ) > {
561- self . t_acc_old . serialize_compressed ( & mut * writer) ?;
562- self . t_acc_new . serialize_compressed ( writer) ?;
554+ self . resp_acc_old
555+ . challenge_contribution ( dst:: ACCOUNT_COMM_OLD , & mut * writer) ?;
556+ self . resp_acc_new
557+ . challenge_contribution ( dst:: ACCOUNT_COMM_NEW , writer) ?;
563558 Ok ( ( ) )
564559 }
565560}
@@ -658,8 +653,10 @@ impl<G: SWCurveConfig + Clone + Copy> AccountCommitmentsHostProtocol<G> {
658653 }
659654
660655 pub fn challenge_contribution < W : Write > ( & self , writer : & mut W ) -> Result < ( ) > {
661- self . t_acc_old . challenge_contribution ( & mut * writer) ?;
662- self . t_acc_new . challenge_contribution ( writer) ?;
656+ self . t_acc_old
657+ . challenge_contribution ( dst:: ACCOUNT_COMM_OLD , & mut * writer) ?;
658+ self . t_acc_new
659+ . challenge_contribution ( dst:: ACCOUNT_COMM_NEW , writer) ?;
663660 Ok ( ( ) )
664661 }
665662
@@ -688,8 +685,6 @@ impl<G: SWCurveConfig + Clone + Copy> AccountCommitmentsHostProtocol<G> {
688685 ) ?;
689686
690687 Ok ( AccountCommitmentsHostProof {
691- t_acc_old : self . t_acc_old . t ,
692- t_acc_new : self . t_acc_new . t ,
693688 resp_acc_old,
694689 resp_acc_new,
695690 } )
@@ -897,7 +892,6 @@ impl<
897892 re_randomized_path : self . re_randomized_path . take ( ) ,
898893 resp_null,
899894 comm_bp_randomness_relations : self . comm_bp ,
900- t_bp_randomness_relations : self . t_bp . t ,
901895 resp_bp_randomness_relations : resp_bp,
902896 }
903897 }
@@ -1217,13 +1211,18 @@ impl<
12171211 let mut transcript = even_prover. transcript ( ) ;
12181212 acc_host_proto
12191213 . t_acc_old
1220- . challenge_contribution ( & mut transcript) ?;
1214+ . challenge_contribution ( dst :: ACCOUNT_COMM_OLD , & mut transcript) ?;
12211215 acc_host_proto
12221216 . t_acc_new
1223- . challenge_contribution ( & mut transcript) ?;
1224- t_bp. challenge_contribution ( & mut transcript) ?;
1217+ . challenge_contribution ( dst :: ACCOUNT_COMM_NEW , & mut transcript) ?;
1218+ t_bp. challenge_contribution ( dst :: BP_RANDOMNESS_RELATIONS , & mut transcript) ?;
12251219 let null_gen = account_comm_key. current_rho_gen ( ) ;
1226- t_null. challenge_contribution ( & null_gen, & nullifier, & mut transcript) ?;
1220+ t_null. challenge_contribution (
1221+ & null_gen,
1222+ & nullifier,
1223+ dst:: NULLIFIER ,
1224+ & mut transcript,
1225+ ) ?;
12271226 }
12281227
12291228 let mut ct_asset_id_2_protos = Vec :: new ( ) ;
@@ -1244,6 +1243,7 @@ impl<
12441243 & enc_gen,
12451244 & b_blinding,
12461245 ct_asset_id_2,
1246+ dst:: HOST_CT_ASSET_ID_2 ,
12471247 & mut transcript,
12481248 ) ?;
12491249 }
@@ -1269,6 +1269,7 @@ impl<
12691269 & enc_gen,
12701270 & b_blinding,
12711271 ct_amount_2,
1272+ dst:: HOST_CT_AMOUNT_2 ,
12721273 & mut transcript,
12731274 ) ?;
12741275 }
@@ -1489,7 +1490,6 @@ impl<
14891490 re_randomized_path,
14901491 resp_null,
14911492 comm_bp_randomness_relations : comm_bp,
1492- t_bp_randomness_relations : t_bp. t ,
14931493 resp_bp_randomness_relations : resp_bp,
14941494 } ;
14951495
0 commit comments