Skip to content

Add unit tests for Soroban waitForConfirmation and validateConfirmedResult #331

@thlpkee20-wq

Description

@thlpkee20-wq

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
    • npm test
  • 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

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions