Skip to content

Commit d3335ea

Browse files
StanislavBreadlesszksync[bot]
andauthored
Remove unneeded pausing logic (#2040)
# What ❔ This is a sister PR to: matter-labs/zksync-era#4674 1. Since stage1 is not supported for chains on top of GW, there is no need to wait before l1->l2 ops can be paused (as there is always the transaction filterer approach). 2. We do not automatically re-enable deposits in 1.5 days since GW is expected to return a confirmation message. l1->l2 ops are unpaused only via the confirmation message (or chain admin but only if no withdrawal happened) There is a known issue preventing stage1: - Chain admin may pause deposits, but not actually try to migrate. - So in the future we will need to reintroduce CHAIN_MIGRATION_TIME_WINDOW_END_MAINNET/PAUSE_DEPOSITS_TIME_WINDOW_END_MAINNET, but we will have to carefully consider the used timelines to ensure that stage1 works. - This not an issue in this release, since we dont support stage1 for chains on GW ## Why ❔ <!-- Why are these changes done? What goal do they contribute to? What are the principles behind them? --> <!-- Example: PR templates ensure PR reviewers, observers, and future iterators are in context about the evolution of repos. --> ## Checklist <!-- Check your PR fulfills the following items. --> <!-- For draft PRs check the boxes as you complete them. --> - [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. --------- Co-authored-by: zksync[bot] <zksync[bot]@users.noreply.github.com>
1 parent 8da2634 commit d3335ea

File tree

17 files changed

+553
-451
lines changed

17 files changed

+553
-451
lines changed

AllContractsHashes.json

Lines changed: 360 additions & 360 deletions
Large diffs are not rendered by default.

l1-contracts/contracts/common/Config.sol

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -214,24 +214,16 @@ uint256 constant PACKED_L2_PRECOMMITMENT_LENGTH = 33;
214214
L2DACommitmentScheme constant ROLLUP_L2_DA_COMMITMENT_SCHEME = L2DACommitmentScheme.BLOBS_AND_PUBDATA_KECCAK256;
215215

216216
/// @dev The start of the pause deposits time window. We pause when migrating to/from gateway.
217-
uint256 constant PAUSE_DEPOSITS_TIME_WINDOW_START_MAINNET = 3 days + 12 hours;
217+
/// @dev It is set to 0 in this release, since stage1 is not yet supported for chains that settle on top of ZK Gateway.
218+
uint256 constant PAUSE_DEPOSITS_TIME_WINDOW_START_MAINNET = 0;
218219

219-
/// @dev The start of the chain migration window, it equals the PAUSE_DEPOSITS_TIME_WINDOW_START.
220-
uint256 constant CHAIN_MIGRATION_TIME_WINDOW_START_MAINNET = 3 days + 12 hours;
220+
/// @dev The delay from `pausedDepositsTimestamp` from which the migration is allowed. It equals the PAUSE_DEPOSITS_TIME_WINDOW_START.
221+
/// @dev It is set to 0 in this release, since stage1 is not yet supported for chains that settle on top of ZK Gateway.
222+
uint256 constant CHAIN_MIGRATION_TIME_WINDOW_START_MAINNET = 0;
221223

222-
/// @dev The end of the chain migration window.
223-
uint256 constant CHAIN_MIGRATION_TIME_WINDOW_END_MAINNET = 4 days + 12 hours;
224+
uint256 constant PAUSE_DEPOSITS_TIME_WINDOW_START_TESTNET = 0;
224225

225-
/// @dev The end of the pause deposits time window. We pause when migrating to/from gateway.
226-
uint256 constant PAUSE_DEPOSITS_TIME_WINDOW_END_MAINNET = 7 days;
227-
228-
uint256 constant PAUSE_DEPOSITS_TIME_WINDOW_START_TESTNET = 1;
229-
230-
uint256 constant CHAIN_MIGRATION_TIME_WINDOW_START_TESTNET = 1;
231-
232-
uint256 constant CHAIN_MIGRATION_TIME_WINDOW_END_TESTNET = 1 days;
233-
234-
uint256 constant PAUSE_DEPOSITS_TIME_WINDOW_END_TESTNET = 2 days;
226+
uint256 constant CHAIN_MIGRATION_TIME_WINDOW_START_TESTNET = 0;
235227

236228
/// @dev Default overhead value in L1 gas for each batch during chain creation.
237229
uint32 constant DEFAULT_BATCH_OVERHEAD_L1_GAS = 1_000_000;

l1-contracts/contracts/state-transition/chain-deps/facets/Mailbox.sol

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {UncheckedMath} from "../../../common/libraries/UncheckedMath.sol";
1717
import {L2ContractHelper} from "../../../common/l2-helpers/L2ContractHelper.sol";
1818
import {AddressAliasHelper} from "../../../vendor/AddressAliasHelper.sol";
1919
import {ZKChainBase} from "./ZKChainBase.sol";
20-
import {MAX_NEW_FACTORY_DEPS, REQUIRED_L2_GAS_PRICE_PER_PUBDATA, SERVICE_TRANSACTION_SENDER, SETTLEMENT_LAYER_RELAY_SENDER, PAUSE_DEPOSITS_TIME_WINDOW_START_TESTNET, PAUSE_DEPOSITS_TIME_WINDOW_END_TESTNET, PAUSE_DEPOSITS_TIME_WINDOW_START_MAINNET, PAUSE_DEPOSITS_TIME_WINDOW_END_MAINNET} from "../../../common/Config.sol";
20+
import {MAX_NEW_FACTORY_DEPS, REQUIRED_L2_GAS_PRICE_PER_PUBDATA, SERVICE_TRANSACTION_SENDER, SETTLEMENT_LAYER_RELAY_SENDER, PAUSE_DEPOSITS_TIME_WINDOW_START_TESTNET, PAUSE_DEPOSITS_TIME_WINDOW_START_MAINNET} from "../../../common/Config.sol";
2121
import {L2_INTEROP_CENTER_ADDR} from "../../../common/l2-helpers/L2ContractAddresses.sol";
2222

2323
import {AddressNotZero, GasPerPubdataMismatch, InvalidChainId, MsgValueTooLow, TooManyFactoryDeps, TransactionNotAllowed, ZeroAddress} from "../../../common/L1ContractErrors.sol";
@@ -55,8 +55,6 @@ contract MailboxFacet is ZKChainBase, IMailboxImpl, MessageVerification {
5555

5656
uint256 internal immutable PAUSE_DEPOSITS_TIME_WINDOW_START;
5757

58-
uint256 internal immutable PAUSE_DEPOSITS_TIME_WINDOW_END;
59-
6058
modifier onlyL1() {
6159
if (block.chainid != L1_CHAIN_ID) {
6260
revert NotL1(block.chainid);
@@ -84,9 +82,6 @@ contract MailboxFacet is ZKChainBase, IMailboxImpl, MessageVerification {
8482
PAUSE_DEPOSITS_TIME_WINDOW_START = _isTestnet
8583
? PAUSE_DEPOSITS_TIME_WINDOW_START_TESTNET
8684
: PAUSE_DEPOSITS_TIME_WINDOW_START_MAINNET;
87-
PAUSE_DEPOSITS_TIME_WINDOW_END = _isTestnet
88-
? PAUSE_DEPOSITS_TIME_WINDOW_END_TESTNET
89-
: PAUSE_DEPOSITS_TIME_WINDOW_END_MAINNET;
9085
}
9186

9287
/// @inheritdoc IMailboxImpl
@@ -547,7 +542,7 @@ contract MailboxFacet is ZKChainBase, IMailboxImpl, MessageVerification {
547542
/// @notice Deposits are paused when a chain migrates to/from GW.
548543
function depositsPaused() public view returns (bool) {
549544
return
550-
_isInDepositsPausedWindow(PAUSE_DEPOSITS_TIME_WINDOW_START, PAUSE_DEPOSITS_TIME_WINDOW_END) ||
545+
_isInDepositsPausedWindow(PAUSE_DEPOSITS_TIME_WINDOW_START) ||
551546
(block.chainid == L1_CHAIN_ID &&
552547
IL1ChainAssetHandler(CHAIN_ASSET_HANDLER).isMigrationInProgress(s.chainId));
553548
}

l1-contracts/contracts/state-transition/chain-deps/facets/Migrator.sol

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
pragma solidity 0.8.28;
44

55
import {IMigrator} from "../../chain-interfaces/IMigrator.sol";
6-
import {L1_SETTLEMENT_LAYER_VIRTUAL_ADDRESS, L2DACommitmentScheme, ZKChainCommitment, CHAIN_MIGRATION_TIME_WINDOW_START_TESTNET, CHAIN_MIGRATION_TIME_WINDOW_START_MAINNET, CHAIN_MIGRATION_TIME_WINDOW_END_TESTNET, CHAIN_MIGRATION_TIME_WINDOW_END_MAINNET, PAUSE_DEPOSITS_TIME_WINDOW_START_TESTNET, PAUSE_DEPOSITS_TIME_WINDOW_START_MAINNET, PAUSE_DEPOSITS_TIME_WINDOW_END_TESTNET, PAUSE_DEPOSITS_TIME_WINDOW_END_MAINNET} from "../../../common/Config.sol";
6+
import {L1_SETTLEMENT_LAYER_VIRTUAL_ADDRESS, L2DACommitmentScheme, ZKChainCommitment, CHAIN_MIGRATION_TIME_WINDOW_START_TESTNET, CHAIN_MIGRATION_TIME_WINDOW_START_MAINNET, PAUSE_DEPOSITS_TIME_WINDOW_START_TESTNET, PAUSE_DEPOSITS_TIME_WINDOW_START_MAINNET} from "../../../common/Config.sol";
77
import {PriorityTree} from "../../../state-transition/libraries/PriorityTree.sol";
88
import {PriorityQueue} from "../../../state-transition/libraries/PriorityQueue.sol";
99
import {IZKChain} from "../../../state-transition/chain-interfaces/IZKChain.sol";
@@ -38,30 +38,18 @@ contract MigratorFacet is ZKChainBase, IMigrator {
3838
/// @notice The timestamp when chain migration becomes available.
3939
uint256 internal immutable CHAIN_MIGRATION_TIME_WINDOW_START;
4040

41-
/// @notice The timestamp when chain migration is no longer available.
42-
uint256 internal immutable CHAIN_MIGRATION_TIME_WINDOW_END;
43-
4441
/// @notice The timestamp when deposits start being paused.
4542
uint256 internal immutable PAUSE_DEPOSITS_TIME_WINDOW_START;
4643

47-
/// @notice The timestamp when deposits stop being paused.
48-
uint256 internal immutable PAUSE_DEPOSITS_TIME_WINDOW_END;
49-
5044
constructor(uint256 _l1ChainId, bool _isTestnet) {
5145
L1_CHAIN_ID = _l1ChainId;
5246

5347
CHAIN_MIGRATION_TIME_WINDOW_START = _isTestnet
5448
? CHAIN_MIGRATION_TIME_WINDOW_START_TESTNET
5549
: CHAIN_MIGRATION_TIME_WINDOW_START_MAINNET;
56-
CHAIN_MIGRATION_TIME_WINDOW_END = _isTestnet
57-
? CHAIN_MIGRATION_TIME_WINDOW_END_TESTNET
58-
: CHAIN_MIGRATION_TIME_WINDOW_END_MAINNET;
5950
PAUSE_DEPOSITS_TIME_WINDOW_START = _isTestnet
6051
? PAUSE_DEPOSITS_TIME_WINDOW_START_TESTNET
6152
: PAUSE_DEPOSITS_TIME_WINDOW_START_MAINNET;
62-
PAUSE_DEPOSITS_TIME_WINDOW_END = _isTestnet
63-
? PAUSE_DEPOSITS_TIME_WINDOW_END_TESTNET
64-
: PAUSE_DEPOSITS_TIME_WINDOW_END_MAINNET;
6553
}
6654

6755
modifier onlyL1() {
@@ -87,7 +75,7 @@ contract MigratorFacet is ZKChainBase, IMigrator {
8775
if (s.priorityModeInfo.canBeActivated) {
8876
revert NotCompatibleWithPriorityMode();
8977
}
90-
require(s.pausedDepositsTimestamp + PAUSE_DEPOSITS_TIME_WINDOW_END < block.timestamp, DepositsAlreadyPaused());
78+
require(s.pausedDepositsTimestamp == 0, DepositsAlreadyPaused());
9179
uint256 timestamp;
9280
// Note, if the chain is new (total number of priority transactions is 0) we allow admin to pause the deposits with immediate effect.
9381
// This is in place to allow for faster migration for newly spawned chains.
@@ -109,11 +97,7 @@ contract MigratorFacet is ZKChainBase, IMigrator {
10997

11098
/// @inheritdoc IMigrator
11199
function unpauseDeposits() external onlyAdmin onlyL1 {
112-
require(
113-
s.pausedDepositsTimestamp != 0 &&
114-
s.pausedDepositsTimestamp + PAUSE_DEPOSITS_TIME_WINDOW_START <= block.timestamp,
115-
DepositsNotPaused()
116-
);
100+
require(s.pausedDepositsTimestamp != 0, DepositsNotPaused());
117101
require(
118102
!IL1ChainAssetHandler(IL1Bridgehub(s.bridgehub).chainAssetHandler()).isMigrationInProgress(s.chainId),
119103
MigrationInProgress()
@@ -154,8 +138,7 @@ contract MigratorFacet is ZKChainBase, IMigrator {
154138

155139
uint256 timestamp = s.pausedDepositsTimestamp;
156140
require(
157-
timestamp + CHAIN_MIGRATION_TIME_WINDOW_START < block.timestamp &&
158-
block.timestamp < timestamp + CHAIN_MIGRATION_TIME_WINDOW_END,
141+
timestamp != 0 && timestamp + CHAIN_MIGRATION_TIME_WINDOW_START <= block.timestamp,
159142
DepositsNotPaused()
160143
);
161144

l1-contracts/contracts/state-transition/chain-deps/facets/ZKChainBase.sol

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,11 @@ contract ZKChainBase is ReentrancyGuard {
181181
return s.zksyncOS ? ZKSYNC_OS_SYSTEM_UPGRADE_L2_TX_TYPE : SYSTEM_UPGRADE_L2_TX_TYPE;
182182
}
183183

184-
/// @notice Returns whether deposits are currently in the paused window.
184+
/// @notice Returns whether deposits are currently paused.
185185
/// @param _windowStart The delay from `pausedDepositsTimestamp` until deposits become paused.
186-
/// @param _windowEnd The duration from `pausedDepositsTimestamp` after which deposits are no longer paused.
187-
/// @dev We provide 3.5 days window to process all deposits.
188-
/// @dev After that, the deposits are not being processed for 3.5 days.
189-
function _isInDepositsPausedWindow(uint256 _windowStart, uint256 _windowEnd) internal view returns (bool) {
186+
function _isInDepositsPausedWindow(uint256 _windowStart) internal view returns (bool) {
190187
uint256 timestamp = s.pausedDepositsTimestamp;
191-
return timestamp + _windowStart <= block.timestamp && block.timestamp < timestamp + _windowEnd;
188+
return timestamp != 0 && timestamp + _windowStart <= block.timestamp;
192189
}
193190

194191
/// @dev Checks that the batch hash is correct and matches the expected hash.

l1-contracts/deploy-scripts/ctm/RegisterZKChain.s.sol

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import {Call} from "contracts/governance/Common.sol";
4141
import {ETH_TOKEN_ADDRESS} from "contracts/common/Config.sol";
4242
import {Create2AndTransfer} from "../utils/deploy/Create2AndTransfer.sol";
4343
import {ZkChainAddresses, StateTransitionDeployedAddresses, CTMDeployedAddresses, CoreDeployedAddresses} from "../utils/Types.sol";
44-
import {PAUSE_DEPOSITS_TIME_WINDOW_END_MAINNET} from "contracts/common/Config.sol";
4544
import {IRegisterZKChain, RegisterZKChainConfig} from "contracts/script-interfaces/IRegisterZKChain.sol";
4645
import {GetDiamondCutData} from "../utils/GetDiamondCutData.sol";
4746

@@ -89,8 +88,8 @@ contract RegisterZKChainScript is Script, IRegisterZKChain {
8988
function runForTest(address _chainTypeManagerProxy, uint256 _chainChainId) public {
9089
console.log("Deploying ZKChain");
9190

92-
// Timestamp needs to be late enough for `pauseDepositsBeforeInitiatingMigration` time checks
93-
vm.warp(PAUSE_DEPOSITS_TIME_WINDOW_END_MAINNET + 1);
91+
// Avoid block.timestamp == 0 to keep paused-deposits sentinel semantics stable in tests.
92+
vm.warp(1);
9493

9594
initializeConfigTest(_chainTypeManagerProxy, _chainChainId);
9695
runInner(vm.envString("ZK_CHAIN_OUT"));

l1-contracts/test/foundry/l1/integration/deploy-scripts/script-config/config-gateway-vote-preparation.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ force_deployments_data = "0x00"
22
gateway_chain_id = 506
33
gateway_settlement_fee = 0
44
is_zk_sync_os = true
5-
owner_address = "0xD2BEa76AF8312f0335C8C27703BAfF5aC7Ec8088"
5+
owner_address = "0x17F713771BC1Da940258ebB56A5D6184372BA681"
66
refund_recipient = "0x000000000000000000000000000000000000bEEF"
77
support_l2_legacy_shared_bridge_test = false
88
testnet_verifier = true

l1-contracts/test/foundry/l1/integration/l2-tests-abstract/_SharedL2ContractDeployer.sol

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {BeaconProxy} from "@openzeppelin/contracts-v4/proxy/beacon/BeaconProxy.s
1717

1818
import {IL2NativeTokenVault} from "../../../../../contracts/bridge/ntv/IL2NativeTokenVault.sol";
1919
import {L2_ASSET_ROUTER_ADDR, L2_ASSET_ROUTER, L2_BASE_TOKEN_SYSTEM_CONTRACT, L2_BASE_TOKEN_SYSTEM_CONTRACT_ADDR, L2_BRIDGEHUB_ADDR, L2_CHAIN_ASSET_HANDLER_ADDR, L2_TO_L1_MESSENGER_SYSTEM_CONTRACT_ADDR, L2_INTEROP_CENTER_ADDR, L2_INTEROP_HANDLER_ADDR, L2_TO_L1_MESSENGER_SYSTEM_CONTRACT, L2_NATIVE_TOKEN_VAULT_ADDR, L2_SYSTEM_CONTEXT_SYSTEM_CONTRACT} from "contracts/common/l2-helpers/L2ContractInterfaces.sol";
20-
import {PAUSE_DEPOSITS_TIME_WINDOW_END_MAINNET} from "contracts/common/Config.sol";
2120
import {ETH_TOKEN_ADDRESS} from "contracts/common/Config.sol";
2221

2322
import {AddressAliasHelper} from "contracts/vendor/AddressAliasHelper.sol";
@@ -98,8 +97,8 @@ abstract contract SharedL2ContractDeployer is UtilsCallMockerTest, DeployIntegra
9897
}
9998

10099
function setUpInner(bool _skip) public virtual {
101-
// Timestamp needs to be big enough for `pauseDepositsBeforeInitiatingMigration` time checks
102-
vm.warp(PAUSE_DEPOSITS_TIME_WINDOW_END_MAINNET + 1);
100+
// Avoid block.timestamp == 0 to keep paused-deposits sentinel semantics stable in tests.
101+
vm.warp(1);
103102

104103
if (_skip) {
105104
vm.startBroadcast();

l1-contracts/test/foundry/l1/integration/upgrade-envs/script-out/local-core.toml

Lines changed: 150 additions & 0 deletions
Large diffs are not rendered by default.

l1-contracts/test/foundry/l1/unit/concrete/state-transition/ChainTypeManager/ZKsyncOSChainTypeManager.t.sol

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import {ZeroAddress, GenesisBatchHashZero, GenesisBatchCommitmentIncorrect, Gene
2727
import {ICTMDeploymentTracker} from "contracts/core/ctm-deployment/ICTMDeploymentTracker.sol";
2828
import {IMessageRootBase} from "contracts/core/message-root/IMessageRoot.sol";
2929
import {L1MessageRoot} from "contracts/core/message-root/L1MessageRoot.sol";
30-
import {PAUSE_DEPOSITS_TIME_WINDOW_END_MAINNET} from "contracts/common/Config.sol";
3130

3231
import {L1AssetRouter} from "contracts/bridge/asset-router/L1AssetRouter.sol";
3332
import {RollupDAManager} from "contracts/state-transition/data-availability/RollupDAManager.sol";
@@ -72,8 +71,8 @@ contract ZKsyncOSChainTypeManagerTest is UtilsCallMockerTest {
7271
Diamond.FacetCut[] internal facetCuts;
7372

7473
function setUp() public {
75-
// Timestamp needs to be late enough for `pauseDepositsBeforeInitiatingMigration` time checks
76-
vm.warp(PAUSE_DEPOSITS_TIME_WINDOW_END_MAINNET + 1);
74+
// Avoid block.timestamp == 0 to keep paused-deposits sentinel semantics stable in tests.
75+
vm.warp(1);
7776

7877
interopCenterAddress = makeAddr("interopCenter");
7978
governor = makeAddr("governor");

0 commit comments

Comments
 (0)