Chore/e2e coverage#117
Conversation
There was a problem hiding this comment.
Review: Chore/e2e coverage (Wave 2)
Test-only PR — no production code changes. All modifications are in NArk.Tests.End2End/ and NArk.Tests/. Safe to merge.
What's good
- Rejection/negative-path coverage is excellent.
CollabExit_WithBoardingInput_IsRejected,SubdustVtxo_SpendOffchain_IsRejected,NoteRedemption_IsRejected_WhenNoteAlreadyRedeemed— these are the tests that catch real-money bugs before they hit mainnet. BtcToArkChainSwap_RejectsWhenBoltzReturnsWrongLockupAddress— security-critical anti-scam check. The MockBoltzServer deliberately returns a wrong address and the SDK must reject. Well structured.MockBoltzServeris comprehensive and well-documented. The VHTLC address computation mirrors production code correctly (sender/receiver ordering per swap type). The WebSocket session management withSemaphoreSlim+ copy-then-iterate pattern is correct.TestWaitereliminates ad-hoc deadline loops scattered across tests — good DRY.- InvariantCulture fix (
ChainSwapTests.cs:108,326) — real bug. Polish locale0,00051232would breakbitcoin-cli sendtoaddress. Correct fix. BoltzSwapProvider404SafetyNetTests— tests the 404 safety-net at threshold=10 with proper counter-reset verification. Good use ofNSubstitute.- Unilateral exit tests re-enabled (removed
[Ignore]fromProgressExits_AdvancesFromBroadcastingToAwaitingCsvDelayandAwaitingCsvDelay_DoesNotAdvanceUntilDelayMatures). TheProgressExits_WorksForPreconfirmedVtxois correctly left[Ignore]with a clear explanation of the missingErrWaitingForConfirmationretry. SameNote_ConcurrentRedemption_ExactlyOneSucceeds— correctly[Ignore]d with a documented bug (evicted intent hangs in WaitingForBatch). Good practice to write the test and document the known issue.
Minor nits (non-blocking)
-
PR description mentions
RecoversPendingTx_WhenFinalizeNeverFollowedSubmitbut this test is not present in the diff. Either it was dropped during development or it's in a commit that didn't make it. Please update the description or add the test. -
SubdustRejectionTests.cs:95-98—Assert.CatchAsynccatches any exception type. IfSpend()throws for a reason unrelated to dust (e.g., network error, null ref), the test still passes. ConsiderAssert.ThrowsAsync<SpecificException>or at minimum assert on the exception message:Assert.That(ex!.Message, Does.Contain("dust").IgnoreCase);
-
CheckpointSpyTransport(BatchSessionTests.cs:200-255) — manual decorator over all 22IClientTransportmethods. If the interface gains a method, this breaks silently at compile time rather than at test time. Not urgent but consider a comment// If this fails to compile, add the new method hereor use a source-generated proxy. -
BoltzSwapProvider404SafetyNetTests.cs:504— the inner classDelegatingHandlershadowsSystem.Net.Http.DelegatingHandler. No functional issue since it'sprivate sealed, butFakeHandlerorLambdaHandlerwould avoid confusion during debugging. -
Missing newline at EOF in
BatchSessionTests.cs,NoteTests.cs,OnchainTests.cs—\ No newline at end of file. Trivial but some tools complain.
Protocol-critical assessment
No production code touching VTXOs, signing, forfeit paths, round lifecycle, or exit paths is modified. All changes are test infrastructure. The UnilateralExitTests exercise protocol-critical paths but only as consumers — the exit logic itself is unchanged.
Verdict: Approve. Ship it. 🚀
Reviewed by Arkana (automated, model: opus) — @d4rp4t please address nit #1 (missing test in description) before merge.
There was a problem hiding this comment.
Review: Chore/e2e coverage (Wave 2)
Test-only PR — no production code changes. All modifications are in NArk.Tests.End2End/ and NArk.Tests/. Safe to merge.
What's good
- Rejection/negative-path coverage is excellent.
CollabExit_WithBoardingInput_IsRejected,SubdustVtxo_SpendOffchain_IsRejected,NoteRedemption_IsRejected_WhenNoteAlreadyRedeemed— these are the tests that catch real-money bugs before they hit mainnet. BtcToArkChainSwap_RejectsWhenBoltzReturnsWrongLockupAddress— security-critical anti-scam check. The MockBoltzServer deliberately returns a wrong address and the SDK must reject. Well structured.MockBoltzServeris comprehensive and well-documented. The VHTLC address computation mirrors production code correctly (sender/receiver ordering per swap type). The WebSocket session management withSemaphoreSlim+ copy-then-iterate pattern is correct.TestWaitereliminates ad-hoc deadline loops scattered across tests — good DRY.- InvariantCulture fix (
ChainSwapTests.cs:108,326) — real bug. Polish locale0,00051232would breakbitcoin-cli sendtoaddress. Correct fix. BoltzSwapProvider404SafetyNetTests— tests the 404 safety-net at threshold=10 with proper counter-reset verification. Good use ofNSubstitute.- Unilateral exit tests re-enabled (removed
[Ignore]fromProgressExits_AdvancesFromBroadcastingToAwaitingCsvDelayandAwaitingCsvDelay_DoesNotAdvanceUntilDelayMatures). TheProgressExits_WorksForPreconfirmedVtxois correctly left[Ignore]with a clear explanation of the missingErrWaitingForConfirmationretry. SameNote_ConcurrentRedemption_ExactlyOneSucceeds— correctly[Ignore]d with a documented bug (evicted intent hangs in WaitingForBatch). Good practice to write the test and document the known issue.
Minor nits (non-blocking)
-
PR description mentions
RecoversPendingTx_WhenFinalizeNeverFollowedSubmitbut this test is not present in the diff. Either it was dropped during development or it's in a commit that didn't make it. Please update the description or add the test. -
SubdustRejectionTests.cs:95-98—Assert.CatchAsynccatches any exception type. IfSpend()throws for a reason unrelated to dust (e.g., network error, null ref), the test still passes. ConsiderAssert.ThrowsAsync<SpecificException>or at minimum assert on the exception message:Assert.That(ex!.Message, Does.Contain("dust").IgnoreCase);
-
CheckpointSpyTransport(BatchSessionTests.cs:200-255) — manual decorator over all 22IClientTransportmethods. If the interface gains a method, this breaks at compile time which is fine, but consider a comment noting the maintenance cost. -
BoltzSwapProvider404SafetyNetTests.cs:504— the inner classDelegatingHandlershadowsSystem.Net.Http.DelegatingHandler. No functional issue since it'sprivate sealed, butFakeHandlerorLambdaHandlerwould avoid confusion during debugging. -
Missing newline at EOF in
BatchSessionTests.cs,NoteTests.cs,OnchainTests.cs—\ No newline at end of file. Trivial but some tools complain.
Protocol-critical assessment
No production code touching VTXOs, signing, forfeit paths, round lifecycle, or exit paths is modified. All changes are test infrastructure. The UnilateralExitTests exercise protocol-critical paths but only as consumers — the exit logic itself is unchanged.
Verdict: Approve. Ship it. 🚀
Reviewed by Arkana (automated, model: opus) — @d4rp4t please address nit #1 (missing test in description) before merge.
…BatchFinalizedEvent" This reverts commit 63b514e.
…dress-match rejection
7596011 to
4db1854
Compare
There was a problem hiding this comment.
Follow-up review (commit 4db1854)
All 5 nits from my previous review addressed:
| # | Nit | Status |
|---|---|---|
| 1 | PR description referenced missing RecoversPendingTx test |
✅ Removed from description |
| 2 | SubdustRejectionTests — Assert.CatchAsync too broad |
✅ Added Does.Contain("dust").IgnoreCase assertion |
| 3 | CheckpointSpyTransport missing maintenance comment |
✅ Comment added explaining intentional compile-time breakage |
| 4 | DelegatingHandler name shadowed System.Net.Http.DelegatingHandler |
✅ Renamed to FakeHandler |
| 5 | Missing newline at EOF in 3 files | ✅ Fixed |
No new issues. Still test-only — no production code changes.
Verdict: Approve. ✅
Reviewed by Arkana (automated, model: opus)
test(e2e): Wave 1 & 2 E2E coverage — rejection tests, multi-input, chain swap security
Completes the Wave 1 & 2 test items from the E2E coverage audit #88 .
New tests
Rejection / negative paths
Batch / settlement
Unilateral exit
Chain swaps
Known issue (documented, test ignored)
SameNote_ConcurrentRedemption_ExactlyOneSucceeds — written and ignored. AlreadyLockedVtxoException recovery uses a VTXO-key-based DeleteProof, so the second host evicts the first host's registration. The evicted intent hangs in WaitingForBatch indefinitely.
Bug fix