payments: the public reader of a receipt now exits 2 and says PARTIAL when it did not verify the notarization (no --verify-proof, the reference verifier answering PARTIAL or PENDING, a chain that does not answer), as POST /v1/payments/verify answers; the receiptFile of /v1/payments/receipt carries the policy and the inputs it needs; new probe proba-verifica-chitanta.mjs (14 rows, no chain); README rule names as the module returns them

This commit is contained in:
Aere Network committed 2026-10-27 14:47:58 +02:00
1 parent fcece14a12
commit 687e5e54a4
5 files changed
+167 -21

No files matched your search

+14 -3
View File
@@ -27,16 +27,27 @@ node proba-risc.mjs # 23 rows, no chain: the verdicts unde
node proba-risc.mjs --control-negativ # 10 plantings on copies of risc.mjs and chitanta.mjs; each forged fixture must then be accepted
AERE_TESTNET_KEY_FILE=<key> AERE_ETHERS_DIR=<dir with node_modules/ethers> node proba-plata-28001.mjs # the flow on testnet 28001
node verifica-chitanta.mjs dovezi/chitanta-28001-<date>.json --rpc https://testnet-rpc.aere.network --verify-proof <verify-proof.mjs>
node proba-verifica-chitanta.mjs # 14 rows, no chain: the public reader against a local RPC stub and a stub of the reference
# verifier, each exit code and verdict word as POST /v1/payments/verify gives them
```
Measured on 2026-10-02 on testnet 28001 (9/9): a person's payment of 0.4 tAERE at a declared 0.5 USD/tAERE = 0.20 USD allowed, paid
by a plain transfer the payer signed, its receipt issued, notarized by the payee and read back with finality PASSED under a
post-quantum certified anchor; a payment of 1.50 USD refused above the per-payment limit with no transaction sent; the fourth payment
in the window refused above the count; the receipt forged (amount changed) INVALID; a looser policy shown under the receipt's policy
hash INVALID. The public reader (`verifica-chitanta.mjs`) needs only Node.js: the chain is read by plain JSON-RPC.
hash INVALID. The public reader (`verifica-chitanta.mjs`) needs only Node.js: the chain is read by plain JSON-RPC. Its file is the
receipt with the policy and the inputs the issuer judged (the `receiptFile` of the Payments API's receipt route), and its verdicts are
those of POST /v1/payments/verify: exit 0 `VALID` only when the transaction is compared on chain and the reference verifier finds the
notarization under a post-quantum certified anchor (finality `PASSED`), 1 `INVALID` with the reasons, 2 `PARTIAL` when something was
not measured (no `--rpc`, no chain answer, an RPC of another chain, no `--verify-proof`, the policy or the inputs missing, finality
`PENDING` or `UNMEASURED`). Corrected 2026-10-27: until this date it wrote `VALID` and exited 0 without `--verify-proof` and while
the notarization was pending, and it called a file without the policy and the inputs `INVALID`.
Every refusal names its rule: `rules` on a risk verdict (form, asset, counterparty, rate, limit, window; outside the hashed body, so
the hash of a verdict already issued is unchanged), `reguli` on a receipt verdict (binding, amount, policy, risk, chain). The rate is a
Every refusal names its rule, in the module's working language: `rules` on a risk verdict (`forma`, `activ`, `contrapartida`,
`curs`, `limita`, `fereastra`, that is form, asset, counterparty, rate, limit and window; outside the hashed body, so the hash of a
verdict already issued is unchanged), `reguli` on a receipt verdict (`legatura`, `suma`, `politica`, `risc`, `lant`, that is binding,
amount, policy, risk and chain). The Payments API of Aere Cloud returns the risk rules under their English names since 2026-10-27,
translated at its boundary. (Corrected 2026-10-27: this paragraph gave the English names as the ones the module returns.) The rate is a
decimal string (a JSON number is refused, not rounded), and a history entry the engine cannot count is refused, not left out of the
window. The conformance suite (`conformance/`) holds a vector for each of these rules and runs any implementation against them.
+102
View File
@@ -0,0 +1,102 @@
#!/usr/bin/env node
// proba-verifica-chitanta.mjs (2026-10-27): the public reader of a payment receipt (verifica-chitanta.mjs) run as a stranger runs it,
// with no chain and no network: a local JSON-RPC stub (127.0.0.1, one route per behaviour) and a stub of the AIP-23 reference verifier
// that answers the shape of verify-proof.mjs (verdict VALID / PARTIAL / INVALID, the finality level PASSED / PENDING / UNMEASURED /
// FAILED). Every row asks for the exit code AND the verdict word of the last line, and the verdicts are those of POST /v1/payments/verify
// (cloud-gateway/plati-api.mjs): VALID only with the notarization's finality PASSED and the transaction compared on chain, PARTIAL when
// something was not measured, INVALID with a reason. Until 2026-10-27 the reader wrote VALID and exited 0 without --verify-proof, without
// --rpc, and when the reference verifier answered PARTIAL / PENDING; it called a file without policy and inputs INVALID; it called an
// unknown transaction UNMEASURED where the route says INVALID; and it compared the transaction on an RPC of another chain. The rows
// marked (NEW) are red on that form: AERE_VERIFICA_CHITANTA_CLI=<a copy of the old reader beside its modules> runs the probe on it.
// node proba-verifica-chitanta.mjs -> 0 every row as named, 1 otherwise
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import http from 'node:http';
import { spawn } from 'node:child_process';
import { fileURLToPath, pathToFileURL } from 'node:url';
const AICI = path.dirname(fileURLToPath(import.meta.url));
const CLI = process.env.AERE_VERIFICA_CHITANTA_CLI ? path.resolve(process.env.AERE_VERIFICA_CHITANTA_CLI) : path.join(AICI, 'verifica-chitanta.mjs');
const R = await import(pathToFileURL(path.join(AICI, 'risc.mjs')).href), C = await import(pathToFileURL(path.join(AICI, 'chitanta.mjs')).href);
const POLITICA = { v: 1, kind: 'aere-payment-risk-policy', id: 'lab-cli-2026-10-27', currency: 'USD', perPaymentMaxUsd: '1.00', window: { seconds: 86400, maxUsd: '2.50', maxCount: 3 },
allowedAssets: [{ chainId: 28001, asset: 'native', decimals: 18 }], refusedCounterparties: [{ address: '0x70099E62735500AA2F85B60C518551a57B202d54', reason: 'a contract with no path to withdraw what is sent to it (AereNotary on 28001)', source: 'contracts/deployments/notary-28001.json' }] };
const PAYER = '0x' + 'aa'.repeat(20), PAYEE = '0x' + 'bb'.repeat(20), RATE = { usdPerUnit: '0.5', source: 'declared for the laboratory', at: '2026-10-27T08:00:00.000Z' };
const INPUTS = { chainId: 28001, payer: PAYER, payee: PAYEE, asset: 'native', amount: '400000000000000000', rate: RATE, identity: null, history: [], now: 1793000000 };
const TX = '0x' + '11'.repeat(32), BLOC = '0x' + '22'.repeat(32);
const v = R.judeca(POLITICA, INPUTS);
const { instruction, envelope } = C.construiesteChitanta({ chainId: 28001, txHash: TX, blockHash: BLOC, payer: PAYER, payee: PAYEE, asset: 'native', decimals: 18, amount: INPUTS.amount, rate: RATE, verdict: v, policyId: POLITICA.id, createdAt: '2026-10-27T08:00:01.000Z' });
const plic = { ...envelope, notarization: { chainId: 28001, notary: '0x70099E62735500AA2F85B60C518551a57B202d54', firstSeen: 1793000100, txHash: '0x' + '33'.repeat(32), block: 7 } };
const D = fs.mkdtempSync(path.join(os.tmpdir(), 'aere-cititor-chitanta-'));
const scrie = (nume, o) => { const f = path.join(D, nume); fs.writeFileSync(f, JSON.stringify(o)); return f; };
const FISIER = scrie('chitanta.json', { instruction, envelope: plic, policy: POLITICA, inputs: INPUTS });
const FARA_POLITICA = scrie('chitanta-api.json', { instruction, envelope: plic }); // the shape of `receipt` in the route's answer
const fals = JSON.parse(JSON.stringify({ instruction, envelope: plic, policy: POLITICA, inputs: INPUTS })); fals.instruction.amount = '500000000000000000';
const FALS = scrie('chitanta-falsa.json', fals);
// the reference verifier, stubbed: the state comes from the environment the reader inherits
const VP = path.join(D, 'verify-proof-stub.mjs');
fs.writeFileSync(VP, "const s = process.env.AERE_STUB_FIN || 'PASSED';\n"
+ "if (s === 'NOJSON') { console.log('not json'); process.exit(2); }\n"
+ "const other = process.env.AERE_STUB_ALT || null;\n"
+ "const levels = [{ level: 'integrity', state: 'PASSED', detail: 'stub' }, { level: 'finality', state: s, detail: 'stub ' + s }];\n"
+ "if (other) levels.push({ level: 'witness', state: other, detail: 'stub' });\n"
+ "const failed = levels.some((l) => l.state === 'FAILED'), unm = levels.some((l) => l.state === 'UNMEASURED' || l.state === 'PENDING');\n"
+ "console.log(JSON.stringify({ verdict: failed ? 'INVALID' : unm ? 'PARTIAL' : 'VALID', levels }));\n"
+ "process.exitCode = failed ? 1 : unm ? 2 : 0;\n");
// the chain, stubbed: /bun answers this payment, /necunoscut does not know it, /alt-lant is another chain, /mut answers 500
const txBun = { hash: TX, from: PAYER, to: PAYEE, value: '0x58d15e176280000', blockHash: BLOC }, rcBun = { status: '0x1', blockHash: BLOC };
const srv = http.createServer((q, s) => {
let b = ''; q.on('data', (d) => { b += d; }); q.on('end', () => {
const mod = q.url.replace(/^\//, ''); let j = {}; try { j = JSON.parse(b); } catch { /* malformed */ }
if (mod === 'mut') { s.writeHead(500); s.end('down'); return; }
const rez = j.method === 'eth_chainId' ? (mod === 'alt-lant' ? '0xaf0' : '0x6d61')
: j.method === 'eth_getTransactionByHash' ? (mod === 'necunoscut' ? null : txBun)
: j.method === 'eth_getTransactionReceipt' ? (mod === 'necunoscut' ? null : rcBun) : null;
s.writeHead(200, { 'content-type': 'application/json' }); s.end(JSON.stringify({ jsonrpc: '2.0', id: j.id ?? 1, result: rez }));
});
});
await new Promise((ok) => srv.listen(0, '127.0.0.1', ok));
const RPC = (mod) => `http://127.0.0.1:${srv.address().port}/${mod}`;
const ruleaza = (args, env = {}) => new Promise((ok) => {
const p = spawn(process.execPath, [CLI, ...args], { env: { ...process.env, AERE_VERIFY_PROOF: '', ...env }, stdio: ['ignore', 'pipe', 'pipe'] });
let out = ''; p.stdout.on('data', (d) => { out += d; }); p.stderr.on('data', (d) => { out += d; });
const t = setTimeout(() => p.kill(), 120000);
p.on('close', (cod) => { clearTimeout(t); ok({ cod, out, ultim: out.trim().split('\n').pop() || '' }); });
});
let rele = 0, n = 0;
const cer = (nume, r, cod, cuvant, alt) => {
n++; const ok = r.cod === cod && r.ultim.startsWith(cuvant) && (!alt || alt.test(r.out));
console.log(` [${ok ? 'VERDE ' : 'ROSU '}] ${nume}: exit ${r.cod}, "${r.ultim.slice(0, 150)}"`); if (!ok) rele++;
};
try {
cer('V1 the full receipt file, the chain agreeing, finality PASSED: VALID, notarized (the route says VALID)',
await ruleaza([FISIER, '--rpc', RPC('bun'), '--verify-proof', VP], { AERE_STUB_FIN: 'PASSED' }), 0, 'VALID, notarized');
cer('V2 (NEW) without --verify-proof: PARTIAL, exit 2, the envelope not judged (the route never answers VALID without the verifier)',
await ruleaza([FISIER, '--rpc', RPC('bun')]), 2, 'PARTIAL', /no --verify-proof/);
cer('V3 (NEW) without --rpc and without --verify-proof: PARTIAL, exit 2, the chain not consulted',
await ruleaza([FISIER]), 2, 'PARTIAL', /not consulted/);
cer('V4 (NEW) the reference verifier answers PARTIAL, finality PENDING (a receipt checked right after it was issued): PARTIAL, exit 2 (the route says PARTIAL)',
await ruleaza([FISIER, '--rpc', RPC('bun'), '--verify-proof', VP], { AERE_STUB_FIN: 'PENDING' }), 2, 'PARTIAL', /finality PENDING/);
cer('V5 (NEW) finality UNMEASURED: PARTIAL, exit 2',
await ruleaza([FISIER, '--rpc', RPC('bun'), '--verify-proof', VP], { AERE_STUB_FIN: 'UNMEASURED' }), 2, 'PARTIAL', /finality UNMEASURED/);
cer('V6 finality FAILED (the verifier says INVALID): INVALID, exit 1 (the route says INVALID)',
await ruleaza([FISIER, '--rpc', RPC('bun'), '--verify-proof', VP], { AERE_STUB_FIN: 'FAILED' }), 1, 'INVALID');
cer('V7 (NEW) the chain does not answer (HTTP 500): PARTIAL, exit 2, said (the route says PARTIAL since 2026-10-27)',
await ruleaza([FISIER, '--rpc', RPC('mut'), '--verify-proof', VP], { AERE_STUB_FIN: 'PASSED' }), 2, 'PARTIAL', /did not answer/);
cer('V8 (NEW) the chain answers and does not know the transaction: INVALID, exit 1, said (as the route)',
await ruleaza([FISIER, '--rpc', RPC('necunoscut'), '--verify-proof', VP], { AERE_STUB_FIN: 'PASSED' }), 1, 'INVALID', /does not know/);
cer('V9 (NEW) an RPC of another chain (2800 for a 28001 receipt): PARTIAL, exit 2, the transaction not compared there',
await ruleaza([FISIER, '--rpc', RPC('alt-lant'), '--verify-proof', VP], { AERE_STUB_FIN: 'PASSED' }), 2, 'PARTIAL', /serves chain 2800/);
cer('V10 (NEW) the `receipt` of the route alone ({instruction, envelope}, no policy, no inputs): PARTIAL, exit 2, naming what is missing and the receiptFile that carries it (not INVALID on a good receipt)',
await ruleaza([FARA_POLITICA, '--rpc', RPC('bun'), '--verify-proof', VP], { AERE_STUB_FIN: 'PASSED' }), 2, 'PARTIAL', /no policy and inputs.*receiptFile/);
cer('V11 a forged receipt (amount changed after the envelope), everything else agreeing: INVALID, exit 1',
await ruleaza([FALS, '--rpc', RPC('bun'), '--verify-proof', VP], { AERE_STUB_FIN: 'PASSED' }), 1, 'INVALID', /does not commit/);
cer('V12 (NEW) --verify-proof at a path where no verifier is: PARTIAL, exit 2, said',
await ruleaza([FISIER, '--rpc', RPC('bun'), '--verify-proof', path.join(D, 'lipsa.mjs')]), 2, 'PARTIAL', /not at/);
cer('V13 the verifier answers PARTIAL for another level (witness UNMEASURED) with finality PASSED: VALID, as the route, which decides on finality',
await ruleaza([FISIER, '--rpc', RPC('bun'), '--verify-proof', VP], { AERE_STUB_FIN: 'PASSED', AERE_STUB_ALT: 'UNMEASURED' }), 0, 'VALID, notarized');
cer('V14 (NEW) the verifier prints no JSON: PARTIAL, exit 2, said',
await ruleaza([FISIER, '--rpc', RPC('bun'), '--verify-proof', VP], { AERE_STUB_FIN: 'NOJSON' }), 2, 'PARTIAL', /gave no JSON/);
} finally { await new Promise((ok) => srv.close(ok)); fs.rmSync(D, { recursive: true, force: true }); }
console.log(`\nthe public reader of a receipt (${path.basename(CLI)}): ${n - rele}/${n} as named${process.env.AERE_VERIFICA_CHITANTA_CLI ? ' (reader under test: ' + CLI + ')' : ''}`);
process.exitCode = rele ? 1 : 0;
+48 -15
View File
@@ -1,10 +1,16 @@
#!/usr/bin/env node
// verifica-chitanta.mjs: a reader's check of a payment receipt (roadmap point 25), without ethers: the receipt file holds the
// instruction, the settlement envelope, the policy and the inputs the issuer judged; with --rpc the transaction and its receipt are
// read from the chain by plain JSON-RPC and compared; with --verify-proof the AIP-23 reference verifier judges the envelope and,
// with --rpc, its notarization under a post-quantum certified anchor (finality).
// instruction, the settlement envelope, the policy and the inputs the issuer judged (the `receiptFile` that POST /v1/payments/receipt
// returns is exactly this file); with --rpc the transaction and its receipt are read from the chain by plain JSON-RPC and compared;
// with --verify-proof the AIP-23 reference verifier judges the envelope and, with --rpc, its notarization under a post-quantum
// certified anchor (finality).
// node verifica-chitanta.mjs <receipt.json> [--rpc URL] [--verify-proof <verify-proof.mjs>] [--chain 28001]
// Exit 0 VALID, 1 INVALID, 2 could not measure (no chain answer, no verifier).
// Exit 0 VALID: every rule holds, the transaction on the chain is this payment, and the reference verifier finds the envelope's
// notarization under a post-quantum certified anchor (finality PASSED). Exit 1 INVALID, with the reasons. Exit 2 PARTIAL: something
// was not measured (no --rpc, no chain answer, an RPC of another chain, no --verify-proof or no verifier at that path, the policy or the
// inputs missing from the file, or the notarization not under an anchor yet: finality PENDING or UNMEASURED). These are the verdicts of
// POST /v1/payments/verify on the same rules. (Corrected 2026-10-27: until this date the tool wrote VALID and exited 0 without
// --verify-proof, and when the reference verifier answered PARTIAL or PENDING; a file without policy or inputs was INVALID.)
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
@@ -15,22 +21,49 @@ const a = process.argv.slice(2); const opt = (k, d = null) => { const i = a.inde
const f = a[0]; if (!f || !fs.existsSync(f)) { console.log('usage: verifica-chitanta.mjs <receipt.json> [--rpc URL] [--verify-proof path] [--chain id]'); process.exit(2); }
const r = JSON.parse(fs.readFileSync(f, 'utf8'));
const rpc = opt('--rpc'); const vp = opt('--verify-proof', process.env.AERE_VERIFY_PROOF || null); const chain = opt('--chain', r.instruction && r.instruction.chainId);
let tx = null, receipt = null, nem = null;
const nem = []; // what was NOT measured: any entry makes the verdict PARTIAL (exit 2), never VALID
let tx = null, receipt = null, lantNuStie = false;
if (rpc) {
const apel = async (method, params) => { const x = await fetch(rpc, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ jsonrpc: '2.0', id: 1, method, params }), signal: AbortSignal.timeout(20000) }); const j = await x.json(); if (j.error) throw new Error(method + ': ' + j.error.message); return j.result; };
try { tx = await apel('eth_getTransactionByHash', [r.instruction.txHash]); receipt = await apel('eth_getTransactionReceipt', [r.instruction.txHash]); if (!tx || !receipt) nem = 'the chain does not know transaction ' + r.instruction.txHash; } catch (e) { nem = 'the chain did not answer: ' + e.message; }
}
try {
// an RPC of another chain does not know the transaction, and that is not a verdict about the receipt
const cid = Number(BigInt(await apel('eth_chainId', [])));
if (r.instruction && r.instruction.chainId !== undefined && cid !== Number(r.instruction.chainId)) nem.push(`the RPC serves chain ${cid}, the receipt names chain ${r.instruction.chainId}: the transaction was not compared`);
else {
tx = await apel('eth_getTransactionByHash', [r.instruction.txHash]); receipt = await apel('eth_getTransactionReceipt', [r.instruction.txHash]);
if (!tx || !receipt) { lantNuStie = true; tx = null; receipt = null; }
}
} catch (e) { tx = null; receipt = null; nem.push('the chain did not answer: ' + e.message); }
} else nem.push('the chain was not consulted (no --rpc): the transaction was not compared');
// the policy and the inputs are what reproduces the risk verdict; a file without them cannot be judged on those rules (PARTIAL, not
// INVALID): the module refuses them by name (politica, risc), and those two refusals are set aside here, every other rule still counts
const lipsa = [!r.policy && 'policy', !r.inputs && 'inputs'].filter(Boolean);
const absente = new Set(lipsa.length ? (r.policy ? ['risc'] : ['politica']) : []);
if (lipsa.length) nem.push(`the file carries no ${lipsa.join(' and ')}: the risk verdict was not reproduced (the receiptFile that /v1/payments/receipt returns carries both)`);
const v = verificaChitanta({ instruction: r.instruction, envelope: r.envelope }, { policy: r.policy, inputs: r.inputs, tx, receipt });
const reguliRele = (v.reguli || []).filter((x) => !absente.has(x));
let fin = null, verdictPlic = null;
if (vp && fs.existsSync(vp)) {
if (!vp) nem.push('the envelope was not judged (no --verify-proof): its notarization under a post-quantum certified anchor was not checked');
else if (!fs.existsSync(vp)) nem.push('the reference verifier is not at ' + vp);
else {
const t = path.join(os.tmpdir(), 'chitanta-' + process.pid + '.json'); fs.writeFileSync(t, JSON.stringify(r.envelope));
try { const p = spawnSync(process.execPath, [vp, t, '--json', ...(rpc ? ['--rpc', rpc, '--chain', String(chain)] : [])], { encoding: 'utf8', timeout: 300000 }); try { const j = JSON.parse(p.stdout); verdictPlic = j.verdict; fin = (j.levels || []).find((l) => l.level === 'finality'); } catch { nem = nem || 'the reference verifier gave no JSON'; } } finally { fs.rmSync(t, { force: true }); }
} else if (vp) nem = nem || 'the reference verifier is not at ' + vp;
try { const p = spawnSync(process.execPath, [vp, t, '--json', ...(rpc ? ['--rpc', rpc, '--chain', String(chain)] : [])], { encoding: 'utf8', timeout: 300000 }); try { const j = JSON.parse(p.stdout); verdictPlic = j.verdict; fin = (j.levels || []).find((l) => l.level === 'finality') || null; } catch { nem.push('the reference verifier gave no JSON'); } } finally { fs.rmSync(t, { force: true }); }
}
const motiveRele = [...(reguliRele.length ? v.motive.filter((m) => !/^no (policy|inputs) given/.test(m)) : []),
...(lantNuStie ? [`the chain does not know transaction ${r.instruction.txHash}`] : []),
...(verdictPlic === 'INVALID' ? ['the reference verifier finds the envelope INVALID'] : []),
...(fin && fin.state === 'FAILED' ? ['the notarization FAILED under the reference verifier: ' + String(fin.detail).slice(0, 140)] : [])];
const invalid = motiveRele.length > 0;
// as POST /v1/payments/verify: VALID only with the finality of the notarization PASSED (and the chain compared); PENDING, UNMEASURED or
// no finality level at all is PARTIAL
if (verdictPlic && !invalid && !(fin && fin.state === 'PASSED')) nem.push(`the notarization is not under a post-quantum certified anchor yet (finality ${fin ? fin.state + ': ' + String(fin.detail).slice(0, 120) : 'absent'})`);
const randuri = [`receipt: ${r.instruction.amountUsd} USD = ${r.instruction.amount} units of ${r.instruction.asset} at ${r.instruction.rate.usdPerUnit} USD/unit (${r.instruction.rate.source}), ${r.instruction.payer.slice(0, 10)}.. -> ${r.instruction.payee.slice(0, 10)}.., tx ${r.instruction.txHash.slice(0, 18)}.., risk ${r.instruction.risk.decision} under policy ${r.instruction.risk.policyHash.slice(0, 18)}..`,
`rules: ${v.verdict}${v.motive.length ? ': ' + v.motive.join('; ') : ''}${v.chainChecked ? ' (transaction compared on chain)' : ' (chain not consulted)'}`,
reguliRele.length || !lipsa.length ? `rules: ${v.verdict}${v.motive.length ? ': ' + v.motive.join('; ') : ''}${v.chainChecked ? ' (transaction compared on chain)' : ' (chain not consulted)'}`
: `rules: not all judged (no ${lipsa.join(' and ')} in the file); the others hold${v.chainChecked ? ' (transaction compared on chain)' : ' (chain not consulted)'}`,
verdictPlic ? `envelope (reference verifier): ${verdictPlic}; finality ${fin ? fin.state + ': ' + String(fin.detail).slice(0, 140) : 'absent'}` : 'envelope (reference verifier): not run'];
console.log(randuri.join('\n'));
const invalid = v.verdict === 'INVALID' || verdictPlic === 'INVALID' || (fin && fin.state === 'FAILED');
process.exitCode = invalid ? 1 : nem ? 2 : 0;
if (nem && !invalid) console.log('UNMEASURED: ' + nem);
else console.log(invalid ? 'INVALID' : 'VALID' + (fin && fin.state === 'PASSED' ? ', notarized under a post-quantum certified anchor' : ''));
const valid = !invalid && !nem.length && v.chainChecked && fin && fin.state === 'PASSED';
process.exitCode = invalid ? 1 : valid ? 0 : 2;
if (invalid) console.log('INVALID: ' + motiveRele.join('; '));
else if (valid) console.log('VALID, notarized under a post-quantum certified anchor');
else console.log('PARTIAL: ' + (nem.length ? nem.join('; ') : 'the transaction was not compared on chain'));