Skip to content

Commit 849a258

Browse files
committed
commitment and bulletproof: fix a bunch of typos and stuff (thanks Tim Ruffing)
1 parent 9601a66 commit 849a258

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

include/secp256k1_bulletproofs.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ typedef struct secp256k1_bulletproof_generators secp256k1_bulletproof_generators
1616
#define SECP256K1_BULLETPROOF_MAX_DEPTH 31
1717

1818
/* Size of a hypothetical 31-depth rangeproof, in bytes */
19-
#define SECP256K1_BULLETPROOF_MAX_PROOF (160 + 66*32 + 7)
19+
#define SECP256K1_BULLETPROOF_MAX_PROOF (160 + 36*32 + 7)
2020

2121
/** Allocates and initializes a list of NUMS generators, along with precomputation data
2222
* Returns a list of generators, or NULL if allocation failed.

include/secp256k1_commitment.h

+14-14
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ SECP256K1_API int secp256k1_pedersen_commitment_serialize(
5858
/** Initialize a context for usage with Pedersen commitments. */
5959
void secp256k1_pedersen_context_initialize(secp256k1_context* ctx);
6060

61-
/** Generate a pedersen commitment.
61+
/** Generate a Pedersen commitment.
6262
* Returns 1: Commitment successfully created.
6363
* 0: Error. The blinding factor is larger than the group order
6464
* (probability for random 32 byte number < 2^-127) or results in the
@@ -89,7 +89,7 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_pedersen_commit(
8989
* In: ctx: pointer to a context object (cannot be NULL)
9090
* blinds: pointer to pointers to 32-byte character arrays for blinding factors. (cannot be NULL)
9191
* n: number of factors pointed to by blinds.
92-
* npositive: how many of the initial factors should be treated with a positive sign.
92+
* npositive: how many of the input factors should be treated with a positive sign.
9393
* Out: blind_out: pointer to a 32-byte array for the sum (cannot be NULL)
9494
*/
9595
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_pedersen_blind_sum(
@@ -100,28 +100,28 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_pedersen_blind_sum(
100100
size_t npositive
101101
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
102102

103-
/** Verify a tally of pedersen commitments
103+
/** Verify a tally of Pedersen commitments
104104
* Returns 1: commitments successfully sum to zero.
105105
* 0: Commitments do not sum to zero or other error.
106-
* In: ctx: pointer to a context object (cannot be NULL)
107-
* commits: pointer to array of pointers to the commitments. (cannot be NULL if pcnt is non-zero)
108-
* pcnt: number of commitments pointed to by commits.
109-
* ncommits: pointer to array of pointers to the negative commitments. (cannot be NULL if ncnt is non-zero)
110-
* ncnt: number of commitments pointed to by ncommits.
106+
* In: ctx: pointer to a context object (cannot be NULL)
107+
* pos: pointer to array of pointers to the commitments. (cannot be NULL if `n_pos` is non-zero)
108+
* n_pos: number of commitments pointed to by `pos`.
109+
* neg: pointer to array of pointers to the negative commitments. (cannot be NULL if `n_neg` is non-zero)
110+
* n_neg: number of commitments pointed to by `neg`.
111111
*
112-
* This computes sum(commit[0..pcnt)) - sum(ncommit[0..ncnt)) == 0.
112+
* This computes sum(pos[0..n_pos)) - sum(neg[0..n_neg)) == 0.
113113
*
114-
* A pedersen commitment is xG + vA where G and A are generators for the secp256k1 group and x is a blinding factor,
114+
* A Pedersen commitment is xG + vA where G and A are generators for the secp256k1 group and x is a blinding factor,
115115
* while v is the committed value. For a collection of commitments to sum to zero, for each distinct generator
116116
* A all blinding factors and all values must sum to zero.
117117
*
118118
*/
119119
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_pedersen_verify_tally(
120120
const secp256k1_context* ctx,
121-
const secp256k1_pedersen_commitment * const* commits,
122-
size_t pcnt,
123-
const secp256k1_pedersen_commitment * const* ncommits,
124-
size_t ncnt
121+
const secp256k1_pedersen_commitment * const* pos,
122+
size_t n_pos,
123+
const secp256k1_pedersen_commitment * const* neg,
124+
size_t n_neg
125125
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(4);
126126

127127
/** Sets the final Pedersen blinding factor correctly when the generators themselves

src/modules/commitment/main_impl.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -139,22 +139,22 @@ int secp256k1_pedersen_blind_sum(const secp256k1_context* ctx, unsigned char *bl
139139
}
140140

141141
/* Takes two lists of commitments and sums the first set and subtracts the second and verifies that they sum to excess. */
142-
int secp256k1_pedersen_verify_tally(const secp256k1_context* ctx, const secp256k1_pedersen_commitment * const* commits, size_t pcnt, const secp256k1_pedersen_commitment * const* ncommits, size_t ncnt) {
142+
int secp256k1_pedersen_verify_tally(const secp256k1_context* ctx, const secp256k1_pedersen_commitment * const* pos, size_t n_pos, const secp256k1_pedersen_commitment * const* neg, size_t n_neg) {
143143
secp256k1_gej accj;
144144
secp256k1_ge add;
145145
size_t i;
146146
VERIFY_CHECK(ctx != NULL);
147-
ARG_CHECK(!pcnt || (commits != NULL));
148-
ARG_CHECK(!ncnt || (ncommits != NULL));
147+
ARG_CHECK(!n_pos || (pos != NULL));
148+
ARG_CHECK(!n_neg || (neg != NULL));
149149
(void) ctx;
150150
secp256k1_gej_set_infinity(&accj);
151-
for (i = 0; i < ncnt; i++) {
152-
secp256k1_pedersen_commitment_load(&add, ncommits[i]);
151+
for (i = 0; i < n_neg; i++) {
152+
secp256k1_pedersen_commitment_load(&add, neg[i]);
153153
secp256k1_gej_add_ge_var(&accj, &accj, &add, NULL);
154154
}
155155
secp256k1_gej_neg(&accj, &accj);
156-
for (i = 0; i < pcnt; i++) {
157-
secp256k1_pedersen_commitment_load(&add, commits[i]);
156+
for (i = 0; i < n_pos; i++) {
157+
secp256k1_pedersen_commitment_load(&add, pos[i]);
158158
secp256k1_gej_add_ge_var(&accj, &accj, &add, NULL);
159159
}
160160
return secp256k1_gej_is_infinity(&accj);

0 commit comments

Comments
 (0)