@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.
Files changed (54) hide show
  1. package/package.json +2 -1
  2. package/src/bridge/Bridge.sol +127 -32
  3. package/src/bridge/IBridge.sol +40 -6
  4. package/src/bridge/{IMessageProvider.sol → IDelayedMessageProvider.sol} +2 -3
  5. package/src/bridge/IInbox.sol +23 -2
  6. package/src/bridge/IOwnable.sol +9 -0
  7. package/src/bridge/ISequencerInbox.sol +36 -9
  8. package/src/bridge/Inbox.sol +131 -45
  9. package/src/bridge/Outbox.sol +134 -31
  10. package/src/bridge/SequencerInbox.sol +159 -60
  11. package/src/challenge/ChallengeLib.sol +0 -2
  12. package/src/challenge/ChallengeManager.sol +4 -8
  13. package/src/challenge/IChallengeManager.sol +1 -1
  14. package/src/libraries/Error.sol +6 -0
  15. package/src/libraries/IGasRefunder.sol +12 -13
  16. package/src/libraries/MerkleLib.sol +11 -2
  17. package/src/libraries/MessageTypes.sol +1 -0
  18. package/src/mocks/BridgeStub.sol +67 -21
  19. package/src/mocks/InboxStub.sol +3 -9
  20. package/src/mocks/SequencerInboxStub.sol +10 -8
  21. package/src/mocks/Simple.sol +8 -0
  22. package/src/node-interface/NodeInterface.sol +32 -5
  23. package/src/osp/IOneStepProver.sol +1 -2
  24. package/src/osp/OneStepProver0.sol +1 -87
  25. package/src/osp/OneStepProverHostIo.sol +5 -6
  26. package/src/osp/OneStepProverMath.sol +37 -27
  27. package/src/osp/OneStepProverMemory.sol +3 -4
  28. package/src/precompiles/ArbAggregator.sol +23 -33
  29. package/src/precompiles/ArbBLS.sol +1 -43
  30. package/src/precompiles/ArbGasInfo.sol +1 -19
  31. package/src/precompiles/ArbOwner.sol +12 -15
  32. package/src/precompiles/ArbRetryableTx.sol +10 -1
  33. package/src/precompiles/ArbosActs.sol +9 -2
  34. package/src/rollup/BridgeCreator.sol +23 -28
  35. package/src/rollup/IRollupCore.sol +3 -3
  36. package/src/rollup/{IRollupEventBridge.sol → IRollupEventInbox.sol} +2 -2
  37. package/src/rollup/IRollupLogic.sol +21 -18
  38. package/src/rollup/RollupAdminLogic.sol +30 -34
  39. package/src/rollup/RollupCore.sol +15 -7
  40. package/src/rollup/RollupCreator.sol +21 -11
  41. package/src/rollup/{RollupEventBridge.sol → RollupEventInbox.sol} +10 -10
  42. package/src/rollup/RollupLib.sol +20 -5
  43. package/src/rollup/RollupUserLogic.sol +9 -18
  44. package/src/rollup/ValidatorWallet.sol +124 -8
  45. package/src/rollup/ValidatorWalletCreator.sol +11 -6
  46. package/src/state/Deserialize.sol +3 -22
  47. package/src/state/Instructions.sol +2 -10
  48. package/src/state/Machine.sol +0 -4
  49. package/src/state/ModuleMemory.sol +2 -1
  50. package/src/state/Value.sol +2 -3
  51. package/src/test-helpers/BridgeTester.sol +223 -0
  52. package/src/test-helpers/OutboxWithoutOptTester.sol +188 -0
  53. package/src/test-helpers/RollupMock.sol +21 -0
  54. package/src/state/PcStack.sol +0 -32
@@ -11,7 +11,8 @@ import "../bridge/ISequencerInbox.sol";
11
11
 
12
12
  import "../bridge/IBridge.sol";
13
13
  import "../bridge/IOutbox.sol";
14
- import "./IRollupEventBridge.sol";
14
+ import "../bridge/IInbox.sol";
15
+ import "./IRollupEventInbox.sol";
15
16
  import "./IRollupLogic.sol";
16
17
 
17
18
  struct Config {
@@ -27,13 +28,17 @@ struct Config {
27
28
  }
28
29
 
29
30
  struct ContractDependencies {
30
- IBridge delayedBridge;
31
+ IBridge bridge;
31
32
  ISequencerInbox sequencerInbox;
33
+ IInbox inbox;
32
34
  IOutbox outbox;
33
- IRollupEventBridge rollupEventBridge;
35
+ IRollupEventInbox rollupEventInbox;
34
36
  IChallengeManager challengeManager;
35
37
  IRollupAdmin rollupAdminLogic;
36
38
  IRollupUser rollupUserLogic;
39
+ // misc contracts that are useful when interacting with the rollup
40
+ address validatorUtils;
41
+ address validatorWalletCreator;
37
42
  }
38
43
 
39
44
  library RollupLib {
@@ -127,9 +132,19 @@ library RollupLib {
127
132
  bool hasSibling,
128
133
  bytes32 lastHash,
129
134
  bytes32 assertionExecHash,
130
- bytes32 inboxAcc
135
+ bytes32 inboxAcc,
136
+ bytes32 wasmModuleRoot
131
137
  ) internal pure returns (bytes32) {
132
138
  uint8 hasSiblingInt = hasSibling ? 1 : 0;
133
- return keccak256(abi.encodePacked(hasSiblingInt, lastHash, assertionExecHash, inboxAcc));
139
+ return
140
+ keccak256(
141
+ abi.encodePacked(
142
+ hasSiblingInt,
143
+ lastHash,
144
+ assertionExecHash,
145
+ inboxAcc,
146
+ wasmModuleRoot
147
+ )
148
+ );
134
149
  }
135
150
  }
@@ -487,6 +487,10 @@ abstract contract AbsRollupUserLogic is
487
487
  return currentRequiredStake(blockNumber, firstUnresolvedNodeNum, latestCreatedNode);
488
488
  }
489
489
 
490
+ function owner() external view returns (address) {
491
+ return _getAdmin();
492
+ }
493
+
490
494
  function currentRequiredStake() public view returns (uint256) {
491
495
  uint64 firstUnresolvedNodeNum = firstUnresolvedNode();
492
496
 
@@ -615,18 +619,12 @@ contract RollupUserLogic is AbsRollupUserLogic, IRollupUser {
615
619
 
616
620
  /**
617
621
  * @notice Withdraw uncommitted funds owned by sender from the rollup chain
618
- * @param destination Address to transfer the withdrawn funds to
619
622
  */
620
- function withdrawStakerFunds(address payable destination)
621
- external
622
- override
623
- onlyValidator
624
- whenNotPaused
625
- returns (uint256)
626
- {
623
+ function withdrawStakerFunds() external override onlyValidator whenNotPaused returns (uint256) {
627
624
  uint256 amount = withdrawFunds(msg.sender);
628
625
  // This is safe because it occurs after all checks and effects
629
- destination.transfer(amount);
626
+ (bool success, ) = msg.sender.call{value: amount}("");
627
+ require(success, "TRANSFER_FAILED");
630
628
  return amount;
631
629
  }
632
630
  }
@@ -692,18 +690,11 @@ contract ERC20RollupUserLogic is AbsRollupUserLogic, IRollupUserERC20 {
692
690
 
693
691
  /**
694
692
  * @notice Withdraw uncommitted funds owned by sender from the rollup chain
695
- * @param destination Address to transfer the withdrawn funds to
696
693
  */
697
- function withdrawStakerFunds(address payable destination)
698
- external
699
- override
700
- onlyValidator
701
- whenNotPaused
702
- returns (uint256)
703
- {
694
+ function withdrawStakerFunds() external override onlyValidator whenNotPaused returns (uint256) {
704
695
  uint256 amount = withdrawFunds(msg.sender);
705
696
  // This is safe because it occurs after all checks and effects
706
- require(IERC20Upgradeable(stakeToken).transfer(destination, amount), "TRANSFER_FAILED");
697
+ require(IERC20Upgradeable(stakeToken).transfer(msg.sender, amount), "TRANSFER_FAILED");
707
698
  return amount;
708
699
  }
709
700
 
@@ -6,24 +6,117 @@ pragma solidity ^0.8.0;
6
6
 
7
7
  import "../challenge/IChallengeManager.sol";
8
8
  import "../libraries/DelegateCallAware.sol";
9
+ import "../libraries/IGasRefunder.sol";
9
10
  import "@openzeppelin/contracts/utils/Address.sol";
10
11
  import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
11
12
 
12
- contract ValidatorWallet is OwnableUpgradeable, DelegateCallAware {
13
+ /// @dev thrown when arrays provided don't have the expected length
14
+ error BadArrayLength(uint256 expected, uint256 actual);
15
+
16
+ /// @dev thrown when a function is called by an address that isn't the owner nor a executor
17
+ error NotExecutorOrOwner(address actual);
18
+
19
+ /// @dev thrown when the particular address can't be called by an executor
20
+ error OnlyOwnerDestination(address expected, address actual, address destination);
21
+
22
+ /// @dev thrown when eth withdrawal tx fails
23
+ error WithdrawEthFail(address destination);
24
+
25
+ contract ValidatorWallet is OwnableUpgradeable, DelegateCallAware, GasRefundEnabled {
13
26
  using Address for address;
14
27
 
15
- function initialize() external initializer onlyDelegated {
28
+ /// @dev a executor is allowed to call only certain contracts
29
+ mapping(address => bool) public executors;
30
+
31
+ /// @dev allowed addresses which can be called by an executor
32
+ mapping(address => bool) public allowedExecutorDestinations;
33
+
34
+ modifier onlyExecutorOrOwner() {
35
+ if (!executors[_msgSender()] && owner() != _msgSender())
36
+ revert NotExecutorOrOwner(_msgSender());
37
+ _;
38
+ }
39
+
40
+ event ExecutorUpdated(address indexed executor, bool isExecutor);
41
+
42
+ /// @dev updates the executor addresses
43
+ function setExecutor(address[] calldata newExecutors, bool[] calldata isExecutor)
44
+ external
45
+ onlyOwner
46
+ {
47
+ if (newExecutors.length != isExecutor.length)
48
+ revert BadArrayLength(newExecutors.length, isExecutor.length);
49
+ unchecked {
50
+ for (uint64 i = 0; i < newExecutors.length; ++i) {
51
+ executors[newExecutors[i]] = isExecutor[i];
52
+ emit ExecutorUpdated(newExecutors[i], isExecutor[i]);
53
+ }
54
+ }
55
+ }
56
+
57
+ function initialize(
58
+ address _executor,
59
+ address _owner,
60
+ address[] calldata initialExecutorAllowedDests
61
+ ) external initializer onlyDelegated {
16
62
  __Ownable_init();
63
+ transferOwnership(_owner);
64
+
65
+ executors[_executor] = true;
66
+ emit ExecutorUpdated(_executor, true);
67
+
68
+ unchecked {
69
+ for (uint64 i = 0; i < initialExecutorAllowedDests.length; ++i) {
70
+ allowedExecutorDestinations[initialExecutorAllowedDests[i]] = true;
71
+ emit AllowedExecutorDestinationsUpdated(initialExecutorAllowedDests[i], true);
72
+ }
73
+ }
74
+ }
75
+
76
+ event AllowedExecutorDestinationsUpdated(address indexed destination, bool isSet);
77
+
78
+ /// @notice updates the destination addresses which executors are allowed to call
79
+ function setAllowedExecutorDestinations(address[] calldata destinations, bool[] calldata isSet)
80
+ external
81
+ onlyOwner
82
+ {
83
+ if (destinations.length != isSet.length)
84
+ revert BadArrayLength(destinations.length, isSet.length);
85
+ unchecked {
86
+ for (uint256 i = 0; i < destinations.length; ++i) {
87
+ allowedExecutorDestinations[destinations[i]] = isSet[i];
88
+ emit AllowedExecutorDestinationsUpdated(destinations[i], isSet[i]);
89
+ }
90
+ }
91
+ }
92
+
93
+ /// @dev reverts if the current function can't be called
94
+ function validateExecuteTransaction(address destination) public view {
95
+ if (!allowedExecutorDestinations[destination] && owner() != _msgSender())
96
+ revert OnlyOwnerDestination(owner(), _msgSender(), destination);
17
97
  }
18
98
 
19
99
  function executeTransactions(
20
100
  bytes[] calldata data,
21
101
  address[] calldata destination,
22
102
  uint256[] calldata amount
23
- ) external payable onlyOwner {
103
+ ) external payable {
104
+ executeTransactionsWithGasRefunder(IGasRefunder(address(0)), data, destination, amount);
105
+ }
106
+
107
+ function executeTransactionsWithGasRefunder(
108
+ IGasRefunder gasRefunder,
109
+ bytes[] calldata data,
110
+ address[] calldata destination,
111
+ uint256[] calldata amount
112
+ ) public payable onlyExecutorOrOwner refundsGas(gasRefunder) {
24
113
  uint256 numTxes = data.length;
114
+ if (numTxes != destination.length) revert BadArrayLength(numTxes, destination.length);
115
+ if (numTxes != amount.length) revert BadArrayLength(numTxes, amount.length);
116
+
25
117
  for (uint256 i = 0; i < numTxes; i++) {
26
118
  if (data[i].length > 0) require(destination[i].isContract(), "NO_CODE_AT_ADDR");
119
+ validateExecuteTransaction(destination[i]);
27
120
  // We use a low level call here to allow for contract and non-contract calls
28
121
  // solhint-disable-next-line avoid-low-level-calls
29
122
  (bool success, ) = address(destination[i]).call{value: amount[i]}(data[i]);
@@ -42,8 +135,18 @@ contract ValidatorWallet is OwnableUpgradeable, DelegateCallAware {
42
135
  bytes calldata data,
43
136
  address destination,
44
137
  uint256 amount
45
- ) external payable onlyOwner {
138
+ ) external payable {
139
+ executeTransactionWithGasRefunder(IGasRefunder(address(0)), data, destination, amount);
140
+ }
141
+
142
+ function executeTransactionWithGasRefunder(
143
+ IGasRefunder gasRefunder,
144
+ bytes calldata data,
145
+ address destination,
146
+ uint256 amount
147
+ ) public payable onlyExecutorOrOwner refundsGas(gasRefunder) {
46
148
  if (data.length > 0) require(destination.isContract(), "NO_CODE_AT_ADDR");
149
+ validateExecuteTransaction(destination);
47
150
  // We use a low level call here to allow for contract and non-contract calls
48
151
  // solhint-disable-next-line avoid-low-level-calls
49
152
  (bool success, ) = destination.call{value: amount}(data);
@@ -57,10 +160,15 @@ contract ValidatorWallet is OwnableUpgradeable, DelegateCallAware {
57
160
  }
58
161
  }
59
162
 
60
- function timeoutChallenges(IChallengeManager manager, uint64[] calldata challenges)
61
- external
62
- onlyOwner
63
- {
163
+ function timeoutChallenges(IChallengeManager manager, uint64[] calldata challenges) external {
164
+ timeoutChallengesWithGasRefunder(IGasRefunder(address(0)), manager, challenges);
165
+ }
166
+
167
+ function timeoutChallengesWithGasRefunder(
168
+ IGasRefunder gasRefunder,
169
+ IChallengeManager manager,
170
+ uint64[] calldata challenges
171
+ ) public onlyExecutorOrOwner refundsGas(gasRefunder) {
64
172
  uint256 challengesCount = challenges.length;
65
173
  for (uint256 i = 0; i < challengesCount; i++) {
66
174
  try manager.timeout(challenges[i]) {} catch (bytes memory error) {
@@ -72,4 +180,12 @@ contract ValidatorWallet is OwnableUpgradeable, DelegateCallAware {
72
180
  }
73
181
  }
74
182
  }
183
+
184
+ receive() external payable {}
185
+
186
+ /// @dev allows the owner to withdraw eth held by this contract
187
+ function withdrawEth(uint256 amount, address destination) external onlyOwner {
188
+ (bool success, ) = destination.call{value: amount}("");
189
+ if (!success) revert WithdrawEthFail(destination);
190
+ }
75
191
  }
@@ -13,7 +13,8 @@ import "./ValidatorWallet.sol";
13
13
  contract ValidatorWalletCreator is Ownable {
14
14
  event WalletCreated(
15
15
  address indexed walletAddress,
16
- address indexed userAddress,
16
+ address indexed executorAddress,
17
+ address indexed ownerAddress,
17
18
  address adminProxy
18
19
  );
19
20
  event TemplateUpdated();
@@ -29,15 +30,19 @@ contract ValidatorWalletCreator is Ownable {
29
30
  emit TemplateUpdated();
30
31
  }
31
32
 
32
- function createWallet() external returns (address) {
33
+ function createWallet(address[] calldata initialExecutorAllowedDests)
34
+ external
35
+ returns (address)
36
+ {
37
+ address _executor = msg.sender;
38
+ address _owner = msg.sender;
33
39
  ProxyAdmin admin = new ProxyAdmin();
34
40
  address proxy = address(
35
41
  new TransparentUpgradeableProxy(address(template), address(admin), "")
36
42
  );
37
- admin.transferOwnership(msg.sender);
38
- ValidatorWallet(proxy).initialize();
39
- ValidatorWallet(proxy).transferOwnership(msg.sender);
40
- emit WalletCreated(proxy, msg.sender, address(admin));
43
+ admin.transferOwnership(_owner);
44
+ ValidatorWallet(payable(proxy)).initialize(_executor, _owner, initialExecutorAllowedDests);
45
+ emit WalletCreated(proxy, _executor, _owner, address(admin));
41
46
  return proxy;
42
47
  }
43
48
  }
@@ -6,7 +6,6 @@ pragma solidity ^0.8.0;
6
6
 
7
7
  import "./Value.sol";
8
8
  import "./ValueStack.sol";
9
- import "./PcStack.sol";
10
9
  import "./Machine.sol";
11
10
  import "./Instructions.sol";
12
11
  import "./StackFrame.sol";
@@ -120,23 +119,6 @@ library Deserialize {
120
119
  stack = ValueStack({proved: ValueArray(proved), remainingHash: remainingHash});
121
120
  }
122
121
 
123
- function pcStack(bytes calldata proof, uint256 startOffset)
124
- internal
125
- pure
126
- returns (PcStack memory stack, uint256 offset)
127
- {
128
- offset = startOffset;
129
- bytes32 remainingHash;
130
- (remainingHash, offset) = b32(proof, offset);
131
- uint256 provedLength;
132
- (provedLength, offset) = u256(proof, offset);
133
- uint32[] memory proved = new uint32[](provedLength);
134
- for (uint256 i = 0; i < proved.length; i++) {
135
- (proved[i], offset) = u32(proof, offset);
136
- }
137
- stack = PcStack({proved: PcArray(proved), remainingHash: remainingHash});
138
- }
139
-
140
122
  function instruction(bytes calldata proof, uint256 startOffset)
141
123
  internal
142
124
  pure
@@ -199,10 +181,12 @@ library Deserialize {
199
181
  {
200
182
  offset = startOffset;
201
183
  uint64 size;
184
+ uint64 maxSize;
202
185
  bytes32 root;
203
186
  (size, offset) = u64(proof, offset);
187
+ (maxSize, offset) = u64(proof, offset);
204
188
  (root, offset) = b32(proof, offset);
205
- mem = ModuleMemory({size: size, merkleRoot: root});
189
+ mem = ModuleMemory({size: size, maxSize: maxSize, merkleRoot: root});
206
190
  }
207
191
 
208
192
  function module(bytes calldata proof, uint256 startOffset)
@@ -274,7 +258,6 @@ library Deserialize {
274
258
  }
275
259
  ValueStack memory values;
276
260
  ValueStack memory internalStack;
277
- PcStack memory blocks;
278
261
  bytes32 globalStateHash;
279
262
  uint32 moduleIdx;
280
263
  uint32 functionIdx;
@@ -283,7 +266,6 @@ library Deserialize {
283
266
  bytes32 modulesRoot;
284
267
  (values, offset) = valueStack(proof, offset);
285
268
  (internalStack, offset) = valueStack(proof, offset);
286
- (blocks, offset) = pcStack(proof, offset);
287
269
  (frameStack, offset) = stackFrameWindow(proof, offset);
288
270
  (globalStateHash, offset) = b32(proof, offset);
289
271
  (moduleIdx, offset) = u32(proof, offset);
@@ -294,7 +276,6 @@ library Deserialize {
294
276
  status: status,
295
277
  valueStack: values,
296
278
  internalStack: internalStack,
297
- blockStack: blocks,
298
279
  frameStack: frameStack,
299
280
  globalStateHash: globalStateHash,
300
281
  moduleIdx: moduleIdx,
@@ -12,9 +12,6 @@ struct Instruction {
12
12
  library Instructions {
13
13
  uint16 internal constant UNREACHABLE = 0x00;
14
14
  uint16 internal constant NOP = 0x01;
15
- uint16 internal constant BLOCK = 0x02;
16
- uint16 internal constant BRANCH = 0x0C;
17
- uint16 internal constant BRANCH_IF = 0x0D;
18
15
  uint16 internal constant RETURN = 0x0F;
19
16
  uint16 internal constant CALL = 0x10;
20
17
  uint16 internal constant CALL_INDIRECT = 0x11;
@@ -129,14 +126,11 @@ library Instructions {
129
126
  uint16 internal constant I64_EXTEND_16S = 0xC3;
130
127
  uint16 internal constant I64_EXTEND_32S = 0xC4;
131
128
 
132
- uint16 internal constant END_BLOCK = 0x8000;
133
- uint16 internal constant END_BLOCK_IF = 0x8001;
134
129
  uint16 internal constant INIT_FRAME = 0x8002;
135
- uint16 internal constant ARBITRARY_JUMP_IF = 0x8003;
136
- uint16 internal constant PUSH_STACK_BOUNDARY = 0x8004;
130
+ uint16 internal constant ARBITRARY_JUMP = 0x8003;
131
+ uint16 internal constant ARBITRARY_JUMP_IF = 0x8004;
137
132
  uint16 internal constant MOVE_FROM_STACK_TO_INTERNAL = 0x8005;
138
133
  uint16 internal constant MOVE_FROM_INTERNAL_TO_STACK = 0x8006;
139
- uint16 internal constant IS_STACK_BOUNDARY = 0x8007;
140
134
  uint16 internal constant DUP = 0x8008;
141
135
  uint16 internal constant CROSS_MODULE_CALL = 0x8009;
142
136
  uint16 internal constant CALLER_MODULE_INTERNAL_CALL = 0x800A;
@@ -150,8 +144,6 @@ library Instructions {
150
144
  uint16 internal constant READ_INBOX_MESSAGE = 0x8021;
151
145
  uint16 internal constant HALT_AND_SET_FINISHED = 0x8022;
152
146
 
153
- uint16 internal constant ARBITRARY_JUMP = 0x8023;
154
-
155
147
  uint256 internal constant INBOX_INDEX_SEQUENCER = 0;
156
148
  uint256 internal constant INBOX_INDEX_DELAYED = 1;
157
149
 
@@ -5,7 +5,6 @@
5
5
  pragma solidity ^0.8.0;
6
6
 
7
7
  import "./ValueStack.sol";
8
- import "./PcStack.sol";
9
8
  import "./Instructions.sol";
10
9
  import "./StackFrame.sol";
11
10
 
@@ -20,7 +19,6 @@ struct Machine {
20
19
  MachineStatus status;
21
20
  ValueStack valueStack;
22
21
  ValueStack internalStack;
23
- PcStack blockStack;
24
22
  StackFrameWindow frameStack;
25
23
  bytes32 globalStateHash;
26
24
  uint32 moduleIdx;
@@ -30,7 +28,6 @@ struct Machine {
30
28
  }
31
29
 
32
30
  library MachineLib {
33
- using PcStackLib for PcStack;
34
31
  using StackFrameLib for StackFrameWindow;
35
32
  using ValueStackLib for ValueStack;
36
33
 
@@ -43,7 +40,6 @@ library MachineLib {
43
40
  "Machine running:",
44
41
  mach.valueStack.hash(),
45
42
  mach.internalStack.hash(),
46
- mach.blockStack.hash(),
47
43
  mach.frameStack.hash(),
48
44
  mach.globalStateHash,
49
45
  mach.moduleIdx,
@@ -9,6 +9,7 @@ import "./Deserialize.sol";
9
9
 
10
10
  struct ModuleMemory {
11
11
  uint64 size;
12
+ uint64 maxSize;
12
13
  bytes32 merkleRoot;
13
14
  }
14
15
 
@@ -16,7 +17,7 @@ library ModuleMemoryLib {
16
17
  using MerkleProofLib for MerkleProof;
17
18
 
18
19
  function hash(ModuleMemory memory mem) internal pure returns (bytes32) {
19
- return keccak256(abi.encodePacked("Memory:", mem.size, mem.merkleRoot));
20
+ return keccak256(abi.encodePacked("Memory:", mem.size, mem.maxSize, mem.merkleRoot));
20
21
  }
21
22
 
22
23
  function proveLeaf(
@@ -11,8 +11,7 @@ enum ValueType {
11
11
  F64,
12
12
  REF_NULL,
13
13
  FUNC_REF,
14
- INTERNAL_REF,
15
- STACK_BOUNDARY
14
+ INTERNAL_REF
16
15
  }
17
16
 
18
17
  struct Value {
@@ -26,7 +25,7 @@ library ValueLib {
26
25
  }
27
26
 
28
27
  function maxValueType() internal pure returns (ValueType) {
29
- return ValueType.STACK_BOUNDARY;
28
+ return ValueType.INTERNAL_REF;
30
29
  }
31
30
 
32
31
  function assumeI32(Value memory val) internal pure returns (uint32) {