@arbitrum/nitro-contracts 1.0.2-beta.0 → 1.0.3-beta.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. package/LICENSE +114 -0
  2. package/README.md +9 -5
  3. package/package.json +1 -1
  4. package/src/bridge/Bridge.sol +3 -3
  5. package/src/bridge/IBridge.sol +1 -1
  6. package/src/bridge/IDelayedMessageProvider.sol +1 -1
  7. package/src/bridge/IInbox.sol +1 -1
  8. package/src/bridge/IOutbox.sol +1 -1
  9. package/src/bridge/IOwnable.sol +1 -1
  10. package/src/bridge/ISequencerInbox.sol +22 -4
  11. package/src/bridge/Inbox.sol +2 -2
  12. package/src/bridge/Messages.sol +1 -1
  13. package/src/bridge/Outbox.sol +1 -1
  14. package/src/bridge/SequencerInbox.sol +9 -1
  15. package/src/challenge/ChallengeLib.sol +1 -1
  16. package/src/challenge/ChallengeManager.sol +1 -1
  17. package/src/challenge/IChallengeManager.sol +1 -1
  18. package/src/challenge/IChallengeResultReceiver.sol +1 -1
  19. package/src/libraries/AddressAliasHelper.sol +1 -1
  20. package/src/libraries/AdminFallbackProxy.sol +3 -3
  21. package/src/libraries/Constants.sol +1 -1
  22. package/src/libraries/CryptographyPrimitives.sol +1 -1
  23. package/src/libraries/DelegateCallAware.sol +1 -1
  24. package/src/libraries/DoubleLogicUUPSUpgradeable.sol +1 -1
  25. package/src/libraries/Error.sol +1 -1
  26. package/src/libraries/IGasRefunder.sol +2 -5
  27. package/src/libraries/MerkleLib.sol +1 -1
  28. package/src/libraries/MessageTypes.sol +1 -1
  29. package/src/mocks/BridgeStub.sol +2 -2
  30. package/src/mocks/BridgeUnproxied.sol +1 -1
  31. package/src/mocks/InboxStub.sol +1 -1
  32. package/src/mocks/MockResultReceiver.sol +1 -1
  33. package/src/mocks/ProxyAdminForBinding.sol +1 -1
  34. package/src/mocks/SequencerInboxStub.sol +1 -1
  35. package/src/mocks/Simple.sol +5 -1
  36. package/src/mocks/SimpleProxy.sol +1 -1
  37. package/src/mocks/SingleExecutionChallenge.sol +1 -1
  38. package/src/mocks/TimedOutChallengeManager.sol +1 -1
  39. package/src/node-interface/NodeInterface.sol +4 -2
  40. package/src/node-interface/NodeInterfaceDebug.sol +1 -1
  41. package/src/osp/HashProofHelper.sol +1 -1
  42. package/src/osp/IOneStepProofEntry.sol +1 -1
  43. package/src/osp/IOneStepProver.sol +2 -1
  44. package/src/osp/OneStepProofEntry.sol +1 -1
  45. package/src/osp/OneStepProver0.sol +1 -1
  46. package/src/osp/OneStepProverHostIo.sol +2 -1
  47. package/src/osp/OneStepProverMath.sol +1 -1
  48. package/src/osp/OneStepProverMemory.sol +2 -1
  49. package/src/precompiles/ArbAddressTable.sol +1 -1
  50. package/src/precompiles/ArbAggregator.sol +1 -1
  51. package/src/precompiles/ArbBLS.sol +1 -1
  52. package/src/precompiles/ArbDebug.sol +1 -1
  53. package/src/precompiles/ArbFunctionTable.sol +1 -1
  54. package/src/precompiles/ArbGasInfo.sol +1 -1
  55. package/src/precompiles/ArbInfo.sol +1 -1
  56. package/src/precompiles/ArbOwner.sol +4 -1
  57. package/src/precompiles/ArbOwnerPublic.sol +1 -1
  58. package/src/precompiles/ArbRetryableTx.sol +1 -1
  59. package/src/precompiles/ArbStatistics.sol +1 -1
  60. package/src/precompiles/ArbSys.sol +1 -1
  61. package/src/precompiles/ArbosTest.sol +1 -1
  62. package/src/rollup/BridgeCreator.sol +1 -1
  63. package/src/rollup/Config.sol +43 -0
  64. package/src/rollup/IRollupAdmin.sol +138 -0
  65. package/src/rollup/IRollupCore.sol +16 -3
  66. package/src/rollup/IRollupEventInbox.sol +2 -2
  67. package/src/rollup/IRollupLogic.sol +4 -132
  68. package/src/rollup/Node.sol +15 -1
  69. package/src/rollup/RollupAdminLogic.sol +7 -9
  70. package/src/rollup/RollupCore.sol +46 -3
  71. package/src/rollup/RollupCreator.sol +33 -45
  72. package/src/rollup/RollupEventInbox.sol +8 -3
  73. package/src/rollup/RollupLib.sol +2 -40
  74. package/src/rollup/RollupProxy.sol +26 -11
  75. package/src/rollup/RollupUserLogic.sol +6 -4
  76. package/src/rollup/ValidatorUtils.sol +2 -1
  77. package/src/rollup/ValidatorWallet.sol +1 -1
  78. package/src/rollup/ValidatorWalletCreator.sol +1 -1
  79. package/src/state/Deserialize.sol +2 -2
  80. package/src/state/GlobalState.sol +1 -1
  81. package/src/state/Instructions.sol +1 -1
  82. package/src/state/Machine.sol +1 -1
  83. package/src/state/MerkleProof.sol +1 -1
  84. package/src/state/Module.sol +3 -3
  85. package/src/state/ModuleMemory.sol +3 -8
  86. package/src/state/ModuleMemoryCompact.sol +17 -0
  87. package/src/state/PcArray.sol +1 -1
  88. package/src/state/StackFrame.sol +1 -1
  89. package/src/state/Value.sol +1 -1
  90. package/src/state/ValueArray.sol +1 -1
  91. package/src/state/ValueStack.sol +1 -1
  92. package/src/test-helpers/BridgeTester.sol +1 -1
  93. package/src/test-helpers/CryptographyPrimitivesTester.sol +1 -1
  94. package/src/test-helpers/InterfaceCompatibilityTester.sol +1 -1
  95. package/src/test-helpers/MessageTester.sol +1 -1
  96. package/src/test-helpers/OutboxWithoutOptTester.sol +1 -1
  97. package/src/test-helpers/RollupMock.sol +1 -1
  98. package/src/test-helpers/ValueArrayTester.sol +1 -1
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;
@@ -7,7 +7,6 @@ pragma solidity ^0.8.0;
7
7
  import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
