Skip to content

Bridge session key encryption cache to decryption cache (#495)#487

Merged
soren-da merged 1 commit into
digital-asset:mainfrom
elliottdehn:speculative-view-cache
Apr 21, 2026
Merged

Bridge session key encryption cache to decryption cache (#495)#487
soren-da merged 1 commit into
digital-asset:mainfrom
elliottdehn:speculative-view-cache

Conversation

@elliottdehn

@elliottdehn elliottdehn commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Closes #495

Summary

When a submitter encrypts session key randomness for N recipients, also store (encryptedRandomness → plainRandomness) in the decryption cache. When the same participant later confirms its own transaction, the ECIES decrypt is a cache hit — no asymmetric crypto needed.

Impact

Decrypt-side savings (confirming participant, self-confirmed transactions only):

Scenario Before After Saved
2-party self-confirm 2 ECIES decrypts (0.8ms) 0 0.8ms
CC transfer, 20 SVs, self-confirm 20 ECIES decrypts (~8ms) 0 ~8ms

Only applies to self-confirmed transactions — when the submitting participant is also a confirmer (which is the common case: the submitter is always an informee of its own transaction).

Does NOT help other confirmers (SVs confirming someone else's transaction). Their decrypt cost is unchanged.

7 lines of code. Zero risk — just populating a cache that already exists.

Relation to other PRs

Test plan

  • Existing session key cache tests pass
  • SimplestPingIntegrationTest passes
  • Session key decryption cache hit rate increases for self-confirmed transactions

🤖 Generated with Claude Code

…firm

When the submitter encrypts session key randomness for each recipient,
also store (encryptedRandomness → plainRandomness) in the decryption
cache. When the same participant later acts as a confirmer for its own
transaction, getSessionKeyRandomness finds a cache hit and skips the
expensive ECIES private-key decryption.

Today, the submitter's participant encrypts session keys (ECIES) for
N recipients, sends to sequencer, receives the same encrypted views
back as a confirmer, and decrypts them — redundantly performing ECIES
decrypt on data it just encrypted. With ~20 SVs on the Global
Synchronizer, this wastes ~8ms of ECIES work per self-confirmed
transaction.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@soren-da

Copy link
Copy Markdown
Collaborator

The decryption cache pre-population makes sense, I'll merge it.

@soren-da soren-da reopened this Apr 21, 2026
@soren-da soren-da merged commit 431be74 into digital-asset:main Apr 21, 2026
18 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session key encryption cache not bridged to decryption cache

3 participants