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 58183b3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 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
14 changes: 12 additions & 2 deletions 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 @@ -368,22 +369,26 @@ contract Specification_Test is CommonTest {
_addSpec({ _name: "SystemConfig", _sel: _getSel("l1CrossDomainMessenger()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("l1ERC721Bridge()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("l1StandardBridge()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("l2OutputOracle()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("optimismPortal()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("optimismMintableERC20Factory()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("batchInbox()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("startBlock()") });
_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)"), _auth: Role.SYSTEMCONFIGOWNER });
_addSpec({ _name: "SystemConfig", _sel: _getSel("basefeeScalar()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("blobbasefeeScalar()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("maximumGasLimit()") });

// 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 58183b3

Please sign in to comment.