Skip to content

test: add deterministic ledger sequence edge-case fixtures (#346) - #398

Merged
preshotta merged 1 commit into
TRELLIS-STELLAR:mainfrom
TheDEV111:test/ledger-sequence-edge-cases
Oct 22, 2026
Merged

preshotta merged 1 commit into
TRELLIS-STELLAR:mainfrom
TheDEV111:test/ledger-sequence-edge-cases

Conversation

@TheDEV111

Copy link
Copy Markdown
Contributor

Description

Oracle verification depends on precise ledger boundaries: the inclusion ledger counts as confirmation one, a stale RPC head must defer verification, and contract data remains live through its TTL ledger. Add a focused, reusable deterministic fixture corpus and tests for these existing behaviors.

Closes #346

Changes

  • Add a transaction factory with fixed Testnet identity, account sequence, invocation arguments, and explicit time bounds so repeated construction produces identical XDR and hashes without a live RPC or wall clock.
  • Add confirmation fixtures for the first ledger, inclusion ledger, exact and exceeded thresholds, stale RPC heads, and the uint32 upper boundary.
  • Add ledger-entry fixtures for inclusive expiry, persistent archival, temporary-entry deletion, placeholder TTL zero, and the maximum ledger.
  • Exercise the actual Stellar adapter for missing/failed transactions, transient read recovery, retry exhaustion, RPC authorization refusal, and registered-submitter mismatch.
  • Exercise the adapter inside the submission verifier to prove an underconfirmed submission is deferred and the same transaction hash is verified after the ledger advances.
  • Document operational edge cases, recovery, compatibility, and rollback in docs/LEDGER_SEQUENCE_FIXTURES.md, linked from the contributor guide.

Compatibility and scope

Test and documentation additions only. Existing production behavior, API responses, database schemas, and fixtures:generate output remain unchanged. No migration is required. Reverting the additions needs no data or ledger rollback.

The fixtures use unsigned envelopes and mocked SDK RPC methods. Authorization coverage checks RPC access refusal and submitter binding; it does not execute HTTP guards, on-chain signature checks, or contract allow-lists. The public deterministic identity and historical time bounds are for offline tests only.

Validation

Passed locally:

npm test -- --runInBand src/testing/fixtures src/blockchain/oracle/services/stellar-oracle.adapter.spec.ts src/blockchain/oracle/services/stellar-oracle.adapter.events.spec.ts src/blockchain/oracle/submission-verifier.service.spec.ts

Result: 6 suites passed, 100 tests passed, including 21 new ledger-fixture tests.

ESLint and Prettier checks passed for both new TypeScript files; git diff --check passed.

Full repository type-check (tsc --noEmit --incremental false --pretty false) fails in existing code, including unresolved imports in nonce management and submission-verifier controllers. The final output contains no errors referencing either new file. Contributor quick diagnostics also reports missing local .env, DATABASE_URL, and JWT_SECRET; the selected tests run offline without those services. No live ledger submission or full application startup was performed.

@drips-wave

drips-wave Bot commented Oct 22, 2026

Copy link
Copy Markdown

@TheDEV111 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@preshotta
preshotta merged commit 5503c45 into TRELLIS-STELLAR:main Oct 22, 2026
3 of 5 checks passed
@preshotta

Copy link
Copy Markdown
Collaborator

Merged as requested after the required Malware guard passed. Please fix and rerun the remaining non-security checks:

  • build
  • Check OpenAPI contract drift

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.

Trellis: Create deterministic fixtures for ledger sequence edge cases

2 participants