Choose what this site may use

This site uses strictly necessary cookies to work and to remember your privacy choices. With your permission it would also load content hosted by other services, such as videos, maps and fonts, which then receive your network address and device data. We do not sell or share your personal information and we run no advertising. Choose Accept all, Reject all or Customise. You can change your mind at any time through Privacy choices at the foot of every page.

  • Always on

    Needed for the site to work and to remember your privacy choices. Always on.

  • Remembers settings you choose, such as the light or dark display, in your browser.

  • Loads videos, maps and other content hosted by other services. Those services receive your address and device data.

Menu Close
In this section: Build
Start
Reference code
Tools
API reference
Public services
Agents
Bindings and crosswalks

Rust reference workspace

REFERENCE Source reference/rust/README.md

On this page
  1. Architecture of the gateway
  2. Node agent (obsp-node)
  3. Node intake of the gateway (feature ingest)
  4. Evidence verifier (obsp-verify)
  5. End-to-end test
  6. The 0.2 candidate (DRAFT)
  7. Data plane of the gateway (features postgres, nats, s3, fast-alloc)
  8. Performance bench (WP-RI-11)
  9. How to run
  10. Live harness run
  11. What is covered and what is not
FieldValue
StatusReference code; live harness checks pass; no conformance claim
Versionsobsp-core 0.0.2, obsp-gateway 0.0.1

Crates that implement parts of the Observatory Protocol in Rust, as reference aids for implementers. Nothing here is a conformance claim: passing these tests, or the live harness, says nothing about any implementation’s conformance level, and no level above SELF_TESTED evidence can rest on it (see registers/conformance-profiles.yaml).

Crate What it is
obsp-core Library and obsp command: RFC 8785 canonical JSON, Digests, UNIs, JSON Schema validation of the protocol’s contracts, and the signature envelope of the draft proposal OIP-0008 (COSE_Sign1 over JCS bytes; Ed25519, ECDSA P-256 and P-384, ML-DSA-44/65/87; the algorithm register); the SIG-2 payload rule oip-0008 (default) or integration-0.2, the 0.2 object classes and the 0.2 schema set (DRAFT)
obsp-exchange Library: the exchange plane, correction-aware in every binding (drafts OIP-0001, OIP-0005, OIP-0009, OIP-0024): OGC API Common, Features Parts 1 to 3 (CRS, CQL2), EDR 1.1 (CoverageJSON) and Records; SensorThings API 1.1 read with its MQTT topics; STAC API with the obsp extension; WIS 2.0 notifications over MQTT 5; a CAP 1.2 feed; CloudEvents over HTTP; signed webhooks with retry, dead letters and replay; SSE and WebSocket streams; a gRPC Exchange service. Guide: docs/guides/exchange.md
obsp-gateway Binary obsp-gateway and library: an HTTP server for the participant gateway API (schemas/openapi/obsp-gateway.openapi.yaml), behind the exchange feature (on by default) the exchange plane of obsp-exchange at its root (--mqtt-broker, --grpc-listen), behind the ingest feature (on by default) a node intake for replay batches with read-back of the stored records, and behind the obsp-0.2 feature, switched on with --obsp-0.2, the 0.2 candidate (DRAFT): observation records 4.0.0, OIP-0002 proof challenges and verification reports, OIP-0003 plan submission
obsp-node Binary obsp-node and library: a NODE-profile agent (node manifest and sensor passports; JSON-lines and Sparkplug-JSON input adapters; observation, quality-flag, time-quality and provenance records; OIP-0008 draft signatures; append-only outbox with replay; the node-side decision on signed plans of the draft OIP-0003); feature obsp-0.2 writes the 4.0.0 record shape of OIP-0006 with origin and subject class and answers OIP-0002 proof challenges; feature orchestrate fetches, verifies and applies signed plans and SUIT-referenced firmware with staged apply and rollback on a failed health check, and the gateway’s feature orchestrate publishes them (ORCHESTRATE.md)
obsp-verify Binary obsp-verify and library: verifies an evidence directory (schemas, digests, OIP-0008 draft signatures, reference graph) with the checks of the web verifier (reference/web/verifier), and prints a JSON report and a human summary; --profile 0.2 runs the 0.2 candidate with the 23 draft checks of the TypeScript SDK; the node-side plan decision of OIP-0003 (obsp_verify::plans, shared by the node and the gateway) and its issuing side (plans::Issuer), the SUIT install decision of the draft OIP-0028 binding (obsp_verify::suit); offline checks of the reference logs’ signed tree heads, RFC 9162 inclusion and consistency proofs, witness cosignatures against a k-of-n policy and split views (obsp_verify::witness, obsp-verify witness <vectors>; a reference-log feature, not protocol: WITNESS.md); a data file against its detached evidence sidecar of draft OIP-0032 (obsp_verify::sidecar, obsp-verify sidecar FILE [SIDECAR] --anchors KEYS [--receipt R --trusted-root HEX], --vectors replays the vectors of reference/python/obsp_sidecar)
obsp-federation Library and binary obsp-federation: the federation reference service for the draft proposal OIP-0004 against the 0.5 candidate’s schemas: signed federation bindings exchanged between two parties, authority leases granted and renewed by a quorum of grantors with epochs, writes only inside an unexpired lease, read-only on partition, rejoin reconciled by epoch then digest with correction candidates, unlisted data classes never exported; a deterministic state machine, an HTTP transport, a multi-peer simulation with injectable partitions, loss and clock skew that checks the invariants of the proposal’s TLA+ model on a fixed seed set, and a replay of TLC counterexamples
obsp-gnss-evidence Library: the reference evaluator of the draft proposal OIP-0033: RTCM 3 frames (CRC-24Q, antenna position), RINEX 3 and 4 headers, NTS-KE responses (RFC 8915 section 4) and Roughtime responses (an Internet-Draft) as time and location evidence; OSNMA status and jamming or spoofing indicators are carried as receiver claims, never as checked; absent inputs stay absent. Constructed vectors only (obsp-gnss-evidence/tests/vectors/README.md lists the real-signal vectors still needed)
obsp-policy Library and binary obsp-policy: the usage-policy evaluator of the draft proposal OIP-0014 (obsp-odrl profile; PERMIT or DENY with every OBS-GOV reason code, duties and transforms; policy-decision documents scoped to declared terms; the 35 draft vectors), its governance invariants, the nine sov-* invariants of the draft OIP-0021 over a SovereigntyEvidence document, and an enforcement point (policy store, the policy that governs a record, refusal problem documents) used by the gateway (feature policy) and the federation service
obsp-dataplane Library: the data plane of the gateway: CloudEvents 1.0 (structured JSON), an event bus with durable consumers and at-least-once delivery (in memory; NATS JetStream with feature nats), content-addressed object storage by SHA-256 digest (local file system; S3-compatible with feature s3), the outbox relay and the correction fan-out workers (docs/ops/dataplane.md)
obsp-load Binary obsp-load: a reproducible load harness for the node intake (deterministic signed nodes and records, many clients, one or more gateway replicas) and scripts/topology.sh; measured results

