Merge pull request #106 from apoelstra/2020-11-reduce-test-rounds

reduce test rounds for rangeproof and surjectionproof
This commit is contained in:
Jonas Nick 2020-12-03 16:04:38 +00:00 committed by GitHub
commit 7093e633b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 9 deletions

View File

@ -498,7 +498,7 @@ static void test_rangeproof(void) {
CHECK(maxv >= v); CHECK(maxv >= v);
} }
memcpy(&commit2, &commit, sizeof(commit)); memcpy(&commit2, &commit, sizeof(commit));
for (i = 0; i < (size_t) 2*count; i++) { for (i = 0; i < (size_t) count; i++) {
int exp; int exp;
int min_bits; int min_bits;
v = secp256k1_testrandi64(0, UINT64_MAX >> (secp256k1_testrand32()&63)); v = secp256k1_testrandi64(0, UINT64_MAX >> (secp256k1_testrand32()&63));
@ -532,11 +532,11 @@ static void test_rangeproof(void) {
CHECK(secp256k1_rangeproof_rewind(ctx, blindout, &vout, NULL, NULL, commit.data, &minv, &maxv, &commit, proof, len, NULL, 0, secp256k1_generator_h)); CHECK(secp256k1_rangeproof_rewind(ctx, blindout, &vout, NULL, NULL, commit.data, &minv, &maxv, &commit, proof, len, NULL, 0, secp256k1_generator_h));
memcpy(&commit2, &commit, sizeof(commit)); memcpy(&commit2, &commit, sizeof(commit));
} }
for (j = 0; j < 5; j++) { for (j = 0; j < 3; j++) {
for (i = 0; i < 96; i++) { for (i = 0; i < 96; i++) {
secp256k1_testrand256(&proof[i * 32]); secp256k1_testrand256(&proof[i * 32]);
} }
for (k = 0; k < 128; k++) { for (k = 0; k < 128; k += 3) {
len = k; len = k;
CHECK(!secp256k1_rangeproof_verify(ctx, &minv, &maxv, &commit2, proof, len, NULL, 0, secp256k1_generator_h)); CHECK(!secp256k1_rangeproof_verify(ctx, &minv, &maxv, &commit2, proof, len, NULL, 0, secp256k1_generator_h));
} }
@ -696,10 +696,10 @@ void run_rangeproof_tests(void) {
test_api(); test_api();
test_rangeproof_fixed_vectors(); test_rangeproof_fixed_vectors();
test_pedersen_commitment_fixed_vector(); test_pedersen_commitment_fixed_vector();
for (i = 0; i < 10*count; i++) { for (i = 0; i < count / 2 + 1; i++) {
test_pedersen(); test_pedersen();
} }
for (i = 0; i < 10*count; i++) { for (i = 0; i < count / 2 + 1; i++) {
test_borromean(); test_borromean();
} }
test_rangeproof(); test_rangeproof();

View File

@ -667,10 +667,7 @@ void test_fixed_vectors(void) {
} }
void run_surjection_tests(void) { void run_surjection_tests(void) {
int i; test_surjectionproof_api();
for (i = 0; i < count; i++) {
test_surjectionproof_api();
}
test_fixed_vectors(); test_fixed_vectors();
test_input_selection(0); test_input_selection(0);