// 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.0; /// @dev The log passed from L2 /// @param l2ShardId The shard identifier, 0 - rollup, 1 - porter. All other values are not used but are reserved for the future /// @param isService A boolean flag that is part of the log along with `key`, `value`, and `sender` address. /// This field is required formally but does not have any special meaning. /// @param txNumberInBlock The L2 transaction number in a block, in which the log was sent /// @param sender The L2 address which sent the log /// @param key The 32 bytes of information that was sent in the log /// @param value The 32 bytes of information that was sent in the log // Both `key` and `value` are arbitrary 32-bytes selected by the log sender struct L2ToL1Log { uint8 l2ShardId; bool isService; uint16 txNumberInBlock; address sender; bytes32 key; bytes32 value; } /// @dev Bytes in raw L2 to L1 log /// @dev Equal to the bytes size of the tuple - (uint8 ShardId, bool isService, uint16 txNumberInBlock, address sender, bytes32 key, bytes32 value) uint256 constant L2_TO_L1_LOG_SERIALIZE_SIZE = 88; /// @dev The value of default leaf hash for L2 to L1 logs Merkle tree /// @dev An incomplete fixed-size tree is filled with this value to be a full binary tree /// @dev Actually equal to the `keccak256(new bytes(L2_TO_L1_LOG_SERIALIZE_SIZE))` bytes32 constant L2_L1_LOGS_TREE_DEFAULT_LEAF_HASH = 0x72abee45b59e344af8a6e520241c4744aff26ed411f4c4b00f8af09adada43ba; /// @dev The current version of state diff compression being used. uint256 constant STATE_DIFF_COMPRESSION_VERSION_NUMBER = 1; /** * @author Matter Labs * @custom:security-contact security@matterlabs.dev * @notice The interface of the L1 Messenger contract, responsible for sending messages to L1. */ interface IL1Messenger { // Possibly in the future we will be able to track the messages sent to L1 with // some hooks in the VM. For now, it is much easier to track them with L2 events. event L1MessageSent( address indexed _sender, bytes32 indexed _hash, bytes _message ); event L2ToL1LogSent(L2ToL1Log _l2log); event BytecodeL1PublicationRequested(bytes32 _bytecodeHash); function sendToL1(bytes calldata _message) external returns (bytes32); function sendL2ToL1Log(bool _isService, bytes32 _key, bytes32 _value) external returns (uint256 logIdInMerkleTree); // This function is expected to be called only by the KnownCodesStorage system contract function requestBytecodeL1Publication(bytes32 _bytecodeHash) external; }