Files
rea/scripts/lib/real-hopper-inventory.mjs
T
morluto 405732a7f5 fix: correct native inventories and bridge error classification (#503)
* fix(hopper): preserve normalized inventory addresses

* test(hopper): isolate real inventory verification

* fix(native): preserve otool addresses and section alignment

* fix: preserve address spaces in call path evidence

* fix(hopper): distinguish request validation from provider faults

* fix(native): retain tool inventory facts and reject failed signatures
2026-10-04 17:25:09 +08:00

48 lines
1.5 KiB
JavaScript

import assert from "node:assert/strict";
import { HOPPER_PROVIDER_IDENTITY } from "../../dist/hopper/HopperProvider.js";
import {
requireMcpResult,
requireEvidenceProvider,
} from "./mcp-verifier-results.mjs";
/** Verify real Hopper inventories and address filters through the MCP transport. */
export async function verifyHopperInventories(client, options) {
const inventoryCounts = {};
for (const operation of ["list_strings", "list_names"]) {
const called = await client.callTool(
{ name: operation, arguments: {} },
options,
);
const inventory = requireMcpResult(called, operation);
requireEvidenceProvider(called, operation, HOPPER_PROVIDER_IDENTITY.id);
assert.ok(
Array.isArray(inventory) && inventory.length > 0,
`${operation} omitted the real fixture inventory`,
);
let previous = -1n;
for (const item of inventory) {
assert.match(item.address, /^0x[0-9a-f]+$/u);
assert.equal(typeof item.value, "string");
const address = BigInt(item.address);
assert.ok(
address > previous,
`${operation} is not numerically address-sorted`,
);
previous = address;
}
const filtered = requireMcpResult(
await client.callTool(
{
name: operation,
arguments: { address: inventory[0].address },
},
options,
),
operation,
);
assert.deepEqual(filtered, [inventory[0]]);
inventoryCounts[operation] = inventory.length;
}
return inventoryCounts;
}