Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .semgrep/rules/sol-rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,13 @@ rules:
message: Event parameters must be named using camelCase and must not be prefixed with underscore
pattern-either:
# Match parameters with underscore prefix
- pattern-regex: event\s+\w+\s*\([^)]*(?:address|uint\d*|int\d*|bytes\d*|bool|string)\s+(?:indexed\s+)?_\w+
- pattern-regex: event\s+\w+\s*\([^)]*\b(?:address|uint\d*|int\d*|bytes\d*|bool|string)\s+(?:indexed\s+)?_\w+
# Match unnamed parameters (type with optional indexed but no parameter name before comma or closing paren)
- pattern-regex: event\s+\w+\s*\([^)]*(?:address|uint\d*|int\d*|bytes\d*|bool|string)(?:\s+indexed)?\s*[,)]
- pattern-regex: event\s+\w+\s*\([^)]*\b(?:address|uint\d*|int\d*|bytes\d*|bool|string)\b(?:\s+indexed)?\s*[,)]
# Match parameters that are all uppercase (like NEW_OWNER)
- pattern-regex: event\s+\w+\s*\([^)]*(?:address|uint\d*|int\d*|bytes\d*|bool|string)\s+(?:indexed\s+)?[A-Z][A-Z0-9_]*\s*[,)]
- pattern-regex: event\s+\w+\s*\([^)]*\b(?:address|uint\d*|int\d*|bytes\d*|bool|string)\s+(?:indexed\s+)?[A-Z][A-Z0-9_]*\s*[,)]
paths:
exclude:
# LegacyMintableERC20 and the corresponding interface use legacy naming conventions.
- packages/contracts-bedrock/src/legacy/LegacyMintableERC20.sol
- packages/contracts-bedrock/interfaces/legacy/ILegacyMintableERC20Full.sol
6 changes: 6 additions & 0 deletions .semgrep/tests/sol-rules.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -725,4 +725,10 @@ contract SemgrepTest__sol_style_event_param_fmt {

// ruleid: sol-style-event-param-fmt
event OwnerChanged(address NEW_OWNER);

// ok: sol-style-event-param-fmt
event SomethingWithMint(uint256 mint);

// ruleid: sol-style-event-param-fmt
event SomethingWithMint(uint256 _mint);
}
6 changes: 3 additions & 3 deletions packages/contracts-bedrock/deploy-config/hardhat.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"gasPriceOracleBaseFeeScalar": 1368,
"gasPriceOracleBlobBaseFeeScalar": 810949,
"l2OutputOracleProposer": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
"l2OutputOracleChallenger": "0x6925B8704Ff96DEe942623d6FB5e946EF5884b63",
"l2OutputOracleChallenger": "0x9BA6e03D8B90dE867373Db8cF1A58d2F7F006b3A",
"l2GenesisBlockBaseFeePerGas": "0x3B9ACA00",
"l2GenesisBlockGasLimit": "0x17D7840",
"baseFeeVaultRecipient": "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc",
Expand Down Expand Up @@ -53,8 +53,8 @@
"faultGameWithdrawalDelay": 302400,
"preimageOracleMinProposalSize": 126000,
"preimageOracleChallengePeriod": 86400,
"proofMaturityDelaySeconds": 12,
"disputeGameFinalityDelaySeconds": 6,
"proofMaturityDelaySeconds": 604800,
"disputeGameFinalityDelaySeconds": 302400,
"respectedGameType": 0,
"useFaultProofs": false,
"fundDevAccounts": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ interface IL1CrossDomainMessenger is ICrossDomainMessenger, IProxyAdminOwnedBase
function systemConfig() external view returns (ISystemConfig);
function version() external view returns (string memory);
function superchainConfig() external view returns (ISuperchainConfig);
function upgrade(ISystemConfig _systemConfig) external;

