perf(votes): add attestation caching#201
Open
MatusKysel wants to merge 4 commits intofix-ABI-parsingfrom
Open
Conversation
will-2012
reviewed
Dec 12, 2025
src/node/evm/pre_execution.rs
Outdated
| LazyLock::new(|| Mutex::new(HashMap::new())); | ||
|
|
||
| static BLS_PUBKEY_CACHE: LazyLock<Mutex<BlsPublicKeyCache>> = | ||
| LazyLock::new(|| Mutex::new(HashMap::new())); |
Contributor
There was a problem hiding this comment.
SNAPSHOT_FINGERPRINT_CACHE / BLS_PUBKEY_CACHE: Are there memory issues if the instance runs for an extended period of time?
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds caching to attestation verification to improve performance. According to the flamegraph analysis, verify_vote_attestation and the underlying BLST signature verification were consuming over 10% of total execution time. The changes introduce three new caches to avoid redundant cryptographic operations and validator set processing.
- Adds attestation verification result caching to skip expensive BLS signature verification for already-validated attestations
- Implements snapshot fingerprinting and BLS public key caching to reuse parsed cryptographic objects
- Refactors validator address derivation into a dedicated method to eliminate code duplication
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/node/evm/pre_execution.rs | Adds three new caches (attestation verification, snapshot fingerprint, BLS public keys) and integrates them into the attestation verification flow. Includes unit tests for cache behavior. |
| src/node/miner/config.rs | Refactors validator address derivation logic into the new derive_validator_address_from_keys() method and updates tests to use shared helper functions. |
| src/rpc/mev.rs | Simplifies MEV API initialization by removing inline key derivation logic and relying solely on the configured validator address. |
| src/main.rs | Adds explicit error handling for validator address derivation during mining configuration setup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
20a4ecd to
f52ad0f
Compare
will-2012
approved these changes
Dec 12, 2025
galaio
reviewed
Dec 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In the original flamegraph (run before any caching),
reth_bsc::node::evm::pre_execution::verify_vote_attestationaccounted for 5.49 % of total samples and the BLSTSignature::fast_aggregate_verifyunderneath it took another 5.32 %.