conformance: a conformance suite for the AIP-23 proof kinds (one verdict form over the published verifiers, 35 rules derived from code, 122 vectors, a runner for any implementation, a second verifier in Python); four defects it found in the published verifiers are fixed here: the market judge accepted a timeline with its submission event withheld, and three verifiers threw on malformed input instead of refusing by name

This commit is contained in:
Aere Network committed 2026-10-03 13:26:03 +03:00
1 parent 2c000478dc
commit c9f2932e04
145 files changed
+17395 -104

No files matched your search

+3 -2
View File
@@ -41,8 +41,9 @@ export function fixturi({ R, C }) {
F.push({ nume: 'R7 the payee is the payer: REFUSE', asteptat: 'REFUSE', paza: 'contrapartida', r: () => dec(R.judeca(POLITICA, inputs({ payee: PAYER })), true) });
F.push({ nume: 'R8 no declared rate: REFUSE', asteptat: 'REFUSE', paza: 'curs', r: () => dec(R.judeca(POLITICA, inputs({ rate: null })), true) });
F.push({ nume: 'R8b with no declared rate the USD value is left unmeasured and named so (never guessed)', asteptat: 'REFUSE', r: () => { const v = R.judeca(POLITICA, inputs({ rate: null })); return { verdict: v.measured.amountUsd === null && v.unmeasured.some((u) => /no declared rate/.test(u)) ? v.decision : 'INVALID', detail: v.unmeasured.find((u) => /rate/.test(u)) || '' }; } });
F.push({ nume: 'R9 an asset the policy does not allow: REFUSE', asteptat: 'REFUSE', r: () => dec(R.judeca(POLITICA, inputs({ asset: 'erc20:0x8215ba247a3574af8ebc36606eb437811e318fbd' })), true) });
F.push({ nume: 'R9 an asset the policy does not allow: REFUSE', asteptat: 'REFUSE', paza: 'activ', r: () => dec(R.judeca(POLITICA, inputs({ asset: 'erc20:0x8215ba247a3574af8ebc36606eb437811e318fbd' })), true) });
F.push({ nume: 'R10 a policy with an unknown field is refused by definePolicy (nothing judged under a field the engine ignores)', asteptat: 'REFUSE', r: () => { try { R.definePolicy({ ...POLITICA, kycTier: 2 }); return { verdict: 'ALLOW', detail: 'accepted' }; } catch (e) { return { verdict: 'REFUSE', detail: e.message }; } } });
F.push({ nume: 'R11 a payer that is not an address: REFUSE, a verdict that names the form rule (until 2026-10-03 this threw instead)', asteptat: 'REFUSE', paza: 'forma', r: () => { const v = R.judeca(POLITICA, inputs({ payer: '0x1234' })); return dec(v, v.decision !== 'REFUSE' || v.rules.join() === 'forma'); } });
// the receipt
F.push({ nume: 'C1 a receipt on an ALLOW verdict verifies: envelope commits to the instruction, USD exact, policy under hash, verdict reproduced, transaction matches', asteptat: 'VALID', r: () => { const r = chitantaValida(R, C); const v = verif(C, r); return { verdict: v.verdict, detail: v.motive.join('; ') || r.instruction.amountUsd + ' USD, ' + r.envelope.statementHash.slice(0, 18) + '..' }; } });
F.push({ nume: 'C2 the same receipt without the chain facts: VALID but "chain not consulted"', asteptat: 'VALID', r: () => { const r = chitantaValida(R, C); const v = C.verificaChitanta({ instruction: r.instruction, envelope: r.envelope }, { policy: r.policy, inputs: r.inputs }); return { verdict: v.verdict === 'VALID' && v.chainChecked === false ? 'VALID' : 'INVALID', detail: v.motive.join('; ') }; } });
@@ -74,7 +75,7 @@ if (!control) {
const srcR = fs.readFileSync(RISC, 'utf8'), srcC = fs.readFileSync(CHIT, 'utf8'); let bune = 0;
// the policy-hash rule in chitanta.mjs carries no marker: it is a diagnostic (a clearer message) under the verdict reproduction, which
// already fails on any policy change (the policy hash is inside the verdict hash); the load-bearing check is PAZA:risc
const marcaje = [['contrapartida', 'R'], ['curs', 'R'], ['limita', 'R'], ['fereastra', 'R'], ['legatura', 'C'], ['suma', 'C'], ['risc', 'C'], ['lant', 'C']];
const marcaje = [['forma', 'R'], ['activ', 'R'], ['contrapartida', 'R'], ['curs', 'R'], ['limita', 'R'], ['fereastra', 'R'], ['legatura', 'C'], ['suma', 'C'], ['risc', 'C'], ['lant', 'C']];
const toate = fixturi(await incarca(RISC, CHIT));
for (const [m, unde] of marcaje) {
const cR = path.join(AICI, `_plantat-risc-${process.pid}-${m}.mjs`), cC = path.join(AICI, `_plantat-chitanta-${process.pid}-${m}.mjs`);