Commit 38db5117 authored by Michael Amadi's avatar Michael Amadi Committed by GitHub

update test folder so segrep require and revert checks pass (#12628)

* update test folder so that smegrep require and revert checks pass for it

* fix test
parent d317e96c
...@@ -80,7 +80,7 @@ contract SystemConfigInterop_Test is CommonTest { ...@@ -80,7 +80,7 @@ contract SystemConfigInterop_Test is CommonTest {
/// @dev Tests that adding a dependency as not the dependency manager reverts. /// @dev Tests that adding a dependency as not the dependency manager reverts.
function testFuzz_addDependency_notDependencyManager_reverts(uint256 _chainId) public { function testFuzz_addDependency_notDependencyManager_reverts(uint256 _chainId) public {
require(alice != _systemConfigInterop().dependencyManager(), "SystemConfigInterop_Test-100"); require(alice != _systemConfigInterop().dependencyManager(), "SystemConfigInterop_Test: 100");
vm.expectRevert("SystemConfig: caller is not the dependency manager"); vm.expectRevert("SystemConfig: caller is not the dependency manager");
vm.prank(alice); vm.prank(alice);
_systemConfigInterop().addDependency(_chainId); _systemConfigInterop().addDependency(_chainId);
...@@ -102,7 +102,7 @@ contract SystemConfigInterop_Test is CommonTest { ...@@ -102,7 +102,7 @@ contract SystemConfigInterop_Test is CommonTest {
/// @dev Tests that removing a dependency as not the dependency manager reverts. /// @dev Tests that removing a dependency as not the dependency manager reverts.
function testFuzz_removeDependency_notDependencyManager_reverts(uint256 _chainId) public { function testFuzz_removeDependency_notDependencyManager_reverts(uint256 _chainId) public {
require(alice != _systemConfigInterop().dependencyManager(), "SystemConfigInterop_Test-100"); require(alice != _systemConfigInterop().dependencyManager(), "SystemConfigInterop_Test: 100");
vm.expectRevert("SystemConfig: caller is not the dependency manager"); vm.expectRevert("SystemConfig: caller is not the dependency manager");
vm.prank(alice); vm.prank(alice);
_systemConfigInterop().removeDependency(_chainId); _systemConfigInterop().removeDependency(_chainId);
......
...@@ -131,7 +131,7 @@ contract GasPriceOracleEcotone_Test is GasPriceOracle_Test { ...@@ -131,7 +131,7 @@ contract GasPriceOracleEcotone_Test is GasPriceOracle_Test {
// Execute the function call // Execute the function call
vm.prank(depositor); vm.prank(depositor);
(bool success,) = address(l1Block).call(calldataPacked); (bool success,) = address(l1Block).call(calldataPacked);
require(success, "Function call failed"); require(success, "GasPriceOracleEcotone_Test: Function call failed");
} }
/// @dev Tests that `setEcotone` is only callable by the depositor. /// @dev Tests that `setEcotone` is only callable by the depositor.
...@@ -222,7 +222,7 @@ contract GasPriceOracleFjordActive_Test is GasPriceOracle_Test { ...@@ -222,7 +222,7 @@ contract GasPriceOracleFjordActive_Test is GasPriceOracle_Test {
vm.prank(depositor); vm.prank(depositor);
(bool success,) = address(l1Block).call(calldataPacked); (bool success,) = address(l1Block).call(calldataPacked);
require(success, "Function call failed"); require(success, "GasPriceOracleFjordActive_Test: Function call failed");
} }
/// @dev Tests that `setFjord` cannot be called when Fjord is already activate /// @dev Tests that `setFjord` cannot be called when Fjord is already activate
......
...@@ -138,7 +138,10 @@ contract AnchorStateRegistry_TryUpdateAnchorState_Test is AnchorStateRegistry_In ...@@ -138,7 +138,10 @@ contract AnchorStateRegistry_TryUpdateAnchorState_Test is AnchorStateRegistry_In
function test_setAnchorState_invalidGame_fails() public { function test_setAnchorState_invalidGame_fails() public {
// Confirm that the anchor state is older than the game state. // Confirm that the anchor state is older than the game state.
(Hash root, uint256 l2BlockNumber) = anchorStateRegistry.anchors(gameProxy.gameType()); (Hash root, uint256 l2BlockNumber) = anchorStateRegistry.anchors(gameProxy.gameType());
require(l2BlockNumber < gameProxy.l2BlockNumber(), "l2BlockNumber < gameProxy.l2BlockNumber()"); require(
l2BlockNumber < gameProxy.l2BlockNumber(),
"AnchorStateRegistry_TryUpdateAnchorState_Test: l2BlockNumber < gameProxy.l2BlockNumber()"
);
// Mock the state that we want. // Mock the state that we want.
vm.mockCall( vm.mockCall(
......
...@@ -2641,7 +2641,7 @@ contract FaultDispute_1v1_Actors_Test is FaultDisputeGame_Init { ...@@ -2641,7 +2641,7 @@ contract FaultDispute_1v1_Actors_Test is FaultDisputeGame_Init {
(uint256 numMovesA,) = dishonest.move(); (uint256 numMovesA,) = dishonest.move();
(uint256 numMovesB, bool success) = honest.move(); (uint256 numMovesB, bool success) = honest.move();
require(success, "Honest actor's moves should always be successful"); require(success, "FaultDispute_1v1_Actors_Test: Honest actor's moves should always be successful");
// If both actors have run out of moves, we're done. // If both actors have run out of moves, we're done.
if (numMovesA == 0 && numMovesB == 0) break; if (numMovesA == 0 && numMovesB == 0) break;
......
...@@ -69,7 +69,7 @@ contract FaultDisputeGame_Solvency_Invariant is FaultDisputeGame_Init { ...@@ -69,7 +69,7 @@ contract FaultDisputeGame_Solvency_Invariant is FaultDisputeGame_Init {
assertEq(DEFAULT_SENDER.balance, type(uint96).max - rootBond); assertEq(DEFAULT_SENDER.balance, type(uint96).max - rootBond);
assertEq(address(actor).balance, actor.totalBonded() + rootBond); assertEq(address(actor).balance, actor.totalBonded() + rootBond);
} else { } else {
revert("unreachable"); revert("FaultDisputeGame_Solvency_Invariant: unreachable");
} }
assertEq(address(gameProxy).balance, 0); assertEq(address(gameProxy).balance, 0);
......
...@@ -157,7 +157,9 @@ contract ProtocolHandler is TestBase, StdUtils, Actors { ...@@ -157,7 +157,9 @@ contract ProtocolHandler is TestBase, StdUtils, Actors {
bytes32 realSalt = keccak256(abi.encode(remoteToken, name, symbol, decimals)); bytes32 realSalt = keccak256(abi.encode(remoteToken, name, symbol, decimals));
// Foundry invariant erroneously show other unrelated invariant breaking // Foundry invariant erroneously show other unrelated invariant breaking
// when this deployment fails due to a create2 collision, so we revert eagerly instead // when this deployment fails due to a create2 collision, so we revert eagerly instead
require(MESSENGER.superTokenAddresses(chainId, realSalt) == address(0), "skip duplicate deployment"); require(
MESSENGER.superTokenAddresses(chainId, realSalt) == address(0), "ProtocolHandler: skip duplicate deployment"
);
// what we use in the tests to walk around two contracts needing two different addresses // what we use in the tests to walk around two contracts needing two different addresses
// tbf we could be using CREATE1, but this feels more verbose // tbf we could be using CREATE1, but this feels more verbose
......
...@@ -89,7 +89,7 @@ contract MockL2ToL2CrossDomainMessenger { ...@@ -89,7 +89,7 @@ contract MockL2ToL2CrossDomainMessenger {
function sendMessage(uint256 chainId, address, /*recipient*/ bytes calldata data) external { function sendMessage(uint256 chainId, address, /*recipient*/ bytes calldata data) external {
address crossChainRecipient = superTokenAddresses[chainId][superTokenInitDeploySalts[msg.sender]]; address crossChainRecipient = superTokenAddresses[chainId][superTokenInitDeploySalts[msg.sender]];
if (crossChainRecipient == msg.sender) { if (crossChainRecipient == msg.sender) {
require(false, "same chain"); require(false, "MockL2ToL2CrossDomainMessenger: same chain");
} }
(address recipient, uint256 amount) = _decodePayload(data); (address recipient, uint256 amount) = _decodePayload(data);
......
...@@ -84,7 +84,7 @@ contract ConfigurableCaller { ...@@ -84,7 +84,7 @@ contract ConfigurableCaller {
/// @dev Any call will revert /// @dev Any call will revert
contract Reverter { contract Reverter {
function doRevert() public pure { function doRevert() public pure {
revert("Reverter reverted"); revert("Reverter: Reverter reverted");
} }
fallback() external { fallback() external {
......
...@@ -93,7 +93,7 @@ contract CompatibilityFallbackHandler is DefaultCallbackHandler, ISignatureValid ...@@ -93,7 +93,7 @@ contract CompatibilityFallbackHandler is DefaultCallbackHandler, ISignatureValid
GnosisSafe safe = GnosisSafe(payable(msg.sender)); GnosisSafe safe = GnosisSafe(payable(msg.sender));
bytes32 messageHash = getMessageHashForSafe(safe, _data); bytes32 messageHash = getMessageHashForSafe(safe, _data);
if (_signature.length == 0) { if (_signature.length == 0) {
require(safe.signedMessages(messageHash) != 0, "Hash not approved"); require(safe.signedMessages(messageHash) != 0, "CompatibilityFallbackHandler: Hash not approved");
} else { } else {
safe.checkSignatures(messageHash, _data, _signature); safe.checkSignatures(messageHash, _data, _signature);
} }
......
...@@ -19,7 +19,7 @@ contract SimpleStorage { ...@@ -19,7 +19,7 @@ contract SimpleStorage {
contract Clasher { contract Clasher {
function upgradeTo(address) external pure { function upgradeTo(address) external pure {
revert("upgradeTo"); revert("Clasher: upgradeTo");
} }
} }
...@@ -228,7 +228,7 @@ contract Proxy_Test is Test { ...@@ -228,7 +228,7 @@ contract Proxy_Test is Test {
// not as the owner so that the call passes through. // not as the owner so that the call passes through.
// The implementation will revert so we can be // The implementation will revert so we can be
// sure that the call passed through. // sure that the call passed through.
vm.expectRevert(bytes("upgradeTo")); vm.expectRevert(bytes("Clasher: upgradeTo"));
proxy.upgradeTo(address(0)); proxy.upgradeTo(address(0));
{ {
......
...@@ -94,7 +94,6 @@ rules: ...@@ -94,7 +94,6 @@ rules:
- pattern-not-regex: \"([a-zA-Z0-9\s]+-[a-zA-Z0-9\s]+-[a-zA-Z0-9\s]+)\" - pattern-not-regex: \"([a-zA-Z0-9\s]+-[a-zA-Z0-9\s]+-[a-zA-Z0-9\s]+)\"
paths: paths:
exclude: exclude:
- packages/contracts-bedrock/test
- packages/contracts-bedrock/src/libraries/Bytes.sol - packages/contracts-bedrock/src/libraries/Bytes.sol
- packages/contracts-bedrock/src/legacy/LegacyMintableERC20.sol - packages/contracts-bedrock/src/legacy/LegacyMintableERC20.sol
- packages/contracts-bedrock/src/cannon/MIPS.sol - packages/contracts-bedrock/src/cannon/MIPS.sol
...@@ -116,7 +115,6 @@ rules: ...@@ -116,7 +115,6 @@ rules:
- pattern-not-regex: \"([a-zA-Z0-9\s]+-[a-zA-Z0-9\s]+-[a-zA-Z0-9\s]+)\" - pattern-not-regex: \"([a-zA-Z0-9\s]+-[a-zA-Z0-9\s]+-[a-zA-Z0-9\s]+)\"
paths: paths:
exclude: exclude:
- packages/contracts-bedrock/test
- packages/contracts-bedrock/src/cannon/libraries/MIPSInstructions.sol - packages/contracts-bedrock/src/cannon/libraries/MIPSInstructions.sol
- id: sol-style-use-abi-encodecall - id: sol-style-use-abi-encodecall
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment