zebra icon indicating copy to clipboard operation
zebra copied to clipboard

Add signature validation telemetry metrics for all signature types at all levels

Open dconnolly opened this issue 3 years ago • 8 comments

Motivation

We're starting to collect metrics for some of our batch signature and proof validation services. We should make sure we measure all the primitives we verify, so that we can see how many signatures we're verifying of each type over time.

Solution

Add: metrics::counter!("zebra.verified.signature.valid", 1, type => $TYPE, source => mempool/chain) metrics::counter!("zebra.verified.signature.invalid", 1, type => $TYPE, source => mempool/chain)

for each of $TYPE:

  • [x] Orchard RedPallas signatures
  • [x] Sapling RedJubjub signatures
  • [ ] Sprout Ed25519 signatures
  • [ ] Transparent secp256k1 script signatures (?)
    • Transparent signatures are verified using our script verifier service, so we may have to go inside zcash_script to instrument accurately

dconnolly avatar Mar 30 '21 15:03 dconnolly

I've updated the metric names to match zcash/zcash#4947, and confirmed that we use zcash_script to verify transparent signatures.

@str4d may also have opinions on these metric names.

teor2345 avatar Mar 30 '21 23:03 teor2345

I would suggest the prefix zcash.chain.verified.* to match other chain metrics, and I would also suggest making $TYPE a label (since signature types being verified by a full node will be low-cardinality):

  • metrics::increment_counter!("zcash.chain.verified.signature.valid", "kind" => $TYPE)
  • metrics::increment_counter!("zcash.chain.verified.signature.invalid", "kind" => $TYPE)

str4d avatar Mar 30 '21 23:03 str4d

I would suggest the prefix zcash.chain.verified.* to match other chain metrics, and I would also suggest making $TYPE a label (since signature types being verified by a full node will be low-cardinality):

  • metrics::increment_counter!("zcash.chain.verified.signature.valid", "kind" => $TYPE)
  • metrics::increment_counter!("zcash.chain.verified.signature.invalid", "kind" => $TYPE)

In Zebra, chain and mempool verification will go through the same batch verifiers, so those names won't quite work for us.

I guess we could tag requests with "chain" or "mempool" as part of this change?

teor2345 avatar Mar 31 '21 00:03 teor2345

Ah interesting, so mempool signature verification is bundled in with any concurrent block verification? In that case I agree that this should be outside the zcash.chain prefix. And if the node is caching verification success then mempool verification would displace block verification. So it might make sense to label by verification source (mempool or block), but probably is less interesting than by kind.

str4d avatar Mar 31 '21 01:03 str4d

We don't cache the results of transactions, but I guess we could if we wanted to. A cache wouldn't be much use for the initial sync, but it would help near the tip. Particularly during a chain fork.

teor2345 avatar Mar 31 '21 07:03 teor2345

And if the node is caching verification success then mempool verification would displace block verification.

Caching successful verifications is now #1968.

teor2345 avatar Mar 31 '21 07:03 teor2345

This might be needed as part of benchmarking.

teor2345 avatar Jun 02 '22 23:06 teor2345

RedPallas and RedJubjub signature verifications are being tracked as of 1.0.0-beta.11

dconnolly avatar Jun 08 '22 14:06 dconnolly

This isn't a priority for Zebra right now.

teor2345 avatar Aug 26 '22 04:08 teor2345