Skip to content

Commit 4706f75

Browse files
committed
commitment and bulletproof: fix a bunch of typos and stuff (thanks Tim Ruffing)
1 parent df8e037 commit 4706f75

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

include/secp256k1_bulletproofs.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ typedef struct secp256k1_bulletproof_generators secp256k1_bulletproof_generators
1616
#define SECP256K1_BULLETPROOF_CIRCUIT_VERSION 1
1717

1818
/* Maximum depth of 31 lets us validate an aggregate of 2^25 64-bit proofs */
19-
#define SECP256K1_BULLETPROOF_MAX_DEPTH 60
19+
#define SECP256K1_BULLETPROOF_MAX_DEPTH 31
2020

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

2424
/* Maximum memory, in bytes, that may be allocated to store a circuit representation */
2525
#define SECP256K1_BULLETPROOF_MAX_CIRCUIT (1024 * 1024 * 1024)

include/secp256k1_commitment.h

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

58-
/** Generate a pedersen commitment.
58+
/** Generate a Pedersen commitment.
5959
* Returns 1: Commitment successfully created.
6060
* 0: Error. The blinding factor is larger than the group order
6161
* (probability for random 32 byte number < 2^-127) or results in the
@@ -86,7 +86,7 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_pedersen_commit(
8686
* In: ctx: pointer to a context object (cannot be NULL)
8787
* blinds: pointer to pointers to 32-byte character arrays for blinding factors. (cannot be NULL)
8888
* n: number of factors pointed to by blinds.
89-
* npositive: how many of the initial factors should be treated with a positive sign.
89+
* npositive: how many of the input factors should be treated with a positive sign.
9090
* Out: blind_out: pointer to a 32-byte array for the sum (cannot be NULL)
9191
*/
9292
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_pedersen_blind_sum(
@@ -97,28 +97,28 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_pedersen_blind_sum(
9797
size_t npositive
9898
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
9999

100-
/** Verify a tally of pedersen commitments
100+
/** Verify a tally of Pedersen commitments
101101
* Returns 1: commitments successfully sum to zero.
102102
* 0: Commitments do not sum to zero or other error.
103-
* In: ctx: pointer to a context object (cannot be NULL)
104-
* commits: pointer to array of pointers to the commitments. (cannot be NULL if pcnt is non-zero)
105-
* pcnt: number of commitments pointed to by commits.
106-
* ncommits: pointer to array of pointers to the negative commitments. (cannot be NULL if ncnt is non-zero)
107-
* ncnt: number of commitments pointed to by ncommits.
103+
* In: ctx: pointer to a context object (cannot be NULL)
104+
* pos: pointer to array of pointers to the commitments. (cannot be NULL if `n_pos` is non-zero)
105+
* n_pos: number of commitments pointed to by `pos`.
106+
* neg: pointer to array of pointers to the negative commitments. (cannot be NULL if `n_neg` is non-zero)
107+
* n_neg: number of commitments pointed to by `neg`.
108108
*
109-
* This computes sum(commit[0..pcnt)) - sum(ncommit[0..ncnt)) == 0.
109+
* This computes sum(pos[0..n_pos)) - sum(neg[0..n_neg)) == 0.
110110
*
111-
* A pedersen commitment is xG + vA where G and A are generators for the secp256k1 group and x is a blinding factor,
111+
* A Pedersen commitment is xG + vA where G and A are generators for the secp256k1 group and x is a blinding factor,
112112
* while v is the committed value. For a collection of commitments to sum to zero, for each distinct generator
113113
* A all blinding factors and all values must sum to zero.
114114
*
115115
*/
116116
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_pedersen_verify_tally(
117117
const secp256k1_context* ctx,
118-
const secp256k1_pedersen_commitment * const* commits,
119-
size_t pcnt,
120-
const secp256k1_pedersen_commitment * const* ncommits,
121-
size_t ncnt
118+
const secp256k1_pedersen_commitment * const* pos,
119+
size_t n_pos,
120+
const secp256k1_pedersen_commitment * const* neg,
121+
size_t n_neg
122122
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(4);
123123

124124
/** 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
@@ -108,22 +108,22 @@ int secp256k1_pedersen_blind_sum(const secp256k1_context* ctx, unsigned char *bl
108108
}
109109

110110
/* Takes two lists of commitments and sums the first set and subtracts the second and verifies that they sum to excess. */
111-
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) {
111+
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) {
112112
secp256k1_gej accj;
113113
secp256k1_ge add;
114114
size_t i;
115115
VERIFY_CHECK(ctx != NULL);
116-
ARG_CHECK(!pcnt || (commits != NULL));
117-
ARG_CHECK(!ncnt || (ncommits != NULL));
116+
ARG_CHECK(!n_pos || (pos != NULL));
117+
ARG_CHECK(!n_neg || (neg != NULL));
118118
(void) ctx;
119119
secp256k1_gej_set_infinity(&accj);
120-
for (i = 0; i < ncnt; i++) {
121-
secp256k1_pedersen_commitment_load(&add, ncommits[i]);
120+
for (i = 0; i < n_pos; i++) {
121+
secp256k1_pedersen_commitment_load(&add, neg[i]);
122122
secp256k1_gej_add_ge_var(&accj, &accj, &add, NULL);
123123
}
124124
secp256k1_gej_neg(&accj, &accj);
125-
for (i = 0; i < pcnt; i++) {
126-
secp256k1_pedersen_commitment_load(&add, commits[i]);
125+
for (i = 0; i < n_neg; i++) {
126+
secp256k1_pedersen_commitment_load(&add, pos[i]);
127127
secp256k1_gej_add_ge_var(&accj, &accj, &add, NULL);
128128
}
129129
return secp256k1_gej_is_infinity(&accj);

0 commit comments

Comments
 (0)