Skip to main content

Module executor

Module executor 

Source
Expand description

Execution engine — runs contracts deterministically in a sandbox

The executor evaluates preconditions, runs operations in an isolated environment, verifies postconditions, and logs all state transitions.

§Architecture

ICL is a specification language, not a scripting language. Operations define typed state transitions with preconditions and postconditions expressed as natural-language strings. The executor:

  1. Maintains typed state matching DataSemantics.state
  2. Validates inputs against operation parameter types
  3. Evaluates simple condition patterns against state
  4. Applies state transitions (parameter values → state fields)
  5. Verifies postconditions and invariants hold
  6. Enforces resource limits (memory, timeout)
  7. Logs every transition in an immutable provenance log

§Determinism

The executor is pure — no I/O, no randomness, no system time. All operations are deterministic: same state + same inputs = same result.

Structs§

ExecutionResult
Result of executing a full contract
ExecutionState
The mutable state of a contract during execution. Uses BTreeMap for deterministic field ordering.
Executor
The contract executor — runs operations deterministically in a sandbox
ExpressionEvaluator
Evaluates simple condition patterns against execution state.
OperationResult
Result of executing a single operation
ProvenanceEntry
A single entry in the provenance log — records one state transition
ProvenanceLog
Immutable append-only provenance log
Sandbox
Isolated execution environment with resource limits
StateChange
A single field change within a state transition

Enums§

SandboxMode
Sandbox isolation levels from spec §1.6
Value
A typed runtime value in the execution state

Functions§

execute_contract
Execute a contract with given inputs (convenience function — public API)