Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ contract SemgrepTest__sol_safety_no_immutable_variables {

// ok: sol-safety-no-immutable-variables
uint256 constant constantVar = 1;
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
// ruleid: sol-style-ban-forge-std-test-import
import { Test } from "forge-std/Test.sol";
import {Test} from "forge-std/Test.sol";

// ruleid: sol-style-ban-forge-std-test-import
import { Test as ForgeTest } from "forge-std/Test.sol";
import {Test as ForgeTest} from "forge-std/Test.sol";

// ruleid: sol-style-ban-forge-std-test-import
import { Test, Vm } from "forge-std/Test.sol";
import {Test, Vm} from "forge-std/Test.sol";

// ok: sol-style-ban-forge-std-test-import
import { Test } from "test/setup/Test.sol";
import {Test} from "test/setup/Test.sol";

// ok: sol-style-ban-forge-std-test-import
import { Test as BaseTest } from "test/setup/Test.sol";
import {Test as BaseTest} from "test/setup/Test.sol";

// ok: sol-style-ban-forge-std-test-import
import { Vm } from "forge-std/Vm.sol";
import {Vm} from "forge-std/Vm.sol";

// ok: sol-style-ban-forge-std-test-import
import { StdUtils } from "forge-std/StdUtils.sol";
import {StdUtils} from "forge-std/StdUtils.sol";
38 changes: 17 additions & 21 deletions .semgrep/tests/sol-rules.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@

/// begin SemgrepTest__sol-style-no-bare-imports
// ok: sol-style-no-bare-imports
import { SomeStruct } from "some-library.sol";
import {SomeStruct} from "some-library.sol";

// ok: sol-style-no-bare-imports
import { SomeStruct, AnotherThing } from "some-library.sol";
import {SomeStruct, AnotherThing} from "some-library.sol";

// ok: sol-style-no-bare-imports
import { SomeStruct as SomeOtherStruct } from "some-library.sol";
import {SomeStruct as SomeOtherStruct} from "some-library.sol";

// ok: sol-style-no-bare-imports
import { SomeStruct as SomeOtherStruct, AnotherThing as AnotherOtherThing } from "some-library.sol";
import {SomeStruct as SomeOtherStruct, AnotherThing as AnotherOtherThing} from "some-library.sol";

// ok: sol-style-no-bare-imports
import { SomeStruct as SomeOtherStruct, AnotherThing } from "some-library.sol";
import {SomeStruct as SomeOtherStruct, AnotherThing} from "some-library.sol";

// ok: sol-style-no-bare-imports
import { AnotherThing, SomeStruct as SomeOtherStruct } from "some-library.sol";
import {AnotherThing, SomeStruct as SomeOtherStruct} from "some-library.sol";

// ruleid: sol-style-no-bare-imports
import "some-library.sol";
Expand All @@ -34,13 +34,11 @@ contract SemgrepTest__sol_safety_deployutils_args {
function test() {
// ruleid: sol-safety-deployutils-args
DeployUtils.create1AndSave({
_save: this,
_name: "SuperchainConfig",
_args: abi.encodeCall(ISuperchainConfig.__constructor__, ())
_save: this, _name: "SuperchainConfig", _args: abi.encodeCall(ISuperchainConfig.__constructor__, ())
});

// ruleid: sol-safety-deployutils-args
DeployUtils.create1({ _name: "SuperchainConfig", _args: abi.encodeCall(ISuperchainConfig.__constructor__, ()) });
DeployUtils.create1({_name: "SuperchainConfig", _args: abi.encodeCall(ISuperchainConfig.__constructor__, ())});

// ruleid: sol-safety-deployutils-args
DeployUtils.create2AndSave({
Expand All @@ -52,16 +50,12 @@ contract SemgrepTest__sol_safety_deployutils_args {

// ruleid: sol-safety-deployutils-args
DeployUtils.create2({
_salt: _implSalt(),
_name: "SuperchainConfig",
_args: abi.encodeCall(ISuperchainConfig.__constructor__, ())
_salt: _implSalt(), _name: "SuperchainConfig", _args: abi.encodeCall(ISuperchainConfig.__constructor__, ())
});

// ruleid: sol-safety-deployutils-args
DeployUtils.createDeterministic({
_name: "SuperchainConfig",
_args: abi.encodeCall(ISuperchainConfig.__constructor__, ()),
_salt: _implSalt()
_name: "SuperchainConfig", _args: abi.encodeCall(ISuperchainConfig.__constructor__, ()), _salt: _implSalt()
});

// ok: sol-safety-deployutils-args
Expand Down Expand Up @@ -140,24 +134,24 @@ contract SemgrepTest__sol_safety_deployutils_named_args_parameter {
);

// ruleid: sol-safety-deployutils-named-args-parameter
DeployUtils.create1({ _save: _args, _name: "Proxy", _nick: "DataAvailabilityChallengeProxy" });
DeployUtils.create1({_save: _args, _name: "Proxy", _nick: "DataAvailabilityChallengeProxy"});

// ruleid: sol-safety-deployutils-named-args-parameter
DeployUtils.createDeterministic(
"Proxy", DeployUtils.encodeConstructor(abi.encodeCall(IProxy.__constructor__, (proxyAdmin))), _implSalt()
);

// ruleid: sol-safety-deployutils-named-args-parameter
DeployUtils.create1AndSave({ _save: this, _name: "Proxy", _nick: "DataAvailabilityChallengeProxy" });
DeployUtils.create1AndSave({_save: this, _name: "Proxy", _nick: "DataAvailabilityChallengeProxy"});

// ruleid: sol-safety-deployutils-named-args-parameter
DeployUtils.create1({ _save: this, _name: "Proxy", _nick: "DataAvailabilityChallengeProxy" });
DeployUtils.create1({_save: this, _name: "Proxy", _nick: "DataAvailabilityChallengeProxy"});

// ruleid: sol-safety-deployutils-named-args-parameter
DeployUtils.create2AndSave({ _save: this, _name: "Proxy", _nick: "DataAvailabilityChallengeProxy" });
DeployUtils.create2AndSave({_save: this, _name: "Proxy", _nick: "DataAvailabilityChallengeProxy"});

// ruleid: sol-safety-deployutils-named-args-parameter
DeployUtils.create2({ _save: this, _name: "Proxy", _nick: "DataAvailabilityChallengeProxy" });
DeployUtils.create2({_save: this, _name: "Proxy", _nick: "DataAvailabilityChallengeProxy"});

// ok: sol-safety-deployutils-named-args-parameter
DeployUtils.create1AndSave({
Expand Down Expand Up @@ -696,6 +690,7 @@ contract SemgrepTest__sol_style_enforce_require_msg {

contract SemgrepTest__sol_safety_try_catch_eip_150 {
function test() {
/// forgefmt: disable-start
// ok: sol-safety-trycatch-eip150
// eip150-safe
try someContract.someFunction() {
Expand All @@ -710,6 +705,7 @@ contract SemgrepTest__sol_safety_try_catch_eip_150 {
} catch {
// ...
}
/// forgefmt: disable-end
}
}

Expand Down
6 changes: 3 additions & 3 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ svm-rs = "0.5.19"
# GitHub release, so we need to use the aliasing trick to get mise to not error
# The git ref here should be on the `stable` branch.
# Updated to use the specific nightly build
forge = "1.2.3"
cast = "1.2.3"
anvil = "1.2.3"
forge = "1.4.3"
cast = "1.4.3"
anvil = "1.4.3"

# Other dependencies
codecov-uploader = "0.8.0"
Expand Down
14 changes: 7 additions & 7 deletions op-deployer/pkg/deployer/forge/version.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"forge": "v1.2.3",
"forge": "v1.4.3",
"checksums": {
"darwin_amd64": "e3e2b425c7e1b8c853ed454276b20ff500fa82d65cc95acad225b4b7063add4a",
"darwin_arm64": "a3f3f1417a7a02a16942e9fc86418d0121c2d904c113feb1b26c9d69dc6f287d",
"linux_amd64": "8202f38f1635c2793b2d1a4fe443ae6f7315190dc6eed219d7969a40ab78a286",
"linux_arm64": "70612fd1da9df3a8b35484214e4f2b37ba1d6c41150849490642d7a053c31eaa",
"alpine_amd64": "015180571c79ce7664717768db2f35e878e6ad98a883750547897420c3a2c461",
"alpine_arm64": "c40f4786bde394514c1074390a477b7de9574e7c95561ca4b03b275de3f13c17"
"darwin_amd64": "4435ea9b063a6f3952de5b1744d03047fff9657afadd9183196c11224ca3af1d",
"darwin_arm64": "4adb4b0a8c5c4a40fa9450b1b87d748d591af7ea0617f514da808bd529098adc",
"linux_amd64": "325ba04dc5cb41c110723b00ac291f8269f8cd785028299aad8252ef980961a7",
"linux_arm64": "209492cb4ebd723d9eac002fa30f41f53c8810105b67d3c32fe8201cf70f89d4",
"alpine_amd64": "2992bccc4de49e604051baba0addbbdeb4d41fdbfba1a1e95db70f713153d765",
"alpine_arm64": "a06a81711ff791a44d0be9d0419ce3d5b4bcdf08394a4738881e22a9573b69a7"
}
}
2 changes: 1 addition & 1 deletion packages/contracts-bedrock/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ phases:
command: cd ../../ && semgrep scan --error --config .semgrep/rules/ ./packages/contracts-bedrock
- name: semgrep-test-validity
description: Check semgrep tests are valid
command: forge fmt ../../.semgrep/tests/sol-rules.t.sol --check
command: cd ../../ && forge fmt .semgrep/tests --check
- name: deploy-configs
description: Validate deploy configurations
command: ./scripts/checks/check-deploy-configs.sh
Expand Down
50 changes: 50 additions & 0 deletions packages/contracts-bedrock/foundry.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"../../kona/crates/protocol/registry/superchain-registry": {
"rev": "300d18077f2799e21e5f2becb64f9cf04c9a0760"
},
"../../op-rbuilder": {
"rev": "272d462d980a43e7caf568df0fbbc0c2e0066207"
},
"../../reth": {
"rev": "8fa01eb62eb145112c8285f02aee12c2b4e2bd4d"
},
"../../rollup-boost": {
"rev": "196237bab2a02298de994b439e0455abb1ac512f"
},
"lib/forge-std": {
"rev": "6853b9ec7df5dc0c213b05ae67785ad4f4baa0ea"
},
"lib/kontrol-cheatcodes": {
"rev": "2c48ae1ab44228c199dca29414c0b4b18a3434e6"
},
"lib/lib-keccak": {
"rev": "3b1e7bbb4cc23e9228097cfebe42aedaf3b8f2b9"
},
"lib/openzeppelin-contracts": {
"rev": "ecd2ca2cd7cac116f7a37d0e474bbb3d7d5e1c4d"
},
"lib/openzeppelin-contracts-upgradeable": {
"rev": "0a2cb9a445c365870ed7a8ab461b12acf3e27d63"
},
"lib/openzeppelin-contracts-v5": {
"rev": "dbb6104ce834628e473d2173bbc9d47f81a9eec3"
},
"lib/safe-contracts": {
"branch": {
"name": "v1.4.1",
"rev": "bf943f80fec5ac647159d26161446ac5d716a294"
}
},
"lib/solady": {
"rev": "502cc1ea718e6fa73b380635ee0868b0740595f0"
},
"lib/solady-v0.0.245": {
"rev": "e0ef35adb0ccd1032794731a995cb599bba7b537"
},
"lib/solmate": {
"rev": "8f9b23f8838670afda0fd8983f2c41e8037ae6bc"
},
"lib/superchain-registry": {
"rev": "84bce73573f130008d84bae6e924163bab589a11"
}
}
7 changes: 5 additions & 2 deletions packages/contracts-bedrock/foundry.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
################################################################
# PROFILE: DEFAULT (local) #
# PROFILE: DEFjusLT (local) #
################################################################

[profile.default]
Expand Down Expand Up @@ -74,7 +74,7 @@ fs_permissions = [

# 5159 error code is selfdestruct error code
ignored_error_codes = ["transient-storage", "code-size", "init-code-size", "too-many-warnings", 5159]
deny_warnings = true
deny = "warnings"
ffi = true

# We set the gas limit to max int64 to avoid running out of gas during testing, since the default
Expand All @@ -84,6 +84,9 @@ ffi = true
# you increase the gas limit above this value it must be a string.
gas_limit = 9223372036854775807

[lint]
exclude_lints = ["mixed-case-function", "unsafe-typecast", "asm-keccak256", "screaming-snake-case-immutable", "mixed-case-variable", "divide-before-multiply", "unaliased-plain-import", "screaming-snake-case-const", "unsafe-cheatcode", "erc20-unchecked-transfer", "unaliased-plain-import", "named-struct-fields", "incorrect-shift", "unchecked-call", "unwrapped-modifier-logic", "unwrapped-modifier-logic", "pascal-case-struct", "unused-import"]

[fuzz]
runs = 64

Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-bedrock/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ semver-diff-check: build semver-diff-check-no-build

# Checks that the semgrep tests are valid.
semgrep-test-validity-check:
forge fmt ../../.semgrep/tests/sol-rules.t.sol --check
cd ../../ && forge fmt .semgrep/tests --check

# Validates forge test conventions and structure. Does not build contracts.
lint-forge-tests-check-no-build:
Expand Down
50 changes: 22 additions & 28 deletions packages/contracts-bedrock/scripts/L2Genesis.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,12 @@ contract L2Genesis is Script {
/// LEGACY_ERC20_ETH and L1_MESSAGE_SENDER are deprecated and are not set.
function setPredeployImplementations(Input memory _input) internal {
setLegacyMessagePasser(); // 0
// 01: legacy, not used in OP-Stack
// 01: legacy, not used in OP-Stack
setDeployerWhitelist(); // 2
// 3,4,5: legacy, not used in OP-Stack.
// 3,4,5: legacy, not used in OP-Stack.
setWETH(); // 6: WETH (not behind a proxy)
setL2CrossDomainMessenger(_input.l1CrossDomainMessengerProxy); // 7
// 8,9,A,B,C,D,E: legacy, not used in OP-Stack.
// 8,9,A,B,C,D,E: legacy, not used in OP-Stack.
setGasPriceOracle(); // f
setL2StandardBridge(_input.l1StandardBridgeProxy); // 10
setSequencerFeeVault(_input); // 11
Expand All @@ -253,7 +253,7 @@ contract L2Genesis is Script {
setBaseFeeVault(_input); // 19
setL1FeeVault(_input); // 1A
setOperatorFeeVault(_input); // 1B
// 1C,1D,1E,1F: not used.
// 1C,1D,1E,1F: not used.
setSchemaRegistry(); // 20
setEAS(); // 21
setGovernanceToken(_input); // 42: OP (not behind a proxy)
Expand Down Expand Up @@ -300,9 +300,8 @@ contract L2Genesis is Script {

IL2CrossDomainMessenger(impl).initialize({ _l1CrossDomainMessenger: ICrossDomainMessenger(address(0)) });

IL2CrossDomainMessenger(Predeploys.L2_CROSS_DOMAIN_MESSENGER).initialize({
_l1CrossDomainMessenger: ICrossDomainMessenger(_l1CrossDomainMessengerProxy)
});
IL2CrossDomainMessenger(Predeploys.L2_CROSS_DOMAIN_MESSENGER)
.initialize({ _l1CrossDomainMessenger: ICrossDomainMessenger(_l1CrossDomainMessengerProxy) });
}

/// @notice This predeploy is following the safety invariant #1.
Expand All @@ -311,9 +310,8 @@ contract L2Genesis is Script {

IL2StandardBridge(payable(impl)).initialize({ _otherBridge: IStandardBridge(payable(address(0))) });

IL2StandardBridge(payable(Predeploys.L2_STANDARD_BRIDGE)).initialize({
_otherBridge: IStandardBridge(_l1StandardBridgeProxy)
});
IL2StandardBridge(payable(Predeploys.L2_STANDARD_BRIDGE))
.initialize({ _otherBridge: IStandardBridge(_l1StandardBridgeProxy) });
}

/// @notice This predeploy is following the safety invariant #1.
Expand Down Expand Up @@ -343,9 +341,8 @@ contract L2Genesis is Script {

IOptimismMintableERC20Factory(impl).initialize({ _bridge: address(0) });

IOptimismMintableERC20Factory(Predeploys.OPTIMISM_MINTABLE_ERC20_FACTORY).initialize({
_bridge: Predeploys.L2_STANDARD_BRIDGE
});
IOptimismMintableERC20Factory(Predeploys.OPTIMISM_MINTABLE_ERC20_FACTORY)
.initialize({ _bridge: Predeploys.L2_STANDARD_BRIDGE });
}

/// @notice This predeploy is following the safety invariant #2,
Expand Down Expand Up @@ -551,17 +548,15 @@ contract L2Genesis is Script {
function setLiquidityController(Input memory _input) internal {
address impl = _setImplementationCode(Predeploys.LIQUIDITY_CONTROLLER);

ILiquidityController(impl).initialize({
_owner: _input.liquidityControllerOwner,
_gasPayingTokenName: "",
_gasPayingTokenSymbol: ""
});
ILiquidityController(impl)
.initialize({ _owner: _input.liquidityControllerOwner, _gasPayingTokenName: "", _gasPayingTokenSymbol: "" });

ILiquidityController(Predeploys.LIQUIDITY_CONTROLLER).initialize({
_owner: _input.liquidityControllerOwner,
_gasPayingTokenName: _input.gasPayingTokenName,
_gasPayingTokenSymbol: _input.gasPayingTokenSymbol
});
ILiquidityController(Predeploys.LIQUIDITY_CONTROLLER)
.initialize({
_owner: _input.liquidityControllerOwner,
_gasPayingTokenName: _input.gasPayingTokenName,
_gasPayingTokenSymbol: _input.gasPayingTokenSymbol
});
}

/// @notice This predeploy is following the safety invariant #1.
Expand Down Expand Up @@ -733,11 +728,10 @@ contract L2Genesis is Script {
/// Initialize the implementation using max value for min withdrawal amount to make it unusable
IFeeVault(payable(impl)).initialize(address(0), type(uint256).max, Types.WithdrawalNetwork.L1);
// Initialize the predeploy
IFeeVault(payable(_vaultAddr)).initialize({
_recipient: recipient,
_minWithdrawalAmount: minWithdrawalAmount,
_withdrawalNetwork: network
});
IFeeVault(payable(_vaultAddr))
.initialize({
_recipient: recipient, _minWithdrawalAmount: minWithdrawalAmount, _withdrawalNetwork: network
});
}

/// @notice Funds the default dev accounts with ether
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -euo pipefail
# Runs the file unchanged script for each of the Kontrol summary files.
# Update these hashes if you have changed the summary files deliberately.
# Use `openssl dgst -sha256` to generate the hash for a file.
./scripts/checks/check-file-unchanged.sh ./test/kontrol/proofs/utils/DeploymentSummary.sol 73e1ed1f3c8bd9e46bb348b774443458206b2399e4eac303e2a92ac987eeefc6
./scripts/checks/check-file-unchanged.sh ./test/kontrol/proofs/utils/DeploymentSummaryCode.sol ffe7298024464a6a282ceb549db401cce4b36fe3342113250a6c674a3b4203ba
./scripts/checks/check-file-unchanged.sh ./test/kontrol/proofs/utils/DeploymentSummaryFaultProofs.sol 5ec8b19a00b47f15a2a8c8d632ab83933e19b0c2bbb04c905a2cda926e56038f
./scripts/checks/check-file-unchanged.sh ./test/kontrol/proofs/utils/DeploymentSummaryFaultProofsCode.sol 1215a561a2bffb5af62b532a2608c4048a22368e505f7ae1d237c16b4ef6a45e
./scripts/checks/check-file-unchanged.sh ./test/kontrol/proofs/utils/DeploymentSummary.sol cb2f1d7ff9a6fb878328650114af6a6864ed6e353e1d031b5704dee75270a4b5
./scripts/checks/check-file-unchanged.sh ./test/kontrol/proofs/utils/DeploymentSummaryCode.sol 8cef371441261e54161645036717d3ee21f66bd638a961da698c6858250e41bc
./scripts/checks/check-file-unchanged.sh ./test/kontrol/proofs/utils/DeploymentSummaryFaultProofs.sol 80e9caac4deba370d01dd642401ec2e8145a1e2ae981b7e423d4de188266f87b
./scripts/checks/check-file-unchanged.sh ./test/kontrol/proofs/utils/DeploymentSummaryFaultProofsCode.sol c4379d2232fab24bea2f55d25cef5de4d0629b8e04592f074f680a3141861d9e
Loading