matter-labs / zksync

zkSync: trustless scaling and privacy engine for Ethereum
https://zksync.io
Apache License 2.0
4.86k stars 2.69k forks source link

It could activate exodusMode maliciously even though the layer 2 is still working? #607

Closed berryjam closed 3 months ago

berryjam commented 3 months ago

The exodusMode was activated by the function activateExodusMode,but the function could be called to froze the contract maliciously. Because the trigger condition will be true when the system just has only layer2 transactions during last priority requests expiration time.Please confirm whether this is a fatal bug. ` /// @notice Checks if Exodus mode must be entered. If true - enters exodus mode and emits ExodusMode event. /// @dev Exodus mode must be entered in case of current ethereum block number is higher than the oldest /// @dev of existed priority requests expiration block number. /// @return bool flag that is true if the Exodus mode must be entered. function activateExodusMode() external returns (bool) { if (exodusMode) { return false; }

    // User could frozen the contract if the layer2 just has
    bool trigger = block.number >= priorityRequests[firstPriorityRequestId].expirationBlock &&
        priorityRequests[firstPriorityRequestId].expirationBlock != 0;

    if (trigger) {
        exodusMode = true;
        emit ExodusMode();
    }
    return trigger;
}

`