fix: harden Base manifest recovery
This commit is contained in:
@@ -363,8 +363,15 @@ function assertManifestUrls(manifest, spec) {
|
||||
if (Object.hasOwn(manifest, "explorerBaseUrl")) throw new Error("manifest anvil must omit explorerBaseUrl");
|
||||
return;
|
||||
}
|
||||
for (const field of OPTIONAL_MANIFEST_FIELDS) {
|
||||
if (Object.hasOwn(manifest, field)) assertPublicUrl(manifest[field], field);
|
||||
for (const field of ["rpcUrl", "explorerBaseUrl"]) {
|
||||
if (!Object.hasOwn(manifest, field)) throw new Error(`manifest baseSepolia is missing ${field}`);
|
||||
assertPublicUrl(manifest[field], field);
|
||||
}
|
||||
if (new URL(manifest.rpcUrl).protocol !== "https:") {
|
||||
throw new Error("manifest Base Sepolia rpcUrl must use HTTPS");
|
||||
}
|
||||
if (manifest.explorerBaseUrl !== "https://sepolia.basescan.org") {
|
||||
throw new Error("manifest Base Sepolia explorerBaseUrl must use the BaseScan root");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,14 +405,13 @@ function assertActorConfiguration(manifest) {
|
||||
throw new Error("manifest anvil actors must match the documented local actor configuration");
|
||||
}
|
||||
} else {
|
||||
const configured = actors.length === 2 && actors[0].label === "Presenter" && actors[1].label === "Recipient";
|
||||
const legacy = actors.length === 1 && actors[0].label === "owner"
|
||||
&& !Object.hasOwn(manifest, "rpcUrl") && !Object.hasOwn(manifest, "explorerBaseUrl");
|
||||
if (!configured && !legacy) {
|
||||
throw new Error("manifest baseSepolia actors must be Presenter and Recipient");
|
||||
if (actors.length !== 2 || actors[0].label !== "Presenter" || actors[1].label !== "Recipient") {
|
||||
throw new Error("manifest baseSepolia actors must contain exactly Presenter and Recipient");
|
||||
}
|
||||
}
|
||||
if (actors[0].address.toLowerCase() !== owner.toLowerCase()) throw new Error("manifest owner must be actor zero");
|
||||
if (actors[0].address.toLowerCase() !== owner.toLowerCase()) {
|
||||
throw new Error(`manifest owner must be the ${network === "baseSepolia" ? "Presenter" : "first actor"}`);
|
||||
}
|
||||
}
|
||||
|
||||
function rejectProhibitedStringValues(value, path = "") {
|
||||
|
||||
Reference in New Issue
Block a user