From 281ebb148ac38a3a25e41d94f3757ac21a59a0af Mon Sep 17 00:00:00 2001 From: pasta Date: Mon, 26 Oct 2026 10:00:41 +0000 Subject: [PATCH 1/3] fix(web): learn the protocol version before the first query A new testnet SDK starts at protocol 13 (rc.8's built-in floor) and learns the real version only from a proved response. Every Forge contract is seeded from the bundled snapshots, so connecting sends no proved request, and on a fresh tab Explore's Trending read was built at 13. rs-sdk refuses a timeRange clause there ("requires protocol version 14+"), so forge.dashhq.org showed "That read did not land" until Try again. The warm-up now sends one proved getLatestVersions (DPNS) before the connection goes live, only when the SDK is below the snapshots' protocol version, and waits at most 5 s for it. Passing `version` would pin the version and turn auto-detect off. x1 now checks that Trending's read lands. It fails on testnet without the fix. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 1 + forge-web/e2e/v2-explore.spec.ts | 7 ++- forge-web/lib/sdk/service-addresses.test.ts | 70 +++++++++++++++++++-- forge-web/lib/sdk/service.ts | 48 +++++++++++--- 4 files changed, 113 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51decde3a..52f26ac7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,7 @@ Members-only content in public repositories, Environments and the secret scan. P - **A partial clone's lazy blob fetch reads only the packs that hold the blobs** it needs, instead of downloading the whole repository again for each checkout, `git log -p` or blame. - **Issue and PR lists say when the repository's label definitions were not read completely**, instead of presenting the first page as all of them. - **A removed member's sealed author events on their own issues and PRs follow the late-content rule**, so they can no longer keep writing readable values under an old key. +- **Trending loads in a fresh tab on testnet.** A new connection learns the network's protocol version before the first page query. Before, the SDK started at protocol 13 and refused Trending's time-range read with "requires protocol version 14+" until you clicked Try again. ## [0.1.0] - 2026-10-04 diff --git a/forge-web/e2e/v2-explore.spec.ts b/forge-web/e2e/v2-explore.spec.ts index a226a3e6e..78ad2d499 100644 --- a/forge-web/e2e/v2-explore.spec.ts +++ b/forge-web/e2e/v2-explore.spec.ts @@ -34,7 +34,12 @@ test('x1. explore lists recent repos, trending, most starred and most forked, an await expect(recent.locator('a[href*="/repo"]').first()).toBeVisible({ timeout: 60_000 }) // Trending and Most starred are proved ranked reads (C-1); no "needs an indexer" note. await expect(page.getByTestId('trending-note')).toHaveCount(0) - await expect(page.getByTestId('explore-trending').getByRole('heading', { name: /Trending (this week|today)/ })).toBeVisible() + const trending = page.getByTestId('explore-trending') + await expect(trending.getByRole('heading', { name: /Trending (this week|today)/ })).toBeVisible() + // Its time-range read lands in a fresh tab, though it can be the page's first query: the SDK + // learns the protocol version (14 or more for `timeRange`) before the page queries. + await expect(trending.getByTestId('ranked-row').first().or(trending.getByText(/^No repo has \d+ new stars/))).toBeVisible({ timeout: 60_000 }) + await expect(trending.getByText('That read did not land')).toHaveCount(0) await expect(page.getByTestId('explore-most-starred').getByRole('heading', { name: 'Most starred' })).toBeVisible() // Most forked (ranked repo.forkOf, fresh core): the repos that are not forks form the index's // null group, which is never shown as a row. diff --git a/forge-web/lib/sdk/service-addresses.test.ts b/forge-web/lib/sdk/service-addresses.test.ts index 1a9d590a1..05cef7c49 100644 --- a/forge-web/lib/sdk/service-addresses.test.ts +++ b/forge-web/lib/sdk/service-addresses.test.ts @@ -12,6 +12,8 @@ const recorded = vi.hoisted(() => ({ snapshots: vi.fn(async () => ({})), emptyTestnet: false, gate: vi.fn(), + version: 14, + latest: vi.fn(async (_q: { contractIds: string[] }) => new Map()), })) vi.mock('./budget', () => ({ installDapiFetchGate: recorded.gate, dapiBudget: { retryAfterMs: () => 0 } })) vi.mock('./wasm-fetch', () => ({ compileWasm: () => Promise.resolve({}), onWasmProgress: () => () => undefined })) @@ -30,18 +32,19 @@ vi.mock('../constants', async (importOriginal) => { }) vi.mock('@dashevo/evo-sdk', () => ({ ensureInitialized: async () => undefined, + DataContract: { fromBase64: () => ({}) }, EvoSDK: class { constructor(options: EvoSDKOptions) { recorded.options.push(options) } connect = async () => undefined - contracts = { fetch: recorded.fetch, getLatestVersions: async () => new Map() } + contracts = { fetch: recorded.fetch, getLatestVersions: recorded.latest, addKnown: async () => true } wasm = { free: recorded.free } - version = () => 14 + version = () => recorded.version }, })) import testnetDeployment from '../../../forge-contracts/deployments/testnet.json' import { NETWORKS, type Network } from '../constants' -import { EvoSdkService } from './service' +import { EvoSdkService, LEARN_VERSION_MS } from './service' const services: EvoSdkService[] = [] beforeEach(() => { @@ -49,9 +52,11 @@ beforeEach(() => { recorded.options.length = 0 recorded.emptyTestnet = false recorded.fetch.mockReset().mockResolvedValue({}) - recorded.snapshots.mockClear() + recorded.snapshots.mockReset().mockResolvedValue({}) recorded.free.mockClear() recorded.gate.mockClear() + recorded.version = 14 + recorded.latest.mockReset().mockResolvedValue(new Map()) }) afterEach(() => { services.splice(0).forEach((service) => service.cleanup()) @@ -112,3 +117,60 @@ describe('trusted SDK endpoint selection', () => { expect(recorded.gate).toHaveBeenCalledWith(NETWORKS.devnet.dapiAddresses) }) }) + +describe('the protocol version before the first query', () => { + const CORE = 'D2ZLdgghZTKGpES35a3KVDp5necSfZqqRHLSknjRPAV9' + beforeEach(() => { + recorded.snapshots.mockResolvedValue({ [CORE]: { version: 1, platformVersion: 14, bytes: '' } }) + }) + + const DPNS = NETWORKS.testnet.dpnsContractId + + /** Connect, noting each `getLatestVersions` for DPNS and whether a connection was live then. */ + async function connectNoting(network: Network): Promise<{ live: boolean }[]> { + const service = new EvoSdkService() + services.push(service) + const calls: { live: boolean }[] = [] + recorded.latest.mockImplementation(async ({ contractIds }) => { + // (The seeded-snapshot check that follows going live asks for the seeded ids instead.) + if (contractIds.includes(DPNS)) calls.push({ live: service.generation > 0 }) + recorded.version = 14 + return new Map() + }) + await service.initialize({ network, contractIds: [] }) + return calls + } + + it('a new SDK below the snapshots\' version learns it from one proved read before going live', async () => { + // rc.8 starts a testnet SDK at 13; with every contract seeded, nothing else would teach it 14. + recorded.version = 13 + expect(await connectNoting('testnet')).toEqual([{ live: false }]) + }) + + it('an SDK already at that version, or with no snapshots, sends nothing before going live', async () => { + expect(await connectNoting('testnet')).toEqual([]) + + recorded.version = 13 + recorded.snapshots.mockResolvedValue({}) + expect(await connectNoting('testnet')).toEqual([]) + }) + + it('a read that fails or does not answer does not hold up the connect', async () => { + recorded.version = 13 + recorded.latest.mockRejectedValue(new Error('no available addresses')) + const failed = new EvoSdkService() + services.push(failed) + await failed.initialize({ network: 'testnet', contractIds: [] }) + expect(failed.getStatus().phase).toBe('ready') + + recorded.latest.mockReset().mockReturnValue(new Promise(() => undefined)) + const hung = new EvoSdkService() + services.push(hung) + const connecting = hung.initialize({ network: 'testnet', contractIds: [] }) + await vi.waitFor(() => expect(recorded.latest).toHaveBeenCalledWith({ contractIds: [DPNS] })) + expect(hung.getStatus().phase).not.toBe('ready') + await vi.advanceTimersByTimeAsync(LEARN_VERSION_MS) + await connecting + expect(hung.getStatus().phase).toBe('ready') + }) +}) diff --git a/forge-web/lib/sdk/service.ts b/forge-web/lib/sdk/service.ts index 077317e19..8bdeed18b 100644 --- a/forge-web/lib/sdk/service.ts +++ b/forge-web/lib/sdk/service.ts @@ -27,9 +27,11 @@ * failure never falls back to unverified reads. * * What a new connection takes over from the one it replaces: - * - the protocol version: wasm-sdk already seeds each new SDK at the version the last one - * learned (`protocol_version_store`, mainnet/testnet; a devnet's floor is current), and the - * handle's `version()` never reports lower than a version a connection proved; + * - the protocol version: wasm-sdk seeds each new SDK at the version the last one learned + * (`protocol_version_store`, in localStorage, mainnet/testnet; a devnet's floor is current), + * the handle's `version()` never reports lower than a version a connection proved, and a + * connection below the deployment's version learns it before it goes live (without a + * store every connection starts at the built-in floor; {@link learnVersion}); * - which bundled contract snapshots turned out outdated: those are fetched, not seeded * again. It preloads only the contracts pages used recently, not every id ever named. * A refreshed connection is installed only while no write is running and the last one ended @@ -1050,13 +1052,16 @@ async function preload(sdk: EvoSDK, contractIds: readonly string[]): Promise): Promise> { +async function seed(sdk: EvoSDK, deploymentKey: string, outdated: ReadonlySet): Promise<{ seeded: Map; floor: number }> { const seeded = new Map() const snapshots = await loadContractSnapshots(deploymentKey).catch(() => ({})) + const floor = Math.max(0, ...Object.values(snapshots).map((s) => s.platformVersion)) const entries = Object.entries(snapshots).filter(([id]) => !outdated.has(id)) - if (entries.length === 0) return seeded + if (entries.length === 0) return { seeded, floor } const { DataContract } = await import('@dashevo/evo-sdk') for (const [id, snapshot] of entries) { try { @@ -1066,7 +1071,32 @@ async function seed(sdk: EvoSDK, deploymentKey: string, outdated: ReadonlySet { + if ((versionOf(sdk) ?? 0) >= floor) return + let timer: ReturnType | undefined + await Promise.race([ + sdk.contracts.getLatestVersions({ contractIds: [dpnsContractId] }).catch(() => undefined), + new Promise((resolve) => { + timer = setTimeout(resolve, LEARN_VERSION_MS) + }), + ]) + clearTimeout(timer) } /** @@ -1326,10 +1356,12 @@ async function connectAndWarm( step(signal, sdk) // Seed the bundled contracts, then preload what is still missing, BEFORE the connection goes // live so callers never see an unwarmed SDK. - const seeded = await seed(sdk, NETWORKS[config.network].key, carry.outdated) + const { seeded, floor } = await seed(sdk, NETWORKS[config.network].key, carry.outdated) step(signal, sdk) await preload(sdk, config.contractIds.filter((id) => !seeded.has(id))) step(signal, sdk) + await learnVersion(sdk, floor, NETWORKS[config.network].dpnsContractId) + step(signal, sdk) return { sdk, seeded } } From af49877b154727ee3d83751ad0ff524bf59e4707 Mon Sep 17 00:00:00 2001 From: pasta Date: Mon, 26 Oct 2026 17:15:53 +0000 Subject: [PATCH 2/3] fix(web): free a connection only after its warm-up read settles When the version read outlives its 5 s wait, it keeps running on an SDK the service does not count. A retirement, an abandoned connect or an abort could then call wasm free() under it, which traps, and the SDK was never freed. The connection now carries the read (`warming`), and dispose waits for it. Co-Authored-By: Claude Opus 5.5 --- forge-web/lib/sdk/service-addresses.test.ts | 15 +++++++-- forge-web/lib/sdk/service.ts | 35 ++++++++++++++++----- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/forge-web/lib/sdk/service-addresses.test.ts b/forge-web/lib/sdk/service-addresses.test.ts index 05cef7c49..e39d58b79 100644 --- a/forge-web/lib/sdk/service-addresses.test.ts +++ b/forge-web/lib/sdk/service-addresses.test.ts @@ -163,14 +163,25 @@ describe('the protocol version before the first query', () => { await failed.initialize({ network: 'testnet', contractIds: [] }) expect(failed.getStatus().phase).toBe('ready') - recorded.latest.mockReset().mockReturnValue(new Promise(() => undefined)) + let answer!: () => void + const late = new Promise>((resolve) => (answer = () => resolve(new Map()))) + // Only the warm-up's read hangs (the seeded-snapshot check after going live is tracked anyway). + recorded.latest.mockReset().mockImplementation(async ({ contractIds }) => (contractIds.includes(DPNS) ? late : new Map())) const hung = new EvoSdkService() - services.push(hung) const connecting = hung.initialize({ network: 'testnet', contractIds: [] }) await vi.waitFor(() => expect(recorded.latest).toHaveBeenCalledWith({ contractIds: [DPNS] })) expect(hung.getStatus().phase).not.toBe('ready') await vi.advanceTimersByTimeAsync(LEARN_VERSION_MS) await connecting expect(hung.getStatus().phase).toBe('ready') + + // The read it stopped waiting for still borrows the SDK: retiring the connection frees it + // only once that read settles (a wasm `free()` under a running call traps). + recorded.free.mockClear() + hung.cleanup() + await vi.advanceTimersByTimeAsync(0) + expect(recorded.free).not.toHaveBeenCalled() + answer() + await vi.waitFor(() => expect(recorded.free).toHaveBeenCalledTimes(1)) }) }) diff --git a/forge-web/lib/sdk/service.ts b/forge-web/lib/sdk/service.ts index 8bdeed18b..cd0308234 100644 --- a/forge-web/lib/sdk/service.ts +++ b/forge-web/lib/sdk/service.ts @@ -90,6 +90,8 @@ export interface EvoSdkConfig { export interface Connection { readonly sdk: EvoSDK readonly seeded: Map + /** The warm-up's version read, when it was still running as the connection went live ({@link learnVersion}). */ + readonly warming?: Promise } /** What a new connection takes over from the one it replaces. */ @@ -230,6 +232,11 @@ function versionOf(sdk: EvoSDK): number | undefined { * frees a retired connection once its last call returned, {@link EvoSdkService.retire}). */ function dispose(connection: Connection): void { + // The warm-up's read still borrows the SDK: free it once that read settles. + if (connection.warming !== undefined) { + void connection.warming.then(() => dispose({ sdk: connection.sdk, seeded: connection.seeded })) + return + } try { ;(connection.sdk.wasm as unknown as { free?: () => void }).free?.() } catch { @@ -1085,18 +1092,28 @@ export const LEARN_VERSION_MS = 5_000 * one the floor does not support (a `timeRange` query below 14) is refused before it is sent. * One proved request (DPNS's latest version: every network has it), only when the SDK is below * `floor`, teaches it. A failure, or no answer within {@link LEARN_VERSION_MS}, is left to the - * reads, which learn the version too: the connect never waits on it longer. + * reads, which learn the version too: the connect never waits on it longer. Returns the read + * when it is still running then, so the SDK is not freed under it ({@link dispose}). */ -async function learnVersion(sdk: EvoSDK, floor: number, dpnsContractId: string): Promise { - if ((versionOf(sdk) ?? 0) >= floor) return +async function learnVersion(sdk: EvoSDK, floor: number, dpnsContractId: string): Promise<{ readonly running?: Promise }> { + if ((versionOf(sdk) ?? 0) >= floor) return {} + let settled = false + const read = sdk.contracts + .getLatestVersions({ contractIds: [dpnsContractId] }) + .catch(() => undefined) + .finally(() => { + settled = true + }) let timer: ReturnType | undefined await Promise.race([ - sdk.contracts.getLatestVersions({ contractIds: [dpnsContractId] }).catch(() => undefined), + read, new Promise((resolve) => { timer = setTimeout(resolve, LEARN_VERSION_MS) }), ]) clearTimeout(timer) + // (Wrapped: an async function returning the promise itself would wait for it.) + return settled ? {} : { running: read } } /** @@ -1360,9 +1377,13 @@ async function connectAndWarm( step(signal, sdk) await preload(sdk, config.contractIds.filter((id) => !seeded.has(id))) step(signal, sdk) - await learnVersion(sdk, floor, NETWORKS[config.network].dpnsContractId) - step(signal, sdk) - return { sdk, seeded } + const { running } = await learnVersion(sdk, floor, NETWORKS[config.network].dpnsContractId) + const connection: Connection = { sdk, seeded, ...(running !== undefined ? { warming: running } : {}) } + if (signal.aborted) { + dispose(connection) + throw new Error('the connect was abandoned') + } + return connection } /** The process-wide evo-sdk service singleton. */ From d8d8223b04ed0a8c591f66170b266fb45071f70e Mon Sep 17 00:00:00 2001 From: pasta Date: Mon, 26 Oct 2026 17:40:17 +0000 Subject: [PATCH 3/3] fix(web): the warm-up's version read is the seeded-snapshot check The warm-up asked DPNS's latest version, and right after going live the seeded-snapshot check asked the seeded contracts' latest versions. On a fresh profile that was two getDataContractsLatestVersions requests, which put the fixture's cold home over its S-1 budget (pb-1: 12 allowed, 13 sent). The warm-up now asks the seeded contracts' versions (DPNS's when nothing was seeded), and the check uses that answer instead of asking again. Co-Authored-By: Claude Opus 5.5 --- forge-web/lib/sdk/service-addresses.test.ts | 27 +++++++------- forge-web/lib/sdk/service.ts | 40 +++++++++++++++------ 2 files changed, 44 insertions(+), 23 deletions(-) diff --git a/forge-web/lib/sdk/service-addresses.test.ts b/forge-web/lib/sdk/service-addresses.test.ts index e39d58b79..6b026fb7b 100644 --- a/forge-web/lib/sdk/service-addresses.test.ts +++ b/forge-web/lib/sdk/service-addresses.test.ts @@ -124,31 +124,34 @@ describe('the protocol version before the first query', () => { recorded.snapshots.mockResolvedValue({ [CORE]: { version: 1, platformVersion: 14, bytes: '' } }) }) - const DPNS = NETWORKS.testnet.dpnsContractId - - /** Connect, noting each `getLatestVersions` for DPNS and whether a connection was live then. */ - async function connectNoting(network: Network): Promise<{ live: boolean }[]> { + /** + * Connect, noting each `getLatestVersions`: its ids, and whether a connection was live then. + * (No localStorage here, so the seeded-snapshot check after going live is always due.) + */ + async function connectNoting(network: Network): Promise<{ ids: string[]; live: boolean }[]> { const service = new EvoSdkService() services.push(service) - const calls: { live: boolean }[] = [] + const calls: { ids: string[]; live: boolean }[] = [] recorded.latest.mockImplementation(async ({ contractIds }) => { - // (The seeded-snapshot check that follows going live asks for the seeded ids instead.) - if (contractIds.includes(DPNS)) calls.push({ live: service.generation > 0 }) + calls.push({ ids: contractIds, live: service.generation > 0 }) recorded.version = 14 - return new Map() + return new Map([[CORE, { version: 1 }]]) }) await service.initialize({ network, contractIds: [] }) + await vi.advanceTimersByTimeAsync(0) return calls } it('a new SDK below the snapshots\' version learns it from one proved read before going live', async () => { // rc.8 starts a testnet SDK at 13; with every contract seeded, nothing else would teach it 14. + // The read asks the seeded-snapshot check's question, so that check sends nothing of its own. recorded.version = 13 - expect(await connectNoting('testnet')).toEqual([{ live: false }]) + expect(await connectNoting('testnet')).toEqual([{ ids: [CORE], live: false }]) }) it('an SDK already at that version, or with no snapshots, sends nothing before going live', async () => { - expect(await connectNoting('testnet')).toEqual([]) + // Only the seeded-snapshot check, after going live. + expect(await connectNoting('testnet')).toEqual([{ ids: [CORE], live: true }]) recorded.version = 13 recorded.snapshots.mockResolvedValue({}) @@ -166,10 +169,10 @@ describe('the protocol version before the first query', () => { let answer!: () => void const late = new Promise>((resolve) => (answer = () => resolve(new Map()))) // Only the warm-up's read hangs (the seeded-snapshot check after going live is tracked anyway). - recorded.latest.mockReset().mockImplementation(async ({ contractIds }) => (contractIds.includes(DPNS) ? late : new Map())) + recorded.latest.mockReset().mockReturnValueOnce(late).mockResolvedValue(new Map()) const hung = new EvoSdkService() const connecting = hung.initialize({ network: 'testnet', contractIds: [] }) - await vi.waitFor(() => expect(recorded.latest).toHaveBeenCalledWith({ contractIds: [DPNS] })) + await vi.waitFor(() => expect(recorded.latest).toHaveBeenCalledWith({ contractIds: [CORE] })) expect(hung.getStatus().phase).not.toBe('ready') await vi.advanceTimersByTimeAsync(LEARN_VERSION_MS) await connecting diff --git a/forge-web/lib/sdk/service.ts b/forge-web/lib/sdk/service.ts index cd0308234..d9c5b94dd 100644 --- a/forge-web/lib/sdk/service.ts +++ b/forge-web/lib/sdk/service.ts @@ -92,8 +92,13 @@ export interface Connection { readonly seeded: Map /** The warm-up's version read, when it was still running as the connection went live ({@link learnVersion}). */ readonly warming?: Promise + /** The seeded contracts' latest versions, when the warm-up read them ({@link revalidateSeeded} uses them). */ + readonly latest?: LatestVersions } +/** What `getDataContractsLatestVersions` answers: each contract's current version. */ +type LatestVersions = Awaited> + /** What a new connection takes over from the one it replaces. */ export interface Carry { /** @@ -1090,16 +1095,26 @@ export const LEARN_VERSION_MS = 5_000 * has a learned one, and learns the real one from the first proved response. With every * contract seeded, connecting sends none, so a page's first query is built at the floor, and * one the floor does not support (a `timeRange` query below 14) is refused before it is sent. - * One proved request (DPNS's latest version: every network has it), only when the SDK is below - * `floor`, teaches it. A failure, or no answer within {@link LEARN_VERSION_MS}, is left to the - * reads, which learn the version too: the connect never waits on it longer. Returns the read - * when it is still running then, so the SDK is not freed under it ({@link dispose}). + * One proved request, only when the SDK is below `floor`, teaches it: the seeded contracts' + * latest versions, the question {@link revalidateSeeded} asks next, so it is not asked twice + * (DPNS's, which every network has, when nothing was seeded). A failure, or no answer within + * {@link LEARN_VERSION_MS}, is left to the reads, which learn the version too: the connect never + * waits on it longer. Returns the answer, or the read when it is still running then, so the SDK + * is not freed under it ({@link dispose}). */ -async function learnVersion(sdk: EvoSDK, floor: number, dpnsContractId: string): Promise<{ readonly running?: Promise }> { +async function learnVersion( + sdk: EvoSDK, + floor: number, + contractIds: readonly string[], +): Promise<{ readonly latest?: LatestVersions; readonly running?: Promise }> { if ((versionOf(sdk) ?? 0) >= floor) return {} let settled = false + let latest: LatestVersions | undefined const read = sdk.contracts - .getLatestVersions({ contractIds: [dpnsContractId] }) + .getLatestVersions({ contractIds: [...contractIds] }) + .then((answer) => { + latest = answer + }) .catch(() => undefined) .finally(() => { settled = true @@ -1113,7 +1128,8 @@ async function learnVersion(sdk: EvoSDK, floor: number, dpnsContractId: string): ]) clearTimeout(timer) // (Wrapped: an async function returning the promise itself would wait for it.) - return settled ? {} : { running: read } + if (!settled) return { running: read } + return latest !== undefined ? { latest } : {} } /** @@ -1121,7 +1137,8 @@ async function learnVersion(sdk: EvoSDK, floor: number, dpnsContractId: string): * `getDataContractsLatestVersions`) and refetch any that moved on, e.g. forge-collab after a * contract update. The SDK also refetches on its own once a document carries a newer * `$contractVersion`; this catches the update before any such document is read. Runs at - * most once per {@link SEED_CHECK_MS} per profile while the versions keep matching. + * most once per {@link SEED_CHECK_MS} per profile while the versions keep matching, and asks + * nothing when the warm-up already read the versions ({@link learnVersion}). * * Each refetch is a stale-contract refresh ({@link refreshStale}): the page's first reads run * alongside this check, and one that fails on the old contract meanwhile joins the refetch in @@ -1133,7 +1150,7 @@ export async function revalidateSeeded(connection: Connection, deploymentKey: st const versions = JSON.stringify([...seeded].sort()) if (Date.now() - lastSeedCheck(deploymentKey, versions) < SEED_CHECK_MS) return try { - const latest = await sdk.contracts.getLatestVersions({ contractIds: [...seeded.keys()] }) + const latest = connection.latest ?? (await sdk.contracts.getLatestVersions({ contractIds: [...seeded.keys()] })) let current = true for (const [id, version] of [...seeded]) { const now = latest.get(id)?.version @@ -1377,8 +1394,9 @@ async function connectAndWarm( step(signal, sdk) await preload(sdk, config.contractIds.filter((id) => !seeded.has(id))) step(signal, sdk) - const { running } = await learnVersion(sdk, floor, NETWORKS[config.network].dpnsContractId) - const connection: Connection = { sdk, seeded, ...(running !== undefined ? { warming: running } : {}) } + const ids = seeded.size > 0 ? [...seeded.keys()] : [NETWORKS[config.network].dpnsContractId] + const { latest, running } = await learnVersion(sdk, floor, ids) + const connection: Connection = { sdk, seeded, ...(running !== undefined ? { warming: running } : {}), ...(latest !== undefined ? { latest } : {}) } if (signal.aborted) { dispose(connection) throw new Error('the connect was abandoned')