@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
@@ -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/Value.sol";
|
8
8
|
import "../state/Machine.sol";
|
9
9
|
import "../state/Deserialize.sol";
|
10
|
+
import "../state/ModuleMemory.sol";
|
10
11
|
import "./IOneStepProver.sol";
|
11
12
|
import "../bridge/Messages.sol";
|
12
13
|
import "../bridge/IBridge.sol";
|
@@ -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/Value.sol";
|
8
8
|
import "../state/Machine.sol";
|
9
9
|
import "../state/Deserialize.sol";
|
10
|
+
import "../state/ModuleMemory.sol";
|
10
11
|
import "./IOneStepProver.sol";
|
11
12
|
|
12
13
|
contract OneStepProverMemory is IOneStepProver {
|
@@ -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.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.4.21 <0.9.0;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
// Copyright 2021-2023, Offchain Labs, Inc.
|
2
|
-
// For license information, see https://github.com/OffchainLabs/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.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.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.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.4.21 <0.9.0;
|
@@ -84,6 +84,9 @@ interface ArbOwner {
|
|
84
84
|
/// @notice Releases surplus funds from L1PricerFundsPoolAddress for use
|
85
85
|
function releaseL1PricerSurplusFunds(uint256 maxWeiToRelease) external returns (uint256);
|
86
86
|
|
87
|
+
/// @notice Sets serialized chain config in ArbOS state
|
88
|
+
function setChainConfig(string calldata chainConfig) external;
|
89
|
+
|
87
90
|
// Emitted when a successful call is made to this precompile
|
88
91
|
event OwnerActs(bytes4 indexed method, address indexed owner, bytes data);
|
89
92
|
}
|
@@ -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.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.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.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.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;
|
@@ -0,0 +1,43 @@
|
|
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
|
+
import "../state/GlobalState.sol";
|
8
|
+
import "../state/Machine.sol";
|
9
|
+
import "../bridge/ISequencerInbox.sol";
|
10
|
+
import "../bridge/IBridge.sol";
|
11
|
+
import "../bridge/IOutbox.sol";
|
12
|
+
import "../bridge/IInbox.sol";
|
13
|
+
import "./IRollupEventInbox.sol";
|
14
|
+
import "./IRollupLogic.sol";
|
15
|
+
import "../challenge/IChallengeManager.sol";
|
16
|
+
|
17
|
+
struct Config {
|
18
|
+
uint64 confirmPeriodBlocks;
|
19
|
+
uint64 extraChallengeTimeBlocks;
|
20
|
+
address stakeToken;
|
21
|
+
uint256 baseStake;
|
22
|
+
bytes32 wasmModuleRoot;
|
23
|
+
address owner;
|
24
|
+
address loserStakeEscrow;
|
25
|
+
uint256 chainId;
|
26
|
+
string chainConfig;
|
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
|
+
address rollupAdminLogic;
|
39
|
+
IRollupUser rollupUserLogic;
|
40
|
+
// misc contracts that are useful when interacting with the rollup
|
41
|
+
address validatorUtils;
|
42
|
+
address validatorWalletCreator;
|
43
|
+
}
|
@@ -0,0 +1,138 @@
|
|
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
|
+
import "./IRollupCore.sol";
|
8
|
+
import "../bridge/ISequencerInbox.sol";
|
9
|
+
import "../bridge/IOutbox.sol";
|
10
|
+
import "../bridge/IOwnable.sol";
|
11
|
+
import "./Config.sol";
|
12
|
+
|
13
|
+
interface IRollupAdmin {
|
14
|
+
event OwnerFunctionCalled(uint256 indexed id);
|
15
|
+
|
16
|
+
function initialize(Config calldata config, ContractDependencies calldata connectedContracts)
|
17
|
+
external;
|
18
|
+
|
19
|
+
/**
|
20
|
+
* @notice Add a contract authorized to put messages into this rollup's inbox
|
21
|
+
* @param _outbox Outbox contract to add
|
22
|
+
*/
|
23
|
+
function setOutbox(IOutbox _outbox) external;
|
24
|
+
|
25
|
+
/**
|
26
|
+
* @notice Disable an old outbox from interacting with the bridge
|
27
|
+
* @param _outbox Outbox contract to remove
|
28
|
+
*/
|
29
|
+
function removeOldOutbox(address _outbox) external;
|
30
|
+
|
31
|
+
/**
|
32
|
+
* @notice Enable or disable an inbox contract
|
33
|
+
* @param _inbox Inbox contract to add or remove
|
34
|
+
* @param _enabled New status of inbox
|
35
|
+
*/
|
36
|
+
function setDelayedInbox(address _inbox, bool _enabled) external;
|
37
|
+
|
38
|
+
/**
|
39
|
+
* @notice Pause interaction with the rollup contract
|
40
|
+
*/
|
41
|
+
function pause() external;
|
42
|
+
|
43
|
+
/**
|
44
|
+
* @notice Resume interaction with the rollup contract
|
45
|
+
*/
|
46
|
+
function resume() external;
|
47
|
+
|
48
|
+
/**
|
49
|
+
* @notice Set the addresses of the validator whitelist
|
50
|
+
* @dev It is expected that both arrays are same length, and validator at
|
51
|
+
* position i corresponds to the value at position i
|
52
|
+
* @param _validator addresses to set in the whitelist
|
53
|
+
* @param _val value to set in the whitelist for corresponding address
|
54
|
+
*/
|
55
|
+
function setValidator(address[] memory _validator, bool[] memory _val) external;
|
56
|
+
|
57
|
+
/**
|
58
|
+
* @notice Set a new owner address for the rollup proxy
|
59
|
+
* @param newOwner address of new rollup owner
|
60
|
+
*/
|
61
|
+
function setOwner(address newOwner) external;
|
62
|
+
|
63
|
+
/**
|
64
|
+
* @notice Set minimum assertion period for the rollup
|
65
|
+
* @param newPeriod new minimum period for assertions
|
66
|
+
*/
|
67
|
+
function setMinimumAssertionPeriod(uint256 newPeriod) external;
|
68
|
+
|
69
|
+
/**
|
70
|
+
* @notice Set number of blocks until a node is considered confirmed
|
71
|
+
* @param newConfirmPeriod new number of blocks until a node is confirmed
|
72
|
+
*/
|
73
|
+
function setConfirmPeriodBlocks(uint64 newConfirmPeriod) external;
|
74
|
+
|
75
|
+
/**
|
76
|
+
* @notice Set number of extra blocks after a challenge
|
77
|
+
* @param newExtraTimeBlocks new number of blocks
|
78
|
+
*/
|
79
|
+
function setExtraChallengeTimeBlocks(uint64 newExtraTimeBlocks) external;
|
80
|
+
|
81
|
+
/**
|
82
|
+
* @notice Set base stake required for an assertion
|
83
|
+
* @param newBaseStake maximum avmgas to be used per block
|
84
|
+
*/
|
85
|
+
function setBaseStake(uint256 newBaseStake) external;
|
86
|
+
|
87
|
+
/**
|
88
|
+
* @notice Set the token used for stake, where address(0) == eth
|
89
|
+
* @dev Before changing the base stake token, you might need to change the
|
90
|
+
* implementation of the Rollup User logic!
|
91
|
+
* @param newStakeToken address of token used for staking
|
92
|
+
*/
|
93
|
+
function setStakeToken(address newStakeToken) external;
|
94
|
+
|
95
|
+
/**
|
96
|
+
* @notice Upgrades the implementation of a beacon controlled by the rollup
|
97
|
+
* @param beacon address of beacon to be upgraded
|
98
|
+
* @param newImplementation new address of implementation
|
99
|
+
*/
|
100
|
+
function upgradeBeacon(address beacon, address newImplementation) external;
|
101
|
+
|
102
|
+
function forceResolveChallenge(address[] memory stackerA, address[] memory stackerB) external;
|
103
|
+
|
104
|
+
function forceRefundStaker(address[] memory stacker) external;
|
105
|
+
|
106
|
+
function forceCreateNode(
|
107
|
+
uint64 prevNode,
|
108
|
+
uint256 prevNodeInboxMaxCount,
|
109
|
+
Assertion memory assertion,
|
110
|
+
bytes32 expectedNodeHash
|
111
|
+
) external;
|
112
|
+
|
113
|
+
function forceConfirmNode(
|
114
|
+
uint64 nodeNum,
|
115
|
+
bytes32 blockHash,
|
116
|
+
bytes32 sendRoot
|
117
|
+
) external;
|
118
|
+
|
119
|
+
function setLoserStakeEscrow(address newLoserStakerEscrow) external;
|
120
|
+
|
121
|
+
/**
|
122
|
+
* @notice Set the proving WASM module root
|
123
|
+
* @param newWasmModuleRoot new module root
|
124
|
+
*/
|
125
|
+
function setWasmModuleRoot(bytes32 newWasmModuleRoot) external;
|
126
|
+
|
127
|
+
/**
|
128
|
+
* @notice set a new sequencer inbox contract
|
129
|
+
* @param _sequencerInbox new address of sequencer inbox
|
130
|
+
*/
|
131
|
+
function setSequencerInbox(address _sequencerInbox) external;
|
132
|
+
|
133
|
+
/**
|
134
|
+
* @notice set the validatorWhitelistDisabled flag
|
135
|
+
* @param _validatorWhitelistDisabled new value of validatorWhitelistDisabled, i.e. true = disabled
|
136
|
+
*/
|
137
|
+
function setValidatorWhitelistDisabled(bool _validatorWhitelistDisabled) external;
|
138
|
+
}
|
@@ -1,11 +1,15 @@
|
|
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;
|
6
6
|
|
7
7
|
import "./Node.sol";
|
8
|
-
import "
|
8
|
+
import "../bridge/IBridge.sol";
|
9
|
+
import "../bridge/IOutbox.sol";
|
10
|
+
import "../bridge/IInbox.sol";
|
11
|
+
import "./IRollupEventInbox.sol";
|
12
|
+
import "../challenge/IChallengeManager.sol";
|
9
13
|
|
10
14
|
interface IRollupCore {
|
11
15
|
struct Staker {
|
@@ -24,7 +28,7 @@ interface IRollupCore {
|
|
24
28
|
bytes32 indexed parentNodeHash,
|
25
29
|
bytes32 indexed nodeHash,
|
26
30
|
bytes32 executionHash,
|
27
|
-
|
31
|
+
Assertion assertion,
|
28
32
|
bytes32 afterInboxBatchAcc,
|
29
33
|
bytes32 wasmModuleRoot,
|
30
34
|
uint256 inboxMaxCount
|
@@ -84,6 +88,15 @@ interface IRollupCore {
|
|
84
88
|
*/
|
85
89
|
function getNode(uint64 nodeNum) external view returns (Node memory);
|
86
90
|
|
91
|
+
/**
|
92
|
+
* @notice Returns the block in which the given node was created for looking up its creation event.
|
93
|
+
* Unlike the Node's createdAtBlock field, this will be the ArbSys blockNumber if the host chain is an Arbitrum chain.
|
94
|
+
* That means that the block number returned for this is usable for event queries.
|
95
|
+
* This function will revert if the given node number does not exist.
|
96
|
+
* @dev This function is meant for internal use only and has no stability guarantees.
|
97
|
+
*/
|
98
|
+
function getNodeCreationBlockForLogLookup(uint64 nodeNum) external view returns (uint256);
|
99
|
+
|
87
100
|
/**
|
88
101
|
* @notice Check if the specified node has been staked on by the provided staker.
|
89
102
|
* Only accurate at the latest confirmed node and afterwards.
|
@@ -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;
|
@@ -13,5 +13,5 @@ interface IRollupEventInbox {
|
|
13
13
|
|
14
14
|
function rollup() external view returns (address);
|
15
15
|
|
16
|
-
function rollupInitialized(uint256 chainId) external;
|
16
|
+
function rollupInitialized(uint256 chainId, string calldata chainConfig) external;
|
17
17
|
}
|
@@ -1,10 +1,9 @@
|
|
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;
|
6
6
|
|
7
|
-
import "./RollupLib.sol";
|
8
7
|
import "./IRollupCore.sol";
|
9
8
|
import "../bridge/ISequencerInbox.sol";
|
10
9
|
import "../bridge/IOutbox.sol";
|
@@ -28,7 +27,7 @@ interface IRollupUserAbs is IRollupCore, IOwnable {
|
|
28
27
|
function stakeOnExistingNode(uint64 nodeNum, bytes32 nodeHash) external;
|
29
28
|
|
30
29
|
function stakeOnNewNode(
|
31
|
-
|
30
|
+
Assertion memory assertion,
|
32
31
|
bytes32 expectedNodeHash,
|
33
32
|
uint256 prevNodeInboxMaxCount
|
34
33
|
) external;
|
@@ -75,7 +74,7 @@ interface IRollupUser is IRollupUserAbs {
|
|
75
74
|
function newStakeOnExistingNode(uint64 nodeNum, bytes32 nodeHash) external payable;
|
76
75
|
|
77
76
|
function newStakeOnNewNode(
|
78
|
-
|
77
|
+
Assertion calldata assertion,
|
79
78
|
bytes32 expectedNodeHash,
|
80
79
|
uint256 prevNodeInboxMaxCount
|
81
80
|
) external payable;
|
@@ -92,137 +91,10 @@ interface IRollupUserERC20 is IRollupUserAbs {
|
|
92
91
|
|
93
92
|
function newStakeOnNewNode(
|
94
93
|
uint256 tokenAmount,
|
95
|
-
|
94
|
+
Assertion calldata assertion,
|
96
95
|
bytes32 expectedNodeHash,
|
97
96
|
uint256 prevNodeInboxMaxCount
|
98
97
|
) external;
|
99
98
|
|
100
99
|
function addToDeposit(address stakerAddress, uint256 tokenAmount) external;
|
101
100
|
}
|
102
|
-
|
103
|
-
interface IRollupAdmin {
|
104
|
-
event OwnerFunctionCalled(uint256 indexed id);
|
105
|
-
|
106
|
-
function initialize(Config calldata config, ContractDependencies calldata connectedContracts)
|
107
|
-
external;
|
108
|
-
|
109
|
-
/**
|
110
|
-
* @notice Add a contract authorized to put messages into this rollup's inbox
|
111
|
-
* @param _outbox Outbox contract to add
|
112
|
-
*/
|
113
|
-
function setOutbox(IOutbox _outbox) external;
|
114
|
-
|
115
|
-
/**
|
116
|
-
* @notice Disable an old outbox from interacting with the bridge
|
117
|
-
* @param _outbox Outbox contract to remove
|
118
|
-
*/
|
119
|
-
function removeOldOutbox(address _outbox) external;
|
120
|
-
|
121
|
-
/**
|
122
|
-
* @notice Enable or disable an inbox contract
|
123
|
-
* @param _inbox Inbox contract to add or remove
|
124
|
-
* @param _enabled New status of inbox
|
125
|
-
*/
|
126
|
-
function setDelayedInbox(address _inbox, bool _enabled) external;
|
127
|
-
|
128
|
-
/**
|
129
|
-
* @notice Pause interaction with the rollup contract
|
130
|
-
*/
|
131
|
-
function pause() external;
|
132
|
-
|
133
|
-
/**
|
134
|
-
* @notice Resume interaction with the rollup contract
|
135
|
-
*/
|
136
|
-
function resume() external;
|
137
|
-
|
138
|
-
/**
|
139
|
-
* @notice Set the addresses of the validator whitelist
|
140
|
-
* @dev It is expected that both arrays are same length, and validator at
|
141
|
-
* position i corresponds to the value at position i
|
142
|
-
* @param _validator addresses to set in the whitelist
|
143
|
-
* @param _val value to set in the whitelist for corresponding address
|
144
|
-
*/
|
145
|
-
function setValidator(address[] memory _validator, bool[] memory _val) external;
|
146
|
-
|
147
|
-
/**
|
148
|
-
* @notice Set a new owner address for the rollup proxy
|
149
|
-
* @param newOwner address of new rollup owner
|
150
|
-
*/
|
151
|
-
function setOwner(address newOwner) external;
|
152
|
-
|
153
|
-
/**
|
154
|
-
* @notice Set minimum assertion period for the rollup
|
155
|
-
* @param newPeriod new minimum period for assertions
|
156
|
-
*/
|
157
|
-
function setMinimumAssertionPeriod(uint256 newPeriod) external;
|
158
|
-
|
159
|
-
/**
|
160
|
-
* @notice Set number of blocks until a node is considered confirmed
|
161
|
-
* @param newConfirmPeriod new number of blocks until a node is confirmed
|
162
|
-
*/
|
163
|
-
function setConfirmPeriodBlocks(uint64 newConfirmPeriod) external;
|
164
|
-
|
165
|
-
/**
|
166
|
-
* @notice Set number of extra blocks after a challenge
|
167
|
-
* @param newExtraTimeBlocks new number of blocks
|
168
|
-
*/
|
169
|
-
function setExtraChallengeTimeBlocks(uint64 newExtraTimeBlocks) external;
|
170
|
-
|
171
|
-
/**
|
172
|
-
* @notice Set base stake required for an assertion
|
173
|
-
* @param newBaseStake maximum avmgas to be used per block
|
174
|
-
*/
|
175
|
-
function setBaseStake(uint256 newBaseStake) external;
|
176
|
-
|
177
|
-
/**
|
178
|
-
* @notice Set the token used for stake, where address(0) == eth
|
179
|
-
* @dev Before changing the base stake token, you might need to change the
|
180
|
-
* implementation of the Rollup User logic!
|
181
|
-
* @param newStakeToken address of token used for staking
|
182
|
-
*/
|
183
|
-
function setStakeToken(address newStakeToken) external;
|
184
|
-
|
185
|
-
/**
|
186
|
-
* @notice Upgrades the implementation of a beacon controlled by the rollup
|
187
|
-
* @param beacon address of beacon to be upgraded
|
188
|
-
* @param newImplementation new address of implementation
|
189
|
-
*/
|
190
|
-
function upgradeBeacon(address beacon, address newImplementation) external;
|
191
|
-
|
192
|
-
function forceResolveChallenge(address[] memory stackerA, address[] memory stackerB) external;
|
193
|
-
|
194
|
-
function forceRefundStaker(address[] memory stacker) external;
|
195
|
-
|
196
|
-
function forceCreateNode(
|
197
|
-
uint64 prevNode,
|
198
|
-
uint256 prevNodeInboxMaxCount,
|
199
|
-
RollupLib.Assertion memory assertion,
|
200
|
-
bytes32 expectedNodeHash
|
201
|
-
) external;
|
202
|
-
|
203
|
-
function forceConfirmNode(
|
204
|
-
uint64 nodeNum,
|
205
|
-
bytes32 blockHash,
|
206
|
-
bytes32 sendRoot
|
207
|
-
) external;
|
208
|
-
|
209
|
-
function setLoserStakeEscrow(address newLoserStakerEscrow) external;
|
210
|
-
|
211
|
-
/**
|
212
|
-
* @notice Set the proving WASM module root
|
213
|
-
* @param newWasmModuleRoot new module root
|
214
|
-
*/
|
215
|
-
function setWasmModuleRoot(bytes32 newWasmModuleRoot) external;
|
216
|
-
|
217
|
-
/**
|
218
|
-
* @notice set a new sequencer inbox contract
|
219
|
-
* @param _sequencerInbox new address of sequencer inbox
|
220
|
-
*/
|
221
|
-
function setSequencerInbox(address _sequencerInbox) external;
|
222
|
-
|
223
|
-
/**
|
224
|
-
* @notice set the validatorWhitelistDisabled flag
|
225
|
-
* @param _validatorWhitelistDisabled new value of validatorWhitelistDisabled, i.e. true = disabled
|
226
|
-
*/
|
227
|
-
function setValidatorWhitelistDisabled(bool _validatorWhitelistDisabled) external;
|
228
|
-
}
|
package/src/rollup/Node.sol
CHANGED
@@ -1,9 +1,23 @@
|
|
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;
|
6
6
|
|
7
|
+
import "../state/GlobalState.sol";
|
8
|
+
import "../state/Machine.sol";
|
9
|
+
|
10
|
+
struct ExecutionState {
|
11
|
+
GlobalState globalState;
|
12
|
+
MachineStatus machineStatus;
|
13
|
+
}
|
14
|
+
|
15
|
+
struct Assertion {
|
16
|
+
ExecutionState beforeState;
|
17
|
+
ExecutionState afterState;
|
18
|
+
uint64 numBlocks;
|
19
|
+
}
|
20
|
+
|
7
21
|
struct Node {
|
8
22
|
// Hash of the state of the chain as of this node
|
9
23
|
bytes32 stateHash;
|
@@ -1,10 +1,11 @@
|
|
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;
|
6
6
|
|
7
|
-
import
|
7
|
+
import "./IRollupAdmin.sol";
|
8
|
+
import "./IRollupLogic.sol";
|
8
9
|
import "./RollupCore.sol";
|
9
10
|
import "../bridge/IOutbox.sol";
|
10
11
|
import "../bridge/ISequencerInbox.sol";
|
@@ -36,7 +37,7 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, DoubleLogicUUPSUpgradeabl
|
|
36
37
|
true
|
37
38
|
);
|
38
39
|
|
39
|
-
connectedContracts.rollupEventInbox.rollupInitialized(config.chainId);
|
40
|
+
connectedContracts.rollupEventInbox.rollupInitialized(config.chainId, config.chainConfig);
|
40
41
|
connectedContracts.sequencerInbox.addSequencerL2Batch(
|
41
42
|
0,
|
42
43
|
"",
|
@@ -76,7 +77,7 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, DoubleLogicUUPSUpgradeabl
|
|
76
77
|
function createInitialNode() private view returns (Node memory) {
|
77
78
|
GlobalState memory emptyGlobalState;
|
78
79
|
bytes32 state = RollupLib.stateHashMem(
|
79
|
-
|
80
|
+
ExecutionState(emptyGlobalState, MachineStatus.FINISHED),
|
80
81
|
1 // inboxMaxCount - force the first assertion to read a message
|
81
82
|
);
|
82
83
|
return
|
@@ -285,7 +286,7 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, DoubleLogicUUPSUpgradeabl
|
|
285
286
|
function forceCreateNode(
|
286
287
|
uint64 prevNode,
|
287
288
|
uint256 prevNodeInboxMaxCount,
|
288
|
-
|
289
|
+
Assertion calldata assertion,
|
289
290
|
bytes32 expectedNodeHash
|
290
291
|
) external override whenPaused {
|
291
292
|
require(prevNode == latestConfirmed(), "ONLY_LATEST_CONFIRMED");
|
@@ -340,10 +341,7 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, DoubleLogicUUPSUpgradeabl
|
|
340
341
|
emit OwnerFunctionCalled(28);
|
341
342
|
}
|
342
343
|
|
343
|
-
function createNitroMigrationGenesis(
|
344
|
-
external
|
345
|
-
whenPaused
|
346
|
-
{
|
344
|
+
function createNitroMigrationGenesis(Assertion calldata assertion) external whenPaused {
|
347
345
|
bytes32 expectedSendRoot = bytes32(0);
|
348
346
|
uint64 expectedInboxCount = 1;
|
349
347
|
|