@arbitrum/nitro-contracts 1.0.0-beta.5 → 1.0.0-beta.6
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.
- package/package.json +2 -1
- package/src/bridge/Bridge.sol +127 -32
- package/src/bridge/IBridge.sol +40 -6
- package/src/bridge/{IMessageProvider.sol → IDelayedMessageProvider.sol} +2 -3
- package/src/bridge/IInbox.sol +23 -2
- package/src/bridge/IOwnable.sol +9 -0
- package/src/bridge/ISequencerInbox.sol +36 -9
- package/src/bridge/Inbox.sol +131 -45
- package/src/bridge/Outbox.sol +134 -31
- package/src/bridge/SequencerInbox.sol +159 -60
- package/src/challenge/ChallengeLib.sol +0 -2
- package/src/challenge/ChallengeManager.sol +4 -8
- package/src/challenge/IChallengeManager.sol +1 -1
- package/src/libraries/Error.sol +6 -0
- package/src/libraries/IGasRefunder.sol +12 -13
- package/src/libraries/MerkleLib.sol +11 -2
- package/src/libraries/MessageTypes.sol +1 -0
- package/src/mocks/BridgeStub.sol +67 -21
- package/src/mocks/InboxStub.sol +3 -9
- package/src/mocks/SequencerInboxStub.sol +10 -8
- package/src/mocks/Simple.sol +8 -0
- package/src/node-interface/NodeInterface.sol +32 -5
- package/src/osp/IOneStepProver.sol +1 -2
- package/src/osp/OneStepProver0.sol +1 -87
- package/src/osp/OneStepProverHostIo.sol +5 -6
- package/src/osp/OneStepProverMath.sol +37 -27
- package/src/osp/OneStepProverMemory.sol +3 -4
- package/src/precompiles/ArbAggregator.sol +23 -33
- package/src/precompiles/ArbBLS.sol +1 -43
- package/src/precompiles/ArbGasInfo.sol +1 -19
- package/src/precompiles/ArbOwner.sol +12 -15
- package/src/precompiles/ArbRetryableTx.sol +10 -1
- package/src/precompiles/ArbosActs.sol +9 -2
- package/src/rollup/BridgeCreator.sol +23 -28
- package/src/rollup/IRollupCore.sol +3 -3
- package/src/rollup/{IRollupEventBridge.sol → IRollupEventInbox.sol} +2 -2
- package/src/rollup/IRollupLogic.sol +21 -18
- package/src/rollup/RollupAdminLogic.sol +30 -34
- package/src/rollup/RollupCore.sol +15 -7
- package/src/rollup/RollupCreator.sol +21 -11
- package/src/rollup/{RollupEventBridge.sol → RollupEventInbox.sol} +10 -10
- package/src/rollup/RollupLib.sol +20 -5
- package/src/rollup/RollupUserLogic.sol +9 -18
- package/src/rollup/ValidatorWallet.sol +124 -8
- package/src/rollup/ValidatorWalletCreator.sol +11 -6
- package/src/state/Deserialize.sol +3 -22
- package/src/state/Instructions.sol +2 -10
- package/src/state/Machine.sol +0 -4
- package/src/state/ModuleMemory.sol +2 -1
- package/src/state/Value.sol +2 -3
- package/src/test-helpers/BridgeTester.sol +223 -0
- package/src/test-helpers/OutboxWithoutOptTester.sol +188 -0
- package/src/test-helpers/RollupMock.sol +21 -0
- package/src/state/PcStack.sol +0 -32
@@ -24,9 +24,6 @@ interface ArbOwner {
|
|
24
24
|
/// @notice Retrieves the list of chain owners
|
25
25
|
function getAllChainOwners() external view returns (address[] memory);
|
26
26
|
|
27
|
-
/// @notice Set the L1 basefee estimate directly, bypassing the autoregression
|
28
|
-
function setL1BaseFeeEstimate(uint256 priceInWei) external;
|
29
|
-
|
30
27
|
/// @notice Set how slowly ArbOS updates its estimate of the L1 basefee
|
31
28
|
function setL1BaseFeeEstimateInertia(uint64 inertia) external;
|
32
29
|
|
@@ -39,18 +36,6 @@ interface ArbOwner {
|
|
39
36
|
/// @notice Set the computational speed limit for the chain
|
40
37
|
function setSpeedLimit(uint64 limit) external;
|
41
38
|
|
42
|
-
/// @notice Set the number of seconds worth of the speed limit the gas pool contains
|
43
|
-
function setGasPoolSeconds(uint64 factor) external;
|
44
|
-
|
45
|
-
/// @notice Set the target fullness in bips the pricing model will try to keep the pool at
|
46
|
-
function setGasPoolTarget(uint64 target) external;
|
47
|
-
|
48
|
-
/// @notice Set the extent in bips to which the pricing model favors filling the pool over increasing speeds
|
49
|
-
function setGasPoolWeight(uint64 weight) external;
|
50
|
-
|
51
|
-
/// @notice Set how slowly ArbOS updates its estimate the amount of gas being burnt per second
|
52
|
-
function setRateEstimateInertia(uint64 inertia) external;
|
53
|
-
|
54
39
|
/// @notice Set the maximum size a tx (and block) can be
|
55
40
|
function setMaxTxGasLimit(uint64 limit) external;
|
56
41
|
|
@@ -69,6 +54,18 @@ interface ArbOwner {
|
|
69
54
|
/// @notice Upgrades ArbOS to the requested version at the requested timestamp
|
70
55
|
function scheduleArbOSUpgrade(uint64 newVersion, uint64 timestamp) external;
|
71
56
|
|
57
|
+
/// @notice Sets equilibration units parameter for L1 price adjustment algorithm
|
58
|
+
function setL1PricingEquilibrationUnits(uint256 equilibrationUnits) external;
|
59
|
+
|
60
|
+
/// @notice Sets inertia parameter for L1 price adjustment algorithm
|
61
|
+
function setL1PricingInertia(uint64 inertia) external;
|
62
|
+
|
63
|
+
/// @notice Sets reward recipient address for L1 price adjustment algorithm
|
64
|
+
function setL1PricingRewardRecipient(address recipient) external;
|
65
|
+
|
66
|
+
/// @notice Sets reward amount for L1 price adjustment algorithm, in wei per unit
|
67
|
+
function setL1PricingRewardRate(uint64 weiPerUnit) external;
|
68
|
+
|
72
69
|
// Emitted when a successful call is made to this precompile
|
73
70
|
event OwnerActs(bytes4 indexed method, address indexed owner, bytes data);
|
74
71
|
}
|
@@ -55,6 +55,13 @@ interface ArbRetryableTx {
|
|
55
55
|
*/
|
56
56
|
function cancel(bytes32 ticketId) external;
|
57
57
|
|
58
|
+
/**
|
59
|
+
* @notice Gets the redeemer of the current retryable redeem attempt.
|
60
|
+
* Returns the zero address if the current transaction is not a retryable redeem attempt.
|
61
|
+
* If this is an auto-redeem, returns the fee refund address of the retryable.
|
62
|
+
*/
|
63
|
+
function getCurrentRedeemer() external view returns (address);
|
64
|
+
|
58
65
|
/**
|
59
66
|
* @notice Do not call. This method represents a retryable submission to aid explorers.
|
60
67
|
* Calling it will always revert.
|
@@ -80,7 +87,9 @@ interface ArbRetryableTx {
|
|
80
87
|
bytes32 indexed retryTxHash,
|
81
88
|
uint64 indexed sequenceNum,
|
82
89
|
uint64 donatedGas,
|
83
|
-
address gasDonor
|
90
|
+
address gasDonor,
|
91
|
+
uint256 maxRefund,
|
92
|
+
uint256 submissionFeeRefund
|
84
93
|
);
|
85
94
|
event Canceled(bytes32 indexed ticketId);
|
86
95
|
|
@@ -26,16 +26,23 @@ interface ArbosActs {
|
|
26
26
|
/**
|
27
27
|
* @notice ArbOS "calls" this when starting a block
|
28
28
|
* @param l1BaseFee the L1 BaseFee
|
29
|
-
* @param l2BaseFeeLastBlock the L2 BaseFee in the last block's header
|
30
29
|
* @param l1BlockNumber the L1 block number
|
31
30
|
* @param timePassed number of seconds since the last block
|
32
31
|
*/
|
33
32
|
function startBlock(
|
34
33
|
uint256 l1BaseFee,
|
35
|
-
uint256 l2BaseFeeLastBlock,
|
36
34
|
uint64 l1BlockNumber,
|
35
|
+
uint64 l2BlockNumber,
|
37
36
|
uint64 timePassed
|
38
37
|
) external;
|
39
38
|
|
39
|
+
function batchPostingReport(
|
40
|
+
uint256 batchTimestamp,
|
41
|
+
address batchPosterAddress,
|
42
|
+
uint64 batchNumber,
|
43
|
+
uint64 batchDataGas,
|
44
|
+
uint256 l1BaseFeeWei
|
45
|
+
) external;
|
46
|
+
|
40
47
|
error CallerNotArbOS();
|
41
48
|
}
|
@@ -9,40 +9,40 @@ import "../bridge/SequencerInbox.sol";
|
|
9
9
|
import "../bridge/ISequencerInbox.sol";
|
10
10
|
import "../bridge/Inbox.sol";
|
11
11
|
import "../bridge/Outbox.sol";
|
12
|
-
import "./
|
12
|
+
import "./RollupEventInbox.sol";
|
13
13
|
|
14
14
|
import "../bridge/IBridge.sol";
|
15
15
|
import "@openzeppelin/contracts/access/Ownable.sol";
|
16
16
|
import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
|
17
17
|
|
18
18
|
contract BridgeCreator is Ownable {
|
19
|
-
Bridge public
|
19
|
+
Bridge public bridgeTemplate;
|
20
20
|
SequencerInbox public sequencerInboxTemplate;
|
21
21
|
Inbox public inboxTemplate;
|
22
|
-
|
22
|
+
RollupEventInbox public rollupEventInboxTemplate;
|
23
23
|
Outbox public outboxTemplate;
|
24
24
|
|
25
25
|
event TemplatesUpdated();
|
26
26
|
|
27
27
|
constructor() Ownable() {
|
28
|
-
|
28
|
+
bridgeTemplate = new Bridge();
|
29
29
|
sequencerInboxTemplate = new SequencerInbox();
|
30
30
|
inboxTemplate = new Inbox();
|
31
|
-
|
31
|
+
rollupEventInboxTemplate = new RollupEventInbox();
|
32
32
|
outboxTemplate = new Outbox();
|
33
33
|
}
|
34
34
|
|
35
35
|
function updateTemplates(
|
36
|
-
address
|
36
|
+
address _bridgeTemplate,
|
37
37
|
address _sequencerInboxTemplate,
|
38
38
|
address _inboxTemplate,
|
39
|
-
address
|
39
|
+
address _rollupEventInboxTemplate,
|
40
40
|
address _outboxTemplate
|
41
41
|
) external onlyOwner {
|
42
|
-
|
42
|
+
bridgeTemplate = Bridge(_bridgeTemplate);
|
43
43
|
sequencerInboxTemplate = SequencerInbox(_sequencerInboxTemplate);
|
44
44
|
inboxTemplate = Inbox(_inboxTemplate);
|
45
|
-
|
45
|
+
rollupEventInboxTemplate = RollupEventInbox(_rollupEventInboxTemplate);
|
46
46
|
outboxTemplate = Outbox(_outboxTemplate);
|
47
47
|
|
48
48
|
emit TemplatesUpdated();
|
@@ -50,10 +50,10 @@ contract BridgeCreator is Ownable {
|
|
50
50
|
|
51
51
|
struct CreateBridgeFrame {
|
52
52
|
ProxyAdmin admin;
|
53
|
-
Bridge
|
53
|
+
Bridge bridge;
|
54
54
|
SequencerInbox sequencerInbox;
|
55
55
|
Inbox inbox;
|
56
|
-
|
56
|
+
RollupEventInbox rollupEventInbox;
|
57
57
|
Outbox outbox;
|
58
58
|
}
|
59
59
|
|
@@ -67,16 +67,14 @@ contract BridgeCreator is Ownable {
|
|
67
67
|
Bridge,
|
68
68
|
SequencerInbox,
|
69
69
|
Inbox,
|
70
|
-
|
70
|
+
RollupEventInbox,
|
71
71
|
Outbox
|
72
72
|
)
|
73
73
|
{
|
74
74
|
CreateBridgeFrame memory frame;
|
75
75
|
{
|
76
|
-
frame.
|
77
|
-
address(
|
78
|
-
new TransparentUpgradeableProxy(address(delayedBridgeTemplate), adminProxy, "")
|
79
|
-
)
|
76
|
+
frame.bridge = Bridge(
|
77
|
+
address(new TransparentUpgradeableProxy(address(bridgeTemplate), adminProxy, ""))
|
80
78
|
);
|
81
79
|
frame.sequencerInbox = SequencerInbox(
|
82
80
|
address(
|
@@ -86,10 +84,10 @@ contract BridgeCreator is Ownable {
|
|
86
84
|
frame.inbox = Inbox(
|
87
85
|
address(new TransparentUpgradeableProxy(address(inboxTemplate), adminProxy, ""))
|
88
86
|
);
|
89
|
-
frame.
|
87
|
+
frame.rollupEventInbox = RollupEventInbox(
|
90
88
|
address(
|
91
89
|
new TransparentUpgradeableProxy(
|
92
|
-
address(
|
90
|
+
address(rollupEventInboxTemplate),
|
93
91
|
adminProxy,
|
94
92
|
""
|
95
93
|
)
|
@@ -100,20 +98,17 @@ contract BridgeCreator is Ownable {
|
|
100
98
|
);
|
101
99
|
}
|
102
100
|
|
103
|
-
frame.
|
104
|
-
frame.sequencerInbox.initialize(IBridge(frame.
|
105
|
-
frame.inbox.initialize(IBridge(frame.
|
106
|
-
frame.
|
107
|
-
frame.outbox.initialize(
|
108
|
-
|
109
|
-
frame.delayedBridge.setInbox(address(frame.inbox), true);
|
110
|
-
frame.delayedBridge.transferOwnership(rollup);
|
101
|
+
frame.bridge.initialize(IOwnable(rollup));
|
102
|
+
frame.sequencerInbox.initialize(IBridge(frame.bridge), maxTimeVariation);
|
103
|
+
frame.inbox.initialize(IBridge(frame.bridge), ISequencerInbox(frame.sequencerInbox));
|
104
|
+
frame.rollupEventInbox.initialize(IBridge(frame.bridge));
|
105
|
+
frame.outbox.initialize(IBridge(frame.bridge));
|
111
106
|
|
112
107
|
return (
|
113
|
-
frame.
|
108
|
+
frame.bridge,
|
114
109
|
frame.sequencerInbox,
|
115
110
|
frame.inbox,
|
116
|
-
frame.
|
111
|
+
frame.rollupEventInbox,
|
117
112
|
frame.outbox
|
118
113
|
);
|
119
114
|
}
|
@@ -59,13 +59,13 @@ interface IRollupCore {
|
|
59
59
|
|
60
60
|
function wasmModuleRoot() external view returns (bytes32);
|
61
61
|
|
62
|
-
function
|
62
|
+
function bridge() external view returns (IBridge);
|
63
63
|
|
64
|
-
function
|
64
|
+
function sequencerInbox() external view returns (ISequencerInbox);
|
65
65
|
|
66
66
|
function outbox() external view returns (IOutbox);
|
67
67
|
|
68
|
-
function
|
68
|
+
function rollupEventInbox() external view returns (IRollupEventInbox);
|
69
69
|
|
70
70
|
function challengeManager() external view returns (IChallengeManager);
|
71
71
|
|
@@ -6,10 +6,10 @@ pragma solidity ^0.8.0;
|
|
6
6
|
|
7
7
|
import "../bridge/IBridge.sol";
|
8
8
|
|
9
|
-
interface
|
9
|
+
interface IRollupEventInbox {
|
10
10
|
function bridge() external view returns (IBridge);
|
11
11
|
|
12
|
-
function initialize(
|
12
|
+
function initialize(IBridge _bridge) external;
|
13
13
|
|
14
14
|
function rollup() external view returns (address);
|
15
15
|
|
@@ -8,8 +8,9 @@ import "./RollupLib.sol";
|
|
8
8
|
import "./IRollupCore.sol";
|
9
9
|
import "../bridge/ISequencerInbox.sol";
|
10
10
|
import "../bridge/IOutbox.sol";
|
11
|
+
import "../bridge/IOwnable.sol";
|
11
12
|
|
12
|
-
interface IRollupUserAbs is IRollupCore {
|
13
|
+
interface IRollupUserAbs is IRollupCore, IOwnable {
|
13
14
|
/// @dev the user logic just validated configuration and shouldn't write to state during init
|
14
15
|
/// this allows the admin logic to ensure consistency on parameters.
|
15
16
|
function initialize(address stakeToken) external view;
|
@@ -52,7 +53,18 @@ interface IRollupUserAbs is IRollupCore {
|
|
52
53
|
|
53
54
|
function requireUnresolved(uint256 nodeNum) external view;
|
54
55
|
|
55
|
-
function withdrawStakerFunds(
|
56
|
+
function withdrawStakerFunds() external returns (uint256);
|
57
|
+
|
58
|
+
function createChallenge(
|
59
|
+
address[2] calldata stakers,
|
60
|
+
uint64[2] calldata nodeNums,
|
61
|
+
MachineStatus[2] calldata machineStatuses,
|
62
|
+
GlobalState[2] calldata globalStates,
|
63
|
+
uint64 numBlocks,
|
64
|
+
bytes32 secondExecutionHash,
|
65
|
+
uint256[2] calldata proposedTimes,
|
66
|
+
bytes32[2] calldata wasmModuleRoots
|
67
|
+
) external;
|
56
68
|
}
|
57
69
|
|
58
70
|
interface IRollupUser is IRollupUserAbs {
|
@@ -107,7 +119,7 @@ interface IRollupAdmin {
|
|
107
119
|
* @param _inbox Inbox contract to add or remove
|
108
120
|
* @param _enabled New status of inbox
|
109
121
|
*/
|
110
|
-
function
|
122
|
+
function setDelayedInbox(address _inbox, bool _enabled) external;
|
111
123
|
|
112
124
|
/**
|
113
125
|
* @notice Pause interaction with the rollup contract
|
@@ -166,21 +178,6 @@ interface IRollupAdmin {
|
|
166
178
|
*/
|
167
179
|
function setStakeToken(address newStakeToken) external;
|
168
180
|
|
169
|
-
/**
|
170
|
-
* @notice Set max time variation from actual time for sequencer inbox
|
171
|
-
* @param maxTimeVariation the maximum time variation parameters
|
172
|
-
*/
|
173
|
-
function setSequencerInboxMaxTimeVariation(
|
174
|
-
ISequencerInbox.MaxTimeVariation memory maxTimeVariation
|
175
|
-
) external;
|
176
|
-
|
177
|
-
/**
|
178
|
-
* @notice Updates whether an address is authorized to be a batch poster at the sequencer inbox
|
179
|
-
* @param addr the address
|
180
|
-
* @param isBatchPoster if the specified address should be authorized as a batch poster
|
181
|
-
*/
|
182
|
-
function setIsBatchPoster(address addr, bool isBatchPoster) external;
|
183
|
-
|
184
181
|
/**
|
185
182
|
* @notice Upgrades the implementation of a beacon controlled by the rollup
|
186
183
|
* @param beacon address of beacon to be upgraded
|
@@ -212,4 +209,10 @@ interface IRollupAdmin {
|
|
212
209
|
* @param newWasmModuleRoot new module root
|
213
210
|
*/
|
214
211
|
function setWasmModuleRoot(bytes32 newWasmModuleRoot) external;
|
212
|
+
|
213
|
+
/**
|
214
|
+
* @notice set a new sequencer inbox contract
|
215
|
+
* @param _sequencerInbox new address of sequencer inbox
|
216
|
+
*/
|
217
|
+
function setSequencerInbox(address _sequencerInbox) external;
|
215
218
|
}
|
@@ -21,16 +21,26 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, SecondaryLogicUUPSUpgrade
|
|
21
21
|
onlyProxy
|
22
22
|
initializer
|
23
23
|
{
|
24
|
-
|
25
|
-
|
24
|
+
rollupDeploymentBlock = block.number;
|
25
|
+
bridge = connectedContracts.bridge;
|
26
|
+
sequencerInbox = connectedContracts.sequencerInbox;
|
27
|
+
connectedContracts.bridge.setDelayedInbox(address(connectedContracts.inbox), true);
|
28
|
+
connectedContracts.bridge.setSequencerInbox(address(connectedContracts.sequencerInbox));
|
29
|
+
|
30
|
+
inbox = connectedContracts.inbox;
|
26
31
|
outbox = connectedContracts.outbox;
|
27
|
-
|
28
|
-
|
29
|
-
|
32
|
+
connectedContracts.bridge.setOutbox(address(connectedContracts.outbox), true);
|
33
|
+
rollupEventInbox = connectedContracts.rollupEventInbox;
|
34
|
+
connectedContracts.bridge.setDelayedInbox(
|
35
|
+
address(connectedContracts.rollupEventInbox),
|
36
|
+
true
|
37
|
+
);
|
30
38
|
|
31
|
-
|
32
|
-
|
39
|
+
connectedContracts.rollupEventInbox.rollupInitialized(config.chainId);
|
40
|
+
connectedContracts.sequencerInbox.addSequencerL2Batch(0, "", 1, IGasRefunder(address(0)));
|
33
41
|
|
42
|
+
validatorUtils = connectedContracts.validatorUtils;
|
43
|
+
validatorWalletCreator = connectedContracts.validatorWalletCreator;
|
34
44
|
challengeManager = connectedContracts.challengeManager;
|
35
45
|
|
36
46
|
Node memory node = createInitialNode();
|
@@ -53,8 +63,6 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, SecondaryLogicUUPSUpgrade
|
|
53
63
|
|
54
64
|
stakeToken = config.stakeToken;
|
55
65
|
|
56
|
-
sequencerBridge.setMaxTimeVariation(config.sequencerInboxMaxTimeVariation);
|
57
|
-
|
58
66
|
emit RollupInitialized(config.wasmModuleRoot, config.chainId);
|
59
67
|
}
|
60
68
|
|
@@ -86,7 +94,7 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, SecondaryLogicUUPSUpgrade
|
|
86
94
|
*/
|
87
95
|
function setOutbox(IOutbox _outbox) external override {
|
88
96
|
outbox = _outbox;
|
89
|
-
|
97
|
+
bridge.setOutbox(address(_outbox), true);
|
90
98
|
emit OwnerFunctionCalled(0);
|
91
99
|
}
|
92
100
|
|
@@ -96,7 +104,7 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, SecondaryLogicUUPSUpgrade
|
|
96
104
|
*/
|
97
105
|
function removeOldOutbox(address _outbox) external override {
|
98
106
|
require(_outbox != address(outbox), "CUR_OUTBOX");
|
99
|
-
|
107
|
+
bridge.setOutbox(_outbox, false);
|
100
108
|
emit OwnerFunctionCalled(1);
|
101
109
|
}
|
102
110
|
|
@@ -105,8 +113,8 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, SecondaryLogicUUPSUpgrade
|
|
105
113
|
* @param _inbox Inbox contract to add or remove
|
106
114
|
* @param _enabled New status of inbox
|
107
115
|
*/
|
108
|
-
function
|
109
|
-
|
116
|
+
function setDelayedInbox(address _inbox, bool _enabled) external override {
|
117
|
+
bridge.setDelayedInbox(address(_inbox), _enabled);
|
110
118
|
emit OwnerFunctionCalled(2);
|
111
119
|
}
|
112
120
|
|
@@ -224,27 +232,6 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, SecondaryLogicUUPSUpgrade
|
|
224
232
|
emit OwnerFunctionCalled(13);
|
225
233
|
}
|
226
234
|
|
227
|
-
/**
|
228
|
-
* @notice Set max delay for sequencer inbox
|
229
|
-
* @param maxTimeVariation the maximum time variation parameters
|
230
|
-
*/
|
231
|
-
function setSequencerInboxMaxTimeVariation(
|
232
|
-
ISequencerInbox.MaxTimeVariation calldata maxTimeVariation
|
233
|
-
) external override {
|
234
|
-
sequencerBridge.setMaxTimeVariation(maxTimeVariation);
|
235
|
-
emit OwnerFunctionCalled(14);
|
236
|
-
}
|
237
|
-
|
238
|
-
/**
|
239
|
-
* @notice Updates whether an address is authorized to be a batch poster at the sequencer inbox
|
240
|
-
* @param addr the address
|
241
|
-
* @param isBatchPoster if the specified address should be authorized as a batch poster
|
242
|
-
*/
|
243
|
-
function setIsBatchPoster(address addr, bool isBatchPoster) external override {
|
244
|
-
ISequencerInbox(sequencerBridge).setIsBatchPoster(addr, isBatchPoster);
|
245
|
-
emit OwnerFunctionCalled(19);
|
246
|
-
}
|
247
|
-
|
248
235
|
/**
|
249
236
|
* @notice Upgrades the implementation of a beacon controlled by the rollup
|
250
237
|
* @param beacon address of beacon to be upgraded
|
@@ -319,4 +306,13 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, SecondaryLogicUUPSUpgrade
|
|
319
306
|
wasmModuleRoot = newWasmModuleRoot;
|
320
307
|
emit OwnerFunctionCalled(26);
|
321
308
|
}
|
309
|
+
|
310
|
+
/**
|
311
|
+
* @notice set a new sequencer inbox contract
|
312
|
+
* @param _sequencerInbox new address of sequencer inbox
|
313
|
+
*/
|
314
|
+
function setSequencerInbox(address _sequencerInbox) external override {
|
315
|
+
bridge.setSequencerInbox(_sequencerInbox);
|
316
|
+
emit OwnerFunctionCalled(27);
|
317
|
+
}
|
322
318
|
}
|
@@ -9,7 +9,7 @@ import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
|
|
9
9
|
import "./Node.sol";
|
10
10
|
import "./IRollupCore.sol";
|
11
11
|
import "./RollupLib.sol";
|
12
|
-
import "./
|
12
|
+
import "./IRollupEventInbox.sol";
|
13
13
|
import "./IRollupCore.sol";
|
14
14
|
|
15
15
|
import "../challenge/IChallengeManager.sol";
|
@@ -31,11 +31,17 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable {
|
|
31
31
|
uint256 public baseStake;
|
32
32
|
bytes32 public wasmModuleRoot;
|
33
33
|
|
34
|
-
|
35
|
-
|
34
|
+
IInbox public inbox;
|
35
|
+
IBridge public bridge;
|
36
36
|
IOutbox public outbox;
|
37
|
-
|
37
|
+
ISequencerInbox public sequencerInbox;
|
38
|
+
IRollupEventInbox public rollupEventInbox;
|
38
39
|
IChallengeManager public override challengeManager;
|
40
|
+
|
41
|
+
// misc useful contracts when interacting with the rollup
|
42
|
+
address public validatorUtils;
|
43
|
+
address public validatorWalletCreator;
|
44
|
+
|
39
45
|
// when a staker loses a challenge, half of their funds get escrowed in this address
|
40
46
|
address public loserStakeEscrow;
|
41
47
|
address public stakeToken;
|
@@ -63,6 +69,7 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable {
|
|
63
69
|
|
64
70
|
mapping(address => uint256) private _withdrawableFunds;
|
65
71
|
uint256 public totalWithdrawableFunds;
|
72
|
+
uint256 public rollupDeploymentBlock;
|
66
73
|
|
67
74
|
// The node number of the initial node
|
68
75
|
uint64 internal constant GENESIS_NODE = 0;
|
@@ -529,7 +536,7 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable {
|
|
529
536
|
{
|
530
537
|
// validate data
|
531
538
|
memoryFrame.prevNode = getNode(prevNodeNum);
|
532
|
-
memoryFrame.currentInboxSize =
|
539
|
+
memoryFrame.currentInboxSize = bridge.sequencerMessageCount();
|
533
540
|
|
534
541
|
// Make sure the previous state is correct against the node being built on
|
535
542
|
require(
|
@@ -560,7 +567,7 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable {
|
|
560
567
|
require(afterInboxCount <= memoryFrame.currentInboxSize, "INBOX_PAST_END");
|
561
568
|
// This gives replay protection against the state of the inbox
|
562
569
|
if (afterInboxCount > 0) {
|
563
|
-
memoryFrame.sequencerBatchAcc =
|
570
|
+
memoryFrame.sequencerBatchAcc = bridge.sequencerInboxAccs(afterInboxCount - 1);
|
564
571
|
}
|
565
572
|
}
|
566
573
|
|
@@ -582,7 +589,8 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable {
|
|
582
589
|
memoryFrame.hasSibling,
|
583
590
|
memoryFrame.lastHash,
|
584
591
|
memoryFrame.executionHash,
|
585
|
-
memoryFrame.sequencerBatchAcc
|
592
|
+
memoryFrame.sequencerBatchAcc,
|
593
|
+
wasmModuleRoot
|
586
594
|
);
|
587
595
|
require(newNodeHash == expectedNodeHash, "UNEXPECTED_NODE_HASH");
|
588
596
|
|
@@ -18,7 +18,7 @@ contract RollupCreator is Ownable {
|
|
18
18
|
address inboxAddress,
|
19
19
|
address adminProxy,
|
20
20
|
address sequencerInbox,
|
21
|
-
address
|
21
|
+
address bridge
|
22
22
|
);
|
23
23
|
event TemplatesUpdated();
|
24
24
|
|
@@ -28,6 +28,9 @@ contract RollupCreator is Ownable {
|
|
28
28
|
IRollupAdmin public rollupAdminLogic;
|
29
29
|
IRollupUser public rollupUserLogic;
|
30
30
|
|
31
|
+
address public validatorUtils;
|
32
|
+
address public validatorWalletCreator;
|
33
|
+
|
31
34
|
constructor() Ownable() {}
|
32
35
|
|
33
36
|
function setTemplates(
|
@@ -35,22 +38,26 @@ contract RollupCreator is Ownable {
|
|
35
38
|
IOneStepProofEntry _osp,
|
36
39
|
IChallengeManager _challengeManagerLogic,
|
37
40
|
IRollupAdmin _rollupAdminLogic,
|
38
|
-
IRollupUser _rollupUserLogic
|
41
|
+
IRollupUser _rollupUserLogic,
|
42
|
+
address _validatorUtils,
|
43
|
+
address _validatorWalletCreator
|
39
44
|
) external onlyOwner {
|
40
45
|
bridgeCreator = _bridgeCreator;
|
41
46
|
osp = _osp;
|
42
47
|
challengeManagerTemplate = _challengeManagerLogic;
|
43
48
|
rollupAdminLogic = _rollupAdminLogic;
|
44
49
|
rollupUserLogic = _rollupUserLogic;
|
50
|
+
validatorUtils = _validatorUtils;
|
51
|
+
validatorWalletCreator = _validatorWalletCreator;
|
45
52
|
emit TemplatesUpdated();
|
46
53
|
}
|
47
54
|
|
48
55
|
struct CreateRollupFrame {
|
49
56
|
ProxyAdmin admin;
|
50
|
-
IBridge
|
57
|
+
IBridge bridge;
|
51
58
|
ISequencerInbox sequencerInbox;
|
52
59
|
IInbox inbox;
|
53
|
-
|
60
|
+
IRollupEventInbox rollupEventInbox;
|
54
61
|
IOutbox outbox;
|
55
62
|
ArbitrumProxy rollup;
|
56
63
|
}
|
@@ -68,10 +75,10 @@ contract RollupCreator is Ownable {
|
|
68
75
|
frame.admin = new ProxyAdmin();
|
69
76
|
|
70
77
|
(
|
71
|
-
frame.
|
78
|
+
frame.bridge,
|
72
79
|
frame.sequencerInbox,
|
73
80
|
frame.inbox,
|
74
|
-
frame.
|
81
|
+
frame.rollupEventInbox,
|
75
82
|
frame.outbox
|
76
83
|
) = bridgeCreator.createBridge(
|
77
84
|
address(frame.admin),
|
@@ -93,20 +100,23 @@ contract RollupCreator is Ownable {
|
|
93
100
|
challengeManager.initialize(
|
94
101
|
IChallengeResultReceiver(expectedRollupAddr),
|
95
102
|
frame.sequencerInbox,
|
96
|
-
frame.
|
103
|
+
frame.bridge,
|
97
104
|
osp
|
98
105
|
);
|
99
106
|
|
100
107
|
frame.rollup = new ArbitrumProxy(
|
101
108
|
config,
|
102
109
|
ContractDependencies({
|
103
|
-
|
110
|
+
bridge: frame.bridge,
|
104
111
|
sequencerInbox: frame.sequencerInbox,
|
112
|
+
inbox: frame.inbox,
|
105
113
|
outbox: frame.outbox,
|
106
|
-
|
114
|
+
rollupEventInbox: frame.rollupEventInbox,
|
107
115
|
challengeManager: challengeManager,
|
108
116
|
rollupAdminLogic: rollupAdminLogic,
|
109
|
-
rollupUserLogic: rollupUserLogic
|
117
|
+
rollupUserLogic: rollupUserLogic,
|
118
|
+
validatorUtils: validatorUtils,
|
119
|
+
validatorWalletCreator: validatorWalletCreator
|
110
120
|
})
|
111
121
|
);
|
112
122
|
require(address(frame.rollup) == expectedRollupAddr, "WRONG_ROLLUP_ADDR");
|
@@ -116,7 +126,7 @@ contract RollupCreator is Ownable {
|
|
116
126
|
address(frame.inbox),
|
117
127
|
address(frame.admin),
|
118
128
|
address(frame.sequencerInbox),
|
119
|
-
address(frame.
|
129
|
+
address(frame.bridge)
|
120
130
|
);
|
121
131
|
return address(frame.rollup);
|
122
132
|
}
|
@@ -4,36 +4,36 @@
|
|
4
4
|
|
5
5
|
pragma solidity ^0.8.0;
|
6
6
|
|
7
|
-
import "./
|
7
|
+
import "./IRollupEventInbox.sol";
|
8
8
|
import "../bridge/IBridge.sol";
|
9
|
-
import "../bridge/
|
9
|
+
import "../bridge/IDelayedMessageProvider.sol";
|
10
10
|
import "../libraries/DelegateCallAware.sol";
|
11
11
|
import {INITIALIZATION_MSG_TYPE} from "../libraries/MessageTypes.sol";
|
12
12
|
|
13
13
|
/**
|
14
14
|
* @title The inbox for rollup protocol events
|
15
15
|
*/
|
16
|
-
contract
|
16
|
+
contract RollupEventInbox is IRollupEventInbox, IDelayedMessageProvider, DelegateCallAware {
|
17
17
|
uint8 internal constant CREATE_NODE_EVENT = 0;
|
18
18
|
uint8 internal constant CONFIRM_NODE_EVENT = 1;
|
19
19
|
uint8 internal constant REJECT_NODE_EVENT = 2;
|
20
20
|
uint8 internal constant STAKE_CREATED_EVENT = 3;
|
21
21
|
|
22
|
-
IBridge public bridge;
|
23
|
-
address public rollup;
|
22
|
+
IBridge public override bridge;
|
23
|
+
address public override rollup;
|
24
24
|
|
25
25
|
modifier onlyRollup() {
|
26
26
|
require(msg.sender == rollup, "ONLY_ROLLUP");
|
27
27
|
_;
|
28
28
|
}
|
29
29
|
|
30
|
-
function initialize(
|
31
|
-
require(
|
32
|
-
bridge =
|
33
|
-
rollup =
|
30
|
+
function initialize(IBridge _bridge) external override onlyDelegated {
|
31
|
+
require(address(bridge) == address(0), "ALREADY_INIT");
|
32
|
+
bridge = _bridge;
|
33
|
+
rollup = address(_bridge.rollup());
|
34
34
|
}
|
35
35
|
|
36
|
-
function rollupInitialized(uint256 chainId) external onlyRollup {
|
36
|
+
function rollupInitialized(uint256 chainId) external override onlyRollup {
|
37
37
|
bytes memory initMsg = abi.encodePacked(chainId);
|
38
38
|
uint256 num = bridge.enqueueDelayedMessage(
|
39
39
|
INITIALIZATION_MSG_TYPE,
|