Commit 7873831f authored by Michael Amadi's avatar Michael Amadi Committed by GitHub

Sc/use deployutils in tests (#12656)

* use deploy utils over new* in tests

* replace new * with use of deployUtils

* fix failing test

* use deployutils for weth98 test file

* fix semgrep

* fixes

* fixes

* fixes...
parent 96468b79
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity ^0.8.0;
// Scripts // Scripts
import { Vm } from "forge-std/Vm.sol"; import { Vm } from "forge-std/Vm.sol";
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
import { IWETH98 } from "src/universal/interfaces/IWETH98.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol"; import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
interface IDelayedWETH is IWETH98 { interface IDelayedWETH {
struct WithdrawalRequest { struct WithdrawalRequest {
uint256 amount; uint256 amount;
uint256 timestamp; uint256 timestamp;
...@@ -30,7 +29,35 @@ interface IDelayedWETH is IWETH98 { ...@@ -30,7 +29,35 @@ interface IDelayedWETH is IWETH98 {
function withdrawals(address, address) external view returns (uint256 amount, uint256 timestamp); function withdrawals(address, address) external view returns (uint256 amount, uint256 timestamp);
function version() external view returns (string memory); function version() external view returns (string memory);
function withdraw(uint256 _wad) external override; function withdraw(uint256 _wad) external;
event Approval(address indexed src, address indexed guy, uint256 wad);
event Transfer(address indexed src, address indexed dst, uint256 wad);
event Deposit(address indexed dst, uint256 wad);
event Withdrawal(address indexed src, uint256 wad);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function balanceOf(address src) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function deposit() external payable;
function totalSupply() external view returns (uint256);
function approve(address guy, uint256 wad) external returns (bool);
function transfer(address dst, uint256 wad) external returns (bool);
function transferFrom(address src, address dst, uint256 wad) external returns (bool);
function __constructor__(uint256 _delay) external; function __constructor__(uint256 _delay) external;
} }
...@@ -36,4 +36,6 @@ interface IWETH98 { ...@@ -36,4 +36,6 @@ interface IWETH98 {
function transfer(address dst, uint256 wad) external returns (bool); function transfer(address dst, uint256 wad) external returns (bool);
function transferFrom(address src, address dst, uint256 wad) external returns (bool); function transferFrom(address src, address dst, uint256 wad) external returns (bool);
function __constructor__() external;
} }
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
pragma solidity 0.8.15; pragma solidity 0.8.15;
import { Test } from "forge-std/Test.sol"; import { Test } from "forge-std/Test.sol";
import { DelayedVetoable } from "src/L1/DelayedVetoable.sol";
import { IDelayedVetoable } from "src/L1/interfaces/IDelayedVetoable.sol"; import { IDelayedVetoable } from "src/L1/interfaces/IDelayedVetoable.sol";
import { DeployUtils } from "scripts/libraries/DeployUtils.sol";
contract DelayedVetoable_Init is Test { contract DelayedVetoable_Init is Test {
error Unauthorized(address expected, address actual); error Unauthorized(address expected, address actual);
...@@ -27,14 +27,12 @@ contract DelayedVetoable_Init is Test { ...@@ -27,14 +27,12 @@ contract DelayedVetoable_Init is Test {
vm.deal(vetoer, 10000 ether); vm.deal(vetoer, 10000 ether);
delayedVetoable = IDelayedVetoable( delayedVetoable = IDelayedVetoable(
address( DeployUtils.create1({
new DelayedVetoable({ _name: "DelayedVetoable",
_initiator: initiator, _args: DeployUtils.encodeConstructor(
_vetoer: vetoer, abi.encodeCall(IDelayedVetoable.__constructor__, (vetoer, initiator, address(target), operatingDelay))
_target: address(target), )
_operatingDelay: operatingDelay })
})
)
); );
// Most tests will use the operating delay, so we call as the initiator with null data // Most tests will use the operating delay, so we call as the initiator with null data
...@@ -155,7 +153,7 @@ contract DelayedVetoable_HandleCall_Test is DelayedVetoable_Init { ...@@ -155,7 +153,7 @@ contract DelayedVetoable_HandleCall_Test is DelayedVetoable_Init {
contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init { contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
/// @dev Only the initiator can initiate a call. /// @dev Only the initiator can initiate a call.
function test_handleCall_unauthorizedInitiation_reverts() external { function test_handleCall_unauthorizedInitiation_reverts() external {
vm.expectRevert(abi.encodeWithSelector(DelayedVetoable.Unauthorized.selector, initiator, address(this))); vm.expectRevert(abi.encodeWithSelector(IDelayedVetoable.Unauthorized.selector, initiator, address(this)));
(bool revertsAsExpected,) = address(delayedVetoable).call(hex"00001234"); (bool revertsAsExpected,) = address(delayedVetoable).call(hex"00001234");
assertTrue(revertsAsExpected); assertTrue(revertsAsExpected);
} }
...@@ -167,7 +165,7 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init { ...@@ -167,7 +165,7 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
(bool success,) = address(delayedVetoable).call(data); (bool success,) = address(delayedVetoable).call(data);
assertTrue(success); assertTrue(success);
vm.expectRevert(DelayedVetoable.ForwardingEarly.selector); vm.expectRevert(IDelayedVetoable.ForwardingEarly.selector);
(bool revertsAsExpected,) = address(delayedVetoable).call(data); (bool revertsAsExpected,) = address(delayedVetoable).call(data);
assertTrue(revertsAsExpected); assertTrue(revertsAsExpected);
} }
...@@ -191,7 +189,7 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init { ...@@ -191,7 +189,7 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
assertTrue(success); assertTrue(success);
// Attempt to forward the same call again. // Attempt to forward the same call again.
vm.expectRevert(abi.encodeWithSelector(DelayedVetoable.Unauthorized.selector, initiator, address(this))); vm.expectRevert(abi.encodeWithSelector(IDelayedVetoable.Unauthorized.selector, initiator, address(this)));
(bool revertsAsExpected,) = address(delayedVetoable).call(data); (bool revertsAsExpected,) = address(delayedVetoable).call(data);
assertTrue(revertsAsExpected); assertTrue(revertsAsExpected);
} }
......
...@@ -4,12 +4,13 @@ pragma solidity 0.8.15; ...@@ -4,12 +4,13 @@ pragma solidity 0.8.15;
import { CommonTest } from "test/setup/CommonTest.sol"; import { CommonTest } from "test/setup/CommonTest.sol";
// Target contract dependencies // Target contract dependencies
import { Proxy } from "src/universal/Proxy.sol"; import { IProxy } from "src/universal/interfaces/IProxy.sol";
// Target contract // Target contract
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol"; import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { DeployUtils } from "scripts/libraries/DeployUtils.sol";
contract SuperchainConfig_Init_Test is CommonTest { contract SuperchainConfig_Init_Test is CommonTest {
/// @dev Tests that initialization sets the correct values. These are defined in CommonTest.sol. /// @dev Tests that initialization sets the correct values. These are defined in CommonTest.sol.
function test_initialize_unpaused_succeeds() external view { function test_initialize_unpaused_succeeds() external view {
...@@ -19,8 +20,18 @@ contract SuperchainConfig_Init_Test is CommonTest { ...@@ -19,8 +20,18 @@ contract SuperchainConfig_Init_Test is CommonTest {
/// @dev Tests that it can be intialized as paused. /// @dev Tests that it can be intialized as paused.
function test_initialize_paused_succeeds() external { function test_initialize_paused_succeeds() external {
Proxy newProxy = new Proxy(alice); IProxy newProxy = IProxy(
ISuperchainConfig newImpl = ISuperchainConfig(address(new SuperchainConfig())); DeployUtils.create1({
_name: "Proxy",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IProxy.__constructor__, (alice)))
})
);
ISuperchainConfig newImpl = ISuperchainConfig(
DeployUtils.create1({
_name: "SuperchainConfig",
_args: DeployUtils.encodeConstructor(abi.encodeCall(ISuperchainConfig.__constructor__, ()))
})
);
vm.startPrank(alice); vm.startPrank(alice);
newProxy.upgradeToAndCall( newProxy.upgradeToAndCall(
......
...@@ -17,8 +17,8 @@ import { Unauthorized } from "src/libraries/errors/CommonErrors.sol"; ...@@ -17,8 +17,8 @@ import { Unauthorized } from "src/libraries/errors/CommonErrors.sol";
import { Preinstalls } from "src/libraries/Preinstalls.sol"; import { Preinstalls } from "src/libraries/Preinstalls.sol";
// Target contract // Target contract
import { OptimismSuperchainERC20 } from "src/L2/OptimismSuperchainERC20.sol";
import { IOptimismSuperchainERC20 } from "src/L2/interfaces/IOptimismSuperchainERC20.sol"; import { IOptimismSuperchainERC20 } from "src/L2/interfaces/IOptimismSuperchainERC20.sol";
import { DeployUtils } from "scripts/libraries/DeployUtils.sol";
/// @title OptimismSuperchainERC20Test /// @title OptimismSuperchainERC20Test
/// @notice Contract for testing the OptimismSuperchainERC20 contract. /// @notice Contract for testing the OptimismSuperchainERC20 contract.
...@@ -31,12 +31,17 @@ contract OptimismSuperchainERC20Test is Test { ...@@ -31,12 +31,17 @@ contract OptimismSuperchainERC20Test is Test {
address internal constant L2_BRIDGE = Predeploys.L2_STANDARD_BRIDGE; address internal constant L2_BRIDGE = Predeploys.L2_STANDARD_BRIDGE;
address internal constant MESSENGER = Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER; address internal constant MESSENGER = Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER;
OptimismSuperchainERC20 public optimismSuperchainERC20Impl; IOptimismSuperchainERC20 public optimismSuperchainERC20Impl;
OptimismSuperchainERC20 public optimismSuperchainERC20; IOptimismSuperchainERC20 public optimismSuperchainERC20;
/// @notice Sets up the test suite. /// @notice Sets up the test suite.
function setUp() public { function setUp() public {
optimismSuperchainERC20Impl = new OptimismSuperchainERC20(); optimismSuperchainERC20Impl = IOptimismSuperchainERC20(
DeployUtils.create1({
_name: "OptimismSuperchainERC20",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IOptimismSuperchainERC20.__constructor__, ()))
})
);
// Deploy the OptimismSuperchainERC20Beacon contract // Deploy the OptimismSuperchainERC20Beacon contract
_deployBeacon(); _deployBeacon();
...@@ -73,13 +78,13 @@ contract OptimismSuperchainERC20Test is Test { ...@@ -73,13 +78,13 @@ contract OptimismSuperchainERC20Test is Test {
uint8 _decimals uint8 _decimals
) )
internal internal
returns (OptimismSuperchainERC20) returns (IOptimismSuperchainERC20)
{ {
return OptimismSuperchainERC20( return IOptimismSuperchainERC20(
address( address(
new BeaconProxy( new BeaconProxy(
Predeploys.OPTIMISM_SUPERCHAIN_ERC20_BEACON, Predeploys.OPTIMISM_SUPERCHAIN_ERC20_BEACON,
abi.encodeCall(OptimismSuperchainERC20.initialize, (_remoteToken, _name, _symbol, _decimals)) abi.encodeCall(IOptimismSuperchainERC20.initialize, (_remoteToken, _name, _symbol, _decimals))
) )
) )
); );
...@@ -219,25 +224,28 @@ contract OptimismSuperchainERC20Test is Test { ...@@ -219,25 +224,28 @@ contract OptimismSuperchainERC20Test is Test {
/// @notice Tests the `decimals` function always returns the correct value. /// @notice Tests the `decimals` function always returns the correct value.
function testFuzz_decimals_succeeds(uint8 _decimals) public { function testFuzz_decimals_succeeds(uint8 _decimals) public {
OptimismSuperchainERC20 _newSuperchainERC20 = _deploySuperchainERC20Proxy(REMOTE_TOKEN, NAME, SYMBOL, _decimals); IOptimismSuperchainERC20 _newSuperchainERC20 =
_deploySuperchainERC20Proxy(REMOTE_TOKEN, NAME, SYMBOL, _decimals);
assertEq(_newSuperchainERC20.decimals(), _decimals); assertEq(_newSuperchainERC20.decimals(), _decimals);
} }
/// @notice Tests the `REMOTE_TOKEN` function always returns the correct value. /// @notice Tests the `REMOTE_TOKEN` function always returns the correct value.
function testFuzz_remoteToken_succeeds(address _remoteToken) public { function testFuzz_remoteToken_succeeds(address _remoteToken) public {
OptimismSuperchainERC20 _newSuperchainERC20 = _deploySuperchainERC20Proxy(_remoteToken, NAME, SYMBOL, DECIMALS); IOptimismSuperchainERC20 _newSuperchainERC20 = _deploySuperchainERC20Proxy(_remoteToken, NAME, SYMBOL, DECIMALS);
assertEq(_newSuperchainERC20.remoteToken(), _remoteToken); assertEq(_newSuperchainERC20.remoteToken(), _remoteToken);
} }
/// @notice Tests the `name` function always returns the correct value. /// @notice Tests the `name` function always returns the correct value.
function testFuzz_name_succeeds(string memory _name) public { function testFuzz_name_succeeds(string memory _name) public {
OptimismSuperchainERC20 _newSuperchainERC20 = _deploySuperchainERC20Proxy(REMOTE_TOKEN, _name, SYMBOL, DECIMALS); IOptimismSuperchainERC20 _newSuperchainERC20 =
_deploySuperchainERC20Proxy(REMOTE_TOKEN, _name, SYMBOL, DECIMALS);
assertEq(_newSuperchainERC20.name(), _name); assertEq(_newSuperchainERC20.name(), _name);
} }
/// @notice Tests the `symbol` function always returns the correct value. /// @notice Tests the `symbol` function always returns the correct value.
function testFuzz_symbol_succeeds(string memory _symbol) public { function testFuzz_symbol_succeeds(string memory _symbol) public {
OptimismSuperchainERC20 _newSuperchainERC20 = _deploySuperchainERC20Proxy(REMOTE_TOKEN, NAME, _symbol, DECIMALS); IOptimismSuperchainERC20 _newSuperchainERC20 =
_deploySuperchainERC20Proxy(REMOTE_TOKEN, NAME, _symbol, DECIMALS);
assertEq(_newSuperchainERC20.symbol(), _symbol); assertEq(_newSuperchainERC20.symbol(), _symbol);
} }
......
...@@ -7,12 +7,13 @@ import { Reverter } from "test/mocks/Callers.sol"; ...@@ -7,12 +7,13 @@ import { Reverter } from "test/mocks/Callers.sol";
import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol"; import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol";
// Contracts // Contracts
import { SequencerFeeVault } from "src/L2/SequencerFeeVault.sol"; import { ISequencerFeeVault } from "src/L2/interfaces/ISequencerFeeVault.sol";
// Libraries // Libraries
import { Hashing } from "src/libraries/Hashing.sol"; import { Hashing } from "src/libraries/Hashing.sol";
import { Types } from "src/libraries/Types.sol"; import { Types } from "src/libraries/Types.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { DeployUtils } from "scripts/libraries/DeployUtils.sol";
contract SequencerFeeVault_Test is CommonTest { contract SequencerFeeVault_Test is CommonTest {
address recipient; address recipient;
...@@ -112,11 +113,19 @@ contract SequencerFeeVault_L2Withdrawal_Test is CommonTest { ...@@ -112,11 +113,19 @@ contract SequencerFeeVault_L2Withdrawal_Test is CommonTest {
vm.etch( vm.etch(
EIP1967Helper.getImplementation(Predeploys.SEQUENCER_FEE_WALLET), EIP1967Helper.getImplementation(Predeploys.SEQUENCER_FEE_WALLET),
address( address(
new SequencerFeeVault( DeployUtils.create1({
deploy.cfg().sequencerFeeVaultRecipient(), _name: "SequencerFeeVault",
deploy.cfg().sequencerFeeVaultMinimumWithdrawalAmount(), _args: DeployUtils.encodeConstructor(
Types.WithdrawalNetwork.L2 abi.encodeCall(
) ISequencerFeeVault.__constructor__,
(
deploy.cfg().sequencerFeeVaultRecipient(),
deploy.cfg().sequencerFeeVaultMinimumWithdrawalAmount(),
Types.WithdrawalNetwork.L2
)
)
)
})
).code ).code
); );
......
...@@ -5,7 +5,8 @@ pragma solidity 0.8.15; ...@@ -5,7 +5,8 @@ pragma solidity 0.8.15;
import { Test } from "forge-std/Test.sol"; import { Test } from "forge-std/Test.sol";
// Contracts // Contracts
import { WETH98 } from "src/universal/WETH98.sol"; import { IWETH98 } from "src/universal/interfaces/IWETH98.sol";
import { DeployUtils } from "scripts/libraries/DeployUtils.sol";
contract WETH98_Test is Test { contract WETH98_Test is Test {
event Approval(address indexed src, address indexed guy, uint256 wad); event Approval(address indexed src, address indexed guy, uint256 wad);
...@@ -13,12 +14,17 @@ contract WETH98_Test is Test { ...@@ -13,12 +14,17 @@ contract WETH98_Test is Test {
event Deposit(address indexed dst, uint256 wad); event Deposit(address indexed dst, uint256 wad);
event Withdrawal(address indexed src, uint256 wad); event Withdrawal(address indexed src, uint256 wad);
WETH98 public weth; IWETH98 public weth;
address alice; address alice;
address bob; address bob;
function setUp() public { function setUp() public {
weth = new WETH98(); weth = IWETH98(
DeployUtils.create1({
_name: "WETH98",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IWETH98.__constructor__, ()))
})
);
alice = makeAddr("alice"); alice = makeAddr("alice");
bob = makeAddr("bob"); bob = makeAddr("bob");
deal(alice, 1 ether); deal(alice, 1 ether);
......
...@@ -4,13 +4,10 @@ pragma solidity 0.8.15; ...@@ -4,13 +4,10 @@ pragma solidity 0.8.15;
// Testing // Testing
import { CommonTest } from "test/setup/CommonTest.sol"; import { CommonTest } from "test/setup/CommonTest.sol";
// Contracts
import { GovernanceToken } from "src/governance/GovernanceToken.sol";
import { MintManager } from "src/governance/MintManager.sol";
// Interfaces // Interfaces
import { IGovernanceToken } from "src/governance/interfaces/IGovernanceToken.sol"; import { IGovernanceToken } from "src/governance/interfaces/IGovernanceToken.sol";
import { IMintManager } from "src/governance/interfaces/IMintManager.sol"; import { IMintManager } from "src/governance/interfaces/IMintManager.sol";
import { DeployUtils } from "scripts/libraries/DeployUtils.sol";
contract MintManager_Initializer is CommonTest { contract MintManager_Initializer is CommonTest {
address constant owner = address(0x1234); address constant owner = address(0x1234);
...@@ -23,10 +20,20 @@ contract MintManager_Initializer is CommonTest { ...@@ -23,10 +20,20 @@ contract MintManager_Initializer is CommonTest {
super.setUp(); super.setUp();
vm.prank(owner); vm.prank(owner);
gov = IGovernanceToken(address(new GovernanceToken())); gov = IGovernanceToken(
DeployUtils.create1({
_name: "GovernanceToken",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IGovernanceToken.__constructor__, ()))
})
);
vm.prank(owner); vm.prank(owner);
manager = IMintManager(address(new MintManager(owner, address(gov)))); manager = IMintManager(
DeployUtils.create1({
_name: "MintManager",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IMintManager.__constructor__, (owner, address(gov))))
})
);
vm.prank(owner); vm.prank(owner);
gov.transferOwnership(address(manager)); gov.transferOwnership(address(manager));
......
...@@ -2,17 +2,27 @@ ...@@ -2,17 +2,27 @@
pragma solidity 0.8.15; pragma solidity 0.8.15;
import { Test } from "forge-std/Test.sol"; import { Test } from "forge-std/Test.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol"; import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { Proxy } from "src/universal/Proxy.sol"; import { IProxy } from "src/universal/interfaces/IProxy.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
import { DeployUtils } from "scripts/libraries/DeployUtils.sol";
contract SystemConfig_GasLimitBoundaries_Invariant is Test { contract SystemConfig_GasLimitBoundaries_Invariant is Test {
ISystemConfig public config; ISystemConfig public config;
function setUp() external { function setUp() external {
Proxy proxy = new Proxy(msg.sender); IProxy proxy = IProxy(
ISystemConfig configImpl = ISystemConfig(address(new SystemConfig())); DeployUtils.create1({
_name: "Proxy",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IProxy.__constructor__, (msg.sender)))
})
);
ISystemConfig configImpl = ISystemConfig(
DeployUtils.create1({
_name: "SystemConfig",
_args: DeployUtils.encodeConstructor(abi.encodeCall(ISystemConfig.__constructor__, ()))
})
);
vm.prank(msg.sender); vm.prank(msg.sender);
proxy.upgradeToAndCall( proxy.upgradeToAndCall(
......
...@@ -5,14 +5,20 @@ pragma solidity 0.8.15; ...@@ -5,14 +5,20 @@ pragma solidity 0.8.15;
import { Test } from "forge-std/Test.sol"; import { Test } from "forge-std/Test.sol";
// Target contract // Target contract
import { DeployerWhitelist } from "src/legacy/DeployerWhitelist.sol"; import { IDeployerWhitelist } from "src/legacy/interfaces/IDeployerWhitelist.sol";
import { DeployUtils } from "scripts/libraries/DeployUtils.sol";
contract DeployerWhitelist_Test is Test { contract DeployerWhitelist_Test is Test {
DeployerWhitelist list; IDeployerWhitelist list;
/// @dev Sets up the test suite. /// @dev Sets up the test suite.
function setUp() public { function setUp() public {
list = new DeployerWhitelist(); list = IDeployerWhitelist(
DeployUtils.create1({
_name: "DeployerWhitelist",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IDeployerWhitelist.__constructor__, ()))
})
);
} }
/// @dev Tests that `owner` is initialized to the zero address. /// @dev Tests that `owner` is initialized to the zero address.
......
...@@ -5,23 +5,29 @@ pragma solidity 0.8.15; ...@@ -5,23 +5,29 @@ pragma solidity 0.8.15;
import { Test } from "forge-std/Test.sol"; import { Test } from "forge-std/Test.sol";
// Contracts // Contracts
import { L1BlockNumber } from "src/legacy/L1BlockNumber.sol"; import { IL1BlockNumber } from "src/legacy/interfaces/IL1BlockNumber.sol";
import { L1Block } from "src/L2/L1Block.sol"; import { L1Block } from "src/L2/L1Block.sol";
// Libraries // Libraries
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { DeployUtils } from "scripts/libraries/DeployUtils.sol";
contract L1BlockNumberTest is Test { contract L1BlockNumberTest is Test {
L1Block lb; L1Block lb;
L1BlockNumber bn; IL1BlockNumber bn;
uint64 constant number = 99; uint64 constant number = 99;
/// @dev Sets up the test suite. /// @dev Sets up the test suite.
function setUp() external { function setUp() external {
vm.etch(Predeploys.L1_BLOCK_ATTRIBUTES, address(new L1Block()).code); vm.etch(Predeploys.L1_BLOCK_ATTRIBUTES, vm.getDeployedCode("L1Block.sol:L1Block"));
lb = L1Block(Predeploys.L1_BLOCK_ATTRIBUTES); lb = L1Block(Predeploys.L1_BLOCK_ATTRIBUTES);
bn = new L1BlockNumber(); bn = IL1BlockNumber(
DeployUtils.create1({
_name: "L1BlockNumber",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IL1BlockNumber.__constructor__, ()))
})
);
vm.prank(lb.DEPOSITOR_ACCOUNT()); vm.prank(lb.DEPOSITOR_ACCOUNT());
lb.setL1BlockValues({ lb.setL1BlockValues({
......
...@@ -5,25 +5,40 @@ pragma solidity 0.8.15; ...@@ -5,25 +5,40 @@ pragma solidity 0.8.15;
import { Test } from "forge-std/Test.sol"; import { Test } from "forge-std/Test.sol";
// Target contract dependencies // Target contract dependencies
import { AddressManager } from "src/legacy/AddressManager.sol"; import { IAddressManager } from "src/legacy/interfaces/IAddressManager.sol";
// Target contract // Target contract
import { ResolvedDelegateProxy } from "src/legacy/ResolvedDelegateProxy.sol"; import { IResolvedDelegateProxy } from "src/legacy/interfaces/IResolvedDelegateProxy.sol";
import { DeployUtils } from "scripts/libraries/DeployUtils.sol";
contract ResolvedDelegateProxy_Test is Test { contract ResolvedDelegateProxy_Test is Test {
AddressManager internal addressManager; IAddressManager internal addressManager;
SimpleImplementation internal impl; SimpleImplementation internal impl;
SimpleImplementation internal proxy; SimpleImplementation internal proxy;
/// @dev Sets up the test suite. /// @dev Sets up the test suite.
function setUp() public { function setUp() public {
// Set up the address manager. // Set up the address manager.
addressManager = new AddressManager(); addressManager = IAddressManager(
DeployUtils.create1({
_name: "AddressManager",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IAddressManager.__constructor__, ()))
})
);
impl = new SimpleImplementation(); impl = new SimpleImplementation();
addressManager.setAddress("SimpleImplementation", address(impl)); addressManager.setAddress("SimpleImplementation", address(impl));
// Set up the proxy. // Set up the proxy.
proxy = SimpleImplementation(address(new ResolvedDelegateProxy(addressManager, "SimpleImplementation"))); proxy = SimpleImplementation(
address(
DeployUtils.create1({
_name: "ResolvedDelegateProxy",
_args: DeployUtils.encodeConstructor(
abi.encodeCall(IResolvedDelegateProxy.__constructor__, (addressManager, "SimpleImplementation"))
)
})
)
);
} }
/// @dev Tests that the proxy properly bubbles up returndata when the delegatecall succeeds. /// @dev Tests that the proxy properly bubbles up returndata when the delegatecall succeeds.
...@@ -42,8 +57,22 @@ contract ResolvedDelegateProxy_Test is Test { ...@@ -42,8 +57,22 @@ contract ResolvedDelegateProxy_Test is Test {
/// @dev Tests that the proxy fallback reverts as expected if the implementation within the /// @dev Tests that the proxy fallback reverts as expected if the implementation within the
/// address manager is not set. /// address manager is not set.
function test_fallback_addressManagerNotSet_reverts() public { function test_fallback_addressManagerNotSet_reverts() public {
AddressManager am = new AddressManager(); IAddressManager am = IAddressManager(
SimpleImplementation p = SimpleImplementation(address(new ResolvedDelegateProxy(am, "SimpleImplementation"))); DeployUtils.create1({
_name: "AddressManager",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IAddressManager.__constructor__, ()))
})
);
SimpleImplementation p = SimpleImplementation(
address(
DeployUtils.create1({
_name: "ResolvedDelegateProxy",
_args: DeployUtils.encodeConstructor(
abi.encodeCall(IResolvedDelegateProxy.__constructor__, (am, "SimpleImplementation"))
)
})
)
);
vm.expectRevert("ResolvedDelegateProxy: target address must be initialized"); vm.expectRevert("ResolvedDelegateProxy: target address must be initialized");
p.foo(0); p.foo(0);
......
...@@ -8,7 +8,7 @@ import { GnosisSafe as Safe } from "safe-contracts/GnosisSafe.sol"; ...@@ -8,7 +8,7 @@ import { GnosisSafe as Safe } from "safe-contracts/GnosisSafe.sol";
import "test/safe-tools/SafeTestTools.sol"; import "test/safe-tools/SafeTestTools.sol";
// Contracts // Contracts
import { DeputyGuardianModule } from "src/safe/DeputyGuardianModule.sol"; import { IDeputyGuardianModule } from "src/safe/interfaces/IDeputyGuardianModule.sol";
// Libraries // Libraries
import "src/dispute/lib/Types.sol"; import "src/dispute/lib/Types.sol";
...@@ -17,6 +17,7 @@ import "src/dispute/lib/Types.sol"; ...@@ -17,6 +17,7 @@ import "src/dispute/lib/Types.sol";
import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol"; import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol";
import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol"; import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol";
import { IAnchorStateRegistry } from "src/dispute/interfaces/IAnchorStateRegistry.sol"; import { IAnchorStateRegistry } from "src/dispute/interfaces/IAnchorStateRegistry.sol";
import { DeployUtils } from "scripts/libraries/DeployUtils.sol";
contract DeputyGuardianModule_TestInit is CommonTest, SafeTestTools { contract DeputyGuardianModule_TestInit is CommonTest, SafeTestTools {
using SafeTestLib for SafeInstance; using SafeTestLib for SafeInstance;
...@@ -26,7 +27,7 @@ contract DeputyGuardianModule_TestInit is CommonTest, SafeTestTools { ...@@ -26,7 +27,7 @@ contract DeputyGuardianModule_TestInit is CommonTest, SafeTestTools {
event ExecutionFromModuleSuccess(address indexed); event ExecutionFromModuleSuccess(address indexed);
DeputyGuardianModule deputyGuardianModule; IDeputyGuardianModule deputyGuardianModule;
SafeInstance safeInstance; SafeInstance safeInstance;
address deputyGuardian; address deputyGuardian;
...@@ -47,11 +48,16 @@ contract DeputyGuardianModule_TestInit is CommonTest, SafeTestTools { ...@@ -47,11 +48,16 @@ contract DeputyGuardianModule_TestInit is CommonTest, SafeTestTools {
deputyGuardian = makeAddr("deputyGuardian"); deputyGuardian = makeAddr("deputyGuardian");
deputyGuardianModule = new DeputyGuardianModule({ deputyGuardianModule = IDeputyGuardianModule(
_safe: safeInstance.safe, DeployUtils.create1({
_superchainConfig: superchainConfig, _name: "DeputyGuardianModule",
_deputyGuardian: deputyGuardian _args: DeployUtils.encodeConstructor(
}); abi.encodeCall(
IDeputyGuardianModule.__constructor__, (safeInstance.safe, superchainConfig, deputyGuardian)
)
)
})
);
safeInstance.enableModule(address(deputyGuardianModule)); safeInstance.enableModule(address(deputyGuardianModule));
} }
} }
......
...@@ -10,11 +10,12 @@ import { Bridge_Initializer } from "test/setup/Bridge_Initializer.sol"; ...@@ -10,11 +10,12 @@ import { Bridge_Initializer } from "test/setup/Bridge_Initializer.sol";
// Libraries // Libraries
import { Types } from "src/libraries/Types.sol"; import { Types } from "src/libraries/Types.sol";
import { SafeCall } from "src/libraries/SafeCall.sol"; import { SafeCall } from "src/libraries/SafeCall.sol";
import { L1BlockInterop } from "src/L2/L1BlockInterop.sol"; import { IL1BlockInterop } from "src/L2/interfaces/IL1BlockInterop.sol";
import { Encoding } from "src/libraries/Encoding.sol"; import { Encoding } from "src/libraries/Encoding.sol";
// Interfaces // Interfaces
import { ICrossDomainMessenger } from "src/universal/interfaces/ICrossDomainMessenger.sol"; import { ICrossDomainMessenger } from "src/universal/interfaces/ICrossDomainMessenger.sol";
import { DeployUtils } from "scripts/libraries/DeployUtils.sol";
// Free function for setting the prevBaseFee param in the OptimismPortal. // Free function for setting the prevBaseFee param in the OptimismPortal.
function setPrevBaseFee(Vm _vm, address _op, uint128 _prevBaseFee) { function setPrevBaseFee(Vm _vm, address _op, uint128 _prevBaseFee) {
...@@ -257,11 +258,16 @@ contract GasBenchMark_L1Block_SetValuesEcotone_Warm is GasBenchMark_L1Block { ...@@ -257,11 +258,16 @@ contract GasBenchMark_L1Block_SetValuesEcotone_Warm is GasBenchMark_L1Block {
} }
contract GasBenchMark_L1BlockInterop is GasBenchMark_L1Block { contract GasBenchMark_L1BlockInterop is GasBenchMark_L1Block {
L1BlockInterop l1BlockInterop; IL1BlockInterop l1BlockInterop;
function setUp() public virtual override { function setUp() public virtual override {
super.setUp(); super.setUp();
l1BlockInterop = new L1BlockInterop(); l1BlockInterop = IL1BlockInterop(
DeployUtils.create1({
_name: "L1BlockInterop",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IL1BlockInterop.__constructor__, ()))
})
);
setValuesCalldata = Encoding.encodeSetL1BlockValuesInterop( setValuesCalldata = Encoding.encodeSetL1BlockValuesInterop(
type(uint32).max, type(uint32).max,
type(uint32).max, type(uint32).max,
......
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
pragma solidity 0.8.15; pragma solidity 0.8.15;
import { Test } from "forge-std/Test.sol"; import { Test } from "forge-std/Test.sol";
import { Proxy } from "src/universal/Proxy.sol";
import { Bytes32AddressLib } from "@rari-capital/solmate/src/utils/Bytes32AddressLib.sol"; import { Bytes32AddressLib } from "@rari-capital/solmate/src/utils/Bytes32AddressLib.sol";
import { IProxy } from "src/universal/interfaces/IProxy.sol";
import { DeployUtils } from "scripts/libraries/DeployUtils.sol";
contract SimpleStorage { contract SimpleStorage {
mapping(uint256 => uint256) internal store; mapping(uint256 => uint256) internal store;
...@@ -33,13 +34,18 @@ contract Proxy_Test is Test { ...@@ -33,13 +34,18 @@ contract Proxy_Test is Test {
bytes32 internal constant OWNER_KEY = bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1); bytes32 internal constant OWNER_KEY = bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1);
Proxy proxy; IProxy proxy;
SimpleStorage simpleStorage; SimpleStorage simpleStorage;
function setUp() external { function setUp() external {
// Deploy a proxy and simple storage contract as // Deploy a proxy and simple storage contract as
// the implementation // the implementation
proxy = new Proxy(alice); proxy = IProxy(
DeployUtils.create1({
_name: "Proxy",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IProxy.__constructor__, (alice)))
})
);
simpleStorage = new SimpleStorage(); simpleStorage = new SimpleStorage();
vm.prank(alice); vm.prank(alice);
......
...@@ -5,47 +5,73 @@ pragma solidity 0.8.15; ...@@ -5,47 +5,73 @@ pragma solidity 0.8.15;
import { Test } from "forge-std/Test.sol"; import { Test } from "forge-std/Test.sol";
import { SimpleStorage } from "test/universal/Proxy.t.sol"; import { SimpleStorage } from "test/universal/Proxy.t.sol";
// Contracts
import { Proxy } from "src/universal/Proxy.sol";
import { ProxyAdmin } from "src/universal/ProxyAdmin.sol";
import { AddressManager } from "src/legacy/AddressManager.sol";
import { L1ChugSplashProxy } from "src/legacy/L1ChugSplashProxy.sol";
import { ResolvedDelegateProxy } from "src/legacy/ResolvedDelegateProxy.sol";
// Interfaces // Interfaces
import { IAddressManager } from "src/legacy/interfaces/IAddressManager.sol"; import { IAddressManager } from "src/legacy/interfaces/IAddressManager.sol";
import { IL1ChugSplashProxy } from "src/legacy/interfaces/IL1ChugSplashProxy.sol";
import { IResolvedDelegateProxy } from "src/legacy/interfaces/IResolvedDelegateProxy.sol";
import { IProxy } from "src/universal/interfaces/IProxy.sol";
import { IProxyAdmin } from "src/universal/interfaces/IProxyAdmin.sol";
import { DeployUtils } from "scripts/libraries/DeployUtils.sol";
contract ProxyAdmin_Test is Test { contract ProxyAdmin_Test is Test {
address alice = address(64); address alice = address(64);
Proxy proxy; IProxy proxy;
L1ChugSplashProxy chugsplash; IL1ChugSplashProxy chugsplash;
ResolvedDelegateProxy resolved; IResolvedDelegateProxy resolved;
AddressManager addressManager; IAddressManager addressManager;
ProxyAdmin admin; IProxyAdmin admin;
SimpleStorage implementation; SimpleStorage implementation;
function setUp() external { function setUp() external {
// Deploy the proxy admin // Deploy the proxy admin
admin = new ProxyAdmin(alice); admin = IProxyAdmin(
DeployUtils.create1({
_name: "ProxyAdmin",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IProxyAdmin.__constructor__, (alice)))
})
);
// Deploy the standard proxy // Deploy the standard proxy
proxy = new Proxy(address(admin)); proxy = IProxy(
DeployUtils.create1({
_name: "Proxy",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IProxy.__constructor__, (address(admin))))
})
);
// Deploy the legacy L1ChugSplashProxy with the admin as the owner // Deploy the legacy L1ChugSplashProxy with the admin as the owner
chugsplash = new L1ChugSplashProxy(address(admin)); chugsplash = IL1ChugSplashProxy(
DeployUtils.create1({
_name: "L1ChugSplashProxy",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IL1ChugSplashProxy.__constructor__, (address(admin))))
})
);
// Deploy the legacy AddressManager // Deploy the legacy AddressManager
addressManager = new AddressManager(); addressManager = IAddressManager(
DeployUtils.create1({
_name: "AddressManager",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IAddressManager.__constructor__, ()))
})
);
// The proxy admin must be the new owner of the address manager // The proxy admin must be the new owner of the address manager
addressManager.transferOwnership(address(admin)); addressManager.transferOwnership(address(admin));
// Deploy a legacy ResolvedDelegateProxy with the name `a`. // Deploy a legacy ResolvedDelegateProxy with the name `a`.
// Whatever `a` is set to in AddressManager will be the address // Whatever `a` is set to in AddressManager will be the address
// that is used for the implementation. // that is used for the implementation.
resolved = new ResolvedDelegateProxy(addressManager, "a"); resolved = IResolvedDelegateProxy(
DeployUtils.create1({
_name: "ResolvedDelegateProxy",
_args: DeployUtils.encodeConstructor(
abi.encodeCall(IResolvedDelegateProxy.__constructor__, (addressManager, "a"))
)
})
);
// Impersonate alice for setting up the admin. // Impersonate alice for setting up the admin.
vm.startPrank(alice); vm.startPrank(alice);
// Set the address of the address manager in the admin so that it // Set the address of the address manager in the admin so that it
...@@ -57,9 +83,9 @@ contract ProxyAdmin_Test is Test { ...@@ -57,9 +83,9 @@ contract ProxyAdmin_Test is Test {
admin.setImplementationName(address(resolved), "a"); admin.setImplementationName(address(resolved), "a");
// Set the proxy types // Set the proxy types
admin.setProxyType(address(proxy), ProxyAdmin.ProxyType.ERC1967); admin.setProxyType(address(proxy), IProxyAdmin.ProxyType.ERC1967);
admin.setProxyType(address(chugsplash), ProxyAdmin.ProxyType.CHUGSPLASH); admin.setProxyType(address(chugsplash), IProxyAdmin.ProxyType.CHUGSPLASH);
admin.setProxyType(address(resolved), ProxyAdmin.ProxyType.RESOLVED); admin.setProxyType(address(resolved), IProxyAdmin.ProxyType.RESOLVED);
vm.stopPrank(); vm.stopPrank();
implementation = new SimpleStorage(); implementation = new SimpleStorage();
...@@ -83,7 +109,7 @@ contract ProxyAdmin_Test is Test { ...@@ -83,7 +109,7 @@ contract ProxyAdmin_Test is Test {
function test_setProxyType_notOwner_reverts() external { function test_setProxyType_notOwner_reverts() external {
vm.expectRevert("Ownable: caller is not the owner"); vm.expectRevert("Ownable: caller is not the owner");
admin.setProxyType(address(0), ProxyAdmin.ProxyType.CHUGSPLASH); admin.setProxyType(address(0), IProxyAdmin.ProxyType.CHUGSPLASH);
} }
function test_owner_succeeds() external view { function test_owner_succeeds() external view {
...@@ -91,9 +117,9 @@ contract ProxyAdmin_Test is Test { ...@@ -91,9 +117,9 @@ contract ProxyAdmin_Test is Test {
} }
function test_proxyType_succeeds() external view { function test_proxyType_succeeds() external view {
assertEq(uint256(admin.proxyType(address(proxy))), uint256(ProxyAdmin.ProxyType.ERC1967)); assertEq(uint256(admin.proxyType(address(proxy))), uint256(IProxyAdmin.ProxyType.ERC1967));
assertEq(uint256(admin.proxyType(address(chugsplash))), uint256(ProxyAdmin.ProxyType.CHUGSPLASH)); assertEq(uint256(admin.proxyType(address(chugsplash))), uint256(IProxyAdmin.ProxyType.CHUGSPLASH));
assertEq(uint256(admin.proxyType(address(resolved))), uint256(ProxyAdmin.ProxyType.RESOLVED)); assertEq(uint256(admin.proxyType(address(resolved))), uint256(IProxyAdmin.ProxyType.RESOLVED));
} }
function test_erc1967GetProxyImplementation_succeeds() external { function test_erc1967GetProxyImplementation_succeeds() external {
...@@ -153,7 +179,7 @@ contract ProxyAdmin_Test is Test { ...@@ -153,7 +179,7 @@ contract ProxyAdmin_Test is Test {
} }
function changeProxyAdmin(address payable _proxy) internal { function changeProxyAdmin(address payable _proxy) internal {
ProxyAdmin.ProxyType proxyType = admin.proxyType(address(_proxy)); IProxyAdmin.ProxyType proxyType = admin.proxyType(address(_proxy));
vm.prank(alice); vm.prank(alice);
admin.changeProxyAdmin(_proxy, address(128)); admin.changeProxyAdmin(_proxy, address(128));
...@@ -162,13 +188,13 @@ contract ProxyAdmin_Test is Test { ...@@ -162,13 +188,13 @@ contract ProxyAdmin_Test is Test {
// no longer call the proxy interface except for // no longer call the proxy interface except for
// the ResolvedDelegate type on which anybody can // the ResolvedDelegate type on which anybody can
// call the admin interface. // call the admin interface.
if (proxyType == ProxyAdmin.ProxyType.ERC1967) { if (proxyType == IProxyAdmin.ProxyType.ERC1967) {
vm.expectRevert("Proxy: implementation not initialized"); vm.expectRevert("Proxy: implementation not initialized");
admin.getProxyAdmin(_proxy); admin.getProxyAdmin(_proxy);
} else if (proxyType == ProxyAdmin.ProxyType.CHUGSPLASH) { } else if (proxyType == IProxyAdmin.ProxyType.CHUGSPLASH) {
vm.expectRevert("L1ChugSplashProxy: implementation is not set yet"); vm.expectRevert("L1ChugSplashProxy: implementation is not set yet");
admin.getProxyAdmin(_proxy); admin.getProxyAdmin(_proxy);
} else if (proxyType == ProxyAdmin.ProxyType.RESOLVED) { } else if (proxyType == IProxyAdmin.ProxyType.RESOLVED) {
// Just an empty block to show that all cases are covered // Just an empty block to show that all cases are covered
} else { } else {
vm.expectRevert("ProxyAdmin: unknown proxy type"); vm.expectRevert("ProxyAdmin: unknown proxy type");
...@@ -177,11 +203,11 @@ contract ProxyAdmin_Test is Test { ...@@ -177,11 +203,11 @@ contract ProxyAdmin_Test is Test {
// Call the proxy contract directly to get the admin. // Call the proxy contract directly to get the admin.
// Different proxy types have different interfaces. // Different proxy types have different interfaces.
vm.prank(address(128)); vm.prank(address(128));
if (proxyType == ProxyAdmin.ProxyType.ERC1967) { if (proxyType == IProxyAdmin.ProxyType.ERC1967) {
assertEq(Proxy(payable(_proxy)).admin(), address(128)); assertEq(IProxy(payable(_proxy)).admin(), address(128));
} else if (proxyType == ProxyAdmin.ProxyType.CHUGSPLASH) { } else if (proxyType == IProxyAdmin.ProxyType.CHUGSPLASH) {
assertEq(L1ChugSplashProxy(payable(_proxy)).getOwner(), address(128)); assertEq(IL1ChugSplashProxy(payable(_proxy)).getOwner(), address(128));
} else if (proxyType == ProxyAdmin.ProxyType.RESOLVED) { } else if (proxyType == IProxyAdmin.ProxyType.RESOLVED) {
assertEq(addressManager.owner(), address(128)); assertEq(addressManager.owner(), address(128));
} else { } else {
assert(false); assert(false);
......
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
pragma solidity 0.8.25; pragma solidity 0.8.25;
import { Test } from "forge-std/Test.sol"; import { Test } from "forge-std/Test.sol";
import { OptimismSuperchainERC20 } from "src/L2/OptimismSuperchainERC20.sol"; import { IOptimismSuperchainERC20 } from "src/L2/interfaces/IOptimismSuperchainERC20.sol";
import { Initializable } from "@openzeppelin/contracts-v5/proxy/utils/Initializable.sol"; import { Initializable } from "@openzeppelin/contracts-v5/proxy/utils/Initializable.sol";
import { DeployUtils } from "scripts/libraries/DeployUtils.sol";
/// @title InitializerOZv5_Test /// @title InitializerOZv5_Test
/// @dev Ensures that the `initialize()` function on contracts cannot be called more than /// @dev Ensures that the `initialize()` function on contracts cannot be called more than
/// once. Tests the contracts inheriting from `Initializable` from OpenZeppelin Contracts v5. /// once. Tests the contracts inheriting from `Initializable` from OpenZeppelin Contracts v5.
contract InitializerOZv5_Test is Test { contract InitializerOZv5_Test is Test {
/// @notice The storage slot of the `initialized` flag in the `Initializable` contract from OZ v5. /// @notice The storage slot of the `initialized` flag in the `Initializable` contract from OZ v5.
/// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) /// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
...@@ -31,8 +32,13 @@ contract InitializerOZv5_Test is Test { ...@@ -31,8 +32,13 @@ contract InitializerOZv5_Test is Test {
// OptimismSuperchainERC20 // OptimismSuperchainERC20
contracts.push( contracts.push(
InitializeableContract({ InitializeableContract({
target: address(new OptimismSuperchainERC20()), target: address(
initCalldata: abi.encodeCall(OptimismSuperchainERC20.initialize, (address(0), "", "", 18)) DeployUtils.create1({
_name: "OptimismSuperchainERC20",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IOptimismSuperchainERC20.__constructor__, ()))
})
),
initCalldata: abi.encodeCall(IOptimismSuperchainERC20.initialize, (address(0), "", "", 18))
}) })
); );
} }
......
...@@ -74,6 +74,7 @@ rules: ...@@ -74,6 +74,7 @@ rules:
exclude: exclude:
- packages/contracts-bedrock/src/universal/interfaces/IOptimismMintableERC721.sol - packages/contracts-bedrock/src/universal/interfaces/IOptimismMintableERC721.sol
- packages/contracts-bedrock/src/universal/interfaces/IWETH98.sol - packages/contracts-bedrock/src/universal/interfaces/IWETH98.sol
- packages/contracts-bedrock/src/dispute/interfaces/IDelayedWETH.sol
- op-chain-ops/script/testdata/scripts/ScriptExample.s.sol - op-chain-ops/script/testdata/scripts/ScriptExample.s.sol
- packages/contracts-bedrock/test - packages/contracts-bedrock/test
- packages/contracts-bedrock/scripts/libraries/Solarray.sol - packages/contracts-bedrock/scripts/libraries/Solarray.sol
......
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