Licence: Apache-2.0 (LICENSES/Apache-2.0.txt), except the copied draft vectors in obsp-core/tests/vectors/ and obsp-node/tests/vectors/ and the copied 0.2 schemas in obsp-core/tests/data/ and the copied 0.5 material in obsp-federation/tests/data/ and the copied OIP-0014 and OIP-0021 material in obsp-policy/tests/data/, which keep their source licence (CC-BY-4.0). The crates read the protocol’s schemas, registers and fixtures from a checkout at run time; obsp-verify (and through it the gateway and the node) also embeds the draft algorithm register copied into obsp-core/tests/vectors/oip-0008/ and reads the OIP-0008 draft schemas the web verifier reads (reference/typescript/obsp-sdk/test/fixtures/oip-0008/schemas/).

The gateway and the federation service have a metrics feature (off by default): GET /metrics in the Prometheus text format, with fixed label sets (obsp-gateway/tests/metrics.rs, obsp-federation/tests/drive.rs). Container images and a local stack that runs these crates together are in infra/.

Architecture of the gateway

              HTTP/1.1 (axum on tokio)
                       |
             one fallback handler: no framework extractors, so every
             error, including routing and body limits, is a problem document
            /                                         \
  /obsp/v0.1/...  participant gateway           /, /conformance, /collections/...
  contracts.rs: the 7 operations as a table     exchange.rs (feature "exchange"):
  (checked against the OpenAPI document)        draft OIP-0001 read endpoints over a
  lib.rs: context, idempotency, validation,     seed of product manifests and
  the effect of each write                      observation records; read-only
            |                                         |
  backend.rs: the store trait                   obsp-core: schemas, digests
  store.rs (memory, JSON-lines) | pg.rs (PostgreSQL, feature "postgres")
            |
  obsp-core: SchemaSet (request and response validation), canonical digests (ETag, idempotency)

Participant gateway (/obsp/v0.1)

Operation Route Success What the gateway does besides validating
registerParticipant POST /participants 201 refuses a participant UNI already registered (409 OBS-CONFLICT-0001)
fileConformanceClaim POST /conformance-claims 201 profiles must be in registers/conformance-profiles.yaml and suiteVersion equal to conformance/suite.yaml (422 OBS-CLAIM-0001, OBS-CLAIM-0002); a claim UNI already filed is refused (409); filing grants nothing
getConformanceClaim GET /conformance-claims/{claimUni} 200 404 OBS-NOTFOUND-0001 for an unknown UNI
getRegister GET /registers/{name} 200 registers/<name>.yaml rendered as JSON, ETag = the canonical SHA-256 Digest of the body (RFC 8785), If-None-Match answered with 304; 404 OBS-REGISTER-0001
joinNode POST /join 201 the attester must be a node (403 OBS-JOIN-0001); a node already enrolled with another manifest is refused (409); answers an attestation result and a bootstrap bundle filled in from the request (see “not covered”)
admitProvider POST /admit 202 every supply-chain receipt must be VERIFIED_FOR_SCOPE (403 OBS-ADMIT-0001); answers a qualification record with result CONDITIONAL and the limitation that nothing was admitted
describeNode GET /describe/{nodeUni} 200 the manifest of an enrolled node; 404 otherwise

Every consequential call (the four POSTs), in this order:

  1. Obsp-Request-Context (unpadded base64url of RFC 8785 JSON) must be present, decode and validate against request-context, else 400 OBS-CTX-0001 (specification 4.3). With --tenant, a context for another tenant is refused (403 OBS-CTX-0003). A context on a read is validated when present.
  2. Idempotency-Key of 8 to 128 characters (400 OBS-IDEM-0002); a context idempotencyKey must equal it (400 OBS-CTX-0002).
  3. Content-Type: application/json (415 OBS-CONTRACT-0002), a body of at most 1 MiB (413 OBS-CONTRACT-0004) that parses and validates against the operation’s request schema (400 OBS-CONTRACT-0001 with violations).
  4. Idempotency, scoped by operation, tenant and key: the same key with the same body (by canonical digest) gets the stored answer again (header Idempotent-Replayed: true); with another body, 409 OBS-IDEM-0001.
  5. The answer is validated against the operation’s response schema before it is sent; an answer that fails is never sent (500 OBS-CONTRACT-0003). Reads are validated the same way.
  6. The write is recorded (with --store, appended to the file and flushed before the answer; 503 OBS-STORE-0001 if that fails).

Other errors: unknown route 404 OBS-ROUTE-0001; known route, wrong method 405 OBS-ROUTE-0002 with Allow; a path parameter outside its pattern 400 OBS-CONTRACT-0005. Every error is an application/problem+json document valid against error-problem (RFC 9457 members plus errorCode, category, correlationId, retryable; the context’s correlationId and requestId are echoed when the call carried one).

Exchange plane (feature exchange, crate obsp-exchange, drafts OIP-0001, OIP-0005, OIP-0009, OIP-0024)

At the root of the server the gateway mounts obsp-exchange: OGC API Common, Features Parts 1 to 3 (CRS by reference, CQL2 filters), EDR 1.1 with CoverageJSON, Records (catalogue: one record per product manifest; systems: stations and sensors), SensorThings API 1.1 read under /sta/v1.1, the STAC API under /stac, a CAP 1.2 feed under /cap, CloudEvents under /events, SSE and WebSocket streams, signed webhooks under /subscriptions, and, from the binary, an MQTT 5 publisher (--mqtt-broker: WIS 2.0 notifications, SensorThings Observations, CloudEvents) and a gRPC Exchange service (--grpc-listen, feature grpc). Every projection is correction-aware: a superseded, withdrawn or recalled value stays served with its state and a link to its successor. The gateway checks the seed with its compiled contracts and renders every refusal as an error-problem document (EXCH-8); every write is 405 OBS-ROUTE-0002 (EXCH-3).

Products, record versions, correction notices, systems and alert notices come from a seed file (--exchange-seed; example: obsp-gateway/examples/exchange-seed.json: two products, one superseding the other, a typed missing value, a true zero, a superseded record version, a withdrawn record and two alerts). Paths, the correction model, webhooks and the recorded test results: docs/guides/exchange.md.

Node agent (obsp-node)

 input adapter                 records.rs                          outbox.rs               lib.rs (flush)
 JSON lines  --\                                                                                       POST
                >-- Reading -> QC (RANGE, STEP) -> observation  -> replay batch -> append  -> attempt  -----> gateway
 Sparkplug   --/    (passport    time-quality, provenance,        (batchId =    + fsync     line,       /node-ingest/
 JSON (draft        in force)    quality-flag records;             digest of               settled on  v0.1/replay-
 OIP-0007)                       OIP-0008 envelope on each         the cut)                any answer  batches
                                 observation; key record and
                                 passports published once
cargo run -p obsp-node -- run --config obsp-node/tests/data/node.json --input obsp-node/tests/data/readings-1.jsonl \
    --gateway http://127.0.0.1:8080 --root ../..
cargo run -p obsp-node -- replay --config obsp-node/tests/data/node.json --gateway http://127.0.0.1:8080
cargo run -p obsp-node -- status --config obsp-node/tests/data/node.json
cargo run -p obsp-node -- apply-plan --config <node.json> --plan <plan.json> [--now <rfc3339>]

(The sample configuration writes its outbox next to itself; copy obsp-node/tests/data/ somewhere else to try it.) Exit status: 0 every batch settled and every event acked; 1 an event or a plan was refused; 2 a usage, configuration or input error; 3 batches remain queued because the gateway did not answer.

  • Configuration (src/config.rs): the node manifest and every sensor passport are validated against the live schemas and the passports must name the manifest’s node. The signing key is read from a file (32-byte seed in hexadecimal); obsp-node/tests/data/node-key.hex is a test key whose seed is derived from a public label.
  • Adapters (src/adapters.rs): JSON lines (passportUni, property, resultTime, value, resultState; a null value is MISSING, never zero) and decoded Sparkplug B payloads as JSON per the draft binding of OIP-0007 (native id from the topic, the connector mapping’s fields and quality table, seq modulo 256 per edge node with gaps recorded, NDEATH only for the current birth bdSeq, transient and unmapped metrics never in a result, STATE and commands never converted). Missing-data records and unmapped fields go to the run summary, not into observation records (their connector-output contract is a draft). Protobuf decoding is not done.
  • Records (src/records.rs): observation records of the live schema (3.1.0) with inline quality flags, a time-quality record per batch from the declared clock source, a PROV-O provenance record per batch (raw input lines used by one acquisition activity of the node’s software agent), quality-flag records for every SUSPECT or BAD flag of the node’s own tests, references by UNI and RFC 8785 digest. Each observation carries an OIP-0008 draft envelope (Ed25519, object class observation); the live observation-record schema refuses a signature member today, so the gateway and obsp-verify check signed observations without the member against the live schema and the member against the draft envelope schema. The STEP limit comes from the passport’s extensions."obsp.qc".rateOfChange, a convention of this agent. With the feature obsp-0.2 and "recordVersion": "4.0.0" the observation follows the OIP-0006 shape of the 0.2 series, with origin and subject class (checked against the series’ schema); a gateway refuses those records unless it serves the 0.2 candidate (see “The 0.2 candidate”).
  • Outbox and replay (src/outbox.rs): every batch is appended and flushed to disk before it is sent; each transmission is recorded first (attempt), and any HTTP answer settles the batch (5xx and no answer leave it queued). The batch is a live replay-batch; batchId is the digest of its ordered event ids and payload digests, so a retry keeps it, and attempt never changes an event id or payload digest. Each request carries an Obsp-Request-Context and an Idempotency-Key (rb-<batch>-a<attempt>).
  • Signed plans (src/plans.rs): the node-side decision of the draft OIP-0003 (rollback and replay, expiry, threshold with distinct root-listed keys, mix-and-match, freeze, root chaining, the reserved tasking kind), returning OBS-PLAN-0001 to -0007 before any state change. Beyond the draft’s reference decision, a signature counts only when its COSE_Sign1 signature verifies over the role’s payload. apply-plan refuses without a trusted root (trustedRoot, standing in for the bootstrap bundle member the draft leaves open) or without trusted time, and writes its trusted state only on acceptance. Every node vector of the draft gives its listed codes (obsp-node/tests/vectors/oip-0003/, copied).

Node intake of the gateway (feature ingest)

No operation of the gateway OpenAPI carries observations from a node, so the intake is a reference aid under its own base path, /node-ingest/v0.1, and not a protocol contract:

Route What it does
POST /replay-batches a live replay-batch with the rules of every consequential call (RequestContext, Idempotency-Key, media type, schema, idempotent replay, answer validated, store flushed first); the context’s tenant must be the batch’s. Per event: ACCEPTED; IDEMPOTENT_REPLAY (same id, same payload digest); CONFLICT (same id, other digest; never acked); REJECTED (payload digest not the RFC 8785 digest of the payload, unknown event type, payload failing its schema, a key record naming another controller than the batch’s node, or a signature that does not verify against the node’s key records received so far). Answer: a live replay-batch-result
GET /records the stored events in arrival order (nodeUni, eventType, limit, offset), without payloads
GET /records/{eventId} the payload exactly as received, ETag its digest

Event types: observatory.node.observation.recorded, .timequality.recorded, .provenance.recorded, .qualityflag.recorded, .passport.published, .key.published. Accepted events are written to the gateway’s store (and its file) like every other write. The intake appraises nothing and enrols nothing; the claims stay REPLAY_BATCH_NOT_AUTHORITY and REPLAY_BATCH_RESULT_NOT_READINESS.

Usage policies (feature policy, draft OIP-0014)

Off by default; built with --features policy and switched on with --policy-dir <dir> (policies and consent records, each validated against the copied OIP-0014 schemas; --default-policy <uni> for records that name none). Then every event payload of an intake batch, every record read back (GET /node-ingest/v0.1/records/{eventId}) and every observation served as an exchange item is decided by the obsp-policy enforcement point. The request attributes come from the RequestContext’s extensions["obsp.policy"] (purpose, recipient class, region, aggregation, consent references, community approval; the action defaults to use, the time to the gateway’s clock); without them the request is denied (OBS-GOV-0001, deny by default). A record names its policy at extensions["obsp.policy"] (policyUni or target; an exchange item falls back to its product’s policy) and its sensitivity flags at extensions["obsp.policy"].flags. These are NON-normative reference conventions (see the open questions in obsp-policy/README.md).

A refusal answers 403 with a problem document valid against error-problem: category POLICY_DENIED, errorCode the first OBS-GOV code, one violation per reason naming its rule (field the requirement id, code the reason code) and policyDecisionRef the decision’s UNI. A refused intake batch stores nothing; an observation a flag withholds is left out of an item list and refused when asked for alone (OBS-GOV-0007). Tests: obsp-gateway/tests/policy.rs.

Evidence verifier (obsp-verify)

cargo run -p obsp-verify -- --root ../.. [--json report.json|-] [--web-compatible] <evidence dir or file>...

Checks, per document, the same as the web verifier (reference/web/verifier/verify.js): JSON (a file holds a document, an array, or a fixture wrapper), schema (found by _schemaTitle, apiVersion, kind, fit, or the closest required set; draft schemas for enveloped documents and key records), identifier, digests, OIP-0008 signature against the key records in the set, and every reference (uni or id with digest) followed to the loaded document and its digest recomputed (the whole document, or without its signature member). The verdict is FAIL when a check failed, INCONCLUSIVE when a check on the loaded documents could not be completed, PASS otherwise; references outside the set do not by themselves make it INCONCLUSIVE. Exit status: 0 PASS, 1 FAIL or INCONCLUSIVE, 2 usage or input error.

One check differs from the web verifier and is off with --web-compatible: a signed document whose class the draft register marks with a planned signature member (an observation record, an event envelope, …) is validated without the member against its live schema and the member against the draft envelope schema (schemaSource: "draft-overlay"). obsp-verify/tests/crosscheck.rs runs both verifiers on every example set of the verifier page when Node.js 20 or later is installed (skipped, not passed, otherwise) and requires the same verdict, counts, schema, schema source, check results and reference edges. The workspace builds serde_json with preserve_order for this: the web verifier walks members in document order.

End-to-end test

obsp-node/tests/node.rs end_to_end_node_gateway_outage_replay_verify starts the gateway on a random loopback port, runs the obsp-node binary over readings-1.jsonl (delivered), over readings-2.jsonl with the gateway address pointing at a closed port (exit 3, the batch stays in the outbox with one attempt), then replay against the gateway (delivered as attempt 2), then the Sparkplug sample; it resends a delivered batch (every event an idempotent replay, the same key answering the stored result), sends a changed payload under a known id (CONFLICT) and a forged observation (REJECTED, OBS-SIG-0005); it fetches every stored record through GET /node-ingest/v0.1/records and runs obsp-verify over them: PASS, every observation’s signature verifies and its passport, time-quality and provenance references resolve; a record edited afterwards fails (OBS-SIG-0004).

The 0.2 candidate (DRAFT)

The 0.2 integration series (oips/integration/0.2) applies the drafts OIP-0008, -0006, -0007, -0001, -0009, -0002, -0003 and -0005 to the live tree. This workspace follows it as reference code only: no proposal is accepted, the live obsp/0.1 behaviour stays the default everywhere, and nothing here is a conformance claim.

  • Schemas. obsp-core/tests/data/integration-0.2/ holds the 46 schemas of the series and, under drafts/, the seven schemas OIP-0013, OIP-0018 and OIP-0020 add (drafts outside the series, as the web verifier’s 0.2 mode loads them), copied by node tools/copy-0.2.mjs (it applies the patches in a temporary folder with the SDK’s tools/draft-sources.mjs; --check reports stale copies and obsp-core/tests/integration_0_2.rs runs it, skipped without Node.js 20). obsp_core::integration loads them. The proof examples and plan vectors the tests use are the SDK’s own copies (reference/typescript/obsp-sdk/test/fixtures/integration-0.2/), kept current by its test.
  • SIG-2 payload rule. PayloadRule::Oip0008 (default: the payload leaves out signature) or PayloadRule::Integration02 (also transparencyReceipt, OIP-0002’s proposal adopted by the series; its open question 2 stays open), in VerifyOptions::payload_rule and signature::sign_with. Register::with_0_2_classes gives the series’ object classes (the SDK’s OBJECT_CLASSES_0_2). The series’ eo-custody receipt verifies under the 0.2 rule and fails OBS-SIG-0004 under the draft’s.
  • Verifier. obsp-verify --profile 0.2 validates against the 0.2 schemas (source series or the draft id), verifies envelopes under the series’ rule and classes, and runs the same 23 draft checks as DRAFT_CHECKS of the SDK (obsp_verify::drafts: OIP-0002 proofs, OIP-0003 plans, OIP-0006 origin and subject class, OIP-0013 trajectories, OIP-0018 trigger recomputation with correctly rounded sums and half-even rounding, OIP-0020 chunk digests), with the same ids, requirement ids and verdicts. tests/crosscheck.rs runs both verifiers on every example set of the verifier page, each in its mode, and requires the same verdict, counts, schema, schema source, check results, draft rows (id, verdict, draft, requirements, number of findings) and reference edges; tests/drafts.rs checks the 13 plan vectors of the series (set checks and node codes) and the ten OIP-0018 evaluator vectors in both input orders. Run over the series’ own OBSP-GRID examples, the 0.2 profile finds one FAIL: observation-record.model-derived.example.json names uni:model:0001 with a placeholder digest (sha256:6666...) that is not the digest of model-manifest.example.json (a point for the OIP-0006 author).
  • Gateway (--features obsp-0.2, then --obsp-0.2 at run time; see the v02 module): the intake takes observation records 4.0.0 (series schema without the planned signature member, the member against the series’ envelope schema, the envelope under the 0.2 rule, OBS-3 and OBS-4 failures refused); under /node-ingest/v0.2, POST /proof-challenges (nonce of 144 bits from /dev/urandom, window of at most 86400 s, signed by the verifier key), POST /proof-receipts (signature OBS-PRV-0009, binding -0003, freshness by respondedAt and by the gateway’s clock at arrival -0001, replay or unknown nonce -0002, evidence digests -0004/-0005, independent location sources: one is INCONCLUSIVE -0006, trusted time -0007, custody chain -0008, transparency receipt -0010), answered with a signed verification report; POST /plans with the node-side decision of OIP-0003 on the gateway’s trusted state per deployment (OBS-PLAN-0001 to -0007, nothing changed on a refusal); GET /verifier-key, /proof-challenges/{uni}, /verification-reports/{uni}, /plans. State is in memory; the verifier key is a test key from a public label unless --verifier-key names a seed file. obsp-gateway/tests/v02.rs covers each route (the plan test replays every node vector of the series).
  • Node (--features obsp-0.2, "recordVersion": "4.0.0"): records carry origin and subjectClass from the configuration (with modelRef, networkFunctionUni, subjectPolicyRef when given) and validate against the series’ schema; obsp_node::proofs requests a challenge and answers it with a signed receipt and its evidence. end_to_end_0_2_records_and_proof_challenges sends 4.0.0 records to a 0.2 gateway (all accepted), proves location with two sources (PASS) and one (INCONCLUSIVE) and time on the node’s own time-quality record (PASS), and runs obsp-verify --profile 0.2 over what both sides produced (PASS).

Data plane of the gateway (features postgres, nats, s3, fast-alloc)

The gateway’s store is behind a trait (obsp-gateway/src/backend.rs). Each write is one atomic decision over a locked scope: the idempotency key, the node’s key records, the event ids and the entity it may create. Two stores implement it:

  • the reference store, in memory with the optional JSON-lines file, behind one lock, with unchanged behaviour;
  • PostgreSQL (src/pg.rs, sqlx), for stateless replicas.

PostgreSQL details:

  • Queries are checked at compile time against the offline metadata in obsp-gateway/.sqlx/. To refresh it, run cargo sqlx prepare -- --features postgres against a migrated database.
  • Schema (obsp-gateway/migrations/): forward-only migrations, embedded and run by obsp-gateway migrate. Intake events are partitioned by month, with PostGIS geometry under a GiST index and result-time indexes. Idempotency keys and event ids are unique constraints. Triggers refuse every change to a record table, and corrections are rows of their own.
  • Payloads of at least --offload-bytes go to the object store (--objects) by digest.
  • Changes reach the bus through a commit-ordered change feed: --bus, --relay, --fanout-peer, --fanout-webhook.
  • Corrections: POST/GET /node-ingest/v0.1/corrections (reference aid, not a contract).
  • Operations: /livez and /readyz; on SIGTERM the gateway drains.

Operations, guarantees and the backup and restore drill: docs/ops/dataplane.md.

Tests that need services run when their variables are set, and are skipped otherwise. Each variable names a running service:

Variable Service Example
OBSP_TEST_DATABASE_URL PostgreSQL with PostGIS, an administrative URL; each test creates its own database. It also runs every other gateway test on PostgreSQL postgres://user@127.0.0.1:5432/postgres
OBSP_TEST_NATS_URL NATS with JetStream nats://127.0.0.1:4222
OBSP_TEST_S3_URL, with credentials in OBSP_S3_ACCESS_KEY_ID and OBSP_S3_SECRET_ACCESS_KEY S3-compatible object store s3://bucket/prefix?endpoint=http://127.0.0.1:9000&region=r&path_style=true&allow_http=true
OBSP_TEST_DATABASE_URL=postgres://user@127.0.0.1:5432/postgres OBSP_TEST_NATS_URL=nats://127.0.0.1:4222 \
  cargo test -p obsp-gateway --features postgres,nats,obsp-0.2

All three passed in the development environment, against PostgreSQL 16 with PostGIS 3.4, NATS 2.10 and an S3 emulator, each run as a plain process (no container engine was available). Load results, with the profile and the ceiling, are in obsp-load/RESULTS.md. On a shared 4-thread machine with everything on it, PostgreSQL gave 17 000 to 19 000 events per second and the in-memory store 38 000 to 41 000. The machine is CPU-bound, and the target of 100 000 per second is not reached there.

Performance bench (WP-RI-11)

cargo run --release -p obsp-gateway --example bench -- --root ../.. [--n 40000] measures signature verification per object, the intake’s per-event checks, and ingest throughput. Measured on the build container, indicative only: a shared 4-thread virtual machine (Intel Xeon at 2.1 GHz) with other jobs running (load average 4.5 to 4.9 before each run, so the 4 threads were never free), release build, two runs (the range is shown), 40 000 records of about 1.4 kB as the node agent writes them (live 3.1.0 shape, Ed25519 envelope), batches of 64 events. Clients and gateway share the same four threads. Nothing here is a capacity or conformance claim.

Measure Before (previous gateway, same bench and session, one run) Now Design target (master plan)
Ed25519 verify, whole envelope (JCS payload, SHA-256, CBOR header, key resolution, signature) 0.051 ms 0.041 ms per object at most 0.1 ms met
Ed25519 verify, signature only 0.040 ms 0.035 to 0.038 ms
ML-DSA-65 verify, whole envelope 0.173 ms 0.161 to 0.164 ms per object at most 0.5 ms met
Intake checks per observation, no HTTP (digest, two schema validations, Ed25519 envelope), 1 thread 0.072 ms 0.058 to 0.059 ms, about 17 000 per second
The same on 4 threads not available 0.026 to 0.031 ms, 32 000 to 39 000 per second
End-to-end ingest over loopback HTTP, keep-alive, in-memory store, 1 client 4 300 events per second 11 100 to 11 300
The same, 4 clients 4 600 17 400 to 18 100
The same, 8 clients 4 100 18 400 to 25 800 at least 100 000 observations per second per node missed by a factor of 4 to 5
File store, 4 clients, synced on every write 4 300 10 900 to 15 700
File store, synced once every 64 writes (--fsync-every 64), 4 and 8 clients not available 13 500 to 19 200
Node agent as the client (a connection per batch, its outbox synced after each answer) 3 200 6 800 to 7 100

What changed, with every check kept (each event still gets its digest check, its schema validations and a strict Ed25519 verification, and the dispositions are those of checking the events one at a time, in order):

  • Key records are indexed by node in the store (Store::node_keys), in the order the old scan produced; a batch no longer scans every stored event, so its cost no longer grows with the store.
  • The store lock is held only for the decision, not for the checks. A batch’s events are checked before the lock, in parallel on the hardware threads (shared between the batches in flight) with results kept in input order, each against the key records it would see if the batch were processed at that moment (the stored ones, then the batch’s own earlier key records). Under the lock the dispositions are decided in order; a precomputed result is used only when the event saw exactly those key records, otherwise the event is checked again there (obsp-gateway/tests/ingest.rs compares the answers with a one-thread gateway, concurrent batches included).
  • Less repeated work: each payload is canonicalized once (its digest, and its text inside the batch’s own canonical form for the idempotency digest); the signed bytes are canonicalized without copying the object; object keys are ordered without a buffer per key and plain strings are copied whole; a schema check of a valid document uses the validator’s boolean path (errors are only collected for an invalid one); decoded Ed25519 public keys are cached per thread; accepted payloads are moved into the store instead of copied. Schemas were already compiled once.
  • Group commit is an option: --fsync-every <n> syncs the store file once every n writes (default 1, every write). Above 1, up to n - 1 answered writes can be lost on power loss; every line is still written before its answer.
  • The bench now posts prepared requests from 1, 4 and 8 clients that each keep one HTTP/1.1 connection alive (the gateway always allowed keep-alive; the node agent’s own client opens one connection per batch).

Not done, and why. Batch signature verification (the Ed25519 batch equation) was not used: it accepts some signatures that the strict single verification the intake uses refuses (it is a cofactored, randomized check), so it would weaken the check, and a batch failure would still need the single checks to say which event failed. The store remains one in-memory map behind one lock: with the checks moved out, the time under the lock is a small share of a batch, so sharding it would not change these numbers.

Why the target is still missed: on this machine the work per observation does not fit. One strict Ed25519 verification costs about 0.035 ms, so 100 000 per second needs about 3.5 fully free cores for the signatures alone; the whole intake check costs about 0.058 ms (about 5.8 cores at the target), and parsing the JSON body (about 0.01 ms per event), the batch’s idempotency digest and the HTTP clients come on top. The bench’s four threads are shared with the clients and with other jobs (load average about 4.5 before each run), and the 4-thread no-HTTP figure (32 000 to 39 000 per second) is the ceiling the end-to-end numbers approach. Reaching the target needs more cores than this machine has (roughly 8 to 16 free cores at this per-event cost, by the arithmetic above, not measured), or a cheaper event (for example one signature over a batch instead of one per observation, which is a protocol change, not a gateway change).

How to run

With a stable Rust toolchain (1.87 or later), from this directory:

cargo test --workspace                        # or `make rust` from the repository root
cargo run -p obsp-gateway -- --root ../.. --listen 127.0.0.1:8080 \
    --exchange-seed obsp-gateway/examples/exchange-seed.json [--store gateway.jsonl] [--tenant uni:tenant:0001]

--fsync-every <n> syncs the file store once every n writes (default: every write) and --verify-threads <n> sets how many threads check one intake batch (default: one per hardware thread). The gateway prints its base URL (http://127.0.0.1:8080/obsp/v0.1) and serves until interrupted. --root defaults to OBSP_REPO_ROOT, else the nearest ancestor of the current directory with schemas/json. There is no authentication: listen on loopback, or put the operator’s mutual TLS or OAuth 2.0 in front of it.

Live harness run

The repository’s live harness (conformance/harness/) was run against this build, from the repository root, with the gateway started as above on a free loopback port:

cargo run -p obsp-gateway -- --root . --listen 127.0.0.1:0 \
    --exchange-seed reference/rust/obsp-gateway/examples/exchange-seed.json   # prints http://127.0.0.1:<port>/obsp/v0.1
PYTHONPATH=sdk/python/src:. python3 -m conformance.harness.run --endpoint http://127.0.0.1:<port>/obsp/v0.1 --profile OBSP-NODE

Output (exit status 0):

CT-LIVE-001  PASS    gateway:registerParticipant    registerParticipant: a valid request is accepted and the response matches its schema
CT-LIVE-002  PASS    gateway:registerParticipant    registerParticipant: an invalid request is refused with an OBS problem document
CT-LIVE-003  PASS    gateway:registerParticipant    registerParticipant: a consequential call without RequestContext is refused with OBS-CTX-0001
CT-LIVE-004  PASS    gateway:fileConformanceClaim   fileConformanceClaim: a valid request is accepted and the response matches its schema
CT-LIVE-005  PASS    gateway:fileConformanceClaim   fileConformanceClaim: an invalid request is refused with an OBS problem document
CT-LIVE-006  PASS    gateway:fileConformanceClaim   fileConformanceClaim: a consequential call without RequestContext is refused with OBS-CTX-0001
CT-LIVE-007  PASS    gateway:getConformanceClaim    getConformanceClaim: a filed claim is returned
CT-LIVE-008  PASS    gateway:getConformanceClaim    getConformanceClaim: an unknown identifier is refused with an OBS problem document
CT-LIVE-009  PASS    gateway:getConformanceClaim    getConformanceClaim: reading twice returns the same digest (reads never change state)
CT-LIVE-010  PASS    gateway:getRegister            getRegister: a register is returned with its digest
CT-LIVE-011  PASS    gateway:getRegister            getRegister: an unknown identifier is refused with an OBS problem document
CT-LIVE-012  PASS    gateway:getRegister            getRegister: reading twice returns the same digest (reads never change state)
CT-LIVE-013  PASS    OBSP-NODE:join                 joinNode: a valid request is accepted and the response matches its schema
CT-LIVE-014  PASS    OBSP-NODE:join                 joinNode: an invalid request is refused with an OBS problem document
CT-LIVE-015  PASS    OBSP-NODE:join                 joinNode: a consequential call without RequestContext is refused with OBS-CTX-0001
CT-LIVE-016  PASS    gateway:admitProvider          admitProvider: a valid request is accepted and the response matches its schema
CT-LIVE-017  PASS    gateway:admitProvider          admitProvider: an invalid request is refused with an OBS problem document
CT-LIVE-018  PASS    gateway:admitProvider          admitProvider: a consequential call without RequestContext is refused with OBS-CTX-0001
CT-LIVE-019  PASS    OBSP-NODE:describe             describeNode: an enrolled node's manifest is returned
CT-LIVE-020  PASS    OBSP-NODE:describe             describeNode: an unknown identifier is refused with an OBS problem document
CT-LIVE-021  PASS    OBSP-NODE:describe             describeNode: reading twice returns the same digest (reads never change state)
OBSP-NODE live: INCOMPLETE  checks 21  pass 21  fail 0  not run 0  requirements 2/7

The live harness checks pass against this build: 21 of 21 for each of the five profiles (the test obsp-gateway/tests/openapi.rs live_harness_passes runs the harness for every profile and is skipped, never passed, when Python with yaml and jsonschema is missing). The harness result is INCOMPLETE by its own design: the profile’s other functions have no live case yet. That is the whole of what this run shows; it is not a conformance claim and no level is claimed.

What is covered and what is not

Covered by tests (cargo test --workspace, and cargo test --workspace --features obsp-gateway/obsp-0.2,obsp-node/obsp-0.2; both are make rust): the node agent and verifier as described above; every OIP-0008 draft vector both ways; signing and verifying round trips for every algorithm with a code point; the CBOR examples of RFC 8949 Appendix A; the gateway’s seven operations end to end over HTTP on a random port (success, replay, idempotency conflict, missing and invalid context, tenant refusal, headers, media type, body limit, routing, 304, HEAD, file store across a restart); the operation table against the OpenAPI document; the exchange endpoints (paging, filters, typed missing values, superseded state, read-only refusals, malformed queries, refused seeds); and the live harness.

Not covered:

  • Authentication and authorisation. The gateway holds no credential and trusts the RequestContext’s tenantUni, workspaceUni, principalUni and policyDigest as given; the schema’s own note says a deployment derives or verifies them server-side.
  • Attestation appraisal and signing. joinNode answers the repository’s example attestation result and bootstrap bundle filled in from the request (node, evidence reference, nonce, root-of-trust class, tenant, idempotency key, times); the result’s status and trust vector are those of the example, not an appraisal, and its signature member is the live schema’s summary from the example, not a signature. Nothing is signed with the OIP-0008 envelope because the live schemas do not carry it yet. The gateway does not check that the evidence names the manifest’s node, because the repository’s example fixtures name different nodes.
  • Admission review. admitProvider checks receipt states only and admits nothing; artifact digests are not matched against the provider’s adapter (the example fixtures differ).
  • The exchange plane follows drafts (OIP-0001, OIP-0005, OIP-0009, OIP-0024) and changes with them. The OGC executable test suites, the SensorThings test suite and the STAC API validator have not been run against it; the tests record results against clauses of each standard’s abstract test suite (gaps and remaining suites: docs/guides/exchange.md). No HTTP route publishes; new versions and notices reach a running gateway through the library only.
  • The field channels of schemas/asyncapi/, the functions without a gateway operation, rate limiting, and TLS.
  • Node agent: no protobuf decoding (Sparkplug payloads arrive decoded as JSON), no MQTT client, no attestation or enrolment (joinNode is not called), no key custody beyond a key file, no plan fetching or installation (the plan decision is taken on a plan file), no connector-output records (draft contract), and the node intake of the gateway is not a protocol operation. The STEP check’s limit is a convention of this agent.
  • Verifier: only Ed25519, ECDSA P-256 and P-384 and ML-DSA signatures are checked (others are INCONCLUSIVE); the draft-overlay check has no counterpart in the web verifier.
  • YAML rendering: registers are parsed as YAML 1.2 (unquoted timestamps stay strings); a register that relies on YAML 1.1 scalars (yes, on) would render differently from a YAML 1.1 reader. The ETag always matches the body served.