diff --git a/l1-contracts/contracts/bridge/L2SharedBridgeLegacy.sol b/l1-contracts/contracts/bridge/L2SharedBridgeLegacy.sol index 4ae901593..b7c762b71 100644 --- a/l1-contracts/contracts/bridge/L2SharedBridgeLegacy.sol +++ b/l1-contracts/contracts/bridge/L2SharedBridgeLegacy.sol @@ -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"; import {AddressAliasHelper} from "../vendor/AddressAliasHelper.sol"; @@ -175,7 +175,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, diff --git a/l1-contracts/contracts/bridge/interfaces/IL2Bridge.sol b/l1-contracts/contracts/bridge/interfaces/IL2Bridge.sol deleted file mode 100644 index 7fe7b7a97..000000000 --- a/l1-contracts/contracts/bridge/interfaces/IL2Bridge.sol +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: MIT -// We use a floating point pragma here so it can be used within other projects that interact with the ZKsync ecosystem without using our exact pragma version. -pragma solidity ^0.8.21; - -/// @author Matter Labs -/// @custom:security-contact security@matterlabs.dev -interface IL2Bridge { - function withdraw(bytes32 _assetId, bytes memory _assetData) external; - - function finalizeDeposit(bytes32 _assetId, bytes calldata _transferData) external; - - function l1Bridge() external view returns (address); - - function setAssetHandlerAddress(bytes32 _assetId, address _assetAddress) external; -} diff --git a/l1-contracts/contracts/bridge/ntv/L2NativeTokenVault.sol b/l1-contracts/contracts/bridge/ntv/L2NativeTokenVault.sol index 379a67daf..af66345dc 100644 --- a/l1-contracts/contracts/bridge/ntv/L2NativeTokenVault.sol +++ b/l1-contracts/contracts/bridge/ntv/L2NativeTokenVault.sol @@ -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"; @@ -163,7 +163,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, diff --git a/l1-contracts/contracts/bridgehub/IMessageRoot.sol b/l1-contracts/contracts/bridgehub/IMessageRoot.sol index 2e15e6f63..d4a3c7d7b 100644 --- a/l1-contracts/contracts/bridgehub/IMessageRoot.sol +++ b/l1-contracts/contracts/bridgehub/IMessageRoot.sol @@ -4,8 +4,11 @@ pragma solidity 0.8.24; import {IBridgehub} from "./IBridgehub.sol"; -/// @author Matter Labs -/// @custom:security-contact security@matterlabs.dev +/** + * @author Matter Labs + * @notice MessageRoot contract is responsible for storing and aggregating the roots of the batches from different chains into the MessageRoot. + * @custom:security-contact security@matterlabs.dev + */ interface IMessageRoot { function BRIDGE_HUB() external view returns (IBridgehub); diff --git a/l1-contracts/contracts/common/Config.sol b/l1-contracts/contracts/common/Config.sol index 1aa26ba4f..0e3ed1f61 100644 --- a/l1-contracts/contracts/common/Config.sol +++ b/l1-contracts/contracts/common/Config.sol @@ -18,7 +18,6 @@ uint256 constant MAX_L2_TO_L1_LOGS_COMMITMENT_BYTES = 4 + L2_TO_L1_LOG_SERIALIZE /// @dev Actually equal to the `keccak256(new bytes(L2_TO_L1_LOG_SERIALIZE_SIZE))` bytes32 constant L2_L1_LOGS_TREE_DEFAULT_LEAF_HASH = 0x72abee45b59e344af8a6e520241c4744aff26ed411f4c4b00f8af09adada43ba; -// TODO: change constant to the real root hash of empty Merkle tree (SMA-184) bytes32 constant DEFAULT_L2_LOGS_TREE_ROOT_HASH = bytes32(0); /// @dev Denotes the type of the ZKsync transaction that came from L1. diff --git a/l1-contracts/contracts/common/L2ContractAddresses.sol b/l1-contracts/contracts/common/L2ContractAddresses.sol index fa8695656..2f656acd9 100644 --- a/l1-contracts/contracts/common/L2ContractAddresses.sol +++ b/l1-contracts/contracts/common/L2ContractAddresses.sol @@ -69,15 +69,12 @@ interface IL2Messenger { /// if the assetId can be calculated with this address then it is in fact an NTV asset address constant L2_NATIVE_TOKEN_VAULT_ADDR = address(0x10004); -/// @dev the address of the l2 asse3t router. +/// @dev the address of the l2 asset router. 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)); diff --git a/l1-contracts/contracts/common/libraries/DataEncoding.sol b/l1-contracts/contracts/common/libraries/DataEncoding.sol index 2dc7dd6c5..f4aaff8a0 100644 --- a/l1-contracts/contracts/common/libraries/DataEncoding.sol +++ b/l1-contracts/contracts/common/libraries/DataEncoding.sol @@ -148,7 +148,8 @@ library DataEncoding { } } - /// @notice Encodes the token data by combining chain id, asset deployment tracker and asset data. + /// @notice Encodes the token data by combining chain id, and its metadata. + /// @dev Note that all the metadata of the token is expected to be ABI encoded. /// @param _chainId The id of the chain token is native to. /// @param _name The name of the token. /// @param _symbol The symbol of the token. diff --git a/l1-contracts/contracts/common/libraries/SystemContractsCaller.sol b/l1-contracts/contracts/common/libraries/SystemContractsCaller.sol index b6bf0c54a..30dbf3a81 100644 --- a/l1-contracts/contracts/common/libraries/SystemContractsCaller.sol +++ b/l1-contracts/contracts/common/libraries/SystemContractsCaller.sol @@ -48,7 +48,7 @@ library SystemContractsCaller { assembly { dataStart := add(data, 0x20) } - uint32 dataLength = uint32(Utils.safeCastToU32(data.length)); + uint32 dataLength = Utils.safeCastToU32(data.length); uint256 farCallAbi = getFarCallABI({ dataOffset: 0, diff --git a/l1-contracts/contracts/common/libraries/UnsafeBytes.sol b/l1-contracts/contracts/common/libraries/UnsafeBytes.sol index 4edf94004..e2680d9e0 100644 --- a/l1-contracts/contracts/common/libraries/UnsafeBytes.sol +++ b/l1-contracts/contracts/common/libraries/UnsafeBytes.sol @@ -30,13 +30,6 @@ library UnsafeBytes { } } - function readUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128 result, uint256 offset) { - assembly { - offset := add(_start, 16) - result := mload(add(_bytes, offset)) - } - } - function readUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256 result, uint256 offset) { assembly { offset := add(_start, 32) diff --git a/l1-contracts/contracts/dev-contracts/test/CustomUpgradeTest.sol b/l1-contracts/contracts/dev-contracts/test/CustomUpgradeTest.sol index 50fbd924a..e20d44863 100644 --- a/l1-contracts/contracts/dev-contracts/test/CustomUpgradeTest.sol +++ b/l1-contracts/contracts/dev-contracts/test/CustomUpgradeTest.sol @@ -25,7 +25,7 @@ contract CustomUpgradeTest is BaseZkSyncUpgrade { /// upgrade. function _postUpgrade(bytes calldata _customCallDataForUpgrade) internal override {} - /// @notice The main function that will be called by the upgrade proxy. + /// @notice The main function that will be delegate-called by the chain. /// @param _proposedUpgrade The upgrade to be executed. function upgrade(ProposedUpgrade calldata _proposedUpgrade) public override returns (bytes32) { (uint32 newMinorVersion, bool isPatchOnly) = _setNewProtocolVersion(_proposedUpgrade.newProtocolVersion); diff --git a/l1-contracts/contracts/dev-contracts/test/DummySharedBridge.sol b/l1-contracts/contracts/dev-contracts/test/DummySharedBridge.sol index c75ec4530..0033fac3c 100644 --- a/l1-contracts/contracts/dev-contracts/test/DummySharedBridge.sol +++ b/l1-contracts/contracts/dev-contracts/test/DummySharedBridge.sol @@ -10,7 +10,6 @@ import {TWO_BRIDGES_MAGIC_VALUE, ETH_TOKEN_ADDRESS} from "../../common/Config.so import {IL1NativeTokenVault} from "../../bridge/ntv/L1NativeTokenVault.sol"; import {L2_NATIVE_TOKEN_VAULT_ADDR} from "../../common/L2ContractAddresses.sol"; import {SafeERC20} from "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol"; -import {IL2Bridge} from "../../bridge/interfaces/IL2Bridge.sol"; import {IL2SharedBridgeLegacy} from "../../bridge/interfaces/IL2SharedBridgeLegacy.sol"; import {IL2SharedBridgeLegacyFunctions} from "../../bridge/interfaces/IL2SharedBridgeLegacyFunctions.sol"; diff --git a/l1-contracts/contracts/transactionFilterer/GatewayTransactionFilterer.sol b/l1-contracts/contracts/transactionFilterer/GatewayTransactionFilterer.sol index ebcb37ff8..25d57ce4f 100644 --- a/l1-contracts/contracts/transactionFilterer/GatewayTransactionFilterer.sol +++ b/l1-contracts/contracts/transactionFilterer/GatewayTransactionFilterer.sol @@ -8,7 +8,6 @@ import {ReentrancyGuard} from "../common/ReentrancyGuard.sol"; import {AlreadyWhitelisted, InvalidSelector, NotWhitelisted, ZeroAddress} from "../common/L1ContractErrors.sol"; import {ITransactionFilterer} from "../state-transition/chain-interfaces/ITransactionFilterer.sol"; import {IBridgehub} from "../bridgehub/IBridgehub.sol"; -import {IL2Bridge} from "../bridge/interfaces/IL2Bridge.sol"; import {IAssetRouterBase} from "../bridge/asset-router/IAssetRouterBase.sol"; import {IL2AssetRouter} from "../bridge/asset-router/IL2AssetRouter.sol"; @@ -86,25 +85,22 @@ contract GatewayTransactionFilterer is ITransactionFilterer, ReentrancyGuard, Ow if (IL2AssetRouter.setAssetHandlerAddress.selector == l2TxSelector) { (, bytes32 decodedAssetId, ) = abi.decode(l2Calldata[4:], (uint256, bytes32, address)); - return _checkSTMAssetId(decodedAssetId); + return _checkCTMAssetId(decodedAssetId); } - if ( - IAssetRouterBase.finalizeDeposit.selector != l2TxSelector && - IL2Bridge.finalizeDeposit.selector != l2TxSelector - ) { + if (IAssetRouterBase.finalizeDeposit.selector != l2TxSelector) { revert InvalidSelector(l2TxSelector); } (, bytes32 decodedAssetId, ) = abi.decode(l2Calldata[4:], (uint256, bytes32, bytes)); - return _checkSTMAssetId(decodedAssetId); + return _checkCTMAssetId(decodedAssetId); } return whitelistedSenders[sender]; } - function _checkSTMAssetId(bytes32 assetId) internal view returns (bool) { - address stmAddress = BRIDGE_HUB.ctmAssetIdToAddress(assetId); - return stmAddress != address(0); + function _checkCTMAssetId(bytes32 assetId) internal view returns (bool) { + address ctmAddress = BRIDGE_HUB.ctmAssetIdToAddress(assetId); + return ctmAddress != address(0); } } diff --git a/l1-contracts/contracts/upgrades/BaseZkSyncUpgrade.sol b/l1-contracts/contracts/upgrades/BaseZkSyncUpgrade.sol index d79e26725..a619e5311 100644 --- a/l1-contracts/contracts/upgrades/BaseZkSyncUpgrade.sol +++ b/l1-contracts/contracts/upgrades/BaseZkSyncUpgrade.sol @@ -61,7 +61,7 @@ abstract contract BaseZkSyncUpgrade is ZKChainBase { /// @notice Notifies about complete upgrade event UpgradeComplete(uint256 indexed newProtocolVersion, bytes32 indexed l2UpgradeTxHash, ProposedUpgrade upgrade); - /// @notice The main function that will be provided by the upgrade proxy + /// @notice The main function that will be delegate-called by the chain. /// @dev This is a virtual function and should be overridden by custom upgrade implementations. /// @param _proposedUpgrade The upgrade to be executed. /// @return txHash The hash of the L2 system contract upgrade transaction. diff --git a/l1-contracts/contracts/upgrades/DefaultUpgrade.sol b/l1-contracts/contracts/upgrades/DefaultUpgrade.sol index c6ebb18dc..87c6dd220 100644 --- a/l1-contracts/contracts/upgrades/DefaultUpgrade.sol +++ b/l1-contracts/contracts/upgrades/DefaultUpgrade.sol @@ -8,7 +8,7 @@ import {BaseZkSyncUpgrade, ProposedUpgrade} from "./BaseZkSyncUpgrade.sol"; /// @author Matter Labs /// @custom:security-contact security@matterlabs.dev contract DefaultUpgrade is BaseZkSyncUpgrade { - /// @notice The main function that will be called by the upgrade proxy. + /// @notice The main function that will be delegate-called by the chain. /// @param _proposedUpgrade The upgrade to be executed. function upgrade(ProposedUpgrade calldata _proposedUpgrade) public override returns (bytes32) { super.upgrade(_proposedUpgrade); diff --git a/l1-contracts/contracts/upgrades/GatewayUpgrade.sol b/l1-contracts/contracts/upgrades/GatewayUpgrade.sol index 2efa6230a..5274c44c3 100644 --- a/l1-contracts/contracts/upgrades/GatewayUpgrade.sol +++ b/l1-contracts/contracts/upgrades/GatewayUpgrade.sol @@ -33,14 +33,17 @@ contract GatewayUpgrade is BaseZkSyncUpgrade { using PriorityQueue for PriorityQueue.Queue; using PriorityTree for PriorityTree.Tree; + /// @notice The address of this contract. + /// @dev needed as this address is delegateCalled, and we delegateCall it again. address public immutable THIS_ADDRESS; constructor() { THIS_ADDRESS = address(this); } - /// @notice The main function that will be called by the upgrade proxy. + /// @notice The main function that will be delegate-called by the chain. /// @param _proposedUpgrade The upgrade to be executed. + /// @dev Doesn't require any access-control restrictions as the contract is used in the delegate call. function upgrade(ProposedUpgrade calldata _proposedUpgrade) public override returns (bytes32) { GatewayUpgradeEncodedInput memory encodedInput = abi.decode( _proposedUpgrade.postUpgradeCalldata, @@ -72,9 +75,7 @@ contract GatewayUpgrade is BaseZkSyncUpgrade { ); // slither-disable-next-line controlled-delegatecall - (bool success, ) = THIS_ADDRESS.delegatecall( - abi.encodeWithSelector(IGatewayUpgrade.upgradeExternal.selector, proposedUpgrade) - ); + (bool success, ) = THIS_ADDRESS.delegatecall(abi.encodeCall(IGatewayUpgrade.upgradeExternal, proposedUpgrade)); if (!success) { revert GatewayUpgradeFailed(); } @@ -82,6 +83,7 @@ contract GatewayUpgrade is BaseZkSyncUpgrade { } /// @notice The function that will be called from this same contract, we need an external call to be able to modify _proposedUpgrade (memory/calldata). + /// @dev Doesn't require any access-control restrictions as the contract is used in the delegate call. function upgradeExternal(ProposedUpgrade calldata _proposedUpgrade) external { super.upgrade(_proposedUpgrade); } diff --git a/l1-contracts/contracts/upgrades/IGatewayUpgrade.sol b/l1-contracts/contracts/upgrades/IGatewayUpgrade.sol index eaa74c75b..c2c972a5e 100644 --- a/l1-contracts/contracts/upgrades/IGatewayUpgrade.sol +++ b/l1-contracts/contracts/upgrades/IGatewayUpgrade.sol @@ -4,6 +4,14 @@ pragma solidity 0.8.24; import {ProposedUpgrade} from "./BaseZkSyncUpgrade.sol"; +/** + * @author Matter Labs + * @custom:security-contact security@matterlabs.dev + * @notice Gateway upgrade interface. Used for the protocol upgrade that introduces the Gateway. + */ interface IGatewayUpgrade { + /// @notice The upgrade function called from within this same contract + /// @dev This is needed for memory -> calldata conversion of the _upgrade arg. + /// @param _upgrade The upgrade to be executed. function upgradeExternal(ProposedUpgrade calldata _upgrade) external returns (bytes32); } diff --git a/l1-contracts/contracts/upgrades/IL1GenesisUpgrade.sol b/l1-contracts/contracts/upgrades/IL1GenesisUpgrade.sol index 57dd40131..c217e3be1 100644 --- a/l1-contracts/contracts/upgrades/IL1GenesisUpgrade.sol +++ b/l1-contracts/contracts/upgrades/IL1GenesisUpgrade.sol @@ -4,8 +4,18 @@ pragma solidity 0.8.24; import {L2CanonicalTransaction} from "../common/Messaging.sol"; +/** + * @author Matter Labs + * @custom:security-contact security@matterlabs.dev + * @notice L1 genesis upgrade interface. Every chain has to process an upgrade txs at its genesis. + * @notice This is needed to set system params like the chainId and to deploy some system contracts. + */ interface IL1GenesisUpgrade { /// @dev emitted when a chain registers and a GenesisUpgrade happens + /// @param _zkChain the address of the zk chain + /// @param _l2Transaction the l2 genesis upgrade transaction + /// @param _protocolVersion the current protocol version + /// @param _factoryDeps the factory dependencies needed for the upgrade event GenesisUpgrade( address indexed _zkChain, L2CanonicalTransaction _l2Transaction, @@ -13,6 +23,13 @@ interface IL1GenesisUpgrade { bytes[] _factoryDeps ); + /// @notice The main function that will be called by the Admin facet at genesis. + /// @param _l1GenesisUpgrade the address of the l1 genesis upgrade + /// @param _chainId the chain id + /// @param _protocolVersion the current protocol version + /// @param _l1CtmDeployerAddress the address of the l1 ctm deployer + /// @param _forceDeployments the force deployments + /// @param _factoryDeps the factory dependencies function genesisUpgrade( address _l1GenesisUpgrade, uint256 _chainId, diff --git a/l1-contracts/contracts/upgrades/L1GenesisUpgrade.sol b/l1-contracts/contracts/upgrades/L1GenesisUpgrade.sol index e9e01cfaf..107cecd03 100644 --- a/l1-contracts/contracts/upgrades/L1GenesisUpgrade.sol +++ b/l1-contracts/contracts/upgrades/L1GenesisUpgrade.sol @@ -24,7 +24,13 @@ import {L1GatewayHelper} from "./L1GatewayHelper.sol"; /// @author Matter Labs /// @custom:security-contact security@matterlabs.dev contract L1GenesisUpgrade is IL1GenesisUpgrade, BaseZkSyncUpgradeGenesis { - /// @notice The main function that will be called by the upgrade proxy. + /// @notice The main function that will be called by the Admin facet. + /// @param _l1GenesisUpgrade the address of the l1 genesis upgrade + /// @param _chainId the chain id + /// @param _protocolVersion the current protocol version + /// @param _l1CtmDeployerAddress the address of the l1 ctm deployer + /// @param _fixedForceDeploymentsData the force deployments data + /// @param _factoryDeps the factory dependencies function genesisUpgrade( address _l1GenesisUpgrade, uint256 _chainId, diff --git a/l1-contracts/deploy-scripts/DeployL1.s.sol b/l1-contracts/deploy-scripts/DeployL1.s.sol index ac33a1f0a..541a00eea 100644 --- a/l1-contracts/deploy-scripts/DeployL1.s.sol +++ b/l1-contracts/deploy-scripts/DeployL1.s.sol @@ -44,7 +44,6 @@ import {BridgedStandardERC20} from "contracts/bridge/BridgedStandardERC20.sol"; import {AddressHasNoCode} from "./ZkSyncScriptErrors.sol"; import {ICTMDeploymentTracker} from "contracts/bridgehub/ICTMDeploymentTracker.sol"; import {IMessageRoot} from "contracts/bridgehub/IMessageRoot.sol"; -import {IL2ContractDeployer} from "contracts/common/interfaces/IL2ContractDeployer.sol"; import {L2ContractHelper} from "contracts/common/libraries/L2ContractHelper.sol"; import {AddressAliasHelper} from "contracts/vendor/AddressAliasHelper.sol"; import {IL1Nullifier} from "contracts/bridge/L1Nullifier.sol"; diff --git a/l1-contracts/test/foundry/l1/integration/l2-tests-in-l1-context/L2WethTestAbstract.t.sol b/l1-contracts/test/foundry/l1/integration/l2-tests-in-l1-context/L2WethTestAbstract.t.sol index af52b4f74..3bc89b3ef 100644 --- a/l1-contracts/test/foundry/l1/integration/l2-tests-in-l1-context/L2WethTestAbstract.t.sol +++ b/l1-contracts/test/foundry/l1/integration/l2-tests-in-l1-context/L2WethTestAbstract.t.sol @@ -11,9 +11,7 @@ import {BridgedStandardERC20} from "contracts/bridge/BridgedStandardERC20.sol"; import {L2AssetRouter} from "contracts/bridge/asset-router/L2AssetRouter.sol"; import {IL2NativeTokenVault} from "contracts/bridge/ntv/IL2NativeTokenVault.sol"; -import {UpgradeableBeacon} from "@openzeppelin/contracts-v4/proxy/beacon/UpgradeableBeacon.sol"; -import {BeaconProxy} from "@openzeppelin/contracts-v4/proxy/beacon/BeaconProxy.sol"; - +import {Unauthorized, BridgeMintNotImplemented} from "contracts/common/L1ContractErrors.sol"; import {L2_ASSET_ROUTER_ADDR, L2_NATIVE_TOKEN_VAULT_ADDR, L2_BRIDGEHUB_ADDR} from "contracts/common/L2ContractAddresses.sol"; import {ETH_TOKEN_ADDRESS, SETTLEMENT_LAYER_RELAY_SENDER} from "contracts/common/Config.sol"; @@ -31,7 +29,6 @@ import {IZKChain} from "contracts/state-transition/chain-interfaces/IZKChain.sol import {SystemContractsArgs} from "./_SharedL2ContractL1DeployerUtils.sol"; import {DeployUtils} from "deploy-scripts/DeployUtils.s.sol"; -import {Unauthorized, BridgeMintNotImplemented} from "contracts/common/L1ContractErrors.sol"; abstract contract L2WethTestAbstract is Test, SharedL2ContractDeployer { function test_shouldDepositWethByCallingDeposit() public { diff --git a/l1-contracts/test/foundry/l1/unit/concrete/Governance/PermanentRestriction.t.sol b/l1-contracts/test/foundry/l1/unit/concrete/Governance/PermanentRestriction.t.sol index 525f89f60..54a576cb7 100644 --- a/l1-contracts/test/foundry/l1/unit/concrete/Governance/PermanentRestriction.t.sol +++ b/l1-contracts/test/foundry/l1/unit/concrete/Governance/PermanentRestriction.t.sol @@ -121,16 +121,16 @@ contract PermanentRestrictionTest is ChainTypeManagerTest { return permRestriction.isAdminOfAChain(chainAddr); } - function test_tryCompareAdminOfAChainIsAddressZero() public { - assertFalse(isAddressAdmin(address(0), owner)); + function test_isAdminOfAChainIsAddressZero() public { + assertFalse(permRestriction.isAdminOfAChain(address(0))); } - function test_tryCompareAdminOfAChainNotAHyperchain() public { - assertFalse(isAddressAdmin(makeAddr("random"), owner)); + function test_isAdminOfAChainNotAHyperchain() public { + assertFalse(permRestriction.isAdminOfAChain(makeAddr("random"))); } - function test_tryCompareAdminOfAChainNotAnAdmin() public { - assertFalse(isAddressAdmin(hyperchain, owner)); + function test_isAdminOfAChainOfAChainNotAnAdmin() public { + assertFalse(permRestriction.isAdminOfAChain(hyperchain)); } function test_tryCompareAdminOfAChain() public { diff --git a/l1-contracts/test/foundry/l2/integration/L2Utils.sol b/l1-contracts/test/foundry/l2/integration/L2Utils.sol index d10105734..cdda458cd 100644 --- a/l1-contracts/test/foundry/l2/integration/L2Utils.sol +++ b/l1-contracts/test/foundry/l2/integration/L2Utils.sol @@ -5,9 +5,7 @@ pragma solidity ^0.8.20; import {Vm} from "forge-std/Vm.sol"; import "forge-std/console.sol"; -import {UpgradeableBeacon} from "@openzeppelin/contracts-v4/proxy/beacon/UpgradeableBeacon.sol"; -import {BeaconProxy} from "@openzeppelin/contracts-v4/proxy/beacon/BeaconProxy.sol"; -import {DEPLOYER_SYSTEM_CONTRACT, L2_ASSET_ROUTER_ADDR, L2_NATIVE_TOKEN_VAULT_ADDR, L2_BRIDGEHUB_ADDR, L2_MESSAGE_ROOT_ADDR} from "contracts/common/L2ContractAddresses.sol"; +import {L2_DEPLOYER_SYSTEM_CONTRACT_ADDR, L2_ASSET_ROUTER_ADDR, L2_NATIVE_TOKEN_VAULT_ADDR, L2_BRIDGEHUB_ADDR, L2_MESSAGE_ROOT_ADDR} from "contracts/common/L2ContractAddresses.sol"; import {IContractDeployer, L2ContractHelper} from "contracts/common/libraries/L2ContractHelper.sol"; import {TransparentUpgradeableProxy} from "@openzeppelin/contracts-v4/proxy/transparent/TransparentUpgradeableProxy.sol"; @@ -70,7 +68,7 @@ library L2Utils { */ function initSystemContracts(SystemContractsArgs memory _args) internal { bytes memory contractDeployerBytecode = readSystemContractsBytecode("ContractDeployer"); - vm.etch(DEPLOYER_SYSTEM_CONTRACT, contractDeployerBytecode); + vm.etch(L2_DEPLOYER_SYSTEM_CONTRACT_ADDR, contractDeployerBytecode); forceDeploySystemContracts(_args); } @@ -213,7 +211,7 @@ library L2Utils { }); vm.prank(L2_FORCE_DEPLOYER_ADDR); - IContractDeployer(DEPLOYER_SYSTEM_CONTRACT).forceDeployOnAddresses(deployments); + IContractDeployer(L2_DEPLOYER_SYSTEM_CONTRACT_ADDR).forceDeployOnAddresses(deployments); } function deployViaCreat2L2( diff --git a/l1-contracts/test/foundry/unit/concrete/GatewayTransactionFilterer/CheckTransaction.sol b/l1-contracts/test/foundry/unit/concrete/GatewayTransactionFilterer/CheckTransaction.sol index 3231a7144..f9e22907f 100644 --- a/l1-contracts/test/foundry/unit/concrete/GatewayTransactionFilterer/CheckTransaction.sol +++ b/l1-contracts/test/foundry/unit/concrete/GatewayTransactionFilterer/CheckTransaction.sol @@ -4,13 +4,16 @@ pragma solidity 0.8.24; import {GatewayTransactionFiltererTest} from "./_GatewayTransactionFilterer_Shared.t.sol"; import {IGetters} from "contracts/state-transition/chain-interfaces/IGetters.sol"; -import {IL2Bridge} from "contracts/bridge/interfaces/IL2Bridge.sol"; import {IBridgehub} from "contracts/bridgehub/IBridgehub.sol"; +import {IAssetRouterBase} from "contracts/bridge/asset-router/IAssetRouterBase.sol"; import {AlreadyWhitelisted, InvalidSelector, NotWhitelisted} from "contracts/common/L1ContractErrors.sol"; contract CheckTransactionTest is GatewayTransactionFiltererTest { function test_TransactionAllowedOnlyFromWhitelistedSenderWhichIsNotAssetRouter() public { - bytes memory txCalladata = abi.encodeCall(IL2Bridge.finalizeDeposit, (bytes32("0x12345"), bytes("0x23456"))); + bytes memory txCalladata = abi.encodeCall( + IAssetRouterBase.finalizeDeposit, + (uint256(10), bytes32("0x12345"), bytes("0x23456")) + ); vm.startPrank(owner); vm.mockCall( bridgehub, @@ -50,7 +53,10 @@ contract CheckTransactionTest is GatewayTransactionFiltererTest { function test_TransactionAllowedFromWhitelistedSenderForChainBridging() public { address stm = address(0x6060606); - bytes memory txCalladata = abi.encodeCall(IL2Bridge.finalizeDeposit, (bytes32("0x12345"), bytes("0x23456"))); + bytes memory txCalladata = abi.encodeCall( + IAssetRouterBase.finalizeDeposit, + (uint256(10), bytes32("0x12345"), bytes("0x23456")) + ); vm.startPrank(owner); vm.mockCall( bridgehub, @@ -74,9 +80,14 @@ contract CheckTransactionTest is GatewayTransactionFiltererTest { } function test_TransactionFailsWithInvalidSelectorEvenIfTheSenderIsAR() public { - bytes memory txCalladata = abi.encodeCall(IL2Bridge.withdraw, (bytes32("0x12345"), bytes("0x23456"))); + bytes memory txCalladata = abi.encodeCall( + IAssetRouterBase.setAssetHandlerAddressThisChain, + (bytes32("0x12345"), address(0x01234567890123456789)) + ); vm.prank(owner); - vm.expectRevert(abi.encodeWithSelector(InvalidSelector.selector, IL2Bridge.withdraw.selector)); + vm.expectRevert( + abi.encodeWithSelector(InvalidSelector.selector, IAssetRouterBase.setAssetHandlerAddressThisChain.selector) + ); bool isTxAllowed = transactionFiltererProxy.isTransactionAllowed( assetRouter, address(0), diff --git a/l2-contracts/contracts/L2ContractHelper.sol b/l2-contracts/contracts/L2ContractHelper.sol index 219b1927b..f367e33ab 100644 --- a/l2-contracts/contracts/L2ContractHelper.sol +++ b/l2-contracts/contracts/L2ContractHelper.sol @@ -55,6 +55,12 @@ interface IContractDeployer { /// @param _input the calldata to be sent to the constructor of the new contract function create2(bytes32 _salt, bytes32 _bytecodeHash, bytes calldata _input) external returns (address); + /// @notice Calculates the address of a create2 contract deployment + /// @param _sender The address of the sender. + /// @param _bytecodeHash The bytecode hash of the new contract to be deployed. + /// @param _salt a unique value to create the deterministic address of the new contract + /// @param _input the calldata to be sent to the constructor of the new contract + /// @return newAddress The derived address of the account. function getNewAddressCreate2( address _sender, bytes32 _bytecodeHash, @@ -82,6 +88,11 @@ interface IBaseToken { * the compression of the state diffs and bytecodes. */ interface ICompressor { + /// @notice Verifies that the compression of state diffs has been done correctly for the {_stateDiffs} param. + /// @param _numberOfStateDiffs The number of state diffs being checked. + /// @param _enumerationIndexSize Number of bytes used to represent an enumeration index for repeated writes. + /// @param _stateDiffs Encoded full state diff structs. See the first dev comment below for encoding. + /// @param _compressedStateDiffs The compressed state diffs function verifyCompressedStateDiffs( uint256 _numberOfStateDiffs, uint256 _enumerationIndexSize, diff --git a/l2-contracts/contracts/errors/L2ContractErrors.sol b/l2-contracts/contracts/errors/L2ContractErrors.sol index 332c1b8b7..89e548ea0 100644 --- a/l2-contracts/contracts/errors/L2ContractErrors.sol +++ b/l2-contracts/contracts/errors/L2ContractErrors.sol @@ -8,22 +8,14 @@ error AddressMismatch(address expected, address supplied); error AssetIdMismatch(bytes32 expected, bytes32 supplied); // 0x5e85ae73 error AmountMustBeGreaterThanZero(); -// 0xb4f54111 -error DeployFailed(); // 0x7138356f error EmptyAddress(); -// 0x1c25715b -error EmptyBytes32(); // 0x1bdfd505 error FailedToTransferTokens(address tokenContract, address to, uint256 amount); // 0x2a1b2dd8 error InsufficientAllowance(uint256 providedAllowance, uint256 requiredAmount); -// 0xcbd9d2e0 -error InvalidCaller(address); // 0xb4fa3fb3 error InvalidInput(); -// 0x0ac76f01 -error NonSequentialVersion(); // 0x8e4a23d6 error Unauthorized(address); // 0xff15b069 diff --git a/system-contracts/SystemContractsHashes.json b/system-contracts/SystemContractsHashes.json index 60a5b5c83..a6dec1ede 100644 --- a/system-contracts/SystemContractsHashes.json +++ b/system-contracts/SystemContractsHashes.json @@ -3,49 +3,49 @@ "contractName": "AccountCodeStorage", "bytecodePath": "artifacts-zk/contracts-preprocessed/AccountCodeStorage.sol/AccountCodeStorage.json", "sourceCodePath": "contracts-preprocessed/AccountCodeStorage.sol", - "bytecodeHash": "0x0100005d279e00e3781eba9b8813f8de7bc5d652c848d583d0062b36b2cae29e", + "bytecodeHash": "0x0100005df535e7d1e6f3933b26076778d9c44fd6e7faf546732f08290d8c8f94", "sourceCodeHash": "0x2e0e09d57a04bd1e722d8bf8c6423fdf3f8bca44e5e8c4f6684f987794be066e" }, { "contractName": "BootloaderUtilities", "bytecodePath": "artifacts-zk/contracts-preprocessed/BootloaderUtilities.sol/BootloaderUtilities.json", "sourceCodePath": "contracts-preprocessed/BootloaderUtilities.sol", - "bytecodeHash": "0x010007c7d96a06465d57858ea13b4bb612215046e127974b5f5b5808f9e3c788", + "bytecodeHash": "0x010007c72b7f29a0e1954ee4c65e6598d0934d33c692faedd7ac4fe30b508fa3", "sourceCodeHash": "0x0f1213c4b95acb71f4ab5d4082cc1aeb2bd5017e1cccd46afc66e53268609d85" }, { "contractName": "ComplexUpgrader", "bytecodePath": "artifacts-zk/contracts-preprocessed/ComplexUpgrader.sol/ComplexUpgrader.json", "sourceCodePath": "contracts-preprocessed/ComplexUpgrader.sol", - "bytecodeHash": "0x010000bf784451a15f1bdcaa8ed5770cc25235984e44ce605779b79849386467", + "bytecodeHash": "0x010000bf6fcec0995b82b1c51133a507c8f63111234530b69fe7dadaae0c8172", "sourceCodeHash": "0xfcc74aefbc7cbde7945c29bad0e47527ac443bd6b75251a4ae520e28c714af37" }, { "contractName": "Compressor", "bytecodePath": "artifacts-zk/contracts-preprocessed/Compressor.sol/Compressor.json", "sourceCodePath": "contracts-preprocessed/Compressor.sol", - "bytecodeHash": "0x0100014b6c51a439159f8e86a891e3515eeea6b782efcba60b7b2ff0008a6869", + "bytecodeHash": "0x0100014b2cac967629cb05fb59a5c77cb5a077b74c50521ed9216a59511bf182", "sourceCodeHash": "0x7240b5fb2ea8e184522e731fb14f764ebae52b8a69d1870a55daedac9a3ed617" }, { "contractName": "ContractDeployer", "bytecodePath": "artifacts-zk/contracts-preprocessed/ContractDeployer.sol/ContractDeployer.json", "sourceCodePath": "contracts-preprocessed/ContractDeployer.sol", - "bytecodeHash": "0x010004e51f0fb3af074c21411a299285b9b6760d577a79bfd98a6d15bde5bd2c", + "bytecodeHash": "0x010004e5a266e697bb45bc90ff310dcb293725006146ff83e46bde8f3c6b44fa", "sourceCodeHash": "0x92bc09da23ed9d86ba7a84f0dbf48503c99582ae58cdbebbdcc5f14ea1fcf014" }, { "contractName": "Create2Factory", "bytecodePath": "artifacts-zk/contracts-preprocessed/Create2Factory.sol/Create2Factory.json", "sourceCodePath": "contracts-preprocessed/Create2Factory.sol", - "bytecodeHash": "0x0100004979f4353b7edd11ad71b4e0435ae74dc669248f12646e06a95ae5eeec", + "bytecodeHash": "0x010000493a391e65a70dea42442132cf7c7001dac94388b9c4218ce9b1491b57", "sourceCodeHash": "0x97392413259e6aae5187768cefd734507460ae818d6975709cc9b4e15a9af906" }, { "contractName": "DefaultAccount", "bytecodePath": "artifacts-zk/contracts-preprocessed/DefaultAccount.sol/DefaultAccount.json", "sourceCodePath": "contracts-preprocessed/DefaultAccount.sol", - "bytecodeHash": "0x0100055d7dee7cec6611cf68fa483883fedccd32592e5b91418d5e8338880fc1", + "bytecodeHash": "0x0100055d74f7387e03ecbb5209bea7e0318aea05cfaaa1c195a85df100115cea", "sourceCodeHash": "0xebffe840ebbd9329edb1ebff8ca50f6935e7dabcc67194a896fcc2e968d46dfb" }, { @@ -59,71 +59,71 @@ "contractName": "ImmutableSimulator", "bytecodePath": "artifacts-zk/contracts-preprocessed/ImmutableSimulator.sol/ImmutableSimulator.json", "sourceCodePath": "contracts-preprocessed/ImmutableSimulator.sol", - "bytecodeHash": "0x01000039bbbb1e91691c8c36672cd0b57adb505bf485b1aeea7b1e1f41d592ef", + "bytecodeHash": "0x0100003946a9e538157e73717201b8cd17af70998602a3692b0ac1eff6ad850e", "sourceCodeHash": "0x9659e69f7db09e8f60a8bb95314b1ed26afcc689851665cf27f5408122f60c98" }, { "contractName": "KnownCodesStorage", "bytecodePath": "artifacts-zk/contracts-preprocessed/KnownCodesStorage.sol/KnownCodesStorage.json", "sourceCodePath": "contracts-preprocessed/KnownCodesStorage.sol", - "bytecodeHash": "0x0100006f68de5d0154a31ff1e889f0623c2b9bfaed2109547c0bbc93df82d6c3", + "bytecodeHash": "0x0100006f1ab2c7415de3914a2b9c53942cd3ff6471f698e7383b59f51e33e4d3", "sourceCodeHash": "0xb39b5b81168653e0c5062f7b8e1d6d15a4e186df3317f192f0cb2fc3a74f5448" }, { "contractName": "L1Messenger", "bytecodePath": "artifacts-zk/contracts-preprocessed/L1Messenger.sol/L1Messenger.json", "sourceCodePath": "contracts-preprocessed/L1Messenger.sol", - "bytecodeHash": "0x010001f7efd57d106ffdacde139e11ae13590509ee55d8ba15573e4410ac092a", - "sourceCodeHash": "0x8d22a4019347a45cb0c27bed9e98f7033637a7bdcd90fafb1922caa48f2b05de" + "bytecodeHash": "0x010001f74f7e45f40e1acbae30507ef94ea2775026a6ba0d0eb38cce10e4a472", + "sourceCodeHash": "0xe97846e4ff5f1cfffd6a454f5ad278deecf6fd7a67525908dea9af877dc822a9" }, { "contractName": "L2BaseToken", "bytecodePath": "artifacts-zk/contracts-preprocessed/L2BaseToken.sol/L2BaseToken.json", "sourceCodePath": "contracts-preprocessed/L2BaseToken.sol", - "bytecodeHash": "0x010001033bf67c0464dce4ed878664840d0b37d25756f6c6c2fb439a253b3017", + "bytecodeHash": "0x01000103bbfa393b49b9f8a7adcfedf1273b7928750f3ea8798347dfd8ca0d6f", "sourceCodeHash": "0x8bdd2b4d0b53dba84c9f0af250bbaa2aad10b3de6747bba957f0bd3721090dfa" }, { "contractName": "L2GatewayUpgrade", "bytecodePath": "artifacts-zk/contracts-preprocessed/L2GatewayUpgrade.sol/L2GatewayUpgrade.json", "sourceCodePath": "contracts-preprocessed/L2GatewayUpgrade.sol", - "bytecodeHash": "0x0100038b37fe650a1b83b23cdcf35cb2701bb5f952f0a63d8f080718788ed4a4", + "bytecodeHash": "0x0100038b3b4065d2682996020e14177a9b4632e054b6718f68d46ff13c012b20", "sourceCodeHash": "0x9248f46f491b8853da77e8f9787cfc1a136abee90fde18a3b8f47dcb8859c63c" }, { "contractName": "L2GatewayUpgradeHelper", "bytecodePath": "artifacts-zk/contracts-preprocessed/L2GatewayUpgradeHelper.sol/L2GatewayUpgradeHelper.json", "sourceCodePath": "contracts-preprocessed/L2GatewayUpgradeHelper.sol", - "bytecodeHash": "0x01000007535b44016390e041915eadc958c713a1a8f5bc27e35ad444ef546fad", + "bytecodeHash": "0x010000071330ec1656098ed33e28b475e101394550c02907d7ee2abbae9b762e", "sourceCodeHash": "0xd1c42c4d338697b8effbfe22a0f07d8d9c5a06c8ec8f45deae77765af48a355b" }, { "contractName": "L2GenesisUpgrade", "bytecodePath": "artifacts-zk/contracts-preprocessed/L2GenesisUpgrade.sol/L2GenesisUpgrade.json", "sourceCodePath": "contracts-preprocessed/L2GenesisUpgrade.sol", - "bytecodeHash": "0x010001b3d649bf9be5b9ed5cc8bc7ae0c7b9664ce63c33e74d7c0674a369521b", - "sourceCodeHash": "0xeb8583c1b31bd66d71f253cab8f8c38d789b7a5986a0ae0a1807b69532678343" + "bytecodeHash": "0x010001b386e0ed48ce9fbaad09c7865a58c28c8350d9bc9446b3beaee4aee999", + "sourceCodeHash": "0x2aaddd8a8ef3f56b4f4e6ba52c0035572145b0ea562fbf218a2eb5fc462f988d" }, { "contractName": "MsgValueSimulator", "bytecodePath": "artifacts-zk/contracts-preprocessed/MsgValueSimulator.sol/MsgValueSimulator.json", "sourceCodePath": "contracts-preprocessed/MsgValueSimulator.sol", - "bytecodeHash": "0x0100005d23f184324cb35d3e9c76e70a898a94e347eea5ddfeea2055b372ec8a", + "bytecodeHash": "0x0100005df63cf8940e407a67346b406dcddf4788cba9792ecd6a0edb8d8b3bd8", "sourceCodeHash": "0x082f3dcbc2fe4d93706c86aae85faa683387097d1b676e7ebd00f71ee0f13b71" }, { "contractName": "NonceHolder", "bytecodePath": "artifacts-zk/contracts-preprocessed/NonceHolder.sol/NonceHolder.json", "sourceCodePath": "contracts-preprocessed/NonceHolder.sol", - "bytecodeHash": "0x010000d9fbee5cbf613421094d193a1a012eb071565a311c548080b6db5f8157", + "bytecodeHash": "0x010000d9e79c30aeda9b823f1a0161c7637ed50848e6287e2a34e37cf2e7e4e8", "sourceCodeHash": "0xcd0c0366effebf2c98c58cf96322cc242a2d1c675620ef5514b7ed1f0a869edc" }, { "contractName": "PubdataChunkPublisher", "bytecodePath": "artifacts-zk/contracts-preprocessed/PubdataChunkPublisher.sol/PubdataChunkPublisher.json", "sourceCodePath": "contracts-preprocessed/PubdataChunkPublisher.sol", - "bytecodeHash": "0x01000049fe72fd8726473cc9fd892b9a6aa02d12f3db1bc20452c5fd0b1c4cc8", - "sourceCodeHash": "0x04d3d2e4019081c87aae5c22a060d84ae2e9d631ebce59801ecce37b9c87e4c7" + "bytecodeHash": "0x01000049377ba719b2d7493420854f12ebe67b75e21338777fb22b73e58ec057", + "sourceCodeHash": "0x398b1b9325b39d4c31e672866d4cbdf1cab453fae8d29f438262d921d427f094" }, { "contractName": "SloadContract", @@ -136,7 +136,7 @@ "contractName": "SystemContext", "bytecodePath": "artifacts-zk/contracts-preprocessed/SystemContext.sol/SystemContext.json", "sourceCodePath": "contracts-preprocessed/SystemContext.sol", - "bytecodeHash": "0x0100017f3a6ec3b05bcfa216590e25bdfde2ac07c22c6ec2c7fb82ac54187a45", + "bytecodeHash": "0x0100017f235b172e9a808764229a777b027e179eacc88a7ea48ef81cb193630a", "sourceCodeHash": "0x22406893d61abd477ce071dce506cf2534cca7b7717d015769fc8af1f1b80e06" }, { diff --git a/system-contracts/contracts/L1Messenger.sol b/system-contracts/contracts/L1Messenger.sol index 0f9242ef1..1f0cfe8e5 100644 --- a/system-contracts/contracts/L1Messenger.sol +++ b/system-contracts/contracts/L1Messenger.sol @@ -186,6 +186,7 @@ contract L1Messenger is IL1Messenger, SystemContractBase { /// @notice Verifies that the {_operatorInput} reflects what occurred within the L1Batch and that /// the compressed statediffs are equivalent to the full state diffs. + /// @param _l2DAValidator the address of the l2 da validator /// @param _operatorInput The total pubdata and uncompressed state diffs of transactions that were /// processed in the current L1 Batch. Pubdata consists of L2 to L1 Logs, messages, deployed bytecode, and state diffs. /// @dev Function that should be called exactly once per L1 Batch by the bootloader. diff --git a/system-contracts/contracts/L2GenesisUpgrade.sol b/system-contracts/contracts/L2GenesisUpgrade.sol index 111135a4a..00a22c799 100644 --- a/system-contracts/contracts/L2GenesisUpgrade.sol +++ b/system-contracts/contracts/L2GenesisUpgrade.sol @@ -11,8 +11,14 @@ import {L2GatewayUpgradeHelper} from "./L2GatewayUpgradeHelper.sol"; /// @custom:security-contact security@matterlabs.dev /// @author Matter Labs -/// @notice The contract that can be used for deterministic contract deployment. +/// @notice The l2 component of the genesis upgrade. contract L2GenesisUpgrade is IL2GenesisUpgrade { + /// @notice The function that is delegateCalled from the complex upgrader. + /// @dev It is used to set the chainId and to deploy the force deployments. + /// @param _chainId the chain id + /// @param _ctmDeployer the address of the ctm deployer + /// @param _fixedForceDeploymentsData the force deployments data + /// @param _additionalForceDeploymentsData the additional force deployments data function genesisUpgrade( uint256 _chainId, address _ctmDeployer, diff --git a/system-contracts/contracts/PubdataChunkPublisher.sol b/system-contracts/contracts/PubdataChunkPublisher.sol index f61f0b5ac..7c2abf2e1 100644 --- a/system-contracts/contracts/PubdataChunkPublisher.sol +++ b/system-contracts/contracts/PubdataChunkPublisher.sol @@ -2,7 +2,6 @@ pragma solidity 0.8.24; import {IPubdataChunkPublisher} from "./interfaces/IPubdataChunkPublisher.sol"; -import {SystemContractBase} from "./abstract/SystemContractBase.sol"; import {BLOB_SIZE_BYTES, MAX_NUMBER_OF_BLOBS} from "./Constants.sol"; import {TooMuchPubdata} from "./SystemContractErrors.sol"; @@ -11,7 +10,7 @@ import {TooMuchPubdata} from "./SystemContractErrors.sol"; * @custom:security-contact security@matterlabs.dev * @notice Smart contract for chunking pubdata into the appropriate size for EIP-4844 blobs. */ -contract PubdataChunkPublisher is IPubdataChunkPublisher, SystemContractBase { +contract PubdataChunkPublisher is IPubdataChunkPublisher { /// @notice Chunks pubdata into pieces that can fit into blobs. /// @param _pubdata The total l2 to l1 pubdata that will be sent via L1 blobs. /// @dev Note: This is an early implementation, in the future we plan to support up to 16 blobs per l1 batch. diff --git a/system-contracts/contracts/interfaces/IMessageRoot.sol b/system-contracts/contracts/interfaces/IMessageRoot.sol index 854508eb1..3966caa15 100644 --- a/system-contracts/contracts/interfaces/IMessageRoot.sol +++ b/system-contracts/contracts/interfaces/IMessageRoot.sol @@ -2,6 +2,13 @@ // We use a floating point pragma here so it can be used within other projects that interact with the ZKsync ecosystem without using our exact pragma version. pragma solidity ^0.8.20; +/** + * @author Matter Labs + * @notice MessageRoot contract is responsible for storing and aggregating the roots of the batches from different chains into the MessageRoot. + * @custom:security-contact security@matterlabs.dev + */ interface IMessageRoot { + /// @notice The aggregated root of the batches from different chains. + /// @return aggregatedRoot of the batches from different chains. function getAggregatedRoot() external view returns (bytes32 aggregatedRoot); }