Skip to content

Encryption State Evals Causing Config Sync Bloat #108

@lamat1111

Description

@lamat1111

When a user creates a space, the encryption state stores ~10,000 polynomial evaluations (evals) for private invite generation. Each eval is ~200 bytes, resulting in ~2MB per created space.

A test user who created more than one space hit the API config sync limit (invalid config missing data 400 error) because the total payload exceeded the server limit.

This is strange, I was not hitting it some days ago, and I had Sycn enabled for all my test users (always have).
API limit has ben reduced?

Root Cause

In SpaceService.createSpace(), the SDK is called without a total parameter, defaulting to ~10,000 evals:

// src/services/SpaceService.ts:343-347
const session = await secureChannel.EstablishTripleRatchetSessionForSpace(
  keyset.userKeyset,
  keyset.deviceKeyset,
  registration
  // No 'total' parameter → defaults to ~10,000
);

Solution?

On-demand eval generation: Can the SDK generate evals incrementally when needed, rather than all upfront at space creation?

This would allow:

  • Spaces to start with 0 or minimal evals (~12KB like joiners)
  • Evals generated only when creating private invites
  • No arbitrary limit that's either too small (runs out) or too large (bloats sync)

Note: Consumed evals are already removed from state when private invites are sent (InvitationService.ts:95-102). The issue is the initial 10K allocation.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions