@@ -53,60 +53,60 @@ SpendTransaction::SpendTransaction(
53
53
this ->params ->get_m_grootle ()
54
54
);
55
55
for (std::size_t u = 0 ; u < w; u++) {
56
- // Parse out cover set data for this spend
57
- uint64_t set_id = inputs[u].cover_set_id ;
58
- this ->cover_set_ids .emplace_back (set_id);
59
- if (cover_set_data.count (set_id) == 0 || cover_sets.count (set_id) == 0 )
60
- throw std::invalid_argument (" Required set is not passed" );
61
-
62
- const auto & cover_set = cover_sets.at (set_id);
63
- std::size_t set_size = cover_set.size ();
64
- if (set_size > N)
65
- throw std::invalid_argument (" Wrong set size" );
66
-
67
- std::vector<GroupElement> S, C;
68
- S.reserve (set_size);
69
- C.reserve (set_size);
70
- for (std::size_t i = 0 ; i < set_size; i++) {
71
- S.emplace_back (cover_set[i].S );
72
- C.emplace_back (cover_set[i].C );
73
- }
74
-
75
- // Serial commitment offset
76
- this ->S1 .emplace_back (
77
- this ->params ->get_F ()*inputs[u].s
78
- + this ->params ->get_H ().inverse ()*SparkUtils::hash_ser1 (inputs[u].s , full_view_key.get_D ())
79
- + full_view_key.get_D ()
80
- );
81
-
82
- // Value commitment offset
83
- this ->C1 .emplace_back (
84
- this ->params ->get_G ()*Scalar (inputs[u].v )
85
- + this ->params ->get_H ()*SparkUtils::hash_val1 (inputs[u].s , full_view_key.get_D ())
86
- );
87
-
88
- // Tags
89
- this ->T .emplace_back (inputs[u].T );
90
-
91
- // Grootle proof
92
- this ->grootle_proofs .emplace_back ();
93
- std::size_t l = inputs[u].index ;
94
- grootle.prove (
95
- l,
96
- SparkUtils::hash_ser1 (inputs[u].s , full_view_key.get_D ()),
97
- S,
98
- this ->S1 .back (),
99
- SparkUtils::hash_val (inputs[u].k ) - SparkUtils::hash_val1 (inputs[u].s , full_view_key.get_D ()),
100
- C,
101
- this ->C1 .back (),
102
- this ->cover_set_representations [set_id],
103
- this ->grootle_proofs .back ()
104
- );
105
-
106
- // Chaum data
107
- chaum_x.emplace_back (inputs[u].s );
108
- chaum_y.emplace_back (spend_key.get_r ());
109
- chaum_z.emplace_back (SparkUtils::hash_ser1 (inputs[u].s , full_view_key.get_D ()).negate ());
56
+ // Parse out cover set data for this spend
57
+ uint64_t set_id = inputs[u].cover_set_id ;
58
+ this ->cover_set_ids .emplace_back (set_id);
59
+ if (cover_set_data.count (set_id) == 0 || cover_sets.count (set_id) == 0 )
60
+ throw std::invalid_argument (" Required set is not passed" );
61
+
62
+ const auto & cover_set = cover_sets.at (set_id);
63
+ std::size_t set_size = cover_set.size ();
64
+ if (set_size > N)
65
+ throw std::invalid_argument (" Wrong set size" );
66
+
67
+ std::vector<GroupElement> S, C;
68
+ S.reserve (set_size);
69
+ C.reserve (set_size);
70
+ for (std::size_t i = 0 ; i < set_size; i++) {
71
+ S.emplace_back (cover_set[i].S );
72
+ C.emplace_back (cover_set[i].C );
73
+ }
74
+
75
+ // Serial commitment offset
76
+ this ->S1 .emplace_back (
77
+ this ->params ->get_F ()*inputs[u].s
78
+ + this ->params ->get_H ().inverse ()*SparkUtils::hash_ser1 (inputs[u].s , full_view_key.get_D ())
79
+ + full_view_key.get_D ()
80
+ );
81
+
82
+ // Value commitment offset
83
+ this ->C1 .emplace_back (
84
+ this ->params ->get_G ()*Scalar (inputs[u].v )
85
+ + this ->params ->get_H ()*SparkUtils::hash_val1 (inputs[u].s , full_view_key.get_D ())
86
+ );
87
+
88
+ // Tags
89
+ this ->T .emplace_back (inputs[u].T );
90
+
91
+ // Grootle proof
92
+ this ->grootle_proofs .emplace_back ();
93
+ std::size_t l = inputs[u].index ;
94
+ grootle.prove (
95
+ l,
96
+ SparkUtils::hash_ser1 (inputs[u].s , full_view_key.get_D ()),
97
+ S,
98
+ this ->S1 .back (),
99
+ SparkUtils::hash_val (inputs[u].k ) - SparkUtils::hash_val1 (inputs[u].s , full_view_key.get_D ()),
100
+ C,
101
+ this ->C1 .back (),
102
+ this ->cover_set_representations [set_id],
103
+ this ->grootle_proofs .back ()
104
+ );
105
+
106
+ // Chaum data
107
+ chaum_x.emplace_back (inputs[u].s );
108
+ chaum_y.emplace_back (spend_key.get_r ());
109
+ chaum_z.emplace_back (SparkUtils::hash_ser1 (inputs[u].s , full_view_key.get_D ()).negate ());
110
110
}
111
111
112
112
// Generate output coins and prepare range proof vectors
@@ -413,13 +413,13 @@ bool SpendTransaction::verify(
413
413
//
414
414
// Note that transparent components of the transaction are bound into `cover_set_representation`, so they don't appear separately.
415
415
std::vector<unsigned char > SpendTransaction::hash_bind_inner (
416
- const std::map<uint64_t , std::vector<unsigned char >>& cover_set_representations,
417
- const std::vector<GroupElement>& S1,
418
- const std::vector<GroupElement>& C1,
419
- const std::vector<GroupElement>& T,
420
- const std::vector<GrootleProof>& grootle_proofs,
421
- const SchnorrProof& balance_proof,
422
- const BPPlusProof& range_proof
416
+ const std::map<uint64_t , std::vector<unsigned char >>& cover_set_representations,
417
+ const std::vector<GroupElement>& S1,
418
+ const std::vector<GroupElement>& C1,
419
+ const std::vector<GroupElement>& T,
420
+ const std::vector<GrootleProof>& grootle_proofs,
421
+ const SchnorrProof& balance_proof,
422
+ const BPPlusProof& range_proof
423
423
) {
424
424
Hash hash (LABEL_HASH_BIND_INNER);
425
425
CDataStream stream (SER_NETWORK, PROTOCOL_VERSION);
@@ -429,7 +429,7 @@ std::vector<unsigned char> SpendTransaction::hash_bind_inner(
429
429
stream << T;
430
430
stream << grootle_proofs;
431
431
stream << balance_proof;
432
- stream << range_proof;
432
+ stream << range_proof;
433
433
hash.include (stream);
434
434
435
435
return hash.finalize ();
@@ -438,16 +438,16 @@ std::vector<unsigned char> SpendTransaction::hash_bind_inner(
438
438
// Hash-to-scalar function H_bind
439
439
// This function must accept pre-hashed data from `H_bind_inner` intended to correspond to the signing operation
440
440
Scalar SpendTransaction::hash_bind (
441
- const std::vector<unsigned char > hash_bind_inner,
441
+ const std::vector<unsigned char > hash_bind_inner,
442
442
const std::vector<Coin>& out_coins,
443
443
const uint64_t f_
444
444
) {
445
- Hash hash (LABEL_HASH_BIND);
445
+ Hash hash (LABEL_HASH_BIND);
446
446
CDataStream stream (SER_NETWORK, PROTOCOL_VERSION);
447
- stream << hash_bind_inner,
448
- stream << out_coins;
449
- stream << f_;
450
- hash.include (stream);
447
+ stream << hash_bind_inner,
448
+ stream << out_coins;
449
+ stream << f_;
450
+ hash.include (stream);
451
451
452
452
return hash.finalize_scalar ();
453
453
}
0 commit comments