@arbitrum/nitro-contracts 1.0.0-beta.5 → 1.0.0-beta.6
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -8,24 +8,26 @@ import "../bridge/SequencerInbox.sol";
|
|
8
8
|
|
9
9
|
contract SequencerInboxStub is SequencerInbox {
|
10
10
|
constructor(
|
11
|
-
IBridge
|
11
|
+
IBridge bridge_,
|
12
12
|
address sequencer_,
|
13
13
|
ISequencerInbox.MaxTimeVariation memory maxTimeVariation_
|
14
14
|
) {
|
15
|
-
|
16
|
-
rollup = msg.sender;
|
15
|
+
bridge = bridge_;
|
16
|
+
rollup = IOwnable(msg.sender);
|
17
17
|
maxTimeVariation = maxTimeVariation_;
|
18
18
|
isBatchPoster[sequencer_] = true;
|
19
19
|
}
|
20
20
|
|
21
21
|
function addInitMessage() external {
|
22
22
|
(bytes32 dataHash, TimeBounds memory timeBounds) = formEmptyDataHash(0);
|
23
|
-
(
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
(
|
24
|
+
uint256 sequencerMessageCount,
|
25
|
+
bytes32 beforeAcc,
|
26
|
+
bytes32 delayedAcc,
|
27
|
+
bytes32 afterAcc
|
28
|
+
) = addSequencerL2BatchImpl(dataHash, 0, 0);
|
27
29
|
emit SequencerBatchDelivered(
|
28
|
-
|
30
|
+
sequencerMessageCount,
|
29
31
|
beforeAcc,
|
30
32
|
afterAcc,
|
31
33
|
delayedAcc,
|
package/src/mocks/Simple.sol
CHANGED
@@ -4,10 +4,13 @@
|
|
4
4
|
|
5
5
|
pragma solidity ^0.8.0;
|
6
6
|
|
7
|
+
import "../precompiles/ArbRetryableTx.sol";
|
8
|
+
|
7
9
|
contract Simple {
|
8
10
|
uint64 public counter;
|
9
11
|
|
10
12
|
event CounterEvent(uint64 count);
|
13
|
+
event RedeemedEvent(address caller, address redeemer);
|
11
14
|
event NullEvent();
|
12
15
|
|
13
16
|
function increment() external {
|
@@ -19,6 +22,11 @@ contract Simple {
|
|
19
22
|
emit CounterEvent(counter);
|
20
23
|
}
|
21
24
|
|
25
|
+
function incrementRedeem() external {
|
26
|
+
counter++;
|
27
|
+
emit RedeemedEvent(msg.sender, ArbRetryableTx(address(110)).getCurrentRedeemer());
|
28
|
+
}
|
29
|
+
|
22
30
|
function emitNullEvent() external {
|
23
31
|
emit NullEvent();
|
24
32
|
}
|
@@ -11,7 +11,8 @@ pragma solidity >=0.4.21 <0.9.0;
|
|
11
11
|
*/
|
12
12
|
interface NodeInterface {
|
13
13
|
/**
|
14
|
-
* @notice Estimate the cost of putting a message in the L2 inbox that is reexecuted
|
14
|
+
* @notice Estimate the cost of putting a message in the L2 inbox that is reexecuted.
|
15
|
+
* Use eth_estimateGas to call.
|
15
16
|
* @param sender sender of the L1 and L2 transaction
|
16
17
|
* @param deposit amount to deposit to sender in L2
|
17
18
|
* @param to destination L2 contract address
|
@@ -31,7 +32,8 @@ interface NodeInterface {
|
|
31
32
|
) external;
|
32
33
|
|
33
34
|
/**
|
34
|
-
* @notice Constructs an outbox proof of an l2->l1 send's existence in the outbox accumulator
|
35
|
+
* @notice Constructs an outbox proof of an l2->l1 send's existence in the outbox accumulator.
|
36
|
+
* Use eth_call to call.
|
35
37
|
* @param size the number of elements in the accumulator
|
36
38
|
* @param leaf the position of the send in the accumulator
|
37
39
|
* @return send the l2->l1 send's hash
|
@@ -48,8 +50,9 @@ interface NodeInterface {
|
|
48
50
|
);
|
49
51
|
|
50
52
|
/**
|
51
|
-
* @notice Finds the L1 batch containing a requested L2 block, reverting if none does
|
52
|
-
*
|
53
|
+
* @notice Finds the L1 batch containing a requested L2 block, reverting if none does.
|
54
|
+
* Use eth_call to call.
|
55
|
+
* Throws if block doesn't exist, or if block number is 0. Use eth_call
|
53
56
|
* @param blockNum The L2 block being queried
|
54
57
|
* @return batch The L1 block containing the requested L2 block
|
55
58
|
*/
|
@@ -59,9 +62,33 @@ interface NodeInterface {
|
|
59
62
|
* @notice Gets the number of L1 confirmations of the sequencer batch producing the requested L2 block
|
60
63
|
* This gets the number of L1 confirmations for the input message producing the L2 block,
|
61
64
|
* which happens well before the L1 rollup contract confirms the L2 block.
|
62
|
-
* Throws if block doesnt exist in the L2 chain.
|
65
|
+
* Throws if block doesnt exist in the L2 chain. Use eth_call to call.
|
63
66
|
* @param blockHash The hash of the L2 block being queried
|
64
67
|
* @return confirmations The number of L1 confirmations the sequencer batch has. Returns 0 if block not yet included in an L1 batch.
|
65
68
|
*/
|
66
69
|
function getL1Confirmations(bytes32 blockHash) external view returns (uint64 confirmations);
|
70
|
+
|
71
|
+
/**
|
72
|
+
* @notice Same as native gas estimation, but with additional info on the l1 costs. Use eth_call to call.
|
73
|
+
* @param data the tx's calldata. Everything else like "From" and "Gas" are copied over
|
74
|
+
* @param to the tx's "To" (ignored when contractCreation is true)
|
75
|
+
* @param contractCreation whether "To" is omitted
|
76
|
+
* @return gasEstimate an estimate of the total amount of gas needed for this tx
|
77
|
+
* @return gasEstimateForL1 an estimate of the amount of gas needed for the l1 component of this tx
|
78
|
+
* @return baseFee the l2 base fee
|
79
|
+
* @return l1BaseFeeEstimate ArbOS's l1 estimate of the l1 base fee
|
80
|
+
*/
|
81
|
+
function gasEstimateComponents(
|
82
|
+
address to,
|
83
|
+
bool contractCreation,
|
84
|
+
bytes calldata data
|
85
|
+
)
|
86
|
+
external
|
87
|
+
payable
|
88
|
+
returns (
|
89
|
+
uint64 gasEstimate,
|
90
|
+
uint64 gasEstimateForL1,
|
91
|
+
uint256 baseFee,
|
92
|
+
uint256 l1BaseFeeEstimate
|
93
|
+
);
|
67
94
|
}
|
@@ -12,7 +12,6 @@ import "./IOneStepProver.sol";
|
|
12
12
|
|
13
13
|
contract OneStepProver0 is IOneStepProver {
|
14
14
|
using MerkleProofLib for MerkleProof;
|
15
|
-
using PcStackLib for PcStack;
|
16
15
|
using StackFrameLib for StackFrameWindow;
|
17
16
|
using ValueLib for Value;
|
18
17
|
using ValueStackLib for ValueStack;
|
@@ -51,8 +50,6 @@ contract OneStepProver0 is IOneStepProver {
|
|
51
50
|
ty = ValueType.F32;
|
52
51
|
} else if (opcode == Instructions.F64_CONST) {
|
53
52
|
ty = ValueType.F64;
|
54
|
-
} else if (opcode == Instructions.PUSH_STACK_BOUNDARY) {
|
55
|
-
ty = ValueType.STACK_BOUNDARY;
|
56
53
|
} else {
|
57
54
|
revert("CONST_PUSH_INVALID_OPCODE");
|
58
55
|
}
|
@@ -86,39 +83,6 @@ contract OneStepProver0 is IOneStepProver {
|
|
86
83
|
}
|
87
84
|
}
|
88
85
|
|
89
|
-
function executeBlock(
|
90
|
-
Machine memory mach,
|
91
|
-
Module memory,
|
92
|
-
Instruction calldata inst,
|
93
|
-
bytes calldata
|
94
|
-
) internal pure {
|
95
|
-
uint32 targetPc = uint32(inst.argumentData);
|
96
|
-
require(targetPc == inst.argumentData, "BAD_BLOCK_PC");
|
97
|
-
mach.blockStack.push(targetPc);
|
98
|
-
}
|
99
|
-
|
100
|
-
function executeBranch(
|
101
|
-
Machine memory mach,
|
102
|
-
Module memory,
|
103
|
-
Instruction calldata,
|
104
|
-
bytes calldata
|
105
|
-
) internal pure {
|
106
|
-
mach.functionPc = mach.blockStack.pop();
|
107
|
-
}
|
108
|
-
|
109
|
-
function executeBranchIf(
|
110
|
-
Machine memory mach,
|
111
|
-
Module memory,
|
112
|
-
Instruction calldata,
|
113
|
-
bytes calldata
|
114
|
-
) internal pure {
|
115
|
-
uint32 cond = mach.valueStack.pop().assumeI32();
|
116
|
-
if (cond != 0) {
|
117
|
-
// Jump to target
|
118
|
-
mach.functionPc = mach.blockStack.pop();
|
119
|
-
}
|
120
|
-
}
|
121
|
-
|
122
86
|
function executeReturn(
|
123
87
|
Machine memory mach,
|
124
88
|
Module memory,
|
@@ -419,27 +383,6 @@ contract OneStepProver0 is IOneStepProver {
|
|
419
383
|
);
|
420
384
|
}
|
421
385
|
|
422
|
-
function executeEndBlock(
|
423
|
-
Machine memory mach,
|
424
|
-
Module memory,
|
425
|
-
Instruction calldata,
|
426
|
-
bytes calldata
|
427
|
-
) internal pure {
|
428
|
-
mach.blockStack.pop();
|
429
|
-
}
|
430
|
-
|
431
|
-
function executeEndBlockIf(
|
432
|
-
Machine memory mach,
|
433
|
-
Module memory,
|
434
|
-
Instruction calldata,
|
435
|
-
bytes calldata
|
436
|
-
) internal pure {
|
437
|
-
uint32 cond = mach.valueStack.peek().assumeI32();
|
438
|
-
if (cond != 0) {
|
439
|
-
mach.blockStack.pop();
|
440
|
-
}
|
441
|
-
}
|
442
|
-
|
443
386
|
function executeInitFrame(
|
444
387
|
Machine memory mach,
|
445
388
|
Module memory,
|
@@ -476,20 +419,6 @@ contract OneStepProver0 is IOneStepProver {
|
|
476
419
|
}
|
477
420
|
}
|
478
421
|
|
479
|
-
function executeIsStackBoundary(
|
480
|
-
Machine memory mach,
|
481
|
-
Module memory,
|
482
|
-
Instruction calldata,
|
483
|
-
bytes calldata
|
484
|
-
) internal pure {
|
485
|
-
Value memory val = mach.valueStack.pop();
|
486
|
-
uint32 newContents = 0;
|
487
|
-
if (val.valueType == ValueType.STACK_BOUNDARY) {
|
488
|
-
newContents = 1;
|
489
|
-
}
|
490
|
-
mach.valueStack.push(ValueLib.newI32(newContents));
|
491
|
-
}
|
492
|
-
|
493
422
|
function executeDup(
|
494
423
|
Machine memory mach,
|
495
424
|
Module memory,
|
@@ -519,12 +448,6 @@ contract OneStepProver0 is IOneStepProver {
|
|
519
448
|
impl = executeUnreachable;
|
520
449
|
} else if (opcode == Instructions.NOP) {
|
521
450
|
impl = executeNop;
|
522
|
-
} else if (opcode == Instructions.BLOCK) {
|
523
|
-
impl = executeBlock;
|
524
|
-
} else if (opcode == Instructions.BRANCH) {
|
525
|
-
impl = executeBranch;
|
526
|
-
} else if (opcode == Instructions.BRANCH_IF) {
|
527
|
-
impl = executeBranchIf;
|
528
451
|
} else if (opcode == Instructions.RETURN) {
|
529
452
|
impl = executeReturn;
|
530
453
|
} else if (opcode == Instructions.CALL) {
|
@@ -535,10 +458,6 @@ contract OneStepProver0 is IOneStepProver {
|
|
535
458
|
impl = executeCallerModuleInternalCall;
|
536
459
|
} else if (opcode == Instructions.CALL_INDIRECT) {
|
537
460
|
impl = executeCallIndirect;
|
538
|
-
} else if (opcode == Instructions.END_BLOCK) {
|
539
|
-
impl = executeEndBlock;
|
540
|
-
} else if (opcode == Instructions.END_BLOCK_IF) {
|
541
|
-
impl = executeEndBlockIf;
|
542
461
|
} else if (opcode == Instructions.ARBITRARY_JUMP) {
|
543
462
|
impl = executeArbitraryJump;
|
544
463
|
} else if (opcode == Instructions.ARBITRARY_JUMP_IF) {
|
@@ -557,18 +476,13 @@ contract OneStepProver0 is IOneStepProver {
|
|
557
476
|
impl = executeDrop;
|
558
477
|
} else if (opcode == Instructions.SELECT) {
|
559
478
|
impl = executeSelect;
|
560
|
-
} else if (
|
561
|
-
(opcode >= Instructions.I32_CONST && opcode <= Instructions.F64_CONST) ||
|
562
|
-
opcode == Instructions.PUSH_STACK_BOUNDARY
|
563
|
-
) {
|
479
|
+
} else if (opcode >= Instructions.I32_CONST && opcode <= Instructions.F64_CONST) {
|
564
480
|
impl = executeConstPush;
|
565
481
|
} else if (
|
566
482
|
opcode == Instructions.MOVE_FROM_STACK_TO_INTERNAL ||
|
567
483
|
opcode == Instructions.MOVE_FROM_INTERNAL_TO_STACK
|
568
484
|
) {
|
569
485
|
impl = executeMoveInternal;
|
570
|
-
} else if (opcode == Instructions.IS_STACK_BOUNDARY) {
|
571
|
-
impl = executeIsStackBoundary;
|
572
486
|
} else if (opcode == Instructions.DUP) {
|
573
487
|
impl = executeDup;
|
574
488
|
} else {
|
@@ -10,7 +10,6 @@ import "../state/Deserialize.sol";
|
|
10
10
|
import "./IOneStepProver.sol";
|
11
11
|
import "../bridge/Messages.sol";
|
12
12
|
import "../bridge/IBridge.sol";
|
13
|
-
import "../bridge/ISequencerInbox.sol";
|
14
13
|
|
15
14
|
contract OneStepProverHostIo is IOneStepProver {
|
16
15
|
using GlobalStateLib for GlobalState;
|
@@ -165,13 +164,13 @@ contract OneStepProverHostIo is IOneStepProver {
|
|
165
164
|
bytes32 delayedAcc;
|
166
165
|
|
167
166
|
if (msgIndex > 0) {
|
168
|
-
beforeAcc = execCtx.
|
167
|
+
beforeAcc = execCtx.bridge.sequencerInboxAccs(msgIndex - 1);
|
169
168
|
}
|
170
169
|
if (afterDelayedMsg > 0) {
|
171
|
-
delayedAcc = execCtx.
|
170
|
+
delayedAcc = execCtx.bridge.delayedInboxAccs(afterDelayedMsg - 1);
|
172
171
|
}
|
173
172
|
bytes32 acc = keccak256(abi.encodePacked(beforeAcc, messageHash, delayedAcc));
|
174
|
-
require(acc == execCtx.
|
173
|
+
require(acc == execCtx.bridge.sequencerInboxAccs(msgIndex), "BAD_SEQINBOX_MESSAGE");
|
175
174
|
return true;
|
176
175
|
}
|
177
176
|
|
@@ -185,7 +184,7 @@ contract OneStepProverHostIo is IOneStepProver {
|
|
185
184
|
bytes32 beforeAcc;
|
186
185
|
|
187
186
|
if (msgIndex > 0) {
|
188
|
-
beforeAcc = execCtx.
|
187
|
+
beforeAcc = execCtx.bridge.delayedInboxAccs(msgIndex - 1);
|
189
188
|
}
|
190
189
|
|
191
190
|
bytes32 messageDataHash = keccak256(message[DELAYED_HEADER_LEN:]);
|
@@ -198,7 +197,7 @@ contract OneStepProverHostIo is IOneStepProver {
|
|
198
197
|
);
|
199
198
|
bytes32 acc = Messages.accumulateInboxMessage(beforeAcc, messageHash);
|
200
199
|
|
201
|
-
require(acc == execCtx.
|
200
|
+
require(acc == execCtx.bridge.delayedInboxAccs(msgIndex), "BAD_DELAYED_MESSAGE");
|
202
201
|
return true;
|
203
202
|
}
|
204
203
|
|
@@ -210,38 +210,38 @@ contract OneStepProverMath is IOneStepProver {
|
|
210
210
|
uint64 a,
|
211
211
|
uint64 b,
|
212
212
|
uint16 opcodeOffset
|
213
|
-
) internal pure returns (uint64) {
|
213
|
+
) internal pure returns (uint64, bool) {
|
214
214
|
unchecked {
|
215
215
|
if (opcodeOffset == 0) {
|
216
216
|
// add
|
217
|
-
return a + b;
|
217
|
+
return (a + b, false);
|
218
218
|
} else if (opcodeOffset == 1) {
|
219
219
|
// sub
|
220
|
-
return a - b;
|
220
|
+
return (a - b, false);
|
221
221
|
} else if (opcodeOffset == 2) {
|
222
222
|
// mul
|
223
|
-
return a * b;
|
223
|
+
return (a * b, false);
|
224
224
|
} else if (opcodeOffset == 4) {
|
225
225
|
// div_u
|
226
226
|
if (b == 0) {
|
227
|
-
return 0;
|
227
|
+
return (0, true);
|
228
228
|
}
|
229
|
-
return a / b;
|
229
|
+
return (a / b, false);
|
230
230
|
} else if (opcodeOffset == 6) {
|
231
231
|
// rem_u
|
232
232
|
if (b == 0) {
|
233
|
-
return 0;
|
233
|
+
return (0, true);
|
234
234
|
}
|
235
|
-
return a % b;
|
235
|
+
return (a % b, false);
|
236
236
|
} else if (opcodeOffset == 7) {
|
237
237
|
// and
|
238
|
-
return a & b;
|
238
|
+
return (a & b, false);
|
239
239
|
} else if (opcodeOffset == 8) {
|
240
240
|
// or
|
241
|
-
return a | b;
|
241
|
+
return (a | b, false);
|
242
242
|
} else if (opcodeOffset == 9) {
|
243
243
|
// xor
|
244
|
-
return a ^ b;
|
244
|
+
return (a ^ b, false);
|
245
245
|
} else {
|
246
246
|
revert("INVALID_GENERIC_BIN_OP");
|
247
247
|
}
|
@@ -263,18 +263,18 @@ contract OneStepProverMath is IOneStepProver {
|
|
263
263
|
unchecked {
|
264
264
|
if (opcodeOffset == 3) {
|
265
265
|
// div_s
|
266
|
-
if (b == 0) {
|
267
|
-
|
268
|
-
|
269
|
-
res = uint32(int32(a) / int32(b));
|
266
|
+
if (b == 0 || (int32(a) == -2147483648 && int32(b) == -1)) {
|
267
|
+
mach.status = MachineStatus.ERRORED;
|
268
|
+
return;
|
270
269
|
}
|
270
|
+
res = uint32(int32(a) / int32(b));
|
271
271
|
} else if (opcodeOffset == 5) {
|
272
272
|
// rem_s
|
273
273
|
if (b == 0) {
|
274
|
-
|
275
|
-
|
276
|
-
res = uint32(int32(a) % int32(b));
|
274
|
+
mach.status = MachineStatus.ERRORED;
|
275
|
+
return;
|
277
276
|
}
|
277
|
+
res = uint32(int32(a) % int32(b));
|
278
278
|
} else if (opcodeOffset == 10) {
|
279
279
|
// shl
|
280
280
|
res = a << (b % 32);
|
@@ -291,7 +291,12 @@ contract OneStepProverMath is IOneStepProver {
|
|
291
291
|
// rotr
|
292
292
|
res = rotr32(a, b);
|
293
293
|
} else {
|
294
|
-
|
294
|
+
(uint64 computed, bool err) = genericBinOp(a, b, opcodeOffset);
|
295
|
+
if (err) {
|
296
|
+
mach.status = MachineStatus.ERRORED;
|
297
|
+
return;
|
298
|
+
}
|
299
|
+
res = uint32(computed);
|
295
300
|
}
|
296
301
|
}
|
297
302
|
|
@@ -313,18 +318,18 @@ contract OneStepProverMath is IOneStepProver {
|
|
313
318
|
unchecked {
|
314
319
|
if (opcodeOffset == 3) {
|
315
320
|
// div_s
|
316
|
-
if (b == 0) {
|
317
|
-
|
318
|
-
|
319
|
-
res = uint64(int64(a) / int64(b));
|
321
|
+
if (b == 0 || (int64(a) == -9223372036854775808 && int64(b) == -1)) {
|
322
|
+
mach.status = MachineStatus.ERRORED;
|
323
|
+
return;
|
320
324
|
}
|
325
|
+
res = uint64(int64(a) / int64(b));
|
321
326
|
} else if (opcodeOffset == 5) {
|
322
327
|
// rem_s
|
323
328
|
if (b == 0) {
|
324
|
-
|
325
|
-
|
326
|
-
res = uint64(int64(a) % int64(b));
|
329
|
+
mach.status = MachineStatus.ERRORED;
|
330
|
+
return;
|
327
331
|
}
|
332
|
+
res = uint64(int64(a) % int64(b));
|
328
333
|
} else if (opcodeOffset == 10) {
|
329
334
|
// shl
|
330
335
|
res = a << (b % 64);
|
@@ -341,7 +346,12 @@ contract OneStepProverMath is IOneStepProver {
|
|
341
346
|
// rotr
|
342
347
|
res = rotr64(a, b);
|
343
348
|
} else {
|
344
|
-
|
349
|
+
bool err;
|
350
|
+
(res, err) = genericBinOp(a, b, opcodeOffset);
|
351
|
+
if (err) {
|
352
|
+
mach.status = MachineStatus.ERRORED;
|
353
|
+
return;
|
354
|
+
}
|
345
355
|
}
|
346
356
|
}
|
347
357
|
|
@@ -271,10 +271,9 @@ contract OneStepProverMemory is IOneStepProver {
|
|
271
271
|
uint32 oldPages = uint32(mod.moduleMemory.size / PAGE_SIZE);
|
272
272
|
uint32 growingPages = mach.valueStack.pop().assumeI32();
|
273
273
|
// Safe as the input integers are too small to overflow a uint256
|
274
|
-
uint256 newSize =
|
275
|
-
|
276
|
-
|
277
|
-
mod.moduleMemory.size = uint64(newSize);
|
274
|
+
uint256 newSize = uint256(oldPages) + uint256(growingPages);
|
275
|
+
if (newSize <= mod.moduleMemory.maxSize) {
|
276
|
+
mod.moduleMemory.size = uint64(newSize * PAGE_SIZE);
|
278
277
|
mach.valueStack.push(ValueLib.newI32(oldPages));
|
279
278
|
} else {
|
280
279
|
mach.valueStack.push(ValueLib.newI32(~uint32(0)));
|
@@ -7,45 +7,35 @@ pragma solidity >=0.4.21 <0.9.0;
|
|
7
7
|
/// @title Provides aggregators and their users methods for configuring how they participate in L1 aggregation.
|
8
8
|
/// @notice Precompiled contract that exists in every Arbitrum chain at 0x000000000000000000000000000000000000006d
|
9
9
|
interface ArbAggregator {
|
10
|
-
/// @notice
|
11
|
-
/// @
|
12
|
-
/// @
|
13
|
-
///
|
10
|
+
/// @notice Deprecated, customization of preferred aggregator is no longer supported
|
11
|
+
/// @notice Get the address of an arbitrarily chosen batch poster.
|
12
|
+
/// @param addr ignored
|
13
|
+
/// @return (batchPosterAddress, true)
|
14
14
|
function getPreferredAggregator(address addr) external view returns (address, bool);
|
15
15
|
|
16
|
-
/// @notice
|
17
|
-
/// @param prefAgg If prefAgg is zero, this sets the caller to prefer the default aggregator
|
18
|
-
function setPreferredAggregator(address prefAgg) external;
|
19
|
-
|
16
|
+
/// @notice Deprecated, there is no longer a single preferred aggregator, use getBatchPosters instead
|
20
17
|
/// @notice Get default aggregator.
|
21
18
|
function getDefaultAggregator() external view returns (address);
|
22
19
|
|
23
|
-
/// @notice
|
24
|
-
///
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
///
|
29
|
-
/// @param
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
/// @
|
34
|
-
/// This
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
/// @
|
40
|
-
/// @param aggregator The aggregator to get the fee collector for
|
41
|
-
/// @return The fee collectors address. This will often but not always be the same as the aggregator's address.
|
42
|
-
function getFeeCollector(address aggregator) external view returns (address);
|
43
|
-
|
44
|
-
/// @notice Set the address where fees to aggregator are sent.
|
45
|
-
/// This reverts unless called by the aggregator, its fee collector, or a chain owner
|
46
|
-
/// @param aggregator The aggregator to set the fee collector for
|
20
|
+
/// @notice Get a list of all current batch posters
|
21
|
+
/// @return Batch poster addresses
|
22
|
+
function getBatchPosters() external view returns (address[] memory);
|
23
|
+
|
24
|
+
/// @notice Adds newBatchPoster as a batch poster
|
25
|
+
/// This reverts unless called by a chain owner
|
26
|
+
/// @param newBatchPoster New batch poster
|
27
|
+
function addBatchPoster(address newBatchPoster) external;
|
28
|
+
|
29
|
+
/// @notice Get the address where fees to batchPoster are sent.
|
30
|
+
/// @param batchPoster The batch poster to get the fee collector for
|
31
|
+
/// @return The fee collectors address. This will sometimes but not always be the same as the batch poster's address.
|
32
|
+
function getFeeCollector(address batchPoster) external view returns (address);
|
33
|
+
|
34
|
+
/// @notice Set the address where fees to batchPoster are sent.
|
35
|
+
/// This reverts unless called by the batch poster, its fee collector, or a chain owner
|
36
|
+
/// @param batchPoster The batch poster to set the fee collector for
|
47
37
|
/// @param newFeeCollector The new fee collector to set
|
48
|
-
function setFeeCollector(address
|
38
|
+
function setFeeCollector(address batchPoster, address newFeeCollector) external;
|
49
39
|
|
50
40
|
/// @notice Deprecated, always returns zero
|
51
41
|
/// @notice Get the tx base fee (in approximate L1 gas) for aggregator
|
@@ -4,50 +4,8 @@
|
|
4
4
|
|
5
5
|
pragma solidity >=0.4.21 <0.9.0;
|
6
6
|
|
7
|
-
/// @title
|
7
|
+
/// @title Disabled precompile, formerly used to register BLS public keys.
|
8
8
|
/// @notice Precompiled contract that exists in every Arbitrum chain at 0x0000000000000000000000000000000000000067.
|
9
9
|
interface ArbBLS {
|
10
|
-
/// @notice Deprecated -- equivalent to registerAltBN128
|
11
|
-
function register(
|
12
|
-
uint256 x0,
|
13
|
-
uint256 x1,
|
14
|
-
uint256 y0,
|
15
|
-
uint256 y1
|
16
|
-
) external; // DEPRECATED
|
17
10
|
|
18
|
-
/// @notice Deprecated -- equivalent to getAltBN128
|
19
|
-
function getPublicKey(address addr)
|
20
|
-
external
|
21
|
-
view
|
22
|
-
returns (
|
23
|
-
uint256,
|
24
|
-
uint256,
|
25
|
-
uint256,
|
26
|
-
uint256
|
27
|
-
); // DEPRECATED
|
28
|
-
|
29
|
-
/// @notice Associate an AltBN128 public key with the caller's address
|
30
|
-
function registerAltBN128(
|
31
|
-
uint256 x0,
|
32
|
-
uint256 x1,
|
33
|
-
uint256 y0,
|
34
|
-
uint256 y1
|
35
|
-
) external;
|
36
|
-
|
37
|
-
/// @notice Get the AltBN128 public key associated with an address (revert if there isn't one)
|
38
|
-
function getAltBN128(address addr)
|
39
|
-
external
|
40
|
-
view
|
41
|
-
returns (
|
42
|
-
uint256,
|
43
|
-
uint256,
|
44
|
-
uint256,
|
45
|
-
uint256
|
46
|
-
);
|
47
|
-
|
48
|
-
/// @notice Associate a BLS 12-381 public key with the caller's address
|
49
|
-
function registerBLS12381(bytes calldata key) external;
|
50
|
-
|
51
|
-
/// @notice Get the BLS 12-381 public key associated with an address (revert if there isn't one)
|
52
|
-
function getBLS12381(address addr) external view returns (bytes memory);
|
53
11
|
}
|
@@ -75,7 +75,7 @@ interface ArbGasInfo {
|
|
75
75
|
uint256
|
76
76
|
);
|
77
77
|
|
78
|
-
/// @notice Get the gas accounting parameters
|
78
|
+
/// @notice Get the gas accounting parameters. `gasPoolMax` is always zero, as the exponential pricing model has no such notion.
|
79
79
|
/// @return (speedLimitPerSecond, gasPoolMax, maxTxGasLimit)
|
80
80
|
function getGasAccountingParams()
|
81
81
|
external
|
@@ -89,21 +89,6 @@ interface ArbGasInfo {
|
|
89
89
|
/// @notice Get the minimum gas price needed for a tx to succeed
|
90
90
|
function getMinimumGasPrice() external view returns (uint256);
|
91
91
|
|
92
|
-
/// @notice Get the number of seconds worth of the speed limit the gas pool contains
|
93
|
-
function getGasPoolSeconds() external view returns (uint64);
|
94
|
-
|
95
|
-
/// @notice Get the target fullness in bips the pricing model will try to keep the pool at
|
96
|
-
function getGasPoolTarget() external view returns (uint64);
|
97
|
-
|
98
|
-
/// @notice Get the extent in bips to which the pricing model favors filling the pool over increasing speeds
|
99
|
-
function getGasPoolWeight() external view returns (uint64);
|
100
|
-
|
101
|
-
/// @notice Get ArbOS's estimate of the amount of gas being burnt per second
|
102
|
-
function getRateEstimate() external view returns (uint64);
|
103
|
-
|
104
|
-
/// @notice Get how slowly ArbOS updates its estimate the amount of gas being burnt per second
|
105
|
-
function getRateEstimateInertia() external view returns (uint64);
|
106
|
-
|
107
92
|
/// @notice Get ArbOS's estimate of the L1 basefee in wei
|
108
93
|
function getL1BaseFeeEstimate() external view returns (uint256);
|
109
94
|
|
@@ -116,9 +101,6 @@ interface ArbGasInfo {
|
|
116
101
|
/// @notice Get L1 gas fees paid by the current transaction
|
117
102
|
function getCurrentTxL1GasFees() external view returns (uint256);
|
118
103
|
|
119
|
-
/// @notice Get the amount of gas remaining in the gas pool
|
120
|
-
function getGasPool() external view returns (int64);
|
121
|
-
|
122
104
|
/// @notice Get the backlogged amount of gas burnt in excess of the speed limit
|
123
105
|
function getGasBacklog() external view returns (uint64);
|
124
106
|
|