Skip to content

feat(sdk): add indexer discovery provider - #485

Merged
m-kus merged 1 commit into
mainfrom
pr-split/16-sdk-indexer-client
Feb 23, 2026
Merged

m-kus merged 1 commit into
mainfrom
pr-split/16-sdk-indexer-client

Conversation

@m-kus

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

Copy link
Copy Markdown

TL;DR

Add IndexerDiscoveryProvider to support discovery via the indexer API, with reorg handling and cursor-based pagination.

What changed?

  • Added IndexerDiscoveryProvider implementation that communicates with the discovery service API
  • Implemented reorg detection and recovery in the ActionCompiler
  • Updated API endpoint paths to match the latest discovery service spec
  • Added cursor conversion utilities between SDK and API formats
  • Added comprehensive tests for the indexer discovery provider
  • Updated verification checklist to include SDK checks

This change is Reviewable

@Yoni-Starkware Yoni-Starkware left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yoni-Starkware reviewed 4 files and all commit messages, and made 1 comment.
Reviewable status: 4 of 7 files reviewed, 1 unresolved discussion (waiting on ittaysw and m-kus).


sdk/src/internal/indexer-discovery.ts line 136 at r1 (raw file):

      } else if (lastKnownBlock) {
        body.last_known_block = lastKnownBlock;
      }

Note that you're not enforcing this on the Rust side

Code quote:

      if (blockRef) {
        body.block_ref = blockRef;
      } else if (lastKnownBlock) {
        body.last_known_block = lastKnownBlock;
      }

@m-kus
m-kus force-pushed the pr-split/16-sdk-indexer-client branch from 2590756 to f6f51d2 Compare February 22, 2026 17:26
@m-kus
m-kus force-pushed the pr-split/15c-preflight-endpoint branch 2 times, most recently from 94836e6 to 97c6d65 Compare February 22, 2026 18:19
@m-kus
m-kus force-pushed the pr-split/16-sdk-indexer-client branch from f6f51d2 to 88b351e Compare February 22, 2026 18:19
@m-kus
m-kus changed the base branch from pr-split/15c-preflight-endpoint to graphite-base/485 February 23, 2026 11:37
@m-kus
m-kus force-pushed the pr-split/16-sdk-indexer-client branch from 88b351e to b9915cf Compare February 23, 2026 11:48
@m-kus
m-kus force-pushed the graphite-base/485 branch from 97c6d65 to 9022d3a Compare February 23, 2026 11:48
@m-kus
m-kus changed the base branch from graphite-base/485 to main February 23, 2026 11:48
@m-kus
m-kus force-pushed the pr-split/16-sdk-indexer-client branch from b9915cf to 48f2d7e Compare February 23, 2026 11:58

@m-kus m-kus left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@m-kus resolved 1 discussion.
Reviewable status: 3 of 8 files reviewed, all discussions resolved (waiting on ittaysw and Yoni-Starkware).

@m-kus
m-kus requested a review from Yoni-Starkware February 23, 2026 11:59

@Yoni-Starkware Yoni-Starkware left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yoni-Starkware partially reviewed 1 file and made 1 comment.
Reviewable status: 4 of 8 files reviewed, 1 unresolved discussion (waiting on ittaysw and m-kus).


sdk/src/internal/indexer-discovery.ts line 538 at r2 (raw file):

    const sender = BigInt(n.sender_addr);
    const channelKey =
      channelKeyMap.get(n.sender_addr) ?? existingChannels.get(sender)?.channelKey ?? 0n;

Is this reachable? should we throw an error instead?

Code quote:

 0n;

@m-kus
m-kus force-pushed the pr-split/16-sdk-indexer-client branch from 48f2d7e to f6b4bbc Compare February 23, 2026 13:43

@m-kus m-kus left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@m-kus made 1 comment.
Reviewable status: 3 of 8 files reviewed, 1 unresolved discussion (waiting on ittaysw and Yoni-Starkware).


sdk/src/internal/indexer-discovery.ts line 538 at r2 (raw file):

Previously, Yoni-Starkware (Yoni) wrote…

Is this reachable? should we throw an error instead?

Done.

@m-kus
m-kus requested a review from Yoni-Starkware February 23, 2026 13:43
@m-kus
m-kus force-pushed the pr-split/16-sdk-indexer-client branch from f6b4bbc to 08cc49a Compare February 23, 2026 13:46

@Yoni-Starkware Yoni-Starkware left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yoni-Starkware made 2 comments and resolved 1 discussion.
Reviewable status: 3 of 8 files reviewed, 2 unresolved discussions (waiting on ittaysw and m-kus).


sdk/src/internal/indexer-discovery.ts line 238 at r2 (raw file):

            subchannel_discovery_complete: false,
            subchannels,
          };

Please share this code

Code quote:

            for (const [token, nonces] of existing.tokens) {
              subchannels[toHex(token)] = {
                last_note_index: nonces.noteNonce > 0 ? nonces.noteNonce - 1 : undefined,
              };
            }
          }
          apiCursor.channels![toHex(rb)] = {
            channel_key: toHex(info.key),
            subchannel_discovery_complete: false,
            subchannels,
          };

sdk/src/internal/indexer-discovery.ts line 375 at r4 (raw file):

    apiCursor.channels![toHex(sender)] = {
      channel_key: toHex(icc.channelKey),
      subchannel_discovery_complete: !!tokenFilter,

What if you have a token in your filter, but no notes from this token in noteIndexes? don't you need to discover subchannels in this case?

Code quote:

      subchannel_discovery_complete: !!tokenFilter,

@m-kus
m-kus force-pushed the pr-split/16-sdk-indexer-client branch from 08cc49a to 6f0b5d9 Compare February 23, 2026 14:09

@m-kus m-kus left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@m-kus made 1 comment and resolved 1 discussion.
Reviewable status: 3 of 8 files reviewed, 1 unresolved discussion (waiting on ittaysw and Yoni-Starkware).


sdk/src/internal/indexer-discovery.ts line 375 at r4 (raw file):

Previously, Yoni-Starkware (Yoni) wrote…

What if you have a token in your filter, but no notes from this token in noteIndexes? don't you need to discover subchannels in this case?

Done.

@m-kus
m-kus requested a review from Yoni-Starkware February 23, 2026 14:09

@Yoni-Starkware Yoni-Starkware left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@Yoni-Starkware reviewed 5 files and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on ittaysw).

@m-kus
m-kus force-pushed the pr-split/16-sdk-indexer-client branch from 6f0b5d9 to fb5dc93 Compare February 23, 2026 14:20
@m-kus
m-kus enabled auto-merge (squash) February 23, 2026 14:20
@m-kus
m-kus merged commit 03877c0 into main Feb 23, 2026
8 checks passed
@m-kus
m-kus deleted the pr-split/16-sdk-indexer-client branch February 23, 2026 14:21
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.

3 participants