import assert from'node:assert/strict';import{readFileSync}from'node:fs';import{publicationAtomicSites,publicationInstructionSites,publicationCallSites}from'./lock-metrics-publication-inputs-proof.mjs';import{metricsCallSites}from'./lock-metrics-inputs-proof.mjs'; const text=n=>readFileSync('scripts/os-acceptance/'+n,'utf8');const exact=(s,a,b)=>{assert.equal(s.split(a).length,2,a);return s.replace(a,b)};const exported=(s,n,v)=>{const re=new RegExp('export const '+n+'=.*?;\\n');assert.equal((s.match(new RegExp(re.source,'g'))??[]).length,1,n);return s.replace(re,'export const '+n+'='+JSON.stringify(v)+';\n')}; export function watchdogParentDerivations(){const names=['frame-inputs-proof','frame-proof','publication-inputs-proof','publication-proof','progress-inputs-proof','progress-proof'],mapping=Object.fromEntries([...names.map(n=>['lock-metrics-'+n+'.mjs','cpu-watchdog-'+n+'.mjs']),['lock-metrics-inputs-proof.mjs','cpu-watchdog-metrics-inputs-proof.mjs'],['lock-metrics-proof.mjs','cpu-watchdog-metrics-proof.mjs']]);const out={};for(const[from,to]of Object.entries(mapping)){let s=text(from);for(const[a,b]of Object.entries(mapping))s=s.replaceAll('./'+a,'./'+b);out[to]=s;} let n='cpu-watchdog-publication-inputs-proof.mjs',s=out[n];s=exact(s,"['publicationCycle',2088]","['publicationCycle',2084]");s=exported(s,'publicationAtomicSites',{...publicationAtomicSites,publicationCycle:publicationAtomicSites.publicationCycle.map(([at,op])=>[at-4,op])});s=exported(s,'publicationInstructionSites',{...publicationInstructionSites,publicationCycle:publicationInstructionSites.publicationCycle.map(([at,op])=>[at-4,op])});s=exported(s,'publicationCallSites',publicationCallSites.map(([name,at,...rest])=>[name,name==='publicationCycle'?at-4:at,...rest]));out[n]=s; n='cpu-watchdog-progress-inputs-proof.mjs';out[n]=exact(out[n],'9648d971bcbe9c81f3cfdb18091fccdfb80c7c429d922c77112dc896a8b60741','08ff75564c7899771d33dbe5598c00d63902b4534e0ddbf1eea8479dab92e53b'); n='cpu-watchdog-metrics-inputs-proof.mjs';s=exported(out[n],'metricsCodeHashes',{metricsCycle:[1428,'85f42826c4d0a6564438edee8a71b7d7532660dc33cfd8de868f9202efaf6638'],metricsDrive:[1192,'52ef000e71d6412929b9a9b4206e77d9b02315383dbe51ef82b8a88434a320e0'],metricsGrant:[176,'ff2c2ca9c7f75760ceb1614b0abb54b7cb9c17924dfe9c0b817cbf1c9f3aeecd'],metricsCollect:[144,'8a69620e27d7865647c91e2601eb707ee2b02ac764e6693bfcce08d0604cdb6c'],metricsRecord:[428,'5b6f981b1f811224d65b453d036a0eeeaf11798718d20b48fd306023f6fce4da']});s=exported(s,'metricsCallSites',metricsCallSites.map(([name,at,to])=>[name,name==='metricsDrive'?at-(at===456?4:8):at,to]));out[n]=exact(s,'metricsCompiledCodeBytes:3380','metricsCompiledCodeBytes:3368');return out;}