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
+19 -7
View File
@@ -45,7 +45,7 @@ test("direct manifest CLIs print the exact educational warning", async () => {
});
});
test("finalizer confirms a nested public actor manifest and preserves omitted Base URLs", async () => {
test("finalizer confirms the exact Base public URLs and Presenter/Recipient actors", async () => {
await withFixture(async (root) => {
const pending = manifest({ network: "baseSepolia", chainId: 84532, deploymentBlock: 0 });
await writeJson(join(root, "deployments", "pending.json"), pending);
@@ -53,9 +53,12 @@ test("finalizer confirms a nested public actor manifest and preserves omitted Ba
const output = await finalizeDeployment({ root, rpc: fakeRpc({ chainId: "0x14a34" }) });
assert.deepEqual(output.manifest, { ...pending, deploymentBlock: 42 });
assert.equal(Object.hasOwn(output.manifest, "rpcUrl"), false);
assert.equal(Object.hasOwn(output.manifest, "explorerBaseUrl"), false);
assert.deepEqual(output.manifest.actors, [{ label: "owner", address: OWNER }]);
assert.equal(output.manifest.rpcUrl, "https://sepolia.base.org");
assert.equal(output.manifest.explorerBaseUrl, "https://sepolia.basescan.org");
assert.deepEqual(output.manifest.actors, [
{ label: "Presenter", address: OWNER },
{ label: "Recipient", address: "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" },
]);
});
});
@@ -145,6 +148,7 @@ test("upgrade finalizer verifies receipt, event, slot, artifact-driven state and
const output = await finalizeUpgrade({ root, rpc: fakeUpgradeRpc() });
assert.equal(output.mode, "upgrade");
assert.equal(output.upgradeBlock, 90);
assert.deepEqual(output.manifest, { ...before, implementation: V2_IMPLEMENTATION });
for (const name of ["anvil.json", "active.json"]) {
const confirmed = await readJson(join(root, "deployments", name));
@@ -177,6 +181,7 @@ test("upgrade finalizer rejects proxy, deployment-block, and actor identity muta
test("upgrade finalizer leaves confirmed files untouched for failed receipt, missing event, live mismatch, and unknown mode", async () => {
const cases = [
["failed receipt", fakeUpgradeRpc({ receiptStatus: "0x0" }), null, /successful/],
["zero receipt block", fakeUpgradeRpc({ receiptBlock: "0x0" }), null, /nonzero/],
["missing Upgraded event", fakeUpgradeRpc({ omitUpgradeLog: true }), null, /Upgraded/],
["wrong live version", fakeUpgradeRpc({ version: 1n }), null, /version/],
["slot mismatch", fakeUpgradeRpc({ slot: IMPLEMENTATION }), null, /slot/],
@@ -300,12 +305,19 @@ function manifest(overrides = {}) {
network: baseSepolia ? "baseSepolia" : "anvil",
chainId: baseSepolia ? 84532 : 31337,
deploymentBlock: 1,
...(baseSepolia ? {} : { rpcUrl: "http://127.0.0.1:8545" }),
...(baseSepolia
? { rpcUrl: "https://sepolia.base.org", explorerBaseUrl: "https://sepolia.basescan.org" }
: { rpcUrl: "http://127.0.0.1:8545" }),
token: TOKEN,
proxy: PROXY,
implementation: IMPLEMENTATION,
owner: OWNER,
actors: baseSepolia ? [{ label: "owner", address: OWNER }] : localActors(),
actors: baseSepolia
? [
{ label: "Presenter", address: OWNER },
{ label: "Recipient", address: "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" },
]
: localActors(),
...overrides,
};
}
@@ -456,7 +468,7 @@ function fakeUpgradeRpc(overrides = {}) {
}
if (method === "eth_getTransactionReceipt") return {
status: overrides.receiptStatus ?? "0x1",
blockNumber: "0x5a",
blockNumber: overrides.receiptBlock ?? "0x5a",
logs: overrides.omitUpgradeLog || params[0] === DECLARED_CALL_HASH
? [] : [{ address: PROXY, topics: [UPGRADED_TOPIC, wordForRpc(V2_IMPLEMENTATION)], data: "0x" }],
};