@arbitrum/nitro-contracts 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +9 -5
- package/package.json +6 -10
- package/src/challenge/ChallengeManager.sol +1 -1
- package/src/mocks/InboxStub.sol +2 -2
- package/src/mocks/ProxyAdminForBinding.sol +9 -0
- package/src/mocks/Simple.sol +14 -0
- package/src/mocks/TimedOutChallengeManager.sol +13 -0
- package/src/precompiles/ArbDebug.sol +7 -2
- package/src/precompiles/ArbSys.sol +2 -0
- package/hardhat.prod-config.js +0 -18
- package/scripts/build.bash +0 -5
- /package/src/mocks/{ExecutionManager.sol → SingleExecutionChallenge.sol} +0 -0
package/README.md
CHANGED
@@ -1,15 +1,19 @@
|
|
1
|
-
# Arbitrum Nitro Contracts
|
1
|
+
# Arbitrum Nitro Rollup Contracts
|
2
2
|
|
3
3
|
This is the package with the smart contract code that powers Arbitrum Nitro.
|
4
4
|
It includes the rollup and fraud proof smart contracts, as well as interfaces for interacting with precompiles.
|
5
5
|
|
6
|
-
For more information see https://developer.arbitrum.io/
|
6
|
+
For more information see https://developer.arbitrum.io/intro
|
7
7
|
|
8
|
-
|
8
|
+
For the deployed addresses of these contracts for Arbitrum chains see https://developer.arbitrum.io/useful-addresses
|
9
|
+
|
10
|
+
For the token bridge contracts see https://github.com/OffchainLabs/token-bridge-contracts
|
11
|
+
|
12
|
+
Compile these contracts locally by running
|
9
13
|
|
10
14
|
```bash
|
11
|
-
git clone https://github.com/offchainlabs/
|
12
|
-
cd
|
15
|
+
git clone https://github.com/offchainlabs/rollup-contracts
|
16
|
+
cd rollup-contracts
|
13
17
|
yarn install
|
14
18
|
yarn build
|
15
19
|
```
|
package/package.json
CHANGED
@@ -1,29 +1,25 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arbitrum/nitro-contracts",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.2",
|
4
4
|
"description": "Layer 2 precompiles and rollup for Arbitrum Nitro",
|
5
5
|
"author": "Offchain Labs, Inc.",
|
6
6
|
"license": "BUSL-1.1",
|
7
7
|
"repository": {
|
8
8
|
"type": "git",
|
9
|
-
"url": "git+https://github.com/offchainlabs/nitro.git"
|
10
|
-
"directory": "contracts"
|
9
|
+
"url": "git+https://github.com/offchainlabs/nitro-contracts.git"
|
11
10
|
},
|
12
11
|
"files": [
|
13
|
-
"src/"
|
14
|
-
"scripts/build.bash",
|
15
|
-
"hardhat.prod-config.js"
|
12
|
+
"src/"
|
16
13
|
],
|
17
14
|
"bugs": {
|
18
|
-
"url": "https://github.com/offchainlabs/nitro/issues"
|
15
|
+
"url": "https://github.com/offchainlabs/nitro-contracts/issues"
|
19
16
|
},
|
20
17
|
"scripts": {
|
21
|
-
"build": "
|
18
|
+
"build": "hardhat compile",
|
22
19
|
"lint:test": "eslint ./test",
|
23
20
|
"solhint": "solhint -f table src/**/*.sol",
|
24
21
|
"prettier:solidity": "prettier --write src/**/*.sol",
|
25
22
|
"format": "prettier './**/*.{js,json,md,ts,yml,sol}' --write && yarn run lint:test --fix",
|
26
|
-
"hardhat:prod": "hardhat --config hardhat.prod-config.js",
|
27
23
|
"build:0.6": "INTERFACE_TESTER_SOLC_VERSION=0.6.9 yarn run build",
|
28
24
|
"build:0.7": "INTERFACE_TESTER_SOLC_VERSION=0.7.0 yarn run build",
|
29
25
|
"test:compatibility": "yarn run build:0.6 && yarn run build:0.7",
|
@@ -33,7 +29,6 @@
|
|
33
29
|
"dependencies": {
|
34
30
|
"@openzeppelin/contracts": "4.5.0",
|
35
31
|
"@openzeppelin/contracts-upgradeable": "4.5.2",
|
36
|
-
"hardhat": "^2.6.6",
|
37
32
|
"patch-package": "^6.4.7"
|
38
33
|
},
|
39
34
|
"private": false,
|
@@ -56,6 +51,7 @@
|
|
56
51
|
"eslint-plugin-prettier": "^4.0.0",
|
57
52
|
"ethereum-waffle": "^3.4.0",
|
58
53
|
"ethers": "^5.5.2",
|
54
|
+
"hardhat": "^2.6.6",
|
59
55
|
"hardhat-deploy": "^0.11.4",
|
60
56
|
"hardhat-gas-reporter": "^1.0.8",
|
61
57
|
"postinstall-postinstall": "^2.1.0",
|
@@ -285,7 +285,7 @@ contract ChallengeManager is DelegateCallAware, IChallengeManager {
|
|
285
285
|
return challenges[challengeIndex].current.addr;
|
286
286
|
}
|
287
287
|
|
288
|
-
function isTimedOut(uint64 challengeIndex) public view override returns (bool) {
|
288
|
+
function isTimedOut(uint64 challengeIndex) public view virtual override returns (bool) {
|
289
289
|
return challenges[challengeIndex].isTimedOut();
|
290
290
|
}
|
291
291
|
|
package/src/mocks/InboxStub.sol
CHANGED
@@ -151,7 +151,7 @@ contract InboxStub is IInbox {
|
|
151
151
|
address,
|
152
152
|
uint256,
|
153
153
|
bytes calldata
|
154
|
-
) external returns (uint256) {
|
154
|
+
) external pure returns (uint256) {
|
155
155
|
revert("NOT_IMPLEMENTED");
|
156
156
|
}
|
157
157
|
|
@@ -161,7 +161,7 @@ contract InboxStub is IInbox {
|
|
161
161
|
uint256,
|
162
162
|
uint256,
|
163
163
|
address
|
164
|
-
) external returns (uint256) {
|
164
|
+
) external pure returns (uint256) {
|
165
165
|
revert("NOT_IMPLEMENTED");
|
166
166
|
}
|
167
167
|
|
@@ -0,0 +1,9 @@
|
|
1
|
+
// Copyright 2021-2022, Offchain Labs, Inc.
|
2
|
+
// For license information, see https://github.com/nitro/blob/master/LICENSE
|
3
|
+
// SPDX-License-Identifier: BUSL-1.1
|
4
|
+
|
5
|
+
pragma solidity ^0.8.0;
|
6
|
+
|
7
|
+
import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
|
8
|
+
|
9
|
+
contract ProxyAdminForBinding is ProxyAdmin {}
|
package/src/mocks/Simple.sol
CHANGED
@@ -13,11 +13,17 @@ contract Simple {
|
|
13
13
|
event CounterEvent(uint64 count);
|
14
14
|
event RedeemedEvent(address caller, address redeemer);
|
15
15
|
event NullEvent();
|
16
|
+
event LogAndIncrementCalled(uint256 expected, uint256 have);
|
16
17
|
|
17
18
|
function increment() external {
|
18
19
|
counter++;
|
19
20
|
}
|
20
21
|
|
22
|
+
function logAndIncrement(uint256 expected) external {
|
23
|
+
emit LogAndIncrementCalled(expected, counter);
|
24
|
+
counter++;
|
25
|
+
}
|
26
|
+
|
21
27
|
function incrementEmit() external {
|
22
28
|
counter++;
|
23
29
|
emit CounterEvent(counter);
|
@@ -104,4 +110,12 @@ contract Simple {
|
|
104
110
|
(success, ) = address(this).call(data);
|
105
111
|
require(success, "CALL_FAILED");
|
106
112
|
}
|
113
|
+
|
114
|
+
function checkGasUsed(address to, bytes calldata input) external view returns (uint256) {
|
115
|
+
uint256 before = gasleft();
|
116
|
+
// The inner call may revert, but we still want to return the amount of gas used,
|
117
|
+
// so we ignore the result of this call.
|
118
|
+
(to.staticcall{gas: before - 10000}(input));
|
119
|
+
return before - gasleft();
|
120
|
+
}
|
107
121
|
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// Copyright 2021-2022, Offchain Labs, Inc.
|
2
|
+
// For license information, see https://github.com/nitro/blob/master/LICENSE
|
3
|
+
// SPDX-License-Identifier: BUSL-1.1
|
4
|
+
|
5
|
+
pragma solidity ^0.8.0;
|
6
|
+
|
7
|
+
import "../challenge/ChallengeManager.sol";
|
8
|
+
|
9
|
+
contract TimedOutChallengeManager is ChallengeManager {
|
10
|
+
function isTimedOut(uint64) public pure override returns (bool) {
|
11
|
+
return true;
|
12
|
+
}
|
13
|
+
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
// Copyright 2021-
|
2
|
-
// For license information, see https://github.com/nitro/blob/master/LICENSE
|
1
|
+
// Copyright 2021-2023, Offchain Labs, Inc.
|
2
|
+
// For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE
|
3
3
|
// SPDX-License-Identifier: BUSL-1.1
|
4
4
|
|
5
5
|
pragma solidity >=0.4.21 <0.9.0;
|
@@ -15,6 +15,9 @@ interface ArbDebug {
|
|
15
15
|
/// @notice Emit events with values based on the args provided
|
16
16
|
function events(bool flag, bytes32 value) external payable returns (address, uint256);
|
17
17
|
|
18
|
+
/// @notice Tries (and fails) to emit logs in a view context
|
19
|
+
function eventsView() external view;
|
20
|
+
|
18
21
|
// Events that exist for testing log creation and pricing
|
19
22
|
event Basic(bool flag, bytes32 indexed value);
|
20
23
|
event Mixed(
|
@@ -34,6 +37,8 @@ interface ArbDebug {
|
|
34
37
|
|
35
38
|
function customRevert(uint64 number) external pure;
|
36
39
|
|
40
|
+
function legacyError() external pure;
|
41
|
+
|
37
42
|
error Custom(uint64, string, bool);
|
38
43
|
error Unused();
|
39
44
|
}
|
package/hardhat.prod-config.js
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @type import('hardhat/config').HardhatUserConfig
|
3
|
-
*/
|
4
|
-
module.exports = {
|
5
|
-
solidity: {
|
6
|
-
version: '0.8.9',
|
7
|
-
settings: {
|
8
|
-
optimizer: {
|
9
|
-
enabled: true,
|
10
|
-
runs: 100,
|
11
|
-
},
|
12
|
-
},
|
13
|
-
},
|
14
|
-
paths: {
|
15
|
-
sources: './src',
|
16
|
-
artifacts: 'build/contracts',
|
17
|
-
},
|
18
|
-
}
|
package/scripts/build.bash
DELETED
File without changes
|