diff --git a/experiments/analysis-efficiency/native-entry.mjs b/experiments/analysis-efficiency/native-entry.mjs index d6666d5550..f8a6db2563 100644 --- a/experiments/analysis-efficiency/native-entry.mjs +++ b/experiments/analysis-efficiency/native-entry.mjs @@ -154,7 +154,7 @@ export const measureNativeEntry = async ({ try { // DOS addresses follow the actual admitted load image. A file header // offset is not a provider address or proof of runtime execution. - let loadImage; + let loadImage, loadImageEvidenceId; if (seed === undefined) { const imageEvidence = await call("inspect_native_load_image", {}); loadImage = normalized(imageEvidence); @@ -162,6 +162,7 @@ export const measureNativeEntry = async ({ throw new Error( "The shipped DOS load image was not independently verified", ); + loadImageEvidenceId = imageEvidence.evidence_id; seed = loadImage.entry.linear_address; } const address = seed; @@ -197,10 +198,20 @@ export const measureNativeEntry = async ({ }), evidence_ids: selected.retainedViews === undefined - ? [containing.evidence_id, info.evidence_id, ...mainEvidenceIds] + ? [ + containing.evidence_id, + info.evidence_id, + ...mainEvidenceIds, + ...(loadImageEvidenceId === undefined + ? [] + : [loadImageEvidenceId]), + ] : { containing_procedure: containing.evidence_id, function_dossier: info.evidence_id, + ...(loadImageEvidenceId === undefined + ? {} + : { native_load_image: loadImageEvidenceId }), retained_views: selected.retainedViewEvidence, ...(selected.summaryEvidenceId === undefined ? {} diff --git a/tests/boundary/cli/nativeEfficiencyComparison.test.ts b/tests/boundary/cli/nativeEfficiencyComparison.test.ts index 9640222203..17d68a600d 100644 --- a/tests/boundary/cli/nativeEfficiencyComparison.test.ts +++ b/tests/boundary/cli/nativeEfficiencyComparison.test.ts @@ -15,6 +15,7 @@ const generate = ` import {measureNativeEntry} from './experiments/analysis-efficiency/native-entry.mjs'; const sha='0'.repeat(64); const duplicate=process.argv[1]==='duplicate'; +const dos=process.argv[1]==='dos'; const dossier={procedure:{address:'0x1000'},pseudocode:'return;',callers:[],callees:[]}; class ToolFailure extends Error {} const build=async digit=>{ @@ -22,6 +23,7 @@ const build=async digit=>{ let ordinal=0; const call=async(name,args)=>{ if(name==='open_binary'||name==='close_binary')return {}; + if(name==='inspect_native_load_image')return {evidence_id:'ev_'+digit.repeat(63)+'6',normalized_result:{status:'verified',entry:{linear_address:'0x1000'}}}; if(name==='resolve_containing_procedure')return {evidence_id:parent,normalized_result:{found:true}}; if(name==='analyze_function')return {evidence_id:parent,subject:{digest:{sha256:sha}},normalized_result:dossier}; const id='ev_'+digit.repeat(63)+(duplicate?1:++ordinal); @@ -30,11 +32,26 @@ const build=async digit=>{ const item=facet==='pseudocode'?{text:dossier.pseudocode,unit:'utf16-code-units'}:dossier[facet]; return {evidence_id:id,normalized_result:{parent_evidence_id:parent,artifact:{sha256:sha},item,coverage:{exhausted:true},limitations:[],unknowns:[]}}; }; - return measureNativeEntry({seed:'0x1000',values:{path:'/selected/input','native-question':'entry-views'},call,inputSha:sha,ToolFailure}); + return measureNativeEntry({seed:dos?undefined:'0x1000',values:{path:'/selected/input','native-question':'entry-views'},call,inputSha:sha,ToolFailure}); }; process.stdout.write(JSON.stringify([await build('1'),await build('2')])); `; +it("retains the DOS load-image source for its facts and derived entry seed", async () => { + const { stdout } = await execute(process.execPath, [ + "--input-type=module", + "-e", + generate, + "dos", + ]); + const [answer] = JSON.parse(stdout); + expect(answer).toMatchObject({ + entry_address: "0x1000", + load_image: { status: "verified", entry: { linear_address: "0x1000" } }, + evidence_ids: { native_load_image: "ev_" + "1".repeat(63) + "6" }, + }); +}); + it("rejects a producer that reuses a view identity across facets", async () => { await expect( execute(process.execPath, [