Repository navigation
Use ArgumentNullException.ThrowIfNull in Client property setter - #10
Merged
Merged
Conversation
…lation Agent-Logs-Url: https://github.com/Tricksfor-Organization/DistributedNonce/sessions/9fd81540-7755-4bd3-a2ff-466d28379204 Co-authored-by: Phelecks <47243363+Phelecks@users.noreply.github.com>
Phelecks
marked this pull request as ready for review
March 28, 2026 17:19
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates DistributedNonceService to incorporate the blockchain chain ID into the distributed lock key, preventing cross-chain lock collisions when the same address is used on multiple networks (e.g., Ethereum + Polygon).
Changes:
- Updated distributed lock key format from
DistributedNonce_{address}toDistributedNonce_{chainId}_{address}. - Added per-instance chain ID retrieval/caching via an
eth_chainIdRPC call. - Extended integration tests to mock
eth_chainIdand added a test intended to validate multi-chain isolation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| src/DistributedNonce/Services/DistributedNonceService.cs | Adds chain ID fetching/caching and incorporates chain ID into lock keys for GetNextNonceAsync and ResetNonceAsync. |
| tests/DistributedNonce.Tests/DistributedNonceIntegrationTests.cs | Updates RPC mocks to handle eth_chainId and adds an integration test intended to cover chain-based isolation. |
…oth methods Agent-Logs-Url: https://github.com/Tricksfor-Organization/DistributedNonce/sessions/d9924183-4db0-4706-a9b3-9f7cc8733f6f Co-authored-by: Phelecks <47243363+Phelecks@users.noreply.github.com>
…nt setter Agent-Logs-Url: https://github.com/Tricksfor-Organization/DistributedNonce/sessions/9dc86feb-2962-4e16-99b1-ad4a766e45d9 Co-authored-by: Phelecks <47243363+Phelecks@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Tricksfor-Organization/DistributedNonce/sessions/3ec7ab5c-f50a-4115-8404-cd7419391e90 Co-authored-by: Phelecks <47243363+Phelecks@users.noreply.github.com>
Copilot
AI
changed the title
Add chain ID to distributed lock cache key for multi-chain isolation
Add chain ID to distributed lock key for multi-chain nonce isolation
Mar 28, 2026
Agent-Logs-Url: https://github.com/Tricksfor-Organization/DistributedNonce/sessions/58932dcb-4ab5-432c-9e86-2902fa5631f2 Co-authored-by: Phelecks <47243363+Phelecks@users.noreply.github.com>
Copilot
AI
changed the title
Add chain ID to distributed lock key for multi-chain nonce isolation
Consolidate nonce + chain ID init into a single distributed lock
Mar 28, 2026
Agent-Logs-Url: https://github.com/Tricksfor-Organization/DistributedNonce/sessions/8ed1eb1f-ba24-4521-af20-ecede7081a1f Co-authored-by: Phelecks <47243363+Phelecks@users.noreply.github.com>
Copilot
AI
changed the title
Consolidate nonce + chain ID init into a single distributed lock
Use ArgumentNullException.ThrowIfNull in Client property setter
Mar 28, 2026
|
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.


The
Clientproperty setter used a verbose manual null-check pattern instead of the idiomatic .NET 6+ helper.Change
Replaced in
CreateDistributedNonceServiceInstance.Clientsetter:ThrowIfNullauto-captures the parameter name via[CallerArgumentExpression], eliminating thenameofboilerplate while preserving identical runtime behavior.⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.