Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: Stop expensive cryptographic validation when deserializing shielded transactions #7939

Open
Tracked by #7728
teor2345 opened this issue Nov 13, 2023 · 1 comment
Labels
A-blockchain-scanner Area: Blockchain scanner of shielded transactions A-state Area: State / database changes C-bug Category: This is a bug I-slow Problems with performance or responsiveness S-needs-triage Status: A bug report needs triage

Comments

@teor2345
Copy link
Contributor

teor2345 commented Nov 13, 2023

Motivation

Zebra's transaction deserialization does a lot of CPU-heavy cryptography for shielded transactions.

Since we know that transactions in our database are valid, we can deserialize them without checking the validity of curve points.

API Reference

TODO: which methods are causing this CPU usage, and what can they be replaced with?

Detailed Analysis

See #4583 (comment)

Designs

In zebra-chain:

  • split out transaction deserialisation methods that optionally do validation
  • do validation by default in ZcashDeserialize (with transactions and blocks from the network and RPCs)

In zebra-state:

  • skip validation for transactions and blocks when reading from the state in FromBytes

Related Work

@teor2345 teor2345 added C-bug Category: This is a bug S-needs-triage Status: A bug report needs triage P-Low ❄️ I-slow Problems with performance or responsiveness A-state Area: State / database changes A-blockchain-scanner Area: Blockchain scanner of shielded transactions labels Nov 13, 2023
@mpguerra mpguerra added this to Zebra Nov 13, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New in Zebra Nov 13, 2023
@teor2345 teor2345 changed the title bug: Stop expensive cryptographic validation when deserializing shielded transactions perf: Stop expensive cryptographic validation when deserializing shielded transactions Nov 13, 2023
@mpguerra
Copy link
Contributor

Is this still relevant outside of the zebra-scan crate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-blockchain-scanner Area: Blockchain scanner of shielded transactions A-state Area: State / database changes C-bug Category: This is a bug I-slow Problems with performance or responsiveness S-needs-triage Status: A bug report needs triage
Projects
Status: New
Development

No branches or pull requests

2 participants