@secondlayer/cli 19.2.1 → 19.2.2

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 CHANGED
@@ -99,7 +99,7 @@ No account. Writes `.env.local`, restores history, prints the Stacks observer st
99
99
  | `secondlayer bootstrap --against <manifest> [--from-block <n>] [--to-block <n>] [--verify all\|blocks] [--public-key <pem>] [-y] [--json]` | Restore chain history from a verified archive into an empty database. A run that died mid-way resumes per dataset on re-run. After the load, digests for blocks, transactions, and events are checked over the restored range (`--verify blocks` skips the child datasets and the minutes they cost). Partition fetches retry three times with backoff on resets, timeouts, 429 (honoring `Retry-After`) and 5xx; a link that stays down exits `1` with a re-run hint, and the re-run resumes. Exit `0` restored, `1` diverged or interrupted, `2` refused |
100
100
  | `secondlayer observer [--mode indexer\|signer-shared] [--endpoint host:port] [--network …]` | Print the `[[events_observer]]` stanza. Signer-shared skips retries; a missed block stays a gap until `repair` |
101
101
  | `secondlayer verify [all\|raw\|decode:<name>\|subgraph:<name>] --against <manifest> [--quick\|--deep\|--anchor]` | Compare local data to a signed archive. Default target `raw`. Exit `0` clean, `1` diverged, `2` unanchored |
102
- | `secondlayer verify block <height\|index_block_hash> [--node <url>] [--checkpoint <file>] [--rows] [--json]` | Prove one Stacks block from the checkpoint built into this release: Bitcoin headers, burn block, signer set, signatures, state root, state diff, and with `--rows` the indexed rows. Nothing else is trusted; proofs come from the API, or a node with `--node`. Exit `0` proven, `1` a link is broken, `2` could not check |
102
+ | `secondlayer verify block <height\|index_block_hash> [--node <url>] [--checkpoint <file>] [--rows] [--json]` | Prove one Stacks block from the checkpoint built into this release: Bitcoin headers, burn block, signer set, signatures, state root, state diff, and with `--rows` the indexed rows. Blocks below the checkpoint are tied to it by hash (parent links or one MARF proof) instead of signatures. Nothing else is trusted; proofs come from the API, or a node with `--node`. Exit `0` proven, `1` a link is broken, `2` could not check |
103
103
  | `secondlayer repair --against <archive> [--apply] [-y]` | Plan (default) or apply an archive repair. A fixed block is rewritten with its transactions and events from the archive; when the reference has no child partition for a height, the block is rewritten alone, the height is named with a `bootstrap --from-block H --to-block H` remedy, and the exit is `1`. Partition fetches retry like `bootstrap`; a link that stays down exits `1` with a re-run hint, and heights already repaired are kept |
104
104
 
105
105
  Bootstrap and repair against the official hosted archive (`archive.secondlayer.tools`)
package/dist/cli.js CHANGED
@@ -29440,7 +29440,7 @@ var init_git_status = () => {};
29440
29440
 
29441
29441
  // ../../node_modules/typescript/lib/typescript.js
