Skip to content

Add supportsInterface #54

@cpb8010

Description

@cpb8010

Feature Request

Description

Implement ERC-165 supportsInterface in ModularSmartAccount to avoid
NoFallbackHandler error when checking for SSO account support.

Currently, calling supportsInterface(bytes4) on a ModularSmartAccount throws
a NoFallbackHandler error (0x48c9ceda) instead of returning a boolean value.
This requires consuming applications to implement error-catching workarounds to
determine if an account is an SSO account.

Rationale

Current State: The auth-server currently has to use this workaround in
useIsSsoAccount.ts:

try {
  return await publicClient.readContract({
    address: accountAddress,
    abi: [
      /* supportsInterface ABI */
    ],
    functionName: "supportsInterface",
    args: [ssoAccountInterfaceId],
  });
} catch (err: unknown) {
  // Handle NoFallbackHandler error (0x48c9ceda)
  // WORKAROUND: ModularSmartAccount doesn't implement supportsInterface yet
  // We treat NoFallbackHandler errors as SSO accounts in our dev environment
  const errorString = err.toString?.() || String(err);
  const errorMessage = (err as Error).message || "";

  if (
    errorMessage.includes("0x48c9ceda") ||
    errorMessage.includes("NoFallbackHandler") ||
    errorString.includes("0x48c9ceda") ||
    errorString.includes("NoFallbackHandler")
  ) {
    return true; // Assume it's an SSO account
  }

  return false;
}

Why This Matters:

  1. Fragile Detection Logic: Error-based detection is brittle and can break
    if error messages change or if other contracts throw similar errors
  2. False Positives: Any contract that throws NoFallbackHandler would be
    incorrectly identified as an SSO account
  3. Developer Experience: Developers integrating SSO accounts shouldn't need
    to rely on error-catching patterns for standard interface detection
  4. ERC-165 Compliance: The ERC-165 standard is designed specifically for
    interface detection and should be the canonical way to check for supported
    interfaces

Desired State: ModularSmartAccount should implement a fallback handler or
native support for supportsInterface(bytes4) that:

  • Returns true for the SSO account interface ID (and any other supported
    interfaces)
  • Returns false for unsupported interfaces
  • Never throws NoFallbackHandler error when called

This would allow clean, standards-compliant detection:

const isSsoAccount = await publicClient.readContract({
  address: accountAddress,
  functionName: "supportsInterface",
  args: [ssoAccountInterfaceId],
});
// Returns: true or false (no try/catch needed)

Additional Context

  • Current Error Code: 0x48c9ceda (NoFallbackHandler)
  • Affected Contract: ModularSmartAccount in zksync-sso-contracts
  • Related Standard:
    ERC-165: Standard Interface Detection
  • Current Workaround Location:
    packages/auth-server/composables/useIsSsoAccount.ts

Implementation Suggestions:

  1. Add a fallback handler that implements supportsInterface
  2. OR add native supportsInterface function to ModularSmartAccount
  3. Return true for supported interfaces including the SSO account interface
  4. Return false for unsupported interfaces instead of reverting

This would align ModularSmartAccount with common smart contract wallet
patterns and improve interoperability with SSO-aware applications.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions