Skip to content

Commit

Permalink
Fix Specification_Test
Browse files Browse the repository at this point in the history
  • Loading branch information
Inphi committed Jun 4, 2024
1 parent 70912c0 commit 3ba6d80
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/contracts-bedrock/scripts/ForgeArtifacts.sol
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ library ForgeArtifacts {
{
string memory pathExcludesPat;
for (uint256 i = 0; i < pathExcludes.length; i++) {
pathExcludesPat = string.concat(pathExcludesPat, " -path ", pathExcludes[i]);
pathExcludesPat = string.concat(pathExcludesPat, " -path \"", pathExcludes[i], "\"");
if (i != pathExcludes.length - 1) {
pathExcludesPat = string.concat(pathExcludesPat, " -o ");
}
Expand Down
12 changes: 11 additions & 1 deletion packages/contracts-bedrock/test/Specs.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ contract Specification_Test is CommonTest {

mapping(string => mapping(bytes4 => Spec)) specs;
mapping(string => uint256) public numEntries;
uint256 numSpecs;

function setUp() public override {
super.setUp();
Expand Down Expand Up @@ -376,14 +377,18 @@ contract Specification_Test is CommonTest {
_addSpec({ _name: "SystemConfig", _sel: _getSel("L1_CROSS_DOMAIN_MESSENGER_SLOT()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("L1_ERC_721_BRIDGE_SLOT()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("L1_STANDARD_BRIDGE_SLOT()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("L2_OUTPUT_ORACLE_SLOT()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("OPTIMISM_PORTAL_SLOT()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("OPTIMISM_MINTABLE_ERC20_FACTORY_SLOT()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("BATCH_INBOX_SLOT()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("gasPayingToken()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("gasPayingTokenName()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("gasPayingTokenSymbol()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("isCustomGasToken()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("DISPUTE_GAME_FACTORY_SLOT()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("disputeGameFactory()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("setGasConfigEcotone(uint32,uint32)") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("basefeeScalar()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("blobfeeScalar()") });

// ProxyAdmin
_addSpec({ _name: "ProxyAdmin", _sel: _getSel("addressManager()") });
Expand Down Expand Up @@ -645,6 +650,7 @@ contract Specification_Test is CommonTest {
function _addSpec(string memory _name, bytes4 _sel, Role _auth, bool _pausable) internal {
specs[_name][_sel] = Spec({ name: _name, sel: _sel, auth: _auth, pausable: _pausable });
numEntries[_name]++;
numSpecs++;
}

/// @dev Adds a spec for a function with no auth.
Expand All @@ -666,9 +672,11 @@ contract Specification_Test is CommonTest {
function testContractAuth() public {
string[] memory pathExcludes = new string[](1);
pathExcludes[0] = "src/dispute/interfaces/*";
pathExcludes[0] = "src/dispute/lib/*";
Abi[] memory abis =
ForgeArtifacts.getContractFunctionAbis("src/{L1,dispute,governance,universal/ProxyAdmin.sol}", pathExcludes);

uint256 numCheckedEntries = 0;
for (uint256 i = 0; i < abis.length; i++) {
string memory contractName = abis[i].contractName;
assertEq(
Expand All @@ -694,7 +702,9 @@ contract Specification_Test is CommonTest {
spec.sel,
string.concat("Specification_Test: invalid ABI ", contractName, "::", abiEntry.fnName)
);
numCheckedEntries++;
}
}
assertEq(numSpecs, numCheckedEntries, "Some specs were not checked");
}
}

0 comments on commit 3ba6d80

Please sign in to comment.