-
Notifications
You must be signed in to change notification settings - Fork 158
Expand file tree
/
Copy pathBOLDUpgradeAction.sol
More file actions
580 lines (509 loc) · 23 KB
/
BOLDUpgradeAction.sol
File metadata and controls
580 lines (509 loc) · 23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/utils/Create2Upgradeable.sol";
import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
import "./RollupProxy.sol";
import "./RollupLib.sol";
struct Node {
// Hash of the state of the chain as of this node
bytes32 stateHash;
// Hash of the data that can be challenged
bytes32 challengeHash;
// Hash of the data that will be committed if this node is confirmed
bytes32 confirmData;
// Index of the node previous to this one
uint64 prevNum;
// Deadline at which this node can be confirmed
uint64 deadlineBlock;
// Deadline at which a child of this node can be confirmed
uint64 noChildConfirmedBeforeBlock;
// Number of stakers staked on this node. This includes real stakers and zombies
uint64 stakerCount;
// Number of stakers staked on a child node. This includes real stakers and zombies
uint64 childStakerCount;
// This value starts at zero and is set to a value when the first child is created. After that it is constant until the node is destroyed or the owner destroys pending nodes
uint64 firstChildBlock;
// The number of the latest child of this node to be created
uint64 latestChildNumber;
// The block number when this node was created
uint64 createdAtBlock;
// A hash of all the data needed to determine this node's validity, to protect against reorgs
bytes32 nodeHash;
}
struct OldStaker {
uint256 amountStaked;
uint64 index;
uint64 latestStakedNode;
// currentChallenge is 0 if staker is not in a challenge
uint64 currentChallenge; // 1. cannot have current challenge
bool isStaked; // 2. must be staked
}
interface IOldRollup {
struct Assertion {
ExecutionState beforeState;
ExecutionState afterState;
uint64 numBlocks;
}
event NodeCreated(
uint64 indexed nodeNum,
bytes32 indexed parentNodeHash,
bytes32 indexed nodeHash,
bytes32 executionHash,
Assertion assertion,
bytes32 afterInboxBatchAcc,
bytes32 wasmModuleRoot,
uint256 inboxMaxCount
);
function paused() external view returns (bool);
function isZombie(
address staker
) external view returns (bool);
function withdrawStakerFunds() external returns (uint256);
function wasmModuleRoot() external view returns (bytes32);
function latestConfirmed() external view returns (uint64);
function getNode(
uint64 nodeNum
) external view returns (Node memory);
function getStakerAddress(
uint64 stakerNum
) external view returns (address);
function stakerCount() external view returns (uint64);
function getStaker(
address staker
) external view returns (OldStaker memory);
function isValidator(
address validator
) external view returns (bool);
function validatorWalletCreator() external view returns (address);
function anyTrustFastConfirmer() external view returns (address);
}
interface IOldRollupAdmin {
function forceRefundStaker(
address[] memory stacker
) external;
function pause() external;
function resume() external;
}
interface ISeqInboxPostUpgradeInit {
function postUpgradeInit(
BufferConfig memory bufferConfig_
) external;
}
/// @title Provides pre-images to a state hash
/// @notice We need to use the execution state of the latest confirmed node as the genesis
/// in the new rollup. However the this full state is not available on chain, only
/// the state hash is, which commits to this. This lookup contract should be deployed
/// before the upgrade, and just before the upgrade is executed the pre-image of the
/// latest confirmed state hash should be populated here. The upgrade contact can then
/// fetch this information and verify it before using it.
contract StateHashPreImageLookup {
using GlobalStateLib for GlobalState;
event HashSet(bytes32 h, ExecutionState executionState, uint256 inboxMaxCount);
mapping(bytes32 => bytes) internal preImages;
function stateHash(
ExecutionState calldata executionState,
uint256 inboxMaxCount
) public pure returns (bytes32) {
return keccak256(
abi.encodePacked(
executionState.globalState.hash(), inboxMaxCount, executionState.machineStatus
)
);
}
function set(bytes32 h, ExecutionState calldata executionState, uint256 inboxMaxCount) public {
require(h == stateHash(executionState, inboxMaxCount), "Invalid hash");
preImages[h] = abi.encode(executionState, inboxMaxCount);
emit HashSet(h, executionState, inboxMaxCount);
}
function get(
bytes32 h
) public view returns (ExecutionState memory executionState, uint256 inboxMaxCount) {
(executionState, inboxMaxCount) = abi.decode(preImages[h], (ExecutionState, uint256));
require(inboxMaxCount != 0, "Hash not yet set");
}
}
/// @notice Stores an array specified during construction.
/// Since the BOLDUpgradeAction is not allowed to have storage,
/// we use this contract so it can keep an immutable pointer to an array.
contract ConstantArrayStorage {
uint256[] internal _array;
constructor(
uint256[] memory __array
) {
_array = __array;
}
function array() public view returns (uint256[] memory) {
return _array;
}
}
/// @title Upgrades an Arbitrum rollup to the new challenge protocol
/// @notice Requires implementation contracts to be pre-deployed and provided in the constructor
/// Also requires a lookup contract to be provided that contains the pre-image of the state hash
/// that is in the latest confirmed assertion in the current rollup.
/// The old rollup should be on v1.1.0 or later to allow stake withdrawals after the upgrade
contract BOLDUpgradeAction {
using AssertionStateLib for AssertionState;
uint256 public immutable BLOCK_LEAF_SIZE;
uint256 public immutable BIGSTEP_LEAF_SIZE;
uint256 public immutable SMALLSTEP_LEAF_SIZE;
uint8 public immutable NUM_BIGSTEP_LEVEL;
address public immutable EXCESS_STAKE_RECEIVER;
IOldRollup public immutable OLD_ROLLUP;
address public immutable BRIDGE;
address public immutable SEQ_INBOX;
address public immutable REI;
address public immutable OUTBOX;
address public immutable INBOX;
uint64 public immutable CONFIRM_PERIOD_BLOCKS;
uint64 public immutable CHALLENGE_PERIOD_BLOCKS;
address public immutable STAKE_TOKEN;
uint256 public immutable STAKE_AMOUNT;
uint256 public immutable CHAIN_ID;
uint256 public immutable MINIMUM_ASSERTION_PERIOD;
uint64 public immutable VALIDATOR_AFK_BLOCKS;
bool public immutable DISABLE_VALIDATOR_WHITELIST;
uint64 public immutable CHALLENGE_GRACE_PERIOD_BLOCKS;
address public immutable MINI_STAKE_AMOUNTS_STORAGE;
bool public immutable IS_DELAY_BUFFERABLE;
uint256 public constant SECONDS_PER_SLOT = 12;
// buffer config
uint64 public immutable MAX;
uint64 public immutable THRESHOLD;
uint64 public immutable REPLENISH_RATE_IN_BASIS;
IOneStepProofEntry public immutable OSP;
// proxy admins of the contracts to be upgraded
ProxyAdmin public immutable PROXY_ADMIN_OUTBOX;
ProxyAdmin public immutable PROXY_ADMIN_BRIDGE;
ProxyAdmin public immutable PROXY_ADMIN_REI;
ProxyAdmin public immutable PROXY_ADMIN_SEQUENCER_INBOX;
ProxyAdmin public immutable PROXY_ADMIN_INBOX;
StateHashPreImageLookup public immutable PREIMAGE_LOOKUP;
// new contract implementations
address public immutable IMPL_BRIDGE;
address public immutable IMPL_SEQUENCER_INBOX;
address public immutable IMPL_INBOX;
address public immutable IMPL_REI;
address public immutable IMPL_OUTBOX;
address public immutable IMPL_NEW_ROLLUP_USER;
address public immutable IMPL_NEW_ROLLUP_ADMIN;
address public immutable IMPL_CHALLENGE_MANAGER;
event RollupMigrated(address rollup, address challengeManager);
struct Settings {
uint64 confirmPeriodBlocks;
uint64 challengePeriodBlocks;
address stakeToken;
uint256 stakeAmt;
uint256[] miniStakeAmounts;
uint256 chainId;
uint256 minimumAssertionPeriod;
uint64 validatorAfkBlocks;
bool disableValidatorWhitelist;
uint256 blockLeafSize;
uint256 bigStepLeafSize;
uint256 smallStepLeafSize;
uint8 numBigStepLevel;
uint64 challengeGracePeriodBlocks;
bool isDelayBufferable;
BufferConfig bufferConfig;
}
// Unfortunately these are not discoverable on-chain, so we need to supply them
struct ProxyAdmins {
address outbox;
address bridge;
address rei;
address seqInbox;
address inbox;
}
struct Implementations {
address bridge;
address seqInbox;
address inbox;
address rei;
address outbox;
address newRollupUser;
address newRollupAdmin;
address challengeManager;
}
struct Contracts {
address excessStakeReceiver;
IOldRollup rollup;
address bridge;
address sequencerInbox;
address rollupEventInbox;
address outbox;
address inbox;
IOneStepProofEntry osp;
}
constructor(
Contracts memory contracts,
ProxyAdmins memory proxyAdmins,
Implementations memory implementations,
Settings memory settings
) {
EXCESS_STAKE_RECEIVER = contracts.excessStakeReceiver;
OLD_ROLLUP = contracts.rollup;
BRIDGE = contracts.bridge;
SEQ_INBOX = contracts.sequencerInbox;
REI = contracts.rollupEventInbox;
OUTBOX = contracts.outbox;
INBOX = contracts.inbox;
OSP = contracts.osp;
PROXY_ADMIN_OUTBOX = ProxyAdmin(proxyAdmins.outbox);
PROXY_ADMIN_BRIDGE = ProxyAdmin(proxyAdmins.bridge);
PROXY_ADMIN_REI = ProxyAdmin(proxyAdmins.rei);
PROXY_ADMIN_SEQUENCER_INBOX = ProxyAdmin(proxyAdmins.seqInbox);
PROXY_ADMIN_INBOX = ProxyAdmin(proxyAdmins.inbox);
PREIMAGE_LOOKUP = new StateHashPreImageLookup();
IMPL_BRIDGE = implementations.bridge;
IMPL_SEQUENCER_INBOX = implementations.seqInbox;
IMPL_INBOX = implementations.inbox;
IMPL_REI = implementations.rei;
IMPL_OUTBOX = implementations.outbox;
IMPL_NEW_ROLLUP_USER = implementations.newRollupUser;
IMPL_NEW_ROLLUP_ADMIN = implementations.newRollupAdmin;
IMPL_CHALLENGE_MANAGER = implementations.challengeManager;
CHAIN_ID = settings.chainId;
MINIMUM_ASSERTION_PERIOD = settings.minimumAssertionPeriod;
VALIDATOR_AFK_BLOCKS = settings.validatorAfkBlocks;
CONFIRM_PERIOD_BLOCKS = settings.confirmPeriodBlocks;
CHALLENGE_PERIOD_BLOCKS = settings.challengePeriodBlocks;
STAKE_TOKEN = settings.stakeToken;
STAKE_AMOUNT = settings.stakeAmt;
MINI_STAKE_AMOUNTS_STORAGE = address(new ConstantArrayStorage(settings.miniStakeAmounts));
DISABLE_VALIDATOR_WHITELIST = settings.disableValidatorWhitelist;
BLOCK_LEAF_SIZE = settings.blockLeafSize;
BIGSTEP_LEAF_SIZE = settings.bigStepLeafSize;
SMALLSTEP_LEAF_SIZE = settings.smallStepLeafSize;
NUM_BIGSTEP_LEVEL = settings.numBigStepLevel;
CHALLENGE_GRACE_PERIOD_BLOCKS = settings.challengeGracePeriodBlocks;
IS_DELAY_BUFFERABLE = settings.isDelayBufferable;
MAX = settings.bufferConfig.max;
THRESHOLD = settings.bufferConfig.threshold;
REPLENISH_RATE_IN_BASIS = settings.bufferConfig.replenishRateInBasis;
}
/// @dev Refund the existing stakers, pause and upgrade the current rollup to
/// allow them to withdraw after pausing
function cleanupOldRollup() private {
IOldRollupAdmin(address(OLD_ROLLUP)).pause();
uint64 stakerCount = OLD_ROLLUP.stakerCount();
// since we for-loop these stakers we set an arbitrary limit - we dont
// expect any instances to have close to this number of stakers
if (stakerCount > 50) {
stakerCount = 50;
}
for (uint64 i = 0; i < stakerCount;) {
address stakerAddr = OLD_ROLLUP.getStakerAddress(i);
OldStaker memory staker = OLD_ROLLUP.getStaker(stakerAddr);
if (staker.isStaked && staker.currentChallenge == 0) {
address[] memory stakersToRefund = new address[](1);
stakersToRefund[0] = stakerAddr;
IOldRollupAdmin(address(OLD_ROLLUP)).forceRefundStaker(stakersToRefund);
stakerCount -= 1;
} else {
i++;
}
}
}
/// @dev Create a config for the new rollup - fetches the latest confirmed
/// assertion from the old rollup and uses it as genesis
function createConfig() private view returns (Config memory) {
// fetch the assertion associated with the latest confirmed state
bytes32 latestConfirmedStateHash =
OLD_ROLLUP.getNode(OLD_ROLLUP.latestConfirmed()).stateHash;
(ExecutionState memory genesisExecState, uint256 inboxMaxCount) =
PREIMAGE_LOOKUP.get(latestConfirmedStateHash);
// Convert ExecutionState into AssertionState with endHistoryRoot 0
AssertionState memory genesisAssertionState;
genesisAssertionState.globalState = genesisExecState.globalState;
genesisAssertionState.machineStatus = genesisExecState.machineStatus;
// double check the hash
require(
PREIMAGE_LOOKUP.stateHash(genesisAssertionState.toExecutionState(), inboxMaxCount)
== latestConfirmedStateHash,
"Invalid latest execution hash"
);
// this isnt used during rollup creation, so we can pass in empty
ISequencerInbox.MaxTimeVariation memory maxTimeVariation;
BufferConfig memory bufferConfig;
return Config({
confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS,
stakeToken: STAKE_TOKEN,
baseStake: STAKE_AMOUNT,
wasmModuleRoot: OLD_ROLLUP.wasmModuleRoot(),
owner: address(this), // upgrade executor is the owner
loserStakeEscrow: EXCESS_STAKE_RECEIVER, // additional funds get sent to the l1 timelock
chainId: CHAIN_ID,
chainConfig: "", // we can use an empty chain config it wont be used in the rollup initialization because we check if the rei is already connected there
minimumAssertionPeriod: MINIMUM_ASSERTION_PERIOD,
validatorAfkBlocks: VALIDATOR_AFK_BLOCKS,
miniStakeValues: ConstantArrayStorage(MINI_STAKE_AMOUNTS_STORAGE).array(),
sequencerInboxMaxTimeVariation: maxTimeVariation,
layerZeroBlockEdgeHeight: BLOCK_LEAF_SIZE,
layerZeroBigStepEdgeHeight: BIGSTEP_LEAF_SIZE,
layerZeroSmallStepEdgeHeight: SMALLSTEP_LEAF_SIZE,
genesisAssertionState: genesisAssertionState,
genesisInboxCount: inboxMaxCount,
anyTrustFastConfirmer: address(0), // fast confirmer would be migrated from the old rollup if existed
numBigStepLevel: NUM_BIGSTEP_LEVEL,
challengeGracePeriodBlocks: CHALLENGE_GRACE_PERIOD_BLOCKS,
bufferConfig: bufferConfig,
dataCostEstimate: 0
});
}
function upgradeSurroundingContracts(
address newRollupAddress
) private {
// upgrade each of these contracts to an implementation that allows
// the rollup address to be set to the new rollup address
TransparentUpgradeableProxy bridge = TransparentUpgradeableProxy(payable(BRIDGE));
PROXY_ADMIN_BRIDGE.upgrade(bridge, IMPL_BRIDGE);
IBridge(BRIDGE).updateRollupAddress(IOwnable(newRollupAddress));
upgradeSequencerInbox();
TransparentUpgradeableProxy inbox = TransparentUpgradeableProxy(payable(INBOX));
PROXY_ADMIN_INBOX.upgrade(inbox, IMPL_INBOX);
TransparentUpgradeableProxy rollupEventInbox = TransparentUpgradeableProxy(payable(REI));
PROXY_ADMIN_REI.upgrade(rollupEventInbox, IMPL_REI);
IRollupEventInbox(REI).updateRollupAddress();
TransparentUpgradeableProxy outbox = TransparentUpgradeableProxy(payable(OUTBOX));
PROXY_ADMIN_OUTBOX.upgrade(outbox, IMPL_OUTBOX);
IOutbox(OUTBOX).updateRollupAddress();
}
function upgradeSequencerInbox() private {
TransparentUpgradeableProxy sequencerInbox = TransparentUpgradeableProxy(payable(SEQ_INBOX));
if (IS_DELAY_BUFFERABLE) {
PROXY_ADMIN_SEQUENCER_INBOX.upgradeAndCall(
sequencerInbox,
IMPL_SEQUENCER_INBOX,
abi.encodeCall(
ISeqInboxPostUpgradeInit.postUpgradeInit,
(
BufferConfig({
max: MAX,
threshold: THRESHOLD,
replenishRateInBasis: REPLENISH_RATE_IN_BASIS
})
)
)
);
} else {
PROXY_ADMIN_SEQUENCER_INBOX.upgrade(sequencerInbox, IMPL_SEQUENCER_INBOX);
}
(uint256 delayBlocks, uint256 futureBlocks, uint256 delaySeconds, uint256 futureSeconds) =
ISequencerInbox(SEQ_INBOX).maxTimeVariation();
// Force inclusion now depends on block numbers and not timestamps.
// To ensure the force inclusion window is unchanged, we need to
// update the delayBlocks if delaySeconds implies a larger delay.
uint256 implDelayBlocks = delaySeconds % SECONDS_PER_SLOT == 0
? delaySeconds / SECONDS_PER_SLOT
: delaySeconds / SECONDS_PER_SLOT + 1;
delayBlocks = implDelayBlocks > delayBlocks ? implDelayBlocks : delayBlocks;
ISequencerInbox(SEQ_INBOX).setMaxTimeVariation(
ISequencerInbox.MaxTimeVariation({
delayBlocks: delayBlocks,
delaySeconds: delaySeconds,
futureBlocks: futureBlocks,
futureSeconds: futureSeconds
})
);
ISequencerInbox(SEQ_INBOX).updateRollupAddress();
}
function expectedRollupAddress(
address deployer,
uint256 chainId
) public pure returns (address) {
bytes32 rollupSalt = keccak256(abi.encode(chainId));
return Create2Upgradeable.computeAddress(
rollupSalt, keccak256(type(RollupProxy).creationCode), deployer
);
}
function validateRollupDeployedAtAddress(
address rollupAddress,
address deployer,
uint256 chainId
) external view {
require(
(rollupAddress.code.length > 0)
&& expectedRollupAddress(deployer, chainId) == rollupAddress,
"ADDR_MISMATCH"
);
}
function perform(
address[] memory validators
) external {
// tidy up the old rollup - pause it and refund stakes
cleanupOldRollup();
// create the config, we do this now so that we compute the expected rollup address
Config memory config = createConfig();
// deploy the new challenge manager
IEdgeChallengeManager challengeManager = IEdgeChallengeManager(
address(
new TransparentUpgradeableProxy(
address(IMPL_CHALLENGE_MANAGER),
address(PROXY_ADMIN_BRIDGE), // use the same proxy admin as the bridge
""
)
)
);
// now that all the dependent contracts are pointed at the new address we can
// deploy and init the new rollup
ContractDependencies memory connectedContracts = ContractDependencies({
bridge: IBridge(BRIDGE),
sequencerInbox: ISequencerInbox(SEQ_INBOX),
inbox: IInboxBase(INBOX),
outbox: IOutbox(OUTBOX),
rollupEventInbox: IRollupEventInbox(REI),
challengeManager: challengeManager,
rollupAdminLogic: IMPL_NEW_ROLLUP_ADMIN,
rollupUserLogic: IRollupUser(IMPL_NEW_ROLLUP_USER),
validatorWalletCreator: OLD_ROLLUP.validatorWalletCreator()
});
// upgrade the surrounding contracts eg bridge, outbox, seq inbox, rollup event inbox
// to set of the new rollup address
// this is different from the typical salt, it is ok because the caller should deploy the upgrade only once for each chainid
bytes32 rollupSalt = keccak256(abi.encode(config.chainId));
address _expectedRollupAddress = expectedRollupAddress(address(this), config.chainId);
upgradeSurroundingContracts(_expectedRollupAddress);
challengeManager.initialize({
_assertionChain: IAssertionChain(_expectedRollupAddress),
_challengePeriodBlocks: CHALLENGE_PERIOD_BLOCKS,
_oneStepProofEntry: OSP,
layerZeroBlockEdgeHeight: config.layerZeroBlockEdgeHeight,
layerZeroBigStepEdgeHeight: config.layerZeroBigStepEdgeHeight,
layerZeroSmallStepEdgeHeight: config.layerZeroSmallStepEdgeHeight,
_stakeToken: IERC20(config.stakeToken),
_stakeAmounts: config.miniStakeValues,
_excessStakeReceiver: EXCESS_STAKE_RECEIVER,
_numBigStepLevel: config.numBigStepLevel
});
RollupProxy rollup = new RollupProxy{salt: rollupSalt}();
require(address(rollup) == _expectedRollupAddress, "UNEXPCTED_ROLLUP_ADDR");
// initialize the rollup with this contract as owner to set batch poster and validators
// it will transfer the ownership back to the actual owner later
address actualOwner = config.owner;
config.owner = address(this);
rollup.initializeProxy(config, connectedContracts);
if (validators.length != 0) {
bool[] memory _vals = new bool[](validators.length);
for (uint256 i = 0; i < validators.length; i++) {
require(OLD_ROLLUP.isValidator(validators[i]), "UNEXPECTED_NEW_VALIDATOR");
_vals[i] = true;
}
IRollupAdmin(address(rollup)).setValidator(validators, _vals);
}
if (DISABLE_VALIDATOR_WHITELIST) {
IRollupAdmin(address(rollup)).setValidatorWhitelistDisabled(DISABLE_VALIDATOR_WHITELIST);
}
// anyTrustFastConfirmer only exists since v2.0.0, but the old rollup can be on an older version
try OLD_ROLLUP.anyTrustFastConfirmer() returns (address anyTrustFastConfirmer) {
if (anyTrustFastConfirmer != address(0)) {
IRollupAdmin(address(rollup)).setAnyTrustFastConfirmer(anyTrustFastConfirmer);
}
} catch {
// do nothing if anyTrustFastConfirmer doesnt exist
}
IRollupAdmin(address(rollup)).setOwner(actualOwner);
emit RollupMigrated(_expectedRollupAddress, address(challengeManager));
}
}