Skip to content

Commit

Permalink
Delete unused function (#1043)
Browse files Browse the repository at this point in the history
  • Loading branch information
StanislavBreadless authored Oct 29, 2024
1 parent 96d42f2 commit 85046c1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 24 deletions.
10 changes: 10 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ The order of the files here only roughly represents the order of reading. A lot

![Reading order](./img/reading_order.png)

## Repo structure

The repository contains the following sections:

- [gas-bound-caller](../gas-bound-caller) that contains `GasBoundCaller` utility contract implementation. You can read more about it in its README.
- [da-contracts](../da-contracts/). There are implementations for [DA validation](./settlement_contracts/data_availability/custom_da.md) contracts that should be deployed on L1 only.
- [l1-contracts](../l1-contracts/). Despite the legacy name, it contains contracts that are deployed both on L1 and on L2. This folder encompasses bridging, ZK chain contracts, the contracts for chain admin, etc. The name is historical due to the fact that these contracts were usually deployed on L1 only. However with Gateway, settlement and bridging-related contracts will be deployed on both EVM and eraVM environment. Also, bridging has been unified between L1 and L2 in many places and so keeping everything in one project allows to avoid code duplication.
- [l2-contracts](../l2-contracts/). Contains contracts that are deployed only on L2.
- [system-contracts](../system-contracts/). Contains system contracts or predeployed L2 contracts.

## For auditors: Invariants/tricky places to look out for

This section is for auditors of the codebase. It includes some of the important invariants that the system relies on and which if broken could have bad consequences.
Expand Down
17 changes: 1 addition & 16 deletions l1-contracts/contracts/state-transition/ChainTypeManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {Ownable2StepUpgradeable} from "@openzeppelin/contracts-upgradeable-v4/ac
import {ReentrancyGuard} from "../common/ReentrancyGuard.sol";
import {L2_TO_L1_LOG_SERIALIZE_SIZE, DEFAULT_L2_LOGS_TREE_ROOT_HASH, EMPTY_STRING_KECCAK} from "../common/Config.sol";
import {Unauthorized, ZeroAddress, HashMismatch, GenesisUpgradeZero, GenesisBatchHashZero, GenesisIndexStorageZero, GenesisBatchCommitmentZero} from "../common/L1ContractErrors.sol";
import {InitialForceDeploymentMismatch, ZeroChainId, SettlementLayerNotRegistered, AdminZero, OutdatedProtocolVersion} from "./L1StateTransitionErrors.sol";
import {InitialForceDeploymentMismatch, AdminZero, OutdatedProtocolVersion} from "./L1StateTransitionErrors.sol";
import {SemVer} from "../common/libraries/SemVer.sol";
import {IBridgehub} from "../bridgehub/IBridgehub.sol";

Expand Down Expand Up @@ -432,21 +432,6 @@ contract ChainTypeManager is IChainTypeManager, ReentrancyGuard, Ownable2StepUpg
return IZKChain(getZKChain(_chainId)).getProtocolVersion();
}

/// @param _newSettlementLayerChainId the chainId of the chain
/// @param _isWhitelisted whether the chain is whitelisted
function registerSettlementLayer(uint256 _newSettlementLayerChainId, bool _isWhitelisted) external onlyOwner {
if (_newSettlementLayerChainId == 0) {
revert ZeroChainId();
}

// Currently, we require that the sync layer is deployed by the same CTM.
if (getZKChain(_newSettlementLayerChainId) == address(0)) {
revert SettlementLayerNotRegistered();
}

IBridgehub(BRIDGE_HUB).registerSettlementLayer(_newSettlementLayerChainId, _isWhitelisted);
}

/// @notice Called by the bridgehub during the migration of a chain to another settlement layer.
/// @param _chainId The chain id of the chain to be migrated.
/// @param _data The data needed to perform the migration.
Expand Down
2 changes: 0 additions & 2 deletions l1-contracts/contracts/state-transition/IChainTypeManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ interface IChainTypeManager {

function getSemverProtocolVersion() external view returns (uint32, uint32, uint32);

function registerSettlementLayer(uint256 _newSettlementLayerChainId, bool _isWhitelisted) external;

function forwardedBridgeBurn(
uint256 _chainId,
bytes calldata _data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,6 @@ error InvalidCommitment();
// 0xc866ff2c
error InitialForceDeploymentMismatch(bytes32 forceDeploymentHash, bytes32 initialForceDeploymentHash);

// 0xc84885d4
error ZeroChainId();

// 0x844da414
error SettlementLayerNotRegistered();

// 0xb325f767
error AdminZero();

Expand Down

0 comments on commit 85046c1

Please sign in to comment.