@mikeargento/bitgraph-audit 0.6.4 → 0.8.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 (42) hide show
  1. package/dist/audit.d.ts +1 -1
  2. package/dist/audit.d.ts.map +1 -1
  3. package/dist/audit.js +9 -2
  4. package/dist/audit.js.map +1 -1
  5. package/dist/ceilings.d.ts +41 -0
  6. package/dist/ceilings.d.ts.map +1 -0
  7. package/dist/ceilings.js +198 -0
  8. package/dist/ceilings.js.map +1 -0
  9. package/dist/cli.js +48 -4
  10. package/dist/cli.js.map +1 -1
  11. package/dist/index.d.ts +4 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +3 -0
  14. package/dist/index.js.map +1 -1
  15. package/dist/ingest.d.ts.map +1 -1
  16. package/dist/ingest.js +17 -0
  17. package/dist/ingest.js.map +1 -1
  18. package/dist/report-json.d.ts.map +1 -1
  19. package/dist/report-json.js +3 -0
  20. package/dist/report-json.js.map +1 -1
  21. package/dist/report-md.js +24 -0
  22. package/dist/report-md.js.map +1 -1
  23. package/dist/settlement-blobs.d.ts +131 -0
  24. package/dist/settlement-blobs.d.ts.map +1 -0
  25. package/dist/settlement-blobs.js +682 -0
  26. package/dist/settlement-blobs.js.map +1 -0
  27. package/dist/types.d.ts +96 -0
  28. package/dist/types.d.ts.map +1 -1
  29. package/package.json +5 -3
  30. package/src/__tests__/fixtures/settlement/0x018efc046e94610e2530344caf1574e507a3182e1a975fb25b032ec1434a3f5c.bin +0 -0
  31. package/src/__tests__/fixtures/settlement/ceiling-51979918.json +101 -0
  32. package/src/__tests__/fixtures/settlement/pointer-51979918.json +69 -0
  33. package/src/__tests__/settlement.test.ts +254 -0
  34. package/src/audit.ts +8 -1
  35. package/src/ceilings.ts +219 -0
  36. package/src/cli.ts +47 -7
  37. package/src/index.ts +6 -0
  38. package/src/ingest.ts +19 -0
  39. package/src/report-json.ts +3 -0
  40. package/src/report-md.ts +22 -0
  41. package/src/settlement-blobs.ts +689 -0
  42. package/src/types.ts +85 -0
package/src/types.ts CHANGED
@@ -406,6 +406,8 @@ export interface IngestCounts {
406
406
  artifacts: number;
407
407
  /** Anchor witness files. */
408
408
  witnesses: number;
409
+ /** Ceiling files (bitgraph-ceiling/1) and ceiling status notes (bitgraph-ceiling-status/1). */
410
+ ceilings?: number;
409
411
  /** Container entries skipped for unsafe paths. */
410
412
  skippedUnsafePaths: number;
411
413
  }
@@ -467,6 +469,10 @@ export interface IngestResult {
467
469
  artifacts: ArtifactRecord[];
468
470
  /** Anchor witness files in observation order. */
469
471
  witnesses: AnchorWitnessFile[];
472
+ /** Ceiling files (bitgraph-ceiling/1) in observation order. Optional so older embedders' IngestResults still type. */
473
+ ceilings?: CeilingFile[];
474
+ /** Ceiling status notes (bitgraph-ceiling-status/1): a package saying why a ceiling is absent. */
475
+ ceilingStatuses?: CeilingFile[];
470
476
  /** Present when a root manifest.json entry existed. */
471
477
  manifest?: ManifestReport;
472
478
 
@@ -1306,6 +1312,8 @@ export interface AuditOptions {
1306
1312
  * explicitly non-AWS deployments.
1307
1313
  */
1308
1314
  trustedRootCaDer?: Uint8Array;
1315
+ /** Ceilings in time: the declared writer, the chain, and an optional Base RPC for the one online check. */
1316
+ ceilings?: import("./ceilings.js").CeilingAuditOptions;
1309
1317
  }
1310
1318
 
1311
1319
  /**
@@ -1325,6 +1333,79 @@ export interface AuditRunMetadata {
1325
1333
  }
1326
1334
 
1327
1335
  /** Everything one full audit run produced, in pipeline order. */
1336
+ /** A ceiling file or a ceiling status note, as found in the bundle. Never an artifact. */
1337
+ export interface CeilingFile {
1338
+ path: string;
1339
+ fileSha256Hex: string;
1340
+ json: Record<string, unknown>;
1341
+ }
1342
+
1343
+ /** One ceiling file checked against its proof (verifyCeiling), offline. */
1344
+ export interface CeilingCheck {
1345
+ path: string;
1346
+ proofHash: string | null;
1347
+ /**
1348
+ * verified: every offline check passed. failed: the file is present and
1349
+ * wrong (a tampered or foreign ceiling). pending: the file says no Base
1350
+ * transaction yet. unmatched: no proof in the bundle has its proofHash.
1351
+ */
1352
+ status: "verified" | "failed" | "pending" | "unmatched";
1353
+ reason?: string;
1354
+ /** One line for people, e.g. "Ceiling: Base block N at hh:mm:ss UTC, settled on Ethereum." */
1355
+ label?: string;
1356
+ window?: {
1357
+ floorBlock: number | null;
1358
+ floorTime: number | null;
1359
+ ceilingChainId: number;
1360
+ ceilingBlock: number;
1361
+ ceilingTime: number;
1362
+ widthSeconds: number | null;
1363
+ };
1364
+ /** Online check against a Base RPC: null when not asked or unreachable. */
1365
+ onChain: boolean | null;
1366
+ onChainDetail?: string;
1367
+ /** Present when the ceiling file carries a settlement pointer (bitgraph-settlement/1). */
1368
+ settlement?: CeilingSettlementCheck;
1369
+ }
1370
+
1371
+ /**
1372
+ * A ceiling's settlement on Ethereum, checked offline in two layers: the
1373
+ * POINTER (the Ethereum header, the batcher transaction's inclusion, its
1374
+ * blob commitments) and the BLOBS (blob bytes kept in the bundle, verified
1375
+ * against those commitments and decoded down to the ceiling transaction).
1376
+ * Blob bytes absent from the bundle are reported, never a failure.
1377
+ */
1378
+ export interface CeilingSettlementCheck {
1379
+ /** verified: both layers passed. pointer-only: the pointer passed and no blob bytes were in the bundle. failed: a layer that ran failed. */
1380
+ status: "verified" | "pointer-only" | "failed";
1381
+ pointer: {
1382
+ ok: boolean;
1383
+ reason?: string;
1384
+ /** The Ethereum block the batcher transaction is in, read from its verified header. */
1385
+ existedBy?: { blockNumber: number; blockHash: string; blockTimestamp: number };
1386
+ };
1387
+ blobs: {
1388
+ status: "verified" | "failed" | "absent";
1389
+ detail: string;
1390
+ /** Blobs the pointer names, and how many had bytes in the bundle. */
1391
+ listed: number;
1392
+ supplied: number;
1393
+ /** Where the ceiling transaction was found inside the decoded batch data. */
1394
+ located?: { baseBlockNumber: number; baseTxIndex: number; txHash: string; batchComplete: boolean; framesDecoded: number; framesTotal: number | null };
1395
+ };
1396
+ /** One line per layer, for people. */
1397
+ lines: string[];
1398
+ }
1399
+
1400
+ export interface CeilingAnalysis {
1401
+ /** The writer address the ceilings were checked against. */
1402
+ writer: string;
1403
+ chainId: number;
1404
+ checks: CeilingCheck[];
1405
+ /** Status notes carried instead of a ceiling (path and note). */
1406
+ statuses: Array<{ path: string; status: string; note: string }>;
1407
+ }
1408
+
1328
1409
  export interface AuditResult {
1329
1410
  runMetadata: AuditRunMetadata;
1330
1411
  ingest: IngestResult;
@@ -1336,6 +1417,8 @@ export interface AuditResult {
1336
1417
  witnesses: AnchorWitnessAnalysis;
1337
1418
  temporal: TemporalAnalysis;
1338
1419
  attestations: AttestationAnalysis;
1420
+ /** Ceilings in time on Base. Absent from results made before this stage existed. */
1421
+ ceilings?: CeilingAnalysis;
1339
1422
  }
1340
1423
 
1341
1424
  /**
@@ -1577,6 +1660,8 @@ export interface AuditJsonReport {
1577
1660
  groups: AuthorityGroup[];
1578
1661
  sharedSignersAcrossEpochs: SignerEpochSpan[];
1579
1662
  };
1663
+ /** Ceilings in time on Base (bitgraph-ceiling/1). Absent when the bundle carries none. */
1664
+ ceilings?: import("./types.js").CeilingAnalysis;
1580
1665
  attestations: {
1581
1666
  records: ProofAttestationRecord[];
1582
1667
  counts: AttestationAnalysis["counts"];