proof402-verify 0.1.0 → 0.1.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/README.md CHANGED
@@ -15,7 +15,7 @@ npx proof402-verify 116
15
15
  Proof402 task 116 on Base Sepolia: Captured, as reported by https://proof402.isworking.dev
16
16
  ✓ Task answer signed by key 573c59d6e932d562: secp256k1 valid, ML-DSA-65 valid
17
17
  ✓ Proofs answer signed by key 573c59d6e932d562: secp256k1 valid, ML-DSA-65 valid
18
- ✓ Escrow address matches the one published in the public repo
18
+ ✓ Escrow and verifier match the ones published in the public repo
19
19
  ✓ Settlement token is Circle's testnet USDC
20
20
  ✓ Terms stored on chain match the terms shown
21
21
  ✓ Terms hash recomputed on this machine matches
@@ -30,7 +30,9 @@ Proof402 task 116 on Base Sepolia: Captured, as reported by https://proof402.isw
30
30
 
31
31
  ## What it checks
32
32
 
33
- 1. The escrow address is the one published in the repository's `deployments/basesepolia.json`.
33
+ 1. The escrow and the task's verifier are the ones published in the repository's
34
+ `deployments/basesepolia.json`. The escrow accepts any verifier its buyer names, so a task
35
+ judged by another contract fails here even when everything else matches.
34
36
  2. The escrow settles in Circle's testnet USDC.
35
37
  3. The terms stored on chain equal the terms the API reports.
36
38
  4. `keccak256(abi.encode(policy))`, recomputed locally, equals the stored hash.
@@ -53,7 +55,7 @@ The chain checks are the code behind the site's **Check against the chain** butt
53
55
  ```
54
56
  --api <url> Proof402 API to read the claim from (default https://proof402.isworking.dev)
55
57
  --rpc <url> Base Sepolia JSON-RPC endpoint; repeat for fallbacks (default: public endpoints)
56
- --anchor <url> where the escrow address is published (default: the repo's deployments file)
58
+ --anchor <url> where the escrow and verifier addresses are published (default: the repo's deployments file)
57
59
  --json print one JSON object
58
60
  ```
59
61
 
package/dist/bin.js CHANGED
@@ -73,7 +73,7 @@ var ESCROW_ABI = [
73
73
  }
74
74
  ];
75
75
  var VERIFY_CHECKS = [
76
- { id: "anchor", label: "Escrow address matches the one published in the public repo" },
76
+ { id: "anchor", label: "Escrow and verifier match the ones published in the public repo" },
77
77
  { id: "token", label: "Settlement token is Circle's testnet USDC" },
78
78
  { id: "terms", label: "Terms stored on chain match the terms shown" },
79
79
  { id: "hash", label: "Terms hash recomputed in your browser matches" },
@@ -123,11 +123,12 @@ async function verifyTask(task, attempts, update, opts = {}) {
123
123
  if (!res.ok)
124
124
  return { skip: `The public repo isn't reachable (HTTP ${res.status}).` };
125
125
  const d = await res.json();
126
- if (lc(d.escrow) === lc(escrow))
127
- return `${shortAddr(escrow)}, as in deployments/basesepolia.json`;
126
+ const current = lc(d.escrow) === lc(escrow);
128
127
  const prev = (d.previousEscrows ?? []).find((p) => lc(p.address) === lc(escrow));
129
- must(!!prev, `This page reads ${shortAddr(escrow)}, the repo publishes ${shortAddr(d.escrow ?? "none")}.`);
130
- return `${shortAddr(escrow)}, listed in deployments/basesepolia.json as the escrow before ${shortAddr(d.escrow ?? "")}`;
128
+ must(current || !!prev, `This page reads ${shortAddr(escrow)}, the repo publishes ${shortAddr(d.escrow ?? "none")}.`);
129
+ const verifier = !current && prev?.verifier || d.verifier?.address;
130
+ must(!!verifier && lc(task.verifier) === lc(verifier), `This task is judged by ${shortAddr(task.verifier)}, not Proof402's verifier ${shortAddr(verifier ?? "none")}: its proofs were never checked by Proof402.`);
131
+ return current ? `Escrow ${shortAddr(escrow)} and verifier ${shortAddr(verifier)}, as in deployments/basesepolia.json` : `Escrow ${shortAddr(escrow)}, listed in deployments/basesepolia.json as the escrow before ${shortAddr(d.escrow ?? "")}, and verifier ${shortAddr(verifier)}`;
131
132
  });
132
133
  await run("token", async () => {
133
134
  const token = await client.readContract({ address: escrow, abi: ESCROW_ABI, functionName: "token" });
@@ -341,11 +342,11 @@ check, and its answers' signatures are verified too.
341
342
  Options:
342
343
  --api <url> Proof402 API to read the claim from (default ${DEFAULT_API})
343
344
  --rpc <url> Base Sepolia JSON-RPC endpoint; repeat for fallbacks (default: public endpoints)
344
- --anchor <url> where the escrow address is published (default: the repo's deployments file)
345
+ --anchor <url> where the escrow and verifier addresses are published (default: the repo's deployments file)
345
346
  --json print one JSON object instead of text
346
347
  -h, --help show this help
347
348
  -v, --version show the version`;
348
- var VERSION = "0.1.0";
349
+ var VERSION = "0.1.1";
349
350
  var CHAIN_ID2 = 84532;
350
351
  function parseArgs(argv) {
351
352
  const a = { taskId: NaN, api: DEFAULT_API, rpc: [], json: false };
package/dist/index.js CHANGED
@@ -71,7 +71,7 @@ var ESCROW_ABI = [
71
71
  }
72
72
  ];
73
73
  var VERIFY_CHECKS = [
74
- { id: "anchor", label: "Escrow address matches the one published in the public repo" },
74
+ { id: "anchor", label: "Escrow and verifier match the ones published in the public repo" },
75
75
  { id: "token", label: "Settlement token is Circle's testnet USDC" },
76
76
  { id: "terms", label: "Terms stored on chain match the terms shown" },
77
77
  { id: "hash", label: "Terms hash recomputed in your browser matches" },
@@ -121,11 +121,12 @@ async function verifyTask(task, attempts, update, opts = {}) {
121
121
  if (!res.ok)
122
122
  return { skip: `The public repo isn't reachable (HTTP ${res.status}).` };
123
123
  const d = await res.json();
124
- if (lc(d.escrow) === lc(escrow))
125
- return `${shortAddr(escrow)}, as in deployments/basesepolia.json`;
124
+ const current = lc(d.escrow) === lc(escrow);
126
125
  const prev = (d.previousEscrows ?? []).find((p) => lc(p.address) === lc(escrow));
127
- must(!!prev, `This page reads ${shortAddr(escrow)}, the repo publishes ${shortAddr(d.escrow ?? "none")}.`);
128
- return `${shortAddr(escrow)}, listed in deployments/basesepolia.json as the escrow before ${shortAddr(d.escrow ?? "")}`;
126
+ must(current || !!prev, `This page reads ${shortAddr(escrow)}, the repo publishes ${shortAddr(d.escrow ?? "none")}.`);
127
+ const verifier = !current && prev?.verifier || d.verifier?.address;
128
+ must(!!verifier && lc(task.verifier) === lc(verifier), `This task is judged by ${shortAddr(task.verifier)}, not Proof402's verifier ${shortAddr(verifier ?? "none")}: its proofs were never checked by Proof402.`);
129
+ return current ? `Escrow ${shortAddr(escrow)} and verifier ${shortAddr(verifier)}, as in deployments/basesepolia.json` : `Escrow ${shortAddr(escrow)}, listed in deployments/basesepolia.json as the escrow before ${shortAddr(d.escrow ?? "")}, and verifier ${shortAddr(verifier)}`;
129
130
  });
130
131
  await run("token", async () => {
131
132
  const token = await client.readContract({ address: escrow, abi: ESCROW_ABI, functionName: "token" });
@@ -97,6 +97,8 @@ export interface Health {
97
97
  cursor_block: number;
98
98
  blocks_behind: number;
99
99
  stale: boolean;
100
+ /** This deployment's verifier. The escrow accepts any verifier a buyer names. */
101
+ verifier?: string;
100
102
  verifier_version: string;
101
103
  }
102
104
  export interface Stats {
@@ -7,7 +7,9 @@
7
7
  * from our indexer) with what the chain itself says.
8
8
  *
9
9
  * Checks, in order:
10
- * 1. The escrow address is the one published in the repo's deployments file.
10
+ * 1. The escrow and the task's verifier are the ones published in the repo's
11
+ * deployments file. The escrow accepts any verifier its buyer names, so without
12
+ * this a task judged by a contract that passes everything would pass every check.
11
13
  * 2. Its settlement token is Circle's testnet USDC.
12
14
  * 3. The task's stored terms equal the terms shown.
13
15
  * 4. The terms hash, recomputed here as keccak256(abi.encode(policy)), equals the
@@ -68,7 +70,7 @@ export declare const VERIFY_CHECKS: Pick<Check, "id" | "label">[];
68
70
  export interface VerifyOptions {
69
71
  /** Base Sepolia JSON-RPC endpoints, tried in order (default: two public ones). */
70
72
  rpcUrls?: string[];
71
- /** Where the escrow address is published (default: the repo's deployments file). */
73
+ /** Where the escrow and verifier addresses are published (default: the repo's deployments file). */
72
74
  deploymentsUrl?: string;
73
75
  }
74
76
  /** Runs every check, reporting progress through `update`. Returns the number of RPC calls. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proof402-verify",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Check a Proof402 escrow task against Base Sepolia without trusting Proof402: terms, terms hash, proofs and token transfers, plus the API's secp256k1 and ML-DSA-65 signatures.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",