Skip to content

[High] Market creation throws an opaque sdk-compat error when v17 detection falls back (admin-oracle mode) #2523

Description

@dcccrypto

Found while deriving the SDK call matrix for the pre-deploy gate harness. Verified by reading the live path, not inferred.

What happens

app/hooks/useCreateMarket.ts:2048 initialises the v17 probe pessimistically:

let isV17Slab = false;
try {
  const newSlabInfo = await connection.getAccountInfo(slabPk);
  if (newSlabInfo?.data) isV17Slab = isV17Account(new Uint8Array(newSlabInfo.data));
} catch { /* fall through — conservative: assume v12 */ }

if (!isV17Slab && isAdminOracle) {
  const { encodeSetOracleAuthority, encodePushOraclePrice, ... } = await import("@/lib/sdk-compat");
  const setAuthToUserData = encodeSetOracleAuthority({ newAuthority: wallet.publicKey });   // <-- THROWS

app/lib/sdk-compat.ts is not a shim that degrades — its stubs throw at call time:

export function encodeSetOracleAuthority(_args: { newAuthority: PublicKey }): Uint8Array {
  throw new Error("[sdk-compat] encodeSetOracleAuthority: on-chain instruction removed in beta.29. ...");
}

(ACCOUNTS_PUSH_ORACLE_PRICE / ACCOUNTS_SET_ORACLE_AUTHORITY are never[], so buildAccountMetas would throw on a length mismatch even if the encoder didn't.)

Why it is reachable

The false default plus the deliberate catch-and-continue means any failure to confirm v17-ness routes a v17 market down the legacy v12 branch. The slab was created moments earlier in the same flow, so getAccountInfo returning null — not yet visible at the commitment used — is an ordinary race, not a hypothetical. A transient RPC error does the same.

Outcome: market creation fails with [sdk-compat] ... removed in beta.29, an error that describes an SDK migration rather than what actually went wrong. Whoever debugs it starts in the wrong place.

Scope / honesty about severity

  • Requires admin-oracle mode (oracleMode === "admin"). If the UI does not offer admin mode for v17 creates, this is unreachable in practice — I did not confirm the UI gating, and that check should come before deciding priority.
  • The v17 path itself is correct: v17 embeds oracle setup in InitMarket, so these instructions genuinely should never be sent. The defect is the fallback direction, not the removal.

Suggested fix

Fail closed rather than silently downgrading. Retry/confirm the account read, and if v17-ness cannot be established for a market this flow just created, surface that directly instead of taking a branch known to throw. The two await import call sites can also be dropped entirely once the v12 create path is retired.

Related

tests/harness.ts, tests/t3|t4|t6|t10*, tests/smoke-all-tiers.ts and scripts/floating-maker.ts import those four removed symbols directly from @percolatorct/sdk, where they no longer exist — so they cannot typecheck or run against the installed 4.4.0.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NgoNgagkvw7i5SSRC3FJ8D

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions