@mikeargento/bitgraph-audit 0.9.0 → 0.11.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/README.md +5 -3
- package/dist/audit.d.ts +4 -3
- package/dist/audit.d.ts.map +1 -1
- package/dist/audit.js +9 -3
- package/dist/audit.js.map +1 -1
- package/dist/ceilings.d.ts.map +1 -1
- package/dist/ceilings.js +1 -0
- package/dist/ceilings.js.map +1 -1
- package/dist/cli.js +120 -21
- package/dist/cli.js.map +1 -1
- package/dist/exports.d.ts.map +1 -1
- package/dist/exports.js +6 -3
- package/dist/exports.js.map +1 -1
- package/dist/floors.d.ts +23 -0
- package/dist/floors.d.ts.map +1 -0
- package/dist/floors.js +203 -0
- package/dist/floors.js.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/ingest.d.ts +2 -0
- package/dist/ingest.d.ts.map +1 -1
- package/dist/ingest.js +14 -0
- package/dist/ingest.js.map +1 -1
- package/dist/report-json.d.ts.map +1 -1
- package/dist/report-json.js +15 -0
- package/dist/report-json.js.map +1 -1
- package/dist/report-md.js +95 -27
- package/dist/report-md.js.map +1 -1
- package/dist/temporal.d.ts +12 -0
- package/dist/temporal.d.ts.map +1 -1
- package/dist/temporal.js +245 -41
- package/dist/temporal.js.map +1 -1
- package/dist/types.d.ts +136 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/__tests__/base-floor.test.ts +405 -0
- package/src/__tests__/carrier-tree.test.ts +95 -0
- package/src/audit.ts +9 -3
- package/src/ceilings.ts +1 -0
- package/src/cli.ts +128 -22
- package/src/exports.ts +7 -3
- package/src/floors.ts +242 -0
- package/src/index.ts +8 -0
- package/src/ingest.ts +15 -0
- package/src/report-json.ts +15 -0
- package/src/report-md.ts +109 -31
- package/src/temporal.ts +279 -48
- package/src/types.ts +140 -6
package/src/report-md.ts
CHANGED
|
@@ -390,41 +390,51 @@ function executiveSummary(
|
|
|
390
390
|
lines.push("### External time evidence");
|
|
391
391
|
lines.push("");
|
|
392
392
|
const t = s.temporal;
|
|
393
|
-
|
|
393
|
+
const bf = t.baseFloors;
|
|
394
|
+
if (t.anchorsIdentified === 0 && bf === undefined) {
|
|
394
395
|
lines.push(
|
|
395
396
|
"No Ethereum anchor proofs were observed. The causal order of the " +
|
|
396
397
|
"proofs stands on its own; this report makes no wall-clock claims."
|
|
397
398
|
);
|
|
398
399
|
lines.push("");
|
|
399
400
|
} else {
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
"
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
401
|
+
if (t.anchorsIdentified > 0) {
|
|
402
|
+
lines.push(
|
|
403
|
+
`${withCommas(t.anchorsIdentified)} Ethereum anchor ${plural(t.anchorsIdentified, "proof was", "proofs were")} ` +
|
|
404
|
+
"identified. An anchor is an ordinary chain member that committed " +
|
|
405
|
+
"the fingerprint of a public Ethereum block, giving the chain a " +
|
|
406
|
+
"contact point with a public timeline. " +
|
|
407
|
+
`${withCommas(t.anchorsWithVerifiedWitness)} ${plural(t.anchorsWithVerifiedWitness, "anchor", "anchors")} ` +
|
|
408
|
+
"came with witness material (the block header) that let this tool " +
|
|
409
|
+
"reconstruct the block fingerprint locally and confirm it against " +
|
|
410
|
+
"the signed anchor, entirely offline."
|
|
411
|
+
);
|
|
412
|
+
lines.push("");
|
|
413
|
+
lines.push(
|
|
414
|
+
"A verified anchor bounds time in one direction at a time. Proofs " +
|
|
415
|
+
"that come after an anchor in the chain were committed no earlier " +
|
|
416
|
+
"than that block's timestamp, because the block's fingerprint " +
|
|
417
|
+
"could not have been known before the block existed. That lower " +
|
|
418
|
+
"bound additionally assumes the anchored header is a genuine, " +
|
|
419
|
+
"publicly published Ethereum block: this offline audit checks the " +
|
|
420
|
+
"header's structure and hash binding, not proof-of-work, " +
|
|
421
|
+
"consensus, or chain membership, so it cannot confirm the block " +
|
|
422
|
+
"is real. Proofs that come before an anchor existed before the " +
|
|
423
|
+
"commit that consumed the block; reading that as a wall-clock " +
|
|
424
|
+
"ceiling additionally assumes the anchor consumed a recently " +
|
|
425
|
+
"published block. Every such bound in this report states its " +
|
|
426
|
+
"assumption. No individual proof's exact creation time is ever " +
|
|
427
|
+
"stated."
|
|
428
|
+
);
|
|
429
|
+
lines.push("");
|
|
430
|
+
} else {
|
|
431
|
+
lines.push(
|
|
432
|
+
"No Ethereum anchor proofs were observed. After the cutover to Base floors (enclave v10) there " +
|
|
433
|
+
"are none: order after a record is the chain of proof hashes."
|
|
434
|
+
);
|
|
435
|
+
lines.push("");
|
|
436
|
+
}
|
|
437
|
+
if (bf !== undefined) baseFloorSummary(lines, report);
|
|
428
438
|
lines.push(
|
|
429
439
|
...table(
|
|
430
440
|
["Temporal coverage", "Segments"],
|
|
@@ -440,6 +450,50 @@ function executiveSummary(
|
|
|
440
450
|
}
|
|
441
451
|
}
|
|
442
452
|
|
|
453
|
+
/** The executive summary's paragraph on Base floors (enclave v10). Only written when a proof signs one or a floor problem was found. */
|
|
454
|
+
function baseFloorSummary(lines: string[], report: AuditJsonReport): void {
|
|
455
|
+
const bf = report.summary.temporal.baseFloors;
|
|
456
|
+
if (bf === undefined) return;
|
|
457
|
+
if (bf.signed > 0) {
|
|
458
|
+
const rest = bf.signed - bf.headersChecked;
|
|
459
|
+
lines.push(
|
|
460
|
+
`${withCommas(bf.signed)} ${plural(bf.signed, "proof signs", "proofs sign")} a Base block as ` +
|
|
461
|
+
`${plural(bf.signed, "its", "their")} floor (commit.slotFloor, enclave v10). A proof that signs a floor was ` +
|
|
462
|
+
"committed no earlier than that block's time: the block's hash could not exist before the block, and the " +
|
|
463
|
+
"proof signs it. Proofs after it in the chain carry the same bound. A floor is a lower bound only: it " +
|
|
464
|
+
"bounds nothing from above, and it orders no epoch. " +
|
|
465
|
+
`${withCommas(bf.headersChecked)} of ${withCommas(bf.signed)} came with the block's header, checked against ` +
|
|
466
|
+
"the signed hash, number and time" +
|
|
467
|
+
(rest > 0
|
|
468
|
+
? `; for the other ${withCommas(rest)} the time is the one the proof signs, on Base mainnet's schedule for ` +
|
|
469
|
+
"that block, and confirming the block needs a Base lookup. "
|
|
470
|
+
: ". ") +
|
|
471
|
+
"Like an anchored block, a floor additionally assumes the block is a genuine, publicly published Base " +
|
|
472
|
+
"block, which this offline audit cannot confirm." +
|
|
473
|
+
(bf.withheld > 0
|
|
474
|
+
? ` ${withCommas(bf.withheld)} ${plural(bf.withheld, "floor is", "floors are")} not used as a bound; ` +
|
|
475
|
+
"the reasons are in the temporal bounds section."
|
|
476
|
+
: "")
|
|
477
|
+
);
|
|
478
|
+
lines.push("");
|
|
479
|
+
}
|
|
480
|
+
const problems = report.temporal.floorProblems ?? [];
|
|
481
|
+
if (problems.length > 0) {
|
|
482
|
+
lines.push(
|
|
483
|
+
`${withCommas(problems.length)} floor ${plural(problems.length, "problem was", "problems were")} found ` +
|
|
484
|
+
"(exit bit 2). A floor with a problem bounds nothing:"
|
|
485
|
+
);
|
|
486
|
+
lines.push("");
|
|
487
|
+
for (const p of problems.slice(0, MAX_TABLE_ROWS)) {
|
|
488
|
+
lines.push(
|
|
489
|
+
`- ${inlineCode(p.code)}${p.path !== undefined ? ` ${inlineCode(p.path)}` : ""}` +
|
|
490
|
+
`${p.proofHash !== undefined ? `, proof ${inlineCode(p.proofHash)}` : ""}: ${p.message}`
|
|
491
|
+
);
|
|
492
|
+
}
|
|
493
|
+
lines.push("");
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
443
497
|
/** Plain sentences describing one partition's chain state, in the brief's style. */
|
|
444
498
|
function partitionSummarySentences(report: AuditJsonReport, partition: ReportPartition): string[] {
|
|
445
499
|
const out: string[] = [];
|
|
@@ -841,6 +895,22 @@ function temporalDetails(lines: string[], report: AuditJsonReport): void {
|
|
|
841
895
|
}
|
|
842
896
|
lines.push("");
|
|
843
897
|
}
|
|
898
|
+
const floors = report.temporal.signedFloors ?? [];
|
|
899
|
+
if (floors.length > 0) {
|
|
900
|
+
lines.push("Base floors the proofs sign (enclave v10), each a not-before for its proof and never an upper bound:");
|
|
901
|
+
lines.push("");
|
|
902
|
+
for (const f of floors.slice(0, MAX_TABLE_ROWS)) {
|
|
903
|
+
lines.push(
|
|
904
|
+
`- Base block ${withCommas(f.blockNumber)} (${formatTimestamp(f.blockTimestamp)}, hash ${inlineCode(f.blockHash)}), ` +
|
|
905
|
+
`signed by ${inlineCode(f.proofHash)}: ` +
|
|
906
|
+
(f.header === "checked"
|
|
907
|
+
? `header checked (${inlineCode(f.headerPath ?? "")})`
|
|
908
|
+
: "no header in the bundle; confirming the block needs a Base lookup") +
|
|
909
|
+
(f.bound === "not-before" ? "; bounds the proof not before that time." : `; not used as a bound: ${f.withheldReason ?? "withheld"}.`)
|
|
910
|
+
);
|
|
911
|
+
}
|
|
912
|
+
lines.push("");
|
|
913
|
+
}
|
|
844
914
|
if (report.epochRelationships.anchorOrderedPairs.length > 0) {
|
|
845
915
|
lines.push("Anchor-derived epoch ordering (assumption-dependent, covered portions only):");
|
|
846
916
|
lines.push("");
|
|
@@ -859,6 +929,13 @@ function temporalDetails(lines: string[], report: AuditJsonReport): void {
|
|
|
859
929
|
}
|
|
860
930
|
|
|
861
931
|
function boundLine(bound: SegmentBound): string {
|
|
932
|
+
if (bound.source === "signed-floor") {
|
|
933
|
+
return (
|
|
934
|
+
`Committed no earlier than ${formatTimestamp(bound.timestamp)} ` +
|
|
935
|
+
`(Base block ${bound.blockNumber ?? "?"}, the floor signed by ${inlineCode(bound.anchorProofHash)}, ` +
|
|
936
|
+
`evidence: ${bound.evidence}${bound.weaker ? ", weaker" : ""}). ${bound.claim}`
|
|
937
|
+
);
|
|
938
|
+
}
|
|
862
939
|
const direction =
|
|
863
940
|
bound.kind === "not-before"
|
|
864
941
|
? "Committed no earlier than"
|
|
@@ -1005,12 +1082,13 @@ function exportDetail(lines: string[], e: ExportCheck): void {
|
|
|
1005
1082
|
const t = e.times;
|
|
1006
1083
|
lines.push(
|
|
1007
1084
|
t.floor !== null
|
|
1008
|
-
? `- Floor:
|
|
1085
|
+
? `- Floor: ${t.floor.chain === "base" ? "Base" : "Ethereum"} block ${withCommas(t.floor.blockNumber)}, ` +
|
|
1086
|
+
`${t.floor.chain === "base" ? "stamped" : "mined"} at ${formatTimestamp(t.floor.blockTimestamp)}, ` +
|
|
1009
1087
|
`hash ${inlineCode(t.floor.blockHash)}: the proof's signed floor block, its header checked by hash. ` +
|
|
1010
1088
|
"Every file in the tree was recorded after it (the record floor). Committed bytes that carry this position's " +
|
|
1011
1089
|
"commitment were also finished after it (the content floor); an original inside them, and a file recorded as is, " +
|
|
1012
1090
|
"are not dated by it. What the floor covers for each file is stated per run below." +
|
|
1013
|
-
confirmedNote("confirmed.floor", "Ethereum")
|
|
1091
|
+
confirmedNote("confirmed.floor", t.floor.chain === "base" ? "Base" : "Ethereum")
|
|
1014
1092
|
: `- Floor: not established (${why("floor.header")}).`
|
|
1015
1093
|
);
|
|
1016
1094
|
lines.push(
|