x402 payment probe: the mock node serves only recorded code (a missing field is a JSON-RPC error, never '0x'); EOA recordings carry code 0x explicitly; control 14 states the empty code explicitly

This commit is contained in:
Aere Network 2026-10-12 00:04:04 +03:00
parent 54028e07f4
commit 092ea48988
3 changed files with 6 additions and 2 deletions

View File

@ -3,6 +3,7 @@
"recordedAt": "2026-09-29T20:23:48.503Z",
"rpc": "https://testnet-rpc.aere.network",
"chainId": "0x6d61",
"code": "0x",
"receipts": {
"0xd70d44785359419a460226d3c54e8f76375332a5cf8634421b04e30b47e4c16e": {
"blockHash": "0x57b530673634ee3454a25cf2fef87ae019bdb7f7dc29041309f7248e5bb637ab",

View File

@ -3,6 +3,7 @@
"recordedAt": "2026-09-29T21:42:19.343Z",
"rpc": "https://testnet-rpc.aere.network",
"chainId": "0x6d61",
"code": "0x",
"receipts": {
"0xd00d81dbeac63874f11146b10008eb614a0c8c550176ed1e46a5989de41f2d20": {
"blockHash": "0x2b37241d2181dadfaa03f8a07d84cc268556782a8c73b14435b82b6e0415b6bd",

View File

@ -31,7 +31,9 @@ async function rpcDin(rec) {
if (q.method === 'eth_chainId') result = rec.chainId;
else if (q.method === 'eth_getTransactionReceipt') result = rec.receipts[String(q.params[0]).toLowerCase()] || null;
else if (q.method === 'eth_getLogs') result = rec.transfersOut;
else if (q.method === 'eth_getCode') result = rec.code || '0x';
// 2026-10-11 (D-FAZA2-04b, R2): macheta serveste numai ce e INREGISTRAT; o inregistrare fara `code` nu devine "fara cod",
// ci o eroare JSON-RPC, pe care verificatorul trebuie sa o trateze ca necunoscut (inregistrarile EOA poarta explicit "0x")
else if (q.method === 'eth_getCode') { if (rec.code === undefined) { res.writeHead(200, { 'content-type': 'application/json' }); res.end(JSON.stringify({ jsonrpc: '2.0', id: q.id, error: { code: -32000, message: 'World state unavailable' } })); return; } result = rec.code; }
res.writeHead(200, { 'content-type': 'application/json' }); res.end(JSON.stringify({ jsonrpc: '2.0', id: q.id, result }));
}); });
await new Promise((r) => srv.listen(0, '127.0.0.1', r));
@ -74,7 +76,7 @@ try {
cer(pica(await judeca(dovada2, r12), e2), '12. CONTROL: un singur octet schimbat in codul de pe lant -> INVALID');
const d13 = copie(dovada2); d13.walletContract.agentSigner = '0x' + '22'.repeat(20);
cer(pica(await judeca(d13, inreg2), e2), '13. CONTROL: dosarul numeste alt semnatar al agentului decat cel din codul de pe lant -> INVALID');
const r14 = copie(inreg2); delete r14.code;
const r14 = copie(inreg2); r14.code = '0x'; // 2026-10-11: controlul spune EXPLICIT "cont fara cod"; o inregistrare fara camp e tacere, nu absenta (R2)
cer(pica(await judeca(dovada2, r14), e2), '14. CONTROL: la adresa portofelului nu e niciun cod (un cont cu o cheie), dar dosarul spune 2-din-2 -> INVALID');
} catch (e) { cer(false, `proba s-a oprit: ${String(e.message || e).slice(0, 160)}`); }
console.log(`\nverifica-plati: ${ok}/${ok + rau} ${rau ? 'CU ESECURI' : 'cum trebuia'}`);