moxzi
Docs / Browser / moxzi-web limits

moxzi-web limitsalpha

What actors in a browser tab can't do, or do differently from moxzid and the Internet Computer.

Execution#

LimitDetailsWhat to do
A page can't interrupt a running messageIn page mode, an infinite loop freezes the tabUse meter: true, which traps a message after instructionLimit instructions, or worker mode with deadlineMs
Instruction counting is off by defaultIt makes modules larger and slowerTurn on meter for actors whose code you don't control and set a positive instructionLimit
Fuel exhaustion is a typed trapExecutionLimitError rolls back the overrunning message and leaves the worker liveCatch it as ExecutionLimitError or its base ActorError
A missed deadline restarts the workerThe runtime restores its last committed whole-runtime generation, including spawned actors and timer policySet a finite deadlineMs as a fallback for instrumentation or engine failures
Timers run only when drivenThe runtime has no clock loopPass timerMs to Moxzi.start, or call tick()
Randomness is reproducibleraw_rand is derived from a fixed seed, so two new pages produce the same bytesDon't rely on raw_rand for secrets in the browser
Actor memory is admitted by the hostDefaults are 24 actors, 320 pages per instance, 4,000 aggregate pages for reserved linear capacity plus live stable memory, and 128 MiB per imported imageSet maxActors, maxInstancePages, maxTotalPages, or maxImportBytes to a smaller trusted ceiling. Quota failures are recoverable errors

The runtime lowers an unbounded or excessive module maximum before browser compilation and then accounts that maximum for each actor. stable64_grow uses the same aggregate ledger and returns the IC-compatible failure value when the remaining budget is insufficient. restore and loadAll reject an oversized or over-budget image before replacing committed state.

Network and identity#

LimitDetailsWhat to do
No certificatesThere's no subnet to sign themUse a real canister for certified data
Not reachable from outsideOnly the page can call its actorsUse moxzid or the IC for actors others must call
HTTPS outcalls need a worker and cross-origin isolationThe page must send Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corpSee Getting started
Outcall responses are limited to 4 MiBThey pass through a fixed-size shared bufferRequest less data

Storage#

LimitDetailsWhat to do
Two tabs can overwrite each other's saved stateindexedDbStore doesn't lockUse a different store name per tab, or save from one tab
Browser storage quotas applyIndexedDB space is limited per siteKeep large data elsewhere

Compiling in the page#

LimitDetailsWhat to do
The compiler must run on the main threadA worker's stack is too small for itCompile in page mode
Deeply nested expressions fail to compileThe browser's stack is smaller than the native one. Hand-written code is not affected; generated code with hundreds of nested operators can beCompile generated code with moxzi build, or split long expressions

Cycles#

Message and creation fees are charged, so code that checks its cycle balance sees them change. Nothing is charged while an actor is idle.

On this pageExecutionNetwork and identityStorageCompiling in the pageCycles