LEZ event exposure — journey #507 doc-packet validation

logos-docs journey #507 · validated against logos-blockchain/logos-execution-zone tag v0.3.0 (db66590a, 2026-09-29; the issue pins its test commands at f7fda38a4, a confirmed ancestor) · RISC0_DEV_MODE=1 (ZK proof generation skipped; guest compilation and execution real) · 2026-10-20.

What this review is. #507 is a documentation journey packet: R&D describes a user journey (a program emits typed events; a client reads them back through getEvents / subscribeToEvents), Docs turns it into docs, and this step validates the journey end to end so the published docs are accurate and reproducible. It is not a security audit of the events subsystem. Known or expected incompleteness of a testnet-v0.3 feature is not reported here as a defect — only things that would make the docs wrong, misleading, or impossible for a reader to reproduce.
Verdict: the journey validates. The documented mechanism — ProgramEvent → PlanOutput.events → full block re-execution → indexer ingest/filter → getEvents/subscribeToEvents — is implemented as described and was exercised live over real JSON-RPC against a real sequencer + indexer + single-node Bedrock stack (no mocks, no Docker). 173 repo tests across every layer pass; the happy path, the filtering semantics, and the unconfigured-indexer rejection were all reproduced on the wire. Three things should be added to the packet before it ships as docs (below) — they are gaps in what the doc tells the reader, not blockers.

Confirmed — the doc's claims are true

Journey claimResult (live, over JSON-RPC)
A program's emitted events are queryable via getEvents. Confirmed. getEvents {from_block:1,to_block:5} returned 5 real Deposit events from the bridge program; selector=cd499ae548cdf23d is byte-for-byte Deposit::SELECTOR; data decodes to the exact Deposit borsh layout.
Queries filter by program and/or selector, matched exactly and conjunctively. Confirmed on the wire: program-pinned → 5 events; a different account → []; selector-only (Deposit) → 5; selector for an un-emitted event (Withdraw) → [].
An indexer that doesn't retain the queried events rejects the query. Confirmed: an indexer with event_filter omitted returns JSON-RPC error -32602 UncoveredEventQuery over real RPC, and prints a correct startup warning.
Events are re-derived by the indexer from blocks (not stored in / committed to blocks). Confirmed by code + the fact that a second indexer with a different filter config answers differently on the same chain.
subscribeToEvents exists as a live subscription method. Confirmed wired up: subscription accepted, real subscription ID returned. (Delivery: see doc gap 3.)

Boundaries the repo tests precisely and that held: tx_hash precedence over block range, the 1000-block span cap, the 8 MiB byte budget, and loud failure (killed subscription) rather than silent drop on backpressure.

Add to the packet before it ships (doc feedback)

Doc gap 1 — the "Failure modes and limits" section is blank; two limits belong in it

Doc gap 2 — the "emit a new event" step is not reproducible with released tooling

The happy path we confirmed reads pre-existing genesis Deposit events. We could find no supported CLI path to emit a fresh post-genesis event and then query it: the wallet CLI exposes only per-program facades (token / AMM / ATA / bridge / program_loader, no generic call), the bridge facade only offers Withdraw, and the dedicated event_emitter test method has no wallet-CLI entry point. So a reader cannot actually walk "emit your own event → read it back" with the shipped tooling. The packet should either provide the exact method (sample program + the call that drives it) or state plainly that end-to-end emit-and-read currently requires custom code / the test harness.

Doc gap 3 — events are only queryable once their block finalizes

A block's events are persisted only in the finalization AtomicUpdate (lez/sequencer/core/src/lib.rs ~1000–1047, built from the newly_final / irreversible / finalized_up_to path). So on a non-finalizing local stack (standalone / mock-Bedrock), only genesis (block 1) events are ever stored: later blocks never finalize, so getEvents for them and subscribeToEvents both return nothing — the subscription is accepted and gets a real ID, but no notification ever arrives, and the indexer's ingestion sits at the last finalized block with status CaughtUp. (This is also why the confirmed happy path above reads genesis events.) The packet should state this plainly: exercising events end to end needs a finalizing stack — real Bedrock finality, or a faked-finality devnet — plus an indexer with event_filter: "archival".

Minor — "no Bedrock needed for the event path" needs nuance

True for the unit/integration layers (they run standalone, Docker-free). A realistic live RPC round trip uses a real Bedrock node — which can be run Docker-free straight from node-config.yaml/deployment-settings.yaml, but is not "no Bedrock." The repo's own FFI integration test additionally needs Docker (testcontainers). Worth a one-line clarification so a reader sizing the setup isn't surprised.

Evidence

Appendix — implementation observations (out of scope; not doc-packet feedback)

Surfaced in passing and kept here for our own record only. These are expected characteristics / known incompleteness of a testnet-v0.3 feature, not things to report to R&D as findings: (a) event selectors are an authoring convention, not cryptographically verified, so a selector-only query cannot distinguish a spoofed selector from an honest one; (b) the bridge Withdraw instruction panics (Deposit-only today); (c) the sequencer FFI event-coverage check synthesizes a flat filter history, latent until per-sequencer custom filters ship. The reviewer's original, fuller (security-framed) write-up is preserved at evidence/reviewer-full-report.html.