Skip to content

Fix/indexer cursor - #919

Open
sebas11042 wants to merge 9 commits into
FinChippay:mainfrom
sebas11042:fix/indexer-cursor
Open

Fix/indexer cursor#919
sebas11042 wants to merge 9 commits into
FinChippay:mainfrom
sebas11042:fix/indexer-cursor

Conversation

@sebas11042

@sebas11042 sebas11042 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the Soroban eventIndexer cursor so it no longer derives its watermark from MAX(ledger_sequence), follows RPC pagination fully, and only advances after a clean, fully committed range.

Type of change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / chore
  • Smart contract change

Related issue

Closes #910

Changes

  • Added an indexer_state migration with last_processed_ledger and last_processed_tx_id.
  • Replaced MAX(ledger_sequence) cursor loading with dedicated indexer_state persistence.
  • Updated getEvents to follow Soroban RPC pagination cursors until exhausted.
  • Made event batch storage transactional and count inserted, conflicts, and errors.
  • Advanced the cursor only after conflict-free, error-free ranges.
  • Stored RPC event id/txHash in parsed payloads for safer deduplication and cursor metadata.
  • Added focused regression tests for pagination, conflicts, insert rollback, empty paged ranges, and cursor persistence.

Testing

  • Tested locally on Testnet
  • Added/updated unit tests
  • Manually tested UI flow

Commands run:

npm.cmd exec -- eslint "src/**/*.js"
npm.cmd test -- eventIndexerCursor.test.js --runInBand
npm.cmd test -- integration-eventIndexer.test.js --runInBand
npm.cmd test -- eventIndexerCursor.test.js integration-eventIndexer.test.js --runInBand 

Checklist

  • My code follows the project style
  • I've updated docs if needed
  • No console errors or warnings
  • I've rebased on latest main

@github-actions github-actions Bot added the needs-review PR ready for Greptile AI code review label Aug 26, 2026
@github-actions

Copy link
Copy Markdown

🤖 Greptile AI Code Review

Greptile will automatically review this PR (10 file(s) changed).

Review gates:

  • ✅ CodeQL Security Scan
  • ✅ Custom rules (.greptile/config.json)
  • ✅ Architecture guidelines (.greptile/rules.md)

To manually trigger a re-review, comment @greptileai on this PR.
To skip review, add the skip-review label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-review PR ready for Greptile AI code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#109 — eventIndexer Cursor Uses MAX(ledger_sequence): Ledger Reorgs or Partial Inserts Can Skip Events

1 participant