context: #760 (comment)
I am trying to implement a PoC for the API proposed above. I have the following batch_verify
object in mind.
0typedef struct {
1 unsigned char chacha_seed[32]; /* for generating common randomizers (1, a2, a3 ... au) */
2 secp256k1_scalar randomizer_cache[2];
3 schnorrsig_batch_verify sigs_data;
4 tweaked_key_batch_verify tweaked_keys_data;
5} batch_verify_struct;
6
7typdef struct {
8 secp256k1_scratch *sigs_data; /* (sig, msg, pk) */
9 size_t len;
10 size_t capacity; /* equals (sigs_data->max_size)/(64 + 32 + sizeof(secp256k1_xonly)) */
11 int result;
12} schnorrsig_batch_verify;
13
14typdef struct {
15 secp256k1_scratch *tweaks_data; /* (pairity, tweaked_key, tweak32, pubkey_key) */
16 size_t len;
17 size_t capacity;
18 int result;
19} tweaked_key_batch_verify;
I plan to use a scratch object to store the data (schnorrsig or tweaks) since it will allow us to keep on adding new data (using batch_add_sig
and batch_add_xpubkey_tweak
) and increase the batch object’s size accordingly. This batch object doesn’t seem compatible with ecmult_pippenger_batch
or ecmult_strauss_batch
function call.
Since both Pippenger and Strauss takes the arguments:
void *cbdata
–> contains the required datasecp256k1_scratch *scratch
–> newly allocated scratch space where scalars and points are loaded for multi multiplication
But this batch object already has the required data in a scratch space. Maybe use another scratch space for loading scalars and points? Won’t this increase memory usage?
Also, does this API require a new module? Or including these in the schnorrsig
module suffice?