Expand description
The deterministic contract behind state-trigger matching.
This module is the first explicit boundary in FeltDB between a deterministic semantic contract and the runtime that executes it. It exists so the question “did this committed change match this trigger?” can be answered identically by more than one implementation.
canonical input bytes
│
┌──────────────┴──────────────┐
│ │
native evaluation WASM evaluation
│ │
└──────────────┬──────────────┘
│
canonical output bytesThe contract is not a plugin system. It defines one decision with one shape, and FeltDB remains authoritative for everything around it: state, committed changes, workload creation, idempotency, authorization, durability, provenance and execution lifecycle. A contract implementation returns a decision; it never mutates FeltDB.
§Determinism budget
Evaluation reads nothing but its input. It does not consult a clock, the filesystem, the network, a random source, or any process-global mutable state, and its output contains no values derived from any of those.
§Relationship to production
crate::state_trigger::StateTrigger::matches delegates to
evaluate_trigger on the typed native path. Canonical bytes are the
wire form used to carry the same input into another runtime; production
evaluation does not pay for encoding on every candidate pair.
Structs§
- Contract
Change - The part of a committed change the decision actually depends on.
- Contract
Error Body - The error body of a contract output.
- Contract
Predicate - The deterministic equality predicate the state-trigger evaluator already had.
- Contract
Trigger - The part of a trigger definition the decision actually depends on.
- Match
Outcome - The decision.
- Trigger
Match Input - The complete deterministic input to one trigger-match decision.
- Trigger
Match Output - The complete deterministic output of one trigger-match decision.
Enums§
- Contract
Change Kind - The kind of committed change, as the contract names it.
- Contract
Error Code - Why an input could not be evaluated.
- Contract
Runtime - The runtime that executed a contract, recorded in evidence.
- Match
Reason - Why the decision came out the way it did.
Constants§
- TRIGGER_
MATCH_ CONTRACT_ ID - Stable identity of this contract. It is part of the input and the output so that a decision can never be silently attributed to a different contract.
- TRIGGER_
MATCH_ CONTRACT_ VERSION - Version of this contract’s input shape, output shape and semantics.
Functions§
- canonical_
input_ bytes - The canonical byte encoding of a contract input.
- canonical_
output_ bytes - The canonical byte encoding of a contract output.
- evaluate_
canonical - The runtime-independent entry point: canonical bytes in, canonical bytes out.
- evaluate_
canonical_ output evaluate_canonicalbefore encoding, for callers that want the value.- evaluate_
trigger - The deterministic contract, natively implemented.
- input_
digest - Content identity of a contract input, for provenance.