snarkOS icon indicating copy to clipboard operation
snarkOS copied to clipboard

[Optimization] Avoid checking certificate signatures twice.

Open acoglio opened this issue 8 months ago • 1 comments

As a validator collects endorsing signatures from other validators, it verifies them. When it has enough signatures, it creates a certificate with BatchCertificate::from(), which verifies the signatures again. We can avoid this duplication by having the validator call BatchCertificate::from_unchecked() instead. BatchCertificate::from() performs a few other simple checks besides verifying signatures; these other simple checks are easy for the validator to perform before calling BatchCertificate::from_unchecked().

acoglio avatar Mar 27 '25 03:03 acoglio

There's a similar issue where, after creating a block, the validator adds it to the ledger which re-checks the block's DAG and certificates again.

For both cases, I like the idea of having some inexpensive sanity checks, instead of doing a full check, as proposed in the PR.

kaimast avatar May 19 '25 22:05 kaimast