function __constructor__() external;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ interface IL1ERC721Bridge is IERC721Bridge, IProxyAdminOwnedBase {
error ReinitializableBase_ZeroInitVersion();

function initVersion() external view returns (uint8);
function upgrade(ISystemConfig _systemConfig) external;
function bridgeERC721(
address _localToken,
address _remoteToken,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ interface IL1StandardBridge is IStandardBridge, IProxyAdminOwnedBase {
event ETHWithdrawalFinalized(address indexed from, address indexed to, uint256 amount, bytes extraData);

function initVersion() external view returns (uint8);
function upgrade(ISystemConfig _systemConfig) external;
function depositERC20(
address _l1Token,
address _l2Token,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ interface IOptimismPortal2 is IProxyAdminOwnedBase {
function respectedGameType() external view returns (GameType);
function respectedGameTypeUpdatedAt() external view returns (uint64);
function systemConfig() external view returns (ISystemConfig);
function upgrade(IAnchorStateRegistry _anchorStateRegistry) external;
function version() external pure returns (string memory);

function __constructor__(uint256 _proofMaturityDelaySeconds) external;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ interface ISuperchainConfig is IProxyAdminOwnedBase {

function guardian() external view returns (address);
function initialize(address _guardian) external;
function upgrade() external;
function pause(address _identifier) external;
function unpause(address _identifier) external;
function pausable(address _identifier) external view returns (bool);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ interface ISystemConfig is IProxyAdminOwnedBase {
function startBlock() external view returns (uint256 startBlock_);
function transferOwnership(address newOwner) external; // nosemgrep
function unsafeBlockSigner() external view returns (address addr_);
function upgrade(uint256 _l2ChainId, ISuperchainConfig _superchainConfig) external;
function version() external pure returns (string memory);
function paused() external view returns (bool);
function superchainConfig() external view returns (ISuperchainConfig);
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-bedrock/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ test-dev *ARGS: build-go-ffi
# Default block number for the forked upgrade path.

export sepoliaBlockNumber := "9118951"
export mainnetBlockNumber := "23276717"
export mainnetBlockNumber := "23327678"

export pinnedBlockNumber := if env_var_or_default("FORK_BASE_CHAIN", "") == "mainnet" {
mainnetBlockNumber
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func processFile(artifactPath string) (*common.Void, []error) {
})
} else {
// Get the AST of OPCM's upgrade function.
opcmUpgradeAst, err := getOpcmUpgradeFunctionAst(opcmAst, "upgrade")
opcmUpgradeAst, err := getOpcmUpgradeFunctionAst(opcmAst, "_doChainUpgrade")
if err != nil {
return nil, []error{err}
}
Expand Down Expand Up @@ -314,8 +314,7 @@ func getOpcmUpgradeFunctionAst(opcmArtifact *solc.ForgeArtifact, upgradeFunction
if astNode.NodeType == "ContractDefinition" && astNode.Name == "OPContractsManagerUpgrader" {
for _, node := range astNode.Nodes {
if node.NodeType == "FunctionDefinition" &&
node.Name == upgradeFunctionName &&
node.Visibility == "external" {
node.Name == upgradeFunctionName {
opcmUpgradeFunctions = append(opcmUpgradeFunctions, node)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestGetOpcmUpgradeFunctionAst(t *testing.T) {
expectedError string
}{
{
name: "With one external upgrade function",
name: "With one _doChainUpgrade function",
opcmArtifact: &solc.ForgeArtifact{
Ast: solc.Ast{
Nodes: []solc.AstNode{
Expand All @@ -26,7 +26,7 @@ func TestGetOpcmUpgradeFunctionAst(t *testing.T) {
Nodes: []solc.AstNode{
{
NodeType: "FunctionDefinition",
Name: "upgrade",
Name: "_doChainUpgrade",
Visibility: "external",
Nodes: []solc.AstNode{
{
Expand All @@ -40,10 +40,10 @@ func TestGetOpcmUpgradeFunctionAst(t *testing.T) {
},
},
},
upgradeFunctionName: "upgrade",
upgradeFunctionName: "_doChainUpgrade",
expectedAst: &solc.AstNode{
NodeType: "FunctionDefinition",
Name: "upgrade",
Name: "_doChainUpgrade",
Visibility: "external",
Nodes: []solc.AstNode{
{
Expand All @@ -54,7 +54,7 @@ func TestGetOpcmUpgradeFunctionAst(t *testing.T) {
expectedError: "",
},
{
name: "With an upgrade function but public visibility",
name: "With a _doChainUpgrade function but public visibility",
opcmArtifact: &solc.ForgeArtifact{
Ast: solc.Ast{
Nodes: []solc.AstNode{
Expand All @@ -63,7 +63,7 @@ func TestGetOpcmUpgradeFunctionAst(t *testing.T) {
Nodes: []solc.AstNode{
{
NodeType: "FunctionDefinition",
Name: "upgrade",
Name: "_doChainUpgrade",
Visibility: "public",
},
},
Expand All @@ -72,12 +72,16 @@ func TestGetOpcmUpgradeFunctionAst(t *testing.T) {
},
},
},
upgradeFunctionName: "upgrade",
expectedAst: nil,
expectedError: "no external upgrade function found in OPContractsManagerUpgrader",
upgradeFunctionName: "_doChainUpgrade",
expectedAst: &solc.AstNode{
NodeType: "FunctionDefinition",
Name: "_doChainUpgrade",
Visibility: "public",
},
expectedError: "",
},
{
name: "With an upgrade function and irrelevant function selector",
name: "With a _doChainUpgrade function and irrelevant function selector",
opcmArtifact: &solc.ForgeArtifact{
Ast: solc.Ast{
Nodes: []solc.AstNode{
Expand All @@ -86,7 +90,7 @@ func TestGetOpcmUpgradeFunctionAst(t *testing.T) {
Nodes: []solc.AstNode{
{
NodeType: "FunctionDefinition",
Name: "upgrade",
Name: "_doChainUpgrade",
Visibility: "external",
FunctionSelector: "aabbccdd",
Nodes: []solc.AstNode{
Expand All @@ -101,10 +105,10 @@ func TestGetOpcmUpgradeFunctionAst(t *testing.T) {
},
},
},
upgradeFunctionName: "upgrade",
upgradeFunctionName: "_doChainUpgrade",
expectedAst: &solc.AstNode{
NodeType: "FunctionDefinition",
Name: "upgrade",
Name: "_doChainUpgrade",
Visibility: "external",
FunctionSelector: "aabbccdd",
Nodes: []solc.AstNode{
Expand All @@ -116,7 +120,7 @@ func TestGetOpcmUpgradeFunctionAst(t *testing.T) {
expectedError: "",
},
{
name: "With multiple external upgrade functions",
name: "With multiple _doChainUpgrade functions",
opcmArtifact: &solc.ForgeArtifact{
Ast: solc.Ast{
Nodes: []solc.AstNode{
Expand All @@ -125,12 +129,12 @@ func TestGetOpcmUpgradeFunctionAst(t *testing.T) {
Nodes: []solc.AstNode{
{
NodeType: "FunctionDefinition",
Name: "upgrade",
Name: "_doChainUpgrade",
Visibility: "external",
},
{
NodeType: "FunctionDefinition",
Name: "upgrade",
Name: "_doChainUpgrade",
Visibility: "external",
},
},
Expand All @@ -139,12 +143,12 @@ func TestGetOpcmUpgradeFunctionAst(t *testing.T) {
},
},
},
upgradeFunctionName: "upgrade",
upgradeFunctionName: "_doChainUpgrade",
expectedAst: nil,
expectedError: "multiple external upgrade functions found in OPContractsManagerUpgrader, expected 1",
expectedError: "multiple external _doChainUpgrade functions found in OPContractsManagerUpgrader, expected 1",
},
{
name: "With no upgrade function",
name: "With no _doChainUpgrade function",
opcmArtifact: &solc.ForgeArtifact{
Ast: solc.Ast{
Nodes: []solc.AstNode{
Expand All @@ -167,9 +171,9 @@ func TestGetOpcmUpgradeFunctionAst(t *testing.T) {
},
},
},
upgradeFunctionName: "upgrade",
upgradeFunctionName: "_doChainUpgrade",
expectedAst: nil,
expectedError: "no external upgrade function found in OPContractsManagerUpgrader",
expectedError: "no external _doChainUpgrade function found in OPContractsManagerUpgrader",
},
{
name: "With no contract definition",
Expand All @@ -178,9 +182,9 @@ func TestGetOpcmUpgradeFunctionAst(t *testing.T) {
Nodes: []solc.AstNode{},
},
},
upgradeFunctionName: "upgrade",
upgradeFunctionName: "_doChainUpgrade",
expectedAst: nil,
expectedError: "no external upgrade function found in OPContractsManagerUpgrader",
expectedError: "no external _doChainUpgrade function found in OPContractsManagerUpgrader",
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,19 +431,6 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract ISystemConfig",
"name": "_systemConfig",
"type": "address"
}
],
"name": "upgrade",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "version",
Expand Down
13 changes: 0 additions & 13 deletions packages/contracts-bedrock/snapshots/abi/L1ERC721Bridge.json
Original file line number Diff line number Diff line change
Expand Up @@ -290,19 +290,6 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract ISystemConfig",
"name": "_systemConfig",
"type": "address"
}
],
"name": "upgrade",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "version",
Expand Down
13 changes: 0 additions & 13 deletions packages/contracts-bedrock/snapshots/abi/L1StandardBridge.json
Original file line number Diff line number Diff line change
Expand Up @@ -549,19 +549,6 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract ISystemConfig",
"name": "_systemConfig",
"type": "address"
}
],
"name": "upgrade",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "version",
Expand Down
13 changes: 0 additions & 13 deletions packages/contracts-bedrock/snapshots/abi/OptimismPortal2.json
Original file line number Diff line number Diff line change
Expand Up @@ -614,19 +614,6 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IAnchorStateRegistry",
"name": "_anchorStateRegistry",
"type": "address"
}
],
"name": "upgrade",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "version",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,6 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "upgrade",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "version",
Expand Down
18 changes: 0 additions & 18 deletions packages/contracts-bedrock/snapshots/abi/SystemConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -873,24 +873,6 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_l2ChainId",
"type": "uint256"
},
{
"internalType": "contract ISuperchainConfig",
"name": "_superchainConfig",
"type": "address"
}
],
"name": "upgrade",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "version",
Expand Down
Loading