fix: enforce optional manifest fields

This commit is contained in:
golem
2026-08-21 03:00:23 -06:00
parent c6bf8a683f
commit 54c893fdb7
4 changed files with 73 additions and 1 deletions
+3 -1
View File
@@ -159,7 +159,9 @@ function assertExactSchema(manifest) {
function assertManifestUrls(manifest, spec) {
if (manifest.network === "anvil") {
if (manifest.rpcUrl !== spec.rpcUrl) throw new Error("manifest anvil rpcUrl must use the local public endpoint");
if (Object.hasOwn(manifest, "rpcUrl") && manifest.rpcUrl !== spec.rpcUrl) {
throw new Error("manifest anvil rpcUrl must use the local public endpoint");
}
if (Object.hasOwn(manifest, "explorerBaseUrl")) throw new Error("manifest anvil must omit explorerBaseUrl");
return;
}
+13
View File
@@ -56,6 +56,19 @@ test("finalizer confirms a nested public actor manifest and preserves omitted Ba
});
});
test("finalizer accepts an Anvil manifest with omitted optional rpcUrl and preserves its absence", async () => {
await withFixture(async (root) => {
const pending = manifest({ deploymentBlock: 0 });
delete pending.rpcUrl;
await writeJson(join(root, "deployments", "pending.json"), pending);
await writeBroadcast(root, pending);
const output = await finalizeDeployment({ root, rpc: fakeRpc() });
assert.equal(Object.hasOwn(output.manifest, "rpcUrl"), false);
assert.equal(Object.hasOwn(await readJson(output.path), "rpcUrl"), false);
});
});
test("validator rejects the legacy parallel actor and explorer schema", () => {
assert.throws(
() => validateManifest(legacyManifest()),