Skip to content

Commit 8afcd4b

Browse files
committed
Fixup: test CI
1 parent 6347c4d commit 8afcd4b

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/modules/bppp/bppp_rangeproof_impl.h

+9-3
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ static int secp256k1_bppp_rangeproof_prove_round4_impl(
511511
const size_t num_digits,
512512
const size_t digit_base
513513
) {
514-
size_t i, scratch_checkpoint;
514+
size_t i, scratch_checkpoint, ret;
515515
size_t g_offset = digit_base > num_digits ? digit_base : num_digits;
516516
/* Compute w = s/t + m + t*d + t^2*r + t^3*c_m. Store w in s*/
517517
secp256k1_scalar t_pows[8], c_poly[8], t_inv;
@@ -590,7 +590,7 @@ static int secp256k1_bppp_rangeproof_prove_round4_impl(
590590
}
591591
memcpy(gs, gens->gens, (gens->n) * sizeof(secp256k1_ge));
592592

593-
return secp256k1_bppp_rangeproof_norm_product_prove(
593+
ret = secp256k1_bppp_rangeproof_norm_product_prove(
594594
ctx,
595595
scratch,
596596
output,
@@ -607,6 +607,8 @@ static int secp256k1_bppp_rangeproof_prove_round4_impl(
607607
c_poly,
608608
8
609609
);
610+
secp256k1_scratch_apply_checkpoint(&ctx->error_callback, scratch, scratch_checkpoint);
611+
return ret;
610612
}
611613

612614
static int secp256k1_bppp_rangeproof_prove_impl(
@@ -826,6 +828,7 @@ static int secp256k1_bppp_rangeproof_verify_impl(
826828
const unsigned char* extra_commit,
827829
size_t extra_commit_len
828830
) {
831+
int res;
829832
size_t scratch_checkpoint;
830833
secp256k1_sha256 transcript;
831834
size_t num_digits = n_bits / secp256k1_bppp_log2(digit_base);
@@ -982,6 +985,7 @@ static int secp256k1_bppp_rangeproof_verify_impl(
982985
num_points = 6 + g_offset;
983986

984987
if (!secp256k1_ecmult_multi_var(&ctx->error_callback, scratch, &c_commj, NULL, secp256k1_bppp_verify_cb, (void*) &cb_data, num_points)) {
988+
secp256k1_scratch_apply_checkpoint(&ctx->error_callback, scratch, scratch_checkpoint);
985989
return 0;
986990
}
987991

@@ -999,7 +1003,7 @@ static int secp256k1_bppp_rangeproof_verify_impl(
9991003
}
10001004
secp256k1_scalar_clear(&c_poly[7]);
10011005

1002-
return secp256k1_bppp_rangeproof_norm_product_verify(
1006+
res = secp256k1_bppp_rangeproof_norm_product_verify(
10031007
ctx,
10041008
scratch,
10051009
&proof[33*4],
@@ -1013,6 +1017,8 @@ static int secp256k1_bppp_rangeproof_verify_impl(
10131017
8,
10141018
&c_comm
10151019
);
1020+
secp256k1_scratch_apply_checkpoint(&ctx->error_callback, scratch, scratch_checkpoint);
1021+
return res;
10161022
}
10171023
}
10181024

src/modules/bppp/tests_impl.h

+6-4
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
#include <stdint.h>
1111

1212
#include "../../../include/secp256k1_bppp.h"
13-
#include "bppp_norm_product_impl.h"
14-
#include "bppp_util.h"
15-
#include "bppp_transcript_impl.h"
13+
#include "../bppp/bppp_norm_product_impl.h"
14+
#include "../bppp/bppp_util.h"
15+
#include "../bppp/bppp_transcript_impl.h"
1616
#include "test_vectors/verify.h"
1717
#include "test_vectors/prove.h"
1818

@@ -604,7 +604,7 @@ static void rangeproof_test(size_t digit_base, size_t num_bits, uint64_t value,
604604
const unsigned char extra_commit[] = "Shock of teal blue beneath clouds gathering, and the light of empty black on the waves at the horizon";
605605
const size_t extra_commit_len = sizeof(extra_commit);
606606
secp256k1_sha256 transcript;
607-
const secp256k1_bppp_generators *gs = secp256k1_bppp_generators_create(CTX, n + 8);
607+
secp256k1_bppp_generators *gs = secp256k1_bppp_generators_create(CTX, n + 8);
608608
secp256k1_scratch *scratch = secp256k1_scratch_space_create(CTX, 1000*1000); /* shouldn't need much */
609609
unsigned char proof[1000];
610610
plen = 1000;
@@ -622,6 +622,8 @@ static void rangeproof_test(size_t digit_base, size_t num_bits, uint64_t value,
622622
proof[plen - 1] ^= 1;
623623
res = secp256k1_bppp_rangeproof_verify(CTX, scratch, gs, &asset_genp, proof, plen, num_bits, digit_base, min_value, &commit, extra_commit, extra_commit_len);
624624
CHECK(res == 0);
625+
secp256k1_bppp_generators_destroy(CTX, gs);
626+
secp256k1_scratch_space_destroy(CTX, scratch);
625627
}
626628

627629
static void run_bppp_tests(void) {

0 commit comments

Comments
 (0)