@mikeargento/bitgraph-verify 1.15.2 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/carrier2.test.js +61 -2
- package/dist/__tests__/carrier2.test.js.map +1 -1
- package/dist/__tests__/ceiling.test.js +11 -4
- package/dist/__tests__/ceiling.test.js.map +1 -1
- package/dist/carrier-verify.d.ts +10 -2
- package/dist/carrier-verify.d.ts.map +1 -1
- package/dist/carrier-verify.js +98 -23
- package/dist/carrier-verify.js.map +1 -1
- package/dist/carrier.d.ts +4 -2
- package/dist/carrier.d.ts.map +1 -1
- package/dist/carrier.js.map +1 -1
- package/dist/ceiling.d.ts +33 -3
- package/dist/ceiling.d.ts.map +1 -1
- package/dist/ceiling.js +55 -6
- package/dist/ceiling.js.map +1 -1
- package/dist/export.d.ts +112 -0
- package/dist/export.d.ts.map +1 -0
- package/dist/export.js +451 -0
- package/dist/export.js.map +1 -0
- package/dist/fuse.d.ts +2 -0
- package/dist/fuse.d.ts.map +1 -1
- package/dist/fuse.js +16 -1
- package/dist/fuse.js.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/measurements.d.ts +30 -0
- package/dist/measurements.d.ts.map +1 -0
- package/dist/measurements.js +21 -0
- package/dist/measurements.js.map +1 -0
- package/dist/output-root.d.ts +88 -0
- package/dist/output-root.d.ts.map +1 -0
- package/dist/output-root.js +260 -0
- package/dist/output-root.js.map +1 -0
- package/dist/stream.d.ts +46 -0
- package/dist/stream.d.ts.map +1 -0
- package/dist/stream.js +290 -0
- package/dist/stream.js.map +1 -0
- package/dist/tree.d.ts +155 -0
- package/dist/tree.d.ts.map +1 -0
- package/dist/tree.js +456 -0
- package/dist/tree.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/carrier2.test.ts +64 -2
- package/src/__tests__/ceiling.test.ts +12 -4
- package/src/carrier-verify.ts +104 -23
- package/src/carrier.ts +4 -2
- package/src/ceiling.ts +70 -7
- package/src/export.ts +529 -0
- package/src/fuse.ts +13 -1
- package/src/index.ts +30 -0
- package/src/measurements.ts +48 -0
- package/src/output-root.ts +301 -0
- package/src/stream.ts +291 -0
- package/src/tree.ts +548 -0
package/dist/tree.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../src/tree.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAE9F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAyC,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EACL,aAAa,EACb,UAAU,EACV,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,UAAU,GACX,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,MAAM,EAAiB,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAGrD,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAiB,CAAC;AACnD,MAAM,CAAC,MAAM,YAAY,GAAG,iBAA0B,CAAC;AAEvD,6DAA6D;AAC7D,MAAM,CAAC,MAAM,WAAW,GAAe,CAAC,GAAG,EAAE;IAC3C,MAAM,KAAK,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACrD,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC7C,GAAG,CAAC,GAAG,CAAC,KAAK,EA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AAO,IAAI,CAAC;IAClF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
import { verifyCarrier } from "../carrier-verify.js";
|
|
20
20
|
import { verifyNitroAttestation, attestationWitness, witnessMatchesAttestation, awsNitroRootSha256 } from "../nitro.js";
|
|
21
21
|
import { computeSignedBodyHash } from "../proof-hash.js";
|
|
22
|
+
import { verifyCeiling } from "../ceiling.js";
|
|
22
23
|
|
|
23
24
|
const fix = (name: string): Buffer => readFileSync(new URL(`../../src/__tests__/fixtures/carrier2/${name}`, import.meta.url));
|
|
24
25
|
const jfix = <T = Record<string, unknown>>(name: string): T => JSON.parse(fix(name).toString("utf-8")) as T;
|
|
@@ -41,7 +42,7 @@ test("the golden carrier/2 verifies TRUE offline, every carried claim TRUE, the
|
|
|
41
42
|
for (const id of ["block", "bytes.digest", "proof.signature", "proof.hash", "proof.fused", "attestation.signature", "attestation.chain", "attestation.root", "attestation.validity", "attestation.pcr0", "attestation.binding", "attestation.witness", "floor.anchor", "floor.binding", "floor.header", "ceiling.position.anchor", "ceiling.position.binding", "ceiling.position.header", "ceiling.time.record", "ceiling.time.payload", "ceiling.time.sender", "ceiling.time.inclusion", "ceiling.time.floor", "pins"]) {
|
|
42
43
|
assert.equal(c[id], "TRUE", `${id}: ${r.claims.find((x) => x.id === id)?.detail}`);
|
|
43
44
|
}
|
|
44
|
-
assert.equal(c["attestation.pins"], "
|
|
45
|
+
assert.equal(c["attestation.pins"], "TRUE", "BitGraph's published v9 image, the default policy");
|
|
45
46
|
assert.equal(c["confirmed.floor"], "UNDETERMINED");
|
|
46
47
|
assert.equal(c["confirmed.ceiling.time"], "UNDETERMINED");
|
|
47
48
|
assert.equal(c["ceiling.time.status"], "UNDETERMINED", "status is reported, never proven");
|
|
@@ -51,10 +52,71 @@ test("the golden carrier/2 verifies TRUE offline, every carried claim TRUE, the
|
|
|
51
52
|
assert.equal(r.bounds?.notAfter?.blockNumber, 26088459);
|
|
52
53
|
assert.equal(r.bounds?.existedBy?.blockNumber, 51979918);
|
|
53
54
|
assert.equal(r.bounds?.existedBy?.timestamp, 1790749183);
|
|
54
|
-
assert.match(r.reading, /
|
|
55
|
+
assert.match(r.reading, /Recorded after Ethereum block 26088457 \(2026-09-30T06:19:23Z\), and existed by Base block 51979918 \(2026-09-30T06:19:43Z\)/);
|
|
56
|
+
assert.match(r.reading, /^These exact bytes carry the commitment, so they were finished after (the floor block|their position was opened) \(the content floor\)\. Recorded after/);
|
|
55
57
|
assert.match(r.reading, /Rests on: SHA-256, Ed25519, the AWS Nitro root \(641A0321…\), Ethereum block 26088457, Base block 51979918/);
|
|
56
58
|
});
|
|
57
59
|
|
|
60
|
+
test("the enclave image decides: an image off the list is FALSE, no list or no attestation leaves the file undetermined", async () => {
|
|
61
|
+
const bytes = buildCarrier(inner, golden());
|
|
62
|
+
const off = await verifyCarrier(bytes, { pins: { pcr0: ["00".repeat(48)] } });
|
|
63
|
+
assert.equal(off.verdict, "FALSE");
|
|
64
|
+
assert.equal(claimsById(off)["attestation.pins"], "FALSE");
|
|
65
|
+
const none = await verifyCarrier(bytes, { pins: { pcr0: [] } });
|
|
66
|
+
assert.equal(none.verdict, "UNDETERMINED", "an attestation alone says only that some Nitro enclave signed");
|
|
67
|
+
assert.equal(claimsById(none)["attestation.pins"], "UNDETERMINED");
|
|
68
|
+
assert.match(none.reading, /^Not judged in full\./);
|
|
69
|
+
// Without its attestation the file is never TRUE (for this proof the signature covers it, so it is FALSE).
|
|
70
|
+
const bare = JSON.parse(JSON.stringify(golden())) as CarrierPayload;
|
|
71
|
+
delete (bare.proof as { environment: { attestation?: unknown } }).environment.attestation;
|
|
72
|
+
delete (bare as { attestation?: unknown }).attestation;
|
|
73
|
+
const unattested = await verifyCarrier(buildCarrier(inner, bare));
|
|
74
|
+
assert.notEqual(unattested.verdict, "TRUE");
|
|
75
|
+
assert.equal(claimsById(unattested)["attestation.signature"], "NOT_CARRIED");
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test("an attestation that does not decode is FALSE; a declared measurement is never hardware evidence", async () => {
|
|
79
|
+
// A deep copy: the fixture's proof object is shared by every test here.
|
|
80
|
+
const p = JSON.parse(JSON.stringify(golden())) as CarrierPayload;
|
|
81
|
+
(p.proof as { environment: { attestation: { reportB64: string } } }).environment.attestation.reportB64 = "AA==";
|
|
82
|
+
delete (p as { attestation?: unknown }).attestation;
|
|
83
|
+
const r = await verifyCarrier(buildCarrier(inner, p));
|
|
84
|
+
const c = claimsById(r);
|
|
85
|
+
assert.equal(c["attestation.signature"], "FALSE");
|
|
86
|
+
assert.equal(c["attestation.pins"], "UNDETERMINED", "the proof names a published image, and that is a claim, not evidence");
|
|
87
|
+
assert.equal(r.verdict, "FALSE");
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test("a sidecar whose floor is present but carries no header fails; one with a null floor passes", async () => {
|
|
91
|
+
const opts = { writerAddress: "0xf3972408D853c975F86351C311f4310220bbF2a3", chainId: 8453 };
|
|
92
|
+
const empty = { ...sidecar, floor: { ...(sidecar as { floor: object }).floor, blockHeader: "" } };
|
|
93
|
+
const r = await verifyCeiling(proof as never, empty as never, opts);
|
|
94
|
+
assert.equal(r.ok, false);
|
|
95
|
+
assert.match(r.reason ?? "", /^floor: the sidecar carries a floor without a header/);
|
|
96
|
+
const none = await verifyCeiling(proof as never, { ...sidecar, floor: null } as never, opts);
|
|
97
|
+
assert.equal(none.ok, true, none.reason);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test("malformed evidence never throws: a null root is FALSE in the sidecar check and in the file", async () => {
|
|
101
|
+
const opts = { writerAddress: "0xf3972408D853c975F86351C311f4310220bbF2a3", chainId: 8453 };
|
|
102
|
+
const broken = { ...sidecar, root: null };
|
|
103
|
+
const r = await verifyCeiling(proof as never, broken as never, opts);
|
|
104
|
+
assert.equal(r.ok, false);
|
|
105
|
+
const p = golden();
|
|
106
|
+
(p.ceilingInTime as { sidecar: Record<string, unknown> }).sidecar = broken;
|
|
107
|
+
const f = await verifyCarrier(buildCarrier(inner, p));
|
|
108
|
+
assert.equal(f.verdict, "FALSE");
|
|
109
|
+
assert.equal(f.bounds?.existedBy ?? null, null, "a ceiling that did not verify states no Base time");
|
|
110
|
+
for (const field of [["anchor", "rawTx"], ["anchor", "blockHeader"], ["anchor", "txIndex"], ["merklePath"], ["proofHash"]]) {
|
|
111
|
+
const s = JSON.parse(JSON.stringify(sidecar)) as Record<string, unknown>;
|
|
112
|
+
let at: Record<string, unknown> = s;
|
|
113
|
+
for (const k of field.slice(0, -1)) at = at[k] as Record<string, unknown>;
|
|
114
|
+
at[field[field.length - 1]!] = null;
|
|
115
|
+
const x = await verifyCeiling(proof as never, s as never, opts);
|
|
116
|
+
assert.equal(x.ok, false, field.join("."));
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
58
120
|
test("the block stays under the ZIP limit, with the witness inside", () => {
|
|
59
121
|
const size = carrierBlockSize(golden());
|
|
60
122
|
assert.ok(size < CARRIER_BLOCK_ZIP_LIMIT, `block is ${size} bytes`);
|
|
@@ -269,14 +269,22 @@ test("a rebuilt header with a moved timestamp passes offline and says it was not
|
|
|
269
269
|
assert.equal(r.headerCheckedAgainstChain, false);
|
|
270
270
|
});
|
|
271
271
|
|
|
272
|
-
test("a floor header that is not the proof's signed floor
|
|
272
|
+
test("a floor header that is not the proof's signed floor fails the sidecar: every part it carries must hold", async () => {
|
|
273
273
|
const w = build();
|
|
274
274
|
const s = clone(w.sidecar);
|
|
275
275
|
const f = rlpDecode(hexToBytes(s.floor!.blockHeader)) as Uint8Array[];
|
|
276
276
|
f[11] = u(1);
|
|
277
277
|
s.floor!.blockHeader = bytesToHex(rlpEncode(f));
|
|
278
278
|
const r = await verifyCeiling(proof, s, { writerAddress: w.writer, chainId: CHAIN });
|
|
279
|
-
assert.equal(r.ok,
|
|
280
|
-
assert.
|
|
281
|
-
assert.equal(r.window
|
|
279
|
+
assert.equal(r.ok, false);
|
|
280
|
+
assert.match(r.reason ?? "", /^floor: the carried floor header does not match the proof's signed slotAnchor/);
|
|
281
|
+
assert.equal(r.window, undefined, "no window from a sidecar that failed");
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
test("the status field never decides: a sidecar with its transaction verifies whatever its status says", async () => {
|
|
285
|
+
const w = build();
|
|
286
|
+
const s = clone(w.sidecar);
|
|
287
|
+
(s as { status: string }).status = "pending";
|
|
288
|
+
const r = await verifyCeiling(proof, s, { writerAddress: w.writer, chainId: CHAIN });
|
|
289
|
+
assert.equal(r.ok, true, r.reason);
|
|
282
290
|
});
|
package/src/carrier-verify.ts
CHANGED
|
@@ -40,7 +40,8 @@ import { verifyFuse } from "./fuse-verify.js";
|
|
|
40
40
|
import { readFuseAttribution } from "./fuse.js";
|
|
41
41
|
import { computeProofHash, computeSignedBodyHash } from "./proof-hash.js";
|
|
42
42
|
import { verifyNitroAttestation, witnessMatchesAttestation, awsNitroRootSha256, type AttestationWitness } from "./nitro.js";
|
|
43
|
-
import { verifyCeiling, checkCeilingOnline, type CeilingSidecar } from "./ceiling.js";
|
|
43
|
+
import { baseTimeIsBound, verifyCeiling, checkCeilingOnline, type CeilingSidecar } from "./ceiling.js";
|
|
44
|
+
import { PUBLISHED_PCR0S, publishedMeasurement } from "./measurements.js";
|
|
44
45
|
import { verifySettlementPointer, checkSettlementOnline, BASE_MAINNET_SETTLEMENT_PINS, type SettlementPointer, type SettlementPins } from "./settlement.js";
|
|
45
46
|
import type { BitGraphProof } from "./types.js";
|
|
46
47
|
import { sha256 } from "@noble/hashes/sha256";
|
|
@@ -80,16 +81,24 @@ export interface CarrierVerifyOptions {
|
|
|
80
81
|
lookups?: CarrierLookups;
|
|
81
82
|
/** The verifier's own pins. The file's declared pins are compared with these, never used as these. */
|
|
82
83
|
pins?: {
|
|
83
|
-
/**
|
|
84
|
-
|
|
84
|
+
/**
|
|
85
|
+
* PCR0 values the verifier accepts. Default: BitGraph's published images
|
|
86
|
+
* (SPEC section 16). An empty list accepts nothing and leaves the claim,
|
|
87
|
+
* and so the verdict, undetermined.
|
|
88
|
+
*/
|
|
89
|
+
pcr0?: readonly string[];
|
|
85
90
|
ceilingWriter?: string;
|
|
86
91
|
baseChainId?: number;
|
|
87
92
|
settlement?: SettlementPins;
|
|
93
|
+
/** Another attestation trust root, DER, for a verifier that pins its own (tests use this). Default: the embedded AWS Nitro root. */
|
|
94
|
+
rootDer?: Uint8Array;
|
|
88
95
|
};
|
|
89
96
|
}
|
|
90
97
|
|
|
91
98
|
export interface CarrierVerifyResult {
|
|
92
99
|
verdict: "TRUE" | "FALSE" | "UNDETERMINED";
|
|
100
|
+
/** Why the Base block's time is not stated as a bound, when it is not (see baseTimeIsBound). */
|
|
101
|
+
baseTimeWithheld?: string | null;
|
|
93
102
|
/** "ok" | "none" | "corrupt" — whether the bytes carried a readable block at all. */
|
|
94
103
|
carrier: "ok" | "none" | "corrupt";
|
|
95
104
|
version: 1 | 2 | null;
|
|
@@ -140,10 +149,43 @@ function envelopeSentence(outer: Uint8Array, inner: Uint8Array): string {
|
|
|
140
149
|
* as not carried, and everything else is judged exactly as for a file.
|
|
141
150
|
*/
|
|
142
151
|
export async function verifyCarrierPayload(payload: CarrierPayload, inner: Uint8Array | null, opts: CarrierVerifyOptions = {}): Promise<CarrierVerifyResult> {
|
|
143
|
-
const version = carrierVersionOf(payload);
|
|
144
152
|
const claims: CarrierClaim[] = [];
|
|
145
153
|
const add = (id: string, name: string, result: ClaimResult, restsOn: string, detail: string, level: "offline" | "confirmed" = "offline") =>
|
|
146
154
|
claims.push({ id, name, result, restsOn, detail, level });
|
|
155
|
+
// Every part is read defensively below; a malformed part that still throws
|
|
156
|
+
// is a FALSE claim, never an exception.
|
|
157
|
+
try {
|
|
158
|
+
return await verifyCarrierPayloadChecks(payload, inner, opts, claims, add);
|
|
159
|
+
} catch (e) {
|
|
160
|
+
const detail = `a part of this proof block is malformed: ${e instanceof Error ? e.message : String(e)}`;
|
|
161
|
+
add("wellformed", "Every part of the proof block is well formed", "FALSE", "", detail);
|
|
162
|
+
let version: 1 | 2 | null = null;
|
|
163
|
+
try { version = carrierVersionOf(payload); } catch { /* unreadable */ }
|
|
164
|
+
const ceilingStatus = (payload as { ceiling?: { status?: unknown } } | null)?.ceiling?.status;
|
|
165
|
+
return {
|
|
166
|
+
verdict: "FALSE",
|
|
167
|
+
baseTimeWithheld: null,
|
|
168
|
+
carrier: "ok",
|
|
169
|
+
version,
|
|
170
|
+
reasons: claims.filter((c) => c.result === "FALSE").map((c) => `${c.name}: ${c.detail}`),
|
|
171
|
+
bounds: null,
|
|
172
|
+
ceiling: ceilingStatus === "present" || ceilingStatus === "unfetched" ? ceilingStatus : null,
|
|
173
|
+
claims,
|
|
174
|
+
reading: `This file does not verify: ${detail}. Nothing here is a verdict on what the bytes say, only that the evidence does not hold together.`,
|
|
175
|
+
payload,
|
|
176
|
+
inner,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
async function verifyCarrierPayloadChecks(
|
|
182
|
+
payload: CarrierPayload,
|
|
183
|
+
inner: Uint8Array | null,
|
|
184
|
+
opts: CarrierVerifyOptions,
|
|
185
|
+
claims: CarrierClaim[],
|
|
186
|
+
add: (id: string, name: string, result: ClaimResult, restsOn: string, detail: string, level?: "offline" | "confirmed") => number,
|
|
187
|
+
): Promise<CarrierVerifyResult> {
|
|
188
|
+
const version = carrierVersionOf(payload);
|
|
147
189
|
const proof = payload.proof as unknown as BitGraphProof;
|
|
148
190
|
const pinnedWriter = opts.pins?.ceilingWriter ?? BITGRAPH_CEILING_WRITER;
|
|
149
191
|
const baseChainId = opts.pins?.baseChainId ?? BASE_MAINNET_CHAIN_ID;
|
|
@@ -187,24 +229,44 @@ export async function verifyCarrierPayload(payload: CarrierPayload, inner: Uint8
|
|
|
187
229
|
}
|
|
188
230
|
|
|
189
231
|
// 4. The attestation: the hardware's word on which image signed, bound to this proof.
|
|
190
|
-
const
|
|
232
|
+
const env = (proof as { environment?: { measurement?: unknown; attestation?: { format?: unknown; reportB64?: unknown } } }).environment;
|
|
233
|
+
const measurement = typeof env?.measurement === "string" && /^[0-9a-fA-F]+$/.test(env.measurement) ? env.measurement.toLowerCase() : null;
|
|
234
|
+
let attestedAtMs: number | null = null;
|
|
235
|
+
const att = env?.attestation;
|
|
191
236
|
if (att && att.format === "aws-nitro" && typeof att.reportB64 === "string") {
|
|
192
|
-
const n = verifyNitroAttestation(att.reportB64, { expectedPcr0:
|
|
237
|
+
const n = verifyNitroAttestation(att.reportB64, { ...(measurement !== null ? { expectedPcr0: measurement } : {}), expectedUserDataB64: computeSignedBodyHash(proof), ...(opts.pins?.rootDer ? { rootDer: opts.pins.rootDer } : {}) });
|
|
193
238
|
const byName = (prefix: string) => n.checks.find((c) => c.name.startsWith(prefix));
|
|
194
239
|
const sig = byName("AWS signature"), chain = byName("Certificate chain"), root = byName("Chains to") ?? byName("Trust root"), validity = byName("Certificate validity"), pcr0 = byName("PCR0"), bound = byName("Bound to this proof");
|
|
195
240
|
const r = (c: { pass: boolean } | undefined): ClaimResult => (c === undefined ? "UNDETERMINED" : c.pass ? "TRUE" : "FALSE");
|
|
196
|
-
|
|
241
|
+
// Not a Nitro document at all: that contradicts the proof's own claim to carry one.
|
|
242
|
+
if (n.doc === null) add("attestation.signature", "AWS hardware signed the attestation", "FALSE", "", `the attestation does not decode as an AWS Nitro document (${n.checks[0]?.detail ?? "unreadable"})`);
|
|
243
|
+
else add("attestation.signature", "AWS hardware signed the attestation", r(sig), "ES384 (P-384)", sig?.detail ?? "not reached");
|
|
197
244
|
add("attestation.chain", "The certificate chain holds together", r(chain), "ES384 (P-384)", chain?.detail ?? "not reached");
|
|
198
245
|
add("attestation.root", "The chain reaches the AWS Nitro root", r(root), `the AWS Nitro Enclaves Root CA G1 (${n.rootSha256.slice(0, 8)}…)`, root?.detail ?? "not reached");
|
|
199
246
|
add("attestation.validity", "Every certificate was valid at the document's own instant", r(validity), "the document's signed timestamp", validity?.detail ?? "not reached");
|
|
200
|
-
add("attestation.pcr0", "The attested image is the one the proof names",
|
|
247
|
+
if (measurement === null) add("attestation.pcr0", "The attested image is the one the proof names", "FALSE", "", "the proof's environment.measurement is not a hex string, so it names no image");
|
|
248
|
+
else add("attestation.pcr0", "The attested image is the one the proof names", r(pcr0), "PCR0 inside the signed document", pcr0?.detail ?? "not reached");
|
|
201
249
|
add("attestation.binding", "The attestation is bound to this proof", r(bound), "user_data inside the signed document", bound?.detail ?? "not reached");
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
250
|
+
// The hardware's word, whole: signature, chain, root, validity, PCR0 and binding all verified.
|
|
251
|
+
const hardwareOk = n.doc !== null && measurement !== null && [sig, chain, root, validity, pcr0, bound].every((c) => c?.pass === true);
|
|
252
|
+
if (sig?.pass && chain?.pass && root?.pass && typeof n.doc?.timestampMs === "number") attestedAtMs = n.doc.timestampMs;
|
|
253
|
+
// The image judged is the one the DOCUMENT attests; the proof's declared measurement is a claim, not evidence.
|
|
254
|
+
const docPcr0 = (n.doc?.pcrs as Record<number, unknown> | undefined)?.[0];
|
|
255
|
+
const measured = typeof docPcr0 === "string" ? docPcr0.toLowerCase() : null;
|
|
256
|
+
const usingDefault = opts.pins?.pcr0 === undefined;
|
|
257
|
+
const policy = (opts.pins?.pcr0 ?? PUBLISHED_PCR0S).map((x) => String(x).toLowerCase());
|
|
258
|
+
if (!hardwareOk || measured === null) {
|
|
259
|
+
add("attestation.pins", "The image is one the verifier accepts", "UNDETERMINED", "", "not judged: the attestation did not verify in full, and a declared measurement is not hardware evidence");
|
|
260
|
+
} else if (policy.length === 0) {
|
|
261
|
+
add("attestation.pins", "The image is one the verifier accepts", "UNDETERMINED", "", `no accepted images were given: PCR0 is ${measured}; any AWS Nitro enclave can produce a valid attestation, and only a measurement policy says whose this is`);
|
|
206
262
|
} else {
|
|
207
|
-
|
|
263
|
+
const ok = policy.includes(measured);
|
|
264
|
+
const pub = publishedMeasurement(measured);
|
|
265
|
+
add("attestation.pins", "The image is one the verifier accepts", ok ? "TRUE" : "FALSE",
|
|
266
|
+
usingDefault ? "BitGraph's published enclave images (SPEC section 16)" : "the verifier's own list",
|
|
267
|
+
ok
|
|
268
|
+
? usingDefault && pub ? `PCR0 ${measured.slice(0, 16)}… is BitGraph's published ${pub.version} image (since ${pub.since})` : `PCR0 ${measured.slice(0, 16)}… is on the verifier's list`
|
|
269
|
+
: usingDefault ? `PCR0 ${measured.slice(0, 16)}… is not an image BitGraph published, so this proof is not BitGraph's` : `PCR0 ${measured.slice(0, 16)}… is not on the verifier's list`);
|
|
208
270
|
}
|
|
209
271
|
if (version === 2 && payload.attestation) {
|
|
210
272
|
const w = witnessMatchesAttestation(payload.attestation as unknown as AttestationWitness, att.reportB64);
|
|
@@ -245,6 +307,7 @@ export async function verifyCarrierPayload(payload: CarrierPayload, inner: Uint8
|
|
|
245
307
|
|
|
246
308
|
// 7. v2: the ceiling in time, the Base block the record existed by.
|
|
247
309
|
let ceilingTime: { blockNumber: number; blockHash: string; blockTimestamp: number; status: string } | null = null;
|
|
310
|
+
let baseTimeWithheld: string | null = null;
|
|
248
311
|
let sidecar: CeilingSidecar | null = null;
|
|
249
312
|
if (version === 2) {
|
|
250
313
|
const ct = payload.ceilingInTime;
|
|
@@ -259,7 +322,12 @@ export async function verifyCarrierPayload(payload: CarrierPayload, inner: Uint8
|
|
|
259
322
|
add("ceiling.time.inclusion", "The transaction is in the Base block", r(byName("inclusion")), `Merkle-Patricia proof; Base block ${sidecar.anchor?.blockNumber ?? "?"}, header as given`, byName("inclusion")?.detail ?? c.reason ?? "not reached");
|
|
260
323
|
add("ceiling.time.floor", "The floor header the ceiling carries is the signed floor", r(byName("floor")), "the proof's signed commit.slotAnchor", byName("floor")?.detail ?? "the sidecar carries no floor header");
|
|
261
324
|
const win = c.ok ? c.window?.ceiling : undefined;
|
|
262
|
-
if (win)
|
|
325
|
+
if (win) {
|
|
326
|
+
// The inclusion holds either way; a stamp that cannot be a bound is withheld as a time.
|
|
327
|
+
const stamp = baseTimeIsBound(win.blockTimestamp, { floorTimestampSec: floorWitness.timestamp ?? c.window?.floor.blockTimestamp ?? null, attestedAtMs });
|
|
328
|
+
if (stamp.ok) ceilingTime = { blockNumber: win.blockNumber, blockHash: win.blockHash, blockTimestamp: win.blockTimestamp, status: c.status ?? "included" };
|
|
329
|
+
else baseTimeWithheld = stamp.reason;
|
|
330
|
+
}
|
|
263
331
|
if (!c.ok && c.reason) add("ceiling.time", "The ceiling in time holds together", "FALSE", "", c.reason);
|
|
264
332
|
add("ceiling.time.status", "How far Base had settled the block", "UNDETERMINED", "", `the sidecar says "${sidecar.status}", as BitGraph's Base node reported when the file was written; not proven by the file. Settlement below is the proof, when carried.`);
|
|
265
333
|
} else {
|
|
@@ -287,7 +355,7 @@ export async function verifyCarrierPayload(payload: CarrierPayload, inner: Uint8
|
|
|
287
355
|
// 9. The declared pins, compared with the verifier's.
|
|
288
356
|
if (payload.pins) {
|
|
289
357
|
const notes: string[] = [];
|
|
290
|
-
if (payload.pins.pcr0 && payload.pins.pcr0.toLowerCase() !== proof.environment
|
|
358
|
+
if (payload.pins.pcr0 && String(payload.pins.pcr0).toLowerCase() !== String(proof.environment?.measurement).toLowerCase()) notes.push("the declared PCR0 is not the proof's measurement");
|
|
291
359
|
if (payload.pins.ceilingWriter && payload.pins.ceilingWriter.toLowerCase() !== pinnedWriter.toLowerCase()) notes.push(`the declared ceiling writer ${payload.pins.ceilingWriter} is not the verifier's pin`);
|
|
292
360
|
if (payload.pins.chains?.base !== undefined && payload.pins.chains.base !== baseChainId) notes.push(`the declared Base chain ${payload.pins.chains.base} is not the verifier's`);
|
|
293
361
|
add("pins", "What the file says it was made under agrees with this verifier's pins", notes.length === 0 ? "TRUE" : "FALSE", "the verifier's own pins", notes.length === 0 ? "declared pins match; they were never used as authority" : notes.join("; "));
|
|
@@ -324,17 +392,24 @@ export async function verifyCarrierPayload(payload: CarrierPayload, inner: Uint8
|
|
|
324
392
|
}
|
|
325
393
|
|
|
326
394
|
const reasons = claims.filter((c) => c.result === "FALSE").map((c) => `${c.name}: ${c.detail}`);
|
|
327
|
-
|
|
395
|
+
// TRUE needs the image to be one the verifier accepts: an attestation alone
|
|
396
|
+
// says only that some AWS Nitro enclave signed.
|
|
397
|
+
const pins = claims.find((c) => c.id === "attestation.pins");
|
|
398
|
+
if (reasons.length === 0 && pins?.result !== "TRUE") reasons.push(pins ? `${pins.name}: ${pins.detail}` : "The image is one the verifier accepts: the proof carries no attestation, so no image was established");
|
|
399
|
+
const verdict: CarrierVerifyResult["verdict"] = claims.some((c) => c.result === "FALSE") ? "FALSE" : pins?.result === "TRUE" ? "TRUE" : "UNDETERMINED";
|
|
328
400
|
const bounds = carrierBounds(payload);
|
|
401
|
+
// The ceiling in time reaches callers only as verified here, and only when its stamp is a bound.
|
|
402
|
+
bounds.existedBy = ceilingTime ? { chain: "base", blockNumber: ceilingTime.blockNumber, blockHash: ceilingTime.blockHash, timestamp: ceilingTime.blockTimestamp } : null;
|
|
329
403
|
return {
|
|
330
404
|
verdict,
|
|
405
|
+
baseTimeWithheld,
|
|
331
406
|
carrier: "ok",
|
|
332
407
|
version,
|
|
333
408
|
reasons,
|
|
334
409
|
bounds,
|
|
335
410
|
ceiling: payload.ceiling.status,
|
|
336
411
|
claims,
|
|
337
|
-
reading: writeReading(verdict, claims, bounds, proof, ceilingTime, floorWitness.timestamp),
|
|
412
|
+
reading: writeReading(verdict, claims, bounds, proof, ceilingTime, floorWitness.timestamp, baseTimeWithheld),
|
|
338
413
|
payload,
|
|
339
414
|
inner,
|
|
340
415
|
};
|
|
@@ -359,6 +434,7 @@ function writeReading(
|
|
|
359
434
|
proof: BitGraphProof,
|
|
360
435
|
ceilingTime: { blockNumber: number; blockHash: string; blockTimestamp: number } | null,
|
|
361
436
|
floorTs: number | null,
|
|
437
|
+
baseTimeWithheld: string | null = null,
|
|
362
438
|
): string {
|
|
363
439
|
const get = (id: string) => claims.find((c) => c.id === id);
|
|
364
440
|
if (verdict === "FALSE") {
|
|
@@ -368,16 +444,19 @@ function writeReading(
|
|
|
368
444
|
const position = proof.commit?.counter ?? "?";
|
|
369
445
|
const epoch = (proof.commit?.epochId ?? "").replace(/=+$/, "").slice(0, 8);
|
|
370
446
|
const fused = get("proof.fused");
|
|
371
|
-
const after = floorTs !== null ? `
|
|
447
|
+
const after = floorTs !== null ? `Recorded after Ethereum block ${bounds.notBefore.blockNumber} (${iso(floorTs)})` : `Recorded after Ethereum block ${bounds.notBefore.blockNumber}`;
|
|
372
448
|
const by = ceilingTime ? `, and existed by Base block ${ceilingTime.blockNumber} (${iso(ceilingTime.blockTimestamp)})` : "";
|
|
373
449
|
const settled = bounds.settledBy ? `, whose batch data Ethereum committed in block ${bounds.settledBy.blockNumber} (${iso(bounds.settledBy.timestamp)})` : "";
|
|
374
450
|
const before = bounds.notAfter ? `; committed before the anchoring of Ethereum block ${bounds.notAfter.blockNumber}, a bound in position` : "";
|
|
375
451
|
const digest = get("bytes.digest");
|
|
452
|
+
// Two floors (SPEC 8.6): every record has the record floor; only bytes that
|
|
453
|
+
// carry the commitment have the content floor. Without it, the bytes
|
|
454
|
+
// themselves are not dated.
|
|
376
455
|
const subject = digest?.result !== "TRUE"
|
|
377
|
-
? "The bytes this proof names were committed"
|
|
456
|
+
? "The bytes this proof names were committed under this position."
|
|
378
457
|
: fused?.result === "TRUE"
|
|
379
|
-
? (fused.restsOn.includes("floor block") ? "These exact bytes were finished after the floor block
|
|
380
|
-
: "These exact bytes
|
|
458
|
+
? (fused.restsOn.includes("floor block") ? "These exact bytes carry the commitment, so they were finished after the floor block (the content floor)." : "These exact bytes carry the commitment, so they were finished after their position was opened (the content floor).")
|
|
459
|
+
: "These exact bytes carry no commitment, so the bytes themselves are not dated (the record floor only).";
|
|
381
460
|
const att = get("attestation.root");
|
|
382
461
|
const rests: string[] = ["SHA-256", "Ed25519"];
|
|
383
462
|
if (att?.result === "TRUE") rests.push(`the AWS Nitro root (${awsNitroRootSha256().slice(0, 8)}…)`);
|
|
@@ -390,6 +469,8 @@ function writeReading(
|
|
|
390
469
|
? "Every block was confirmed against a node, so nothing here rests on a header taken as given."
|
|
391
470
|
: "Offline, the blocks are taken from their headers, each of which hashes to the hash the evidence names; confirm them against any node or explorer to remove that reliance.";
|
|
392
471
|
const pins = get("attestation.pins");
|
|
393
|
-
const pinLine = pins?.result === "TRUE" ? "
|
|
394
|
-
|
|
472
|
+
const pinLine = pins?.result === "TRUE" ? ` ${pins.detail.replace(/^PCR0 [0-9a-f]+… is /, "The enclave image is ")}.` : pins?.result === "UNDETERMINED" ? ` ${pins.detail}.` : !pins ? " The proof carries no attestation, so which enclave image signed it is not established." : "";
|
|
473
|
+
const withheld = baseTimeWithheld ? ` The record is in a Base block, but its time is not used as a bound: ${baseTimeWithheld}.` : "";
|
|
474
|
+
const lead = verdict === "UNDETERMINED" ? "Not judged in full. " : "";
|
|
475
|
+
return `${lead}${subject} ${after}${by}${settled}${before}. Position ${position} of epoch ${epoch}…. Rests on: ${rests.join(", ")}. ${tail}${withheld}${pinLine}`;
|
|
395
476
|
}
|
package/src/carrier.ts
CHANGED
|
@@ -590,8 +590,10 @@ export interface CarrierBounds {
|
|
|
590
590
|
/** The ceiling in POSITION: the next anchor. null means NOT FETCHED — say so in those words — never "none exists". */
|
|
591
591
|
notAfter: { blockNumber: number; blockHash: string; timestamp: number | null } | null;
|
|
592
592
|
/**
|
|
593
|
-
* v2: the ceiling in TIME, as the sidecar states it
|
|
594
|
-
*
|
|
593
|
+
* v2: the ceiling in TIME. From carrierBounds, as the sidecar states it;
|
|
594
|
+
* from verifyCarrier, only as verified from the header, and null when the
|
|
595
|
+
* ceiling did not verify or its stamp was withheld as a bound
|
|
596
|
+
* (CarrierVerifyResult.baseTimeWithheld). null on a v1 block or when not fetched.
|
|
595
597
|
*/
|
|
596
598
|
existedBy: { chain: "base"; blockNumber: number; blockHash: string; timestamp: number } | null;
|
|
597
599
|
/** v2: the Ethereum block that committed the Base batch data, as the pointer states it. */
|
package/src/ceiling.ts
CHANGED
|
@@ -132,7 +132,7 @@ export interface CeilingCheck {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
export interface CeilingVerifyResult {
|
|
135
|
-
/** True when every offline check passed. Says nothing about chain canonicality. */
|
|
135
|
+
/** True when every offline check that ran passed, the carried floor header included. Says nothing about chain canonicality. */
|
|
136
136
|
ok: boolean;
|
|
137
137
|
reason?: string;
|
|
138
138
|
checks: CeilingCheck[];
|
|
@@ -181,8 +181,9 @@ export function ceilingLabel(status: CeilingStatus, blockNumber: number, blockTi
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
/**
|
|
184
|
-
* Check a ceiling sidecar against its proof, offline.
|
|
185
|
-
*
|
|
184
|
+
* Check a ceiling sidecar against its proof, offline. The checks run in
|
|
185
|
+
* order and stop at the first failure, which is the `reason`; `ok` is true
|
|
186
|
+
* only when every check that ran passed, a carried floor header included.
|
|
186
187
|
*/
|
|
187
188
|
export async function verifyCeiling(
|
|
188
189
|
proof: BitGraphProof,
|
|
@@ -194,6 +195,21 @@ export async function verifyCeiling(
|
|
|
194
195
|
checks.push({ name, ok: false, detail });
|
|
195
196
|
return { ok: false, reason: `${name}: ${detail}`, checks, headerCheckedAgainstChain: false };
|
|
196
197
|
};
|
|
198
|
+
// A malformed field anywhere is a failed check, never an exception.
|
|
199
|
+
try {
|
|
200
|
+
return await verifyCeilingChecks(proof, sidecar, opts, checks, fail);
|
|
201
|
+
} catch (e) {
|
|
202
|
+
return fail("malformed", `a field of the sidecar is malformed: ${e instanceof Error ? e.message : String(e)}`);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
async function verifyCeilingChecks(
|
|
207
|
+
proof: BitGraphProof,
|
|
208
|
+
sidecar: CeilingSidecar,
|
|
209
|
+
opts: CeilingVerifyOptions,
|
|
210
|
+
checks: CeilingCheck[],
|
|
211
|
+
fail: (name: string, detail: string) => CeilingVerifyResult,
|
|
212
|
+
): Promise<CeilingVerifyResult> {
|
|
197
213
|
const pass = (name: string, detail?: string) => checks.push(detail === undefined ? { name, ok: true } : { name, ok: true, detail });
|
|
198
214
|
|
|
199
215
|
if (sidecar?.version !== CEILING_VERSION) return fail("format", `not a ${CEILING_VERSION} sidecar`);
|
|
@@ -233,7 +249,9 @@ export async function verifyCeiling(
|
|
|
233
249
|
if (bytesToHex(computedRoot) !== sidecar.root.toLowerCase()) return fail("merkle", "the leaf and path do not reach the root");
|
|
234
250
|
pass("merkle", `leaf ${sidecar.leafIndex} of ${sidecar.leafCount} reaches the root`);
|
|
235
251
|
|
|
236
|
-
|
|
252
|
+
// Pending is the absence of a transaction to check. The status field is
|
|
253
|
+
// the writer's report, unproven by the file, and never decides a result.
|
|
254
|
+
if (!sidecar.anchor) {
|
|
237
255
|
return { ok: false, reason: "ceiling pending: no transaction included yet", checks, status: "pending", headerCheckedAgainstChain: false };
|
|
238
256
|
}
|
|
239
257
|
const a = sidecar.anchor;
|
|
@@ -286,17 +304,22 @@ export async function verifyCeiling(
|
|
|
286
304
|
if (slotAnchor) {
|
|
287
305
|
floor = { blockNumber: slotAnchor.blockNumber, blockHash: slotAnchor.blockHash, blockTimestamp: null };
|
|
288
306
|
const w = sidecar.floor;
|
|
289
|
-
if (w && w
|
|
307
|
+
if (w !== null && w !== undefined) {
|
|
308
|
+
if (typeof w !== "object" || typeof w.blockHeader !== "string" || w.blockHeader.length === 0) {
|
|
309
|
+
return fail("floor", "the sidecar carries a floor without a header (absence is null; a present floor carries its header)");
|
|
310
|
+
}
|
|
290
311
|
try {
|
|
291
312
|
const fh = decodeHeader(hexToBytes(w.blockHeader));
|
|
292
313
|
if (fh.hash === slotAnchor.blockHash.toLowerCase() && fh.number === slotAnchor.blockNumber) {
|
|
293
314
|
floor.blockTimestamp = fh.timestamp;
|
|
294
315
|
pass("floor", `Ethereum block ${fh.number}, header checked against the signed hash`);
|
|
295
316
|
} else {
|
|
296
|
-
|
|
317
|
+
// Every part a sidecar carries must hold: a copy of the floor that
|
|
318
|
+
// is not the signed floor block fails the sidecar, it is not skipped.
|
|
319
|
+
return fail("floor", "the carried floor header does not match the proof's signed slotAnchor");
|
|
297
320
|
}
|
|
298
321
|
} catch {
|
|
299
|
-
|
|
322
|
+
return fail("floor", "the carried floor header does not decode");
|
|
300
323
|
}
|
|
301
324
|
}
|
|
302
325
|
}
|
|
@@ -340,3 +363,43 @@ export async function checkCeilingOnline(
|
|
|
340
363
|
}
|
|
341
364
|
|
|
342
365
|
export { keccak256 as ceilingKeccak256 };
|
|
366
|
+
|
|
367
|
+
// ── The Base stamp as a time bound ─────────────────────────────────────────
|
|
368
|
+
|
|
369
|
+
const isoSec = (unix: number) => new Date(unix * 1000).toISOString().replace(".000Z", "Z");
|
|
370
|
+
const isoMs = (ms: number) => new Date(ms).toISOString();
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* The slack allowed between a Base block's stamp and the attestation
|
|
374
|
+
* document's time: one Base block. A Base stamp is whole seconds on Base's
|
|
375
|
+
* fixed two-second schedule; the document's time is milliseconds on the AWS
|
|
376
|
+
* Nitro hypervisor's clock. The writer puts the ceiling on Base only after
|
|
377
|
+
* the proof exists, so an honest stamp is seconds to minutes after the
|
|
378
|
+
* document; one block covers sealing latency and clock skew.
|
|
379
|
+
*/
|
|
380
|
+
export const BASE_STAMP_TOLERANCE_SECONDS = 2;
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Whether a Base block's stamp may be stated as an "existed by" time for a
|
|
384
|
+
* record. Base stamps every block by its number, so after a halt the missed
|
|
385
|
+
* time is refilled with blocks stamped in the past; in the 2026-06-25 and
|
|
386
|
+
* 2026-06-26 halts those blocks were empty, but nothing in the protocol makes
|
|
387
|
+
* them so. A stamp earlier than the floor block's time, or more than
|
|
388
|
+
* BASE_STAMP_TOLERANCE_SECONDS earlier than the attestation document (made
|
|
389
|
+
* after the signed body it binds), cannot be a bound for this record.
|
|
390
|
+
* Passing says only that the stamp is not known to be wrong: the Base time
|
|
391
|
+
* stays provisional until the block is checked against Base.
|
|
392
|
+
*/
|
|
393
|
+
export function baseTimeIsBound(
|
|
394
|
+
baseTimestampSec: number,
|
|
395
|
+
ref: { floorTimestampSec?: number | null; attestedAtMs?: number | null },
|
|
396
|
+
): { ok: true } | { ok: false; reason: string } {
|
|
397
|
+
if (ref.floorTimestampSec != null && baseTimestampSec < ref.floorTimestampSec) {
|
|
398
|
+
return { ok: false, reason: `Base stamped this block ${isoSec(baseTimestampSec)}, before the floor block's own time (${isoSec(ref.floorTimestampSec)})` };
|
|
399
|
+
}
|
|
400
|
+
if (ref.attestedAtMs != null && baseTimestampSec + BASE_STAMP_TOLERANCE_SECONDS < ref.attestedAtMs / 1000) {
|
|
401
|
+
return { ok: false, reason: `Base stamped this block ${isoSec(baseTimestampSec)}, more than ${BASE_STAMP_TOLERANCE_SECONDS} s before the attestation document was made (${isoMs(ref.attestedAtMs)}), as Base does when it refills time after a halt` };
|
|
402
|
+
}
|
|
403
|
+
return { ok: true };
|
|
404
|
+
}
|
|
405
|
+
|