@probecli/cli 0.5.0 → 0.6.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 CHANGED
@@ -34,8 +34,11 @@ Anyone can check a published result without trusting the website:
34
34
  ```shell
35
35
  probe hooks # hooks with a published check
36
36
  probe verify hook 0x0af57f62982d03066ef917acad87f771c06528ec # signature, signer, and signer approved on-chain
37
+ probe verify hook 0x0af57f62982d03066ef917acad87f771c06528ec --rerun --rpc <archive-rpc> # also rerun the checks at that block
37
38
  ```
38
39
 
40
+ The public RPC keeps recent state only, so `--rerun` on an older check needs an archive RPC.
41
+
39
42
  ## Run a job
40
43
 
41
44
  ```shell
package/dist/probe.mjs CHANGED
@@ -2019,10 +2019,20 @@ async function verifyHookCheck(c2, approvedOnChain) {
2019
2019
  }
2020
2020
  return findings;
2021
2021
  }
2022
+ function compareRerun(published, rerun) {
2023
+ const mine = new Map(rerun.checks.map((c2) => [c2.id, c2.status]));
2024
+ const theirs = new Map(published.checks.map((c2) => [c2.id, c2.status]));
2025
+ const diffs = [.../* @__PURE__ */ new Set([...theirs.keys(), ...mine.keys()])].filter((id) => theirs.get(id) !== mine.get(id)).map((id) => `${id}: published ${theirs.get(id) ?? "missing"}, rerun ${mine.get(id) ?? "missing"}`);
2026
+ return {
2027
+ ok: diffs.length === 0,
2028
+ title: "Rerunning the checks at the same block gives the same results",
2029
+ detail: diffs.length ? diffs.join("; ") : `${rerun.checks.length} of ${published.checks.length} checks match at block ${published.block}`
2030
+ };
2031
+ }
2022
2032
 
2023
2033
  // src/cli/verify.ts
2024
2034
  var SITE2 = process.env.PROBE_SITE_URL ?? "https://probecli.com";
2025
- var USAGE = "Usage: probe verify job <job> | probe verify hook <address> [--json]";
2035
+ var USAGE = "Usage: probe verify job <job> | probe verify hook <address> [--rerun] [--rpc <url>] [--json]";
2026
2036
  function printFindings(findings) {
2027
2037
  console.log("");
2028
2038
  for (const f of findings) {
@@ -2047,7 +2057,7 @@ async function verifyJob(slug, json) {
2047
2057
  printFindings(findings);
2048
2058
  console.log(dim(" The scope and rules you work under cannot have changed since the job was funded."));
2049
2059
  }
2050
- async function verifyHook(address, json, rpc) {
2060
+ async function verifyHook(address, json, rpc, rerun) {
2051
2061
  if (!isAddress3(address)) fail(USAGE);
2052
2062
  const hook = getAddress4(address);
2053
2063
  const published = await api(`/hooks/${hook}`).catch(
@@ -2059,6 +2069,19 @@ async function verifyHook(address, json, rpc) {
2059
2069
  const client = publicClient(rpc, report.chainId);
2060
2070
  const approved = (signer) => client.readContract({ address: contract, abi: probeJobsAbi, functionName: "approvedVerifier", args: [signer] });
2061
2071
  const findings = json ? await verifyHookCheck(published, approved) : await task("Checking the signature and the signer", () => verifyHookCheck(published, approved), () => "done");
2072
+ if (rerun) {
2073
+ const at = Number(report.block).toLocaleString("en-US");
2074
+ const run2 = () => checkHook(client, hook, { chainId: report.chainId, block: BigInt(report.block) }).catch((e) => e);
2075
+ const mine = json ? await run2() : await task(`Rerunning the checks at block ${at}`, run2, (r) => r instanceof Error ? "could not run" : `${r.checks.length} checks`);
2076
+ if (mine instanceof Error) {
2077
+ const pruned = /historical state|missing trie node|state.*not available|header not found/i.test(mine.message);
2078
+ findings.push({
2079
+ ok: false,
2080
+ title: "Rerunning the checks at the same block gives the same results",
2081
+ detail: pruned ? `${rpc} no longer has the state for block ${at}. Rerun against an archive RPC: --rpc <url>` : `the rerun failed: ${mine.message.split("\n")[0]}`
2082
+ });
2083
+ } else findings.push(compareRerun(report, mine));
2084
+ }
2062
2085
  if (json) {
2063
2086
  printJson({ hook, block: report.block, chainId: report.chainId, signer: published.signer, findings });
2064
2087
  if (findings.some((f) => !f.ok)) process.exitCode = 1;
@@ -2066,19 +2089,19 @@ async function verifyHook(address, json, rpc) {
2066
2089
  }
2067
2090
  console.log(`${dim(" hook")} ${hook} ${dim(`at block ${Number(report.block).toLocaleString("en-US")}, ${report.summary.passed} of ${report.summary.total} checks passed`)}`);
2068
2091
  printFindings(findings);
2069
- console.log(dim(` Rerun the checks yourself: probe check ${hook} --block ${report.block}`));
2092
+ if (!rerun) console.log(dim(` Rerun the checks too: probe verify hook ${hook} --rerun`));
2070
2093
  console.log(dim(` ${SITE2}/hooks/${hook}`));
2071
2094
  }
2072
2095
  async function verify(args) {
2073
2096
  const { values, positionals } = parseArgs2({
2074
2097
  args,
2075
2098
  allowPositionals: true,
2076
- options: { json: { type: "boolean", default: false }, rpc: { type: "string" } }
2099
+ options: { json: { type: "boolean", default: false }, rpc: { type: "string" }, rerun: { type: "boolean", default: false } }
2077
2100
  });
2078
2101
  const [kind, target] = positionals;
2079
2102
  if (!kind || !target) fail(USAGE);
2080
2103
  if (kind === "job") return verifyJob(target, values.json);
2081
- if (kind === "hook") return verifyHook(target, values.json, values.rpc ?? process.env.PROBE_RPC_URL ?? DEFAULT_RPC);
2104
+ if (kind === "hook") return verifyHook(target, values.json, values.rpc ?? process.env.PROBE_RPC_URL ?? DEFAULT_RPC, values.rerun);
2082
2105
  fail(USAGE);
2083
2106
  }
2084
2107
  async function hooks(args) {
@@ -2096,7 +2119,7 @@ async function hooks(args) {
2096
2119
  }
2097
2120
 
2098
2121
  // src/cli/version.ts
2099
- var VERSION = true ? "0.5.0" : JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8")).version;
2122
+ var VERSION = true ? "0.6.0" : JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8")).version;
2100
2123
 
2101
2124
  // src/cli/main.ts
2102
2125
  var HELP = `${bold("probe")}: test Uniswap v4 hooks, get paid for verified work.
@@ -2132,6 +2155,8 @@ Verify
2132
2155
  probe verify job <job> Recompute a job's spec hash and compare it with the chain
2133
2156
  probe verify hook <address> Check a published hook check's signature and that its signer
2134
2157
  is an approved verifier on ProbeJobs
2158
+ --rerun Also rerun the checks at the same block and compare
2159
+ --rpc <url> Chain RPC for the rerun and the approval lookup
2135
2160
 
2136
2161
  Sponsor
2137
2162
  probe sponsor keygen Create your report-decryption key pair
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@probecli/cli",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "license": "MIT",
5
5
  "description": "probe: run reproducible tests for Uniswap v4 hooks, get paid for verified work, and check any deployed hook.",
6
6
  "keywords": [