@arbitrum/nitro-contracts 1.0.0-beta.5 → 1.0.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/package.json +2 -1
  2. package/src/bridge/Bridge.sol +127 -32
  3. package/src/bridge/IBridge.sol +40 -6
  4. package/src/bridge/{IMessageProvider.sol → IDelayedMessageProvider.sol} +2 -3
  5. package/src/bridge/IInbox.sol +23 -2
  6. package/src/bridge/IOwnable.sol +9 -0
  7. package/src/bridge/ISequencerInbox.sol +36 -9
  8. package/src/bridge/Inbox.sol +131 -45
  9. package/src/bridge/Outbox.sol +134 -31
  10. package/src/bridge/SequencerInbox.sol +159 -60
  11. package/src/challenge/ChallengeLib.sol +0 -2
  12. package/src/challenge/ChallengeManager.sol +4 -8
  13. package/src/challenge/IChallengeManager.sol +1 -1
  14. package/src/libraries/Error.sol +6 -0
  15. package/src/libraries/IGasRefunder.sol +12 -13
  16. package/src/libraries/MerkleLib.sol +11 -2
  17. package/src/libraries/MessageTypes.sol +1 -0
  18. package/src/mocks/BridgeStub.sol +67 -21
  19. package/src/mocks/InboxStub.sol +3 -9
  20. package/src/mocks/SequencerInboxStub.sol +10 -8
  21. package/src/mocks/Simple.sol +8 -0
  22. package/src/node-interface/NodeInterface.sol +32 -5
  23. package/src/osp/IOneStepProver.sol +1 -2
  24. package/src/osp/OneStepProver0.sol +1 -87
  25. package/src/osp/OneStepProverHostIo.sol +5 -6
  26. package/src/osp/OneStepProverMath.sol +37 -27
  27. package/src/osp/OneStepProverMemory.sol +3 -4
  28. package/src/precompiles/ArbAggregator.sol +23 -33
  29. package/src/precompiles/ArbBLS.sol +1 -43
  30. package/src/precompiles/ArbGasInfo.sol +1 -19
  31. package/src/precompiles/ArbOwner.sol +12 -15
  32. package/src/precompiles/ArbRetryableTx.sol +10 -1
  33. package/src/precompiles/ArbosActs.sol +9 -2
  34. package/src/rollup/BridgeCreator.sol +23 -28
  35. package/src/rollup/IRollupCore.sol +3 -3
  36. package/src/rollup/{IRollupEventBridge.sol → IRollupEventInbox.sol} +2 -2
  37. package/src/rollup/IRollupLogic.sol +21 -18
  38. package/src/rollup/RollupAdminLogic.sol +30 -34
  39. package/src/rollup/RollupCore.sol +15 -7
  40. package/src/rollup/RollupCreator.sol +21 -11
  41. package/src/rollup/{RollupEventBridge.sol → RollupEventInbox.sol} +10 -10
  42. package/src/rollup/RollupLib.sol +20 -5
  43. package/src/rollup/RollupUserLogic.sol +9 -18
  44. package/src/rollup/ValidatorWallet.sol +124 -8
  45. package/src/rollup/ValidatorWalletCreator.sol +11 -6
  46. package/src/state/Deserialize.sol +3 -22
  47. package/src/state/Instructions.sol +2 -10
  48. package/src/state/Machine.sol +0 -4
  49. package/src/state/ModuleMemory.sol +2 -1
  50. package/src/state/Value.sol +2 -3
  51. package/src/test-helpers/BridgeTester.sol +223 -0
  52. package/src/test-helpers/OutboxWithoutOptTester.sol +188 -0
  53. package/src/test-helpers/RollupMock.sol +21 -0
  54. package/src/state/PcStack.sol +0 -32
@@ -24,9 +24,6 @@ interface ArbOwner {
24
24
  /// @notice Retrieves the list of chain owners
25
25
  function getAllChainOwners() external view returns (address[] memory);
26
26
 
27
- /// @notice Set the L1 basefee estimate directly, bypassing the autoregression
28
- function setL1BaseFeeEstimate(uint256 priceInWei) external;
29
-
30
27
  /// @notice Set how slowly ArbOS updates its estimate of the L1 basefee
31
28
  function setL1BaseFeeEstimateInertia(uint64 inertia) external;
32
29
 
@@ -39,18 +36,6 @@ interface ArbOwner {
39
36
  /// @notice Set the computational speed limit for the chain
40
37
  function setSpeedLimit(uint64 limit) external;
41
38
 
42
- /// @notice Set the number of seconds worth of the speed limit the gas pool contains
43
- function setGasPoolSeconds(uint64 factor) external;
44
-
45
- /// @notice Set the target fullness in bips the pricing model will try to keep the pool at
46
- function setGasPoolTarget(uint64 target) external;
47
-
48
- /// @notice Set the extent in bips to which the pricing model favors filling the pool over increasing speeds
49
- function setGasPoolWeight(uint64 weight) external;
50
-
51
- /// @notice Set how slowly ArbOS updates its estimate the amount of gas being burnt per second
52
- function setRateEstimateInertia(uint64 inertia) external;
53
-
54
39
  /// @notice Set the maximum size a tx (and block) can be
55
40
  function setMaxTxGasLimit(uint64 limit) external;
56
41
 
@@ -69,6 +54,18 @@ interface ArbOwner {
69
54
  /// @notice Upgrades ArbOS to the requested version at the requested timestamp
70
55
  function scheduleArbOSUpgrade(uint64 newVersion, uint64 timestamp) external;
71
56
 
57
+ /// @notice Sets equilibration units parameter for L1 price adjustment algorithm
58
+ function setL1PricingEquilibrationUnits(uint256 equilibrationUnits) external;
59
+
60
+ /// @notice Sets inertia parameter for L1 price adjustment algorithm
61
+ function setL1PricingInertia(uint64 inertia) external;
62
+
63
+ /// @notice Sets reward recipient address for L1 price adjustment algorithm
64
+ function setL1PricingRewardRecipient(address recipient) external;
65
+
66
+ /// @notice Sets reward amount for L1 price adjustment algorithm, in wei per unit
67
+ function setL1PricingRewardRate(uint64 weiPerUnit) external;
68
+
72
69
  // Emitted when a successful call is made to this precompile
73
70
  event OwnerActs(bytes4 indexed method, address indexed owner, bytes data);
74
71
  }
@@ -55,6 +55,13 @@ interface ArbRetryableTx {
55
55
  */
56
56
  function cancel(bytes32 ticketId) external;
57
57
 
58
+ /**
59
+ * @notice Gets the redeemer of the current retryable redeem attempt.
60
+ * Returns the zero address if the current transaction is not a retryable redeem attempt.
61
+ * If this is an auto-redeem, returns the fee refund address of the retryable.
62
+ */
63
+ function getCurrentRedeemer() external view returns (address);
64
+
58
65
  /**
59
66
  * @notice Do not call. This method represents a retryable submission to aid explorers.
60
67
  * Calling it will always revert.
@@ -80,7 +87,9 @@ interface ArbRetryableTx {
80
87
  bytes32 indexed retryTxHash,
81
88
  uint64 indexed sequenceNum,
82
89
  uint64 donatedGas,
83
- address gasDonor
90
+ address gasDonor,
91
+ uint256 maxRefund,
92
+ uint256 submissionFeeRefund
84
93
  );
85
94
  event Canceled(bytes32 indexed ticketId);
86
95
 
@@ -26,16 +26,23 @@ interface ArbosActs {
26
26
  /**
27
27
  * @notice ArbOS "calls" this when starting a block
28
28
  * @param l1BaseFee the L1 BaseFee
29
- * @param l2BaseFeeLastBlock the L2 BaseFee in the last block's header
30
29
  * @param l1BlockNumber the L1 block number
31
30
  * @param timePassed number of seconds since the last block
32
31
  */
33
32
  function startBlock(
34
33
  uint256 l1BaseFee,
35
- uint256 l2BaseFeeLastBlock,
36
34
  uint64 l1BlockNumber,
35
+ uint64 l2BlockNumber,
37
36
  uint64 timePassed
38
37
  ) external;
39
38
 
39
+ function batchPostingReport(
40
+ uint256 batchTimestamp,
41
+ address batchPosterAddress,
42
+ uint64 batchNumber,
43
+ uint64 batchDataGas,
44
+ uint256 l1BaseFeeWei
45
+ ) external;
46
+
40
47
  error CallerNotArbOS();
41
48
  }
@@ -9,40 +9,40 @@ import "../bridge/SequencerInbox.sol";
9
9
  import "../bridge/ISequencerInbox.sol";
10
10
  import "../bridge/Inbox.sol";
11
11
  import "../bridge/Outbox.sol";
12
- import "./RollupEventBridge.sol";
12
+ import "./RollupEventInbox.sol";
13
13
 
14
14
  import "../bridge/IBridge.sol";
15
15
  import "@openzeppelin/contracts/access/Ownable.sol";
16
16
  import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
17
17
 
18
18
  contract BridgeCreator is Ownable {
19
- Bridge public delayedBridgeTemplate;
19
+ Bridge public bridgeTemplate;
20
20
  SequencerInbox public sequencerInboxTemplate;
21
21
  Inbox public inboxTemplate;
22
- RollupEventBridge public rollupEventBridgeTemplate;
22
+ RollupEventInbox public rollupEventInboxTemplate;
23
23
  Outbox public outboxTemplate;
24
24
 
25
25
  event TemplatesUpdated();
26
26
 
27
27
  constructor() Ownable() {
28
- delayedBridgeTemplate = new Bridge();
28
+ bridgeTemplate = new Bridge();
29
29
  sequencerInboxTemplate = new SequencerInbox();
30
30
  inboxTemplate = new Inbox();
31
- rollupEventBridgeTemplate = new RollupEventBridge();
31
+ rollupEventInboxTemplate = new RollupEventInbox();
32
32
  outboxTemplate = new Outbox();
33
33
  }
34
34
 
35
35
  function updateTemplates(
36
- address _delayedBridgeTemplate,
36
+ address _bridgeTemplate,
37
37
  address _sequencerInboxTemplate,
38
38
  address _inboxTemplate,
39
- address _rollupEventBridgeTemplate,
39
+ address _rollupEventInboxTemplate,
40
40
  address _outboxTemplate
41
41
  ) external onlyOwner {
42
- delayedBridgeTemplate = Bridge(_delayedBridgeTemplate);
42
+ bridgeTemplate = Bridge(_bridgeTemplate);
43
43
  sequencerInboxTemplate = SequencerInbox(_sequencerInboxTemplate);
44
44
  inboxTemplate = Inbox(_inboxTemplate);
45
- rollupEventBridgeTemplate = RollupEventBridge(_rollupEventBridgeTemplate);
45
+ rollupEventInboxTemplate = RollupEventInbox(_rollupEventInboxTemplate);
46
46
  outboxTemplate = Outbox(_outboxTemplate);
47
47
 
48
48
  emit TemplatesUpdated();
@@ -50,10 +50,10 @@ contract BridgeCreator is Ownable {
50
50
 
51
51
  struct CreateBridgeFrame {
52
52
  ProxyAdmin admin;
53
- Bridge delayedBridge;
53
+ Bridge bridge;
54
54
  SequencerInbox sequencerInbox;
55
55
  Inbox inbox;
56
- RollupEventBridge rollupEventBridge;
56
+ RollupEventInbox rollupEventInbox;
57
57
  Outbox outbox;
58
58
  }
59
59
 
@@ -67,16 +67,14 @@ contract BridgeCreator is Ownable {
67
67
  Bridge,
68
68
  SequencerInbox,
69
69
  Inbox,
70
- RollupEventBridge,
70
+ RollupEventInbox,
71
71
  Outbox
72
72
  )
73
73
  {
74
74
  CreateBridgeFrame memory frame;
75
75
  {
76
- frame.delayedBridge = Bridge(
77
- address(
78
- new TransparentUpgradeableProxy(address(delayedBridgeTemplate), adminProxy, "")
79
- )
76
+ frame.bridge = Bridge(
77
+ address(new TransparentUpgradeableProxy(address(bridgeTemplate), adminProxy, ""))
80
78
  );
81
79
  frame.sequencerInbox = SequencerInbox(
82
80
  address(
@@ -86,10 +84,10 @@ contract BridgeCreator is Ownable {
86
84
  frame.inbox = Inbox(
87
85
  address(new TransparentUpgradeableProxy(address(inboxTemplate), adminProxy, ""))
88
86
  );
89
- frame.rollupEventBridge = RollupEventBridge(
87
+ frame.rollupEventInbox = RollupEventInbox(
90
88
  address(
91
89
  new TransparentUpgradeableProxy(
92
- address(rollupEventBridgeTemplate),
90
+ address(rollupEventInboxTemplate),
93
91
  adminProxy,
94
92
  ""
95
93
  )
@@ -100,20 +98,17 @@ contract BridgeCreator is Ownable {
100
98
  );
101
99
  }
102
100
 
103
- frame.delayedBridge.initialize();
104
- frame.sequencerInbox.initialize(IBridge(frame.delayedBridge), rollup, maxTimeVariation);
105
- frame.inbox.initialize(IBridge(frame.delayedBridge));
106
- frame.rollupEventBridge.initialize(address(frame.delayedBridge), rollup);
107
- frame.outbox.initialize(rollup, IBridge(frame.delayedBridge));
108
-
109
- frame.delayedBridge.setInbox(address(frame.inbox), true);
110
- frame.delayedBridge.transferOwnership(rollup);
101
+ frame.bridge.initialize(IOwnable(rollup));
102
+ frame.sequencerInbox.initialize(IBridge(frame.bridge), maxTimeVariation);
103
+ frame.inbox.initialize(IBridge(frame.bridge), ISequencerInbox(frame.sequencerInbox));
104
+ frame.rollupEventInbox.initialize(IBridge(frame.bridge));
105
+ frame.outbox.initialize(IBridge(frame.bridge));
111
106
 
112
107
  return (
113
- frame.delayedBridge,
108
+ frame.bridge,
114
109
  frame.sequencerInbox,
115
110
  frame.inbox,
116
- frame.rollupEventBridge,
111
+ frame.rollupEventInbox,
117
112
  frame.outbox
118
113
  );
119
114
  }
@@ -59,13 +59,13 @@ interface IRollupCore {
59
59
 
60
60
  function wasmModuleRoot() external view returns (bytes32);
61
61
 
62
- function delayedBridge() external view returns (IBridge);
62
+ function bridge() external view returns (IBridge);
63
63
 
64
- function sequencerBridge() external view returns (ISequencerInbox);
64
+ function sequencerInbox() external view returns (ISequencerInbox);
65
65
 
66
66
  function outbox() external view returns (IOutbox);
67
67
 
68
- function rollupEventBridge() external view returns (IRollupEventBridge);
68
+ function rollupEventInbox() external view returns (IRollupEventInbox);
69
69
 
70
70
  function challengeManager() external view returns (IChallengeManager);
71
71
 
@@ -6,10 +6,10 @@ pragma solidity ^0.8.0;
6
6
 
7
7
  import "../bridge/IBridge.sol";
8
8
 
9
- interface IRollupEventBridge {
9
+ interface IRollupEventInbox {
10
10
  function bridge() external view returns (IBridge);
11
11
 
12
- function initialize(address _bridge, address _rollup) external;
12
+ function initialize(IBridge _bridge) external;
13
13
 
14
14
  function rollup() external view returns (address);
15
15
 
@@ -8,8 +8,9 @@ import "./RollupLib.sol";
8
8
  import "./IRollupCore.sol";
9
9
  import "../bridge/ISequencerInbox.sol";
10
10
  import "../bridge/IOutbox.sol";
11
+ import "../bridge/IOwnable.sol";
11
12
 
12
- interface IRollupUserAbs is IRollupCore {
13
+ interface IRollupUserAbs is IRollupCore, IOwnable {
13
14
  /// @dev the user logic just validated configuration and shouldn't write to state during init
14
15
  /// this allows the admin logic to ensure consistency on parameters.
15
16
  function initialize(address stakeToken) external view;
@@ -52,7 +53,18 @@ interface IRollupUserAbs is IRollupCore {
52
53
 
53
54
  function requireUnresolved(uint256 nodeNum) external view;
54
55
 
55
- function withdrawStakerFunds(address payable destination) external returns (uint256);
56
+ function withdrawStakerFunds() external returns (uint256);
57
+
58
+ function createChallenge(
59
+ address[2] calldata stakers,
60
+ uint64[2] calldata nodeNums,
61
+ MachineStatus[2] calldata machineStatuses,
62
+ GlobalState[2] calldata globalStates,
63
+ uint64 numBlocks,
64
+ bytes32 secondExecutionHash,
65
+ uint256[2] calldata proposedTimes,
66
+ bytes32[2] calldata wasmModuleRoots
67
+ ) external;
56
68
  }
57
69
 
58
70
  interface IRollupUser is IRollupUserAbs {
@@ -107,7 +119,7 @@ interface IRollupAdmin {
107
119
  * @param _inbox Inbox contract to add or remove
108
120
  * @param _enabled New status of inbox
109
121
  */
110
- function setInbox(address _inbox, bool _enabled) external;
122
+ function setDelayedInbox(address _inbox, bool _enabled) external;
111
123
 
112
124
  /**
113
125
  * @notice Pause interaction with the rollup contract
@@ -166,21 +178,6 @@ interface IRollupAdmin {
166
178
  */
167
179
  function setStakeToken(address newStakeToken) external;
168
180
 
169
- /**
170
- * @notice Set max time variation from actual time for sequencer inbox
171
- * @param maxTimeVariation the maximum time variation parameters
172
- */
173
- function setSequencerInboxMaxTimeVariation(
174
- ISequencerInbox.MaxTimeVariation memory maxTimeVariation
175
- ) external;
176
-
177
- /**
178
- * @notice Updates whether an address is authorized to be a batch poster at the sequencer inbox
179
- * @param addr the address
180
- * @param isBatchPoster if the specified address should be authorized as a batch poster
181
- */
182
- function setIsBatchPoster(address addr, bool isBatchPoster) external;
183
-
184
181
  /**
185
182
  * @notice Upgrades the implementation of a beacon controlled by the rollup
186
183
  * @param beacon address of beacon to be upgraded
@@ -212,4 +209,10 @@ interface IRollupAdmin {
212
209
  * @param newWasmModuleRoot new module root
213
210
  */
214
211
  function setWasmModuleRoot(bytes32 newWasmModuleRoot) external;
212
+
213
+ /**
214
+ * @notice set a new sequencer inbox contract
215
+ * @param _sequencerInbox new address of sequencer inbox
216
+ */
217
+ function setSequencerInbox(address _sequencerInbox) external;
215
218
  }
@@ -21,16 +21,26 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, SecondaryLogicUUPSUpgrade
21
21
  onlyProxy
22
22
  initializer
23
23
  {
24
- delayedBridge = connectedContracts.delayedBridge;
25
- sequencerBridge = connectedContracts.sequencerInbox;
24
+ rollupDeploymentBlock = block.number;
25
+ bridge = connectedContracts.bridge;
26
+ sequencerInbox = connectedContracts.sequencerInbox;
27
+ connectedContracts.bridge.setDelayedInbox(address(connectedContracts.inbox), true);
28
+ connectedContracts.bridge.setSequencerInbox(address(connectedContracts.sequencerInbox));
29
+
30
+ inbox = connectedContracts.inbox;
26
31
  outbox = connectedContracts.outbox;
27
- delayedBridge.setOutbox(address(connectedContracts.outbox), true);
28
- rollupEventBridge = connectedContracts.rollupEventBridge;
29
- delayedBridge.setInbox(address(connectedContracts.rollupEventBridge), true);
32
+ connectedContracts.bridge.setOutbox(address(connectedContracts.outbox), true);
33
+ rollupEventInbox = connectedContracts.rollupEventInbox;
34
+ connectedContracts.bridge.setDelayedInbox(
35
+ address(connectedContracts.rollupEventInbox),
36
+ true
37
+ );
30
38
 
31
- rollupEventBridge.rollupInitialized(config.chainId);
32
- sequencerBridge.addSequencerL2Batch(0, "", 1, IGasRefunder(address(0)));
39
+ connectedContracts.rollupEventInbox.rollupInitialized(config.chainId);
40
+ connectedContracts.sequencerInbox.addSequencerL2Batch(0, "", 1, IGasRefunder(address(0)));
33
41
 
42
+ validatorUtils = connectedContracts.validatorUtils;
43
+ validatorWalletCreator = connectedContracts.validatorWalletCreator;
34
44
  challengeManager = connectedContracts.challengeManager;
35
45
 
36
46
  Node memory node = createInitialNode();
@@ -53,8 +63,6 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, SecondaryLogicUUPSUpgrade
53
63
 
54
64
  stakeToken = config.stakeToken;
55
65
 
56
- sequencerBridge.setMaxTimeVariation(config.sequencerInboxMaxTimeVariation);
57
-
58
66
  emit RollupInitialized(config.wasmModuleRoot, config.chainId);
59
67
  }
60
68
 
@@ -86,7 +94,7 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, SecondaryLogicUUPSUpgrade
86
94
  */
87
95
  function setOutbox(IOutbox _outbox) external override {
88
96
  outbox = _outbox;
89
- delayedBridge.setOutbox(address(_outbox), true);
97
+ bridge.setOutbox(address(_outbox), true);
90
98
  emit OwnerFunctionCalled(0);
91
99
  }
92
100
 
@@ -96,7 +104,7 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, SecondaryLogicUUPSUpgrade
96
104
  */
97
105
  function removeOldOutbox(address _outbox) external override {
98
106
  require(_outbox != address(outbox), "CUR_OUTBOX");
99
- delayedBridge.setOutbox(_outbox, false);
107
+ bridge.setOutbox(_outbox, false);
100
108
  emit OwnerFunctionCalled(1);
101
109
  }
102
110
 
@@ -105,8 +113,8 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, SecondaryLogicUUPSUpgrade
105
113
  * @param _inbox Inbox contract to add or remove
106
114
  * @param _enabled New status of inbox
107
115
  */
108
- function setInbox(address _inbox, bool _enabled) external override {
109
- delayedBridge.setInbox(address(_inbox), _enabled);
116
+ function setDelayedInbox(address _inbox, bool _enabled) external override {
117
+ bridge.setDelayedInbox(address(_inbox), _enabled);
110
118
  emit OwnerFunctionCalled(2);
111
119
  }
112
120
 
@@ -224,27 +232,6 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, SecondaryLogicUUPSUpgrade
224
232
  emit OwnerFunctionCalled(13);
225
233
  }
226
234
 
227
- /**
228
- * @notice Set max delay for sequencer inbox
229
- * @param maxTimeVariation the maximum time variation parameters
230
- */
231
- function setSequencerInboxMaxTimeVariation(
232
- ISequencerInbox.MaxTimeVariation calldata maxTimeVariation
233
- ) external override {
234
- sequencerBridge.setMaxTimeVariation(maxTimeVariation);
235
- emit OwnerFunctionCalled(14);
236
- }
237
-
238
- /**
239
- * @notice Updates whether an address is authorized to be a batch poster at the sequencer inbox
240
- * @param addr the address
241
- * @param isBatchPoster if the specified address should be authorized as a batch poster
242
- */
243
- function setIsBatchPoster(address addr, bool isBatchPoster) external override {
244
- ISequencerInbox(sequencerBridge).setIsBatchPoster(addr, isBatchPoster);
245
- emit OwnerFunctionCalled(19);
246
- }
247
-
248
235
  /**
249
236
  * @notice Upgrades the implementation of a beacon controlled by the rollup
250
237
  * @param beacon address of beacon to be upgraded
@@ -319,4 +306,13 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, SecondaryLogicUUPSUpgrade
319
306
  wasmModuleRoot = newWasmModuleRoot;
320
307
  emit OwnerFunctionCalled(26);
321
308
  }
309
+
310
+ /**
311
+ * @notice set a new sequencer inbox contract
312
+ * @param _sequencerInbox new address of sequencer inbox
313
+ */
314
+ function setSequencerInbox(address _sequencerInbox) external override {
315
+ bridge.setSequencerInbox(_sequencerInbox);
316
+ emit OwnerFunctionCalled(27);
317
+ }
322
318
  }
@@ -9,7 +9,7 @@ import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
9
9
  import "./Node.sol";
10
10
  import "./IRollupCore.sol";
11
11
  import "./RollupLib.sol";
12
- import "./IRollupEventBridge.sol";
12
+ import "./IRollupEventInbox.sol";
13
13
  import "./IRollupCore.sol";
14
14
 
15
15
  import "../challenge/IChallengeManager.sol";
@@ -31,11 +31,17 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable {
31
31
  uint256 public baseStake;
32
32
  bytes32 public wasmModuleRoot;
33
33
 
34
- IBridge public delayedBridge;
35
- ISequencerInbox public sequencerBridge;
34
+ IInbox public inbox;
35
+ IBridge public bridge;
36
36
  IOutbox public outbox;
37
- IRollupEventBridge public rollupEventBridge;
37
+ ISequencerInbox public sequencerInbox;
38
+ IRollupEventInbox public rollupEventInbox;
38
39
  IChallengeManager public override challengeManager;
40
+
41
+ // misc useful contracts when interacting with the rollup
42
+ address public validatorUtils;
43
+ address public validatorWalletCreator;
44
+
39
45
  // when a staker loses a challenge, half of their funds get escrowed in this address
40
46
  address public loserStakeEscrow;
41
47
  address public stakeToken;
@@ -63,6 +69,7 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable {
63
69
 
64
70
  mapping(address => uint256) private _withdrawableFunds;
65
71
  uint256 public totalWithdrawableFunds;
72
+ uint256 public rollupDeploymentBlock;
66
73
 
67
74
  // The node number of the initial node
68
75
  uint64 internal constant GENESIS_NODE = 0;
@@ -529,7 +536,7 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable {
529
536
  {
530
537
  // validate data
531
538
  memoryFrame.prevNode = getNode(prevNodeNum);
532
- memoryFrame.currentInboxSize = sequencerBridge.batchCount();
539
+ memoryFrame.currentInboxSize = bridge.sequencerMessageCount();
533
540
 
534
541
  // Make sure the previous state is correct against the node being built on
535
542
  require(
@@ -560,7 +567,7 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable {
560
567
  require(afterInboxCount <= memoryFrame.currentInboxSize, "INBOX_PAST_END");
561
568
  // This gives replay protection against the state of the inbox
562
569
  if (afterInboxCount > 0) {
563
- memoryFrame.sequencerBatchAcc = sequencerBridge.inboxAccs(afterInboxCount - 1);
570
+ memoryFrame.sequencerBatchAcc = bridge.sequencerInboxAccs(afterInboxCount - 1);
564
571
  }
565
572
  }
566
573
 
@@ -582,7 +589,8 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable {
582
589
  memoryFrame.hasSibling,
583
590
  memoryFrame.lastHash,
584
591
  memoryFrame.executionHash,
585
- memoryFrame.sequencerBatchAcc
592
+ memoryFrame.sequencerBatchAcc,
593
+ wasmModuleRoot
586
594
  );
587
595
  require(newNodeHash == expectedNodeHash, "UNEXPECTED_NODE_HASH");
588
596
 
@@ -18,7 +18,7 @@ contract RollupCreator is Ownable {
18
18
  address inboxAddress,
19
19
  address adminProxy,
20
20
  address sequencerInbox,
21
- address delayedBridge
21
+ address bridge
22
22
  );
23
23
  event TemplatesUpdated();
24
24
 
@@ -28,6 +28,9 @@ contract RollupCreator is Ownable {
28
28
  IRollupAdmin public rollupAdminLogic;
29
29
  IRollupUser public rollupUserLogic;
30
30
 
31
+ address public validatorUtils;
32
+ address public validatorWalletCreator;
33
+
31
34
  constructor() Ownable() {}
32
35
 
33
36
  function setTemplates(
@@ -35,22 +38,26 @@ contract RollupCreator is Ownable {
35
38
  IOneStepProofEntry _osp,
36
39
  IChallengeManager _challengeManagerLogic,
37
40
  IRollupAdmin _rollupAdminLogic,
38
- IRollupUser _rollupUserLogic
41
+ IRollupUser _rollupUserLogic,
42
+ address _validatorUtils,
43
+ address _validatorWalletCreator
39
44
  ) external onlyOwner {
40
45
  bridgeCreator = _bridgeCreator;
41
46
  osp = _osp;
42
47
  challengeManagerTemplate = _challengeManagerLogic;
43
48
  rollupAdminLogic = _rollupAdminLogic;
44
49
  rollupUserLogic = _rollupUserLogic;
50
+ validatorUtils = _validatorUtils;
51
+ validatorWalletCreator = _validatorWalletCreator;
45
52
  emit TemplatesUpdated();
46
53
  }
47
54
 
48
55
  struct CreateRollupFrame {
49
56
  ProxyAdmin admin;
50
- IBridge delayedBridge;
57
+ IBridge bridge;
51
58
  ISequencerInbox sequencerInbox;
52
59
  IInbox inbox;
53
- IRollupEventBridge rollupEventBridge;
60
+ IRollupEventInbox rollupEventInbox;
54
61
  IOutbox outbox;
55
62
  ArbitrumProxy rollup;
56
63
  }
@@ -68,10 +75,10 @@ contract RollupCreator is Ownable {
68
75
  frame.admin = new ProxyAdmin();
69
76
 
70
77
  (
71
- frame.delayedBridge,
78
+ frame.bridge,
72
79
  frame.sequencerInbox,
73
80
  frame.inbox,
74
- frame.rollupEventBridge,
81
+ frame.rollupEventInbox,
75
82
  frame.outbox
76
83
  ) = bridgeCreator.createBridge(
77
84
  address(frame.admin),
@@ -93,20 +100,23 @@ contract RollupCreator is Ownable {
93
100
  challengeManager.initialize(
94
101
  IChallengeResultReceiver(expectedRollupAddr),
95
102
  frame.sequencerInbox,
96
- frame.delayedBridge,
103
+ frame.bridge,
97
104
  osp
98
105
  );
99
106
 
100
107
  frame.rollup = new ArbitrumProxy(
101
108
  config,
102
109
  ContractDependencies({
103
- delayedBridge: frame.delayedBridge,
110
+ bridge: frame.bridge,
104
111
  sequencerInbox: frame.sequencerInbox,
112
+ inbox: frame.inbox,
105
113
  outbox: frame.outbox,
106
- rollupEventBridge: frame.rollupEventBridge,
114
+ rollupEventInbox: frame.rollupEventInbox,
107
115
  challengeManager: challengeManager,
108
116
  rollupAdminLogic: rollupAdminLogic,
109
- rollupUserLogic: rollupUserLogic
117
+ rollupUserLogic: rollupUserLogic,
118
+ validatorUtils: validatorUtils,
119
+ validatorWalletCreator: validatorWalletCreator
110
120
  })
111
121
  );
112
122
  require(address(frame.rollup) == expectedRollupAddr, "WRONG_ROLLUP_ADDR");
@@ -116,7 +126,7 @@ contract RollupCreator is Ownable {
116
126
  address(frame.inbox),
117
127
  address(frame.admin),
118
128
  address(frame.sequencerInbox),
119
- address(frame.delayedBridge)
129
+ address(frame.bridge)
120
130
  );
121
131
  return address(frame.rollup);
122
132
  }
@@ -4,36 +4,36 @@
4
4
 
5
5
  pragma solidity ^0.8.0;
6
6
 
7
- import "./IRollupEventBridge.sol";
7
+ import "./IRollupEventInbox.sol";
8
8
  import "../bridge/IBridge.sol";
9
- import "../bridge/IMessageProvider.sol";
9
+ import "../bridge/IDelayedMessageProvider.sol";
10
10
  import "../libraries/DelegateCallAware.sol";
11
11
  import {INITIALIZATION_MSG_TYPE} from "../libraries/MessageTypes.sol";
12
12
 
13
13
  /**
14
14
  * @title The inbox for rollup protocol events
15
15
  */
16
- contract RollupEventBridge is IRollupEventBridge, IMessageProvider, DelegateCallAware {
16
+ contract RollupEventInbox is IRollupEventInbox, IDelayedMessageProvider, DelegateCallAware {
17
17
  uint8 internal constant CREATE_NODE_EVENT = 0;
18
18
  uint8 internal constant CONFIRM_NODE_EVENT = 1;
19
19
  uint8 internal constant REJECT_NODE_EVENT = 2;
20
20
  uint8 internal constant STAKE_CREATED_EVENT = 3;
21
21
 
22
- IBridge public bridge;
23
- address public rollup;
22
+ IBridge public override bridge;
23
+ address public override rollup;
24
24
 
25
25
  modifier onlyRollup() {
26
26
  require(msg.sender == rollup, "ONLY_ROLLUP");
27
27
  _;
28
28
  }
29
29
 
30
- function initialize(address _bridge, address _rollup) external onlyDelegated {
31
- require(rollup == address(0), "ALREADY_INIT");
32
- bridge = IBridge(_bridge);
33
- rollup = _rollup;
30
+ function initialize(IBridge _bridge) external override onlyDelegated {
31
+ require(address(bridge) == address(0), "ALREADY_INIT");
32
+ bridge = _bridge;
33
+ rollup = address(_bridge.rollup());
34
34
  }
35
35
 
36
- function rollupInitialized(uint256 chainId) external onlyRollup {
36
+ function rollupInitialized(uint256 chainId) external override onlyRollup {
37
37
  bytes memory initMsg = abi.encodePacked(chainId);
38
38
  uint256 num = bridge.enqueueDelayedMessage(
39
39
  INITIALIZATION_MSG_TYPE,