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:
1 parent
2c000478dc
commit
c9f2932e04
145 files changed
+17395
-104
No files matched your search
@@ -34,6 +34,11 @@ export function fixturi(P) {
|
||||
F.push({ nume: 'N8 S1 the envelope names another result (outputHash changed, statementHash kept)', asteptat: 'INVALID', paza: 'dovada', r: () => { const d = date('S1'); d.envelope.statement.outputHash = '0x' + 'cc'.repeat(32); return v(P.judeca(d)); } });
|
||||
F.push({ nume: 'N9 S1 the envelope notarized only after the window closed', asteptat: 'INVALID', paza: 'dovada', r: () => { const d = date('S1'); d.envelope.notarization.firstSeen = d.job.submittedAt + d.job.challengeWindow + 1; return v(P.judeca(d)); } });
|
||||
F.push({ nume: 'N10 S4 reclaimed as expired BEFORE the deadline', asteptat: 'INVALID', paza: 'termen', r: () => { const d = date('S4'); ev(d, 'JobRefunded').timestamp = d.job.deadline - 1; return v(P.judeca(d)); } });
|
||||
F.push({ nume: 'N11 S2 the JobPosted event names another requester than the job', asteptat: 'INVALID', paza: 'postare', r: () => { const d = date('S2'); ev(d, 'JobPosted').args.requester = d.job.provider; return v(P.judeca(d)); } });
|
||||
F.push({ nume: 'N12 S5 an event whose time is not a whole number of seconds: refused by name (form)', asteptat: 'INVALID', paza: 'forma', r: () => { const d = date('S5'); ev(d, 'JobPosted').timestamp += 0.5; return v(P.judeca(d)); } });
|
||||
F.push({ nume: 'N14 S1 finalized inside the window by a third party, with the ResultSubmitted event withheld (the window rule would be skipped): refused as not whole', asteptat: 'INVALID', paza: 'intreg', r: () => { const d = date('S1'); ev(d, 'JobPaid').timestamp = d.job.submittedAt + 1; d.events = d.events.filter((e) => e.name !== 'ResultSubmitted'); const r = P.judeca(d); return { verdict: r.verdict, detail: r.reguli.join() + ': ' + r.motive.join('; ') }; } });
|
||||
F.push({ nume: 'N15 S4 the JobClaimed event withheld (the deadline rule of an expiry would be skipped): refused as not whole', asteptat: 'INVALID', paza: 'intreg', r: () => { const d = date('S4'); d.events = d.events.filter((e) => e.name !== 'JobClaimed'); return v(P.judeca(d)); } });
|
||||
F.push({ nume: 'N13 malformed timelines (no constants, an event without args, events not a list) are refused by name, never thrown', asteptat: 'INVALID', r: () => { const rez = [(d) => { delete d.constants; }, (d) => { delete d.events[0].args; }, (d) => { d.events = 'x'; }].map((f) => { const d = date('S2'); f(d); const r = P.judeca(d); return r.verdict + ':' + r.reguli.join(); }); return { verdict: rez.every((x) => x === 'INVALID:forma') ? 'INVALID' : 'VALID', detail: rez.join(' ') }; } });
|
||||
F.push({ nume: 'R1 the settlement receipt of S1 is an AIP-23 settlement envelope naming the payout tx and the provider', asteptat: 'VALID', r: () => { const d = date('S1'); const c = P.chitanta(d); const t = ev(d, 'JobPaid'); return { verdict: c.kind === 'aere-proof-of-settlement-attestation' && c.statement.txHash === t.txHash && c.statement.to.toLowerCase() === d.job.provider.toLowerCase() && c.statement.chainId === 28001 ? 'VALID' : 'INVALID', detail: c.statementHash.slice(0, 18) + '..' }; } });
|
||||
return F;
|
||||
}
|
||||
@@ -49,7 +54,7 @@ if (!control) {
|
||||
console.log(`\nmarket judge (evidence ${dovezi[dovezi.length - 1]}): ${verzi} VERDE, ${rosii} ROSU, ${stricate} STRICAT`);
|
||||
process.exitCode = rosii || stricate ? 1 : 0;
|
||||
} else {
|
||||
const SURSA = fs.readFileSync(MODUL, 'utf8'); const marcaje = ['termen', 'fereastra', 'arbitru', 'plata', 'rezultat', 'replay', 'dovada']; let bune = 0;
|
||||
const SURSA = fs.readFileSync(MODUL, 'utf8'); const marcaje = ['forma', 'intreg', 'postare', 'termen', 'fereastra', 'arbitru', 'plata', 'rezultat', 'replay', 'dovada']; let bune = 0;
|
||||
for (const m of marcaje) {
|
||||
const copie = path.join(AICI, `_plantat-piata-${process.pid}-${m}.mjs`); const n = SURSA.split(`/*PAZA:${m}*/`).length - 1; const tinte = fixturi(P).filter((f) => f.paza === m);
|
||||
let stare, detaliu;
|
||||
|
||||
Reference in new issue
Block a user