From af0bd856b147832d94263b84482c06dd84dde844 Mon Sep 17 00:00:00 2001 From: Vladislav Volosnikov Date: Wed, 12 Feb 2025 14:50:23 +0100 Subject: [PATCH 1/9] fix(EVM): Add EVM force deploy flow without constructor (M-01) (#1255) --- .../contracts/AccountCodeStorage.sol | 4 +- system-contracts/contracts/Constants.sol | 3 +- .../contracts/ContractDeployer.sol | 141 ++++++++++-------- system-contracts/contracts/EvmEmulator.yul | 32 ++-- .../contracts/EvmHashesStorage.sol | 37 +++++ .../contracts/EvmPredeploysManager.sol | 4 +- .../contracts/SystemContractErrors.sol | 2 + .../interfaces/IContractDeployer.sol | 7 +- .../interfaces/IEvmHashesStorage.sol | 9 ++ .../libraries/SystemContractHelper.sol | 7 +- .../EvmEmulatorFunctions.template.yul | 14 +- .../evm-emulator/EvmEmulatorLoop.template.yul | 2 +- .../test/AccountCodeStorage.spec.ts | 4 +- system-contracts/test/shared/constants.ts | 1 + 14 files changed, 170 insertions(+), 97 deletions(-) create mode 100644 system-contracts/contracts/EvmHashesStorage.sol create mode 100644 system-contracts/contracts/interfaces/IEvmHashesStorage.sol diff --git a/system-contracts/contracts/AccountCodeStorage.sol b/system-contracts/contracts/AccountCodeStorage.sol index 52879df1fe..c977685c06 100644 --- a/system-contracts/contracts/AccountCodeStorage.sol +++ b/system-contracts/contracts/AccountCodeStorage.sol @@ -4,7 +4,7 @@ pragma solidity 0.8.24; import {IAccountCodeStorage} from "./interfaces/IAccountCodeStorage.sol"; import {Utils} from "./libraries/Utils.sol"; -import {DEPLOYER_SYSTEM_CONTRACT, NONCE_HOLDER_SYSTEM_CONTRACT, CURRENT_MAX_PRECOMPILE_ADDRESS} from "./Constants.sol"; +import {DEPLOYER_SYSTEM_CONTRACT, NONCE_HOLDER_SYSTEM_CONTRACT, CURRENT_MAX_PRECOMPILE_ADDRESS, EVM_HASHES_STORAGE} from "./Constants.sol"; import {Unauthorized, InvalidCodeHash, CodeHashReason} from "./SystemContractErrors.sol"; /** @@ -116,7 +116,7 @@ contract AccountCodeStorage is IAccountCodeStorage { else if (Utils.isContractConstructing(codeHash)) { codeHash = EMPTY_STRING_KECCAK; } else if (Utils.isCodeHashEVM(codeHash)) { - codeHash = DEPLOYER_SYSTEM_CONTRACT.evmCodeHash(account); + codeHash = EVM_HASHES_STORAGE.getEvmCodeHash(codeHash); } return codeHash; diff --git a/system-contracts/contracts/Constants.sol b/system-contracts/contracts/Constants.sol index f3e37148a4..0841a90df7 100644 --- a/system-contracts/contracts/Constants.sol +++ b/system-contracts/contracts/Constants.sol @@ -17,6 +17,7 @@ import {IBootloaderUtilities} from "./interfaces/IBootloaderUtilities.sol"; import {IPubdataChunkPublisher} from "./interfaces/IPubdataChunkPublisher.sol"; import {IMessageRoot} from "./interfaces/IMessageRoot.sol"; import {ICreate2Factory} from "./interfaces/ICreate2Factory.sol"; +import {IEvmHashesStorage} from "./interfaces/IEvmHashesStorage.sol"; /// @dev All the system contracts introduced by ZKsync have their addresses /// started from 2^15 in order to avoid collision with Ethereum precompiles. @@ -101,8 +102,8 @@ IPubdataChunkPublisher constant PUBDATA_CHUNK_PUBLISHER = IPubdataChunkPublisher address constant CODE_ORACLE_SYSTEM_CONTRACT = address(SYSTEM_CONTRACTS_OFFSET + 0x12); address constant EVM_GAS_MANAGER = address(SYSTEM_CONTRACTS_OFFSET + 0x13); - address constant EVM_PREDEPLOYS_MANAGER = address(SYSTEM_CONTRACTS_OFFSET + 0x14); +IEvmHashesStorage constant EVM_HASHES_STORAGE = IEvmHashesStorage(address(SYSTEM_CONTRACTS_OFFSET + 0x15)); ICreate2Factory constant L2_CREATE2_FACTORY = ICreate2Factory(address(USER_CONTRACTS_OFFSET)); address constant L2_ASSET_ROUTER = address(USER_CONTRACTS_OFFSET + 0x03); diff --git a/system-contracts/contracts/ContractDeployer.sol b/system-contracts/contracts/ContractDeployer.sol index 38561029a8..9aafccaeaf 100644 --- a/system-contracts/contracts/ContractDeployer.sol +++ b/system-contracts/contracts/ContractDeployer.sol @@ -4,13 +4,13 @@ pragma solidity 0.8.24; import {ImmutableData} from "./interfaces/IImmutableSimulator.sol"; import {IContractDeployer, ForceDeployment} from "./interfaces/IContractDeployer.sol"; -import {CREATE2_PREFIX, CREATE_PREFIX, NONCE_HOLDER_SYSTEM_CONTRACT, ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT, FORCE_DEPLOYER, MAX_SYSTEM_CONTRACT_ADDRESS, KNOWN_CODE_STORAGE_CONTRACT, BASE_TOKEN_SYSTEM_CONTRACT, IMMUTABLE_SIMULATOR_SYSTEM_CONTRACT, COMPLEX_UPGRADER_CONTRACT, SERVICE_CALL_PSEUDO_CALLER, EVM_PREDEPLOYS_MANAGER} from "./Constants.sol"; +import {CREATE2_PREFIX, CREATE_PREFIX, NONCE_HOLDER_SYSTEM_CONTRACT, ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT, FORCE_DEPLOYER, MAX_SYSTEM_CONTRACT_ADDRESS, KNOWN_CODE_STORAGE_CONTRACT, BASE_TOKEN_SYSTEM_CONTRACT, IMMUTABLE_SIMULATOR_SYSTEM_CONTRACT, COMPLEX_UPGRADER_CONTRACT, SERVICE_CALL_PSEUDO_CALLER, EVM_PREDEPLOYS_MANAGER, EVM_HASHES_STORAGE} from "./Constants.sol"; import {Utils} from "./libraries/Utils.sol"; import {EfficientCall} from "./libraries/EfficientCall.sol"; import {SystemContractHelper} from "./libraries/SystemContractHelper.sol"; import {SystemContractBase} from "./abstract/SystemContractBase.sol"; -import {Unauthorized, InvalidNonceOrderingChange, ValueMismatch, EmptyBytes32, EVMBytecodeHash, EVMEmulationNotSupported, NotAllowedToDeployInKernelSpace, HashIsNonZero, NonEmptyAccount, UnknownCodeHash, NonEmptyMsgValue} from "./SystemContractErrors.sol"; +import {Unauthorized, InvalidNonceOrderingChange, ValueMismatch, EmptyBytes32, EVMBytecodeHash, EVMBytecodeHashUnknown, EVMEmulationNotSupported, NotAllowedToDeployInKernelSpace, HashIsNonZero, NonEmptyAccount, UnknownCodeHash, NonEmptyMsgValue} from "./SystemContractErrors.sol"; /** * @author Matter Labs @@ -22,9 +22,6 @@ import {Unauthorized, InvalidNonceOrderingChange, ValueMismatch, EmptyBytes32, E * do not need to be published anymore. */ contract ContractDeployer is IContractDeployer, SystemContractBase { - /// @dev Prefix for EVM contracts hashes storage slots. - uint256 private constant EVM_HASHES_PREFIX = 1 << 254; - /// @notice Information about an account contract. /// @dev For EOA and simple contracts (i.e. not accounts) this value is 0. mapping(address => AccountInfo) internal accountInfo; @@ -39,11 +36,6 @@ contract ContractDeployer is IContractDeployer, SystemContractBase { _; } - /// @notice Returns keccak of EVM bytecode at address if it is an EVM contract. Returns bytes32(0) if it isn't a EVM contract. - function evmCodeHash(address _address) external view returns (bytes32 _hash) { - _hash = _getEvmCodeHash(_address); - } - /// @notice Returns information about a certain account. function getAccountInfo(address _address) external view returns (AccountInfo memory info) { return accountInfo[_address]; @@ -310,8 +302,19 @@ contract ContractDeployer is IContractDeployer, SystemContractBase { NONCE_HOLDER_SYSTEM_CONTRACT.incrementDeploymentNonce(_deployment.newAddress); } + if (!_deployment.callConstructor) { + _ensureBytecodeIsKnown(_deployment.bytecodeHash); + } + // It is not possible to change the AccountInfo for EVM contracts. - _constructEVMContract(_sender, _deployment.newAddress, _deployment.input); + // _versionedBytecodeHash will be ignored if _callConstructor is true + _constructEVMContract({ + _sender: _sender, + _newAddress: _deployment.newAddress, + _versionedBytecodeHash: _deployment.bytecodeHash, + _input: _deployment.input, + _callConstructor: _deployment.callConstructor + }); } else { _ensureBytecodeIsKnown(_deployment.bytecodeHash); @@ -476,7 +479,14 @@ contract ContractDeployer is IContractDeployer, SystemContractBase { NONCE_HOLDER_SYSTEM_CONTRACT.incrementDeploymentNonce(_newAddress); // We will store dummy constructing bytecode hash to trigger EVM emulator in constructor call - return _constructEVMContract(_sender, _newAddress, _input); + return + _constructEVMContract({ + _sender: _sender, + _newAddress: _newAddress, + _versionedBytecodeHash: bytes32(0), // Ignored since we will call constructor + _input: _input, + _callConstructor: true + }); } /// @notice Check that bytecode hash is marked as known on the `KnownCodeStorage` system contracts @@ -556,68 +566,75 @@ contract ContractDeployer is IContractDeployer, SystemContractBase { function _constructEVMContract( address _sender, address _newAddress, - bytes calldata _input + bytes32 _versionedBytecodeHash, + bytes calldata _input, + bool _callConstructor ) internal returns (uint256 constructorReturnEvmGas) { uint256 value = msg.value; - // 1. Transfer the balance to the new address on the constructor call. - if (value > 0) { - BASE_TOKEN_SYSTEM_CONTRACT.transferFromTo(address(this), _newAddress, value); - } + if (_callConstructor) { + // 1. Transfer the balance to the new address on the constructor call. + if (value > 0) { + BASE_TOKEN_SYSTEM_CONTRACT.transferFromTo(address(this), _newAddress, value); + } - // 2. Set the constructed code hash on the account - ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT.storeAccountConstructingCodeHash( - _newAddress, - // Dummy EVM bytecode hash just to call emulator. - // The second byte is `0x01` to indicate that it is being constructed. - bytes32(0x0201000000000000000000000000000000000000000000000000000000000000) - ); + // 2. Set the constructing code hash on the account + ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT.storeAccountConstructingCodeHash( + _newAddress, + // Dummy EVM bytecode hash just to call emulator. + // The second byte is `0x01` to indicate that it is being constructed. + bytes32(0x0201000000000000000000000000000000000000000000000000000000000000) + ); - // 3. Call the constructor on behalf of the account - if (value > 0) { - // Safe to cast value, because `msg.value` <= `uint128.max` due to `MessageValueSimulator` invariant - SystemContractHelper.setValueForNextFarCall(uint128(value)); - } + // 3. Call the constructor on behalf of the account + if (value > 0) { + // Safe to cast value, because `msg.value` <= `uint128.max` due to `MessageValueSimulator` invariant + SystemContractHelper.setValueForNextFarCall(uint128(value)); + } - bytes memory paddedBytecode = EfficientCall.mimicCall({ - _gas: gasleft(), // note: native gas, not EVM gas - _address: _newAddress, - _data: _input, - _whoToMimic: _sender, - _isConstructor: true, - _isSystem: false - }); + bytes memory paddedBytecode = EfficientCall.mimicCall({ + _gas: gasleft(), // note: native gas, not EVM gas + _address: _newAddress, + _data: _input, + _whoToMimic: _sender, + _isConstructor: true, + _isSystem: false + }); - uint256 evmBytecodeLen; - // Returned data bytes have structure: paddedBytecode.evmBytecodeLen.constructorReturnEvmGas - assembly { - let dataLen := mload(paddedBytecode) - evmBytecodeLen := mload(add(paddedBytecode, sub(dataLen, 0x20))) - constructorReturnEvmGas := mload(add(paddedBytecode, dataLen)) - mstore(paddedBytecode, sub(dataLen, 0x40)) // shrink paddedBytecode - } + uint256 evmBytecodeLen; + // Returned data bytes have structure: paddedBytecode.evmBytecodeLen.constructorReturnEvmGas + assembly { + let dataLen := mload(paddedBytecode) + evmBytecodeLen := mload(add(paddedBytecode, sub(dataLen, 0x20))) + constructorReturnEvmGas := mload(add(paddedBytecode, dataLen)) + mstore(paddedBytecode, sub(dataLen, 0x40)) // shrink paddedBytecode + } - bytes32 versionedBytecodeHash = KNOWN_CODE_STORAGE_CONTRACT.publishEVMBytecode(evmBytecodeLen, paddedBytecode); - ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT.storeAccountConstructedCodeHash(_newAddress, versionedBytecodeHash); + _versionedBytecodeHash = KNOWN_CODE_STORAGE_CONTRACT.publishEVMBytecode(evmBytecodeLen, paddedBytecode); + ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT.storeAccountConstructedCodeHash(_newAddress, _versionedBytecodeHash); - bytes32 evmBytecodeHash; - assembly { - evmBytecodeHash := keccak256(add(paddedBytecode, 0x20), evmBytecodeLen) - } + // Calculate keccak256 of the EVM bytecode if it hasn't been done before + if (EVM_HASHES_STORAGE.getEvmCodeHash(_versionedBytecodeHash) == bytes32(0)) { + bytes32 evmBytecodeHash; + assembly { + evmBytecodeHash := keccak256(add(paddedBytecode, 0x20), evmBytecodeLen) + } - _setEvmCodeHash(_newAddress, evmBytecodeHash); + EVM_HASHES_STORAGE.storeEvmCodeHash(_versionedBytecodeHash, evmBytecodeHash); + } + } else { + if (value != 0) { + revert NonEmptyMsgValue(); + } - emit ContractDeployed(_sender, versionedBytecodeHash, _newAddress); - } + // Sanity check, EVM code hash should be present if versioned bytecode hash is known + if (EVM_HASHES_STORAGE.getEvmCodeHash(_versionedBytecodeHash) == bytes32(0)) { + revert EVMBytecodeHashUnknown(); + } - function _setEvmCodeHash(address _address, bytes32 _hash) internal { - assembly { - sstore(or(EVM_HASHES_PREFIX, _address), _hash) + // If we do not call the constructor, we need to set the constructed code hash. + ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT.storeAccountConstructedCodeHash(_newAddress, _versionedBytecodeHash); } - } - function _getEvmCodeHash(address _address) internal view returns (bytes32 _hash) { - assembly { - _hash := sload(or(EVM_HASHES_PREFIX, _address)) - } + emit ContractDeployed(_sender, _versionedBytecodeHash, _newAddress); } } diff --git a/system-contracts/contracts/EvmEmulator.yul b/system-contracts/contracts/EvmEmulator.yul index 952686c011..129fb40497 100644 --- a/system-contracts/contracts/EvmEmulator.yul +++ b/system-contracts/contracts/EvmEmulator.yul @@ -82,6 +82,10 @@ object "EvmEmulator" { addr := 0x0000000000000000000000000000000000008013 } + function EVM_HASHES_STORAGE_CONTRACT() -> addr { + addr := 0x0000000000000000000000000000000000008015 + } + function MSG_VALUE_SYSTEM_CONTRACT() -> addr { addr := 0x0000000000000000000000000000000000008009 } @@ -402,11 +406,11 @@ object "EvmEmulator" { hash := fetchFromSystemContract(ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT(), 36) } - function getEvmExtcodehash(addr) -> evmCodeHash { - // function evmCodeHash(address _address) - mstore(0, 0x54A3314700000000000000000000000000000000000000000000000000000000) - mstore(4, addr) - evmCodeHash := fetchFromSystemContract(DEPLOYER_SYSTEM_CONTRACT(), 36) + function getEvmExtcodehash(versionedBytecodeHash) -> evmCodeHash { + // function getEvmCodeHash(bytes32 versionedBytecodeHash) external view returns(bytes32) + mstore(0, 0x5F8F27B000000000000000000000000000000000000000000000000000000000) + mstore(4, versionedBytecodeHash) + evmCodeHash := fetchFromSystemContract(EVM_HASHES_STORAGE_CONTRACT(), 36) } function isHashOfConstructedEvmContract(rawCodeHash) -> isConstructedEVM { @@ -1916,7 +1920,7 @@ object "EvmEmulator" { } default { // Get precalculated keccak of EVM code - stackHead := getEvmExtcodehash(addr) + stackHead := getEvmExtcodehash(rawCodeHash) } ip := add(ip, 1) @@ -3008,6 +3012,10 @@ object "EvmEmulator" { addr := 0x0000000000000000000000000000000000008013 } + function EVM_HASHES_STORAGE_CONTRACT() -> addr { + addr := 0x0000000000000000000000000000000000008015 + } + function MSG_VALUE_SYSTEM_CONTRACT() -> addr { addr := 0x0000000000000000000000000000000000008009 } @@ -3328,11 +3336,11 @@ object "EvmEmulator" { hash := fetchFromSystemContract(ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT(), 36) } - function getEvmExtcodehash(addr) -> evmCodeHash { - // function evmCodeHash(address _address) - mstore(0, 0x54A3314700000000000000000000000000000000000000000000000000000000) - mstore(4, addr) - evmCodeHash := fetchFromSystemContract(DEPLOYER_SYSTEM_CONTRACT(), 36) + function getEvmExtcodehash(versionedBytecodeHash) -> evmCodeHash { + // function getEvmCodeHash(bytes32 versionedBytecodeHash) external view returns(bytes32) + mstore(0, 0x5F8F27B000000000000000000000000000000000000000000000000000000000) + mstore(4, versionedBytecodeHash) + evmCodeHash := fetchFromSystemContract(EVM_HASHES_STORAGE_CONTRACT(), 36) } function isHashOfConstructedEvmContract(rawCodeHash) -> isConstructedEVM { @@ -4830,7 +4838,7 @@ object "EvmEmulator" { } default { // Get precalculated keccak of EVM code - stackHead := getEvmExtcodehash(addr) + stackHead := getEvmExtcodehash(rawCodeHash) } ip := add(ip, 1) diff --git a/system-contracts/contracts/EvmHashesStorage.sol b/system-contracts/contracts/EvmHashesStorage.sol new file mode 100644 index 0000000000..b69640e4d8 --- /dev/null +++ b/system-contracts/contracts/EvmHashesStorage.sol @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.24; + +import {IEvmHashesStorage} from "./interfaces/IEvmHashesStorage.sol"; +import {SystemContractBase} from "./abstract/SystemContractBase.sol"; +import {DEPLOYER_SYSTEM_CONTRACT} from "./Constants.sol"; + +/** + * @author Matter Labs + * @custom:security-contact security@matterlabs.dev + * @notice The storage of this contract serves as a mapping for the EVM code hashes (keccak256) corresponding to versioned bytecode hashes. + */ +contract EvmHashesStorage is IEvmHashesStorage, SystemContractBase { + /// @notice Stores the EVM code hash of the contract + /// @dev No checks are made for the correctness of the data, this is the responsibility of the caller + /// @param versionedBytecodeHash The versioned bytecode hash + /// @param evmBytecodeHash The keccak of bytecode + function storeEvmCodeHash( + bytes32 versionedBytecodeHash, + bytes32 evmBytecodeHash + ) external override onlyCallFrom(address(DEPLOYER_SYSTEM_CONTRACT)) { + assembly { + sstore(versionedBytecodeHash, evmBytecodeHash) + } + } + + /// @notice Get the EVM code hash of the contract by it's versioned bytecode hash + /// @param versionedBytecodeHash The versioned bytecode hash + function getEvmCodeHash(bytes32 versionedBytecodeHash) external view override returns (bytes32) { + assembly { + let res := sload(versionedBytecodeHash) + mstore(0x0, res) + return(0x0, 0x20) + } + } +} diff --git a/system-contracts/contracts/EvmPredeploysManager.sol b/system-contracts/contracts/EvmPredeploysManager.sol index a7ecf4df0c..5ed71756d0 100644 --- a/system-contracts/contracts/EvmPredeploysManager.sol +++ b/system-contracts/contracts/EvmPredeploysManager.sol @@ -89,9 +89,9 @@ contract EvmPredeploysManager { ForceDeployment[] memory deployments = new ForceDeployment[](1); deployments[0] = ForceDeployment({ - bytecodeHash: bytes32(0x0200000000000000000000000000000000000000000000000000000000000000), // BytecodeHash is ignored for EVM deploys + bytecodeHash: bytes32(0x0200000000000000000000000000000000000000000000000000000000000000), // BytecodeHash is ignored for EVM deploys with constructor call newAddress: contractAddress, - callConstructor: true, // it is ignored + callConstructor: true, value: 0, input: constructorInput }); diff --git a/system-contracts/contracts/SystemContractErrors.sol b/system-contracts/contracts/SystemContractErrors.sol index 8f97571d22..a5f90ea72e 100644 --- a/system-contracts/contracts/SystemContractErrors.sol +++ b/system-contracts/contracts/SystemContractErrors.sol @@ -32,6 +32,8 @@ error EncodedAndRealBytecodeChunkNotEqual(uint64 expected, uint64 provided); error EncodedLengthNotFourTimesSmallerThanOriginal(); // 0x39bae0e6 error EVMBytecodeHash(); +// 0x536a56c8 +error EVMBytecodeHashUnknown(); // 0xb9e6e31f error EVMEmulationNotSupported(); // 0xe95a1fbe diff --git a/system-contracts/contracts/interfaces/IContractDeployer.sol b/system-contracts/contracts/interfaces/IContractDeployer.sol index a4a0b5a996..29ede25fca 100644 --- a/system-contracts/contracts/interfaces/IContractDeployer.sol +++ b/system-contracts/contracts/interfaces/IContractDeployer.sol @@ -4,11 +4,11 @@ pragma solidity ^0.8.20; /// @notice A struct that describes a forced deployment on an address struct ForceDeployment { - // The bytecode hash to put on an address. Hash and length parts are ignored in case of EVM bytecode. + // The bytecode hash to put on an address. Hash and length parts are ignored in case of EVM deployment with constructor. bytes32 bytecodeHash; // The address on which to deploy the bytecodehash to address newAddress; - // Whether to run the constructor on the force deployment. Ignored in case of EVM deployment. + // Whether to run the constructor on the force deployment. bool callConstructor; // The value with which to initialize a contract uint256 value; @@ -126,9 +126,6 @@ interface IContractDeployer { bytes calldata _initCode ) external payable returns (uint256 evmGasUsed, address newAddress); - /// @notice Returns keccak of EVM bytecode at address if it is an EVM contract. Returns bytes32(0) if it isn't a EVM contract. - function evmCodeHash(address) external view returns (bytes32); - /// @notice Changes what types of bytecodes are allowed to be deployed on the chain. /// @param newAllowedBytecodeTypes The new allowed bytecode types mode. function setAllowedBytecodeTypesToDeploy(AllowedBytecodeTypes newAllowedBytecodeTypes) external; diff --git a/system-contracts/contracts/interfaces/IEvmHashesStorage.sol b/system-contracts/contracts/interfaces/IEvmHashesStorage.sol new file mode 100644 index 0000000000..5685e20b87 --- /dev/null +++ b/system-contracts/contracts/interfaces/IEvmHashesStorage.sol @@ -0,0 +1,9 @@ +// 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.20; + +interface IEvmHashesStorage { + function storeEvmCodeHash(bytes32 versionedBytecodeHash, bytes32 evmBytecodeHash) external; + + function getEvmCodeHash(bytes32 versionedBytecodeHash) external view returns (bytes32); +} diff --git a/system-contracts/contracts/libraries/SystemContractHelper.sol b/system-contracts/contracts/libraries/SystemContractHelper.sol index 656a2e0199..546492bf5c 100644 --- a/system-contracts/contracts/libraries/SystemContractHelper.sol +++ b/system-contracts/contracts/libraries/SystemContractHelper.sol @@ -457,14 +457,9 @@ library SystemContractHelper { revert SloadContractBytecodeUnknown(); } - bytes32 previoushHash; - assembly { - previoushHash := extcodehash(_addr) - } + bytes32 previoushHash = ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT.getRawCodeHash(_addr); // Just in case, double checking that the previous bytecode is known. - // It may be needed since `previoushHash` could be non-zero and unknown if it is - // equal to keccak(""). It is the case for used default accounts. if (KNOWN_CODE_STORAGE_CONTRACT.getMarker(previoushHash) == 0) { revert PreviousBytecodeUnknown(); } diff --git a/system-contracts/evm-emulator/EvmEmulatorFunctions.template.yul b/system-contracts/evm-emulator/EvmEmulatorFunctions.template.yul index 0b45dc4239..4a34a2386f 100644 --- a/system-contracts/evm-emulator/EvmEmulatorFunctions.template.yul +++ b/system-contracts/evm-emulator/EvmEmulatorFunctions.template.yul @@ -22,6 +22,10 @@ function EVM_GAS_MANAGER_CONTRACT() -> addr { addr := 0x0000000000000000000000000000000000008013 } +function EVM_HASHES_STORAGE_CONTRACT() -> addr { + addr := 0x0000000000000000000000000000000000008015 +} + function MSG_VALUE_SYSTEM_CONTRACT() -> addr { addr := 0x0000000000000000000000000000000000008009 } @@ -342,11 +346,11 @@ function getRawCodeHash(addr) -> hash { hash := fetchFromSystemContract(ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT(), 36) } -function getEvmExtcodehash(addr) -> evmCodeHash { - // function evmCodeHash(address _address) - mstore(0, 0x54A3314700000000000000000000000000000000000000000000000000000000) - mstore(4, addr) - evmCodeHash := fetchFromSystemContract(DEPLOYER_SYSTEM_CONTRACT(), 36) +function getEvmExtcodehash(versionedBytecodeHash) -> evmCodeHash { + // function getEvmCodeHash(bytes32 versionedBytecodeHash) external view returns(bytes32) + mstore(0, 0x5F8F27B000000000000000000000000000000000000000000000000000000000) + mstore(4, versionedBytecodeHash) + evmCodeHash := fetchFromSystemContract(EVM_HASHES_STORAGE_CONTRACT(), 36) } function isHashOfConstructedEvmContract(rawCodeHash) -> isConstructedEVM { diff --git a/system-contracts/evm-emulator/EvmEmulatorLoop.template.yul b/system-contracts/evm-emulator/EvmEmulatorLoop.template.yul index ab88e92e11..f1a77dbe46 100644 --- a/system-contracts/evm-emulator/EvmEmulatorLoop.template.yul +++ b/system-contracts/evm-emulator/EvmEmulatorLoop.template.yul @@ -582,7 +582,7 @@ for { } true { } { } default { // Get precalculated keccak of EVM code - stackHead := getEvmExtcodehash(addr) + stackHead := getEvmExtcodehash(rawCodeHash) } ip := add(ip, 1) diff --git a/system-contracts/test/AccountCodeStorage.spec.ts b/system-contracts/test/AccountCodeStorage.spec.ts index f1b44a0518..fef4d2c9f9 100644 --- a/system-contracts/test/AccountCodeStorage.spec.ts +++ b/system-contracts/test/AccountCodeStorage.spec.ts @@ -8,6 +8,7 @@ import { ONE_BYTES32_HEX, TEST_ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT_ADDRESS, TEST_DEPLOYER_SYSTEM_CONTRACT_ADDRESS, + TEST_EVM_HASHES_STORAGE, } from "./shared/constants"; import { prepareEnvironment, setResult } from "./shared/mocks"; import { deployContractOnAddress, getWallets } from "./shared/utils"; @@ -206,12 +207,13 @@ describe("AccountCodeStorage tests", function () { it("constructed EVM contract", async () => { await deployContractOnAddress(TEST_DEPLOYER_SYSTEM_CONTRACT_ADDRESS, "ContractDeployer", false); + await deployContractOnAddress(TEST_EVM_HASHES_STORAGE, "EvmHashesStorage", false); await accountCodeStorage .connect(deployerAccount) .storeAccountConstructedCodeHash(RANDOM_ADDRESS, CONSTRUCTED_EVM_BYTECODE_HASH); - expect(await accountCodeStorage.getCodeHash(RANDOM_ADDRESS)).to.be.eq(ZERO_HASH); // contract deployer doesn't have this contract hash + expect(await accountCodeStorage.getCodeHash(RANDOM_ADDRESS)).to.be.eq(ZERO_HASH); // EVM hash storage doesn't have this contract hash await unsetCodeHash(accountCodeStorage, RANDOM_ADDRESS); }); diff --git a/system-contracts/test/shared/constants.ts b/system-contracts/test/shared/constants.ts index c3f82c9897..9ea6ba9696 100644 --- a/system-contracts/test/shared/constants.ts +++ b/system-contracts/test/shared/constants.ts @@ -16,6 +16,7 @@ export const TEST_COMPRESSOR_CONTRACT_ADDRESS = "0x00000000000000000000000000000 export const TEST_COMPLEX_UPGRADER_CONTRACT_ADDRESS = "0x000000000000000000000000000000000000900f"; export const TEST_PUBDATA_CHUNK_PUBLISHER_ADDRESS = "0x0000000000000000000000000000000000009011"; export const TEST_L2_GENESIS_UPGRADE_CONTRACT_ADDRESS = "0x0000000000000000000000000000000000010001"; +export const TEST_EVM_HASHES_STORAGE = "0x0000000000000000000000000000000000009015"; // event writer should be on the original address because event logs are filtered by address export const REAL_EVENT_WRITER_CONTRACT_ADDRESS = "0x000000000000000000000000000000000000800d"; From 3f40a4f791b305b9622e9e9c8299a705256afa0e Mon Sep 17 00:00:00 2001 From: Vladislav Volosnikov Date: Wed, 12 Feb 2025 15:35:40 +0100 Subject: [PATCH 2/9] fix(EVM): Fix natspecs in ContractDeployer (#1257) --- system-contracts/contracts/ContractDeployer.sol | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/system-contracts/contracts/ContractDeployer.sol b/system-contracts/contracts/ContractDeployer.sol index 9aafccaeaf..0c8b8535fd 100644 --- a/system-contracts/contracts/ContractDeployer.sol +++ b/system-contracts/contracts/ContractDeployer.sol @@ -161,8 +161,8 @@ contract ContractDeployer is IContractDeployer, SystemContractBase { } /// @notice Deploys an EVM contract using address derivation of EVM's `CREATE` opcode. + /// @dev Note: this method may be callable only in system mode. /// @param _initCode The init code for the contract. - /// Note: this method may be callable only in system mode. /// @return The amount of EVM gas used. /// @return The address of created contract. function createEVM(bytes calldata _initCode) external payable override onlySystemCall returns (uint256, address) { @@ -184,9 +184,9 @@ contract ContractDeployer is IContractDeployer, SystemContractBase { } /// @notice Deploys an EVM contract using address derivation of EVM's `CREATE2` opcode. + /// @dev Note: this method may be callable only in system mode. /// @param _salt The CREATE2 salt. /// @param _initCode The init code for the contract. - /// Note: this method may be callable only in system mode. /// @return The amount of EVM gas used. /// @return The address of created contract. function create2EVM( @@ -203,10 +203,11 @@ contract ContractDeployer is IContractDeployer, SystemContractBase { return (evmGasUsed, newAddress); } - /// @notice Method used by EVM emulator to check if contract can be deployed. + /// @notice Method used by EVM emulator to check if contract can be deployed and calculate the corresponding address. + /// @dev Note: this method may be callable only by the EVM emulator. /// @param _salt The CREATE2 salt. /// @param _evmBytecodeHash The keccak of EVM code to be deployed (initCode). - /// Note: this method may be callable only by the EVM emulator. + /// @return newAddress The address of the contract to be deployed. function precreateEvmAccountFromEmulator( bytes32 _salt, bytes32 _evmBytecodeHash @@ -433,6 +434,7 @@ contract ContractDeployer is IContractDeployer, SystemContractBase { /// @param _newAddress The address of the contract to be deployed. /// @param _aaVersion The version of the account abstraction protocol to use. /// @param _input The constructor calldata. + /// @param _callConstructor Whether to run the constructor or not. function _performDeployOnAddress( bytes32 _bytecodeHash, address _newAddress, @@ -463,6 +465,7 @@ contract ContractDeployer is IContractDeployer, SystemContractBase { /// @param _newAddress The address of the contract to be deployed. /// @param _aaVersion The version of the account abstraction protocol to use. /// @param _input The constructor calldata. + /// @return constructorReturnEvmGas The EVM gas left after constructor execution. function _performDeployOnAddressEVM( address _sender, address _newAddress, @@ -510,8 +513,10 @@ contract ContractDeployer is IContractDeployer, SystemContractBase { /// This function must revert in case the deployment fails. /// @param _sender The msg.sender to be used in the constructor /// @param _newAddress The address of the deployed contract + /// @param _bytecodeHash The correctly formatted versioned hash of the bytecode. /// @param _input The constructor calldata /// @param _isSystem Whether the call should be a system call (could be possibly required in the future). + /// @param _callConstructor Whether to run the constructor or not. function _constructContract( address _sender, address _newAddress, @@ -562,7 +567,10 @@ contract ContractDeployer is IContractDeployer, SystemContractBase { /// This function must revert in case the deployment fails. /// @param _sender The msg.sender to be used in the constructor. /// @param _newAddress The address of the deployed contract. + /// @param _versionedBytecodeHash The correctly formatted versioned hash of the bytecode (ignored if `_callConstructor` is true). /// @param _input The constructor calldata. + /// @param _callConstructor Whether to run the constructor or not. + /// @return constructorReturnEvmGas The EVM gas left after constructor execution. function _constructEVMContract( address _sender, address _newAddress, From 0f15cb0a5dd68eee1bc63c97762cee85c387bb32 Mon Sep 17 00:00:00 2001 From: Vladislav Volosnikov Date: Wed, 12 Feb 2025 15:38:45 +0100 Subject: [PATCH 3/9] fix(EVM): Add explicit visibility modifiers for constants in EvmPredeploysManager (#1258) --- .../contracts/EvmPredeploysManager.sol | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/system-contracts/contracts/EvmPredeploysManager.sol b/system-contracts/contracts/EvmPredeploysManager.sol index 5ed71756d0..13e91c7c39 100644 --- a/system-contracts/contracts/EvmPredeploysManager.sol +++ b/system-contracts/contracts/EvmPredeploysManager.sol @@ -14,34 +14,38 @@ import {EfficientCall} from "./libraries/EfficientCall.sol"; */ contract EvmPredeploysManager { // https://github.com/Arachnid/deterministic-deployment-proxy - address constant CREATE2_PROXY = 0x4e59b44847b379578588920cA78FbF26c0B4956C; - bytes32 constant CREATE2_PROXY_INPUT_HASH = 0x50ea9137a35a9ad33b0ed4a431e9b6996ea9ed1f14781126cec78f168c0e64e5; - bytes32 constant CREATE2_PROXY_BYTECODE_HASH = 0x020000453cf89ad86bc13761a15f8f205faa1dbb41ccd3553352fa3c5dd3a9a0; + address private constant CREATE2_PROXY = 0x4e59b44847b379578588920cA78FbF26c0B4956C; + bytes32 private constant CREATE2_PROXY_INPUT_HASH = + 0x50ea9137a35a9ad33b0ed4a431e9b6996ea9ed1f14781126cec78f168c0e64e5; + bytes32 private constant CREATE2_PROXY_BYTECODE_HASH = + 0x020000453cf89ad86bc13761a15f8f205faa1dbb41ccd3553352fa3c5dd3a9a0; // https://github.com/pcaversaccio/create2deployer - address constant CREATE2_DEPLOYER = 0x13b0D85CcB8bf860b6b79AF3029fCA081AE9beF2; - bytes32 constant CREATE2_DEPLOYER_INPUT_HASH = 0xc9cdbda80cd4ba1961148079822602f7bd7619c26f78fec2fd1fc0beaf39d7d0; - bytes32 constant CREATE2_DEPLOYER_BYTECODE_HASH = + address private constant CREATE2_DEPLOYER = 0x13b0D85CcB8bf860b6b79AF3029fCA081AE9beF2; + bytes32 private constant CREATE2_DEPLOYER_INPUT_HASH = + 0xc9cdbda80cd4ba1961148079822602f7bd7619c26f78fec2fd1fc0beaf39d7d0; + bytes32 private constant CREATE2_DEPLOYER_BYTECODE_HASH = 0x02000aab5ea35752b7904cb5c3d2a2608f283b04c4da41202326c0f712c85568; // https://eips.ethereum.org/EIPS/eip-2470 - address constant ERC2470_SINGLETON_FACTORY = 0xce0042B868300000d44A59004Da54A005ffdcf9f; - bytes32 constant ERC2470_SINGLETON_FACTORY_INPUT_HASH = + address private constant ERC2470_SINGLETON_FACTORY = 0xce0042B868300000d44A59004Da54A005ffdcf9f; + bytes32 private constant ERC2470_SINGLETON_FACTORY_INPUT_HASH = 0x122b6b28aeddfd05fa3ce4348e93d357b3ce50d9ab7dda4e8ee524a5b9a6ab3b; - bytes32 constant ERC2470_SINGLETON_FACTORY_BYTECODE_HASH = + bytes32 private constant ERC2470_SINGLETON_FACTORY_BYTECODE_HASH = 0x0200013423ebb21b5377c3afaef4cbb0117243b48d1b32a751500760027b87a4; // https://github.com/safe-global/safe-singleton-factory/blob/main/source/deterministic-deployment-proxy.yul - address constant SAFE_SINGLETON_FACTORY = 0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7; - bytes32 constant SAFE_SINGLETON_FACTORY_INPUT_HASH = + address private constant SAFE_SINGLETON_FACTORY = 0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7; + bytes32 private constant SAFE_SINGLETON_FACTORY_INPUT_HASH = 0x50ea9137a35a9ad33b0ed4a431e9b6996ea9ed1f14781126cec78f168c0e64e5; - bytes32 constant SAFE_SINGLETON_FACTORY_BYTECODE_HASH = + bytes32 private constant SAFE_SINGLETON_FACTORY_BYTECODE_HASH = 0x020000453cf89ad86bc13761a15f8f205faa1dbb41ccd3553352fa3c5dd3a9a0; // https://github.com/mds1/multicall/tree/main - address constant MULTICALL3 = 0xcA11bde05977b3631167028862bE2a173976CA11; - bytes32 constant MULTICALL3_INPUT_HASH = 0x0b2046aa018109118d518235014ac2c679dcbdff32c64705fdf50d048cd32d22; - bytes32 constant MULTICALL3_BYTECODE_HASH = 0x02000ee02baee85cacb504f6ee1df7aad6809ac8d94a4a111d76991f90d36d6e; + address private constant MULTICALL3 = 0xcA11bde05977b3631167028862bE2a173976CA11; + bytes32 private constant MULTICALL3_INPUT_HASH = 0x0b2046aa018109118d518235014ac2c679dcbdff32c64705fdf50d048cd32d22; + bytes32 private constant MULTICALL3_BYTECODE_HASH = + 0x02000ee02baee85cacb504f6ee1df7aad6809ac8d94a4a111d76991f90d36d6e; /// @notice The method used to deploy pre-defined contract at specified address /// @dev Can only use the date of the corresponding presigned deployment transaction as constructorInput From 00b6c3182590c11dc5fcf54dbbe344624e405894 Mon Sep 17 00:00:00 2001 From: Vladislav Volosnikov Date: Fri, 14 Feb 2025 17:06:53 +0000 Subject: [PATCH 4/9] fix(EVM): add one more create2 factory (#1271) --- .../contracts/EvmPredeploysManager.sol | 10 +++ .../test/EvmPredeploysManager.spec.ts | 76 +++++++++++++++++++ system-contracts/test/shared/constants.ts | 1 + 3 files changed, 87 insertions(+) create mode 100644 system-contracts/test/EvmPredeploysManager.spec.ts diff --git a/system-contracts/contracts/EvmPredeploysManager.sol b/system-contracts/contracts/EvmPredeploysManager.sol index 13e91c7c39..46dea5521a 100644 --- a/system-contracts/contracts/EvmPredeploysManager.sol +++ b/system-contracts/contracts/EvmPredeploysManager.sol @@ -20,6 +20,13 @@ contract EvmPredeploysManager { bytes32 private constant CREATE2_PROXY_BYTECODE_HASH = 0x020000453cf89ad86bc13761a15f8f205faa1dbb41ccd3553352fa3c5dd3a9a0; + // https://github.com/Zoltu/deterministic-deployment-proxy + address private constant DETERMINISTIC_CREATE2_PROXY = 0x7A0D94F55792C434d74a40883C6ed8545E406D12; + bytes32 private constant DETERMINISTIC_CREATE2_PROXY_INPUT_HASH = + 0xa4d93d1dea5ac777c77f60dfbe95efcfc8847f592b1fb7e235171ed60949f4b0; + bytes32 private constant DETERMINISTIC_CREATE2_PROXY_BYTECODE_HASH = + 0x0200001f3bd554e541ab39bcf6e19564c9a6cbd700acceb65bfad0170c324d95; + // https://github.com/pcaversaccio/create2deployer address private constant CREATE2_DEPLOYER = 0x13b0D85CcB8bf860b6b79AF3029fCA081AE9beF2; bytes32 private constant CREATE2_DEPLOYER_INPUT_HASH = @@ -66,6 +73,9 @@ contract EvmPredeploysManager { if (contractAddress == CREATE2_PROXY) { expectedInputHash = CREATE2_PROXY_INPUT_HASH; expectedBytecodeHash = CREATE2_PROXY_BYTECODE_HASH; + } else if (contractAddress == DETERMINISTIC_CREATE2_PROXY) { + expectedInputHash = DETERMINISTIC_CREATE2_PROXY_INPUT_HASH; + expectedBytecodeHash = DETERMINISTIC_CREATE2_PROXY_BYTECODE_HASH; } else if (contractAddress == CREATE2_DEPLOYER) { expectedInputHash = CREATE2_DEPLOYER_INPUT_HASH; expectedBytecodeHash = CREATE2_DEPLOYER_BYTECODE_HASH; diff --git a/system-contracts/test/EvmPredeploysManager.spec.ts b/system-contracts/test/EvmPredeploysManager.spec.ts new file mode 100644 index 0000000000..c667c70287 --- /dev/null +++ b/system-contracts/test/EvmPredeploysManager.spec.ts @@ -0,0 +1,76 @@ +import { expect } from "chai"; +import { network } from "hardhat"; +import type { EvmPredeploysManager } from "../typechain"; +import { EvmPredeploysManagerFactory, ContractDeployerFactory } from "../typechain"; +import { + TEST_DEPLOYER_SYSTEM_CONTRACT_ADDRESS, + TEST_EVM_PREDEPLOYS_MANAGER, + TEST_FORCE_DEPLOYER_ADDRESS, +} from "./shared/constants"; +import { deployContractOnAddress, getWallets } from "./shared/utils"; + +// TODO: enable when EVM emulator is added to the test node +describe.skip("EvmPredeploysManager tests", function () { + let evmPredeploysManager: EvmPredeploysManager; + + before(async () => { + const wallet = getWallets()[0]; + await deployContractOnAddress(TEST_EVM_PREDEPLOYS_MANAGER, "EvmPredeploysManager"); + await deployContractOnAddress(TEST_DEPLOYER_SYSTEM_CONTRACT_ADDRESS, "ContractDeployer"); + evmPredeploysManager = EvmPredeploysManagerFactory.connect(TEST_EVM_PREDEPLOYS_MANAGER, wallet); + + await network.provider.request({ + method: "hardhat_impersonateAccount", + params: [TEST_FORCE_DEPLOYER_ADDRESS], + }); + + const contractDeployer = ContractDeployerFactory.connect(TEST_DEPLOYER_SYSTEM_CONTRACT_ADDRESS, wallet); + contractDeployer.setAllowedBytecodeTypesToDeploy(1); // Allow EVM contracts to be deployed + + await network.provider.request({ + method: "hardhat_stopImpersonatingAccount", + params: [TEST_FORCE_DEPLOYER_ADDRESS], + }); + }); + + describe("deployPredeployedContract", function () { + it("successfully deploys all predeployed contracts", async () => { + for (const predeploy of PREDEPLOYS_DATA) { + await expect(evmPredeploysManager.deployPredeployedContract(predeploy.address, predeploy.input)).to.be.not + .rejected; + } + }); + }); +}); + +const PREDEPLOYS_DATA = [ + { + address: "0x4e59b44847b379578588920cA78FbF26c0B4956C", + input: + "0x604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3", + }, + { + address: "0x7A0D94F55792C434d74a40883C6ed8545E406D12", + input: "0x601f80600e600039806000f350fe60003681823780368234f58015156014578182fd5b80825250506014600cf3", + }, + { + address: "0x13b0D85CcB8bf860b6b79AF3029fCA081AE9beF2", + input: + "0x608060405234801561001057600080fd5b5061001a3361002c565b6000805460ff60a01b1916905561007c565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610aab8061008b6000396000f3fe6080604052600436106100a05760003560e01c80636447045411610064578063644704541461016a57806366cfa0571461018a578063715018a6146101aa5780638456cb59146101bf5780638da5cb5b146101d4578063f2fde38b146101f257600080fd5b8063076c37b2146100ac5780633f4ba83a146100ce578063481286e6146100e357806356299481146101205780635c975abb1461014057600080fd5b366100a757005b600080fd5b3480156100b857600080fd5b506100cc6100c736600461077b565b610212565b005b3480156100da57600080fd5b506100cc610277565b3480156100ef57600080fd5b506101036100fe36600461077b565b6102ab565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561012c57600080fd5b5061010361013b3660046107b2565b610311565b34801561014c57600080fd5b50600054600160a01b900460ff166040519015158152602001610117565b34801561017657600080fd5b506100cc6101853660046107eb565b610372565b34801561019657600080fd5b506100cc6101a536600461081e565b6103de565b3480156101b657600080fd5b506100cc610419565b3480156101cb57600080fd5b506100cc61044d565b3480156101e057600080fd5b506000546001600160a01b0316610103565b3480156101fe57600080fd5b506100cc61020d3660046107eb565b61047f565b600054600160a01b900460ff16156102455760405162461bcd60e51b815260040161023c906108e2565b60405180910390fd5b61027282826040518060200161025a9061076e565b601f1982820381018352601f9091011660405261051a565b505050565b6000546001600160a01b031633146102a15760405162461bcd60e51b815260040161023c9061090c565b6102a961061c565b565b600061030a8383604080516001600160f81b03196020808301919091526bffffffffffffffffffffffff193060601b16602183015260358201859052605580830185905283518084039091018152607590920190925280519101206000905b9392505050565b604080516001600160f81b03196020808301919091526bffffffffffffffffffffffff19606085901b16602183015260358201869052605580830186905283518084039091018152607590920190925280519101206000905b949350505050565b6000546001600160a01b0316331461039c5760405162461bcd60e51b815260040161023c9061090c565b6040516001600160a01b038216904780156108fc02916000818181858888f193505050501580156103d1573d6000803e3d6000fd5b50806001600160a01b0316ff5b600054600160a01b900460ff16156104085760405162461bcd60e51b815260040161023c906108e2565b61041383838361051a565b50505050565b6000546001600160a01b031633146104435760405162461bcd60e51b815260040161023c9061090c565b6102a960006106b9565b6000546001600160a01b031633146104775760405162461bcd60e51b815260040161023c9061090c565b6102a9610709565b6000546001600160a01b031633146104a95760405162461bcd60e51b815260040161023c9061090c565b6001600160a01b03811661050e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161023c565b610517816106b9565b50565b6000808447101561056d5760405162461bcd60e51b815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e6365000000604482015260640161023c565b82516105bb5760405162461bcd60e51b815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f604482015260640161023c565b8383516020850187f590506001600160a01b03811661036a5760405162461bcd60e51b815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f7900000000000000604482015260640161023c565b600054600160a01b900460ff1661066c5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161023c565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600054600160a01b900460ff16156107335760405162461bcd60e51b815260040161023c906108e2565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861069c3390565b6101348061094283390190565b6000806040838503121561078e57600080fd5b50508035926020909101359150565b6001600160a01b038116811461051757600080fd5b6000806000606084860312156107c757600080fd5b833592506020840135915060408401356107e08161079d565b809150509250925092565b6000602082840312156107fd57600080fd5b813561030a8161079d565b634e487b7160e01b600052604160045260246000fd5b60008060006060848603121561083357600080fd5b8335925060208401359150604084013567ffffffffffffffff8082111561085957600080fd5b818601915086601f83011261086d57600080fd5b81358181111561087f5761087f610808565b604051601f8201601f19908116603f011681019083821181831017156108a7576108a7610808565b816040528281528960208487010111156108c057600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260408201526060019056fe608060405234801561001057600080fd5b50610114806100206000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063249cb3fa14602d575b600080fd5b603c603836600460a4565b604e565b60405190815260200160405180910390f35b6000828152602081815260408083206001600160a01b038516845290915281205460ff16607b576000609d565b7fa2ef4600d742022d532d4747cb3547474667d6f13804902513b2ec01c848f4b45b9392505050565b6000806040838503121560b657600080fd5b8235915060208301356001600160a01b038116811460d357600080fd5b80915050925092905056fea2646970667358221220a5a496558254ee0cf3c67a46f475274d2a4e7c3fcd0a6926c382539e9f4e747f64736f6c63430008090033a264697066735822122058b32e980f80f9510cb90f6ad481aa6ca33b3d34a29adff4a2381aa52879574b64736f6c63430008090033", + }, + { + address: "0xce0042B868300000d44A59004Da54A005ffdcf9f", + input: + "0x608060405234801561001057600080fd5b50610134806100206000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80634af63f0214602d575b600080fd5b60cf60048036036040811015604157600080fd5b810190602081018135640100000000811115605b57600080fd5b820183602082011115606c57600080fd5b80359060200191846001830284011164010000000083111715608d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550509135925060eb915050565b604080516001600160a01b039092168252519081900360200190f35b6000818351602085016000f5939250505056fea26469706673582212206b44f8a82cb6b156bfcc3dc6aadd6df4eefd204bc928a4397fd15dacf6d5320564736f6c63430006020033", + }, + { + address: "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", + input: + "0x604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3", + }, + { + address: "0xcA11bde05977b3631167028862bE2a173976CA11", + input: + "0x608060405234801561001057600080fd5b50610ee0806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e1461025a578063bce38bd714610275578063c3077fa914610288578063ee82ac5e1461029b57600080fd5b80634d2301cc146101ec57806372425d9d1461022157806382ad56cb1461023457806386d516e81461024757600080fd5b80633408e470116100c65780633408e47014610191578063399542e9146101a45780633e64a696146101c657806342cbb15c146101d957600080fd5b80630f28c97d146100f8578063174dea711461011a578063252dba421461013a57806327e86d6e1461015b575b600080fd5b34801561010457600080fd5b50425b6040519081526020015b60405180910390f35b61012d610128366004610a85565b6102ba565b6040516101119190610bbe565b61014d610148366004610a85565b6104ef565b604051610111929190610bd8565b34801561016757600080fd5b50437fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0140610107565b34801561019d57600080fd5b5046610107565b6101b76101b2366004610c60565b610690565b60405161011193929190610cba565b3480156101d257600080fd5b5048610107565b3480156101e557600080fd5b5043610107565b3480156101f857600080fd5b50610107610207366004610ce2565b73ffffffffffffffffffffffffffffffffffffffff163190565b34801561022d57600080fd5b5044610107565b61012d610242366004610a85565b6106ab565b34801561025357600080fd5b5045610107565b34801561026657600080fd5b50604051418152602001610111565b61012d610283366004610c60565b61085a565b6101b7610296366004610a85565b610a1a565b3480156102a757600080fd5b506101076102b6366004610d18565b4090565b60606000828067ffffffffffffffff8111156102d8576102d8610d31565b60405190808252806020026020018201604052801561031e57816020015b6040805180820190915260008152606060208201528152602001906001900390816102f65790505b5092503660005b8281101561047757600085828151811061034157610341610d60565b6020026020010151905087878381811061035d5761035d610d60565b905060200281019061036f9190610d8f565b6040810135958601959093506103886020850185610ce2565b73ffffffffffffffffffffffffffffffffffffffff16816103ac6060870187610dcd565b6040516103ba929190610e32565b60006040518083038185875af1925050503d80600081146103f7576040519150601f19603f3d011682016040523d82523d6000602084013e6103fc565b606091505b50602080850191909152901515808452908501351761046d577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b5050600101610325565b508234146104e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4d756c746963616c6c333a2076616c7565206d69736d6174636800000000000060448201526064015b60405180910390fd5b50505092915050565b436060828067ffffffffffffffff81111561050c5761050c610d31565b60405190808252806020026020018201604052801561053f57816020015b606081526020019060019003908161052a5790505b5091503660005b8281101561068657600087878381811061056257610562610d60565b90506020028101906105749190610e42565b92506105836020840184610ce2565b73ffffffffffffffffffffffffffffffffffffffff166105a66020850185610dcd565b6040516105b4929190610e32565b6000604051808303816000865af19150503d80600081146105f1576040519150601f19603f3d011682016040523d82523d6000602084013e6105f6565b606091505b5086848151811061060957610609610d60565b602090810291909101015290508061067d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060448201526064016104dd565b50600101610546565b5050509250929050565b43804060606106a086868661085a565b905093509350939050565b6060818067ffffffffffffffff8111156106c7576106c7610d31565b60405190808252806020026020018201604052801561070d57816020015b6040805180820190915260008152606060208201528152602001906001900390816106e55790505b5091503660005b828110156104e657600084828151811061073057610730610d60565b6020026020010151905086868381811061074c5761074c610d60565b905060200281019061075e9190610e76565b925061076d6020840184610ce2565b73ffffffffffffffffffffffffffffffffffffffff166107906040850185610dcd565b60405161079e929190610e32565b6000604051808303816000865af19150503d80600081146107db576040519150601f19603f3d011682016040523d82523d6000602084013e6107e0565b606091505b506020808401919091529015158083529084013517610851577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b50600101610714565b6060818067ffffffffffffffff81111561087657610876610d31565b6040519080825280602002602001820160405280156108bc57816020015b6040805180820190915260008152606060208201528152602001906001900390816108945790505b5091503660005b82811015610a105760008482815181106108df576108df610d60565b602002602001015190508686838181106108fb576108fb610d60565b905060200281019061090d9190610e42565b925061091c6020840184610ce2565b73ffffffffffffffffffffffffffffffffffffffff1661093f6020850185610dcd565b60405161094d929190610e32565b6000604051808303816000865af19150503d806000811461098a576040519150601f19603f3d011682016040523d82523d6000602084013e61098f565b606091505b506020830152151581528715610a07578051610a07576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060448201526064016104dd565b506001016108c3565b5050509392505050565b6000806060610a2b60018686610690565b919790965090945092505050565b60008083601f840112610a4b57600080fd5b50813567ffffffffffffffff811115610a6357600080fd5b6020830191508360208260051b8501011115610a7e57600080fd5b9250929050565b60008060208385031215610a9857600080fd5b823567ffffffffffffffff811115610aaf57600080fd5b610abb85828601610a39565b90969095509350505050565b6000815180845260005b81811015610aed57602081850181015186830182015201610ad1565b81811115610aff576000602083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082825180855260208086019550808260051b84010181860160005b84811015610bb1578583037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001895281518051151584528401516040858501819052610b9d81860183610ac7565b9a86019a9450505090830190600101610b4f565b5090979650505050505050565b602081526000610bd16020830184610b32565b9392505050565b600060408201848352602060408185015281855180845260608601915060608160051b870101935082870160005b82811015610c52577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0888703018452610c40868351610ac7565b95509284019290840190600101610c06565b509398975050505050505050565b600080600060408486031215610c7557600080fd5b83358015158114610c8557600080fd5b9250602084013567ffffffffffffffff811115610ca157600080fd5b610cad86828701610a39565b9497909650939450505050565b838152826020820152606060408201526000610cd96060830184610b32565b95945050505050565b600060208284031215610cf457600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610bd157600080fd5b600060208284031215610d2a57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81833603018112610dc357600080fd5b9190910192915050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112610e0257600080fd5b83018035915067ffffffffffffffff821115610e1d57600080fd5b602001915036819003821315610a7e57600080fd5b8183823760009101908152919050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc1833603018112610dc357600080fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa1833603018112610dc357600080fdfea2646970667358221220bb2b5c71a328032f97c676ae39a1ec2148d3e5d6f73d95e9b17910152d61f16264736f6c634300080c0033", + }, +]; diff --git a/system-contracts/test/shared/constants.ts b/system-contracts/test/shared/constants.ts index 9ea6ba9696..2cf9ac3fbb 100644 --- a/system-contracts/test/shared/constants.ts +++ b/system-contracts/test/shared/constants.ts @@ -16,6 +16,7 @@ export const TEST_COMPRESSOR_CONTRACT_ADDRESS = "0x00000000000000000000000000000 export const TEST_COMPLEX_UPGRADER_CONTRACT_ADDRESS = "0x000000000000000000000000000000000000900f"; export const TEST_PUBDATA_CHUNK_PUBLISHER_ADDRESS = "0x0000000000000000000000000000000000009011"; export const TEST_L2_GENESIS_UPGRADE_CONTRACT_ADDRESS = "0x0000000000000000000000000000000000010001"; +export const TEST_EVM_PREDEPLOYS_MANAGER = "0x0000000000000000000000000000000000009014"; export const TEST_EVM_HASHES_STORAGE = "0x0000000000000000000000000000000000009015"; // event writer should be on the original address because event logs are filtered by address From 97c832690308574290c27e43fcf410cf09021f62 Mon Sep 17 00:00:00 2001 From: Vladislav Volosnikov Date: Tue, 18 Feb 2025 09:32:30 +0000 Subject: [PATCH 5/9] fix: Add comment to verificationKeyHash() (L-01) (#1273) --- .../contracts/state-transition/verifiers/DualVerifier.sol | 1 + l2-contracts/contracts/verifiers/DualVerifier.sol | 1 + 2 files changed, 2 insertions(+) diff --git a/l1-contracts/contracts/state-transition/verifiers/DualVerifier.sol b/l1-contracts/contracts/state-transition/verifiers/DualVerifier.sol index b5f5e25ae4..81ddce2489 100644 --- a/l1-contracts/contracts/state-transition/verifiers/DualVerifier.sol +++ b/l1-contracts/contracts/state-transition/verifiers/DualVerifier.sol @@ -61,6 +61,7 @@ contract DualVerifier is IVerifier { } /// @inheritdoc IVerifier + /// @dev Used for backward compatibility with older Verifier implementation. Returns PLONK verification key hash. function verificationKeyHash() external view returns (bytes32) { return PLONK_VERIFIER.verificationKeyHash(); } diff --git a/l2-contracts/contracts/verifiers/DualVerifier.sol b/l2-contracts/contracts/verifiers/DualVerifier.sol index 6f0424c82d..53def77d41 100644 --- a/l2-contracts/contracts/verifiers/DualVerifier.sol +++ b/l2-contracts/contracts/verifiers/DualVerifier.sol @@ -61,6 +61,7 @@ contract DualVerifier is IVerifier { } /// @inheritdoc IVerifier + /// @dev Used for backward compatibility with older Verifier implementation. Returns PLONK verification key hash. function verificationKeyHash() external view returns (bytes32) { return PLONK_VERIFIER.verificationKeyHash(); } From ebf6b1e7aa5bb6102c4824c5a74ef83a75ec8207 Mon Sep 17 00:00:00 2001 From: Vladislav Volosnikov Date: Tue, 18 Feb 2025 10:09:04 +0000 Subject: [PATCH 6/9] fix: Optimize extract proof in DualVerifier (N-02) (#1274) --- .../state-transition/verifiers/DualVerifier.sol | 10 +++++----- l2-contracts/contracts/verifiers/DualVerifier.sol | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/l1-contracts/contracts/state-transition/verifiers/DualVerifier.sol b/l1-contracts/contracts/state-transition/verifiers/DualVerifier.sol index 81ddce2489..b7844fc6c1 100644 --- a/l1-contracts/contracts/state-transition/verifiers/DualVerifier.sol +++ b/l1-contracts/contracts/state-transition/verifiers/DualVerifier.sol @@ -85,14 +85,14 @@ contract DualVerifier is IVerifier { /// @return result A new array with the first element removed. The first element was used as a hack for /// differentiator between FFLONK and PLONK proofs. function _extractProof(uint256[] calldata _proof) internal pure returns (uint256[] memory result) { - uint256 length = _proof.length; + uint256 resultLength = _proof.length - 1; - // Allocate memory for the new array (length - 1) since the first element is omitted. - result = new uint256[](length - 1); + // Allocate memory for the new array (_proof.length - 1) since the first element is omitted. + result = new uint256[](resultLength); // Copy elements starting from index 1 (the second element) of the original array. - for (uint256 i = 1; i < length; ++i) { - result[i - 1] = _proof[i]; + assembly { + calldatacopy(add(result, 0x20), add(_proof.offset, 0x20), mul(resultLength, 0x20)) } } } diff --git a/l2-contracts/contracts/verifiers/DualVerifier.sol b/l2-contracts/contracts/verifiers/DualVerifier.sol index 53def77d41..5704bbb7cd 100644 --- a/l2-contracts/contracts/verifiers/DualVerifier.sol +++ b/l2-contracts/contracts/verifiers/DualVerifier.sol @@ -85,14 +85,14 @@ contract DualVerifier is IVerifier { /// @return result A new array with the first element removed. The first element was used as a hack for /// differentiator between FFLONK and PLONK proofs. function _extractProof(uint256[] calldata _proof) internal pure returns (uint256[] memory result) { - uint256 length = _proof.length; + uint256 resultLength = _proof.length - 1; - // Allocate memory for the new array (length - 1) since the first element is omitted. - result = new uint256[](length - 1); + // Allocate memory for the new array (_proof.length - 1) since the first element is omitted. + result = new uint256[](resultLength); // Copy elements starting from index 1 (the second element) of the original array. - for (uint256 i = 1; i < length; ++i) { - result[i - 1] = _proof[i]; + assembly { + calldatacopy(add(result, 0x20), add(_proof.offset, 0x20), mul(resultLength, 0x20)) } } } From b24486a4d4104cf149281a09201378b15b91653a Mon Sep 17 00:00:00 2001 From: Vladislav Volosnikov Date: Tue, 18 Feb 2025 10:32:23 +0000 Subject: [PATCH 7/9] fix: Fix comments in verifiers (N-03) (#1275) --- .../contracts/state-transition/verifiers/DualVerifier.sol | 2 +- .../contracts/state-transition/verifiers/VerifierFflonk.sol | 2 +- l2-contracts/contracts/verifiers/DualVerifier.sol | 2 +- l2-contracts/contracts/verifiers/VerifierFflonk.sol | 2 +- tools/data/fflonk_verifier_contract_template.txt | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/l1-contracts/contracts/state-transition/verifiers/DualVerifier.sol b/l1-contracts/contracts/state-transition/verifiers/DualVerifier.sol index b7844fc6c1..3a8c83b8be 100644 --- a/l1-contracts/contracts/state-transition/verifiers/DualVerifier.sol +++ b/l1-contracts/contracts/state-transition/verifiers/DualVerifier.sol @@ -47,7 +47,7 @@ contract DualVerifier is IVerifier { revert EmptyProofLength(); } - // The first element of `_recursiveAggregationInput` determines the verifier type (either FFLONK or PLONK). + // The first element of `_proof` determines the verifier type (either FFLONK or PLONK). uint256 verifierType = _proof[0]; if (verifierType == FFLONK_VERIFICATION_TYPE) { return FFLONK_VERIFIER.verify(_publicInputs, _extractProof(_proof)); diff --git a/l1-contracts/contracts/state-transition/verifiers/VerifierFflonk.sol b/l1-contracts/contracts/state-transition/verifiers/VerifierFflonk.sol index 63c207da34..ba7acd385c 100644 --- a/l1-contracts/contracts/state-transition/verifiers/VerifierFflonk.sol +++ b/l1-contracts/contracts/state-transition/verifiers/VerifierFflonk.sol @@ -1583,7 +1583,7 @@ contract VerifierFflonk is IVerifierV2 { /** * @dev Performs modular exponentiation using the formula (value ^ power) mod R_MOD. - * @notice Stores values starting from the initial free memory pointer i.e., 0x80. + * @notice Stores values starting from the 0x00 memory slot. * The free memory pointer is not updated as it stays unused throughout the code execution. */ function modexp(value, power) -> res { diff --git a/l2-contracts/contracts/verifiers/DualVerifier.sol b/l2-contracts/contracts/verifiers/DualVerifier.sol index 5704bbb7cd..b5e8e709f2 100644 --- a/l2-contracts/contracts/verifiers/DualVerifier.sol +++ b/l2-contracts/contracts/verifiers/DualVerifier.sol @@ -47,7 +47,7 @@ contract DualVerifier is IVerifier { revert EmptyProofLength(); } - // The first element of `_recursiveAggregationInput` determines the verifier type (either FFLONK or PLONK). + // The first element of `_proof` determines the verifier type (either FFLONK or PLONK). uint256 verifierType = _proof[0]; if (verifierType == FFLONK_VERIFICATION_TYPE) { return FFLONK_VERIFIER.verify(_publicInputs, _extractProof(_proof)); diff --git a/l2-contracts/contracts/verifiers/VerifierFflonk.sol b/l2-contracts/contracts/verifiers/VerifierFflonk.sol index 33e50f885d..eadc8d8ecd 100644 --- a/l2-contracts/contracts/verifiers/VerifierFflonk.sol +++ b/l2-contracts/contracts/verifiers/VerifierFflonk.sol @@ -1583,7 +1583,7 @@ contract VerifierFflonk is IVerifierV2 { /** * @dev Performs modular exponentiation using the formula (value ^ power) mod R_MOD. - * @notice Stores values starting from the initial free memory pointer i.e., 0x80. + * @notice Stores values starting from the 0x00 memory slot. * The free memory pointer is not updated as it stays unused throughout the code execution. */ function modexp(value, power) -> res { diff --git a/tools/data/fflonk_verifier_contract_template.txt b/tools/data/fflonk_verifier_contract_template.txt index f3254c3fca..f439d005e1 100644 --- a/tools/data/fflonk_verifier_contract_template.txt +++ b/tools/data/fflonk_verifier_contract_template.txt @@ -1567,7 +1567,7 @@ contract VerifierFflonk is IVerifierV2 { /** * @dev Performs modular exponentiation using the formula (value ^ power) mod R_MOD. - * @notice Stores values starting from the initial free memory pointer i.e., 0x80. + * @notice Stores values starting from the 0x00 memory slot. * The free memory pointer is not updated as it stays unused throughout the code execution. */ {{modexp_function}} From 7e3c7ffa1e76a065cc3a608f550919e58f3dfc0f Mon Sep 17 00:00:00 2001 From: Vladislav Volosnikov Date: Tue, 18 Feb 2025 11:01:26 +0000 Subject: [PATCH 8/9] fix: Add more validation in diamond init (L-02) (#1276) --- .../state-transition/chain-deps/DiamondInit.sol | 14 +++++++++++++- .../script-config/config-deploy-l1.toml | 6 +++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/l1-contracts/contracts/state-transition/chain-deps/DiamondInit.sol b/l1-contracts/contracts/state-transition/chain-deps/DiamondInit.sol index d0cf373094..c4068d5ed9 100644 --- a/l1-contracts/contracts/state-transition/chain-deps/DiamondInit.sol +++ b/l1-contracts/contracts/state-transition/chain-deps/DiamondInit.sol @@ -8,7 +8,7 @@ import {L2_TO_L1_LOG_SERIALIZE_SIZE, MAX_GAS_PER_TRANSACTION} from "../../common import {InitializeData, IDiamondInit} from "../chain-interfaces/IDiamondInit.sol"; import {PriorityQueue} from "../libraries/PriorityQueue.sol"; import {PriorityTree} from "../libraries/PriorityTree.sol"; -import {ZeroAddress, EmptyAssetId, TooMuchGas} from "../../common/L1ContractErrors.sol"; +import {ZeroAddress, EmptyAssetId, TooMuchGas, EmptyBytes32} from "../../common/L1ContractErrors.sol"; /// @author Matter Labs /// @dev The contract is used only once to initialize the diamond proxy. @@ -49,6 +49,18 @@ contract DiamondInit is ZKChainBase, IDiamondInit { revert ZeroAddress(); } + if (_initializeData.l2BootloaderBytecodeHash == bytes32(0)) { + revert EmptyBytes32(); + } + + if (_initializeData.l2DefaultAccountBytecodeHash == bytes32(0)) { + revert EmptyBytes32(); + } + + if (_initializeData.l2EvmEmulatorBytecodeHash == bytes32(0)) { + revert EmptyBytes32(); + } + s.chainId = _initializeData.chainId; s.bridgehub = _initializeData.bridgehub; s.chainTypeManager = _initializeData.chainTypeManager; diff --git a/l1-contracts/test/foundry/l1/integration/deploy-scripts/script-config/config-deploy-l1.toml b/l1-contracts/test/foundry/l1/integration/deploy-scripts/script-config/config-deploy-l1.toml index 6bcbe0b59b..a927947414 100644 --- a/l1-contracts/test/foundry/l1/integration/deploy-scripts/script-config/config-deploy-l1.toml +++ b/l1-contracts/test/foundry/l1/integration/deploy-scripts/script-config/config-deploy-l1.toml @@ -24,9 +24,9 @@ diamond_init_max_pubdata_per_batch = 120000 diamond_init_max_l2_gas_per_batch = 80000000 diamond_init_priority_tx_max_pubdata = 99000 diamond_init_minimal_l2_gas_price = 250000000 -bootloader_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -default_aa_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -evm_emulator_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" +bootloader_hash = "0x0100000000000000000000000000000000000000000000000000000000000000" +default_aa_hash = "0x0100000000000000000000000000000000000000000000000000000000000000" +evm_emulator_hash = "0x0100000000000000000000000000000000000000000000000000000000000000" force_deployments_data = "0x00" diamond_cut_data = "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000060000000000000000000000000103aa417efc38582cbb322d23b86342cb3bca4a40000000000000000000000000000000000000000000000000000000000000de00000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000005d8d8112ce7c189c3df7e80fce3cd96863acbbb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000014a37dc1d400000000000000000000000000000000000000000000000000000000a3bd011200000000000000000000000000000000000000000000000000000000a9f6d94100000000000000000000000000000000000000000000000000000000be6f11cf00000000000000000000000000000000000000000000000000000000e76db86500000000000000000000000000000000000000000000000000000000fc57565f000000000000000000000000000000000000000000000000000000006223258e0000000000000000000000000000000000000000000000000000000064b554ad0000000000000000000000000000000000000000000000000000000064bf8d660000000000000000000000000000000000000000000000000000000082b57749000000000000000000000000000000000000000000000000000000008c564cc100000000000000000000000000000000000000000000000000000000235d9eb50000000000000000000000000000000000000000000000000000000027ae4c160000000000000000000000000000000000000000000000000000000043dc2951000000000000000000000000000000000000000000000000000000004623c91d000000000000000000000000000000000000000000000000000000004dd18bf5000000000000000000000000000000000000000000000000000000000e18b68100000000000000000000000000000000000000000000000000000000173389450000000000000000000000000000000000000000000000000000000021f603d7000000000000000000000000000000000000000000000000000000001cc5d103000000000000000000000000000000000000000000000000000000000000000000000000000000007684a3fd9f61c7c4d396177cc92384b076c6164a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000002c98acd7a6000000000000000000000000000000000000000000000000000000009cd939e4000000000000000000000000000000000000000000000000000000009d1b5a8100000000000000000000000000000000000000000000000000000000a1954fc500000000000000000000000000000000000000000000000000000000a7358efb00000000000000000000000000000000000000000000000000000000adfca15e00000000000000000000000000000000000000000000000000000000af6a2dcd00000000000000000000000000000000000000000000000000000000b22dd78e00000000000000000000000000000000000000000000000000000000b8c2f66f00000000000000000000000000000000000000000000000000000000bd7c541200000000000000000000000000000000000000000000000000000000c3bbd2d700000000000000000000000000000000000000000000000000000000cdffacc600000000000000000000000000000000000000000000000000000000d046815600000000000000000000000000000000000000000000000000000000d86970d800000000000000000000000000000000000000000000000000000000db1f0bf900000000000000000000000000000000000000000000000000000000e5355c7500000000000000000000000000000000000000000000000000000000e81e0ba100000000000000000000000000000000000000000000000000000000ea6c029c00000000000000000000000000000000000000000000000000000000ef3f0bae00000000000000000000000000000000000000000000000000000000f5c1182c00000000000000000000000000000000000000000000000000000000facd743b00000000000000000000000000000000000000000000000000000000fd791f3c00000000000000000000000000000000000000000000000000000000fe26699e00000000000000000000000000000000000000000000000000000000631f4bac000000000000000000000000000000000000000000000000000000006e9960c30000000000000000000000000000000000000000000000000000000074f4d30d0000000000000000000000000000000000000000000000000000000079823c9a000000000000000000000000000000000000000000000000000000007a0ed627000000000000000000000000000000000000000000000000000000007b30c8da0000000000000000000000000000000000000000000000000000000039d7d4aa0000000000000000000000000000000000000000000000000000000046657fe90000000000000000000000000000000000000000000000000000000052ef6b2c000000000000000000000000000000000000000000000000000000005518c73b0000000000000000000000000000000000000000000000000000000056142d7a000000000000000000000000000000000000000000000000000000001de72e340000000000000000000000000000000000000000000000000000000029b98c670000000000000000000000000000000000000000000000000000000033ce93fe000000000000000000000000000000000000000000000000000000003408e470000000000000000000000000000000000000000000000000000000003591c1a000000000000000000000000000000000000000000000000000000000396073820000000000000000000000000000000000000000000000000000000006d49e5b00000000000000000000000000000000000000000000000000000000086a56f8000000000000000000000000000000000000000000000000000000000ec6b0b70000000000000000000000000000000000000000000000000000000018e3a94100000000000000000000000000000000000000000000000000000000000000000000000000000000a36f72a317fa180d945efb5fe4383c9fbfe8c8be000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000b7efda2ae00000000000000000000000000000000000000000000000000000000b473318e00000000000000000000000000000000000000000000000000000000d06b26e200000000000000000000000000000000000000000000000000000000dcabb98200000000000000000000000000000000000000000000000000000000e4948f4300000000000000000000000000000000000000000000000000000000eb67241900000000000000000000000000000000000000000000000000000000042901c70000000000000000000000000000000000000000000000000000000008522c300000000000000000000000000000000000000000000000000000000012f43dab000000000000000000000000000000000000000000000000000000006c0960f900000000000000000000000000000000000000000000000000000000263b7f8e00000000000000000000000000000000000000000000000000000000000000000000000000000000340e73f0092fd6faec522a3b8a6b4b0d7242dbff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000008701f58c5000000000000000000000000000000000000000000000000000000007f61885c0000000000000000000000000000000000000000000000000000000097c09d3400000000000000000000000000000000000000000000000000000000bd6db49900000000000000000000000000000000000000000000000000000000c37533bb0000000000000000000000000000000000000000000000000000000000a22e22000000000000000000000000000000000000000000000000000000000f23da43000000000000000000000000000000000000000000000000000000006edd4f120000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000ec2597d47a5416270d475b67e2b6cc20f35f4f50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004c4b400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f4240000000000000000000000000000000000000000000000000000000000001d4c00000000000000000000000000000000000000000000000000000000004c4b40000000000000000000000000000000000000000000000000000000000000182b8000000000000000000000000000000000000000000000000000000000ee6b280000000000000000000000000a4cb26d6933d2c3e76718d30de8547bcdf8dd241" From 4c5007ade6f5de949e4b966bad99c2d0ac1a1511 Mon Sep 17 00:00:00 2001 From: Vladislav Volosnikov Date: Tue, 18 Feb 2025 12:07:24 +0100 Subject: [PATCH 9/9] Update hashes --- AllContractsHashes.json | 82 ++++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 37 deletions(-) diff --git a/AllContractsHashes.json b/AllContractsHashes.json index 93e86b7523..b6aadc9e86 100644 --- a/AllContractsHashes.json +++ b/AllContractsHashes.json @@ -1,7 +1,7 @@ [ { "contractName": "system-contracts/AccountCodeStorage", - "zkBytecodeHash": "0x01000073324275cd163f8fe4e128d5e30a91d283e266adc424393b151eb8d120", + "zkBytecodeHash": "0x01000073537cf459c3dcb9248d7004acb3f31da90a78cea7d9454610b8c4c687", "zkBytecodePath": "/system-contracts/zkout/AccountCodeStorage.sol/AccountCodeStorage.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -25,7 +25,7 @@ }, { "contractName": "system-contracts/BootloaderUtilities", - "zkBytecodeHash": "0x010006f339272ff7ac0aff2fdee781666653580404aab6445c6536708e9d9626", + "zkBytecodeHash": "0x010006f352af7512030015606fa88b19be3ebff99ad656abfe0610df18ae0cfb", "zkBytecodePath": "/system-contracts/zkout/BootloaderUtilities.sol/BootloaderUtilities.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -33,7 +33,7 @@ }, { "contractName": "system-contracts/ComplexUpgrader", - "zkBytecodeHash": "0x010000b1df7bb1a5415abb8be2792b1dd472748a81029b9d4c81b161b7f20f4c", + "zkBytecodeHash": "0x010000b16cd5e3080bf8d99c26b9041645643af132936ba9a2117b3433ce7344", "zkBytecodePath": "/system-contracts/zkout/ComplexUpgrader.sol/ComplexUpgrader.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -41,7 +41,7 @@ }, { "contractName": "system-contracts/Compressor", - "zkBytecodeHash": "0x0100013b7dd58541755ca349877db7d7bbac68a246a4814e3abe46f6c3615874", + "zkBytecodeHash": "0x0100013bcc0169c9814b92cad255bac6e87cc6f6f7b3a53b799d881377fbe074", "zkBytecodePath": "/system-contracts/zkout/Compressor.sol/Compressor.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -49,7 +49,7 @@ }, { "contractName": "system-contracts/ContractDeployer", - "zkBytecodeHash": "0x010006f59a1a206cd1f8381e0ccf44ec322549735aca1ffbc59f9402fd5b7c6c", + "zkBytecodeHash": "0x01000769a5a7159a6a9b373c7773d80cd41ed0798bc20cff2e877d9db825f9e6", "zkBytecodePath": "/system-contracts/zkout/ContractDeployer.sol/ContractDeployer.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -57,7 +57,7 @@ }, { "contractName": "system-contracts/Create2Factory", - "zkBytecodeHash": "0x0100003fdde3b21a22a5bc173f52e63e0d4c608ebc66e41c6f9068165d7c3e51", + "zkBytecodeHash": "0x0100003f7fa87caa073860bf4aaf878d69fd5d6abce4bcd77543eedb8b4c1676", "zkBytecodePath": "/system-contracts/zkout/Create2Factory.sol/Create2Factory.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -65,7 +65,7 @@ }, { "contractName": "system-contracts/DefaultAccount", - "zkBytecodeHash": "0x0100050be03bbcc3ef04f08f03ca91a6b5bf3fe2f638f038600ca38548936442", + "zkBytecodeHash": "0x0100050b8a16aa406d2461cc9abde5f7e93009d3d485bfab1eeccdfda3e697ce", "zkBytecodePath": "/system-contracts/zkout/DefaultAccount.sol/DefaultAccount.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -129,7 +129,7 @@ }, { "contractName": "system-contracts/EfficientCall", - "zkBytecodeHash": "0x01000007515ac6ab353f91d56c3e0b5db4af5fdea2c9f2c5248cd6d9afc1d6d5", + "zkBytecodeHash": "0x01000007f0da7a829da37a1a9dcefa35ccd4681b5a9054004eeb8de8d073e884", "zkBytecodePath": "/system-contracts/zkout/EfficientCall.sol/EfficientCall.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -143,9 +143,17 @@ "evmBytecodePath": null, "evmDeployedBytecodeHash": null }, + { + "contractName": "system-contracts/EvmHashesStorage", + "zkBytecodeHash": "0x01000019f6a19dc8299a6528224c4ec89206138719f7283cc144369f8a17ee28", + "zkBytecodePath": "/system-contracts/zkout/EvmHashesStorage.sol/EvmHashesStorage.json", + "evmBytecodeHash": null, + "evmBytecodePath": null, + "evmDeployedBytecodeHash": null + }, { "contractName": "system-contracts/EvmPredeploysManager", - "zkBytecodeHash": "0x010000e5ed6d2a8a31b1decb823c517b605b90a7aacb7217a735d4ec0ee01537", + "zkBytecodeHash": "0x010000e9127590bdda952392cd0f8d5515cf27a5640b333b8d0dcea4f195a480", "zkBytecodePath": "/system-contracts/zkout/EvmPredeploysManager.sol/EvmPredeploysManager.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -153,7 +161,7 @@ }, { "contractName": "system-contracts/ImmutableSimulator", - "zkBytecodeHash": "0x010000330d86fa969e263a537149e8ee36e0ff129b535bb0df07548bfd76d914", + "zkBytecodeHash": "0x0100003375cf73a5c665225f8c8fe46cb16301512ee544d095a83f6391fdfa20", "zkBytecodePath": "/system-contracts/zkout/ImmutableSimulator.sol/ImmutableSimulator.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -161,7 +169,7 @@ }, { "contractName": "system-contracts/KnownCodesStorage", - "zkBytecodeHash": "0x010000cf114a4c607f307ab0083d89c5b7709a725c747c88bb457b646fa6df49", + "zkBytecodeHash": "0x010000cff7945446a2ffbd5770af2074c968ef14076c9fe4601c862dd9d5c8ca", "zkBytecodePath": "/system-contracts/zkout/KnownCodesStorage.sol/KnownCodesStorage.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -169,7 +177,7 @@ }, { "contractName": "system-contracts/L1Messenger", - "zkBytecodeHash": "0x010001d348abccbde052ceb0641eae3bb713935fc7ffd0edc33a0c01857c8275", + "zkBytecodeHash": "0x010001d38ce17f8684ecb9f3b05fabbf17ed3296ef9911efd0e5b2006f41cf6a", "zkBytecodePath": "/system-contracts/zkout/L1Messenger.sol/L1Messenger.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -177,7 +185,7 @@ }, { "contractName": "system-contracts/L2BaseToken", - "zkBytecodeHash": "0x010000db2d415e2fa4a5290f0195cdb84f2402b28ac38cb990f76e46bfc3fba9", + "zkBytecodeHash": "0x010000db9bd7557689ea12bd36b111de46752fee61c7c6f41b046a16c148fae8", "zkBytecodePath": "/system-contracts/zkout/L2BaseToken.sol/L2BaseToken.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -185,7 +193,7 @@ }, { "contractName": "system-contracts/L2GatewayUpgrade", - "zkBytecodeHash": "0x01000335a30e759fc930892f7d895dcc81bba33052c5ffd3fd2783c20e3e5025", + "zkBytecodeHash": "0x01000345a6402a34f7df211b56d95ee22221271b6a7b5c74ea7c140112c36436", "zkBytecodePath": "/system-contracts/zkout/L2GatewayUpgrade.sol/L2GatewayUpgrade.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -193,7 +201,7 @@ }, { "contractName": "system-contracts/L2GatewayUpgradeHelper", - "zkBytecodeHash": "0x01000007d05a4ddd3c90fe3e3d180d634fedc81adf1cf3de1caa4f1750fa26f4", + "zkBytecodeHash": "0x01000007a442a0a7706e75b4e237144831e63c34391c1c7ef7bd5e08dba9efb3", "zkBytecodePath": "/system-contracts/zkout/L2GatewayUpgradeHelper.sol/L2GatewayUpgradeHelper.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -201,7 +209,7 @@ }, { "contractName": "system-contracts/L2GenesisUpgrade", - "zkBytecodeHash": "0x01000189a2e601eff85279fa8aac2f05c4efaba20ecb13acad1651efd3f45f0d", + "zkBytecodeHash": "0x01000189ad076dce57aba4916711df12b72ee4bde475ed07b856c1a3bf3a7da7", "zkBytecodePath": "/system-contracts/zkout/L2GenesisUpgrade.sol/L2GenesisUpgrade.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -217,7 +225,7 @@ }, { "contractName": "system-contracts/MsgValueSimulator", - "zkBytecodeHash": "0x01000059005c1fc30aa3358654950f8109531a88da35f8982e4ff7b7333203a4", + "zkBytecodeHash": "0x010000590135a215fb4475cfa90ddc49ae34988fab3ab02fe2c877742d2bfc02", "zkBytecodePath": "/system-contracts/zkout/MsgValueSimulator.sol/MsgValueSimulator.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -225,7 +233,7 @@ }, { "contractName": "system-contracts/NonceHolder", - "zkBytecodeHash": "0x010000cff88e85df5069b5ea14155aab0065e7153a2a58bce8bfa47864c4c9d8", + "zkBytecodeHash": "0x010000cf4163ffc8d20dce8a2db69cb304608539643a984cf729ce19cbc2df77", "zkBytecodePath": "/system-contracts/zkout/NonceHolder.sol/NonceHolder.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -233,7 +241,7 @@ }, { "contractName": "system-contracts/PubdataChunkPublisher", - "zkBytecodeHash": "0x01000043b80a9116d47f99373a08bfe4c3d6c30654fed5719d7b9868d1815044", + "zkBytecodeHash": "0x01000043461d3afc5ee18fd091551be210b25de8a3eace83c05fad379a4e7243", "zkBytecodePath": "/system-contracts/zkout/PubdataChunkPublisher.sol/PubdataChunkPublisher.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -273,7 +281,7 @@ }, { "contractName": "system-contracts/SystemCaller", - "zkBytecodeHash": "0x0100004db6049c5571272626d8efe08fadd9b218dbb1537b4e6a72f33e9b1a09", + "zkBytecodeHash": "0x0100004da1e8321ad37729000a8bb6ba79989b20a4898b488585dfb5fc66e86e", "zkBytecodePath": "/system-contracts/zkout/SystemCaller.sol/SystemCaller.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -281,7 +289,7 @@ }, { "contractName": "system-contracts/SystemContext", - "zkBytecodeHash": "0x0100017b2d20aeb4a8948ac1e513b5492737ddc74c0285940ef16a5367d6b74c", + "zkBytecodeHash": "0x0100017b060b101e50b4695e9742fa51aed04d89872686341ccb74e0833a20c5", "zkBytecodePath": "/system-contracts/zkout/SystemContext.sol/SystemContext.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -289,7 +297,7 @@ }, { "contractName": "system-contracts/SystemContractHelper", - "zkBytecodeHash": "0x01000007922c89ea2e63d96c3d2c5ee168f5e095be162c191eb34e7e0bfe71a0", + "zkBytecodeHash": "0x01000007128081fec4323d920b60a2399fa239a9b2fef25a5ecac8a9c5c0498c", "zkBytecodePath": "/system-contracts/zkout/SystemContractHelper.sol/SystemContractHelper.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -297,7 +305,7 @@ }, { "contractName": "system-contracts/SystemContractsCaller", - "zkBytecodeHash": "0x010000077d495960d3b4842729152328a99f45dd570683ea919b3f653742a513", + "zkBytecodeHash": "0x01000007eb7967a649f52aac2b27f45075f1c66bc9c94a6f84331e0479529cbd", "zkBytecodePath": "/system-contracts/zkout/SystemContractsCaller.sol/SystemContractsCaller.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -305,7 +313,7 @@ }, { "contractName": "system-contracts/TransactionHelper", - "zkBytecodeHash": "0x01000007d5138757931ea532c878871c4061607761963e74aa2ed1c7294fe1cb", + "zkBytecodeHash": "0x010000078c821737846a2bb1a5eb419e94f38e8c0d7f415ed35469844961102d", "zkBytecodePath": "/system-contracts/zkout/TransactionHelper.sol/TransactionHelper.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -337,7 +345,7 @@ }, { "contractName": "system-contracts/Utils", - "zkBytecodeHash": "0x01000007ec624ed04b48512ba75757d1fd5165caaeead34ab2f0ab020e0bc4e6", + "zkBytecodeHash": "0x01000007ec3ec9db063eb075e9f550e7390dbf41f3368a0dde9ccf9e2638cfde", "zkBytecodePath": "/system-contracts/zkout/Utils.sol/Utils.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -705,7 +713,7 @@ }, { "contractName": "l2-contracts/VerifierFflonk", - "zkBytecodeHash": "0x01000a236b4711709c1044f218506bb5ee6e222f71e91af447474951741859eb", + "zkBytecodeHash": "0x01000a23f65f58c78be195fef629c4cca69a44f5ff84d71dcd108cca3d06e6b0", "zkBytecodePath": "/l2-contracts/zkout/VerifierFflonk.sol/VerifierFflonk.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -713,7 +721,7 @@ }, { "contractName": "l2-contracts/VerifierPlonk", - "zkBytecodeHash": "0x01000eb365703782e52c88bc4568b1bfeedc19fcd828f373b17b879dbdd4c80e", + "zkBytecodeHash": "0x01000eb3d08e0f5e22a0b908688e52ece85313705457f5d9970b74f3a41f82b6", "zkBytecodePath": "/l2-contracts/zkout/VerifierPlonk.sol/VerifierPlonk.json", "evmBytecodeHash": null, "evmBytecodePath": null, @@ -1177,11 +1185,11 @@ }, { "contractName": "l1-contracts/GatewayCTMDeployer", - "zkBytecodeHash": "0x0100032f90bdeb8b42fbcdb7370716f67162ef2519d5f66f1d340982c8af5aa3", + "zkBytecodeHash": "0x0100032ff469557568f881bdc4bf9cabeec81d848364fd20aa564bed8b570b07", "zkBytecodePath": "/l1-contracts/zkout/GatewayCTMDeployer.sol/GatewayCTMDeployer.json", - "evmBytecodeHash": "0x64dde2f5c65847cf2823fd1316da7710c8f0203f6997e481d29a8ebb02362716", + "evmBytecodeHash": "0x800bafe085021e01ab20a57a7f19fbf3b55c9914bf2eb3ac559efdc5ded9a9c0", "evmBytecodePath": "/l1-contracts/out/GatewayCTMDeployer.sol/GatewayCTMDeployer.json", - "evmDeployedBytecodeHash": "0x741fb476a87520c7677e8fcbb07d5bd26f42802d197eed5241c47801ec88363d" + "evmDeployedBytecodeHash": "0x77d414986c65f91a2f1aca25dc432e0e579959b657a9648113bdc55775c67572" }, { "contractName": "l1-contracts/GatewayTransactionFilterer", @@ -1721,19 +1729,19 @@ }, { "contractName": "l1-contracts/VerifierFflonk", - "zkBytecodeHash": "0x010009f5afb3a1189a32c712fd8f6031338d41d560d36973492f846e63f87e1b", + "zkBytecodeHash": "0x010009f5cbf14be5ea69f054cf1d482418f9df8c98b0067b8bbb837870325b86", "zkBytecodePath": "/l1-contracts/zkout/VerifierFflonk.sol/VerifierFflonk.json", - "evmBytecodeHash": "0xc8a05607937d0d6c941f348828f870fc85e2b8a1dfeba4c74bb2488bb7b0e24e", + "evmBytecodeHash": "0xd4003d68475b4dbe4d8329877a21e469723b1c4289a94f928fa5db7b7c937575", "evmBytecodePath": "/l1-contracts/out/VerifierFflonk.sol/VerifierFflonk.json", - "evmDeployedBytecodeHash": "0x5f2802457dc240828f97dce21b556d73cee7d7156191328e29ccbc9bd2917586" + "evmDeployedBytecodeHash": "0xb1c7c13a250579ba29a3503f8fa0fca25da08d26629d3ba4b542420444a11f7e" }, { "contractName": "l1-contracts/VerifierPlonk", - "zkBytecodeHash": "0x01000e47e9ed073bd8df2a8e99121688aca09247c170208e80e102335a11c2e2", + "zkBytecodeHash": "0x01000e47742eaac43f3c0d2e0931a3014ff728f6f45e72bd0a8d4b8dce7fb267", "zkBytecodePath": "/l1-contracts/zkout/VerifierPlonk.sol/VerifierPlonk.json", - "evmBytecodeHash": "0xd796316a31abb5cf18693cf262ef980a675605d5d784b600344bb6274dc01720", + "evmBytecodeHash": "0x0dec3884d0414a045803215f445a19e941e45e2f0abe75149d1dcd997d2e81b9", "evmBytecodePath": "/l1-contracts/out/VerifierPlonk.sol/VerifierPlonk.json", - "evmDeployedBytecodeHash": "0xf9b0dab3a7296ce5b3dbd47d639dfd1172131861985ce61dab0894dfca61e369" + "evmDeployedBytecodeHash": "0x4c4c3180b97fb7a3572b12e45920fc2068d7e2dfae26119bc02430b89397fcf2" }, { "contractName": "l1-contracts/WETH9", @@ -1930,7 +1938,7 @@ { "contractName": "EvmEmulator.yul", "zkBytecodePath": "/system-contracts/zkout/EvmEmulator.yul/contracts-preprocessed/EvmEmulator.yul.json", - "zkBytecodeHash": "0x01000bbbd68833b14b8dc6b4b9331185c1e02e9c90fcdd0874c6b97c9f9ede6a", + "zkBytecodeHash": "0x01000bbb8116fe7bdf690c19740ea350375426cec23f4f1f69a12fdc58adc9ba", "evmBytecodePath": null, "evmBytecodeHash": null, "evmDeployedBytecodeHash": null