Skip to content

Conversation

@mjwebblue
Copy link
Owner

No description provided.

…on features

This commit introduces a new deterministic runtime in QuickJS, allowing for controlled execution by disabling the 'eval' and 'Function' features. It includes functions to initialize the deterministic context and define properties for the host environment. The changes enhance the runtime's capabilities for deterministic execution scenarios.
This commit extends the deterministic runtime by introducing a mechanism to disable the 'Math.random' function. It includes a new function to handle the disabling and updates the context initialization to incorporate this feature, enhancing the control over random number generation in deterministic execution scenarios.
This commit introduces a new feature to the deterministic runtime in QuickJS, allowing the 'Promise' constructor to be disabled. It includes a function to handle the disabling and updates the context initialization to incorporate this feature, enhancing control over asynchronous operations in deterministic execution scenarios.
…time

This commit enhances the deterministic runtime in QuickJS by introducing the ability to disable the 'RegExp' and 'Proxy' constructors. It includes functions to handle the disabling of these features and updates the context initialization accordingly, providing greater control over the execution environment in deterministic scenarios.
…s in deterministic runtime

This commit enhances the deterministic runtime in QuickJS by introducing the ability to disable Typed Arrays, WebAssembly, and Atomics. It includes new functions to handle the disabling of these features and updates the context initialization accordingly, providing greater control over the execution environment in deterministic scenarios.
…ntime

This commit enhances the deterministic runtime in QuickJS by introducing the ability to disable the 'console' and 'print' features. It includes new functions to handle the disabling of these features and updates the context initialization accordingly, providing greater control over the execution environment in deterministic scenarios.
This commit enhances the deterministic runtime in QuickJS by introducing the ability to prevent extensions on host objects. It includes checks to ensure that extensions are disabled during context initialization, further improving control over the execution environment in deterministic scenarios.
This commit adds a gas management system to the QuickJS runtime, allowing for resource usage tracking and control. It introduces new functions to set gas limits, check remaining gas, and handle out-of-gas scenarios. The changes enhance the deterministic runtime by providing mechanisms to prevent excessive resource consumption during execution, improving overall control in deterministic environments.
This commit enhances the QuickJS runtime by introducing gas allocation tracking in memory management functions. It adds a mechanism to charge gas for memory allocations, preventing excessive resource consumption. The changes include new functions for calculating gas costs and handling out-of-gas scenarios, improving control over resource usage in deterministic environments.
This commit introduces new features to the QuickJS deterministic runtime, including support for a checkpoint-based garbage collection mechanism. It adds fields to track the state of deterministic garbage collection and modifies the garbage collection trigger to respect the deterministic mode. Additionally, a new function, JS_RunGCCheckpoint, is implemented to manage garbage collection in a controlled manner, improving resource management in deterministic environments.
This commit introduces a gas tracing system to the QuickJS runtime, allowing for detailed tracking of gas usage during execution. It adds a new structure, JSGasTraceData, to store gas usage metrics, and functions to enable, reset, and read gas trace data. The changes enhance resource management by providing insights into gas consumption for opcode execution, array callbacks, and memory allocations, improving control in deterministic environments.
This commit updates the gas tracing functionality in the QuickJS runtime by replacing the direct memory reset with a call to the new function js_gas_trace_reset_counts. This change improves code clarity and ensures that gas trace counts are reset correctly, enhancing the overall reliability of the gas tracing system.
Add a Deterministic Values (DV) codec to the QuickJS fork.

- Add quickjs-dv.c implementing JS_EncodeDV / JS_DecodeDV for a restricted CBOR subset
  (null/bool/finite numbers, UTF-8 text, arrays, plain objects as maps).
- Enforce canonical encoding: shortest-length integers, float64-only (no non-finite),
  no indefinite lengths, canonical map key ordering, and duplicate key rejection.
- Add public API types JSDvLimits/JSDvBuffer, defaults (JS_DV_LIMIT_DEFAULTS),
  and JS_FreeDVBuffer for output ownership cleanup.
- Validate UTF-8 and normalize -0 to 0 for deterministic round-trips.
…check

Introduce JS_InitDeterministicContext() and JSDeterministicInitOptions to
initialize a deterministic JSContext from an ABI manifest + optional context
blob and gas limit.

Validate manifest size and required hash, compute/compare SHA-256, throw a
ManifestError (ABI_MANIFEST_HASH_MISMATCH) on mismatch, and store owned copies
on the context (freed in JS_FreeContext). Add internal SHA-256 helpers and link
quickjs-dv/quickjs-sha256 into the QuickJS lib build.
…t + reentrancy guard)

- add JS_SetHostCallDispatcher() and JS_HostCall() public API, including JSHostCallFunc/JSHostCallResult and JS_HOST_CALL_TRANSPORT_ERROR
- implement host_call plumbing in deterministic runtime with per-context scratch response buffer + bounds/limit checks
- on Emscripten, default dispatcher calls imported host.host_call; otherwise dispatcher is unset by default
- prevent reentrant host calls via rt->in_host_call and free host_call response buffer on context teardown
Add `quickjs-host.{c,h}` implementing `HostError` construction and host response envelope parsing (T-039), including DV decode, strict envelope validation, units bounds checks, and whitelisted error code→tag mapping.

- Wire `quickjs-host.o` into `QJS_LIB_OBJS`
- Use `JS_ThrowHostTransportError()` instead of a generic `TypeError` on transport failure

Refs: T-039
…host bindings (T-040)

- add DV manifest parser + validation (sorted fn_id, js_path collision checks, reserved error codes)
- generate/install Host.v1 namespaces + per-function CFunction wrappers with pre/post gas charging
- validate args/return types (string/null/dv) and enforce per-arg utf8 limits
- expose host lifecycle API: JS_InitHostFromManifest / JS_FreeHostManifest
- init deterministic contexts from manifest and free manifest state on JS_FreeContext
- prevent extensions on Host namespaces created from the manifest

Refs: T-040
…text blob (T-041)

- add JS_InitErgonomicGlobals() to install:
  - global document() wrapper + document.canonical() backed by Host.v1.document.{get,getCanonical}
  - global canon.{unwrap,at} for canonical DV clone+freeze and safe path lookup
  - global event/eventCanonical/steps decoded from context blob (deep-frozen)
- implement deep freeze utilities and canonical clone via DV roundtrip
- wire ergonomic globals init into JS_InitDeterministicContext when a context blob is provided

Refs: T-041
…(T-043)

- quickjs-host: store per-context tape state alongside the loaded host manifest
- add tape API: JS_EnableHostTape / JS_ResetHostTape / JS_GetHostTapeLength / JS_ReadHostTape
- record Host.v1 call metadata (fn_id, req/resp lengths, units, is_error, charge_failed)
- hash request/response bytes (sha256) and record computed pre/post gas charges
- ensure tape memory is freed with JS_FreeHostManifest

Refs: T-043
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants