From c239cbd750023ccca9dc09564767f5c6a5b8437a Mon Sep 17 00:00:00 2001 From: Aere Network Date: Sun, 27 Sep 2026 20:48:58 +0300 Subject: [PATCH] tools/verify-proof.mjs: the chain comes from --chain, else from the chain the envelope's notarization declares (when known), else 2800. An envelope notarized on the testnet 28001 and checked without --chain used to be looked up on 2800 and reported INVALID. The notary stays the known contract of that chain (or --notary); an address written in the envelope is never trusted as the notary. --- tools/verify-proof.mjs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/verify-proof.mjs b/tools/verify-proof.mjs index a75b4c7..e3fea27 100644 --- a/tools/verify-proof.mjs +++ b/tools/verify-proof.mjs @@ -219,9 +219,13 @@ const args = process.argv.slice(2); const opt = (n) => { const i = args.indexOf(n); return i >= 0 ? args[i + 1] : null; }; const file = args.find((a, i) => !a.startsWith('--') && !(i > 0 && args[i - 1].startsWith('--') && args[i - 1] !== '--json')); if (!file) { console.error('usage: node verify-proof.mjs [--rpc ] [--chain 2800|28001] [--notary
] [--manifests ] [--json]'); stop(2); } -const chain = Number(opt('--chain') || 2800); -if (!NOTARY[chain]) { console.error('unknown chain ' + chain + ' (2800 or 28001)'); stop(2); } let env; try { env = JSON.parse(fs.readFileSync(file, 'utf8')); } catch (e) { console.error('the envelope cannot be read: ' + e.message); stop(2); } +// The chain: --chain if given; otherwise the chain the envelope's notarization declares, when it is a known chain; otherwise 2800. +// (Before 2026-09-27 an envelope notarized on 28001, checked without --chain, was looked up on 2800 and reported INVALID.) The +// notary stays the known contract of that chain (or --notary): an address written in the envelope is never trusted as the notary. +const declared = env && env.notarization && Number(env.notarization.chainId); +const chain = Number(opt('--chain') || (declared && NOTARY[declared] ? declared : 2800)); +if (!NOTARY[chain]) { console.error('unknown chain ' + chain + ' (2800 or 28001)'); stop(2); } const o = { chain, rpcGiven: !!opt('--rpc'), rpc: opt('--rpc') || RPC_DEFAULT[chain], notary: (opt('--notary') || NOTARY[chain]).toLowerCase(), manifests: opt('--manifests') || MANIFESTS_DEFAULT[chain] }; const l = local(env);