Skip to main content

Module engine

Module engine 

Source
Expand description

Overlay Services Engine — the core orchestrator.

Receives transactions (submit), answers queries (lookup), manages advertisements, and coordinates GASP sync. All storage, topic management, and lookup service operations go through trait interfaces.

Ported from ~/bsv/overlay-services/src/Engine.ts (1,337 lines).

Structs§

CursorMove
One peer’s persisted last_interaction cursor moving from -> to in a sync (TopicSyncResult::cursor_moves).
DoorBudget
The DOOR’s static work bound (bsv-low W-A gate MED-1, 2026-09-09). Bitcoin script has no loops: every opcode runs at most once, so an input’s work is bounded BEFORE execution by its opcode census times the interpreter’s element limit (the stack memory limit bounds every element, and every CAT / NUM2BIN / SPLIT result with it) plus its signature checks times the transaction’s own size or a floor, whichever is more (a BIP-143 preimage hashes the prevouts and the outputs; the EC verification costs the same whatever the transaction weighs). The estimate is computed from the bytes; nothing executes past the budget, and a budget breach is the DOOR’s verdict (inconclusive: the network judges), never the interpreter’s.
DroppedDeferral
A deferred graph’s record deleted without converging (bsv-low #555, TopicSyncResult::dropped_graphs).
Engine
The Overlay Services Engine.
EngineConfig
Configuration for constructing the Engine.
GASPSyncResult
Result of a GASP sync operation.
MutationFault
One Phase-3 write — or the validation read it depends on — that FAILED during a submit (S2 queue-durable admission, bsv-low 2026-08-29).
MutationReport
What Phase 3 actually landed for a submit — the durability report.
ProofCompletionSummary
Summary of an Engine::complete_missing_proofs pass.
RenotifyReport
bsv-low PLAN-PRE-LOOP4 §H4 (2026-09-06): what Engine::renotify_admitted did.
SyncAdvertisementsReport
Outcome of one Engine::sync_advertisements run (bsv-low #320 defect 3a).
TopicSyncResult
Sync result for a single topic.
WalkCouldNotRun
A submit whose own script walk COULD NOT RUN within the engine’s DoorBudget (bsv-low #592, the owner’s ruling 3a of 2026-10-10). Shaped like EngineError::ScriptWalkOverBudget. Under WalkBreachPolicy::NotNow it is carried by EngineError::WalkCouldNotRun (not now); under WalkBreachPolicy::NetworkAccepted the submit went on as under HistoricalTxNoSpv and this says so on its MutationReport. The reference (Engine.submit, tx.verify) has no budget; this is the platform’s addition, on the door’s lineage (D8).
WalkStats
What the walk did (the door’s cost instrument, since Date.now() is frozen during synchronous work on Workers and cannot time it).

Enums§

DoorLimb
Which limb of the DoorBudget a walk went past.
EngineError
HistorySelector
Controls how much spend history to include in lookup responses.
WalkBreachPolicy
What a submit does when its own script walk could not run within the engine’s DoorBudget (bsv-low #592; the E592 lens fold, H1, the owner’s ruling 3a read with the lens): a breach is NEVER an admission without the network’s word on record.
WalkLimb
Which limb of the DoorBudget a submit’s own walk went past (bsv-low #592): the DoorLimb of the door’s error, with the interpreter’s own memory limit told apart from the static work estimate.

Type Aliases§

LandingGuard
The caller’s admission predicate over a carried predecessor the door is about to land: (predecessor txid, topic). See Engine::set_landing_guard.
LandingGuardFuture
The answer of a LandingGuard: Ok lets the body land, Err says why it may not (the topic waits).
SleepFactory
Platform sleep factory (bsv-low#302): milliseconds → a future that resolves after that delay. The Cloudflare crate passes its sleep_ms; tests pass ready(()) (instant deadline) or pending() (no deadline) to drive the race deterministically.
SleepFuture
Boxed platform sleep future (bsv-low#302). Not Send — the engine runs single-threaded on wasm (Workers) and under #[tokio::test] locally.