@secondlayer/cli 20.0.0 → 20.0.1
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/cli.js +18 -91
- package/dist/cli.js.map +3 -3
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -202569,7 +202569,7 @@ var {
|
|
|
202569
202569
|
// package.json
|
|
202570
202570
|
var package_default = {
|
|
202571
202571
|
name: "@secondlayer/cli",
|
|
202572
|
-
version: "20.0.
|
|
202572
|
+
version: "20.0.1",
|
|
202573
202573
|
description: "Run a Stacks index on your own hardware — set it up, restore verified history, and keep it current.",
|
|
202574
202574
|
repository: {
|
|
202575
202575
|
type: "git",
|
|
@@ -202611,8 +202611,8 @@ var package_default = {
|
|
|
202611
202611
|
"@secondlayer/sdk": "^15.0.0",
|
|
202612
202612
|
"@secondlayer/shared": "^12.0.0",
|
|
202613
202613
|
"@secondlayer/stacks": "^6.2.0",
|
|
202614
|
-
"@secondlayer/subgraphs": "^7.0.
|
|
202615
|
-
"@secondlayer/verify": "^0.
|
|
202614
|
+
"@secondlayer/subgraphs": "^7.0.1",
|
|
202615
|
+
"@secondlayer/verify": "^0.5.0",
|
|
202616
202616
|
esbuild: "^0.28.2",
|
|
202617
202617
|
"smol-toml": "^1.9.1",
|
|
202618
202618
|
zod: "^4.3.6"
|
|
@@ -204051,24 +204051,12 @@ init_resolve_auth();
|
|
|
204051
204051
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
204052
204052
|
import {
|
|
204053
204053
|
BlockVerifier,
|
|
204054
|
+
LINKS,
|
|
204054
204055
|
MAINNET_CHECKPOINT,
|
|
204055
204056
|
NodeRpcProofSource,
|
|
204056
204057
|
SecondlayerProofSource,
|
|
204057
|
-
|
|
204058
|
-
unhex
|
|
204058
|
+
describeLinks
|
|
204059
204059
|
} from "@secondlayer/verify";
|
|
204060
|
-
var LINKS = [
|
|
204061
|
-
{ step: "ancestry", label: "ancestry" },
|
|
204062
|
-
{ step: "block", label: "block" },
|
|
204063
|
-
{ step: "bitcoin", label: "bitcoin" },
|
|
204064
|
-
{ step: "burn", label: "burn" },
|
|
204065
|
-
{ step: "signer-set", label: "cycle" },
|
|
204066
|
-
{ step: "signatures", label: "signatures" },
|
|
204067
|
-
{ step: "txs", label: "txs" },
|
|
204068
|
-
{ step: "witness", label: "state root" },
|
|
204069
|
-
{ step: "names", label: "diff" },
|
|
204070
|
-
{ step: "rows", label: "rows" }
|
|
204071
|
-
];
|
|
204072
204060
|
var LABEL_WIDTH = Math.max(...LINKS.map((l) => l.label.length));
|
|
204073
204061
|
var n = (v) => v.toLocaleString("en-US");
|
|
204074
204062
|
function parseBlockRef(raw) {
|
|
@@ -204122,81 +204110,20 @@ function prepareSource(src) {
|
|
|
204122
204110
|
};
|
|
204123
204111
|
return out;
|
|
204124
204112
|
}
|
|
204125
|
-
function linkDetail(step, r, cp) {
|
|
204126
|
-
switch (step) {
|
|
204127
|
-
case "ancestry": {
|
|
204128
|
-
const a = r.ancestry;
|
|
204129
|
-
if (!a)
|
|
204130
|
-
return "";
|
|
204131
|
-
const checkpoint = parseNakamotoHeader(unhex(cp.stacks.header));
|
|
204132
|
-
const start = a.fromHeight === Number(checkpoint.chainLength) ? `the checkpoint ${n(a.fromHeight)}` : `block ${n(a.fromHeight)}`;
|
|
204133
|
-
return a.via === "marf" ? `${n(r.height ?? 0)} proven in the state of ${start} (one MARF proof)` : `${n(r.height ?? 0)} reached from ${start} by parent links`;
|
|
204134
|
-
}
|
|
204135
|
-
case "block":
|
|
204136
|
-
return `${n(r.height ?? 0)} ${r.blockId}`;
|
|
204137
|
-
case "bitcoin":
|
|
204138
|
-
return `headers ${n(cp.bitcoin.height)}..${n(r.burnHeight ?? 0)}, proof-of-work and retargets checked`;
|
|
204139
|
-
case "burn":
|
|
204140
|
-
return `height ${n(r.burnHeight ?? 0)} ${r.bitcoinBlockHash}`;
|
|
204141
|
-
case "signer-set":
|
|
204142
|
-
return r.cycle === cp.stacks.cycle ? `${r.cycle}, the checkpoint's own signer set` : `${r.cycle}, signer set proven forward from checkpoint cycle ${cp.stacks.cycle}`;
|
|
204143
|
-
case "signatures":
|
|
204144
|
-
return `${n(r.signerWeight ?? 0n)} / ${n(r.totalWeight ?? 0n)} weight signed, threshold ${n(r.threshold ?? 0n)}`;
|
|
204145
|
-
case "txs":
|
|
204146
|
-
return `${n(r.transactions?.length ?? 0)} transactions match the tx merkle root`;
|
|
204147
|
-
case "witness":
|
|
204148
|
-
return `${r.stateRoot} matches the witness`;
|
|
204149
|
-
case "names": {
|
|
204150
|
-
const d = r.diff;
|
|
204151
|
-
if (!d)
|
|
204152
|
-
return "";
|
|
204153
|
-
const named = d.writes.filter((w) => w.named).length;
|
|
204154
|
-
const written = named ? `${d.writes.length} written (${named} named, ${d.writes.length - named} unnamed)` : `${d.writes.length} written (unnamed)`;
|
|
204155
|
-
return `${written}, ${d.carried.length} carried, ${d.internal.length} internal`;
|
|
204156
|
-
}
|
|
204157
|
-
case "rows":
|
|
204158
|
-
return `${n(r.rowsChecked ?? 0)} vm_events rows match the diff`;
|
|
204159
|
-
}
|
|
204160
|
-
}
|
|
204161
|
-
function notNeeded(step, r) {
|
|
204162
|
-
if (!r.ancestry)
|
|
204163
|
-
return false;
|
|
204164
|
-
if (step === "bitcoin" || step === "burn")
|
|
204165
|
-
return r.burnHeight === undefined;
|
|
204166
|
-
return step === "signer-set" || step === "signatures";
|
|
204167
|
-
}
|
|
204168
204113
|
function report(r, cp, rows) {
|
|
204169
|
-
const
|
|
204170
|
-
|
|
204171
|
-
|
|
204172
|
-
|
|
204173
|
-
|
|
204174
|
-
if (
|
|
204175
|
-
|
|
204176
|
-
if (failure)
|
|
204177
|
-
writeData(`${red("✗")} ${label} ${failure.message}`);
|
|
204178
|
-
else if (link.step === "rows" && !rows)
|
|
204179
|
-
writeData(dim(`· ${label} not checked (pass --rows)`));
|
|
204180
|
-
else if (i > broken)
|
|
204181
|
-
writeData(dim(`· ${label} not checked: an earlier link is broken`));
|
|
204182
|
-
else if (notNeeded(link.step, r))
|
|
204183
|
-
writeData(dim(`· ${label} not needed: the block is hash-chained to the checkpoint`));
|
|
204184
|
-
else if (link.step === "rows" && r.rowsChecked === undefined)
|
|
204185
|
-
writeData(dim(`· ${label} not checked: the source serves no indexed rows`));
|
|
204186
|
-
else if (link.step === "txs" && r.transactions === undefined)
|
|
204187
|
-
writeData(dim(`· ${label} not checked: no transaction bytes (epoch 2.x, or the source served the header only)`));
|
|
204114
|
+
const { lines, verdict } = describeLinks(r, cp, { rows });
|
|
204115
|
+
for (const line of lines) {
|
|
204116
|
+
const label = line.label.padEnd(LABEL_WIDTH);
|
|
204117
|
+
if (line.status === "failed")
|
|
204118
|
+
writeData(`${red("✗")} ${label} ${line.detail}`);
|
|
204119
|
+
else if (line.status === "skipped")
|
|
204120
|
+
writeData(dim(`· ${label} ${line.detail}`));
|
|
204188
204121
|
else
|
|
204189
|
-
writeData(`${green("✓")} ${label} ${
|
|
204122
|
+
writeData(`${green("✓")} ${label} ${line.detail}`);
|
|
204190
204123
|
}
|
|
204191
204124
|
for (const line of r.notes)
|
|
204192
204125
|
note(` note: ${line}`);
|
|
204193
|
-
|
|
204194
|
-
const from = n(parseNakamotoHeader(unhex(cp.stacks.header)).chainLength);
|
|
204195
|
-
writeData(green(`✓ Block ${n(r.height ?? 0)} is proven. Trusted: only the checkpoint (Stacks ${from}, Bitcoin ${n(cp.bitcoin.height)}).`));
|
|
204196
|
-
return;
|
|
204197
|
-
}
|
|
204198
|
-
const label = LINKS[broken]?.label ?? first.step;
|
|
204199
|
-
writeData(red(first.code === "unavailable" ? `✗ Could not check the ${label} link: the source could not serve it.` : `✗ Not proven: the ${label} link is broken.`));
|
|
204126
|
+
writeData(verdict.ok ? green(`✓ ${verdict.text}`) : red(`✗ ${verdict.text}`));
|
|
204200
204127
|
}
|
|
204201
204128
|
function verificationJson(r) {
|
|
204202
204129
|
const { transactions, ...rest } = r;
|
|
@@ -204280,8 +204207,8 @@ import {
|
|
|
204280
204207
|
} from "@secondlayer/subgraphs/verify";
|
|
204281
204208
|
import {
|
|
204282
204209
|
MAINNET_CHECKPOINT as MAINNET_CHECKPOINT2,
|
|
204283
|
-
parseNakamotoHeader
|
|
204284
|
-
unhex
|
|
204210
|
+
parseNakamotoHeader,
|
|
204211
|
+
unhex
|
|
204285
204212
|
} from "@secondlayer/verify";
|
|
204286
204213
|
var LINKS2 = [
|
|
204287
204214
|
{ step: "pin", label: "pin" },
|
|
@@ -204369,7 +204296,7 @@ function report2(r, from, to) {
|
|
|
204369
204296
|
return VERIFY_EXIT.UNANCHORED;
|
|
204370
204297
|
}
|
|
204371
204298
|
const cp = MAINNET_CHECKPOINT2;
|
|
204372
|
-
const stacks = n2(Number(
|
|
204299
|
+
const stacks = n2(Number(parseNakamotoHeader(unhex(cp.stacks.header)).chainLength));
|
|
204373
204300
|
writeData(green(`✓ ${r.name} ${n2(from)}..${n2(to)} recomputed from proven inputs. Trusted: only the checkpoint (Stacks ${stacks}, Bitcoin ${n2(cp.bitcoin.height)}).`));
|
|
204374
204301
|
writeData(dim(` unproven, so not compared: ${[...r.unproven, "rows compare declared columns and _block_height only"].join("; ")}`));
|
|
204375
204302
|
return VERIFY_EXIT.CLEAN;
|
|
@@ -209466,5 +209393,5 @@ registerCreditsCommand(program);
|
|
|
209466
209393
|
registerArchiveCommand(program);
|
|
209467
209394
|
program.parse();
|
|
209468
209395
|
|
|
209469
|
-
//# debugId=
|
|
209396
|
+
//# debugId=255DFF8A4862FC7D64756E2164756E21
|
|
209470
209397
|
//# sourceMappingURL=cli.js.map
|