Skip to content

feat(indexer): preflight endpoint, sync with abstract discovery provider interface - #439

Closed
m-kus wants to merge 1 commit into
02-06-feat_indexer_outgoing_state_sync_endpointfrom
02-06-feat_indexer_preflight_endpoint_sync_with_abstract_discovery_provider_interface
Closed

m-kus wants to merge 1 commit into
02-06-feat_indexer_outgoing_state_sync_endpointfrom
02-06-feat_indexer_preflight_endpoint_sync_with_abstract_discovery_provider_interface

Conversation

@m-kus

@m-kus m-kus commented Feb 6, 2026 •

Copy link
Copy Markdown

TL;DR

Refactored the Discovery Service API with improved endpoint naming, enhanced cursor structure, and added a new preflight endpoint for transfer readiness checks.

What changed?

  • Renamed /v1/discovery/incoming/sync to /v1/sync/incoming_state for consistency
  • Added new /v1/discovery/preflight endpoint to check transfer readiness
  • Improved cursor structure:
    • Changed total_n_subchannels to skip_subchannel_discovery boolean flag
    • Added skip_channel_discovery flag to optimize channel discovery
    • Added max_note_index to optimize note scanning with exponential probing
    • Keyed channels by sender address instead of channel key for better organization
  • Added helper functions for computing channel and subchannel markers
  • Reduced default max_reads from 1000 to 50 (capped at 100) for better request sizing
  • Enhanced response structure with more consistent field naming and organization

How to test?

  1. Use the new /v1/sync/incoming_state endpoint to discover incoming notes
  2. Test the /v1/sync/outgoing_state endpoint to discover outgoing channels
  3. Try the new /v1/discovery/preflight endpoint with:
    {
      "sender_address": "0x...",
      "viewing_key": "0x...",
      "recipient": "0x...",
      "token": "0x..."
    }
  4. Verify the preflight response contains the expected flags:
    {
      "block_ref": "0x...",
      "sender_registered": true,
      "channel_exists": true,
      "subchannel_exists": true
    }

Why make this change?

These changes improve the API's consistency, efficiency, and usability:

  1. The preflight endpoint enables clients to quickly check transfer readiness with minimal storage reads (max 4)
  2. The improved cursor structure reduces unnecessary storage reads by skipping already-discovered channels/subchannels
  3. The exponential probing for note discovery optimizes scanning for sparse note distributions
  4. Consistent naming and organization makes the API more intuitive and easier to use
  5. Smaller default read limits help prevent excessive resource usage while still allowing pagination

This change is Reviewable

m-kus commented Feb 6, 2026 •

Copy link
Copy Markdown
Author

@m-kus
m-kus marked this pull request as ready for review February 6, 2026 19:38
@m-kus
m-kus marked this pull request as draft February 6, 2026 21:15
@m-kus m-kus closed this Feb 9, 2026
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.

1 participant