Description
The confirmation polling and result-validation helpers in src/services/soroban/submitAttestation.ts handle timeout, failure, mismatch, and decode errors but are only partially exercised. Add unit tests with a mocked rpc.Server covering each terminal path.
Requirements and context
- Must be secure, tested, and documented
- Should be efficient and easy to review
- Relevant code:
src/services/soroban/submitAttestation.ts, tests/unit/services/soroban/client.test.ts
- Mock
getTransaction to drive SUCCESS/FAILED/NOT_FOUND sequences
Suggested execution
- Fork the repo and create a branch
git checkout -b test/soroban-confirmation
- Implement changes
- Test
waitForConfirmation SUCCESS, FAILED, and timeout paths with fake timers
- Test
validateConfirmedResult for missing return value and root mismatch
- Assert
SorobanSubmissionError codes (CONFIRMATION_TIMEOUT, RESULT_MISMATCH)
- Validate security and correctness assumptions
Test and commit
- Run tests
- Cover edge cases
- NOT_FOUND then SUCCESS, decode failure, missing timestamp, root mismatch
- Include test output and notes
Example commit message
test: soroban confirmation and result validation
Guidelines
- Minimum 95 percent test coverage
- Clear documentation
- Timeframe: 96 hours
Description
The confirmation polling and result-validation helpers in
src/services/soroban/submitAttestation.tshandle timeout, failure, mismatch, and decode errors but are only partially exercised. Add unit tests with a mockedrpc.Servercovering each terminal path.Requirements and context
src/services/soroban/submitAttestation.ts,tests/unit/services/soroban/client.test.tsgetTransactionto drive SUCCESS/FAILED/NOT_FOUND sequencesSuggested execution
git checkout -b test/soroban-confirmationwaitForConfirmationSUCCESS, FAILED, and timeout paths with fake timersvalidateConfirmedResultfor missing return value and root mismatchSorobanSubmissionErrorcodes (CONFIRMATION_TIMEOUT,RESULT_MISMATCH)Test and commit
npm testExample commit message
test: soroban confirmation and result validationGuidelines