Commit 6d874d5f authored by smartcontracts's avatar smartcontracts Committed by GitHub

feat: add sol-style-malformed-revert locally (#12341)

Adds sol-style-malformed-revert to local semgrep and fixes the
rule so that it actually works. Fixes a couple of findings that
the updated rule discovered.
parent 35bbd80e
......@@ -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
......@@ -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");
......
......@@ -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) {
......
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