Skip to content

Add concurrency regression tests for V2 IndirectSignatureFactory#193

Closed
JeromySt wants to merge 1 commit intousers/jstatia/v2_clean_slatefrom
fix/v2-thread-safe-hash-algorithm
Closed

Add concurrency regression tests for V2 IndirectSignatureFactory#193
JeromySt wants to merge 1 commit intousers/jstatia/v2_clean_slatefrom
fix/v2-thread-safe-hash-algorithm

Conversation

@JeromySt
Copy link
Copy Markdown
Member

@JeromySt JeromySt commented Apr 7, 2026

Summary

Adds concurrency regression tests for the V2 IndirectSignatureFactory, related to #191.

Context

The V1 IndirectSignatureFactory cached a shared HashAlgorithm instance causing CryptographicException under concurrent usage (fixed in #192). The V2 implementation already uses thread-safe static hash methods (TryHashData, IncrementalHash.CreateHash) that create fresh instances per call, so no code fix is needed.

Changes

  • Added ConcurrentHashComputationShouldNotThrow — hammers the factory with Parallel.For from many threads
  • Added ConcurrentAsyncHashComputationShouldNotThrow — launches many concurrent async tasks
  • Both tests verify results are non-null/non-empty

These tests serve as a regression guard to ensure V2 remains thread-safe as the codebase evolves.

V2's IndirectSignatureFactory already uses thread-safe static hash methods
(TryHashData, IncrementalHash) that create fresh instances per call.
Adding regression tests to guard against future regressions.

Related to #191

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@JeromySt JeromySt closed this Apr 7, 2026
@JeromySt JeromySt deleted the fix/v2-thread-safe-hash-algorithm branch April 7, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants