Some checks failed
no-vanity-metrics / Scan committed Markdown for vanity metrics (push) Successful in 4s
standards workspaces build + test / jouleclaw-rs (push) Successful in 1m50s
standards workspaces build + test / eoc-rs (push) Successful in 1m54s
standards workspaces build + test / arl-rs (push) Successful in 2m10s
standards workspaces build + test / aac-rs (push) Successful in 40s
standards workspaces build + test / joule-code-rs (push) Successful in 38s
standards workspaces build + test / jcp-rs (push) Successful in 1m18s
standards workspaces build + test / joulecontract-rs (push) Successful in 30s
standards workspaces build + test / map-rs (push) Successful in 30s
standards workspaces build + test / proof-rs (push) Successful in 1m11s
standards workspaces build + test / mesh-rs (push) Successful in 26s
standards workspaces build + test / joule-ui-rs (push) Successful in 2m32s
standards workspaces build + test / openpay (push) Successful in 1m21s
standards workspaces build + test / sandbox-rs (push) Successful in 2m12s
WAI conformance / cargo-class corpora · linux-arm64 (push) Successful in 51s
WAI conformance / cross-arch byte-equality · linux-arm64 (push) Successful in 18s
standards workspaces build + test / jouledesk-rs (push) Successful in 2m39s
standards workspaces build + test / smart-byte-rs (push) Successful in 2m30s
WAI conformance / cargo-class corpora · linux (push) Successful in 1m11s
WAI conformance / cross-arch byte-equality · linux (push) Successful in 15s
standards workspaces build + test / joulehook-rs (push) Successful in 3m48s
WAI conformance / C2PA manifest emission · signed, read back, validated (push) Successful in 40s
standards workspaces build + test / sense-rs (push) Successful in 2m22s
standards workspaces build + test / macOS energy backend (jcp-energy) (push) Successful in 2m32s
WAI conformance / cargo-class corpora · macos (push) Successful in 55s
WAI conformance / cross-arch byte-equality · macos (push) Successful in 14s
WAI conformance / cargo-class corpora · windows (push) Has been cancelled
WAI conformance / cross-arch byte-equality · windows (push) Has been cancelled
Departures from OER/2 draft 0.1, each in extensions/oer-receipts.md §9: - decisions are named oer.decision.*, not wai.settle.* (WAI's namespace is for payload formats) - the stage list behind bundle.provenance_root is serialised exactly as the body is, pinned by a non-ASCII fixture - the number profile is normative: I-JSON integers, decimal strings in JSON's number grammar (<=34 digits), anything else malformed - a document outside the document profile is refused whole: a number whose nearest binary64 is infinite, NaN/Infinity, an unpaired surrogate, a repeated member name, nesting past 64 - every composition check is exact (num-bigint / exact decimal context), ln 2 pinned as a decimal, every tolerance scaled by the figure's magnitude - the order of the reasons reported alone, and every member judged on its value, are stated, so each mistyped member has one named reason - published Ed25519 keys are decoded strictly: canonical encoding, not small order - abstention is its own outcome (abstain, no answer, no record), held by a new reason, abstention_settled; escalate is a verdict returned from upstream Four rounds of adversarial review with differential fuzzing drove this; the last fuzz found one remaining divergence (repeated member names), now refused by both. The edge corpus grows to 99 hand-declared vectors plus unreadable/ (11 documents every verifier must refuse); each rule was falsified in both verifiers. serde_json gains float_roundtrip under the oer feature so Rust rounds as Python does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
30 lines
1.8 KiB
C
30 lines
1.8 KiB
C
/* SPDX-License-Identifier: Apache-2.0 */
|
|
/* The settlement kernel: the keystone loop as portable C.
|
|
canonicalize -> key -> lookup -> verify -> decide -> record -> receipt
|
|
(OER/2 draft 0.1 as profiled by extensions/oer-receipts.md). */
|
|
#ifndef SETTLE_H
|
|
#define SETTLE_H
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#define SETTLE_RECORDS 4096
|
|
#define SETTLE_ANSWER 24
|
|
typedef struct { double compute_j, movement_j, idle_alloc_j, shared_alloc_j, upstream_j; double latency_s; const char *method; const char *weakest_how, *weakest_input; } settle_meter_t;
|
|
typedef struct { uint8_t key[32]; char answer[SETTLE_ANSWER]; double created, valid_until, deriv_j; uint32_t reuse, id; uint8_t used; } settle_record_t;
|
|
typedef struct { int status; const char *outcome; char answer[SETTLE_ANSWER]; uint32_t record_id; uint32_t reuse; char receipt_hash[72]; double joules_total; } settle_result_t;
|
|
typedef struct {
|
|
settle_record_t rec[SETTLE_RECORDS];
|
|
uint32_t rec_next, receipt_n;
|
|
char prev_hash[72];
|
|
uint8_t pk[32], sk[64];
|
|
double temperature_k, validity_s, cycle_j;
|
|
uint32_t bits_committed;
|
|
const char *boundary, *rules_hash;
|
|
} settle_ctx_t;
|
|
int settle_init(settle_ctx_t *c, const uint8_t seed[32], double temperature_k, double validity_s);
|
|
/* Runs the loop for one question. cls is 'A' (charging authorization) or 'B' (sensor check), id the canonical question id.
|
|
Writes the full receipt JSON (with chain) into out. Returns 0 on success. */
|
|
int settle_decide(settle_ctx_t *c, char cls, uint32_t id, double now, const settle_meter_t *m, char *out, size_t outlen, settle_result_t *res);
|
|
/* Records as a JSON object {id: {key, answer, created, valid_until}}, for vector files. */
|
|
int settle_records_json(const settle_ctx_t *c, char *out, size_t outlen);
|
|
void settle_pk_hex(const settle_ctx_t *c, char out[65]);
|
|
#endif
|