@arbitrum/nitro-contracts 1.0.2 → 1.0.3-beta.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +114 -0
- package/README.md +2 -2
- package/package.json +2 -2
- package/src/bridge/Bridge.sol +3 -3
- package/src/bridge/IBridge.sol +1 -1
- package/src/bridge/IDelayedMessageProvider.sol +1 -1
- package/src/bridge/IInbox.sol +1 -1
- package/src/bridge/IOutbox.sol +1 -1
- package/src/bridge/IOwnable.sol +1 -1
- package/src/bridge/ISequencerInbox.sol +22 -4
- package/src/bridge/Inbox.sol +2 -2
- package/src/bridge/Messages.sol +1 -1
- package/src/bridge/Outbox.sol +1 -1
- package/src/bridge/SequencerInbox.sol +9 -1
- package/src/challenge/ChallengeLib.sol +1 -1
- package/src/challenge/ChallengeManager.sol +1 -1
- package/src/challenge/IChallengeManager.sol +1 -1
- package/src/challenge/IChallengeResultReceiver.sol +1 -1
- package/src/libraries/AddressAliasHelper.sol +1 -1
- package/src/libraries/AdminFallbackProxy.sol +3 -3
- package/src/libraries/Constants.sol +1 -1
- package/src/libraries/CryptographyPrimitives.sol +1 -1
- package/src/libraries/DelegateCallAware.sol +1 -1
- package/src/libraries/DoubleLogicUUPSUpgradeable.sol +1 -1
- package/src/libraries/Error.sol +1 -1
- package/src/libraries/IGasRefunder.sol +2 -5
- package/src/libraries/MerkleLib.sol +1 -1
- package/src/libraries/MessageTypes.sol +1 -1
- package/src/mocks/BridgeStub.sol +2 -2
- package/src/mocks/BridgeUnproxied.sol +1 -1
- package/src/mocks/InboxStub.sol +1 -1
- package/src/mocks/MockResultReceiver.sol +1 -1
- package/src/mocks/ProxyAdminForBinding.sol +1 -1
- package/src/mocks/SequencerInboxStub.sol +1 -1
- package/src/mocks/Simple.sol +5 -1
- package/src/mocks/SimpleProxy.sol +1 -1
- package/src/mocks/SingleExecutionChallenge.sol +1 -1
- package/src/mocks/TimedOutChallengeManager.sol +1 -1
- package/src/node-interface/NodeInterface.sol +4 -2
- package/src/node-interface/NodeInterfaceDebug.sol +1 -1
- package/src/osp/HashProofHelper.sol +1 -1
- package/src/osp/IOneStepProofEntry.sol +1 -1
- package/src/osp/IOneStepProver.sol +2 -1
- package/src/osp/OneStepProofEntry.sol +1 -1
- package/src/osp/OneStepProver0.sol +1 -1
- package/src/osp/OneStepProverHostIo.sol +2 -1
- package/src/osp/OneStepProverMath.sol +1 -1
- package/src/osp/OneStepProverMemory.sol +2 -1
- package/src/precompiles/ArbAddressTable.sol +1 -1
- package/src/precompiles/ArbAggregator.sol +1 -1
- package/src/precompiles/ArbBLS.sol +1 -1
- package/src/precompiles/ArbDebug.sol +1 -1
- package/src/precompiles/ArbFunctionTable.sol +1 -1
- package/src/precompiles/ArbGasInfo.sol +1 -1
- package/src/precompiles/ArbInfo.sol +1 -1
- package/src/precompiles/ArbOwner.sol +4 -1
- package/src/precompiles/ArbOwnerPublic.sol +1 -1
- package/src/precompiles/ArbRetryableTx.sol +1 -1
- package/src/precompiles/ArbStatistics.sol +1 -1
- package/src/precompiles/ArbSys.sol +1 -1
- package/src/precompiles/ArbosTest.sol +1 -1
- package/src/rollup/BridgeCreator.sol +1 -1
- package/src/rollup/Config.sol +43 -0
- package/src/rollup/IRollupAdmin.sol +138 -0
- package/src/rollup/IRollupCore.sol +16 -3
- package/src/rollup/IRollupEventInbox.sol +2 -2
- package/src/rollup/IRollupLogic.sol +4 -132
- package/src/rollup/Node.sol +15 -1
- package/src/rollup/RollupAdminLogic.sol +7 -9
- package/src/rollup/RollupCore.sol +46 -3
- package/src/rollup/RollupCreator.sol +33 -45
- package/src/rollup/RollupEventInbox.sol +8 -3
- package/src/rollup/RollupLib.sol +2 -40
- package/src/rollup/RollupProxy.sol +26 -11
- package/src/rollup/RollupUserLogic.sol +6 -4
- package/src/rollup/ValidatorUtils.sol +2 -1
- package/src/rollup/ValidatorWallet.sol +1 -1
- package/src/rollup/ValidatorWalletCreator.sol +1 -1
- package/src/state/Deserialize.sol +2 -2
- package/src/state/GlobalState.sol +1 -1
- package/src/state/Instructions.sol +1 -1
- package/src/state/Machine.sol +1 -1
- package/src/state/MerkleProof.sol +1 -1
- package/src/state/Module.sol +3 -3
- package/src/state/ModuleMemory.sol +3 -8
- package/src/state/ModuleMemoryCompact.sol +17 -0
- package/src/state/PcArray.sol +1 -1
- package/src/state/StackFrame.sol +1 -1
- package/src/state/Value.sol +1 -1
- package/src/state/ValueArray.sol +1 -1
- package/src/state/ValueStack.sol +1 -1
- package/src/test-helpers/BridgeTester.sol +1 -1
- package/src/test-helpers/CryptographyPrimitivesTester.sol +1 -1
- package/src/test-helpers/InterfaceCompatibilityTester.sol +1 -1
- package/src/test-helpers/MessageTester.sol +1 -1
- package/src/test-helpers/OutboxWithoutOptTester.sol +1 -1
- package/src/test-helpers/RollupMock.sol +1 -1
- 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/
|
16
|
-
cd
|
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.
|
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
|
},
|
package/src/bridge/Bridge.sol
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// Copyright 2021-2022, Offchain Labs, Inc.
|
2
|
-
// For license information, see https://github.com/nitro/blob/
|
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 (
|
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 (
|
255
|
+
if (alreadyEnabled == enabled) {
|
256
256
|
return;
|
257
257
|
}
|
258
258
|
if (enabled) {
|
package/src/bridge/IBridge.sol
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// Copyright 2021-2022, Offchain Labs, Inc.
|
2
|
-
// For license information, see https://github.com/nitro/blob/
|
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/
|
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
|
package/src/bridge/IInbox.sol
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// Copyright 2021-2022, Offchain Labs, Inc.
|
2
|
-
// For license information, see https://github.com/nitro/blob/
|
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
|
package/src/bridge/IOutbox.sol
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// Copyright 2021-2022, Offchain Labs, Inc.
|
2
|
-
// For license information, see https://github.com/nitro/blob/
|
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
|
package/src/bridge/IOwnable.sol
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// Copyright 2021-2022, Offchain Labs, Inc.
|
2
|
-
// For license information, see https://github.com/nitro/blob/
|
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/
|
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
|
-
|
78
|
-
|
79
|
-
|
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;
|
package/src/bridge/Inbox.sol
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// Copyright 2021-2022, Offchain Labs, Inc.
|
2
|
-
// For license information, see https://github.com/nitro/blob/
|
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.
|
355
|
+
abi.encodeWithSelector(ArbSys.withdrawEth.selector, withdrawTo)
|
356
356
|
)
|
357
357
|
);
|
358
358
|
}
|
package/src/bridge/Messages.sol
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// Copyright 2021-2022, Offchain Labs, Inc.
|
2
|
-
// For license information, see https://github.com/nitro/blob/
|
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;
|
package/src/bridge/Outbox.sol
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// Copyright 2021-2022, Offchain Labs, Inc.
|
2
|
-
// For license information, see https://github.com/nitro/blob/
|
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/
|
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/
|
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/
|
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/
|
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/
|
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/
|
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/
|
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
|
-
|
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
|
-
)
|
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/
|
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/
|
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/
|
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/
|
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;
|
package/src/libraries/Error.sol
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// Copyright 2021-2022, Offchain Labs, Inc.
|
2
|
-
// For license information, see https://github.com/nitro/blob/
|
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/
|
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/
|
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/
|
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;
|
package/src/mocks/BridgeStub.sol
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// Copyright 2021-2022, Offchain Labs, Inc.
|
2
|
-
// For license information, see https://github.com/nitro/blob/
|
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 (
|
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/
|
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;
|
package/src/mocks/InboxStub.sol
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// Copyright 2021-2022, Offchain Labs, Inc.
|
2
|
-
// For license information, see https://github.com/nitro/blob/
|
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/
|
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/
|
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/
|
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;
|
package/src/mocks/Simple.sol
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// Copyright 2021-2022, Offchain Labs, Inc.
|
2
|
-
// For license information, see https://github.com/nitro/blob/
|
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/
|
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/
|
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/
|
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/
|
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
|
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/
|
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/
|
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/
|
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/
|
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
|
|