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
+8
-2
@@ -22,8 +22,9 @@ the USD amount is exactly amount x rate, that the policy shown hashes to the one
|
||||
the inputs and was ALLOW, and, with the chain facts, that the transaction is this payment (from, to, value, block, status).
|
||||
|
||||
```
|
||||
node proba-risc.mjs # 22 rows, no chain: the verdicts under a policy, a receipt verified, nine forged ones refused by name
|
||||
node proba-risc.mjs --control-negativ # 8 plantings on copies of risc.mjs and chitanta.mjs; each forged fixture must then be accepted
|
||||
node proba-risc.mjs # 23 rows, no chain: the verdicts under a policy, a receipt verified, nine forged ones refused by name,
|
||||
# a malformed payment refused by name (a verdict, not an exception)
|
||||
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>
|
||||
```
|
||||
@@ -34,6 +35,11 @@ post-quantum certified anchor; a payment of 1.50 USD refused above the per-payme
|
||||
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.
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
## What it is not, and what is not measured
|
||||
|
||||
- **Not KYC, not AML, not sanctions screening.** The policy's refused counterparties are addresses this house measured as sinks on
|
||||
|
||||
+20
-17
@@ -4,12 +4,15 @@
|
||||
// chainId, from, to, amount, asset). The envelope is what gets notarized on AereNotary, so the receipt's time is the chain's, read back
|
||||
// under a post-quantum certified anchor by the reference verifier; the instruction is what a reader checks against the chain and against
|
||||
// the risk module. `verificaChitanta` is pure (the chain facts come in as arguments: the transaction and its receipt, fetched by the
|
||||
// caller); every rule carries a PAZA marker for the planting control. Only node:crypto and proof-kinds.
|
||||
// caller); every rule carries a PAZA marker for the planting control and is NAMED in the verdict (`reguli`: legatura, suma, politica,
|
||||
// risc, lant), so a reader, or the conformance suite, knows which rule refused, not only that something did. Only node:crypto and proof-kinds.
|
||||
import crypto from 'node:crypto';
|
||||
import { buildProof } from '../proof-kinds/proof-kinds.mjs';
|
||||
import { canonical, hashOf, definePolicy, judeca, usdOf, usdText } from './risc.mjs';
|
||||
|
||||
export const KIND_INSTRUCTION = 'aere-payment-receipt-instruction';
|
||||
/** The rules this verifier names. A refusal can only name one of these (the helper throws otherwise), so the list is the whole list. */
|
||||
export const REGULI = ['legatura', 'suma', 'politica', 'risc', 'lant'];
|
||||
const sha256 = (b) => '0x' + crypto.createHash('sha256').update(b).digest('hex');
|
||||
const H32 = /^0x[0-9a-f]{64}$/i, low = (x) => String(x || '').toLowerCase();
|
||||
|
||||
@@ -28,36 +31,36 @@ export function construiesteChitanta({ chainId, txHash, blockHash, payer, payee,
|
||||
* @param {object} o { policy, inputs, tx?: {from, to, value(hex|string), blockHash}, receipt?: {status(hex|number), blockHash} }
|
||||
*/
|
||||
export function verificaChitanta(r, o = {}) {
|
||||
const motive = []; const ok = (c, m) => { if (!c) motive.push(m); return !!c; };
|
||||
const motive = [], reguli = new Set(); const ok = (c, m, regula) => { if (!REGULI.includes(regula)) throw new Error('chitanta: undeclared rule ' + regula); if (!c) { motive.push(m); reguli.add(regula); } return !!c; };
|
||||
const ins = r && r.instruction, env = r && r.envelope;
|
||||
if (!ins || ins.kind !== KIND_INSTRUCTION || !env || !env.statement) return { verdict: 'INVALID', motive: ['not a receipt (instruction + settlement envelope)'] };
|
||||
if (!ins || ins.kind !== KIND_INSTRUCTION || !env || !env.statement) return { verdict: 'INVALID', motive: ['not a receipt (instruction + settlement envelope)'], reguli: ['legatura'] };
|
||||
const st = env.statement;
|
||||
// the envelope commits to this instruction, and says the same thing
|
||||
const okLegatura = env.kind === 'aere-proof-of-settlement-attestation' && sha256(Buffer.from(JSON.stringify(st), 'utf8')) === low(env.statementHash)
|
||||
&& st.instructionHash === sha256(Buffer.from(canonical(ins), 'utf8')) && st.chainId === ins.chainId && low(st.from) === ins.payer && low(st.to) === ins.payee && st.amount === ins.amount && low(st.asset) === ins.asset && low(st.txHash) === ins.txHash && low(st.blockHash) === ins.blockHash /*PAZA:legatura*/;
|
||||
ok(okLegatura, 'the envelope does not commit to this instruction (instructionHash, statementHash or the fields differ)');
|
||||
ok(H32.test(ins.txHash) && H32.test(ins.blockHash), 'txHash and blockHash must be 32-byte hashes');
|
||||
ok(okLegatura, 'the envelope does not commit to this instruction (instructionHash, statementHash or the fields differ)', 'legatura');
|
||||
ok(H32.test(ins.txHash) && H32.test(ins.blockHash) /*PAZA:legatura*/, 'txHash and blockHash must be 32-byte hashes', 'legatura');
|
||||
// the USD amount is the amount at the declared rate, exactly
|
||||
try { ok(ins.amountUsd === usdText(usdOf(ins.amount, ins.decimals, ins.rate.usdPerUnit)) /*PAZA:suma*/, 'amountUsd is not amount x the declared rate'); } catch (e) { motive.push('the amount or the rate is malformed: ' + e.message); }
|
||||
try { ok(ins.amountUsd === usdText(usdOf(ins.amount, ins.decimals, ins.rate.usdPerUnit)) /*PAZA:suma*/, 'amountUsd is not amount x the declared rate', 'suma'); } catch (e) { ok(false, 'the amount or the rate is malformed: ' + e.message, 'suma'); }
|
||||
// the policy under the hash is the policy shown
|
||||
if (o.policy) { try { ok(definePolicy(o.policy).policyHash === ins.risk.policyHash, 'the policy shown does not hash to the policy the verdict names (a policy changed under its hash)'); } catch (e) { motive.push('the policy is refused: ' + e.message); } }
|
||||
else motive.push('no policy given: the risk verdict cannot be reproduced');
|
||||
if (o.policy) { try { ok(definePolicy(o.policy).policyHash === ins.risk.policyHash /*PAZA:politica*/, 'the policy shown does not hash to the policy the verdict names (a policy changed under its hash)', 'politica'); } catch (e) { ok(false, 'the policy is refused: ' + e.message, 'politica'); } }
|
||||
else ok(false, 'no policy given: the risk verdict cannot be reproduced', 'politica');
|
||||
// the verdict is reproduced from the same inputs, and it was ALLOW
|
||||
if (o.policy && o.inputs) {
|
||||
try {
|
||||
const v = judeca(o.policy, o.inputs);
|
||||
const okRisc = hashOf(o.inputs) === ins.risk.inputsHash && v.verdictHash === ins.risk.verdictHash && v.decision === 'ALLOW' && ins.risk.decision === 'ALLOW' /*PAZA:risc*/;
|
||||
ok(okRisc, v.decision !== 'ALLOW' ? 'the risk module REFUSES these inputs under this policy: ' + v.reasons.join('; ') : 'the risk verdict does not reproduce from the inputs and the policy (inputsHash or verdictHash differ)');
|
||||
ok(low(o.inputs.payer) === ins.payer && low(o.inputs.payee) === ins.payee && String(o.inputs.amount) === ins.amount && low(o.inputs.asset) === ins.asset && o.inputs.chainId === ins.chainId, 'the inputs judged are not the payment of this receipt');
|
||||
ok(o.inputs.rate && o.inputs.rate.usdPerUnit === ins.rate.usdPerUnit && o.inputs.rate.source === ins.rate.source && o.inputs.rate.at === ins.rate.at, 'the rate judged is not the rate on the receipt');
|
||||
} catch (e) { motive.push('the risk verdict could not be reproduced: ' + e.message); }
|
||||
} else if (o.policy) motive.push('no inputs given: the risk verdict cannot be reproduced');
|
||||
ok(okRisc, v.decision !== 'ALLOW' ? 'the risk module REFUSES these inputs under this policy: ' + v.reasons.join('; ') : 'the risk verdict does not reproduce from the inputs and the policy (inputsHash or verdictHash differ)', 'risc');
|
||||
ok(low(o.inputs.payer) === ins.payer && low(o.inputs.payee) === ins.payee && String(o.inputs.amount) === ins.amount && low(o.inputs.asset) === ins.asset && o.inputs.chainId === ins.chainId /*PAZA:risc*/, 'the inputs judged are not the payment of this receipt', 'risc');
|
||||
ok(o.inputs.rate && o.inputs.rate.usdPerUnit === ins.rate.usdPerUnit && o.inputs.rate.source === ins.rate.source && o.inputs.rate.at === ins.rate.at /*PAZA:risc*/, 'the rate judged is not the rate on the receipt', 'risc');
|
||||
} catch (e) { ok(false, 'the risk verdict could not be reproduced: ' + e.message, 'risc'); }
|
||||
} else if (o.policy) ok(false, 'no inputs given: the risk verdict cannot be reproduced', 'risc');
|
||||
// the chain facts, when given: the transaction is the payment, mined, in the block the receipt names
|
||||
if (o.tx) {
|
||||
if (o.tx) try {
|
||||
const val = typeof o.tx.value === 'string' && o.tx.value.startsWith('0x') ? BigInt(o.tx.value).toString() : String(o.tx.value);
|
||||
const status = o.receipt ? Number(BigInt(o.receipt.status)) : null;
|
||||
const okLant = low(o.tx.from) === ins.payer && low(o.tx.to) === ins.payee && (ins.asset !== 'native' || val === ins.amount) && low(o.tx.blockHash) === ins.blockHash && (status === null || status === 1) && (!o.receipt || low(o.receipt.blockHash) === ins.blockHash) /*PAZA:lant*/;
|
||||
ok(okLant, 'the transaction on chain is not this payment (from, to, value, block or status differ)');
|
||||
}
|
||||
return { verdict: motive.length ? 'INVALID' : 'VALID', motive, amountUsd: ins.amountUsd, chainChecked: !!o.tx };
|
||||
ok(okLant, 'the transaction on chain is not this payment (from, to, value, block or status differ)', 'lant');
|
||||
} catch (e) { ok(false, 'the transaction facts supplied are malformed: ' + String(e.message).slice(0, 80), 'lant'); }
|
||||
return { verdict: motive.length ? 'INVALID' : 'VALID', motive, reguli: [...reguli].sort(), amountUsd: ins.amountUsd, chainChecked: !!o.tx };
|
||||
}
|
||||
@@ -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`);
|
||||
|
||||
+23
-13
@@ -11,6 +11,8 @@ import crypto from 'node:crypto';
|
||||
|
||||
export const KIND_POLICY = 'aere-payment-risk-policy';
|
||||
export const KIND_VERDICT = 'aere-payment-risk-verdict';
|
||||
/** The rules this module names. A refusal can only name one of these (the helper throws otherwise), so the list is the whole list. */
|
||||
export const REGULI = ['forma', 'activ', 'contrapartida', 'curs', 'limita', 'fereastra'];
|
||||
const sha256 = (s) => '0x' + crypto.createHash('sha256').update(Buffer.from(s, 'utf8')).digest('hex');
|
||||
const ADDR = /^0x[0-9a-fA-F]{40}$/, INT = /^[0-9]+$/, DEC = /^[0-9]+(\.[0-9]{1,6})?$/;
|
||||
/** Canonical JSON: keys sorted at every depth, no whitespace. */
|
||||
@@ -54,33 +56,41 @@ export const NEMASURATE = ['sanctions screening: no source consulted', 'identity
|
||||
export function judeca(policyIn, inputs) {
|
||||
const { policy, policyHash } = definePolicy(policyIn);
|
||||
const reasons = [], unmeasured = [...NEMASURATE]; const i = inputs || {};
|
||||
const cere = (c, m) => { if (!c) reasons.push(m); return !!c; };
|
||||
cere(ADDR.test(i.payer) && ADDR.test(i.payee), 'payer and payee must be addresses');
|
||||
cere(Number.isInteger(i.chainId) && typeof i.asset === 'string' && INT.test(String(i.amount)) && BigInt(i.amount || 0) > 0n, 'chainId, asset and a positive integer amount are required');
|
||||
cere(Number.isInteger(i.now) && i.now > 0, 'now (unix seconds) is required');
|
||||
const rules = new Set(); const cere = (c, m, regula) => { if (!REGULI.includes(regula)) throw new Error('risc: undeclared rule ' + regula); if (!c) { reasons.push(m); rules.add(regula); } return !!c; };
|
||||
// declared before the first refusal: a refusal of form returns a verdict too, and the verdict reads these (2026-10-03: until today a
|
||||
// malformed payment threw "Cannot access 'amountUsd' before initialization" instead of REFUSE naming the form rule; the conformance
|
||||
// vector of that rule found it)
|
||||
let amountUsd = null, windowUsd = 0n, windowCount = 0; const windowStart = Number.isInteger(i.now) ? i.now - policy.window.seconds : null;
|
||||
cere(ADDR.test(i.payer) && ADDR.test(i.payee) /*PAZA:forma*/, 'payer and payee must be addresses', 'forma');
|
||||
cere(Number.isInteger(i.chainId) && typeof i.asset === 'string' && INT.test(String(i.amount)) && BigInt(i.amount || 0) > 0n /*PAZA:forma*/, 'chainId, asset and a positive integer amount are required', 'forma');
|
||||
cere(Number.isInteger(i.now) && i.now > 0 /*PAZA:forma*/, 'now (unix seconds) is required', 'forma');
|
||||
// a history entry the engine cannot count is a refusal, never a payment silently left out of the window (2026-10-03)
|
||||
cere(i.history == null || (Array.isArray(i.history) && i.history.every((h) => h && typeof h === 'object' && Number.isInteger(h.at) && typeof h.amountUsd === 'string' && DEC.test(h.amountUsd))) /*PAZA:forma*/, 'history must be a list of { at (unix seconds), amountUsd (decimal string) }', 'forma');
|
||||
if (reasons.length) return verdict('REFUSE');
|
||||
const asset = policy.allowedAssets.find((a) => a.chainId === i.chainId && a.asset === low(i.asset));
|
||||
cere(!!asset, `asset ${i.asset} on chain ${i.chainId} is not allowed by the policy`);
|
||||
cere(!!asset /*PAZA:activ*/, `asset ${i.asset} on chain ${i.chainId} is not allowed by the policy`, 'activ');
|
||||
const self = low(i.payer) === low(i.payee); const refuzat = policy.refusedCounterparties.find((r) => r.address === low(i.payee));
|
||||
const okContrapartida = !self && !refuzat /*PAZA:contrapartida*/;
|
||||
cere(okContrapartida, self ? 'the payee is the payer' : refuzat ? `refused counterparty: ${refuzat.reason} (source: ${refuzat.source})` : '');
|
||||
cere(okContrapartida, self ? 'the payee is the payer' : refuzat ? `refused counterparty: ${refuzat.reason} (source: ${refuzat.source})` : '', 'contrapartida');
|
||||
const rate = i.rate && typeof i.rate === 'object' ? i.rate : null;
|
||||
const okCurs = !!(rate && DEC.test(String(rate.usdPerUnit)) && rate.source && rate.at) || !policy.requireRate /*PAZA:curs*/;
|
||||
if (!okCurs) { reasons.push('the USD rate is not declared (usdPerUnit, source, at): the amount in USD is unmeasured and the policy requires it'); unmeasured.push('USD value of the payment: no declared rate'); }
|
||||
const rataBuna = !!(rate && typeof rate.usdPerUnit === 'string' && DEC.test(rate.usdPerUnit)); // a decimal STRING: a JSON number is refused, not rounded
|
||||
const okCurs = (rataBuna && !!rate.source && !!rate.at) || !policy.requireRate /*PAZA:curs*/;
|
||||
if (!okCurs) { rules.add('curs'); reasons.push('the USD rate is not declared (usdPerUnit, source, at): the amount in USD is unmeasured and the policy requires it'); unmeasured.push('USD value of the payment: no declared rate'); }
|
||||
if (i.identity && i.identity.complianceRecordHash) unmeasured.splice(1, 1, 'identity: a compliance record is named (' + String(i.identity.complianceRecordHash).slice(0, 18) + '..), not judged here');
|
||||
let amountUsd = null, windowUsd = 0n, windowCount = 0; const windowStart = i.now - policy.window.seconds;
|
||||
if (okCurs && asset && rate && rate.usdPerUnit !== undefined) { // with no rate nothing is computed: the USD value stays unmeasured
|
||||
if (okCurs && asset && rataBuna) { // with no rate nothing is computed: the USD value stays unmeasured
|
||||
amountUsd = usdOf(i.amount, asset.decimals, rate.usdPerUnit);
|
||||
for (const h of Array.isArray(i.history) ? i.history : []) { if (Number.isInteger(h.at) && h.at > windowStart && h.at <= i.now && low(h.payer || i.payer) === low(i.payer)) { windowUsd += usdMicro(h.amountUsd); windowCount++; } }
|
||||
const okLimita = amountUsd <= usdMicro(policy.perPaymentMaxUsd) /*PAZA:limita*/;
|
||||
cere(okLimita, `above the per-payment limit: ${usdText(amountUsd)} USD > ${policy.perPaymentMaxUsd} USD`);
|
||||
cere(okLimita, `above the per-payment limit: ${usdText(amountUsd)} USD > ${policy.perPaymentMaxUsd} USD`, 'limita');
|
||||
const okFereastra = windowUsd + amountUsd <= usdMicro(policy.window.maxUsd) && windowCount + 1 <= policy.window.maxCount /*PAZA:fereastra*/;
|
||||
cere(okFereastra, windowCount + 1 > policy.window.maxCount ? `above the window count: ${windowCount + 1} payments in ${policy.window.seconds} s > ${policy.window.maxCount}` : `above the window limit: ${usdText(windowUsd + amountUsd)} USD in ${policy.window.seconds} s > ${policy.window.maxUsd} USD`);
|
||||
cere(okFereastra, windowCount + 1 > policy.window.maxCount ? `above the window count: ${windowCount + 1} payments in ${policy.window.seconds} s > ${policy.window.maxCount}` : `above the window limit: ${usdText(windowUsd + amountUsd)} USD in ${policy.window.seconds} s > ${policy.window.maxUsd} USD`, 'fereastra');
|
||||
}
|
||||
return verdict(reasons.length ? 'REFUSE' : 'ALLOW');
|
||||
function verdict(decision) {
|
||||
const measured = { amountUsd: amountUsd === null ? null : usdText(amountUsd), windowUsd: usdText(windowUsd), windowCount, windowStart, historyCounted: windowCount };
|
||||
const inputsHash = hashOf(i); const corp = { v: 1, kind: KIND_VERDICT, policyId: policy.id, policyHash, inputsHash, decision, reasons: reasons.filter(Boolean), unmeasured, measured };
|
||||
return { ...corp, verdictHash: hashOf(corp) };
|
||||
// `rules`: the named rules that refused (forma, activ, contrapartida, curs, limita, fereastra), OUTSIDE the hashed body, so the
|
||||
// verdictHash of every receipt already issued stays what it was
|
||||
return { ...corp, verdictHash: hashOf(corp), rules: [...rules].sort() };
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user