Skip to content

General batch verification API context #1087

Open
@siv2r

Description

@siv2r

context: #760 (comment)

I am trying to implement a PoC for the API proposed above. I have the following batch_verify object in mind.

typedef struct {
    unsigned char chacha_seed[32];  /* for generating common randomizers (1, a2, a3 ... au) */
    secp256k1_scalar randomizer_cache[2];
    schnorrsig_batch_verify sigs_data;
    tweaked_key_batch_verify tweaked_keys_data;
} batch_verify_struct;

typdef struct {
    secp256k1_scratch *sigs_data; /* (sig, msg, pk) */
    size_t len; 
    size_t capacity; /* equals (sigs_data->max_size)/(64 + 32 + sizeof(secp256k1_xonly)) */
    int result;
} schnorrsig_batch_verify;

typdef struct {
    secp256k1_scratch *tweaks_data; /* (pairity, tweaked_key, tweak32, pubkey_key) */
    size_t len;
    size_t capacity;
    int result;
} 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 data
  • secp256k1_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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions