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

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 (98) hide show
  1. package/LICENSE +114 -0
  2. package/README.md +2 -2
  3. package/package.json +2 -2
  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
package/LICENSE ADDED
@@ -0,0 +1,114 @@
1
+ Business Source License 1.1
2
+
3
+ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
4
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
5
+
6
+ -----------------------------------------------------------------------------
7
+
8
+ Parameters
9
+
10
+ Licensor: Offchain Labs
11
+
12
+ Licensed Work: Arbitrum Nitro Contracts
13
+ The Licensed Work is (c) 2021-2023 Offchain Labs
14
+
15
+ Additional Use Grant: You may use the Licensed Work in a production environment solely
16
+ to provide a point of interface to permit end users or applications
17
+ utilizing the Covered Arbitrum Chains to interact and query the
18
+ state of a Covered Arbitrum Chain, including without limitation
19
+ validating the correctness of the posted chain state. For purposes
20
+ of this Additional Use Grant, the "Covered Arbitrum Chains" are
21
+ means (a) Arbitrum One (chainid:42161), Arbitrum Nova (chainid:42170),
22
+ Arbitrum Rinkeby testnet/Rinkarby (chainid:421611), and
23
+ Arbitrum Nitro Goerli testnet (chainid:421613) (b) any future
24
+ blockchains authorized to be designated as Covered Arbitrum Chains
25
+ by the decentralized autonomous organization governing the Arbitrum
26
+ network; and (c) any “Layer 3” Arbitrum-based blockchain that is built
27
+ on and settles to another Covered Arbitrum Chain.
28
+
29
+
30
+
31
+
32
+
33
+ Change Date: Dec 31, 2027
34
+
35
+ Change License: Apache License Version 2.0
36
+
37
+ -----------------------------------------------------------------------------
38
+
39
+ Terms
40
+
41
+ The Licensor hereby grants you the right to copy, modify, create derivative
42
+ works, redistribute, and make non-production use of the Licensed Work. The
43
+ Licensor may make an Additional Use Grant, above, permitting limited
44
+ production use.
45
+
46
+ Effective on the Change Date, or the fourth anniversary of the first publicly
47
+ available distribution of a specific version of the Licensed Work under this
48
+ License, whichever comes first, the Licensor hereby grants you rights under
49
+ the terms of the Change License, and the rights granted in the paragraph
50
+ above terminate.
51
+
52
+ If your use of the Licensed Work does not comply with the requirements
53
+ currently in effect as described in this License, you must purchase a
54
+ commercial license from the Licensor, its affiliated entities, or authorized
55
+ resellers, or you must refrain from using the Licensed Work.
56
+
57
+ All copies of the original and modified Licensed Work, and derivative works
58
+ of the Licensed Work, are subject to this License. This License applies
59
+ separately for each version of the Licensed Work and the Change Date may vary
60
+ for each version of the Licensed Work released by Licensor.
61
+
62
+ You must conspicuously display this License on each original or modified copy
63
+ of the Licensed Work. If you receive the Licensed Work in original or
64
+ modified form from a third party, the terms and conditions set forth in this
65
+ License apply to your use of that work.
66
+
67
+ Any use of the Licensed Work in violation of this License will automatically
68
+ terminate your rights under this License for the current and all other
69
+ versions of the Licensed Work.
70
+
71
+ This License does not grant you any right in any trademark or logo of
72
+ Licensor or its affiliates (provided that you may use a trademark or logo of
73
+ Licensor as expressly required by this License).
74
+
75
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
76
+ AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
77
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
78
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
79
+ TITLE.
80
+
81
+ MariaDB hereby grants you permission to use this License’s text to license
82
+ your works, and to refer to it using the trademark "Business Source License",
83
+ as long as you comply with the Covenants of Licensor below.
84
+
85
+ -----------------------------------------------------------------------------
86
+
87
+ Covenants of Licensor
88
+
89
+ In consideration of the right to use this License’s text and the "Business
90
+ Source License" name and trademark, Licensor covenants to MariaDB, and to all
91
+ other recipients of the licensed work to be provided by Licensor:
92
+
93
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
94
+ or a license that is compatible with GPL Version 2.0 or a later version,
95
+ where "compatible" means that software provided under the Change License can
96
+ be included in a program with software provided under GPL Version 2.0 or a
97
+ later version. Licensor may specify additional Change Licenses without
98
+ limitation.
99
+
100
+ 2. To either: (a) specify an additional grant of rights to use that does not
101
+ impose any additional restriction on the right granted in this License, as
102
+ the Additional Use Grant; or (b) insert the text "None".
103
+
104
+ 3. To specify a Change Date.
105
+
106
+ 4. Not to modify this License in any other way.
107
+
108
+ -----------------------------------------------------------------------------
109
+
110
+ Notice
111
+
112
+ The Business Source License (this document, or the "License") is not an Open
113
+ Source license. However, the Licensed Work will eventually be made available
114
+ under an Open Source License, as stated in this License.
package/README.md CHANGED
@@ -12,8 +12,8 @@ For the token bridge contracts see https://github.com/OffchainLabs/token-bridge-
12
12
  Compile these contracts locally by running
13
13
 
14
14
  ```bash
15
- git clone https://github.com/offchainlabs/rollup-contracts
16
- cd rollup-contracts
15
+ git clone https://github.com/offchainlabs/nitro-contracts
16
+ cd nitro-contracts
17
17
  yarn install
18
18
  yarn build
19
19
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arbitrum/nitro-contracts",
3
- "version": "1.0.2",
3
+ "version": "1.0.3-beta.0",
4
4
  "description": "Layer 2 precompiles and rollup for Arbitrum Nitro",
5
5
  "author": "Offchain Labs, Inc.",
6
6
  "license": "BUSL-1.1",
@@ -60,8 +60,8 @@
60
60
  "solhint": "^3.3.7",
61
61
  "solhint-plugin-prettier": "^0.0.5",
62
62
  "solidity-coverage": "^0.7.20",
63
- "tslint": "^6.1.3",
64
63
  "ts-node": "^10.4.0",
64
+ "tslint": "^6.1.3",
65
65
  "typechain": "^8.0.0",
66
66
  "typescript": "^4.5.4"
67
67
  },
@@ -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;
@@ -230,7 +230,7 @@ contract Bridge is Initializable, DelegateCallAware, IBridge {
230
230
  InOutInfo storage info = allowedDelayedInboxesMap[inbox];
231
231
  bool alreadyEnabled = info.allowed;
232
232
  emit InboxToggle(inbox, enabled);
233
- if ((alreadyEnabled && enabled) || (!alreadyEnabled && !enabled)) {
233
+ if (alreadyEnabled == enabled) {
234
234
  return;
235
235
  }
236
236
  if (enabled) {
@@ -252,7 +252,7 @@ contract Bridge is Initializable, DelegateCallAware, IBridge {
252
252
  InOutInfo storage info = allowedOutboxesMap[outbox];
253
253
  bool alreadyEnabled = info.allowed;
254
254
  emit OutboxToggle(outbox, enabled);
255
- if ((alreadyEnabled && enabled) || (!alreadyEnabled && !enabled)) {
255
+ if (alreadyEnabled == enabled) {
256
256
  return;
257
257
  }
258
258
  if (enabled) {
@@ -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
  // 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
  // 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
  // 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
  // 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
  // solhint-disable-next-line compiler-version
@@ -69,14 +69,24 @@ interface ISequencerInbox is IDelayedMessageProvider {
69
69
 
70
70
  function isBatchPoster(address) external view returns (bool);
71
71
 
72
+ function isSequencer(address) external view returns (bool);
73
+
72
74
  struct DasKeySetInfo {
73
75
  bool isValidKeyset;
74
76
  uint64 creationBlock;
75
77
  }
76
78
 
77
- // https://github.com/ethereum/solidity/issues/11826
78
- // function maxTimeVariation() external view returns (MaxTimeVariation calldata);
79
- // function dasKeySetInfo(bytes32) external view returns (DasKeySetInfo calldata);
79
+ function maxTimeVariation()
80
+ external
81
+ view
82
+ returns (
83
+ uint256,
84
+ uint256,
85
+ uint256,
86
+ uint256
87
+ );
88
+
89
+ function dasKeySetInfo(bytes32) external view returns (bool, uint64);
80
90
 
81
91
  /// @notice Remove force inclusion delay after a L1 chainId fork
82
92
  function removeDelayAfterFork() external;
@@ -154,6 +164,14 @@ interface ISequencerInbox is IDelayedMessageProvider {
154
164
  */
155
165
  function invalidateKeysetHash(bytes32 ksHash) external;
156
166
 
167
+ /**
168
+ * @notice Updates whether an address is authorized to be a sequencer.
169
+ * @dev The IsSequencer information is used only off-chain by the nitro node to validate sequencer feed signer.
170
+ * @param addr the address
171
+ * @param isSequencer_ if the specified address should be authorized as a sequencer
172
+ */
173
+ function setIsSequencer(address addr, bool isSequencer_) external;
174
+
157
175
  // ---------- initializer ----------
158
176
 
159
177
  function initialize(IBridge bridge_, MaxTimeVariation calldata maxTimeVariation_) external;
@@ -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;
@@ -352,7 +352,7 @@ contract Inbox is DelegateCallAware, PausableUpgradeable, IInbox {
352
352
  nonce,
353
353
  uint256(uint160(address(100))), // ArbSys address
354
354
  value,
355
- abi.encode(ArbSys.withdrawEth.selector, withdrawTo)
355
+ abi.encodeWithSelector(ArbSys.withdrawEth.selector, withdrawTo)
356
356
  )
357
357
  );
358
358
  }
@@ -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;
@@ -64,6 +64,8 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
64
64
 
65
65
  uint256 internal immutable deployTimeChainId = block.chainid;
66
66
 
67
+ mapping(address => bool) public isSequencer;
68
+
67
69
  function _chainIdChanged() internal view returns (bool) {
68
70
  return deployTimeChainId != block.chainid;
69
71
  }
@@ -450,6 +452,12 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
450
452
  emit OwnerFunctionCalled(3);
451
453
  }
452
454
 
455
+ /// @inheritdoc ISequencerInbox
456
+ function setIsSequencer(address addr, bool isSequencer_) external onlyRollupOwner {
457
+ isSequencer[addr] = isSequencer_;
458
+ emit OwnerFunctionCalled(4);
459
+ }
460
+
453
461
  function isValidKeysetHash(bytes32 ksHash) external view returns (bool) {
454
462
  return dasKeySetInfo[ksHash].isValidKeyset;
455
463
  }
@@ -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.0;
@@ -107,13 +107,13 @@ contract AdminFallbackProxy is Proxy, DoubleLogicERC1967Upgrade {
107
107
  * Only the `adminAddr` is able to use the `adminLogic` functions
108
108
  * All other addresses can interact with the `userLogic` functions
109
109
  */
110
- constructor(
110
+ function _initialize(
111
111
  address adminLogic,
112
112
  bytes memory adminData,
113
113
  address userLogic,
114
114
  bytes memory userData,
115
115
  address adminAddr
116
- ) payable {
116
+ ) internal {
117
117
  assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
118
118
  assert(
119
119
  _IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 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.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
  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
  // solhint-disable-next-line compiler-version
@@ -21,10 +21,7 @@ abstract contract GasRefundEnabled {
21
21
  uint256 startGasLeft = gasleft();
22
22
  _;
23
23
  if (address(gasRefunder) != address(0)) {
24
- uint256 calldataSize;
25
- assembly {
26
- calldataSize := calldatasize()
27
- }
24
+ uint256 calldataSize = msg.data.length;
28
25
  uint256 calldataWords = (calldataSize + 31) / 32;
29
26
  // account for the CALLDATACOPY cost of the proxy contract, including the memory expansion cost
30
27
  startGasLeft += calldataWords * 6 + (calldataWords**2) / 512;
@@ -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;
@@ -139,7 +139,7 @@ contract BridgeStub is IBridge {
139
139
  InOutInfo storage info = allowedDelayedInboxesMap[inbox];
140
140
  bool alreadyEnabled = info.allowed;
141
141
  emit InboxToggle(inbox, enabled);
142
- if ((alreadyEnabled && enabled) || (!alreadyEnabled && !enabled)) {
142
+ if (alreadyEnabled == enabled) {
143
143
  return;
144
144
  }
145
145
  if (enabled) {
@@ -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.0;
@@ -43,6 +43,10 @@ contract Simple {
43
43
  return block.number;
44
44
  }
45
45
 
46
+ function getBlockDifficulty() external view returns (uint256) {
47
+ return block.difficulty;
48
+ }
49
+
46
50
  function noop() external pure {}
47
51
 
48
52
  function pleaseRevert() external pure {
@@ -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.4.21 <0.9.0;
@@ -98,8 +98,10 @@ interface NodeInterface {
98
98
  /**
99
99
  * @notice Estimates a transaction's l1 costs.
100
100
  * @dev Use eth_call to call.
101
- * This method is exactly like gasEstimateComponents, but doesn't include the l2 component
101
+ * This method is similar to gasEstimateComponents, but doesn't include the l2 component
102
102
  * so that the l1 component can be known even when the tx may fail.
103
+ * This method also doesn't pad the estimate as gas estimation normally does.
104
+ * If using this value to submit a transaction, we'd recommend first padding it by 10%.
103
105
  * @param data the tx's calldata. Everything else like "From" and "Gas" are copied over
104
106
  * @param to the tx's "To" (ignored when contractCreation is true)
105
107
  * @param contractCreation whether "To" is omitted
@@ -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.4.21 <0.9.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;
@@ -7,6 +7,7 @@ pragma solidity ^0.8.0;
7
7
  import "../state/Machine.sol";
8
8
  import "../state/Module.sol";
9
9
  import "../state/Instructions.sol";
10
+ import "../state/GlobalState.sol";
10
11
  import "../bridge/ISequencerInbox.sol";
11
12
  import "../bridge/IBridge.sol";
12
13