8
8
 
9
9
  import "./Node.sol";
10
- import "./IRollupCore.sol";
11
10
  import "./RollupLib.sol";
12
11
  import "./IRollupEventInbox.sol";
13
12
  import "./IRollupCore.sol";
@@ -18,6 +17,8 @@ import "../bridge/ISequencerInbox.sol";
18
17
  import "../bridge/IBridge.sol";
19
18
  import "../bridge/IOutbox.sol";
20
19
 
20
+ import "../precompiles/ArbSys.sol";
21
+
21
22
  import {NO_CHAL_INDEX} from "../libraries/Constants.sol";
22
23
 
23
24
  abstract contract RollupCore is IRollupCore, PausableUpgradeable {
@@ -76,6 +77,18 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable {
76
77
 
77
78
  bool public validatorWhitelistDisabled;
78
79
 
80
+ // If the chain this RollupCore is deployed on is an Arbitrum chain.
81
+ bool internal immutable _hostChainIsArbitrum;
82
+ // If the chain RollupCore is deployed on, this will contain the ArbSys.blockNumber() at each node's creation.
83
+ mapping(uint64 => uint256) internal _nodeCreatedAtArbSysBlock;
84
+
85
+ constructor() {
86
+ (bool ok, bytes memory data) = address(100).staticcall(
87
+ abi.encodeWithSelector(ArbSys.arbOSVersion.selector)
88
+ );
89
+ _hostChainIsArbitrum = ok && data.length == 32;
90
+ }
91
+
79
92
  /**
80
93
  * @notice Get a storage reference to the Node for the given node index
81
94
  * @param nodeNum Index of the node
@@ -92,6 +105,30 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable {
92
105
  return getNodeStorage(nodeNum);
93
106
  }
94
107
 
108
+ /**
109
+ * @notice Returns the block in which the given node was created for looking up its creation event.
110
+ * Unlike the Node's createdAtBlock field, this will be the ArbSys blockNumber if the host chain is an Arbitrum chain.
111
+ * That means that the block number returned for this is usable for event queries.
112
+ * This function will revert if the given node number does not exist.
113
+ * @dev This function is meant for internal use only and has no stability guarantees.
114
+ */
115
+ function getNodeCreationBlockForLogLookup(uint64 nodeNum)
116
+ external
117
+ view
118
+ override
119
+ returns (uint256)
120
+ {
121
+ if (_hostChainIsArbitrum) {
122
+ uint256 blockNum = _nodeCreatedAtArbSysBlock[nodeNum];
123
+ require(blockNum > 0, "NO_NODE");
124
+ return blockNum;
125
+ } else {
126
+ Node storage node = getNodeStorage(nodeNum);
127
+ require(node.deadlineBlock != 0, "NO_NODE");
128
+ return node.createdAtBlock;
129
+ }
130
+ }
131
+
95
132
  /**
96
133
  * @notice Check if the specified node has been staked on by the provided staker.
97
134
  * Only accurate at the latest confirmed node and afterwards.
@@ -250,6 +287,9 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable {
250
287
  __Pausable_init();
251
288
  _nodes[GENESIS_NODE] = initialNode;
252
289
  _firstUnresolvedNode = GENESIS_NODE + 1;
290
+ if (_hostChainIsArbitrum) {
291
+ _nodeCreatedAtArbSysBlock[GENESIS_NODE] = ArbSys(address(100)).arbBlockNumber();
292
+ }
253
293
  }
254
294
 
255
295
  /**
@@ -259,6 +299,9 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable {
259
299
  function nodeCreated(Node memory node) internal {
260
300
  _latestNodeCreated++;
261
301
  _nodes[_latestNodeCreated] = node;
302
+ if (_hostChainIsArbitrum) {
303
+ _nodeCreatedAtArbSysBlock[_latestNodeCreated] = ArbSys(address(100)).arbBlockNumber();
304
+ }
262
305
  }
263
306
 
264
307
  /// @notice Reject the next unresolved node
@@ -524,7 +567,7 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable {
524
567
  }
525
568
 
526
569
  function createNewNode(
527
- RollupLib.Assertion calldata assertion,
570
+ Assertion calldata assertion,
528
571
  uint64 prevNodeNum,
529
572
  uint256 prevNodeInboxMaxCount,
530
573
  bytes32 expectedNodeHash
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;
@@ -52,82 +52,70 @@ contract RollupCreator is Ownable {
52
52
  emit TemplatesUpdated();
53
53
  }
54
54
 
55
- struct CreateRollupFrame {
56
- ProxyAdmin admin;
57
- IBridge bridge;
58
- ISequencerInbox sequencerInbox;
59
- IInbox inbox;
60
- IRollupEventInbox rollupEventInbox;
61
- IOutbox outbox;
62
- RollupProxy rollup;
63
- }
64
-
65
55
  // After this setup:
66
56
  // Rollup should be the owner of bridge
67
57
  // RollupOwner should be the owner of Rollup's ProxyAdmin
68
58
  // RollupOwner should be the owner of Rollup
69
59
  // Bridge should have a single inbox and outbox
70
- function createRollup(Config memory config, address expectedRollupAddr)
71
- external
72
- returns (address)
73
- {
74
- CreateRollupFrame memory frame;
75
- frame.admin = new ProxyAdmin();
60
+ function createRollup(Config memory config) external returns (address) {
61
+ ProxyAdmin proxyAdmin = new ProxyAdmin();
62
+
63
+ // Create the rollup proxy to figure out the address and initialize it later
64
+ RollupProxy rollup = new RollupProxy{salt: keccak256(abi.encode(config))}();
76
65
 
77
66
  (
78
- frame.bridge,
79
- frame.sequencerInbox,
80
- frame.inbox,
81
- frame.rollupEventInbox,
82
- frame.outbox
67
+ IBridge bridge,
68
+ ISequencerInbox sequencerInbox,
69
+ IInbox inbox,
70
+ IRollupEventInbox rollupEventInbox,
71
+ IOutbox outbox
83
72
  ) = bridgeCreator.createBridge(
84
- address(frame.admin),
85
- expectedRollupAddr,
86
- config.sequencerInboxMaxTimeVariation
87
- );
73
+ address(proxyAdmin),
74
+ address(rollup),
75
+ config.sequencerInboxMaxTimeVariation
76
+ );
88
77
 
89
- frame.admin.transferOwnership(config.owner);
78
+ proxyAdmin.transferOwnership(config.owner);
90
79
 
91
80
  IChallengeManager challengeManager = IChallengeManager(
92
81
  address(
93
82
  new TransparentUpgradeableProxy(
94
83
  address(challengeManagerTemplate),
95
- address(frame.admin),
84
+ address(proxyAdmin),
96
85
  ""
97
86
  )
98
87
  )
99
88
  );
100
89
  challengeManager.initialize(
101
- IChallengeResultReceiver(expectedRollupAddr),
102
- frame.sequencerInbox,
103
- frame.bridge,
90
+ IChallengeResultReceiver(address(rollup)),
91
+ sequencerInbox,
92
+ bridge,
104
93
  osp
105
94
  );
106
95
 
107
- frame.rollup = new RollupProxy(
96
+ rollup.initializeProxy(
108
97
  config,
109
98
  ContractDependencies({
110
- bridge: frame.bridge,
111
- sequencerInbox: frame.sequencerInbox,
112
- inbox: frame.inbox,
113
- outbox: frame.outbox,
114
- rollupEventInbox: frame.rollupEventInbox,
99
+ bridge: bridge,
100
+ sequencerInbox: sequencerInbox,
101
+ inbox: inbox,
102
+ outbox: outbox,
103
+ rollupEventInbox: rollupEventInbox,
115
104
  challengeManager: challengeManager,
116
- rollupAdminLogic: rollupAdminLogic,
105
+ rollupAdminLogic: address(rollupAdminLogic),
117
106
  rollupUserLogic: rollupUserLogic,
118
107
  validatorUtils: validatorUtils,
119
108
  validatorWalletCreator: validatorWalletCreator
120
109
  })
121
110
  );
122
- require(address(frame.rollup) == expectedRollupAddr, "WRONG_ROLLUP_ADDR");
123
111
 
124
112
  emit RollupCreated(
125
- address(frame.rollup),
126
- address(frame.inbox),
127
- address(frame.admin),
128
- address(frame.sequencerInbox),
129
- address(frame.bridge)
113
+ address(rollup),
114
+ address(inbox),
115
+ address(proxyAdmin),
116
+ address(sequencerInbox),
117
+ address(bridge)
130
118
  );
131
- return address(frame.rollup);
119
+ return address(rollup);
132
120
  }
133
121
  }
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;
@@ -30,8 +30,13 @@ contract RollupEventInbox is IRollupEventInbox, IDelayedMessageProvider, Delegat
30
30
  rollup = address(_bridge.rollup());
31
31
  }
32
32
 
33
- function rollupInitialized(uint256 chainId) external override onlyRollup {
34
- bytes memory initMsg = abi.encodePacked(chainId);
33
+ function rollupInitialized(uint256 chainId, string calldata chainConfig)
34
+ external
35
+ override
36
+ onlyRollup
37
+ {
38
+ require(bytes(chainConfig).length > 0, "EMPTY_CHAIN_CONFIG");
39
+ bytes memory initMsg = abi.encodePacked(chainId, uint8(0), chainConfig);
35
40
  uint256 num = bridge.enqueueDelayedMessage(
36
41
  INITIALIZATION_MSG_TYPE,
37
42
  address(0),
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;
@@ -12,44 +12,12 @@ import "../bridge/ISequencerInbox.sol";
12
12
  import "../bridge/IBridge.sol";
13
13
  import "../bridge/IOutbox.sol";
14
14
  import "../bridge/IInbox.sol";
15
+ import "./Node.sol";
15
16
  import "./IRollupEventInbox.sol";
16
- import "./IRollupLogic.sol";
17
-
18
- struct Config {
19
- uint64 confirmPeriodBlocks;
20
- uint64 extraChallengeTimeBlocks;
21
- address stakeToken;
22
- uint256 baseStake;
23
- bytes32 wasmModuleRoot;
24
- address owner;
25
- address loserStakeEscrow;
26
- uint256 chainId;
27
- uint64 genesisBlockNum;
28
- ISequencerInbox.MaxTimeVariation sequencerInboxMaxTimeVariation;
29
- }
30
-
31
- struct ContractDependencies {
32
- IBridge bridge;
33
- ISequencerInbox sequencerInbox;
34
- IInbox inbox;
35
- IOutbox outbox;
36
- IRollupEventInbox rollupEventInbox;
37
- IChallengeManager challengeManager;
38
- IRollupAdmin rollupAdminLogic;
39
- IRollupUser rollupUserLogic;
40
- // misc contracts that are useful when interacting with the rollup
41
- address validatorUtils;
42
- address validatorWalletCreator;
43
- }
44
17
 
45
18
  library RollupLib {
46
19
  using GlobalStateLib for GlobalState;
47
20
 
48
- struct ExecutionState {
49
- GlobalState globalState;
50
- MachineStatus machineStatus;
51
- }
52
-
53
21
  function stateHash(ExecutionState calldata execState, uint256 inboxMaxCount)
54
22
  internal
55
23
  pure
@@ -81,12 +49,6 @@ library RollupLib {
81
49
  );
82
50
  }
83
51
 
84
- struct Assertion {
85
- ExecutionState beforeState;
86
- ExecutionState afterState;
87
- uint64 numBlocks;
88
- }
89
-
90
52
  function executionHash(Assertion memory assertion) internal pure returns (bytes32) {
91
53
  MachineStatus[2] memory statuses;
92
54
  statuses[0] = assertion.beforeState.machineStatus;
@@ -1,20 +1,35 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;
6
6
 
7
7
  import "../libraries/AdminFallbackProxy.sol";
8
- import "./IRollupLogic.sol";
8
+ import "./IRollupAdmin.sol";
9
+ import "./Config.sol";
9
10
 
10
11
  contract RollupProxy is AdminFallbackProxy {
11
- constructor(Config memory config, ContractDependencies memory connectedContracts)
12
- AdminFallbackProxy(
13
- address(connectedContracts.rollupAdminLogic),
14
- abi.encodeWithSelector(IRollupAdmin.initialize.selector, config, connectedContracts),
15
- address(connectedContracts.rollupUserLogic),
16
- abi.encodeWithSelector(IRollupUserAbs.initialize.selector, config.stakeToken),
17
- config.owner
18
- )
19
- {}
12
+ function initializeProxy(Config memory config, ContractDependencies memory connectedContracts)
13
+ external
14
+ {
15
+ if (
16
+ _getAdmin() == address(0) &&
17
+ _getImplementation() == address(0) &&
18
+ _getSecondaryImplementation() == address(0)
19
+ ) {
20
+ _initialize(
21
+ address(connectedContracts.rollupAdminLogic),
22
+ abi.encodeWithSelector(
23
+ IRollupAdmin.initialize.selector,
24
+ config,
25
+ connectedContracts
26
+ ),
27
+ address(connectedContracts.rollupUserLogic),
28
+ abi.encodeWithSelector(IRollupUserAbs.initialize.selector, config.stakeToken),
29
+ config.owner
30
+ );
31
+ } else {
32
+ _fallback();
33
+ }
34
+ }
20
35
  }
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;
@@ -9,6 +9,8 @@ import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
9
9
  import {IRollupUser} from "./IRollupLogic.sol";
10
10
  import "../libraries/UUPSNotUpgradeable.sol";
11
11
  import "./RollupCore.sol";
12
+ import "./IRollupLogic.sol";
13
+
12
14
  import {ETH_POS_BLOCK_TIME} from "../libraries/Constants.sol";
13
15
 
14
16
  abstract contract AbsRollupUserLogic is
@@ -189,7 +191,7 @@ abstract contract AbsRollupUserLogic is
189
191
  * @param expectedNodeHash The hash of the node being created (protects against reorgs)
190
192
  */
191
193
  function stakeOnNewNode(
192
- RollupLib.Assertion calldata assertion,
194
+ Assertion calldata assertion,
193
195
  bytes32 expectedNodeHash,
194
196
  uint256 prevNodeInboxMaxCount
195
197
  ) public onlyValidator whenNotPaused {
@@ -632,7 +634,7 @@ contract RollupUserLogic is AbsRollupUserLogic, IRollupUser {
632
634
  * @param prevNodeInboxMaxCount Total of messages in the inbox as of the previous node
633
635
  */
634
636
  function newStakeOnNewNode(
635
- RollupLib.Assertion calldata assertion,
637
+ Assertion calldata assertion,
636
638
  bytes32 expectedNodeHash,
637
639
  uint256 prevNodeInboxMaxCount
638
640
  ) external payable override {
@@ -701,7 +703,7 @@ contract ERC20RollupUserLogic is AbsRollupUserLogic, IRollupUserERC20 {
701
703
  */
702
704
  function newStakeOnNewNode(
703
705
  uint256 tokenAmount,
704
- RollupLib.Assertion calldata assertion,
706
+ Assertion calldata assertion,
705
707
  bytes32 expectedNodeHash,
706
708
  uint256 prevNodeInboxMaxCount
707
709
  ) external override {
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;
@@ -8,6 +8,7 @@ pragma experimental ABIEncoderV2;
8
8
 
9
9
  import "../rollup/IRollupCore.sol";
10
10
  import "../challenge/IChallengeManager.sol";
11
+ import "./IRollupLogic.sol";
11
12
 
12
13
  import {NO_CHAL_INDEX} from "../libraries/Constants.sol";
13
14
 
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;
@@ -10,7 +10,7 @@ import "./Machine.sol";
10
10
  import "./Instructions.sol";
11
11
  import "./StackFrame.sol";
12
12
  import "./MerkleProof.sol";
13
- import "./ModuleMemory.sol";
13
+ import "./ModuleMemoryCompact.sol";
14
14
  import "./Module.sol";
15
15
  import "./GlobalState.sol";
16
16
 
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;
@@ -1,10 +1,10 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;
6
6
 
7
- import "./ModuleMemory.sol";
7
+ import "./ModuleMemoryCompact.sol";
8
8
 
9
9
  struct Module {
10
10
  bytes32 globalsMerkleRoot;
@@ -15,7 +15,7 @@ struct Module {
15
15
  }
16
16
 
17
17
  library ModuleLib {
18
- using ModuleMemoryLib for ModuleMemory;
18
+ using ModuleMemoryCompactLib for ModuleMemory;
19
19
 
20
20
  function hash(Module memory mod) internal pure returns (bytes32) {
21
21
  return
@@ -1,23 +1,18 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;
6
6
 
7
7
  import "./MerkleProof.sol";
8
8
  import "./Deserialize.sol";
9
-
10
- struct ModuleMemory {
11
- uint64 size;
12
- uint64 maxSize;
13
- bytes32 merkleRoot;
14
- }
9
+ import "./ModuleMemoryCompact.sol";
15
10
 
16
11
  library ModuleMemoryLib {
17
12
  using MerkleProofLib for MerkleProof;
18
13
 
19
14
  function hash(ModuleMemory memory mem) internal pure returns (bytes32) {
20
- return keccak256(abi.encodePacked("Memory:", mem.size, mem.maxSize, mem.merkleRoot));
15
+ return ModuleMemoryCompactLib.hash(mem);
21
16
  }
22
17
 
23
18
  function proveLeaf(
@@ -0,0 +1,17 @@
1
+ // Copyright 2021-2022, Offchain Labs, Inc.
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
+ // SPDX-License-Identifier: BUSL-1.1
4
+
5
+ pragma solidity ^0.8.0;
6
+
7
+ struct ModuleMemory {
8
+ uint64 size;
9
+ uint64 maxSize;
10
+ bytes32 merkleRoot;
11
+ }
12
+
13
+ library ModuleMemoryCompactLib {
14
+ function hash(ModuleMemory memory mem) internal pure returns (bytes32) {
15
+ return keccak256(abi.encodePacked("Memory:", mem.size, mem.maxSize, mem.merkleRoot));
16
+ }
17
+ }
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.4;
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  // solhint-disable-next-line compiler-version
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.4;
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.4;
@@ -1,5 +1,5 @@
1
1
  // Copyright 2021-2022, Offchain Labs, Inc.
2
- // For license information, see https://github.com/nitro/blob/master/LICENSE
2
+ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
5
5
  pragma solidity ^0.8.0;