Files
SGF/scripts/settlement-page-bench.mjs
T
2026-11-04 09:37:20 +02:00

14 lines
1.7 KiB
JavaScript

import fs from 'node:fs';import path from 'node:path';import {spawnSync} from 'node:child_process';
const state=JSON.parse(fs.readFileSync('C:/laragon/data/sgf-tempo/run/modular-regression-current.json','utf8')),tag=process.argv[2];
if(state.port!==55439||!/^[a-f0-9]{12}$/.test(tag??''))throw Error('Owned QA tag required');
const root=path.join(state.root,'private/settlement-page-'+tag),settings=path.join(root,'settings.json');
for(const strategy of ['legacy','page25','page100','focus']){
const output=path.join(root,'settlement-bench-'+strategy+'.json');if(fs.existsSync(output))continue;
const at=Date.now(),r=spawnSync('C:/laragon/tools/sgf-tempo/php-8.4.27/php.exe',['-d','memory_limit=512M','scripts/payable-history-sgf-proof.php',settings,'settlement-page-bench',strategy],{encoding:'utf8',windowsHide:true,maxBuffer:1024*1024});
fs.writeFileSync(path.join(root,'bench-'+strategy+'-'+at+'.log'),(r.stdout??'')+(r.stderr??''));if(r.status!==0||!fs.existsSync(output))throw Error('Private measurement failed: '+root);process.stdout.write(r.stdout);
}
const read=s=>JSON.parse(fs.readFileSync(path.join(root,'settlement-bench-'+s+'.json'),'utf8')),old=read('legacy');
for(const size of [25,100])for(const table of ['payments','proposals','allocations','events'])if(old.window_fingerprints[table][size]!==read('page'+size).window_fingerprints[table][size])throw Error('Legacy and page facts differ');
if(old.original_payment_fingerprint!==read('focus').original_payment_fingerprint||read('focus').original_unallocated_minor!==41)throw Error('Original full-history amount differs');
console.log(JSON.stringify({all_four_windows_equal:true,full_history_balance_equal:true,indices_added:false}));