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
+43
View File
@@ -225,6 +225,20 @@ contract ScriptPreflightTest is Test {
harness.readManifest(path, true);
}
function testActorObjectWithExtraKeyIsRejected() public {
string memory path = _writeAnvilManifestWithExtraActorKey("note", "public");
_etchManifestContracts();
vm.expectRevert(abi.encodeWithSelector(DemoScript.InvalidManifestSchema.selector, uint256(0)));
harness.readManifest(path, true);
}
function testActorObjectWithSecretBearingKeyIsRejected() public {
string memory path = _writeAnvilManifestWithExtraActorKey("privateKey", "not-a-key");
_etchManifestContracts();
vm.expectRevert(abi.encodeWithSelector(DemoScript.InvalidManifestSchema.selector, uint256(0)));
harness.readManifest(path, true);
}
function testBaseSepoliaManifestUsesCamelCaseAndOmitsUnavailableUrls() public {
string memory path = _writePublicBaseManifest();
vm.chainId(84532);
@@ -404,6 +418,35 @@ contract ScriptPreflightTest is Test {
);
}
function _writeAnvilManifestWithExtraActorKey(string memory key, string memory value)
internal
returns (string memory path)
{
path = string.concat(fixtureDir, "/extra-actor-key.json");
vm.writeFile(
path,
string.concat(
'{"schemaVersion":1,"network":"anvil","chainId":31337,"deploymentBlock":1,"rpcUrl":"http://127.0.0.1:8545","token":"',
vm.toString(TOKEN),
'","proxy":"',
vm.toString(PROXY),
'","implementation":"',
vm.toString(IMPLEMENTATION),
'","owner":"',
vm.toString(OWNER),
'","actors":[{"label":"owner","address":"',
vm.toString(OWNER),
'","',
key,
'":"',
value,
'"},{"label":"Alice","address":"',
vm.toString(ALICE),
'"},{"label":"Bob","address":"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC"}]}'
)
);
}
function _writePublicBaseManifest() internal returns (string memory path) {
path = string.concat(fixtureDir, "/public-base-manifest.json");
vm.writeFile(