From 7fb81ec26855ad97890ad067860aae9bb768982e Mon Sep 17 00:00:00 2001 From: Nikita Stupin <178824211+nikitastupin-matterlabs@users.noreply.github.com> Date: Tue, 12 Nov 2024 19:36:50 +0700 Subject: [PATCH 1/2] use DataEncoding for consistency and fix comments --- .../contracts/bridge/asset-router/L1AssetRouter.sol | 2 +- .../state-transition/chain-deps/facets/Executor.sol | 6 +++--- .../contracts/state-transition/chain-interfaces/IAdmin.sol | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/l1-contracts/contracts/bridge/asset-router/L1AssetRouter.sol b/l1-contracts/contracts/bridge/asset-router/L1AssetRouter.sol index cf2ab966c..17e8dfc73 100644 --- a/l1-contracts/contracts/bridge/asset-router/L1AssetRouter.sol +++ b/l1-contracts/contracts/bridge/asset-router/L1AssetRouter.sol @@ -144,7 +144,7 @@ contract L1AssetRouter is AssetRouterBase, IL1AssetRouter, ReentrancyGuard { bytes32 _assetRegistrationData, address _assetDeploymentTracker ) external onlyOwner { - bytes32 assetId = keccak256(abi.encode(block.chainid, _assetDeploymentTracker, _assetRegistrationData)); + bytes32 assetId = DataEncoding.encodeAssetId(block.chainid, _assetRegistrationData, _assetDeploymentTracker); assetDeploymentTracker[assetId] = _assetDeploymentTracker; emit AssetDeploymentTrackerSet(assetId, _assetDeploymentTracker, _assetRegistrationData); } diff --git a/l1-contracts/contracts/state-transition/chain-deps/facets/Executor.sol b/l1-contracts/contracts/state-transition/chain-deps/facets/Executor.sol index 01a15829c..9adfc3b9e 100644 --- a/l1-contracts/contracts/state-transition/chain-deps/facets/Executor.sol +++ b/l1-contracts/contracts/state-transition/chain-deps/facets/Executor.sol @@ -228,9 +228,9 @@ contract ExecutorFacet is ZKChainBase, IExecutor { } } - // We only require 8 logs to be checked, the 9th is if we are expecting a protocol upgrade - // Without the protocol upgrade we expect 8 logs: 2^8 - 1 = 255 - // With the protocol upgrade we expect 9 logs: 2^9 - 1 = 511 + // We only require 7 logs to be checked, the 8th is if we are expecting a protocol upgrade + // Without the protocol upgrade we expect 7 logs: 2^7 - 1 = 127 + // With the protocol upgrade we expect 8 logs: 2^8 - 1 = 255 if (_expectedSystemContractUpgradeTxHash == bytes32(0)) { if (processedLogs != 127) { revert MissingSystemLogs(127, processedLogs); diff --git a/l1-contracts/contracts/state-transition/chain-interfaces/IAdmin.sol b/l1-contracts/contracts/state-transition/chain-interfaces/IAdmin.sol index ac5cfcc2d..ef21f4051 100644 --- a/l1-contracts/contracts/state-transition/chain-interfaces/IAdmin.sol +++ b/l1-contracts/contracts/state-transition/chain-interfaces/IAdmin.sol @@ -53,7 +53,7 @@ interface IAdmin is IZKChainBase { function upgradeChainFromVersion(uint256 _protocolVersion, Diamond.DiamondCutData calldata _cutData) external; /// @notice Executes a proposed governor upgrade - /// @dev Only the current admin can execute the upgrade + /// @dev Only the ChainTypeManager contract can execute the upgrade /// @param _diamondCut The diamond cut parameters to be executed function executeUpgrade(Diamond.DiamondCutData calldata _diamondCut) external; From 58657176446a3dd30849009d33702413fcb5b3da Mon Sep 17 00:00:00 2001 From: Nikita Stupin <178824211+nikitastupin-matterlabs@users.noreply.github.com> Date: Tue, 12 Nov 2024 20:10:59 +0700 Subject: [PATCH 2/2] fix typo --- l1-contracts/test/foundry/l1/integration/DeploymentTest.t.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/l1-contracts/test/foundry/l1/integration/DeploymentTest.t.sol b/l1-contracts/test/foundry/l1/integration/DeploymentTest.t.sol index 1c8bba297..c7ef28dad 100644 --- a/l1-contracts/test/foundry/l1/integration/DeploymentTest.t.sol +++ b/l1-contracts/test/foundry/l1/integration/DeploymentTest.t.sol @@ -139,12 +139,12 @@ contract DeploymentTests is L1ContractDeployer, ZKChainDeployer, TokenDeployer, address bridgehubStmForChain = bridgehub.chainTypeManager(chainId); bytes32 bridgehubBaseAssetIdForChain = bridgehub.baseTokenAssetId(chainId); - address bridgehubChainAddressdForChain = bridgehub.getZKChain(chainId); + address bridgehubChainAddressForChain = bridgehub.getZKChain(chainId); address bhAddr = IZKChain(chain).getBridgehub(); assertEq(bridgehubStmForChain, stmAddr); assertEq(bridgehubBaseAssetIdForChain, baseTokenAssetId); - assertEq(bridgehubChainAddressdForChain, chain); + assertEq(bridgehubChainAddressForChain, chain); assertEq(bhAddr, address(bridgehub)); }