Skip to content

feat: add syncVersion helper - #396

Merged
Sekhmet merged 1 commit into
masterfrom
sekhmet/sync-version
Jun 30, 2026
Merged

Sekhmet merged 1 commit into
masterfrom
sekhmet/sync-version

Conversation

@Sekhmet

@Sekhmet Sekhmet commented Jun 30, 2026

Copy link
Copy Markdown
Member

Currently our APIs handle versionTag based reset manually. This is repetetive so it can be included in Checkpoint itself. This is flexible as consumers build the versionTag themselves.

import Checkpoint from '@snapshot-labs/checkpoint';

const GIT_COMMIT = process.env.GIT_COMMIT;
const ENABLE_SNAPSHOT_X = process.env.ENABLE_SNAPSHOT_X === 'true';
const ENABLE_GOVERNOR_BRAVO = process.env.ENABLE_GOVERNOR_BRAVO === 'true';

async function startIndexer(checkpoint: Checkpoint) {
  addStarknetIndexers(checkpoint);
  addEvmIndexers(checkpoint);

  // undefined when GIT_COMMIT is missing → always resets (safe default)
  const versionTag = GIT_COMMIT
    ? `commit:${GIT_COMMIT}|snapshotX:${ENABLE_SNAPSHOT_X}|governorBravo:${ENABLE_GOVERNOR_BRAVO}`
    : undefined;

  await checkpoint.syncVersion(versionTag);

  checkpoint.start();
}

Currently our APIs handle versionTag based reset manually.
This is repetetive so it can be included in Checkpoint itself.
This is flexible as consumers build the versionTag themselves.
@Sekhmet
Sekhmet requested a review from bonustrack June 30, 2026 14:29

@bonustrack bonustrack left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

utACK

@Sekhmet
Sekhmet merged commit 8ceacb0 into master Jun 30, 2026
1 check passed
@Sekhmet
Sekhmet deleted the sekhmet/sync-version branch June 30, 2026 16:17
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.

2 participants