fix: harden Base manifest recovery

This commit is contained in:
golem
2026-08-21 16:16:12 -06:00
parent 90b0a11b8a
commit 6dee960d15
7 changed files with 119 additions and 32 deletions
+12 -3
View File
@@ -35,11 +35,20 @@ export function validatePublicManifest(manifest) {
assertActors(manifest.actors);
for (const field of optionalFields) if (Object.hasOwn(manifest, field)) assertPublicUrl(manifest[field], field);
if (manifest.network === "baseSepolia") {
if (Object.hasOwn(manifest, "rpcUrl") && new URL(manifest.rpcUrl).protocol !== "https:") {
for (const field of ["rpcUrl", "explorerBaseUrl"]) {
if (!Object.hasOwn(manifest, field)) throw new Error(`manifest baseSepolia is missing ${field}`);
}
if (new URL(manifest.rpcUrl).protocol !== "https:") {
throw new Error("manifest Base Sepolia rpcUrl must use HTTPS");
}
if (Object.hasOwn(manifest, "explorerBaseUrl") && manifest.explorerBaseUrl !== "https://sepolia.basescan.org") {
throw new Error("manifest Base Sepolia explorerBaseUrl must use BaseScan");
if (manifest.explorerBaseUrl !== "https://sepolia.basescan.org") {
throw new Error("manifest Base Sepolia explorerBaseUrl must use the BaseScan root");
}
if (manifest.actors.length !== 2 || manifest.actors[0].label !== "Presenter" || manifest.actors[1].label !== "Recipient") {
throw new Error("manifest baseSepolia actors must contain exactly Presenter and Recipient");
}
if (manifest.owner.toLowerCase() !== manifest.actors[0].address.toLowerCase()) {
throw new Error("manifest owner must be the Presenter");
}
}
}