diff --git a/.semgrep/sol-rules.yaml b/.semgrep/sol-rules.yaml index a7a8a0f19c7c..9af39ff64043 100644 --- a/.semgrep/sol-rules.yaml +++ b/.semgrep/sol-rules.yaml @@ -67,4 +67,16 @@ rules: - packages/contracts-bedrock/src/cannon/MIPS.sol - packages/contracts-bedrock/src/cannon/MIPS2.sol - packages/contracts-bedrock/src/cannon/libraries/MIPSMemory.sol + + - id: sol-style-malformed-revert + languages: [solidity] + severity: ERROR + message: Revert statement style is malformed + patterns: + - pattern: revert($MSG); + - pattern-not: revert $ERR(...); + - focus-metavariable: $MSG + - pattern-not-regex: \"(\w+:\s[^"]+)\" + paths: + exclude: - packages/contracts-bedrock/src/cannon/libraries/MIPSInstructions.sol diff --git a/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol b/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol index 9cb35f220866..91b508004e72 100644 --- a/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol +++ b/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol @@ -1289,7 +1289,9 @@ contract Deploy is Deployer { commands[1] = "-c"; commands[2] = string.concat("[[ -f ", filePath, " ]] && echo \"present\""); if (Process.run(commands).length == 0) { - revert("Cannon prestate dump not found, generate it with `make cannon-prestate` in the monorepo root."); + revert( + "Deploy: cannon prestate dump not found, generate it with `make cannon-prestate` in the monorepo root" + ); } commands[2] = string.concat("cat ", filePath, " | jq -r .pre"); mipsAbsolutePrestate_ = Claim.wrap(abi.decode(Process.run(commands), (bytes32))); @@ -1310,7 +1312,7 @@ contract Deploy is Deployer { commands[2] = string.concat("[[ -f ", filePath, " ]] && echo \"present\""); if (Process.run(commands).length == 0) { revert( - "MT-Cannon prestate dump not found, generate it with `make cannon-prestate-mt` in the monorepo root." + "Deploy: MT-Cannon prestate dump not found, generate it with `make cannon-prestate-mt` in the monorepo root" ); } commands[2] = string.concat("cat ", filePath, " | jq -r .pre"); diff --git a/packages/contracts-bedrock/scripts/deploy/DeployConfig.s.sol b/packages/contracts-bedrock/scripts/deploy/DeployConfig.s.sol index 4296e82c2166..9ffc6ca9a2c2 100644 --- a/packages/contracts-bedrock/scripts/deploy/DeployConfig.s.sol +++ b/packages/contracts-bedrock/scripts/deploy/DeployConfig.s.sol @@ -202,7 +202,9 @@ contract DeployConfig is Script { } catch { } } } - revert("l1StartingBlockTag must be a bytes32, string or uint256 or cannot fetch l1StartingBlockTag"); + revert( + "DeployConfig: l1StartingBlockTag must be a bytes32, string or uint256 or cannot fetch l1StartingBlockTag" + ); } function l2OutputOracleStartingTimestamp() public returns (uint256) {