From 9bf1e0c6f06ab206e8426c85574eacd0e583c7c3 Mon Sep 17 00:00:00 2001 From: kelemeno Date: Thu, 6 Feb 2025 19:06:53 +0000 Subject: [PATCH] doc comment fixes --- l1-contracts/contracts/bridge/L1ERC20Bridge.sol | 4 ++-- l1-contracts/contracts/bridge/ntv/NativeTokenVault.sol | 2 +- l1-contracts/contracts/common/libraries/DataEncoding.sol | 2 +- .../contracts/common/libraries/L2ContractHelper.sol | 2 +- l1-contracts/contracts/common/libraries/Merkle.sol | 5 +++-- .../contracts/state-transition/ChainTypeManager.sol | 2 +- system-contracts/contracts/MsgValueSimulator.sol | 6 +++--- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/l1-contracts/contracts/bridge/L1ERC20Bridge.sol b/l1-contracts/contracts/bridge/L1ERC20Bridge.sol index bb3f6dd56..7f52332c1 100644 --- a/l1-contracts/contracts/bridge/L1ERC20Bridge.sol +++ b/l1-contracts/contracts/bridge/L1ERC20Bridge.sol @@ -134,7 +134,7 @@ contract L1ERC20Bridge is IL1ERC20Bridge, ReentrancyGuard { if (isWithdrawalFinalized[_l2BatchNumber][_l2MessageIndex]) { revert WithdrawalAlreadyFinalized(); } - // We don't need to set finalizeWithdrawal here, as we set it in the shared bridge + // We don't need to set finalizeWithdrawal here, as we set it in the L1 Nullifier FinalizeL1DepositParams memory finalizeWithdrawalParams = FinalizeL1DepositParams({ chainId: ERA_CHAIN_ID, @@ -221,7 +221,7 @@ contract L1ERC20Bridge is IL1ERC20Bridge, ReentrancyGuard { ERA LEGACY FUNCTIONS //////////////////////////////////////////////////////////////*/ - /// @dev Transfers tokens from the depositor address to the native token vault address. + /// @dev Transfers tokens from the depositor address to the asset router address. /// @return The difference between the contract balance before and after the transferring of funds. function _approveFundsToAssetRouter(address _from, IERC20 _token, uint256 _amount) internal returns (uint256) { uint256 balanceBefore = _token.balanceOf(address(this)); diff --git a/l1-contracts/contracts/bridge/ntv/NativeTokenVault.sol b/l1-contracts/contracts/bridge/ntv/NativeTokenVault.sol index 021cab58a..0ff4022da 100644 --- a/l1-contracts/contracts/bridge/ntv/NativeTokenVault.sol +++ b/l1-contracts/contracts/bridge/ntv/NativeTokenVault.sol @@ -122,7 +122,7 @@ abstract contract NativeTokenVault is //////////////////////////////////////////////////////////////*/ /// @inheritdoc IAssetHandler - /// @notice Used when the chain receives a transfer from L1 Shared Bridge and correspondingly mints the asset. + /// @notice Used when the chain receives a transfer from another chain's Asset Router and correspondingly mints the asset. /// @param _chainId The chainId that the message is from. /// @param _assetId The assetId of the asset being bridged. /// @param _data The abi.encoded transfer data. diff --git a/l1-contracts/contracts/common/libraries/DataEncoding.sol b/l1-contracts/contracts/common/libraries/DataEncoding.sol index 4c623febb..b0b784943 100644 --- a/l1-contracts/contracts/common/libraries/DataEncoding.sol +++ b/l1-contracts/contracts/common/libraries/DataEncoding.sol @@ -131,7 +131,7 @@ library DataEncoding { /// @param _originalCaller The address of the entity that initiated the deposit. /// @param _assetId The unique identifier of the deposited L1 token. /// @param _nativeTokenVault The address of the token, only used if the encoding version is legacy. - /// @param _transferData The encoded transfer data, which includes both the deposit amount and the address of the L2 receiver. + /// @param _transferData The encoded transfer data, which includes the deposit amount, the address of the L2 receiver, and potentially the token address. /// @return txDataHash The resulting encoded transaction data hash. function encodeTxDataHash( bytes1 _encodingVersion, diff --git a/l1-contracts/contracts/common/libraries/L2ContractHelper.sol b/l1-contracts/contracts/common/libraries/L2ContractHelper.sol index d33ced05d..0d71428c9 100644 --- a/l1-contracts/contracts/common/libraries/L2ContractHelper.sol +++ b/l1-contracts/contracts/common/libraries/L2ContractHelper.sol @@ -184,7 +184,7 @@ library L2ContractHelper { for (uint256 i = 0; i < factoryDepsLen; i = i.uncheckedInc()) { bytes32 hashedBytecode = hashL2Bytecode(_factoryDeps[i]); - // Store the resulting hash sequentially in bytes. + // Store the resulting hash sequentially in words. assembly { mstore(add(hashedFactoryDeps, mul(add(i, 1), 32)), hashedBytecode) } diff --git a/l1-contracts/contracts/common/libraries/Merkle.sol b/l1-contracts/contracts/common/libraries/Merkle.sol index c6fd737c7..72249f57c 100644 --- a/l1-contracts/contracts/common/libraries/Merkle.sol +++ b/l1-contracts/contracts/common/libraries/Merkle.sol @@ -37,9 +37,10 @@ library Merkle { } /// @dev Calculate Merkle root by the provided Merkle proof. - /// NOTE: When using this function, check that the _path length is equal to the tree height to prevent shorter/longer paths attack + /// @dev NOTE: When using this function, check that the _path length is appropriate to prevent shorter/longer paths attack /// @param _path Merkle path from the leaf to the root - /// @param _index Leaf index in the tree + /// @param _index Leaf index in the tree. + /// @dev NOTE the tree can be joined. In this case the second tree's leaves indexes increase by the number of leaves in the first tree. /// @param _itemHash Hash of leaf content /// @return The Merkle root function calculateRootMemory( diff --git a/l1-contracts/contracts/state-transition/ChainTypeManager.sol b/l1-contracts/contracts/state-transition/ChainTypeManager.sol index 7b17dc7f0..a306ce68e 100644 --- a/l1-contracts/contracts/state-transition/ChainTypeManager.sol +++ b/l1-contracts/contracts/state-transition/ChainTypeManager.sol @@ -22,7 +22,7 @@ import {IBridgehub} from "../bridgehub/IBridgehub.sol"; import {ReentrancyGuard} from "../common/ReentrancyGuard.sol"; -/// @title State Transition Manager contract +/// @title Chain Type Manager contract /// @author Matter Labs /// @custom:security-contact security@matterlabs.dev contract ChainTypeManager is IChainTypeManager, ReentrancyGuard, Ownable2StepUpgradeable { diff --git a/system-contracts/contracts/MsgValueSimulator.sol b/system-contracts/contracts/MsgValueSimulator.sol index fe74f8683..4f48656ca 100644 --- a/system-contracts/contracts/MsgValueSimulator.sol +++ b/system-contracts/contracts/MsgValueSimulator.sol @@ -20,9 +20,9 @@ import {InvalidCall} from "./SystemContractErrors.sol"; contract MsgValueSimulator is SystemContractBase { /// @notice Extract value, isSystemCall and to from the extraAbi params. /// @dev The contract accepts value, the callee and whether the call should be a system one via its ABI params. - /// @dev The first ABI param contains the value. The second one contains - /// the address to call, while the third one contains whether the `systemCall` flag should - /// be used (this can be helpful when e.g. calling `ContractDeployer`). + /// @dev The first ABI param contains the value. The second one contains whether the `systemCall` flag should + /// be used (this can be helpful when e.g. calling `ContractDeployer`), + /// while the third one contains the address to call. function _getAbiParams() internal view returns (uint256 value, bool isSystemCall, address to) { value = SystemContractHelper.getExtraAbiData(0); uint256 addressAsUint = SystemContractHelper.getExtraAbiData(1);