29442
29442
  var require_typescript = __commonJS(function(exports, module) {
29443
- var __dirname = "/Users/ryan/projects/secondlayer/.claude/worktrees/agent-adcb760acc54b4c28/node_modules/typescript/lib", __filename = "/Users/ryan/projects/secondlayer/.claude/worktrees/agent-adcb760acc54b4c28/node_modules/typescript/lib/typescript.js";
29443
+ var __dirname = "/Users/ryan/projects/secondlayer/.claude/worktrees/agent-a6ba56a9f98cf6ff7/node_modules/typescript/lib", __filename = "/Users/ryan/projects/secondlayer/.claude/worktrees/agent-a6ba56a9f98cf6ff7/node_modules/typescript/lib/typescript.js";
29444
29444
  /*! *****************************************************************************
29445
29445
  Copyright (c) Microsoft Corporation. All rights reserved.
29446
29446
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
@@ -202526,7 +202526,7 @@ var {
202526
202526
  // package.json
202527
202527
  var package_default = {
202528
202528
  name: "@secondlayer/cli",
202529
- version: "19.2.1",
202529
+ version: "19.2.2",
202530
202530
  description: "Run a Stacks index on your own hardware — set it up, restore verified history, and keep it current.",
202531
202531
  repository: {
202532
202532
  type: "git",
@@ -202569,7 +202569,7 @@ var package_default = {
202569
202569
  "@secondlayer/shared": "^11.20.0",
202570
202570
  "@secondlayer/stacks": "^6.1.1",
202571
202571
  "@secondlayer/subgraphs": "^6.3.6",
202572
- "@secondlayer/verify": "^0.1.0",
202572
+ "@secondlayer/verify": "^0.2.0",
202573
202573
  esbuild: "^0.28.2",
202574
202574
  "smol-toml": "^1.8.0",
202575
202575
  zod: "^4.3.6"
@@ -204015,6 +204015,7 @@ import {
204015
204015
  unhex
204016
204016
  } from "@secondlayer/verify";
204017
204017
  var LINKS = [
204018
+ { step: "ancestry", label: "ancestry" },
204018
204019
  { step: "block", label: "block" },
204019
204020
  { step: "bitcoin", label: "bitcoin" },
204020
204021
  { step: "burn", label: "burn" },
@@ -204065,7 +204066,9 @@ function prepareSource(src) {
204065
204066
  return src.getBitcoinHeaders(from, count);
204066
204067
  }
204067
204068
  };
204068
- const { getStateWrites, getVmEvents } = src;
204069
+ const { getEpoch2Header, getStateWrites, getVmEvents } = src;
204070
+ if (getEpoch2Header)
204071
+ out.getEpoch2Header = (id) => getEpoch2Header.call(src, id);
204069
204072
  if (getStateWrites)
204070
204073
  out.getStateWrites = (height) => getStateWrites.call(src, height);
204071
204074
  if (getVmEvents)
@@ -204077,6 +204080,14 @@ function prepareSource(src) {
204077
204080
  }
204078
204081
  function linkDetail(step, r, cp, rows) {
204079
204082
  switch (step) {
204083
+ case "ancestry": {
204084
+ const a = r.ancestry;
204085
+ if (!a)
204086
+ return "";
204087
+ const checkpoint = parseNakamotoHeader(unhex(cp.stacks.header));
204088
+ const start = a.fromHeight === Number(checkpoint.chainLength) ? `the checkpoint ${n(a.fromHeight)}` : `block ${n(a.fromHeight)}`;
204089
+ 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`;
204090
+ }
204080
204091
  case "block":
204081
204092
  return `${n(r.height ?? 0)} ${r.blockId}`;
204082
204093
  case "bitcoin":
@@ -204101,18 +204112,29 @@ function linkDetail(step, r, cp, rows) {
204101
204112
  return `${n(r.rowsChecked ?? 0)} vm_events rows match the diff`;
204102
204113
  }
204103
204114
  }
204115
+ function notNeeded(step, r) {
204116
+ if (!r.ancestry)
204117
+ return false;
204118
+ if (step === "bitcoin" || step === "burn")
204119
+ return r.burnHeight === undefined;
204120
+ return step === "signer-set" || step === "signatures";
204121
+ }
204104
204122
  function report(r, cp, rows) {
204105
204123
  const first = r.failures[0];
204106
204124
  const broken = first ? LINKS.findIndex((l) => l.step === first.step) : LINKS.length;
204107
204125
  for (const [i, link] of LINKS.entries()) {
204108
204126
  const label = link.label.padEnd(LABEL_WIDTH);
204109
204127
  const failure = r.failures.find((f) => f.step === link.step);
204128
+ if (link.step === "ancestry" && !failure && !r.ancestry)
204129
+ continue;
204110
204130
  if (failure)
204111
204131
  writeData(`${red("✗")} ${label} ${failure.message}`);
204112
204132
  else if (link.step === "rows" && !rows)
204113
204133
  writeData(dim(`· ${label} not checked (pass --rows)`));
204114
204134
  else if (i > broken)
204115
204135
  writeData(dim(`· ${label} not checked: an earlier link is broken`));
204136
+ else if (notNeeded(link.step, r))
204137
+ writeData(dim(`· ${label} not needed: the block is hash-chained to the checkpoint`));
204116
204138
  else if (link.step === "rows" && r.rowsChecked === undefined)
204117
204139
  writeData(dim(`· ${label} not checked: the source serves no indexed rows`));
204118
204140
  else
@@ -204161,6 +204183,8 @@ async function runVerifyBlock(ref, opts, deps = {}) {
204161
204183
  function attachVerifyBlockCommand(verify) {
204162
204184
  return verify.command("block").description("Prove one Stacks block from the checkpoint built into this release, trusting nothing else").argument("<ref>", "block height or index block hash").option("--node <url>", "read blocks and MARF proofs from this Stacks node RPC instead of the API").option("--checkpoint <file>", "trust this checkpoint JSON instead of the one built into this release").option("--rows", "also prove the indexer's rows for the block (state_writes, vm_events) against its state diff").addHelpText("after", `
204163
204185
  What is proven, link by link:
204186
+ ancestry below the checkpoint only: the block's id, from the checkpoint by
204187
+ parent links or one MARF proof (signer links are then not needed)
204164
204188
  bitcoin headers from the checkpoint to the block's burn block: proof-of-work and retargets
204165
204189
  burn the block's consensus hash commits to that Bitcoin block
204166
204190
  cycle the reward cycle's signer set, proven forward from the checkpoint's set
@@ -209505,5 +209529,5 @@ registerCreditsCommand(program);
209505
209529
  registerArchiveCommand(program);
209506
209530
  program.parse();
209507
209531
 
209508
- //# debugId=063D7FC6388E8ABC64756E2164756E21
209532
+ //# debugId=92924A7AE61FB1AF64756E2164756E21
209509
209533
  //# sourceMappingURL=cli.js.map