Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: N-03 Unnecessary Code #990

Draft
wants to merge 1 commit into
base: library-fix-review
Choose a base branch
from
Draft
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
fix: N-03 Unnecessary Code
  • Loading branch information
kelemeno committed Oct 25, 2024
commit c5934cefa7bfe18aee337bab6ebad7fa8ce775c3
4 changes: 2 additions & 2 deletions l1-contracts/contracts/bridge/L2SharedBridgeLegacy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {UpgradeableBeacon} from "@openzeppelin/contracts-v4/proxy/beacon/Upgrade

import {BridgedStandardERC20} from "./BridgedStandardERC20.sol";

import {DEPLOYER_SYSTEM_CONTRACT, L2_ASSET_ROUTER_ADDR, L2_NATIVE_TOKEN_VAULT_ADDR} from "../common/L2ContractAddresses.sol";
import {L2_DEPLOYER_SYSTEM_CONTRACT_ADDR, L2_ASSET_ROUTER_ADDR, L2_NATIVE_TOKEN_VAULT_ADDR} from "../common/L2ContractAddresses.sol";
import {SystemContractsCaller} from "../common/libraries/SystemContractsCaller.sol";
import {L2ContractHelper, IContractDeployer} from "../common/libraries/L2ContractHelper.sol";

Expand Down Expand Up @@ -143,7 +143,7 @@ contract L2SharedBridgeLegacy is IL2SharedBridgeLegacy, Initializable {
function deployBeaconProxy(bytes32 salt) external onlyNTV returns (address proxy) {
(bool success, bytes memory returndata) = SystemContractsCaller.systemCallWithReturndata(
uint32(gasleft()),
DEPLOYER_SYSTEM_CONTRACT,
L2_DEPLOYER_SYSTEM_CONTRACT_ADDR,
0,
abi.encodeCall(
IContractDeployer.create2,
Expand Down
4 changes: 2 additions & 2 deletions l1-contracts/contracts/bridge/ntv/L2NativeTokenVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {NativeTokenVault} from "./NativeTokenVault.sol";
import {IL2SharedBridgeLegacy} from "../interfaces/IL2SharedBridgeLegacy.sol";
import {BridgedStandardERC20} from "../BridgedStandardERC20.sol";

import {DEPLOYER_SYSTEM_CONTRACT, L2_ASSET_ROUTER_ADDR} from "../../common/L2ContractAddresses.sol";
import {L2_DEPLOYER_SYSTEM_CONTRACT_ADDR, L2_ASSET_ROUTER_ADDR} from "../../common/L2ContractAddresses.sol";
import {L2ContractHelper, IContractDeployer} from "../../common/libraries/L2ContractHelper.sol";

import {SystemContractsCaller} from "../../common/libraries/SystemContractsCaller.sol";
Expand Down Expand Up @@ -136,7 +136,7 @@ contract L2NativeTokenVault is IL2NativeTokenVault, NativeTokenVault {

(bool success, bytes memory returndata) = SystemContractsCaller.systemCallWithReturndata(
uint32(gasleft()),
DEPLOYER_SYSTEM_CONTRACT,
L2_DEPLOYER_SYSTEM_CONTRACT_ADDR,
0,
abi.encodeCall(
IContractDeployer.create2,
Expand Down
3 changes: 0 additions & 3 deletions l1-contracts/contracts/common/L2ContractAddresses.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ address constant L2_MESSAGE_ROOT_ADDR = address(0x10005);
/// @dev the offset for the system contracts
uint160 constant SYSTEM_CONTRACTS_OFFSET = 0x8000; // 2^15

/// @dev the address of the deployer system contract
address constant DEPLOYER_SYSTEM_CONTRACT = address(SYSTEM_CONTRACTS_OFFSET + 0x06);

/// @dev the address of the l2 messenger system contract
IL2Messenger constant L2_MESSENGER = IL2Messenger(address(SYSTEM_CONTRACTS_OFFSET + 0x08));

Expand Down

This file was deleted.

8 changes: 4 additions & 4 deletions l1-contracts/test/foundry/l2/unit/utils/L2Utils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.20;

import {Vm} from "forge-std/Vm.sol";

import {DEPLOYER_SYSTEM_CONTRACT, L2_ASSET_ROUTER_ADDR, L2_NATIVE_TOKEN_VAULT_ADDR} from "contracts/common/L2ContractAddresses.sol";
import {L2_DEPLOYER_SYSTEM_CONTRACT_ADDR, L2_ASSET_ROUTER_ADDR, L2_NATIVE_TOKEN_VAULT_ADDR} from "contracts/common/L2ContractAddresses.sol";
import {IContractDeployer, L2ContractHelper} from "contracts/common/libraries/L2ContractHelper.sol";

import {L2AssetRouter} from "contracts/bridge/asset-router/L2AssetRouter.sol";
Expand Down Expand Up @@ -55,7 +55,7 @@ library L2Utils {
*/
function initSystemContracts() internal {
bytes memory contractDeployerBytecode = readSystemContractsBytecode("ContractDeployer");
vm.etch(DEPLOYER_SYSTEM_CONTRACT, contractDeployerBytecode);
vm.etch(L2_DEPLOYER_SYSTEM_CONTRACT_ADDR, contractDeployerBytecode);
}

/// @notice Deploys the L2AssetRouter contract.
Expand Down Expand Up @@ -89,7 +89,7 @@ library L2Utils {
});

vm.prank(L2_FORCE_DEPLOYER_ADDR);
IContractDeployer(DEPLOYER_SYSTEM_CONTRACT).forceDeployOnAddresses(deployments);
IContractDeployer(L2_DEPLOYER_SYSTEM_CONTRACT_ADDR).forceDeployOnAddresses(deployments);
}

/// @notice Deploys the L2NativeTokenVault contract.
Expand Down Expand Up @@ -146,7 +146,7 @@ library L2Utils {
});

vm.prank(L2_FORCE_DEPLOYER_ADDR);
IContractDeployer(DEPLOYER_SYSTEM_CONTRACT).forceDeployOnAddresses(deployments);
IContractDeployer(L2_DEPLOYER_SYSTEM_CONTRACT_ADDR).forceDeployOnAddresses(deployments);
}

/// @notice Encodes the token data.
Expand Down
Loading