@mikeargento/bitgraph-verify 1.16.0 → 1.17.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.
Files changed (52) hide show
  1. package/README.md +24 -3
  2. package/dist/__tests__/carrier2.test.js +1 -1
  3. package/dist/__tests__/carrier2.test.js.map +1 -1
  4. package/dist/carrier-assemble.d.ts +12 -2
  5. package/dist/carrier-assemble.d.ts.map +1 -1
  6. package/dist/carrier-assemble.js +14 -3
  7. package/dist/carrier-assemble.js.map +1 -1
  8. package/dist/carrier-verify.d.ts +5 -2
  9. package/dist/carrier-verify.d.ts.map +1 -1
  10. package/dist/carrier-verify.js +110 -43
  11. package/dist/carrier-verify.js.map +1 -1
  12. package/dist/carrier.d.ts +44 -11
  13. package/dist/carrier.d.ts.map +1 -1
  14. package/dist/carrier.js +74 -16
  15. package/dist/carrier.js.map +1 -1
  16. package/dist/ceiling.d.ts +82 -3
  17. package/dist/ceiling.d.ts.map +1 -1
  18. package/dist/ceiling.js +137 -20
  19. package/dist/ceiling.js.map +1 -1
  20. package/dist/export.d.ts +10 -0
  21. package/dist/export.d.ts.map +1 -1
  22. package/dist/export.js +89 -30
  23. package/dist/export.js.map +1 -1
  24. package/dist/fuse.d.ts +43 -11
  25. package/dist/fuse.d.ts.map +1 -1
  26. package/dist/fuse.js +85 -18
  27. package/dist/fuse.js.map +1 -1
  28. package/dist/index.d.ts +9 -3
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +7 -2
  31. package/dist/index.js.map +1 -1
  32. package/dist/measurements.d.ts.map +1 -1
  33. package/dist/measurements.js +1 -0
  34. package/dist/measurements.js.map +1 -1
  35. package/dist/tree.d.ts +15 -3
  36. package/dist/tree.d.ts.map +1 -1
  37. package/dist/tree.js +41 -12
  38. package/dist/tree.js.map +1 -1
  39. package/dist/types.d.ts +21 -0
  40. package/dist/types.d.ts.map +1 -1
  41. package/package.json +1 -1
  42. package/src/__tests__/carrier2.test.ts +1 -1
  43. package/src/carrier-assemble.ts +21 -3
  44. package/src/carrier-verify.ts +107 -45
  45. package/src/carrier.ts +91 -25
  46. package/src/ceiling.ts +150 -24
  47. package/src/export.ts +94 -31
  48. package/src/fuse.ts +114 -23
  49. package/src/index.ts +18 -2
  50. package/src/measurements.ts +1 -0
  51. package/src/tree.ts +42 -10
  52. package/src/types.ts +22 -0
package/src/fuse.ts CHANGED
@@ -204,9 +204,76 @@ export const FUSE2_DOMAIN: Uint8Array = (() => {
204
204
  return out;
205
205
  })();
206
206
 
207
- /** Which commitment a fused proof's signed marker declares: 1, 2, or null when the proof is not fused. */
208
- export function fuseVersionOfName(name: unknown): 1 | 2 | null {
209
- return name === FUSE_ATTRIBUTION_NAME ? 1 : name === FUSE2_ATTRIBUTION_NAME ? 2 : null;
207
+ // ---------------------------------------------------------------------------
208
+ // bitgraph-fuse/3 (2026-10-06, enclave v10): the floor is a Base block.
209
+ //
210
+ // commitment/3 = SHA256(UTF8("bitgraph-fuse/3") || 0x00 || slotRecordHash || nonce || floorBlockHash)
211
+ //
212
+ // floorBlockHash is the 32 raw bytes of commit.slotFloor.blockHash: the Base
213
+ // block the enclave fixed at allocation from a header it hashed itself, and
214
+ // signed into the proof with its chain named. fuse/2 is unchanged and still
215
+ // binds commit.slotAnchor (an Ethereum anchor). A proof carries one floor or
216
+ // the other, never both: a proof with both is ambiguous and binds nothing.
217
+ // ---------------------------------------------------------------------------
218
+
219
+ export const FUSE3_PROFILE = "bitgraph-fuse/3" as const;
220
+ export const FUSE3_ATTRIBUTION_NAME = FUSE3_PROFILE;
221
+
222
+ /** "bitgraph-fuse/3" followed by one zero byte. */
223
+ export const FUSE3_DOMAIN: Uint8Array = (() => {
224
+ const label = new TextEncoder().encode(FUSE3_PROFILE);
225
+ const out = new Uint8Array(label.length + 1);
226
+ out.set(label, 0);
227
+ out[label.length] = 0x00;
228
+ return out;
229
+ })();
230
+
231
+ /** The fused commitment versions: 1 binds no floor, 2 an Ethereum anchor, 3 a Base block. */
232
+ export type FuseVersion = 1 | 2 | 3;
233
+
234
+ /** Which commitment a fused proof's signed marker declares, or null when the proof is not fused. */
235
+ export function fuseVersionOfName(name: unknown): FuseVersion | null {
236
+ return name === FUSE_ATTRIBUTION_NAME ? 1 : name === FUSE2_ATTRIBUTION_NAME ? 2 : name === FUSE3_ATTRIBUTION_NAME ? 3 : null;
237
+ }
238
+
239
+ /** The signed marker name for a version. */
240
+ export function fuseNameOfVersion(version: FuseVersion): string {
241
+ return version === 3 ? FUSE3_ATTRIBUTION_NAME : version === 2 ? FUSE2_ATTRIBUTION_NAME : FUSE_ATTRIBUTION_NAME;
242
+ }
243
+
244
+ /**
245
+ * The floor a proof signs, whichever kind it is: an Ethereum anchor fixed at
246
+ * allocation (commit.slotAnchor, enclave v7 to v9) or a Base block
247
+ * (commit.slotFloor, enclave v10). Null when the proof signs no floor. Throws
248
+ * when it signs both, or a slotFloor that does not name Base: such a proof is
249
+ * ambiguous and nothing should be read from it as a floor.
250
+ */
251
+ export interface SignedFloor {
252
+ chain: "ethereum" | "base";
253
+ blockNumber: number;
254
+ /** 0x-prefixed lowercase hex. */
255
+ blockHash: string;
256
+ /** Unix seconds; signed only for a Base floor (an Ethereum floor's time is read from its header). */
257
+ blockTimestamp?: number;
258
+ /** The anchor proof's counter, for an Ethereum floor. */
259
+ anchorCounter?: string;
260
+ }
261
+
262
+ export function signedFloorOf(proof: BitGraphProof): SignedFloor | null {
263
+ const a = proof.commit?.slotAnchor;
264
+ const f = proof.commit?.slotFloor;
265
+ if (a && f) throw new TypeError("the proof signs two floors (commit.slotAnchor and commit.slotFloor); it is ambiguous and binds neither");
266
+ if (f) {
267
+ if (f.chain !== "base" || f.evmChainId !== 8453) throw new TypeError("commit.slotFloor does not name Base mainnet");
268
+ if (typeof f.blockHash !== "string" || !/^0x[0-9a-f]{64}$/.test(f.blockHash)) throw new TypeError("commit.slotFloor.blockHash is not a 32-byte hash");
269
+ if (!Number.isSafeInteger(f.blockNumber) || !Number.isSafeInteger(f.blockTimestamp)) throw new TypeError("commit.slotFloor carries no block number or time");
270
+ return { chain: "base", blockNumber: f.blockNumber, blockHash: f.blockHash, blockTimestamp: f.blockTimestamp };
271
+ }
272
+ if (a) {
273
+ if (typeof a.blockHash !== "string") throw new TypeError("commit.slotAnchor.blockHash is missing");
274
+ return { chain: "ethereum", blockNumber: a.blockNumber, blockHash: a.blockHash.toLowerCase(), anchorCounter: a.counter };
275
+ }
276
+ return null;
210
277
  }
211
278
 
212
279
  /** True for either fused marker name. Use this, never a string compare against one version. */
@@ -234,30 +301,54 @@ export function computeSlotCommitment2(slot: SlotAllocation, floorBlockHash: str
234
301
  return sha256(slotCommitment2Preimage(slot, floorBlockHash));
235
302
  }
236
303
 
304
+ /** The exact preimage of commitment/3: domain/3 || slotRecordHash || nonce || floorBlockHash (a Base block). */
305
+ export function slotCommitment3Preimage(slot: SlotAllocation, floorBlockHash: string | Uint8Array): Uint8Array {
306
+ const nonce = base64ToBytes(slot.nonceB64);
307
+ if (nonce === null || nonce.length !== 32) {
308
+ throw new TypeError("slot.nonceB64 must decode to exactly 32 bytes");
309
+ }
310
+ return concat(FUSE3_DOMAIN, computeSlotRecordHash(slot), nonce, floorHashBytes(floorBlockHash));
311
+ }
312
+
313
+ /** commitment/3 = SHA256(domain/3 || slotRecordHash || nonce || floorBlockHash). */
314
+ export function computeSlotCommitment3(slot: SlotAllocation, floorBlockHash: string | Uint8Array): Uint8Array {
315
+ return sha256(slotCommitment3Preimage(slot, floorBlockHash));
316
+ }
317
+
237
318
  /**
238
319
  * The commitment a fused proof's bytes must carry, chosen by its signed marker:
239
- * fuse/2 binds the proof's own signed commit.slotAnchor block, fuse/1 does not.
240
- * Throws when a fuse/2 proof has no signed floor to bind.
320
+ * fuse/3 binds the proof's signed Base floor (commit.slotFloor), fuse/2 its
321
+ * signed Ethereum anchor (commit.slotAnchor), fuse/1 no floor. Throws when the
322
+ * marker's floor is missing, or the proof signs both floors.
241
323
  */
242
324
  export function commitmentForProof(proof: BitGraphProof, slot: SlotAllocation): Uint8Array {
243
- if (fuseVersionOfName(proof.attribution?.name) === 2) {
244
- const hash = proof.commit?.slotAnchor?.blockHash;
245
- if (typeof hash !== "string") throw new TypeError("a bitgraph-fuse/2 proof must carry a signed commit.slotAnchor to bind");
246
- return computeSlotCommitment2(slot, hash);
325
+ const version = fuseVersionOfName(proof.attribution?.name);
326
+ if (version === 1 || version === null) return computeSlotCommitment(slot);
327
+ const floor = signedFloorOf(proof);
328
+ if (version === 2) {
329
+ if (floor?.chain !== "ethereum") throw new TypeError("a bitgraph-fuse/2 proof must carry a signed commit.slotAnchor to bind");
330
+ return computeSlotCommitment2(slot, floor.blockHash);
247
331
  }
248
- return computeSlotCommitment(slot);
332
+ if (floor?.chain !== "base") throw new TypeError("a bitgraph-fuse/3 proof must carry a signed commit.slotFloor (a Base block) to bind");
333
+ return computeSlotCommitment3(slot, floor.blockHash);
249
334
  }
250
335
 
251
336
  /**
252
337
  * The commitment a PRODUCER writes into new bytes, from what the allocation
253
- * returned: fuse/2 when the enclave handed back its floor anchor (v9 and
254
- * later), else fuse/1. The attribution name must be chosen to match; see
255
- * fuseAttribution's version argument.
338
+ * returned: fuse/3 when the enclave handed back a Base floor (v10), fuse/2 for
339
+ * an Ethereum floor anchor (v9), else fuse/1. The attribution name must match;
340
+ * see fuseAttribution's version argument.
256
341
  */
257
- export function producerCommitment(slot: SlotAllocation, floor?: { blockHash: string } | null): { commitment: Uint8Array; version: 1 | 2 } {
258
- return floor && typeof floor.blockHash === "string"
259
- ? { commitment: computeSlotCommitment2(slot, floor.blockHash), version: 2 }
260
- : { commitment: computeSlotCommitment(slot), version: 1 };
342
+ export function producerCommitment(
343
+ slot: SlotAllocation,
344
+ floor?: { blockHash: string; chain?: string } | null,
345
+ ): { commitment: Uint8Array; version: FuseVersion } {
346
+ if (floor && typeof floor.blockHash === "string") {
347
+ return floor.chain === "base"
348
+ ? { commitment: computeSlotCommitment3(slot, floor.blockHash), version: 3 }
349
+ : { commitment: computeSlotCommitment2(slot, floor.blockHash), version: 2 };
350
+ }
351
+ return { commitment: computeSlotCommitment(slot), version: 1 };
261
352
  }
262
353
 
263
354
  // ---------------------------------------------------------------------------
@@ -998,11 +1089,11 @@ export function getPlacement(id: string): Placement | undefined {
998
1089
  * set/1 refuses an origin digest: a set/1 marker carrying one is out of
999
1090
  * profile and verifyFuseMember refuses it.
1000
1091
  */
1001
- export function fuseAttribution(placement: PlacementId, originDigest?: Uint8Array, version: 1 | 2 = 1): Attribution {
1092
+ export function fuseAttribution(placement: PlacementId, originDigest?: Uint8Array, version: FuseVersion = 1): Attribution {
1002
1093
  if (originDigest !== undefined && originDigest.length !== 32) throw new TypeError("originDigest must be 32 bytes");
1003
1094
  if ((placement === SET_PLACEMENT_ID || placement === SET2_PLACEMENT_ID) && originDigest !== undefined) throw new TypeError(`${placement} has no single origin; a set marker carries no origin digest`);
1004
1095
  return {
1005
- name: version === 2 ? FUSE2_ATTRIBUTION_NAME : FUSE_ATTRIBUTION_NAME,
1096
+ name: fuseNameOfVersion(version),
1006
1097
  title: placement,
1007
1098
  ...(originDigest !== undefined ? { message: bytesToBase64(originDigest) } : {}),
1008
1099
  };
@@ -1025,7 +1116,7 @@ export interface FuseMarker {
1025
1116
  /** "attribution" when the proof's signed attribution marks it fused, else "manifest". */
1026
1117
  source: MarkerSource;
1027
1118
  /** Which commitment the signed marker declares; absent on a manifest-only marker, which means 1. */
1028
- version?: 1 | 2;
1119
+ version?: FuseVersion;
1029
1120
  }
1030
1121
 
1031
1122
  /** Read the fused marker from a proof's signed attribution, or null when the proof is not marked fused. */
@@ -1076,15 +1167,15 @@ export function findCommitment(bytes: Uint8Array, commitment: Uint8Array, encodi
1076
1167
  }
1077
1168
 
1078
1169
  /** The attribution a producer sends for an artifact made with the commitment inside it. */
1079
- export function inlineAttribution(version: 1 | 2 = 1): { name: string; title: string } {
1080
- return { name: version === 2 ? FUSE2_ATTRIBUTION_NAME : FUSE_ATTRIBUTION_NAME, title: ENCODING_BASE64URL };
1170
+ export function inlineAttribution(version: FuseVersion = 1): { name: string; title: string } {
1171
+ return { name: fuseNameOfVersion(version), title: ENCODING_BASE64URL };
1081
1172
  }
1082
1173
 
1083
1174
  export function readFuseAttribution(proof: BitGraphProof): FuseMarker | null {
1084
1175
  const a = proof.attribution;
1085
1176
  const version = fuseVersionOfName(a?.name);
1086
1177
  if (a === undefined || version === null) return null;
1087
- // A tree/1 proof carries the fuse/2 name, but it is not a single fused file:
1178
+ // A tree/1 proof carries the fuse/2 or fuse/3 name, but it is not a single fused file:
1088
1179
  // its committed artifact is the tree's root document and its message is the
1089
1180
  // SPEC hash, not an origin. Read it with verifyTreeMember (tree.ts), never
1090
1181
  // here, or the spec hash would be taken for an origin digest.
package/src/index.ts CHANGED
@@ -62,6 +62,13 @@ export {
62
62
  FUSE2_PROFILE,
63
63
  FUSE2_DOMAIN,
64
64
  FUSE2_ATTRIBUTION_NAME,
65
+ FUSE3_PROFILE,
66
+ FUSE3_DOMAIN,
67
+ FUSE3_ATTRIBUTION_NAME,
68
+ fuseNameOfVersion,
69
+ signedFloorOf,
70
+ slotCommitment3Preimage,
71
+ computeSlotCommitment3,
65
72
  fuseVersionOfName,
66
73
  isFuseMarkerName,
67
74
  slotCommitment2Preimage,
@@ -82,7 +89,7 @@ export {
82
89
  hexToBytes,
83
90
  bytesEqual,
84
91
  } from "./fuse.js";
85
- export type { PlacementId, Placement, Located, FusePayload, FuseFrame, FuseMarker, MarkerSource, SetMember, SetManifest, FusedFrame } from "./fuse.js";
92
+ export type { PlacementId, Placement, Located, FusePayload, FuseFrame, FuseMarker, MarkerSource, SetMember, SetManifest, FusedFrame, FuseVersion, SignedFloor } from "./fuse.js";
86
93
  export { MAX_CONTAINER_ENTRY_BYTES } from "./fuse.js";
87
94
  /* Streaming checks: a file of any size against its leaf, in constant memory. */
88
95
  export { bytesSource, blobSource, streamDigest, streamLeafCheck } from "./stream.js";
@@ -125,6 +132,12 @@ export type { CarrierVersion, CarrierCeilingInTime, CarrierSettlement, CarrierPi
125
132
  export { assembleCarrierV2Payload, carrierBlockSize, CARRIER_BLOCK_ZIP_LIMIT } from "./carrier-assemble.js";
126
133
  export type { CarrierV2Parts } from "./carrier-assemble.js";
127
134
 
135
+ /* bitgraph-carrier/3 (2026-10-06, enclave v10): the floor is the Base header the proof signs; no ceiling in position exists. */
136
+ export { CARRIER_VERSION_3, baseHeaderFields } from "./carrier.js";
137
+ export type { CarrierBaseFloor } from "./carrier.js";
138
+ export { assembleCarrierV3Payload } from "./carrier-assemble.js";
139
+ export type { CarrierV3Parts } from "./carrier-assemble.js";
140
+
128
141
  /* AWS Nitro attestation: decode, verify (chain to the AWS root, validity at the document's instant), and the openssl-checkable witness. */
129
142
  export {
130
143
  AWS_NITRO_ROOT_CA_PEM, awsNitroRootDer, awsNitroRootSha256, decodeNitroAttestation, verifyNitroAttestation,
@@ -150,7 +163,7 @@ export type { RlpItem, DecodedHeader, DecodedTx } from "./ceiling-evm.js";
150
163
  /* tree/1 (2026-10-03): every BitGraph is a Merkle tree under one position; a single file is a tree of one. */
151
164
  export {
152
165
  TREE_PLACEMENT_ID, TREE_PROFILE, TREE_DOMAIN, TREE_LEAF_BYTES, TREE_ROOT_DOCUMENT_BYTES, MAX_TREE_LEAVES, TREE_METADATA_KEY,
153
- KNOWN_TREE_SPEC_HASHES, LEAF_AS_IS, LEAF_PLACEMENTS, TREE_MEMBER_CATEGORIES,
166
+ KNOWN_TREE_SPEC_HASHES, TREE_SPEC_V1_HASH, TREE_SPEC_V2_HASH, LEAF_AS_IS, LEAF_PLACEMENTS, TREE_MEMBER_CATEGORIES,
154
167
  leafCodeOf, encodeTreeLeaf, decodeTreeLeaf, treeLeafHash, sortTreeLeaves, buildTree,
155
168
  buildTreeRootDocument, parseTreeRootDocument, readTreeMetadata, treeAttribution, currentTreeSpecHash, isTreeProof,
156
169
  buildTreeMemberEvidence, parseTreeMemberEvidence, treeRootFromMember, encodeTreeLeaves, decodeTreeLeaves, verifyTreeLeaves,
@@ -168,6 +181,9 @@ export type { OutputRootSettlement, OutputRootCheck, OutputRootVerifyResult, Out
168
181
  /* bitgraph-export/1: one JSON file that, with the file, checks a tree/1 BitGraph with nothing of BitGraph's required. */
169
182
  export { EXPORT_FORMAT, parseExport, verifyExport, buildExport } from "./export.js";
170
183
  export { baseTimeIsBound, BASE_STAMP_TOLERANCE_SECONDS } from "./ceiling.js";
184
+ /* The floor block's header, on either chain (enclave v10 floors are Base blocks). */
185
+ export { checkFloorHeader, floorTimeIsBound, onBaseSchedule, headerRlpFromRpc, BASE_MAINNET_GENESIS_TIME, BASE_BLOCK_TIME_SECONDS } from "./ceiling.js";
186
+ export type { RpcBlockHeader } from "./ceiling.js";
171
187
  /* The enclave images BitGraph has published: the default measurement policy (SPEC section 16). */
172
188
  export { PUBLISHED_ENCLAVE_MEASUREMENTS, PUBLISHED_PCR0S, publishedMeasurement } from "./measurements.js";
173
189
  export type { PublishedMeasurement } from "./measurements.js";
@@ -35,6 +35,7 @@ export const PUBLISHED_ENCLAVE_MEASUREMENTS: readonly PublishedMeasurement[] = O
35
35
  { version: "v7", since: "2026-09-06", pcr0: "394c3cf515651dc27187d85e4716c12dfeb99c1227f1fe0eacfaa427d80018e1a28ebba9469e99c7936601f901d74e1d" },
36
36
  { version: "v8", since: "2026-09-07", pcr0: "eccfc1c78006f4b74f929c992785575c908a0f60eca08ff638cd6c0842f993f182ebb002457b8ef3e732a6a10805c72b" },
37
37
  { version: "v9", since: "2026-09-30", pcr0: "934feb8bb6f4f7e2d2f85d902a7d5edd0981f706d9d2385638988ac096a05ea0583c3d00eef2a7947865ec66efc1fcf8" },
38
+ { version: "v10", since: "2026-10-08", pcr0: "5a947cc66095adcceefa9e5ece5d1416dfe08c3470df1bcaa5b2bc5267b0480e6cdc172fe077cd06b0afb07614307973" },
38
39
  ].map((m) => Object.freeze(m)));
39
40
 
40
41
  /** PUBLISHED_ENCLAVE_MEASUREMENTS as the bare PCR0 list a verifier's pins take. */
package/src/tree.ts CHANGED
@@ -43,6 +43,7 @@ import {
43
43
  bytesToHex,
44
44
  commitmentForProof,
45
45
  FUSE2_ATTRIBUTION_NAME,
46
+ FUSE3_ATTRIBUTION_NAME,
46
47
  fuseVersionOfName,
47
48
  getPlacement,
48
49
  hexToBytes,
@@ -81,9 +82,25 @@ export const TREE_METADATA_KEY = TREE_PROFILE;
81
82
  * Appending a revised spec here is how a verifier learns it; nothing is ever
82
83
  * removed, so every proof made under an earlier spec keeps verifying.
83
84
  */
85
+ /** SPEC.md v1 (spec/SPEC.md). Frozen 2026-10-04 (spec/FROZEN.json): tree/1 under bitgraph-fuse/2, an Ethereum floor. */
86
+ export const TREE_SPEC_V1_HASH = "QazdIR0JYtHQwQuIISo7bvH1gxUvTS2cY+tW6BjUIRs=";
87
+ /** SPEC v2 (spec/SPEC-v2.md): tree/1 under bitgraph-fuse/3, a Base floor (enclave v10). */
88
+ export const TREE_SPEC_V2_HASH = "9O3sqlxqi6IQPVJd50NfjJtwWWoslZ9gpIIzbrRzAiU=";
89
+
84
90
  export const KNOWN_TREE_SPEC_HASHES: readonly string[] = Object.freeze([
85
- // SPEC.md v1 (spec/SPEC.md). Frozen 2026-10-04 (spec/FROZEN.json): it never changes; a later spec is added beside it, never in its place.
86
- "QazdIR0JYtHQwQuIISo7bvH1gxUvTS2cY+tW6BjUIRs=",
91
+ // Each spec never changes; a later spec is added beside it, never in its place.
92
+ TREE_SPEC_V1_HASH,
93
+ TREE_SPEC_V2_HASH,
94
+ ]);
95
+
96
+ /**
97
+ * The marker each spec requires: v1 defines tree/1 under fuse/2 (the floor an
98
+ * Ethereum anchor), v2 under fuse/3 (the floor a Base block). A tree proof
99
+ * whose marker and spec disagree is refused, so neither spec's meaning moves.
100
+ */
101
+ const TREE_SPEC_FUSE_VERSION: ReadonlyMap<string, 2 | 3> = new Map([
102
+ [TREE_SPEC_V1_HASH, 2],
103
+ [TREE_SPEC_V2_HASH, 3],
87
104
  ]);
88
105
 
89
106
  /** Placement codes: the first byte of a leaf. */
@@ -210,16 +227,26 @@ export function readTreeMetadata(proof: BitGraphProof): Uint8Array | null {
210
227
  // The signed marker
211
228
  // ---------------------------------------------------------------------------
212
229
 
213
- /** The attribution a producer sends for a tree/1 commit. specHash is the 32-byte SHA-256 of the SPEC.md the producer follows. */
230
+ /**
231
+ * The attribution a producer sends for a tree/1 commit. specHash is the 32-byte
232
+ * SHA-256 of the spec the producer follows; the marker is the one that spec
233
+ * requires (fuse/2 for v1, fuse/3 for v2).
234
+ */
214
235
  export function treeAttribution(specHash: Uint8Array): Attribution {
215
236
  if (specHash.length !== 32) throw new TypeError("the spec hash is 32 bytes");
216
- return { name: FUSE2_ATTRIBUTION_NAME, title: TREE_PLACEMENT_ID, message: bytesToBase64(specHash) };
237
+ const b64 = bytesToBase64(specHash);
238
+ const version = TREE_SPEC_FUSE_VERSION.get(b64) ?? 2;
239
+ return { name: version === 3 ? FUSE3_ATTRIBUTION_NAME : FUSE2_ATTRIBUTION_NAME, title: TREE_PLACEMENT_ID, message: b64 };
217
240
  }
218
241
 
219
- /** The current spec hash a producer pins, as raw bytes. Throws while the spec hash is still a placeholder. */
220
- export function currentTreeSpecHash(): Uint8Array {
221
- const latest = KNOWN_TREE_SPEC_HASHES[KNOWN_TREE_SPEC_HASHES.length - 1]!;
222
- const b = base64ToBytes(latest);
242
+ /**
243
+ * The spec hash a producer pins, as raw bytes, for the floor its allocation
244
+ * returned: a Base floor (fuse/3) follows SPEC v2, an Ethereum floor anchor
245
+ * (fuse/2) follows SPEC v1. Throws while the requested spec hash is a placeholder.
246
+ */
247
+ export function currentTreeSpecHash(fuseVersion: 2 | 3 = 2): Uint8Array {
248
+ const hash = fuseVersion === 3 ? TREE_SPEC_V2_HASH : TREE_SPEC_V1_HASH;
249
+ const b = base64ToBytes(hash);
223
250
  if (b === null || b.length !== 32) throw new Error("the tree/1 spec hash has not been set");
224
251
  return b;
225
252
  }
@@ -429,14 +456,19 @@ export async function verifyTreeMember(opts: TreeVerifyOptions): Promise<TreeVer
429
456
  if (!v.valid) return base("INVALID_UNDERLYING_PROOF", `the proof does not verify (${v.reason ?? "invalid"})`, { proof: proofResult });
430
457
  }
431
458
 
432
- // 2. The signed marker: fuse/2 (the floor is bound) and a known spec.
459
+ // 2. The signed marker: fuse/2 or fuse/3 (the floor is bound) and a known spec that requires it.
433
460
  const a = proof.attribution!;
434
- if (fuseVersionOfName(a.name) !== 2) return base("INVALID_TREE_MARKER", "a tree/1 proof must be marked bitgraph-fuse/2, which binds the floor block into the commitment", { proof: proofResult });
461
+ const markerVersion = fuseVersionOfName(a.name);
462
+ if (markerVersion !== 2 && markerVersion !== 3) return base("INVALID_TREE_MARKER", "a tree/1 proof must be marked bitgraph-fuse/2 or bitgraph-fuse/3, which bind the floor block into the commitment", { proof: proofResult });
435
463
  const specBytes = typeof a.message === "string" ? base64ToBytes(a.message) : null;
436
464
  if (specBytes === null || specBytes.length !== 32) return base("INVALID_TREE_MARKER", "a tree/1 proof must pin its spec: the signed message is the base64 SHA-256 of SPEC.md", { proof: proofResult });
437
465
  const specHashB64 = a.message as string;
438
466
  const known = new Set([...KNOWN_TREE_SPEC_HASHES, ...(opts.extraSpecHashes ?? [])]);
439
467
  if (!known.has(specHashB64)) return base("UNKNOWN_SPEC", `the proof follows a spec this verifier does not know (${specHashB64})`, { proof: proofResult, specHashB64 });
468
+ const required = TREE_SPEC_FUSE_VERSION.get(specHashB64);
469
+ if (required !== undefined && required !== markerVersion) {
470
+ return base("INVALID_TREE_MARKER", `the proof pins a spec that defines tree/1 under bitgraph-fuse/${required}, but is marked bitgraph-fuse/${markerVersion}`, { proof: proofResult, specHashB64 });
471
+ }
440
472
 
441
473
  // 3. The commitment, from the proof's own slot record and signed floor block.
442
474
  if (!proof.slotAllocation) return base("INVALID_SLOT_COMMITMENT", "the proof carries no slot record, so no commitment can be recomputed", { proof: proofResult, specHashB64 });
package/src/types.ts CHANGED
@@ -183,6 +183,28 @@ export interface BitGraphProof {
183
183
  blockHash: string;
184
184
  };
185
185
 
186
+ /**
187
+ * Enclave v10 (2026-10-06). The Base block fixed as this proof's floor
188
+ * when its slot was ALLOCATED: the parent hands the enclave the newest Base
189
+ * header, and the enclave hashes it (keccak-256), reads the number and time
190
+ * from the same bytes, refuses a block lower than the chain's last floor or
191
+ * stamped ahead of its own clock or off Base's 2 s schedule, and SIGNS the result here. It names its
192
+ * chain, so a verifier never reads it as an Ethereum floor. Proofs with
193
+ * slotAnchor and no slotFloor have an Ethereum floor. Verify it with the
194
+ * Base header: keccak(header) must equal blockHash and the block must be
195
+ * on Base (one lookup).
196
+ */
197
+ slotFloor?: {
198
+ chain: "base";
199
+ /** The EVM chain id, not BitGraph's chain id (commit.chainId). */
200
+ evmChainId: 8453;
201
+ blockNumber: number;
202
+ /** 0x-prefixed lowercase hex, 32 bytes. */
203
+ blockHash: string;
204
+ /** Unix seconds, read from the header. */
205
+ blockTimestamp: number;
206
+ };
207
+
186
208
  /**
187
209
  * Epoch lineage link — present only on the FIRST proof of a new epoch.
188
210
  *