conformance: 97 rules of 9 verifiers, 206 vectors; verify-layer and agents refuse a classical key under an ML-DSA-65 name; market-settlement reads the notarization time from the certified read; proof-of-ai README in English

This commit is contained in:
Aere Network committed 2026-10-05 17:17:59 +03:00
1 parent c9f2932e04
commit c9798a0013
111 files changed
+15871 -292

No files matched your search

+7 -2
View File
@@ -30,6 +30,10 @@ const AICI = path.dirname(fileURLToPath(import.meta.url));
export const FORMAT = 'aere-ai-trust-chain-1';
export const LEVELS = ['form', 'identity', 'version', 'runtime', 'permissions', 'provenance', 'witness'];
export const TOLERANCE_S = 300;
/** The rules this verifier names: the reason codes of its refusals. `fail` throws on any other, so the list is the whole list. */
export const REGULI = ['form', 'identity-mismatch', 'identity-key', 'version-attestation', 'version-artifact-mismatch', 'version-label-mismatch', 'runtime-record', 'runtime-artifact-mismatch',
'runtime-after-output', 'audit-log-broken', 'runtime-not-in-audit-log', 'audit-head', 'witness-head', 'policy-hash', 'ledger-invalid', 'output-not-in-ledger', 'action-refused', 'ledger-time-mismatch',
'policy', 'provenance-envelope', 'provenance-finality'];
export const VERIFY_PROOF_DEFAULT = process.env.AERE_VERIFY_PROOF || path.resolve(AICI, '..', '..', 'verificator-falcon', 'verify-proof.mjs');
const H32 = /^0x[0-9a-f]{64}$/;
const sha = (b) => '0x' + crypto.createHash('sha256').update(b).digest('hex');
@@ -77,7 +81,7 @@ const envelopeOk = (j) => j && ['form', 'integrity'].every((n) => parsed(j, n).s
export async function verifica(bundle, { verifyProof = VERIFY_PROOF_DEFAULT, rpc = null, chain = null, now = Math.floor(Date.now() / 1000) } = {}) {
const levels = Object.fromEntries(LEVELS.map((l) => [l, lvl('ABSENT')]));
const assumptions = {};
const fail = (l, reason, detail) => { levels[l] = lvl('FAILED', { reason, detail }); };
const fail = (l, reason, detail) => { if (!REGULI.includes(reason)) throw new Error('ai-trust: undeclared rule ' + reason); levels[l] = lvl('FAILED', { reason, detail }); };
const unm = (l, reason, detail) => { levels[l] = lvl('UNMEASURED', { reason, detail }); };
// 1. form
const isObj = (x) => x !== null && typeof x === 'object' && !Array.isArray(x);
@@ -208,6 +212,7 @@ function verdict(levels, assumptions) {
else if (levels.witness.state !== 'PASSED') { v = 'PARTIAL'; reason = 'unwitnessed'; }
else v = 'VALID';
}
return { verdict: v, reason, levels: Object.fromEntries(LEVELS.map((l) => [l, levels[l].state])), details: levels, assumptions,
// `rules`: the reason code of every level that failed (the verdict's `reason` is only the first)
return { verdict: v, reason, rules: LEVELS.filter((l) => levels[l].state === 'FAILED').map((l) => levels[l].reason).sort(), levels: Object.fromEntries(LEVELS.map((l) => [l, levels[l].state])), details: levels, assumptions,
notice: 'A verdict says that the bytes link and who vouches for each link. It does not say the model is good, the host is honest, or the output is true.' };
}