Verified contractPartialMIT
GovernanceUpgradeTimer
Address0x019517fd35e9710ad6e0bb3e4ff53ec0b004c577
- Balance
0 ETH
- Transactions
0
- Compiler
solc 0.8.28
- Same code
3 more contracts
Details
- Compiler
- solc 0.8.28+commit.7893614a
- Language
- solidity
- Optimization
- Yes, 9,999,999 runs
- EVM version
- prague
- License
- MIT
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,334,316
- Creation transaction
- 0xd4709b21fe…5eae2557ef
7 files
- contracts/upgrades/GovernanceUpgradeTimer.solmain5.09 KB
- ../system-contracts/contracts/Constants.sol11.5 KB
- contracts/common/Config.sol17.27 KB
- contracts/common/L1ContractErrors.sol14.74 KB
- lib/openzeppelin-contracts-v4/contracts/access/Ownable.sol2.62 KB
- lib/openzeppelin-contracts-v4/contracts/access/Ownable2Step.sol1.95 KB
- lib/openzeppelin-contracts-v4/contracts/utils/Context.sol962 B
contracts/upgrades/GovernanceUpgradeTimer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import {Ownable2Step} from "@openzeppelin/contracts-v4/access/Ownable2Step.sol";
import {
CallerNotTimerAdmin,
DeadlineNotYetPassed,
NewDeadlineExceedsMaxDeadline,
NewDeadlineNotGreaterThanCurrent,
TimerAlreadyStarted,
TimerNotStarted,
ZeroAddress
} from "../common/L1ContractErrors.sol";
/// @title Governance Upgrade Timer
/// @author Matter Labs
/// @custom:security-contact [email protected]
/// @notice This contract will be used by the governance to ensure that the chains have enough time
/// to upgrade their implementation before finalizing the upgrade on L1.
/// @notice The `startTimer` function should be called once the new version is published. It starts the
/// timer and gives at least `INITIAL_DELAY` for the chains to upgrade. In case for any reason the timeline has to
/// be extended, the owner of this contract can increase the timeline, but only the maximum of `MAX_ADDITIONAL_DELAY`
/// is allowed.
contract GovernanceUpgradeTimer is Ownable2Step {
/// @notice The initial delay to be used.
uint256 public immutable INITIAL_DELAY;
/// @notice The maximal delay for the upgrade.
uint256 public immutable MAX_ADDITIONAL_DELAY;
/// @notice The address that can start the timer.
address public immutable TIMER_GOVERNANCE;
/// @notice The deadline which we should wait.
uint256 public deadline;
/// @notice The maximal deadline to which the owner of this contract can
/// increase the deadline.
uint256 public maxDeadline;
/// @dev Emitted when the timer is started, logging the initial `deadline` and `maxDeadline`.
/// @param deadline The initial deadline set for the timer.
/// @param maxDeadline The maximum deadline the timer can be extended to.
event TimerStarted(uint256 deadline, uint256 maxDeadline);
/// @dev Emitted when the owner changes the deadline.
/// @param newDeadline The new deadline set by the owner.
event DeadlineChanged(uint256 newDeadline);
/// @dev Initializes the contract with immutable values for `INITIAL_DELAY`, `MAX_ADDITIONAL_DELAY`, and `TIMER_GOVERNANCE`.
/// @param _initialDelay The initial delay in seconds to be added to the current block timestamp to set the deadline.
/// @param _maxAdditionalDelay The maximum number of seconds that can be added to the initial delay to set `maxDeadline`.
/// @param _timerGovernance The address of the timer administrator, who is allowed to start the timer.
/// @param _initialOwner The initial owner of the contract.
constructor(uint256 _initialDelay, uint256 _maxAdditionalDelay, address _timerGovernance, address _initialOwner) {
if (_timerGovernance == address(0)) {
revert ZeroAddress();
}
INITIAL_DELAY = _initialDelay;
MAX_ADDITIONAL_DELAY = _maxAdditionalDelay;
TIMER_GOVERNANCE = _timerGovernance;
_transferOwnership(_initialOwner);
}
/// @dev Modifier that restricts function access to the `TIMER_GOVERNANCE` address.
/// Reverts with a custom error if the caller is not `TIMER_GOVERNANCE`.
modifier onlyTimerAdmin() {
if (msg.sender != TIMER_GOVERNANCE) {
revert CallerNotTimerAdmin();
}
_;
}
/// @dev Starts the timer by setting the `deadline` and `maxDeadline`. Only callable by the `TIMER_GOVERNANCE`.
///
/// Emits a {TimerStarted} event.
function startTimer() external onlyTimerAdmin {
if (deadline != 0) {
revert TimerAlreadyStarted();
}
deadline = block.timestamp + INITIAL_DELAY;
maxDeadline = deadline + MAX_ADDITIONAL_DELAY;
emit TimerStarted(deadline, maxDeadline);
}
/// @dev Checks if the current `deadline` has passed. Reverts if the deadline has already passed.
///
/// Reverts with {DeadlineNotYetPassed} error if the current block timestamp is less than `deadline`.
function checkDeadline() external view {
if (deadline == 0) {
revert TimerNotStarted();
}
if (block.timestamp < deadline) {
revert DeadlineNotYetPassed();
}
}
/// @dev Allows the owner to change the current `deadline` to a new value.
///
/// The new deadline must be greater than the current deadline and must not exceed `maxDeadline`.
///
/// Emits a {DeadlineChanged} event.
///
/// @param newDeadline The new deadline to be set.
///
/// Reverts with {NewDeadlineNotGreaterThanCurrent} if the new deadline is not greater than the current one.
/// Reverts with {NewDeadlineExceedsMaxDeadline} if the new deadline exceeds `maxDeadline`.
function changeDeadline(uint256 newDeadline) external onlyOwner {
if (newDeadline <= deadline) {
revert NewDeadlineNotGreaterThanCurrent();
}
if (newDeadline > maxDeadline) {
revert NewDeadlineExceedsMaxDeadline();
}
deadline = newDeadline;
emit DeadlineChanged(newDeadline);
}
}
../system-contracts/contracts/Constants.sol
// 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;
/// @notice This file contains pure value constants and enums.
/// Interface-typed constants (e.g. IContractDeployer constant DEPLOYER_SYSTEM_CONTRACT) are in Contracts.sol.
/// @dev All the system contracts introduced by ZKsync have their addresses
/// started from 2^15 in order to avoid collision with Ethereum precompiles.
uint160 constant SYSTEM_CONTRACTS_OFFSET = 0x8000; // 2^15
/// @dev Unlike the value above, it is not overridden for the purpose of testing and
/// is identical to the constant value actually used as the system contracts offset on
/// mainnet.
uint160 constant REAL_SYSTEM_CONTRACTS_OFFSET = 0x8000;
/// @dev All the system contracts must be located in the kernel space,
/// i.e. their addresses must be below 2^16.
uint160 constant MAX_SYSTEM_CONTRACT_ADDRESS = 0xffff; // 2^16 - 1
/// @dev The offset from which the built-in, but user space contracts are located.
uint160 constant USER_CONTRACTS_OFFSET = MAX_SYSTEM_CONTRACT_ADDRESS + 1;
address constant ECRECOVER_SYSTEM_CONTRACT = address(0x01);
address constant SHA256_SYSTEM_CONTRACT = address(0x02);
address constant IDENTITY_SYSTEM_CONTRACT = address(0x04);
address constant MODEXP_SYSTEM_CONTRACT = address(0x05);
address constant ECADD_SYSTEM_CONTRACT = address(0x06);
address constant ECMUL_SYSTEM_CONTRACT = address(0x07);
address constant ECPAIRING_SYSTEM_CONTRACT = address(0x08);
/// @dev The number of gas that need to be spent for a single byte of pubdata regardless of the pubdata price.
/// This variable is used to ensure the following:
/// - That the long-term storage of the operator is compensated properly.
/// - That it is not possible that the pubdata counter grows too high without spending proportional amount of computation.
uint256 constant COMPUTATIONAL_PRICE_FOR_PUBDATA = 80;
/// @dev The maximal possible address of an L1-like precompie. These precompiles maintain the following properties:
/// - Their extcodehash is EMPTY_STRING_KECCAK
/// - Their extcodesize is 0 despite having a bytecode formally deployed there.
uint256 constant CURRENT_MAX_PRECOMPILE_ADDRESS = 0xff;
address payable constant BOOTLOADER_FORMAL_ADDRESS = payable(address(SYSTEM_CONTRACTS_OFFSET + 0x01));
// A contract that is allowed to deploy any codehash
// on any address. To be used only during an upgrade.
address constant FORCE_DEPLOYER = address(SYSTEM_CONTRACTS_OFFSET + 0x07);
address constant MSG_VALUE_SYSTEM_CONTRACT = address(SYSTEM_CONTRACTS_OFFSET + 0x09);
// It will be a different value for tests, while shouldn't. But for now, this constant is not used by other contracts, so that's fine.
address constant EVENT_WRITER_CONTRACT = address(SYSTEM_CONTRACTS_OFFSET + 0x0d);
// Hardcoded because even for tests we should keep the address. (Instead `SYSTEM_CONTRACTS_OFFSET + 0x10`)
// Precompile call depends on it.
// And we don't want to mock this contract.
address constant KECCAK256_SYSTEM_CONTRACT = address(0x8010);
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);
address constant L2_DA_VALIDATOR = address(SYSTEM_CONTRACTS_OFFSET + 0x16);
address constant L2_NATIVE_TOKEN_VAULT_ADDR = address(USER_CONTRACTS_OFFSET + 0x04);
// Note, that on its own this contract does not provide much functionality, but having it on a constant address
// serves as a convenient storage for its bytecode to be accessible via `extcodehash`.
address constant SLOAD_CONTRACT_ADDRESS = address(USER_CONTRACTS_OFFSET + 0x06);
address constant WRAPPED_BASE_TOKEN_IMPL_ADDRESS = address(USER_CONTRACTS_OFFSET + 0x07);
address constant L2_CHAIN_ASSET_HANDLER_ADDRESS = address(USER_CONTRACTS_OFFSET + 0x0a);
address constant L2_UPGRADEABLE_BEACON_DEPLOYER_ADDRESS = address(USER_CONTRACTS_OFFSET + 0x0b);
address constant L2_SYSTEM_CONTRACT_PROXY_ADMIN_ADDRESS = address(USER_CONTRACTS_OFFSET + 0x0c);
address constant L2_INTEROP_CENTER_ADDRESS = address(USER_CONTRACTS_OFFSET + 0x0d);
address constant L2_INTEROP_HANDLER_ADDRESS = address(USER_CONTRACTS_OFFSET + 0x0e);
address constant L2_ASSET_TRACKER_ADDRESS = address(USER_CONTRACTS_OFFSET + 0x0f);
/// @dev If the bitwise AND of the extraAbi[2] param when calling the MSG_VALUE_SIMULATOR
/// is non-zero, the call will be assumed to be a system one.
uint256 constant MSG_VALUE_SIMULATOR_IS_SYSTEM_BIT = 1;
/// @dev The maximal msg.value that context can have
uint256 constant MAX_MSG_VALUE = type(uint128).max;
/// @dev Prefix used during derivation of account addresses using CREATE2
/// @dev keccak256("zksyncCreate2")
bytes32 constant CREATE2_PREFIX = 0x2020dba91b30cc0006188af794c2fb30dd8520db7e2c088b7fc7c103c00ca494;
/// @dev Prefix used during derivation of account addresses using CREATE
/// @dev keccak256("zksyncCreate")
bytes32 constant CREATE_PREFIX = 0x63bae3a9951d38e8a3fbb7b70909afc1200610fc5bc55ade242f815974674f23;
/// @dev Prefix used during derivation of account addresses using CREATE2 within the EVM
bytes1 constant CREATE2_EVM_PREFIX = 0xff;
/// @dev Each state diff consists of 156 bytes of actual data and 116 bytes of unused padding, needed for circuit efficiency.
uint256 constant STATE_DIFF_ENTRY_SIZE = 272;
/// @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;
/// @dev Enum used for system logs emitted by the bootloader.
enum SystemLogKey {
L2_TO_L1_LOGS_TREE_ROOT_KEY,
PACKED_BATCH_AND_L2_BLOCK_TIMESTAMP_KEY,
CHAINED_PRIORITY_TXN_HASH_KEY,
NUMBER_OF_LAYER_1_TXS_KEY,
// Note, that it is important that `PREV_BATCH_HASH_KEY` has position
// `4` since it is the same as it was in the previous protocol version and
// it is the only one that is emitted before the system contracts are upgraded.
PREV_BATCH_HASH_KEY,
L2_DA_VALIDATOR_OUTPUT_HASH_KEY,
USED_L2_DA_VALIDATION_COMMITMENT_SCHEME_KEY,
MESSAGE_ROOT_ROLLING_HASH_KEY,
L2_TXS_STATUS_ROLLING_HASH_KEY,
SETTLEMENT_LAYER_CHAIN_ID_KEY,
EXPECTED_SYSTEM_CONTRACT_UPGRADE_TX_HASH_KEY
}
/// @dev The number of leaves in the L2->L1 log Merkle tree.
/// While formally a tree of any length is acceptable, the node supports only a constant length of 16384 leaves.
uint256 constant L2_TO_L1_LOGS_MERKLE_TREE_LEAVES = 16_384;
uint256 constant L2_TO_L1_LOGS_MERKLE_TREE_DEPTH = 14 + 1;
/// @dev The length of the derived key in bytes inside compressed state diffs.
uint256 constant DERIVED_KEY_LENGTH = 32;
/// @dev The length of the enum index in bytes inside compressed state diffs.
uint256 constant ENUM_INDEX_LENGTH = 8;
/// @dev The length of value in bytes inside compressed state diffs.
uint256 constant VALUE_LENGTH = 32;
/// @dev The length of the compressed initial storage write in bytes.
uint256 constant COMPRESSED_INITIAL_WRITE_SIZE = DERIVED_KEY_LENGTH + VALUE_LENGTH;
/// @dev The length of the compressed repeated storage write in bytes.
uint256 constant COMPRESSED_REPEATED_WRITE_SIZE = ENUM_INDEX_LENGTH + VALUE_LENGTH;
/// @dev The position from which the initial writes start in the compressed state diffs.
uint256 constant INITIAL_WRITE_STARTING_POSITION = 4;
/// @dev Each storage diffs consists of the following elements:
/// [20bytes address][32bytes key][32bytes derived key][8bytes enum index][32bytes initial value][32bytes final value]
/// @dev The offset of the derived key in a storage diff.
uint256 constant STATE_DIFF_DERIVED_KEY_OFFSET = 52;
/// @dev The offset of the enum index in a storage diff.
uint256 constant STATE_DIFF_ENUM_INDEX_OFFSET = 84;
/// @dev The offset of the final value in a storage diff.
uint256 constant STATE_DIFF_FINAL_VALUE_OFFSET = 124;
/// @dev Total number of bytes in a blob. Blob = 4096 field elements * 31 bytes per field element
/// @dev EIP-4844 defines it as 131_072 but we use 4096 * 31 within our circuits to always fit within a field element
/// @dev Our circuits will prove that a EIP-4844 blob and our internal blob are the same.
uint256 constant BLOB_SIZE_BYTES = 126_976;
/// @dev Max number of blobs currently supported
uint256 constant MAX_NUMBER_OF_BLOBS = 6;
/// @dev Marker of EraVM bytecode
uint8 constant ERA_VM_BYTECODE_FLAG = 1;
/// @dev Marker of EVM bytecode
uint8 constant EVM_BYTECODE_FLAG = 2;
address constant SERVICE_CALL_PSEUDO_CALLER = 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF;
/// @dev Pubdata commitment scheme used for DA. This is the commitment *mechanism* — how the committed
/// pubdata is published and hashed. Which *part* of the pubdata is committed (full vs logs-only) is a
/// separate, orthogonal axis: {PubdataContent}.
/// @param NONE Invalid option.
/// @param EMPTY_NO_DA No DA commitment, used by Validiums.
/// @param PUBDATA_KECCAK256 Keccak of stateDiffHash and keccak(pubdata). Can be used by custom DA solutions.
/// @param BLOBS_AND_PUBDATA_KECCAK256 This commitment includes EIP-4844 blobs data. Used by default RollupL1DAValidator.
/// @param BLOBS_ZKSYNC_OS Keccak of blob versioned hashes filled with pubdata. This commitment scheme is used only for ZKsyncOS.
enum L2DACommitmentScheme {
NONE,
EMPTY_NO_DA,
PUBDATA_KECCAK256,
BLOBS_AND_PUBDATA_KECCAK256,
BLOBS_ZKSYNC_OS
}
/// @dev Data availability mode: which part of the pubdata the batch commits to. Orthogonal to
/// {L2DACommitmentScheme} (the mechanism). Carried in diamond storage and committed into the batch
/// public input via the chain config hash, so the settlement layer enforces the chain's configured mode.
/// @param FULL_PUBDATA The whole pubdata (including state diffs, logs, and messages) is committed and must be published.
/// @param LOGS_ONLY Only the mandatory L2->L1 log region (log records, incl. interop-commitment (IMT)
/// leaves) is committed; state diffs and message preimages are published at the operator's discretion.
/// Used by atomic-interop participants to keep their interop (IMT) data reconstructible from L1. ZKsyncOS only.
enum PubdataContent {
FULL_PUBDATA,
LOGS_ONLY
}
/// @dev The metadata version that is supported by the ZK Chains to prove that an L2->L1 log was included in a batch.
uint256 constant SUPPORTED_PROOF_METADATA_VERSION = 1;
/// @dev The server has a hardcoded chainId 270 which is updated to the real value in the L2GenesisUpgradeTxs
/// see link: https://github.com/matter-labs/zksync-era/blob/54dc61c6faff53d314227ffe26961b1abfc999a7/core/node/genesis/src/lib.rs#L182
/// https://github.com/matter-labs/zksync-era/blob/54dc61c6faff53d314227ffe26961b1abfc999a7/core/lib/basic_types/src/lib.rs#L228
uint256 constant HARD_CODED_CHAIN_ID = 270;
contracts/common/Config.sol
// 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;
// solhint-disable no-unused-import
import {
L2DACommitmentScheme,
PubdataContent,
L2_TO_L1_LOG_SERIALIZE_SIZE,
L2_L1_LOGS_TREE_DEFAULT_LEAF_HASH,
L2_TO_L1_LOGS_MERKLE_TREE_DEPTH,
SUPPORTED_PROOF_METADATA_VERSION,
HARD_CODED_CHAIN_ID
} from "system-contracts/contracts/Constants.sol";
// solhint-enable no-unused-import
/// @dev `keccak256("")`
bytes32 constant EMPTY_STRING_KECCAK = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
/// @dev The maximum length of the bytes array with L2 -> L1 logs
uint256 constant MAX_L2_TO_L1_LOGS_COMMITMENT_BYTES = 4 + L2_TO_L1_LOG_SERIALIZE_SIZE * 512;
bytes32 constant DEFAULT_L2_LOGS_TREE_ROOT_HASH = bytes32(0);
/// @dev Denotes the type of the ZKsync Era transaction that came from L1.
uint256 constant PRIORITY_OPERATION_L2_TX_TYPE = 255;
/// @dev Denotes the type of the ZKsync Era transaction that is used for system upgrades.
uint256 constant SYSTEM_UPGRADE_L2_TX_TYPE = 254;
/// @dev Denotes the type of the ZKsync OS transaction that came from L1.
uint256 constant ZKSYNC_OS_PRIORITY_OPERATION_L2_TX_TYPE = 127;
/// @dev Denotes the type of the ZKsync OS transaction that is used for system upgrades.
uint256 constant ZKSYNC_OS_SYSTEM_UPGRADE_L2_TX_TYPE = 126;
/// @dev The maximal allowed difference between protocol minor versions in an upgrade. The 100 gap is needed
/// in case a protocol version has been tested on testnet, but then not launched on mainnet, e.g.
/// due to a bug found.
/// We are allowed to jump at most 100 minor versions at a time. The major version is always expected to be 0.
uint256 constant MAX_ALLOWED_MINOR_VERSION_DELTA = 100;
/// @dev By convention, tokens native to a chain are treated as if an infinite amount was deposited at the
/// chain's inception, so their tracked balances start at this value and decrease as tokens are bridged out.
/// Load-bearing on L1 as well: the removed pre-v32 asset tracker's L1 entry is read as the complement of
/// this value (see {protocol-docs/bridging.md#populating-bridgedout-during-an-in-place-upgrade}).
uint256 constant MAX_TOKEN_BALANCE = type(uint256).max;
/// @dev Maximum time a priority transaction may remain unprocessed before Priority Mode (escape hatch) can be activated.
/// Note: This is not the full user exit window. The effective exit window is`UPGRADE_NOTICE_PERIOD` - `PRIORITY_EXPIRATION`.
uint256 constant PRIORITY_EXPIRATION = 4 days;
// @dev The chainId of Ethereum Mainnet
uint256 constant MAINNET_CHAIN_ID = 1;
// @dev The chainId of Ethereum Sepolia testnet
uint256 constant SEPOLIA_CHAIN_ID = 11155111;
/// @dev Timestamp - seconds since unix epoch. This value will be used on the mainnet.
uint256 constant MAINNET_COMMIT_TIMESTAMP_NOT_OLDER = 3 days;
/// @dev Timestamp - seconds since unix epoch. This value will be used on testnets.
uint256 constant TESTNET_COMMIT_TIMESTAMP_NOT_OLDER = 30 days;
/// @dev Maximum available error between real commit batch timestamp and analog used in the verifier (in seconds)
/// @dev Must be used cause miner's `block.timestamp` value can differ on some small value (as we know - 12 seconds)
uint256 constant COMMIT_TIMESTAMP_APPROXIMATION_DELTA = 1 hours;
/// @dev Shift to apply to verify public input before verifying.
uint256 constant PUBLIC_INPUT_SHIFT = 32;
/// @dev Proof type used by the ZKsync OS PLONK verifier.
uint256 constant ZKSYNC_OS_PLONK_VERIFICATION_TYPE = 2;
/// @dev Proof type used by the proof-skipping ZKsync OS testnet verifier.
uint256 constant ZKSYNC_OS_MOCK_VERIFICATION_TYPE = 3;
/// @dev Number of proof words consumed by ZKsync OS metadata before the underlying PLONK proof.
uint256 constant ZKSYNC_OS_PROOF_METADATA_LENGTH = 2;
/// @dev Number of words expected in a proof-skipping ZKsync OS testnet proof.
uint256 constant ZKSYNC_OS_MOCK_PROOF_LENGTH = 2;
/// @dev Marker expected as the first word in a proof-skipping ZKsync OS testnet proof.
uint256 constant ZKSYNC_OS_MOCK_PROOF_MAGIC = 13;
/// @dev Padding value for empty/unused leaves in an {IndexedMerkleTree}. Deliberately NOT a valid
/// `hashLeaf(IMTLeaf)` output, so an unused padded index can't be presented as a `{0,0,0}` low leaf to forge
/// a non-inclusion proof. The off-chain imt-engine must use the same value.
bytes32 constant IMT_EMPTY_LEAF_HASH = keccak256("zkSync:IndexedMerkleTree:emptyLeaf");
/// @dev The maximum number of L2 gas that a user can request for an L2 transaction
uint256 constant MAX_GAS_PER_TRANSACTION = 80_000_000;
/// @dev Even though the price for 1 byte of pubdata is 16 L1 gas, we have a slightly increased
/// value.
uint256 constant L1_GAS_PER_PUBDATA_BYTE = 17;
/// @dev The intrinsic cost of the L1->l2 transaction in computational L2 gas
uint256 constant L1_TX_INTRINSIC_L2_GAS = 167_157;
/// @dev The intrinsic cost of the L1->l2 transaction in pubdata
uint256 constant L1_TX_INTRINSIC_PUBDATA = 88;
/// @dev The minimal base price for L1 transaction
uint256 constant L1_TX_MIN_L2_GAS_BASE = 173_484;
/// @dev The number of L2 gas the transaction starts costing more with each 544 bytes of encoding
uint256 constant L1_TX_DELTA_544_ENCODING_BYTES = 1656;
/// @dev The number of L2 gas an L1->L2 transaction gains with each new factory dependency
uint256 constant L1_TX_DELTA_FACTORY_DEPS_L2_GAS = 2473;
/// @dev The number of L2 gas an L1->L2 transaction gains with each new factory dependency
uint256 constant L1_TX_DELTA_FACTORY_DEPS_PUBDATA = 64;
/// @dev The number of pubdata an L1->L2 transaction requires with each new factory dependency
uint256 constant MAX_NEW_FACTORY_DEPS = 64;
/// @dev The L2 gasPricePerPubdata required to be used in bridges.
uint256 constant REQUIRED_L2_GAS_PRICE_PER_PUBDATA = 800;
/// @dev Minimum interval between token multiplier updates.
uint256 constant PRICE_UPDATE_INTERVAL = 1 days;
/// @dev Max allowed price increase per update, as a ratio (e.g. 13/10 = 1.3x).
uint256 constant MAX_PRICE_CHANGE_NUMERATOR = 13;
uint256 constant MAX_PRICE_CHANGE_DENOMINATOR = 10;
/// @dev Reference L1 gas price used for price-change bound calculations.
uint256 constant PRICE_REFERENCE_L1_GAS = 1 gwei;
/// @dev The intrinsic cost of the L1->L2 transaction in computational L2 gas for ZKsync OS.
uint256 constant L1_TX_INTRINSIC_L2_GAS_ZKSYNC_OS = 21000;
/// @dev The floor cost(EIP-7623) of non-zero calldata byte for the L1->L2 transaction in computational L2 gas for ZKsync OS.
uint256 constant L1_TX_CALLDATA_FLOOR_PRICE_L2_GAS_ZKSYNC_OS = 40;
/// @dev The maximal computational native limit for transaction in ZKsync OS.
uint256 constant MAX_NATIVE_COMPUTATIONAL_ZKSYNC_OS = 1 << 35;
/// @dev The intrinsic cost of the L1->l2 transaction in pubdata for ZKsync OS
/// It includes tx log, coinbase, treasury, refund recipient and asset tracker pubdata.
uint256 constant L1_TX_INTRINSIC_PUBDATA_ZKSYNC_OS = 351;
/// @dev The native per gas ratio for l1 -> l2 txs, including upgrade/service/gateway transactions in ZKsync OS.
/// This value is big enough to cover computational native resources usage for any operations.
uint256 constant L1_TX_NATIVE_PER_GAS = 100_000_000;
/// @dev The default ZKsync OS single-transaction gas limit (EIP-7825, 2^24). This is both the
/// default per-tx gas cap and the lower bound for any chain-configured value: a chain may raise
/// the cap above Ethereum's limit but must not set it below.
uint64 constant ZKSYNC_OS_DEFAULT_MAX_TX_GAS_LIMIT = uint64(1) << 24;
/// @dev The upper bound for the ZKsync OS single-transaction gas limit (EIP-7825), matching the
/// ZKsync OS block gas limit. It equals `type(uint64).max / 256` (`2^56 - 1`), the maximum gas
/// representable once ZKsync OS scales gas into its `uint64` ergs counter (256 ergs/gas).
uint64 constant ZKSYNC_OS_MAX_BLOCK_GAS_LIMIT = type(uint64).max / 256;
/// @dev The mask which should be applied to the packed batch and L2 block timestamp in order
/// to obtain the L2 block timestamp. Applying this mask is equivalent to calculating modulo 2**128
uint256 constant PACKED_L2_BLOCK_TIMESTAMP_MASK = 0xffffffffffffffffffffffffffffffff;
/// @dev Address of the point evaluation precompile used for EIP-4844 blob verification.
address constant POINT_EVALUATION_PRECOMPILE_ADDR = address(0x0A);
/// @dev The overhead for a transaction slot in L2 gas.
/// It is roughly equal to 80kk/MAX_TRANSACTIONS_IN_BATCH, i.e. how many gas would an L1->L2 transaction
/// need to pay to compensate for the batch being closed.
/// @dev It is expected that the L1 contracts will enforce that the L2 gas price will be high enough to compensate
/// the operator in case the batch is closed because of tx slots filling up.
uint256 constant TX_SLOT_OVERHEAD_L2_GAS = 10000;
/// @dev The overhead for each byte of the bootloader memory that the encoding of the transaction.
/// It is roughly equal to 80kk/BOOTLOADER_MEMORY_FOR_TXS, i.e. how many gas would an L1->L2 transaction
/// need to pay to compensate for the batch being closed.
/// @dev It is expected that the L1 contracts will enforce that the L2 gas price will be high enough to compensate
/// the operator in case the batch is closed because of the memory for transactions being filled up.
uint256 constant MEMORY_OVERHEAD_GAS = 10;
/// @dev The maximum gas limit for a priority transaction in L2.
uint256 constant PRIORITY_TX_MAX_GAS_LIMIT = 72_000_000;
/// @dev the address used to identify eth as the base token for chains.
address constant ETH_TOKEN_ADDRESS = address(1);
/// @dev the value returned in bridgehubDeposit in the TwoBridges function.
bytes32 constant TWO_BRIDGES_MAGIC_VALUE = bytes32(uint256(keccak256("TWO_BRIDGES_MAGIC_VALUE")) - 1);
/// @dev https://eips.ethereum.org/EIPS/eip-1352
address constant BRIDGEHUB_MIN_SECOND_BRIDGE_ADDRESS = address(uint160(type(uint16).max));
/// @dev the maximum number of supported chains, this is an arbitrary limit.
/// @dev Note, that in case of a malicious Bridgehub admin, the total number of chains
/// can be up to 2 times higher. This may be possible, in case the old ChainTypeManager
/// had `100` chains and these were migrated to the Bridgehub only after `MAX_NUMBER_OF_ZK_CHAINS`
/// were added to the bridgehub via creation of new chains.
uint256 constant MAX_NUMBER_OF_ZK_CHAINS = 100;
/// @dev Used as the `msg.sender` for transactions that relayed via a settlement layer.
address constant SETTLEMENT_LAYER_RELAY_SENDER = address(uint160(0x1111111111111111111111111111111111111111));
/// @dev The virtual address of the L1 settlement layer.
address constant L1_SETTLEMENT_LAYER_VIRTUAL_ADDRESS = address(
uint160(uint256(keccak256("L1_SETTLEMENT_LAYER_VIRTUAL_ADDRESS")) - 1)
);
struct PriorityTreeCommitment {
uint256 nextLeafIndex;
uint256 startIndex;
uint256 unprocessedIndex;
bytes32[] sides;
}
// Info that allows to restore a chain.
struct ZKChainCommitment {
/// @notice Total number of executed batches i.e. batches[totalBatchesExecuted] points at the latest executed batch
/// (batch 0 is genesis)
uint256 totalBatchesExecuted;
/// @notice Total number of proved batches i.e. batches[totalBatchesProved] points at the latest proved batch
uint256 totalBatchesVerified;
/// @notice Total number of committed batches i.e. batches[totalBatchesCommitted] points at the latest committed
/// batch
uint256 totalBatchesCommitted;
/// @notice The hash of the L2 system contracts ugpgrade transaction.
/// @dev It is non zero if the migration happens while the upgrade is not yet finalized.
bytes32 l2SystemContractsUpgradeTxHash;
/// @notice The batch when the system contracts upgrade transaction was executed.
/// @dev It is non-zero if the migration happens while the batch where the upgrade tx was present
/// has not been finalized (executed) yet.
uint256 l2SystemContractsUpgradeBatchNumber;
/// @notice The hashes of the batches that are needed to keep the blockchain working.
/// @dev The length of the array is equal to the `totalBatchesCommitted - totalBatchesExecuted + 1`, i.e. we need
/// to store all the unexecuted batches' hashes + 1 latest executed one.
bytes32[] batchHashes;
/// @notice Commitment to the priority merkle tree.
PriorityTreeCommitment priorityTree;
/// @notice Whether a chain is a permanent rollup.
bool isPermanentRollup;
/// @notice The precommitment to the transactions of the latest batch.
bytes32 precommitmentForTheLatestBatch;
}
/// @dev Used as the `msg.sender` for system service transactions.
address constant SERVICE_TRANSACTION_SENDER = address(uint160(0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF));
/// @dev To avoid higher costs the writes, we avoid making the slot zero.
/// This ensures that the cost of writes is always 5k and avoids the 20k initial write from the non-zero value.
bytes32 constant DEFAULT_PRECOMMITMENT_FOR_THE_LAST_BATCH = bytes32(uint256(1));
/// @dev The length of a packed transaction precommitment in bytes. It consists of two parts: 32-byte tx hash and 1-byte status (0 or 1).
uint256 constant PACKED_L2_PRECOMMITMENT_LENGTH = 33;
/// @dev The L2 data availability commitment scheme that permanent rollups are expected to use.
L2DACommitmentScheme constant ROLLUP_L2_DA_COMMITMENT_SCHEME = L2DACommitmentScheme.BLOBS_AND_PUBDATA_KECCAK256;
/// @dev The start of the pause deposits time window. We pause when migrating to/from gateway.
/// @dev It is set to 0 in this release, since stage1 is not yet supported for chains that settle on top of ZK Gateway.
uint256 constant PAUSE_DEPOSITS_TIME_WINDOW_START_MAINNET = 0;
/// @dev The delay from `pausedDepositsTimestamp` from which the migration is allowed. It equals the PAUSE_DEPOSITS_TIME_WINDOW_START.
/// @dev It is set to 0 in this release, since stage1 is not yet supported for chains that settle on top of ZK Gateway.
uint256 constant CHAIN_MIGRATION_TIME_WINDOW_START_MAINNET = 0;
uint256 constant PAUSE_DEPOSITS_TIME_WINDOW_START_TESTNET = 0;
uint256 constant CHAIN_MIGRATION_TIME_WINDOW_START_TESTNET = 0;
/// @dev Default overhead value in L1 gas for each batch during chain creation.
uint32 constant DEFAULT_BATCH_OVERHEAD_L1_GAS = 1_000_000;
/// @dev Default maximum amount of pubdata per batch during chain creation.
uint32 constant DEFAULT_MAX_PUBDATA_PER_BATCH = 120_000;
/// @dev Default maximum amount of L2 gas per batch during chain creation.
uint32 constant DEFAULT_MAX_L2_GAS_PER_BATCH = 80_000_000;
/// @dev Default maximum amount of pubdata for priority transactions during chain creation.
uint32 constant DEFAULT_PRIORITY_TX_MAX_PUBDATA = 99_000;
/// @dev Default minimum L2 gas price (in wei) for L1->L2 transactions during chain creation.
uint64 constant DEFAULT_MINIMAL_L2_GAS_PRICE = 250_000_000;
/// @notice The struct that describes whether users will be charged for pubdata for L1->L2 transactions.
/// @param Rollup The users are charged for pubdata & it is priced based on the gas price on Ethereum.
/// @param Validium The pubdata is considered free with regard to the L1 gas price.
enum PubdataPricingMode {
Rollup,
Validium
}
/// @dev Default pubdata pricing mode during chain creation.
PubdataPricingMode constant DEFAULT_PUBDATA_PRICING_MODE = PubdataPricingMode.Rollup;
/// @dev Default maximum gas limit for priority transactions during chain creation.
uint64 constant DEFAULT_PRIORITY_TX_MAX_GAS_LIMIT = 72_000_000;
/// @dev The initial balance of the BaseTokenHolder contract (2^127 - 1).
/// @dev Used to derive the real circulating supply: circulatingSupply = INITIAL - TotalSupplyBeforeMigration
uint256 constant INITIAL_BASE_TOKEN_HOLDER_BALANCE = (2 ** 127) - 1;
/// @dev The total number of supported interop attributes.
uint256 constant SUPPORTED_INTEROP_ATTRIBUTES = 7;
/// @dev Whether chain migrations between settlement layers are enabled in the current release.
/// @dev Release-level switch (disabled in v32): lifting the ban requires a protocol upgrade, unlike
/// the runtime `migrationPaused` flag. See {protocol-docs/chain-lifecycle.md#v32-chain-migrations-are-explicitly-disabled}.
bool constant CHAIN_MIGRATIONS_ENABLED = false;
/// @dev Migration number used when a chain migrates from L1 to a settlement layer.
uint256 constant MIGRATION_NUMBER_L1_TO_SETTLEMENT_LAYER = 1;
/// @dev Migration number used when a chain returns from a settlement layer back to L1.
uint256 constant MIGRATION_NUMBER_SETTLEMENT_LAYER_TO_L1 = 2;
/// @dev Iterated migrations are not supported; chain can migrate only to settlement layer and back once.
uint256 constant MAX_ALLOWED_NUMBER_OF_MIGRATIONS = 2;
/// @dev The mask that should be applied to the packed log data containing both the number of L2 and L1 transactions
/// processed in the batch. Applying this mask is equivalent to calculating modulo 2**128.
uint256 constant PACKED_NUMBER_OF_L1_TRANSACTIONS_LOG_MASK = 0xffffffffffffffffffffffffffffffff;
/// @dev Bit offset for extracting the upper 128 bits (L2 tx count) from the packed log value.
uint256 constant PACKED_NUMBER_OF_L2_TRANSACTIONS_LOG_SPLIT_BITS = 128;
contracts/common/L1ContractErrors.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.21;
import {L2DACommitmentScheme} from "./Config.sol";
// 0x5ecf2d7a
error AccessToFallbackDenied(address target, address invoker);
// 0x3995f750
error AccessToFunctionDenied(address target, bytes4 selector, address invoker);
// 0x0dfb42bf
error AddressAlreadySet(address addr);
// 0x86bb51b8
error AddressHasNoCode(address);
// 0x1f73225f
error AddressMismatch(address expected, address supplied);
// 0x42573d7a
error AddressNotZero();
// 0xb577eb6c
error AlreadyDangerousContract(address);
// 0x2a5989a0
error AlreadyPermanentRollup();
// 0x0bfcef28
error AlreadyWhitelisted(address);
// 0x5e85ae73
error AmountMustBeGreaterThanZero();
// 0x76fc80ad
error AssetDeploymentTrackerNotSet(bytes32 assetId);
// 0xfde974f4
error AssetHandlerDoesNotExist(bytes32 assetId);
// 0x64107968
error AssetHandlerNotRegistered(bytes32 assetId);
// 0xfe919e28
error AssetIdAlreadyRegistered();
// 0x1294e9e1
error AssetIdMismatch(bytes32 expected, bytes32 supplied);
// 0xda72d995
error AssetIdNotRegistered(bytes32 assetId);
// 0x04a0b7e9
error AssetIdNotSupported(bytes32 assetId);
// 0x9b821ed7
error BadTransferDataLength();
// 0x6ef9a972
error BaseTokenGasPriceDenominatorNotSet();
// 0x764c57db
error BaseTokenHolderAlreadyInitialized();
// 0xd3cd4bd2
error BaseTokenHolderMintFailed();
// 0x8361ff70
error BaseTokenNativeToThisChain();
// 0x00a6b592
error BaseTokenPreV31TotalSupplyNotSet();
// 0xe3ec2bc9
error BaseTokenTransferFailed();
// 0x55ad3fd3
error BatchHashMismatch(bytes32 expected, bytes32 actual);
// 0xbd4455ff
error BatchNumberMismatch(uint256 expectedBatchNumber, uint256 providedBatchNumber);
// 0x41c329f7
error BatchTimestampGreaterThanLastL2BlockTimestamp();
// 0x6cf12312
error BridgeHubAlreadyRegistered();
// 0xdb538614
error BridgeMintNotImplemented();
// 0xaa5f6180
error BurningNativeWETHNotSupported();
// 0x25d8333c
error CallerNotTimerAdmin();
// 0x3331e9c0
error CallNotAllowed(bytes call);
// 0xe85392f9
error CanOnlyProcessOneBatch();
// 0x00c6ead2
error CantExecuteUnprovenBatches();
// 0xe18cb383
error CantRevertExecutedBatch();
// 0x78d2ed02
error ChainAlreadyLive();
// 0xd054a77e
error ChainBalanceMustBeZeroBeforeMigration(uint256 chainId, bytes32 assetId, uint256 chainBalance);
// 0x24591d89
error ChainIdAlreadyExists();
// 0x717a1656
error ChainIdCantBeCurrentChain();
// 0x6b617b38
error ChainIdIsHardcoded();
// 0xa179f8c9
error ChainIdMismatch();
// 0x23f3c357
error ChainIdNotRegistered(uint256 chainId);
// 0x8f620a06
error ChainIdTooBig();
// 0x41888953
error ChainMigrationsDisabled();
// 0x5e361ef9
error ChainRequiresValidatorsSignaturesForCommit();
// 0x8746f42f
error ConstructorsNotSupported();
// 0xec273439
error CTMAlreadyRegistered();
// 0xc630ef3c
error CTMNotRegistered();
// 0x13df796c
error CutDataForProtocolVersionNotAvailable(uint256 oldProtocolVersion);
// 0x907f8e51
error DeadlineNotYetPassed();
// 0xf2885eb3
error DefaultAdminTransferNotAllowed();
// 0xf7a01e4d
error DelegateCallFailed(bytes returnData);
// 0x0a8ed92c
error DenominatorIsZero();
// 0xb4f54111
error DeployFailed();
// 0x138ee1a3
error DeployingBridgedTokenForNativeToken();
// 0x42bce528
error DepositDoesNotExist(bytes32, bytes32);
// 0xad2fa98e
error DepositExists();
// 0x0e7ee319
error DiamondAlreadyFrozen();
// 0xa7151b9a
error DiamondNotFrozen();
// 0x7138356f
error EmptyAddress();
// 0x2d4d012f
error EmptyAssetId();
// 0x1c25715b
error EmptyBytes32();
// 0x99d8fec9
error EmptyData();
// 0x84286507
error EmptyPrecommitData(uint256 batchNumber);
// 0x456f8f7a
error EmptyProofLength();
// 0x05410cbc
error EmptyPublicInputsLength();
// 0x876e8b23
error EraBytecodeAlreadyPublished(bytes32 bytecodeHash);
// 0x61733a89
error EVMBytecodeAlreadyPublished(bytes32 bytecodeHash);
// 0xac4a3f98
error FacetExists(bytes4 selector, address);
// 0x3fce21be
error FeeParamsChangeTooLarge(uint256 oldPrice, uint256 newPrice, uint256 maxAllowedPrice);
// 0xc91cf3b1
error GasPerPubdataMismatch();
// 0x5ca97564
error GenesisBatchCommitmentIncorrect();
// 0x6d4a7df8
error GenesisBatchCommitmentZero();
// 0x7940c83f
error GenesisBatchHashZero();
// 0xb4fc6835
error GenesisIndexStorageZero();
// 0x3a1a8589
error GenesisUpgradeZero();
// 0xd356e6ba
error HashedLogIsDefault();
// 0x0b08d5be
error HashMismatch(bytes32 expected, bytes32 actual);
// 0xf11438d9
error IMTAlreadyInitialized();
// 0x62f8ffe2
error IMTLeafValueMismatch(uint256 expectedValue, uint256 actualValue);
// 0x037dc2ed
error IMTLowLeafIndexOutOfBounds(uint256 lowLeafIndex, uint256 leafCount);
// 0xd87e0e66
error IMTLowLeafNextTooSmall(uint256 lowNextValue, uint256 newValue);
// 0x74470b8f
error IMTLowLeafValueTooLarge(uint256 lowValue, uint256 newValue);
// 0xae48798a
error IMTNotInitialized();
// 0x68051076
error IMTValueAlreadyExists(uint256 value);
// 0xbd1de53d
error IMTValueZero();
// 0xd7d93e1f
error IncorrectBatchBounds(
uint256 processFromExpected,
uint256 processToExpected,
uint256 processFromProvided,
uint256 processToProvided
);
// 0xc1b4bc7b
error IncorrectBatchChainId(uint256, uint256);
// 0xdd381a4c
error IncorrectBridgeHubAddress(address bridgehub);
// 0x07859b3b
error InsufficientChainBalance(uint256 chainId, bytes32 assetId, uint256 amount);
// 0x03eb8b54
error InsufficientFunds(uint256 required, uint256 actual);
// 0xd70c44f6
error InteropSenderChainIdMismatch(uint256 senderChainId, uint256 payloadSourceChainId);
// 0x9bf8b9aa
error InvalidBatchNumber(uint256 provided, uint256 expected);
// 0xd438e1fa
error InvalidBlockRange(uint64 batchNumber, uint64 from, uint64 to);
// 0xcbd9d2e0
error InvalidCaller(address);
// 0x7a47c9a2
error InvalidChainId();
// 0x92daded2
error InvalidDAForPermanentRollup();
// 0xd95d4d82
error PubdataContentLockedForPermanentRollup();
// 0x3731bfa2
error NonFullPubdataContentForPermanentRollup();
// 0x4fbe5dba
error InvalidDelay();
// 0x3f98a77e
error InvalidL2DACommitmentScheme(L2DACommitmentScheme);
// 0xc1780bd6
error InvalidLogSender(address sender, uint256 logKey);
// 0xa1ec1876
error InvalidMessageRoot(bytes32 expectedMessageRoot, bytes32 providedMessageRoot);
// 0xd08a97e6
error InvalidMockProofLength();
// 0xde4c0b96
error InvalidNTVBurnData();
// 0xd8e9405c
error InvalidNumberOfBlobs(uint256 expected, uint256 numCommitments, uint256 numHashes);
// 0x99f6cc22
error InvalidPackedPrecommitmentLength(uint256 length);
// 0x09bde339
error InvalidProof();
// 0x48c5fa28
error InvalidProofLengthForFinalNode();
// 0x5428eae7
error InvalidProtocolVersion();
// 0x6f1cf752
error InvalidPubdataPricingMode();
// 0x12ba286f
error InvalidSelector(bytes4 func);
// 0xbe7193d4
error InvalidSystemLogsLength();
// 0x7b7a98f1
error InvalidThreshold(uint256 max, uint256 got);
// 0xd857fbc0
error InvalidTxCountInPriorityMode(uint256 l2TxCount, uint256 l1TxCount);
// 0x5f1aa154
error InvalidUpgradeTxn(UpgradeTxVerifyParam);
// 0xfb5c22e6
error L2TimestampTooBig();
// 0xe37d2c02
error LengthIsNotDivisibleBy32(uint256 length);
// 0x1b6825bb
error LogAlreadyProcessed(uint8);
// 0xe4623697
error LowerBoundAlreadyRecorded();
// 0x5c25a57b
error LowerBoundNotRecorded();
// 0x43e266b0
error MalformedBytecode(BytecodeError);
// 0xafbb7a4e
error MerkleIndexOrHeightMismatch();
// 0x9bb54c35
error MerkleIndexOutOfBounds();
// 0xc33e6128
error MerkleNothingToProve();
// 0x8e23ac1a
error MerklePathEmpty();
// 0x09aa9830
error MerklePathLengthMismatch(uint256 pathLength, uint256 expectedLength);
// 0x1c500385
error MerklePathOutOfBounds();
// 0x1b582fcf
error MerkleWrongIndex(uint256 index, uint256 maxNodeNumber);
// 0x485cfcaa
error MerkleWrongLength(uint256 newLeavesLength, uint256 leafNumber);
// 0x3312a450
error MigrationPaused();
// 0x4e98b356
error MigrationsNotPaused();
// 0x7e472272
error MissingBaseTokenAssetId();
// 0xfa44b527
error MissingSystemLogs(uint256 expected, uint256 actual);
// 0x1508fb47
error MockVerifierNotSupported();
// 0x4a094431
error MsgValueMismatch(uint256 expectedMsgValue, uint256 providedMsgValue);
// 0xb385a3da
error MsgValueTooLow(uint256 required, uint256 provided);
// 0xedd74330
error MustBeEraChain();
// 0x8b7e144a
error NewDeadlineExceedsMaxDeadline();
// 0x6eef58d1
error NewDeadlineNotGreaterThanCurrent();
// 0x79cc2d22
error NoCallsProvided();
// 0xce63ce17
error NoCTMForAssetId(bytes32 assetId);
// 0xa6fef710
error NoFunctionsForDiamondCut();
// 0xcab098d8
error NoFundsTransferred();
// 0xc4dc2673
error NonCanonicalRepresentation();
// 0xc21b1ab7
error NonEmptyCalldata();
// 0x536ec84b
error NonEmptyMsgValue();
// 0xd018e08e
error NonIncreasingTimestamp();
// 0x0105f9c0
error NonSequentialBatch();
// 0x0ac76f01
error NonSequentialVersion();
// 0x0e0ff4d9
error NonZeroBlobToVerifyZKsyncOS(uint256 index, bytes32 blobLinearHash, bytes32 blobOpeningCommitment);
// 0x31967fc6
error NonZeroCarriedHash();
// 0xfa5cd00f
error NotAllowed(address addr);
// 0x64846fe4
error NotARestriction(address addr);
// 0xf306a770
error NotAssetRouter(address sender, address assetRouter);
// 0xb49df1f2
error NotAZKChain(address addr);
// 0x7fdf8632
error NotCompatibleWithPriorityMode();
// 0x5e67e793
error NotCurrentSettlementLayer();
// 0x2b1dc354
error NotDangerousContract(address);
// 0x230f9d11
error NotEnoughSigners(uint256 provided, uint256 expected);
// 0xdd7e3621
error NotInitializedReentrancyGuard();
// 0xecb34449
error NotL1(uint256 l1ChainId, uint256 blockChainId);
// 0xc5441a63
error NotL2ToL2(uint256 sourceChainId, uint256 destinationChainId);
// 0xdf17e316
error NotWhitelisted(address);
// 0x9d7bb13f
error OnlyNormalMode();
// 0xd702c443
error OnlyPriorityMode();
// 0x6c167909
error OnlySelfAllowed();
// 0x1a21feed
error OperationExists();
// 0xeda2fbb1
error OperationMustBePending();
// 0xe1c1ff37
error OperationMustBeReady();
// 0xb926450e
error OriginChainIdNotFound();
// 0x97da9c1c
error PayloadTooShort();
// 0x688c63e5
error PrecommitmentMismatch(uint256 batchNumber, bytes32 expected, bytes32 found);
// 0x9b48e060
error PreviousOperationNotExecuted();
// 0x67c198fe
error PriorityModeActivationTooEarly(uint256 earliestActivationTimestamp, uint256 currentTimestamp);
// 0xdbfcbbef
error PriorityModeIsNotAllowed();
// 0x2b9d9c4c
error PriorityModeRequiresPermanentRollup();
// 0xd5a99014
error PriorityOperationsRollingHashMismatch();
// 0xbeda0935
error PriorityOpsRequestTimestampMissing(uint256 requestId);
// 0xa840274f
error PriorityQueueNotReady();
// 0x1a4d284a
error PriorityTxPubdataExceedsMaxPubDataPerBatch();
// 0xa461f651
error ProtocolIdMismatch(uint256 expectedProtocolVersion, uint256 providedProtocolId);
// 0x64f94ec2
error ProtocolIdNotGreater();
// 0x959f26fb
error PubdataGreaterThanLimit(uint256 limit, uint256 length);
// 0x63c36549
error QueueIsEmpty();
// 0x881fba9f
error RecoverToL1NotSupported();
// 0xab143c06
error Reentrancy();
// 0x667d17de
error RemoveFunctionFacetAddressNotZero(address facet);
// 0xa2d4b16c
error RemoveFunctionFacetAddressZero();
// 0xf6fd7071
error RemovingPermanentRestriction();
// 0x3580370c
error ReplaceFunctionFacetAddressZero();
// 0xf126e113
error RestrictionWasAlreadyPresent(address restriction);
// 0x52e22c98
error RestrictionWasNotPresent(address restriction);
// 0x9a67c1cb
error RevertedBatchNotAfterNewLastBatch();
// 0xfe0aa4f2
error RoleAccessDenied(address chainAddress, bytes32 role, address account);
// 0xd3b6535b
error SelectorsMustAllHaveSameFreezability();
// 0x02181a13
error SettlementLayersMustSettleOnL1();
// 0x856d5b77
error SharedBridgeNotSet();
// 0xabdc734e
error SignatureNotValid(address signer);
// 0xa665a34d
error SignaturesLengthMismatch(uint256 expected, uint256 actual);
// 0x3b94fe24
error SignerNotAuthorized(address signer);
// 0xa7781cbb
error SignersNotSorted();
// 0xdf3a8fdd
error SlotOccupied();
// 0xcc0f168b
error SystemContractProxyInitialized();
// 0xae43b424
error SystemLogsSizeTooBig();
// 0x08753982
error TimeNotReached(uint256 expectedTimestamp, uint256 actualTimestamp);
// 0x7a4902ad
error TimerAlreadyStarted();
// 0xf511412f
error TimerNotStarted();
// 0x2d50c33b
error TimestampError();
// 0xb1e96bbd
error TokenMultiplierChangeTooFrequent(uint256 nextAllowedTimestamp);
// 0x1850b46b
error TokenNotLegacy();
// 0x06439c6b
error TokenNotSupported(address token);
// 0x23830e28
error TokensWithFeesNotSupported();
// 0x8e3ce3cb
error TooHighDeploymentNonce();
// 0x76da24b9
error TooManyFactoryDeps();
// 0xf0b4e88f
error TooMuchGas();
// 0x00c5a6a9
error TransactionNotAllowed();
// 0x4c991078
error TxHashMismatch();
// 0x2e311df8
error TxnBodyGasLimitNotEnoughGas();
// 0xfcb9b2e1
error UnallowedImplementation(bytes32 implementationHash);
// 0x8e4a23d6
error Unauthorized(address caller);
// 0xe52478c7
error UndefinedDiamondCutAction();
// 0x6aa39880
error UnexpectedSystemLog(uint256 logKey);
// 0x8124d8ff
error UnexpectedUpgradeSelector();
// 0xc352bb73
error UnknownVerifierType();
// 0xf3dd1b9c
error UnsupportedCommitBatchEncoding(uint8 version);
// 0x084a1449
error UnsupportedEncodingVersion();
// 0x14d2ed8a
error UnsupportedExecuteBatchEncoding(uint8 version);
// 0xf338f830
error UnsupportedProofBatchEncoding(uint8 version);
// 0x1906f346
error UnsupportedUpgradeType();
// 0xf093c2e5
error UpgradeBatchNumberIsNotZero();
// 0x04d91f9d
error UpgradeTimestampNotReached(uint256 upgradeTimestamp, uint256 currentTimestamp);
// 0x47b3b145
error ValidateTxnNotEnoughGas();
// 0x626ade30
error ValueMismatch(uint256 expected, uint256 actual);
// 0xe1022469
error VerifiedBatchesExceedsCommittedBatches();
// 0x750b219c
error WithdrawFailed();
// 0xf20c5c2a
error WrappedBaseTokenAlreadyRegistered();
// 0xf1ff6cf6
error WrongCTMDeployerVariant();
// 0x15e8e429
error WrongMagicValue(uint256 expectedMagicValue, uint256 providedMagicValue);
// 0xd92e233d
error ZeroAddress();
// 0xc84885d4
error ZeroChainId();
// 0x16787758
error ZeroUpgradeTimestamp();
// 0x601b6882
error ZKChainLimitReached();
// 0xb2cabab5
error ZKsyncOSChainConfigUpdateWithUnverifiedBatches(uint256 batchesVerified, uint256 batchesCommitted);
// 0x1df14b10
error ZKsyncOSMaxTxGasLimitTooHigh();
// 0x7e34baaf
error ZKsyncOSMaxTxGasLimitTooLow();
// 0x646ac57e
error ZKsyncOSNotForceDeployForExistingContract(address);
// 0xb24b1ccb
error ZKsyncOSNotForceDeployToPrecompileAddress(address);
// 0x3d9d4821
error ZKsyncOSPrecommitsNotSupported();
enum SharedBridgeKey {
PostUpgradeFirstBatch,
LegacyBridgeFirstBatch,
LegacyBridgeLastDepositBatch,
LegacyBridgeLastDepositTxn
}
enum BytecodeError {
Version,
NumberOfWords,
Length,
WordsMustBeOdd
}
enum UpgradeTxVerifyParam {
From,
To,
Paymaster,
Value,
MaxFeePerGas,
MaxPriorityFeePerGas,
Reserved0,
Reserved1,
Reserved2,
Reserved3,
Signature,
PaymasterInput,
ReservedDynamic
}
lib/openzeppelin-contracts-v4/contracts/access/Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
lib/openzeppelin-contracts-v4/contracts/access/Ownable2Step.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)
pragma solidity ^0.8.0;
import "./Ownable.sol";
/**
* @dev Contract module which provides access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership} and {acceptOwnership}.
*
* This module is used through inheritance. It will make available all functions
* from parent (Ownable).
*/
abstract contract Ownable2Step is Ownable {
address private _pendingOwner;
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
/**
* @dev Returns the address of the pending owner.
*/
function pendingOwner() public view virtual returns (address) {
return _pendingOwner;
}
/**
* @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual override onlyOwner {
_pendingOwner = newOwner;
emit OwnershipTransferStarted(owner(), newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual override {
delete _pendingOwner;
super._transferOwnership(newOwner);
}
/**
* @dev The new owner accepts the ownership transfer.
*/
function acceptOwnership() public virtual {
address sender = _msgSender();
require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
_transferOwnership(sender);
}
}
lib/openzeppelin-contracts-v4/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
Compiler settingsShow
{
"viaIR": false,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"libraries": {},
"optimizer": {
"runs": 9999999,
"enabled": true
},
"evmVersion": "prague",
"remappings": [
"@ensdomains/=node_modules/@ensdomains/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"eth-gas-reporter/=node_modules/eth-gas-reporter/",
"forge-std/=lib/forge-std/src/",
"hardhat/=node_modules/hardhat/",
"murky/=lib/murky/src/",
"foundry-test/=test/foundry/",
"l2-contracts/=../l2-contracts/contracts/",
"system-contracts/=../system-contracts/",
"@openzeppelin/contracts-v4/=lib/openzeppelin-contracts-v4/contracts/",
"@openzeppelin/contracts-upgradeable-v4/=lib/openzeppelin-contracts-upgradeable-v4/contracts/",
"test-utils/=test/foundry/l1/integration/utils/",
"lib/murky/lib/openzeppelin-contracts/:erc4626-tests/=lib/murky/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/murky/lib/openzeppelin-contracts/:erc4626-tests/=lib/murky/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/openzeppelin-contracts-upgradeable-v4/:erc4626-tests/=lib/openzeppelin-contracts-upgradeable-v4/lib/erc4626-tests/",
"lib/openzeppelin-contracts-upgradeable-v4/:erc4626-tests/=lib/openzeppelin-contracts-upgradeable-v4/lib/erc4626-tests/",
"lib/openzeppelin-contracts-v4/:erc4626-tests/=lib/openzeppelin-contracts-v4/lib/erc4626-tests/",
"lib/openzeppelin-contracts-v4/:erc4626-tests/=lib/openzeppelin-contracts-v4/lib/erc4626-tests/",
"erc4626-tests/=lib/openzeppelin-contracts-upgradeable-v4/lib/erc4626-tests/",
"openzeppelin-contracts-upgradeable-v4/=lib/openzeppelin-contracts-upgradeable-v4/",
"openzeppelin-contracts-v4/=lib/openzeppelin-contracts-v4/",
"openzeppelin-contracts/=lib/murky/lib/openzeppelin-contracts/",
"openzeppelin/=lib/openzeppelin-contracts-upgradeable-v4/contracts/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.