@arbitrum/nitro-contracts 1.2.1 → 2.0.0-beta.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (276) hide show
  1. package/build/contracts/@openzeppelin/contracts/access/Ownable.sol/Ownable.dbg.json +1 -1
  2. package/build/contracts/@openzeppelin/contracts/interfaces/draft-IERC1822.sol/IERC1822Proxiable.dbg.json +1 -1
  3. package/build/contracts/@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol/ERC1967Proxy.dbg.json +1 -1
  4. package/build/contracts/@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol/ERC1967Proxy.json +2 -2
  5. package/build/contracts/@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol/ERC1967Upgrade.dbg.json +1 -1
  6. package/build/contracts/@openzeppelin/contracts/proxy/Proxy.sol/Proxy.dbg.json +1 -1
  7. package/build/contracts/@openzeppelin/contracts/proxy/beacon/IBeacon.sol/IBeacon.dbg.json +1 -1
  8. package/build/contracts/@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol/UpgradeableBeacon.dbg.json +1 -1
  9. package/build/contracts/@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol/UpgradeableBeacon.json +2 -2
  10. package/build/contracts/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol/ProxyAdmin.dbg.json +1 -1
  11. package/build/contracts/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol/ProxyAdmin.json +2 -2
  12. package/build/contracts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.dbg.json +1 -1
  13. package/build/contracts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.json +2 -2
  14. package/build/contracts/@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol/UUPSUpgradeable.dbg.json +1 -1
  15. package/build/contracts/@openzeppelin/contracts/security/ReentrancyGuard.sol/ReentrancyGuard.dbg.json +1 -1
  16. package/build/contracts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json +1 -1
  17. package/build/contracts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.json +2 -2
  18. package/build/contracts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json +1 -1
  19. package/build/contracts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json +1 -1
  20. package/build/contracts/@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol/IERC20Permit.dbg.json +4 -0
  21. package/build/contracts/@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol/IERC20Permit.json +86 -0
  22. package/build/contracts/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol/SafeERC20.dbg.json +1 -1
  23. package/build/contracts/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol/SafeERC20.json +2 -2
  24. package/build/contracts/@openzeppelin/contracts/utils/Address.sol/Address.dbg.json +1 -1
  25. package/build/contracts/@openzeppelin/contracts/utils/Address.sol/Address.json +2 -2
  26. package/build/contracts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json +1 -1
  27. package/build/contracts/@openzeppelin/contracts/utils/StorageSlot.sol/StorageSlot.dbg.json +1 -1
  28. package/build/contracts/@openzeppelin/contracts/utils/StorageSlot.sol/StorageSlot.json +2 -2
  29. package/build/contracts/@openzeppelin/contracts/utils/Strings.sol/Strings.dbg.json +4 -0
  30. package/build/contracts/@openzeppelin/contracts/utils/Strings.sol/Strings.json +10 -0
  31. package/build/contracts/@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol/AccessControlUpgradeable.dbg.json +1 -1
  32. package/build/contracts/@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol/AccessControlUpgradeable.json +13 -0
  33. package/build/contracts/@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol/IAccessControlUpgradeable.dbg.json +1 -1
  34. package/build/contracts/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol/OwnableUpgradeable.dbg.json +1 -1
  35. package/build/contracts/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol/OwnableUpgradeable.json +13 -0
  36. package/build/contracts/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol/Initializable.dbg.json +1 -1
  37. package/build/contracts/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol/Initializable.json +15 -1
  38. package/build/contracts/@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol/PausableUpgradeable.dbg.json +1 -1
  39. package/build/contracts/@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol/PausableUpgradeable.json +13 -0
  40. package/build/contracts/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol/IERC20Upgradeable.dbg.json +1 -1
  41. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol/AddressUpgradeable.dbg.json +1 -1
  42. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol/AddressUpgradeable.json +2 -2
  43. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol/ContextUpgradeable.dbg.json +1 -1
  44. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol/ContextUpgradeable.json +15 -1
  45. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol/StorageSlotUpgradeable.dbg.json +1 -1
  46. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol/StorageSlotUpgradeable.json +2 -2
  47. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol/StringsUpgradeable.dbg.json +1 -1
  48. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol/StringsUpgradeable.json +2 -2
  49. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol/ERC165Upgradeable.dbg.json +1 -1
  50. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol/ERC165Upgradeable.json +13 -0
  51. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol/IERC165Upgradeable.dbg.json +1 -1
  52. package/build/contracts/src/bridge/AbsBridge.sol/AbsBridge.dbg.json +1 -1
  53. package/build/contracts/src/bridge/AbsBridge.sol/AbsBridge.json +13 -0
  54. package/build/contracts/src/bridge/AbsInbox.sol/AbsInbox.dbg.json +1 -1
  55. package/build/contracts/src/bridge/AbsInbox.sol/AbsInbox.json +13 -0
  56. package/build/contracts/src/bridge/AbsOutbox.sol/AbsOutbox.dbg.json +1 -1
  57. package/build/contracts/src/bridge/Bridge.sol/Bridge.dbg.json +1 -1
  58. package/build/contracts/src/bridge/Bridge.sol/Bridge.json +15 -2
  59. package/build/contracts/src/bridge/ERC20Bridge.sol/ERC20Bridge.dbg.json +1 -1
  60. package/build/contracts/src/bridge/ERC20Bridge.sol/ERC20Bridge.json +15 -2
  61. package/build/contracts/src/bridge/ERC20Inbox.sol/ERC20Inbox.dbg.json +1 -1
  62. package/build/contracts/src/bridge/ERC20Inbox.sol/ERC20Inbox.json +15 -2
  63. package/build/contracts/src/bridge/ERC20Outbox.sol/ERC20Outbox.dbg.json +1 -1
  64. package/build/contracts/src/bridge/GasRefunder.sol/GasRefunder.dbg.json +1 -1
  65. package/build/contracts/src/bridge/GasRefunder.sol/GasRefunder.json +2 -2
  66. package/build/contracts/src/bridge/IBridge.sol/IBridge.dbg.json +1 -1
  67. package/build/contracts/src/bridge/IDelayedMessageProvider.sol/IDelayedMessageProvider.dbg.json +1 -1
  68. package/build/contracts/src/bridge/IERC20Bridge.sol/IERC20Bridge.dbg.json +1 -1
  69. package/build/contracts/src/bridge/IERC20Inbox.sol/IERC20Inbox.dbg.json +1 -1
  70. package/build/contracts/src/bridge/IEthBridge.sol/IEthBridge.dbg.json +1 -1
  71. package/build/contracts/src/bridge/IInbox.sol/IInbox.dbg.json +1 -1
  72. package/build/contracts/src/bridge/IInboxBase.sol/IInboxBase.dbg.json +1 -1
  73. package/build/contracts/src/bridge/IOutbox.sol/IOutbox.dbg.json +1 -1
  74. package/build/contracts/src/bridge/IOwnable.sol/IOwnable.dbg.json +1 -1
  75. package/build/contracts/src/bridge/ISequencerInbox.sol/ISequencerInbox.dbg.json +1 -1
  76. package/build/contracts/src/bridge/Inbox.sol/Inbox.dbg.json +1 -1
  77. package/build/contracts/src/bridge/Inbox.sol/Inbox.json +15 -2
  78. package/build/contracts/src/bridge/Messages.sol/Messages.dbg.json +1 -1
  79. package/build/contracts/src/bridge/Outbox.sol/Outbox.dbg.json +1 -1
  80. package/build/contracts/src/bridge/SequencerInbox.sol/SequencerInbox.dbg.json +1 -1
  81. package/build/contracts/src/bridge/SequencerInbox.sol/SequencerInbox.json +2 -2
  82. package/build/contracts/src/chain/CacheManager.sol/CacheManager.dbg.json +4 -0
  83. package/build/contracts/src/chain/CacheManager.sol/CacheManager.json +490 -0
  84. package/build/contracts/src/challenge/ChallengeLib.sol/ChallengeLib.dbg.json +1 -1
  85. package/build/contracts/src/challenge/ChallengeLib.sol/ChallengeLib.json +2 -2
  86. package/build/contracts/src/challenge/ChallengeManager.sol/ChallengeManager.dbg.json +1 -1
  87. package/build/contracts/src/challenge/ChallengeManager.sol/ChallengeManager.json +50 -2
  88. package/build/contracts/src/challenge/IChallengeManager.sol/IChallengeManager.dbg.json +1 -1
  89. package/build/contracts/src/challenge/IChallengeManager.sol/IChallengeManager.json +55 -0
  90. package/build/contracts/src/challenge/IChallengeResultReceiver.sol/IChallengeResultReceiver.dbg.json +1 -1
  91. package/build/contracts/src/libraries/AddressAliasHelper.sol/AddressAliasHelper.dbg.json +1 -1
  92. package/build/contracts/src/libraries/AdminFallbackProxy.sol/AdminFallbackProxy.dbg.json +1 -1
  93. package/build/contracts/src/libraries/AdminFallbackProxy.sol/AdminFallbackProxy.json +2 -2
  94. package/build/contracts/src/libraries/AdminFallbackProxy.sol/DoubleLogicERC1967Upgrade.dbg.json +1 -1
  95. package/build/contracts/src/libraries/ArbitrumChecker.sol/ArbitrumChecker.dbg.json +1 -1
  96. package/build/contracts/src/libraries/CryptographyPrimitives.sol/CryptographyPrimitives.dbg.json +1 -1
  97. package/build/contracts/src/libraries/DelegateCallAware.sol/DelegateCallAware.dbg.json +1 -1
  98. package/build/contracts/src/libraries/DoubleLogicUUPSUpgradeable.sol/DoubleLogicUUPSUpgradeable.dbg.json +1 -1
  99. package/build/contracts/src/libraries/GasRefundEnabled.sol/GasRefundEnabled.dbg.json +1 -1
  100. package/build/contracts/src/libraries/IGasRefunder.sol/IGasRefunder.dbg.json +1 -1
  101. package/build/contracts/src/libraries/IReader4844.sol/IReader4844.dbg.json +1 -1
  102. package/build/contracts/src/libraries/MerkleLib.sol/MerkleLib.dbg.json +1 -1
  103. package/build/contracts/src/libraries/UUPSNotUpgradeable.sol/UUPSNotUpgradeable.dbg.json +1 -1
  104. package/build/contracts/src/mocks/Benchmarks.sol/Benchmarks.dbg.json +4 -0
  105. package/build/contracts/src/mocks/Benchmarks.sol/Benchmarks.json +46 -0
  106. package/build/contracts/src/mocks/BridgeStub.sol/BridgeStub.dbg.json +1 -1
  107. package/build/contracts/src/mocks/BridgeUnproxied.sol/BridgeUnproxied.dbg.json +1 -1
  108. package/build/contracts/src/mocks/BridgeUnproxied.sol/BridgeUnproxied.json +15 -2
  109. package/build/contracts/src/mocks/InboxStub.sol/InboxStub.dbg.json +1 -1
  110. package/build/contracts/src/mocks/MockResultReceiver.sol/MockResultReceiver.dbg.json +1 -1
  111. package/build/contracts/src/mocks/MockResultReceiver.sol/MockResultReceiver.json +2 -2
  112. package/build/contracts/src/mocks/MultiCallTest.sol/MultiCallTest.dbg.json +4 -0
  113. package/build/contracts/src/mocks/MultiCallTest.sol/MultiCallTest.json +71 -0
  114. package/build/contracts/src/mocks/PendingBlkTimeAndNrAdvanceCheck.sol/PendingBlkTimeAndNrAdvanceCheck.dbg.json +4 -0
  115. package/build/contracts/src/mocks/PendingBlkTimeAndNrAdvanceCheck.sol/PendingBlkTimeAndNrAdvanceCheck.json +36 -0
  116. package/build/contracts/src/mocks/Program.sol/ProgramTest.dbg.json +4 -0
  117. package/build/contracts/src/mocks/Program.sol/ProgramTest.json +142 -0
  118. package/build/contracts/src/mocks/ProxyAdminForBinding.sol/ProxyAdminForBinding.dbg.json +1 -1
  119. package/build/contracts/src/mocks/ProxyAdminForBinding.sol/ProxyAdminForBinding.json +2 -2
  120. package/build/contracts/src/mocks/SdkStorage.sol/SdkStorage.dbg.json +4 -0
  121. package/build/contracts/src/mocks/SdkStorage.sol/SdkStorage.json +25 -0
  122. package/build/contracts/src/mocks/SequencerInboxStub.sol/SequencerInboxStub.dbg.json +1 -1
  123. package/build/contracts/src/mocks/SequencerInboxStub.sol/SequencerInboxStub.json +2 -2
  124. package/build/contracts/src/mocks/Simple.sol/Simple.dbg.json +1 -1
  125. package/build/contracts/src/mocks/SimpleCacheManager.sol/SimpleCacheManager.dbg.json +4 -0
  126. package/build/contracts/src/mocks/SimpleCacheManager.sol/SimpleCacheManager.json +37 -0
  127. package/build/contracts/src/mocks/SimpleProxy.sol/SimpleProxy.dbg.json +1 -1
  128. package/build/contracts/src/mocks/SimpleProxy.sol/SimpleProxy.json +2 -2
  129. package/build/contracts/src/mocks/SingleExecutionChallenge.sol/SingleExecutionChallenge.dbg.json +1 -1
  130. package/build/contracts/src/mocks/SingleExecutionChallenge.sol/SingleExecutionChallenge.json +50 -2
  131. package/build/contracts/src/mocks/TimedOutChallengeManager.sol/TimedOutChallengeManager.dbg.json +1 -1
  132. package/build/contracts/src/mocks/TimedOutChallengeManager.sol/TimedOutChallengeManager.json +50 -2
  133. package/build/contracts/src/mocks/UpgradeExecutorMock.sol/UpgradeExecutorMock.dbg.json +1 -1
  134. package/build/contracts/src/mocks/UpgradeExecutorMock.sol/UpgradeExecutorMock.json +15 -2
  135. package/build/contracts/src/node-interface/NodeInterface.sol/NodeInterface.dbg.json +1 -1
  136. package/build/contracts/src/node-interface/NodeInterfaceDebug.sol/NodeInterfaceDebug.dbg.json +1 -1
  137. package/build/contracts/src/osp/HashProofHelper.sol/HashProofHelper.dbg.json +1 -1
  138. package/build/contracts/src/osp/IOneStepProofEntry.sol/IOneStepProofEntry.dbg.json +1 -1
  139. package/build/contracts/src/osp/IOneStepProofEntry.sol/IOneStepProofEntry.json +48 -0
  140. package/build/contracts/src/osp/IOneStepProofEntry.sol/OneStepProofEntryLib.dbg.json +1 -1
  141. package/build/contracts/src/osp/IOneStepProofEntry.sol/OneStepProofEntryLib.json +2 -2
  142. package/build/contracts/src/osp/IOneStepProver.sol/IOneStepProver.dbg.json +1 -1
  143. package/build/contracts/src/osp/IOneStepProver.sol/IOneStepProver.json +88 -0
  144. package/build/contracts/src/osp/OneStepProofEntry.sol/OneStepProofEntry.dbg.json +1 -1
  145. package/build/contracts/src/osp/OneStepProofEntry.sol/OneStepProofEntry.json +50 -2
  146. package/build/contracts/src/osp/OneStepProver0.sol/OneStepProver0.dbg.json +1 -1
  147. package/build/contracts/src/osp/OneStepProver0.sol/OneStepProver0.json +90 -2
  148. package/build/contracts/src/osp/OneStepProverHostIo.sol/OneStepProverHostIo.dbg.json +1 -1
  149. package/build/contracts/src/osp/OneStepProverHostIo.sol/OneStepProverHostIo.json +90 -2
  150. package/build/contracts/src/osp/OneStepProverMath.sol/OneStepProverMath.dbg.json +1 -1
  151. package/build/contracts/src/osp/OneStepProverMath.sol/OneStepProverMath.json +90 -2
  152. package/build/contracts/src/osp/OneStepProverMemory.sol/OneStepProverMemory.dbg.json +1 -1
  153. package/build/contracts/src/osp/OneStepProverMemory.sol/OneStepProverMemory.json +90 -2
  154. package/build/contracts/src/precompiles/ArbAddressTable.sol/ArbAddressTable.dbg.json +1 -1
  155. package/build/contracts/src/precompiles/ArbAggregator.sol/ArbAggregator.dbg.json +1 -1
  156. package/build/contracts/src/precompiles/ArbBLS.sol/ArbBLS.dbg.json +1 -1
  157. package/build/contracts/src/precompiles/ArbDebug.sol/ArbDebug.dbg.json +1 -1
  158. package/build/contracts/src/precompiles/ArbDebug.sol/ArbDebug.json +7 -0
  159. package/build/contracts/src/precompiles/ArbFunctionTable.sol/ArbFunctionTable.dbg.json +1 -1
  160. package/build/contracts/src/precompiles/ArbGasInfo.sol/ArbGasInfo.dbg.json +1 -1
  161. package/build/contracts/src/precompiles/ArbInfo.sol/ArbInfo.dbg.json +1 -1
  162. package/build/contracts/src/precompiles/ArbOwner.sol/ArbOwner.dbg.json +1 -1
  163. package/build/contracts/src/precompiles/ArbOwner.sol/ArbOwner.json +161 -0
  164. package/build/contracts/src/precompiles/ArbOwnerPublic.sol/ArbOwnerPublic.dbg.json +1 -1
  165. package/build/contracts/src/precompiles/ArbRetryableTx.sol/ArbRetryableTx.dbg.json +1 -1
  166. package/build/contracts/src/precompiles/ArbStatistics.sol/ArbStatistics.dbg.json +1 -1
  167. package/build/contracts/src/precompiles/ArbSys.sol/ArbSys.dbg.json +1 -1
  168. package/build/contracts/src/precompiles/ArbWasm.sol/ArbWasm.dbg.json +4 -0
  169. package/build/contracts/src/precompiles/ArbWasm.sol/ArbWasm.json +453 -0
  170. package/build/contracts/src/precompiles/ArbWasmCache.sol/ArbWasmCache.dbg.json +4 -0
  171. package/build/contracts/src/precompiles/ArbWasmCache.sol/ArbWasmCache.json +113 -0
  172. package/build/contracts/src/precompiles/ArbosActs.sol/ArbosActs.dbg.json +1 -1
  173. package/build/contracts/src/precompiles/ArbosTest.sol/ArbosTest.dbg.json +1 -1
  174. package/build/contracts/src/rollup/AbsRollupEventInbox.sol/AbsRollupEventInbox.dbg.json +1 -1
  175. package/build/contracts/src/rollup/BridgeCreator.sol/BridgeCreator.dbg.json +1 -1
  176. package/build/contracts/src/rollup/BridgeCreator.sol/BridgeCreator.json +2 -2
  177. package/build/contracts/src/rollup/DeployHelper.sol/DeployHelper.dbg.json +1 -1
  178. package/build/contracts/src/rollup/DeployHelper.sol/DeployHelper.json +2 -2
  179. package/build/contracts/src/rollup/ERC20RollupEventInbox.sol/ERC20RollupEventInbox.dbg.json +1 -1
  180. package/build/contracts/src/rollup/IRollupAdmin.sol/IRollupAdmin.dbg.json +1 -1
  181. package/build/contracts/src/rollup/IRollupCore.sol/IRollupCore.dbg.json +1 -1
  182. package/build/contracts/src/rollup/IRollupEventInbox.sol/IRollupEventInbox.dbg.json +1 -1
  183. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUser.dbg.json +1 -1
  184. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUserAbs.dbg.json +1 -1
  185. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUserERC20.dbg.json +1 -1
  186. package/build/contracts/src/rollup/Node.sol/NodeLib.dbg.json +1 -1
  187. package/build/contracts/src/rollup/Node.sol/NodeLib.json +2 -2
  188. package/build/contracts/src/rollup/RollupAdminLogic.sol/RollupAdminLogic.dbg.json +1 -1
  189. package/build/contracts/src/rollup/RollupAdminLogic.sol/RollupAdminLogic.json +15 -2
  190. package/build/contracts/src/rollup/RollupCore.sol/RollupCore.dbg.json +1 -1
  191. package/build/contracts/src/rollup/RollupCore.sol/RollupCore.json +13 -0
  192. package/build/contracts/src/rollup/RollupCreator.sol/RollupCreator.dbg.json +1 -1
  193. package/build/contracts/src/rollup/RollupCreator.sol/RollupCreator.json +2 -2
  194. package/build/contracts/src/rollup/RollupEventInbox.sol/RollupEventInbox.dbg.json +1 -1
  195. package/build/contracts/src/rollup/RollupLib.sol/RollupLib.dbg.json +1 -1
  196. package/build/contracts/src/rollup/RollupLib.sol/RollupLib.json +2 -2
  197. package/build/contracts/src/rollup/RollupProxy.sol/RollupProxy.dbg.json +1 -1
  198. package/build/contracts/src/rollup/RollupProxy.sol/RollupProxy.json +2 -2
  199. package/build/contracts/src/rollup/RollupUserLogic.sol/AbsRollupUserLogic.dbg.json +1 -1
  200. package/build/contracts/src/rollup/RollupUserLogic.sol/AbsRollupUserLogic.json +13 -0
  201. package/build/contracts/src/rollup/RollupUserLogic.sol/ERC20RollupUserLogic.dbg.json +1 -1
  202. package/build/contracts/src/rollup/RollupUserLogic.sol/ERC20RollupUserLogic.json +15 -2
  203. package/build/contracts/src/rollup/RollupUserLogic.sol/RollupUserLogic.dbg.json +1 -1
  204. package/build/contracts/src/rollup/RollupUserLogic.sol/RollupUserLogic.json +15 -2
  205. package/build/contracts/src/rollup/ValidatorUtils.sol/ValidatorUtils.dbg.json +1 -1
  206. package/build/contracts/src/rollup/ValidatorUtils.sol/ValidatorUtils.json +2 -2
  207. package/build/contracts/src/rollup/ValidatorWallet.sol/ValidatorWallet.dbg.json +1 -1
  208. package/build/contracts/src/rollup/ValidatorWallet.sol/ValidatorWallet.json +15 -2
  209. package/build/contracts/src/rollup/ValidatorWalletCreator.sol/ValidatorWalletCreator.dbg.json +1 -1
  210. package/build/contracts/src/rollup/ValidatorWalletCreator.sol/ValidatorWalletCreator.json +2 -2
  211. package/build/contracts/src/state/Deserialize.sol/Deserialize.dbg.json +1 -1
  212. package/build/contracts/src/state/Deserialize.sol/Deserialize.json +2 -2
  213. package/build/contracts/src/state/GlobalState.sol/GlobalStateLib.dbg.json +1 -1
  214. package/build/contracts/src/state/Instructions.sol/Instructions.dbg.json +1 -1
  215. package/build/contracts/src/state/Instructions.sol/Instructions.json +2 -2
  216. package/build/contracts/src/state/Machine.sol/MachineLib.dbg.json +1 -1
  217. package/build/contracts/src/state/Machine.sol/MachineLib.json +2 -2
  218. package/build/contracts/src/state/MerkleProof.sol/MerkleProofLib.dbg.json +1 -1
  219. package/build/contracts/src/state/MerkleProof.sol/MerkleProofLib.json +2 -2
  220. package/build/contracts/src/state/Module.sol/ModuleLib.dbg.json +1 -1
  221. package/build/contracts/src/state/Module.sol/ModuleLib.json +2 -2
  222. package/build/contracts/src/state/ModuleMemory.sol/ModuleMemoryLib.dbg.json +1 -1
  223. package/build/contracts/src/state/ModuleMemory.sol/ModuleMemoryLib.json +2 -2
  224. package/build/contracts/src/state/ModuleMemoryCompact.sol/ModuleMemoryCompactLib.dbg.json +1 -1
  225. package/build/contracts/src/state/MultiStack.sol/MultiStackLib.dbg.json +4 -0
  226. package/build/contracts/src/state/MultiStack.sol/MultiStackLib.json +10 -0
  227. package/build/contracts/src/state/PcArray.sol/PcArrayLib.dbg.json +1 -1
  228. package/build/contracts/src/state/StackFrame.sol/StackFrameLib.dbg.json +1 -1
  229. package/build/contracts/src/state/StackFrame.sol/StackFrameLib.json +2 -2
  230. package/build/contracts/src/state/Value.sol/ValueLib.dbg.json +1 -1
  231. package/build/contracts/src/state/Value.sol/ValueLib.json +2 -2
  232. package/build/contracts/src/state/ValueArray.sol/ValueArrayLib.dbg.json +1 -1
  233. package/build/contracts/src/state/ValueArray.sol/ValueArrayLib.json +2 -2
  234. package/build/contracts/src/state/ValueStack.sol/ValueStackLib.dbg.json +1 -1
  235. package/build/contracts/src/state/ValueStack.sol/ValueStackLib.json +2 -2
  236. package/build/contracts/src/test-helpers/BridgeTester.sol/BridgeTester.dbg.json +1 -1
  237. package/build/contracts/src/test-helpers/BridgeTester.sol/BridgeTester.json +15 -2
  238. package/build/contracts/src/test-helpers/CryptographyPrimitivesTester.sol/CryptographyPrimitivesTester.dbg.json +1 -1
  239. package/build/contracts/src/test-helpers/EthVault.sol/EthVault.dbg.json +1 -1
  240. package/build/contracts/src/test-helpers/MessageTester.sol/MessageTester.dbg.json +1 -1
  241. package/build/contracts/src/test-helpers/OutboxWithoutOptTester.sol/OutboxWithoutOptTester.dbg.json +1 -1
  242. package/build/contracts/src/test-helpers/RollupMock.sol/RollupMock.dbg.json +1 -1
  243. package/build/contracts/src/test-helpers/TestToken.sol/TestToken.dbg.json +1 -1
  244. package/build/contracts/src/test-helpers/TestToken.sol/TestToken.json +2 -2
  245. package/build/contracts/src/test-helpers/ValueArrayTester.sol/ValueArrayTester.dbg.json +1 -1
  246. package/build/contracts/src/test-helpers/ValueArrayTester.sol/ValueArrayTester.json +2 -2
  247. package/package.json +13 -7
  248. package/src/chain/CacheManager.sol +283 -0
  249. package/src/challenge/ChallengeLib.sol +0 -45
  250. package/src/challenge/ChallengeManager.sol +24 -9
  251. package/src/challenge/IChallengeManager.sol +13 -0
  252. package/src/mocks/Benchmarks.sol +52 -0
  253. package/src/mocks/MultiCallTest.sol +117 -0
  254. package/src/mocks/PendingBlkTimeAndNrAdvanceCheck.sol +29 -0
  255. package/src/mocks/Program.sol +126 -0
  256. package/src/mocks/SdkStorage.sol +176 -0
  257. package/src/mocks/SimpleCacheManager.sol +22 -0
  258. package/src/osp/IOneStepProofEntry.sol +10 -0
  259. package/src/osp/OneStepProofEntry.sol +81 -7
  260. package/src/osp/OneStepProver0.sol +64 -20
  261. package/src/osp/OneStepProverHostIo.sol +201 -2
  262. package/src/osp/OneStepProverMemory.sol +4 -33
  263. package/src/precompiles/ArbDebug.sol +2 -0
  264. package/src/precompiles/ArbOwner.sol +51 -9
  265. package/src/precompiles/ArbWasm.sol +119 -0
  266. package/src/precompiles/ArbWasmCache.sol +33 -0
  267. package/src/state/Deserialize.sol +88 -47
  268. package/src/state/Instructions.sol +38 -3
  269. package/src/state/Machine.sol +92 -15
  270. package/src/state/MerkleProof.sol +22 -4
  271. package/src/state/Module.sol +3 -1
  272. package/src/state/ModuleMemory.sol +54 -0
  273. package/src/state/MultiStack.sol +58 -0
  274. package/src/state/StackFrame.sol +6 -1
  275. package/src/state/Value.sol +13 -1
  276. package/src/state/ValueStack.sol +6 -1
@@ -1,4 +1,4 @@
1
- // Copyright 2021-2022, Offchain Labs, Inc.
1
+ // Copyright 2021-2023, Offchain Labs, Inc.
2
2
  // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
@@ -11,6 +11,7 @@ import "../state/Deserialize.sol";
11
11
  import "./IOneStepProver.sol";
12
12
 
13
13
  contract OneStepProver0 is IOneStepProver {
14
+ using MachineLib for Machine;
14
15
  using MerkleProofLib for MerkleProof;
15
16
  using StackFrameLib for StackFrameWindow;
16
17
  using ValueLib for Value;
@@ -90,28 +91,11 @@ contract OneStepProver0 is IOneStepProver {
90
91
  bytes calldata
91
92
  ) internal pure {
92
93
  StackFrame memory frame = mach.frameStack.pop();
93
- if (frame.returnPc.valueType == ValueType.REF_NULL) {
94
- mach.status = MachineStatus.ERRORED;
95
- return;
96
- } else if (frame.returnPc.valueType != ValueType.INTERNAL_REF) {
97
- revert("INVALID_RETURN_PC_TYPE");
98
- }
99
- uint256 data = frame.returnPc.contents;
100
- uint32 pc = uint32(data);
101
- uint32 func = uint32(data >> 32);
102
- uint32 mod = uint32(data >> 64);
103
- require(data >> 96 == 0, "INVALID_RETURN_PC_DATA");
104
- mach.functionPc = pc;
105
- mach.functionIdx = func;
106
- mach.moduleIdx = mod;
94
+ mach.setPc(frame.returnPc);
107
95
  }
108
96
 
109
97
  function createReturnValue(Machine memory mach) internal pure returns (Value memory) {
110
- uint256 returnData = 0;
111
- returnData |= mach.functionPc;
112
- returnData |= uint256(mach.functionIdx) << 32;
113
- returnData |= uint256(mach.moduleIdx) << 64;
114
- return Value({valueType: ValueType.INTERNAL_REF, contents: returnData});
98
+ return ValueLib.newPc(mach.functionPc, mach.functionIdx, mach.moduleIdx);
115
99
  }
116
100
 
117
101
  function executeCall(
@@ -157,6 +141,62 @@ contract OneStepProver0 is IOneStepProver {
157
141
  mach.functionPc = 0;
158
142
  }
159
143
 
144
+ function executeCrossModuleForward(
145
+ Machine memory mach,
146
+ Module memory,
147
+ Instruction calldata inst,
148
+ bytes calldata
149
+ ) internal pure {
150
+ // Push the return pc to the stack
151
+ mach.valueStack.push(createReturnValue(mach));
152
+
153
+ // Push caller's caller module info to the stack
154
+ StackFrame memory frame = mach.frameStack.peek();
155
+ mach.valueStack.push(ValueLib.newI32(frame.callerModule));
156
+ mach.valueStack.push(ValueLib.newI32(frame.callerModuleInternals));
157
+
158
+ // Jump to the target
159
+ uint32 func = uint32(inst.argumentData);
160
+ uint32 module = uint32(inst.argumentData >> 32);
161
+ require(inst.argumentData >> 64 == 0, "BAD_CROSS_MODULE_CALL_DATA");
162
+ mach.moduleIdx = module;
163
+ mach.functionIdx = func;
164
+ mach.functionPc = 0;
165
+ }
166
+
167
+ function executeCrossModuleInternalCall(
168
+ Machine memory mach,
169
+ Module memory mod,
170
+ Instruction calldata inst,
171
+ bytes calldata proof
172
+ ) internal pure {
173
+ // Get the target from the stack
174
+ uint32 internalIndex = uint32(inst.argumentData);
175
+ uint32 moduleIndex = mach.valueStack.pop().assumeI32();
176
+ Module memory calledMod;
177
+
178
+ MerkleProof memory modProof;
179
+ uint256 offset = 0;
180
+ (calledMod, offset) = Deserialize.module(proof, offset);
181
+ (modProof, offset) = Deserialize.merkleProof(proof, offset);
182
+ require(
183
+ modProof.computeRootFromModule(moduleIndex, calledMod) == mach.modulesRoot,
184
+ "CROSS_MODULE_INTERNAL_MODULES_ROOT"
185
+ );
186
+
187
+ // Push the return pc to the stack
188
+ mach.valueStack.push(createReturnValue(mach));
189
+
190
+ // Push caller module info to the stack
191
+ mach.valueStack.push(ValueLib.newI32(mach.moduleIdx));
192
+ mach.valueStack.push(ValueLib.newI32(mod.internalsOffset));
193
+
194
+ // Jump to the target
195
+ mach.moduleIdx = moduleIndex;
196
+ mach.functionIdx = internalIndex + calledMod.internalsOffset;
197
+ mach.functionPc = 0;
198
+ }
199
+
160
200
  function executeCallerModuleInternalCall(
161
201
  Machine memory mach,
162
202
  Module memory mod,
@@ -454,6 +494,10 @@ contract OneStepProver0 is IOneStepProver {
454
494
  impl = executeCall;
455
495
  } else if (opcode == Instructions.CROSS_MODULE_CALL) {
456
496
  impl = executeCrossModuleCall;
497
+ } else if (opcode == Instructions.CROSS_MODULE_FORWARD) {
498
+ impl = executeCrossModuleForward;
499
+ } else if (opcode == Instructions.CROSS_MODULE_INTERNAL_CALL) {
500
+ impl = executeCrossModuleInternalCall;
457
501
  } else if (opcode == Instructions.CALLER_MODULE_INTERNAL_CALL) {
458
502
  impl = executeCallerModuleInternalCall;
459
503
  } else if (opcode == Instructions.CALL_INDIRECT) {
@@ -1,4 +1,4 @@
1
- // Copyright 2021-2022, Offchain Labs, Inc.
1
+ // Copyright 2021-2024, Offchain Labs, Inc.
2
2
  // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
3
3
  // SPDX-License-Identifier: BUSL-1.1
4
4
 
@@ -6,6 +6,8 @@ pragma solidity ^0.8.0;
6
6
 
7
7
  import "../state/Value.sol";
8
8
  import "../state/Machine.sol";
9
+ import "../state/MerkleProof.sol";
10
+ import "../state/MultiStack.sol";
9
11
  import "../state/Deserialize.sol";
10
12
  import "../state/ModuleMemory.sol";
11
13
  import "./IOneStepProver.sol";
@@ -14,10 +16,13 @@ import "../bridge/IBridge.sol";
14
16
 
15
17
  contract OneStepProverHostIo is IOneStepProver {
16
18
  using GlobalStateLib for GlobalState;
19
+ using MachineLib for Machine;
17
20
  using MerkleProofLib for MerkleProof;
18
21
  using ModuleMemoryLib for ModuleMemory;
22
+ using MultiStackLib for MultiStack;
19
23
  using ValueLib for Value;
20
24
  using ValueStackLib for ValueStack;
25
+ using StackFrameLib for StackFrameWindow;
21
26
 
22
27
  uint256 private constant LEAF_SIZE = 32;
23
28
  uint256 private constant INBOX_NUM = 2;
@@ -52,7 +57,7 @@ contract OneStepProverHostIo is IOneStepProver {
52
57
  mach.status = MachineStatus.ERRORED;
53
58
  return;
54
59
  }
55
- if (ptr + 32 > mod.moduleMemory.size || ptr % LEAF_SIZE != 0) {
60
+ if (!mod.moduleMemory.isValidLeaf(ptr)) {
56
61
  mach.status = MachineStatus.ERRORED;
57
62
  return;
58
63
  }
@@ -380,6 +385,103 @@ contract OneStepProverHostIo is IOneStepProver {
380
385
  mach.status = MachineStatus.FINISHED;
381
386
  }
382
387
 
388
+ function isPowerOfTwo(uint256 value) internal pure returns (bool) {
389
+ return value != 0 && (value & (value - 1) == 0);
390
+ }
391
+
392
+ function proveLastLeaf(
393
+ Machine memory mach,
394
+ uint256 offset,
395
+ bytes calldata proof
396
+ )
397
+ internal
398
+ pure
399
+ returns (
400
+ uint256 leaf,
401
+ MerkleProof memory leafProof,
402
+ MerkleProof memory zeroProof
403
+ )
404
+ {
405
+ string memory prefix = "Module merkle tree:";
406
+ bytes32 root = mach.modulesRoot;
407
+
408
+ {
409
+ Module memory leafModule;
410
+ uint32 leaf32;
411
+ (leafModule, offset) = Deserialize.module(proof, offset);
412
+ (leaf32, offset) = Deserialize.u32(proof, offset);
413
+ (leafProof, offset) = Deserialize.merkleProof(proof, offset);
414
+ leaf = uint256(leaf32);
415
+
416
+ bytes32 compRoot = leafProof.computeRootFromModule(leaf, leafModule);
417
+ require(compRoot == root, "WRONG_ROOT_FOR_LEAF");
418
+ }
419
+
420
+ // if tree is unbalanced, check that the next leaf is 0
421
+ bool balanced = isPowerOfTwo(leaf + 1);
422
+ if (balanced) {
423
+ require(1 << leafProof.counterparts.length == leaf + 1, "WRONG_LEAF");
424
+ } else {
425
+ (zeroProof, offset) = Deserialize.merkleProof(proof, offset);
426
+ bytes32 compRoot = zeroProof.computeRootUnsafe(leaf + 1, 0, prefix);
427
+ require(compRoot == root, "WRONG_ROOT_FOR_ZERO");
428
+ }
429
+
430
+ return (leaf, leafProof, zeroProof);
431
+ }
432
+
433
+ function executeLinkModule(
434
+ ExecutionContext calldata,
435
+ Machine memory mach,
436
+ Module memory mod,
437
+ Instruction calldata,
438
+ bytes calldata proof
439
+ ) internal pure {
440
+ string memory prefix = "Module merkle tree:";
441
+ bytes32 root = mach.modulesRoot;
442
+
443
+ uint256 pointer = mach.valueStack.pop().assumeI32();
444
+ if (!mod.moduleMemory.isValidLeaf(pointer)) {
445
+ mach.status = MachineStatus.ERRORED;
446
+ return;
447
+ }
448
+ (bytes32 userMod, uint256 offset, ) = mod.moduleMemory.proveLeaf(
449
+ pointer / LEAF_SIZE,
450
+ proof,
451
+ 0
452
+ );
453
+
454
+ (uint256 leaf, , MerkleProof memory zeroProof) = proveLastLeaf(mach, offset, proof);
455
+
456
+ bool balanced = isPowerOfTwo(leaf + 1);
457
+ if (balanced) {
458
+ mach.modulesRoot = MerkleProofLib.growToNewRoot(root, leaf + 1, userMod, 0, prefix);
459
+ } else {
460
+ mach.modulesRoot = zeroProof.computeRootUnsafe(leaf + 1, userMod, prefix);
461
+ }
462
+
463
+ mach.valueStack.push(ValueLib.newI32(uint32(leaf + 1)));
464
+ }
465
+
466
+ function executeUnlinkModule(
467
+ ExecutionContext calldata,
468
+ Machine memory mach,
469
+ Module memory,
470
+ Instruction calldata,
471
+ bytes calldata proof
472
+ ) internal pure {
473
+ string memory prefix = "Module merkle tree:";
474
+
475
+ (uint256 leaf, MerkleProof memory leafProof, ) = proveLastLeaf(mach, 0, proof);
476
+
477
+ bool shrink = isPowerOfTwo(leaf);
478
+ if (shrink) {
479
+ mach.modulesRoot = leafProof.counterparts[leafProof.counterparts.length - 1];
480
+ } else {
481
+ mach.modulesRoot = leafProof.computeRootUnsafe(leaf, 0, prefix);
482
+ }
483
+ }
484
+
383
485
  function executeGlobalStateAccess(
384
486
  ExecutionContext calldata,
385
487
  Machine memory mach,
@@ -410,6 +512,93 @@ contract OneStepProverHostIo is IOneStepProver {
410
512
  mach.globalStateHash = state.hash();
411
513
  }
412
514
 
515
+ function executeNewCoThread(
516
+ ExecutionContext calldata,
517
+ Machine memory mach,
518
+ Module memory,
519
+ Instruction calldata,
520
+ bytes calldata
521
+ ) internal pure {
522
+ if (mach.recoveryPc != MachineLib.NO_RECOVERY_PC) {
523
+ // cannot create new cothread from inside cothread
524
+ mach.status = MachineStatus.ERRORED;
525
+ return;
526
+ }
527
+ mach.frameMultiStack.pushNew();
528
+ mach.valueMultiStack.pushNew();
529
+ }
530
+
531
+ function provePopCothread(MultiStack memory multi, bytes calldata proof) internal pure {
532
+ uint256 proofOffset = 0;
533
+ bytes32 newInactiveCoThread;
534
+ bytes32 newRemaining;
535
+ (newInactiveCoThread, proofOffset) = Deserialize.b32(proof, proofOffset);
536
+ (newRemaining, proofOffset) = Deserialize.b32(proof, proofOffset);
537
+ if (newInactiveCoThread == MultiStackLib.NO_STACK_HASH) {
538
+ require(newRemaining == bytes32(0), "WRONG_COTHREAD_EMPTY");
539
+ require(multi.remainingHash == bytes32(0), "WRONG_COTHREAD_EMPTY");
540
+ } else {
541
+ require(
542
+ keccak256(abi.encodePacked("cothread:", newInactiveCoThread, newRemaining)) ==
543
+ multi.remainingHash,
544
+ "WRONG_COTHREAD_POP"
545
+ );
546
+ }
547
+ multi.remainingHash = newRemaining;
548
+ multi.inactiveStackHash = newInactiveCoThread;
549
+ }
550
+
551
+ function executePopCoThread(
552
+ ExecutionContext calldata,
553
+ Machine memory mach,
554
+ Module memory,
555
+ Instruction calldata,
556
+ bytes calldata proof
557
+ ) internal pure {
558
+ if (mach.recoveryPc != MachineLib.NO_RECOVERY_PC) {
559
+ // cannot pop cothread from inside cothread
560
+ mach.status = MachineStatus.ERRORED;
561
+ return;
562
+ }
563
+ if (mach.frameMultiStack.inactiveStackHash == MultiStackLib.NO_STACK_HASH) {
564
+ // cannot pop cothread if there isn't one
565
+ mach.status = MachineStatus.ERRORED;
566
+ return;
567
+ }
568
+ provePopCothread(mach.valueMultiStack, proof);
569
+ provePopCothread(mach.frameMultiStack, proof[64:]);
570
+ }
571
+
572
+ function executeSwitchCoThread(
573
+ ExecutionContext calldata,
574
+ Machine memory mach,
575
+ Module memory,
576
+ Instruction calldata inst,
577
+ bytes calldata
578
+ ) internal pure {
579
+ if (mach.frameMultiStack.inactiveStackHash == MultiStackLib.NO_STACK_HASH) {
580
+ // cannot switch cothread if there isn't one
581
+ mach.status = MachineStatus.ERRORED;
582
+ return;
583
+ }
584
+ if (inst.argumentData == 0) {
585
+ if (mach.recoveryPc == MachineLib.NO_RECOVERY_PC) {
586
+ // switching to main thread, from main thread
587
+ mach.status = MachineStatus.ERRORED;
588
+ return;
589
+ }
590
+ mach.recoveryPc = MachineLib.NO_RECOVERY_PC;
591
+ } else {
592
+ if (mach.recoveryPc != MachineLib.NO_RECOVERY_PC) {
593
+ // switching from cothread to cothread
594
+ mach.status = MachineStatus.ERRORED;
595
+ return;
596
+ }
597
+ mach.setRecoveryFromPc(uint32(inst.argumentData));
598
+ }
599
+ mach.switchCoThreadStacks();
600
+ }
601
+
413
602
  function executeOneStep(
414
603
  ExecutionContext calldata execCtx,
415
604
  Machine calldata startMach,
@@ -441,6 +630,16 @@ contract OneStepProverHostIo is IOneStepProver {
441
630
  impl = executeReadInboxMessage;
442
631
  } else if (opcode == Instructions.HALT_AND_SET_FINISHED) {
443
632
  impl = executeHaltAndSetFinished;
633
+ } else if (opcode == Instructions.LINK_MODULE) {
634
+ impl = executeLinkModule;
635
+ } else if (opcode == Instructions.UNLINK_MODULE) {
636
+ impl = executeUnlinkModule;
637
+ } else if (opcode == Instructions.NEW_COTHREAD) {
638
+ impl = executeNewCoThread;
639
+ } else if (opcode == Instructions.POP_COTHREAD) {
640
+ impl = executePopCoThread;
641
+ } else if (opcode == Instructions.SWITCH_COTHREAD) {
642
+ impl = executeSwitchCoThread;
444
643
  } else {
445
644
  revert("INVALID_MEMORY_OPCODE");
446
645
  }
@@ -19,13 +19,6 @@ contract OneStepProverMemory is IOneStepProver {
19
19
  uint256 private constant LEAF_SIZE = 32;
20
20
  uint64 private constant PAGE_SIZE = 65536;
21
21
 
22
- function pullLeafByte(bytes32 leaf, uint256 idx) internal pure returns (uint8) {
23
- require(idx < LEAF_SIZE, "BAD_PULL_LEAF_BYTE_IDX");
24
- // Take into account that we are casting the leaf to a big-endian integer
25
- uint256 leafShift = (LEAF_SIZE - 1 - idx) * 8;
26
- return uint8(uint256(leaf) >> leafShift);
27
- }
28
-
29
22
  function setLeafByte(
30
23
  bytes32 oldLeaf,
31
24
  uint256 idx,
@@ -109,35 +102,13 @@ contract OneStepProverMemory is IOneStepProver {
109
102
  revert("INVALID_MEMORY_LOAD_OPCODE");
110
103
  }
111
104
 
112
- // Neither of these can overflow as they're computed with much less than 256 bit integers.
113
- uint256 startIdx = inst.argumentData + mach.valueStack.pop().assumeI32();
114
- if (startIdx + readBytes > mod.moduleMemory.size) {
105
+ uint256 index = inst.argumentData + mach.valueStack.pop().assumeI32();
106
+ (bool err, uint256 value, ) = mod.moduleMemory.load(index, readBytes, proof, 0);
107
+ if (err) {
115
108
  mach.status = MachineStatus.ERRORED;
116
109
  return;
117
110
  }
118
-
119
- uint256 proofOffset = 0;
120
- uint256 lastProvedLeafIdx = ~uint256(0);
121
- bytes32 lastProvedLeafContents;
122
- uint64 readValue;
123
- for (uint256 i = 0; i < readBytes; i++) {
124
- uint256 idx = startIdx + i;
125
- uint256 leafIdx = idx / LEAF_SIZE;
126
- if (leafIdx != lastProvedLeafIdx) {
127
- // This hits the stack size if we phrase it as mod.moduleMemory.proveLeaf(...)
128
- (lastProvedLeafContents, proofOffset, ) = ModuleMemoryLib.proveLeaf(
129
- mod.moduleMemory,
130
- leafIdx,
131
- proof,
132
- proofOffset
133
- );
134
- lastProvedLeafIdx = leafIdx;
135
- }
136
- uint256 indexWithinLeaf = idx % LEAF_SIZE;
137
- readValue |=
138
- uint64(pullLeafByte(lastProvedLeafContents, indexWithinLeaf)) <<
139
- uint64(i * 8);
140
- }
111
+ uint64 readValue = uint64(value);
141
112
 
142
113
  if (signed) {
143
114
  // Go down to the original uint size, change to signed, go up to correct size, convert back to unsigned
@@ -37,6 +37,8 @@ interface ArbDebug {
37
37
 
38
38
  function customRevert(uint64 number) external pure;
39
39
 
40
+ function panic() external;
41
+
40
42
  function legacyError() external pure;
41
43
 
42
44
  error Custom(uint64, string, bool);
@@ -1,16 +1,18 @@
1
- // Copyright 2021-2022, Offchain Labs, Inc.
1
+ // Copyright 2021-2024, Offchain Labs, Inc.
2
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;
6
6
 
7
- /// @title Provides owners with tools for managing the rollup.
8
- /// @notice Calls by non-owners will always revert.
9
- /// Most of Arbitrum Classic's owner methods have been removed since they no longer make sense in Nitro:
10
- /// - What were once chain parameters are now parts of ArbOS's state, and those that remain are set at genesis.
11
- /// - ArbOS upgrades happen with the rest of the system rather than being independent
12
- /// - Exemptions to address aliasing are no longer offered. Exemptions were intended to support backward compatibility for contracts deployed before aliasing was introduced, but no exemptions were ever requested.
13
- /// Precompiled contract that exists in every Arbitrum chain at 0x0000000000000000000000000000000000000070.
7
+ /**
8
+ * @title Provides owners with tools for managing the rollup.
9
+ * @notice Calls by non-owners will always revert.
10
+ * Most of Arbitrum Classic's owner methods have been removed since they no longer make sense in Nitro:
11
+ * - What were once chain parameters are now parts of ArbOS's state, and those that remain are set at genesis.
12
+ * - ArbOS upgrades happen with the rest of the system rather than being independent
13
+ * - Exemptions to address aliasing are no longer offered. Exemptions were intended to support backward compatibility for contracts deployed before aliasing was introduced, but no exemptions were ever requested.
14
+ * Precompiled contract that exists in every Arbitrum chain at 0x0000000000000000000000000000000000000070.
15
+ **/
14
16
  interface ArbOwner {
15
17
  /// @notice Add account as a chain owner
16
18
  function addChainOwner(address newOwner) external;
@@ -90,9 +92,49 @@ interface ArbOwner {
90
92
  /// @notice Releases surplus funds from L1PricerFundsPoolAddress for use
91
93
  function releaseL1PricerSurplusFunds(uint256 maxWeiToRelease) external returns (uint256);
92
94
 
95
+ /// @notice Sets the amount of ink 1 gas buys
96
+ /// @param price the conversion rate (must fit in a uint24)
97
+ function setInkPrice(uint32 price) external;
98
+
99
+ /// @notice Sets the maximum depth (in wasm words) a wasm stack may grow
100
+ function setWasmMaxStackDepth(uint32 depth) external;
101
+
102
+ /// @notice Sets the number of free wasm pages a tx gets
103
+ function setWasmFreePages(uint16 pages) external;
104
+
105
+ /// @notice Sets the base cost of each additional wasm page
106
+ function setWasmPageGas(uint16 gas) external;
107
+
108
+ /// @notice Sets the maximum number of pages a wasm may allocate
109
+ function setWasmPageLimit(uint16 limit) external;
110
+
111
+ /// @notice Sets the minimum costs to invoke a program
112
+ /// @param gas amount of gas paid in increments of 256 when not the program is not cached
113
+ /// @param cached amount of gas paid in increments of 64 when the program is cached
114
+ function setWasmMinInitGas(uint8 gas, uint16 cached) external;
115
+
116
+ /// @notice Sets the linear adjustment made to program init costs.
117
+ /// @param percent the adjustment (100% = no adjustment).
118
+ function setWasmInitCostScalar(uint64 percent) external;
119
+
120
+ /// @notice Sets the number of days after which programs deactivate
121
+ function setWasmExpiryDays(uint16 _days) external;
122
+
123
+ /// @notice Sets the age a program must be to perform a keepalive
124
+ function setWasmKeepaliveDays(uint16 _days) external;
125
+
126
+ /// @notice Sets the number of extra programs ArbOS caches during a given block
127
+ function setWasmBlockCacheSize(uint16 count) external;
128
+
129
+ /// @notice Adds account as a wasm cache manager
130
+ function addWasmCacheManager(address manager) external;
131
+
132
+ /// @notice Removes account from the list of wasm cache managers
133
+ function removeWasmCacheManager(address manager) external;
134
+
93
135
  /// @notice Sets serialized chain config in ArbOS state
94
136
  function setChainConfig(string calldata chainConfig) external;
95
137
 
96
- // Emitted when a successful call is made to this precompile
138
+ /// Emitted when a successful call is made to this precompile
97
139
  event OwnerActs(bytes4 indexed method, address indexed owner, bytes data);
98
140
  }
@@ -0,0 +1,119 @@
1
+ // Copyright 2022-2024, Offchain Labs, Inc.
2
+ // For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE
3
+ // SPDX-License-Identifier: BUSL-1.1
4
+
5
+ pragma solidity >=0.4.21 <0.9.0;
6
+
7
+ /**
8
+ * @title Methods for managing user programs
9
+ * @notice Precompiled contract that exists in every Arbitrum chain at 0x0000000000000000000000000000000000000071.
10
+ */
11
+ interface ArbWasm {
12
+ /// @notice Activate a wasm program
13
+ /// @param program the program to activate
14
+ /// @return version the stylus version the program was activated against
15
+ /// @return dataFee the data fee paid to store the activated program
16
+ function activateProgram(address program)
17
+ external
18
+ payable
19
+ returns (uint16 version, uint256 dataFee);
20
+
21
+ /// @notice Gets the latest stylus version
22
+ /// @return version the stylus version
23
+ function stylusVersion() external view returns (uint16 version);
24
+
25
+ /// @notice Gets the stylus version the program with codehash was most recently activated against
26
+ /// @return version the program version (reverts for EVM contracts)
27
+ function codehashVersion(bytes32 codehash) external view returns (uint16 version);
28
+
29
+ /// @notice Extends a program's expiration date.
30
+ /// Reverts if too soon or if the program is not up to date.
31
+ function codehashKeepalive(bytes32 codehash) external payable;
32
+
33
+ /// @notice Gets a program's asm size.
34
+ /// Reverts if program is not active.
35
+ /// @return size the size in bytes
36
+ function codehashAsmSize(bytes32 codehash) external view returns (uint32 size);
37
+
38
+ /// @notice Gets the stylus version the program was most recently activated against
39
+ /// @return version the program version (reverts for EVM contracts)
40
+ function programVersion(address program) external view returns (uint16 version);
41
+
42
+ /// @notice Gets the cost to invoke the program
43
+ /// @return gas the amount of gas
44
+ /// @return gasWhenCached the amount of gas if the program was recently used
45
+ function programInitGas(address program)
46
+ external
47
+ view
48
+ returns (uint64 gas, uint64 gasWhenCached);
49
+
50
+ /// @notice Gets the memory footprint of the program at the given address in pages
51
+ /// @return footprint the memory footprint of program in pages (reverts for EVM contracts)
52
+ function programMemoryFootprint(address program) external view returns (uint16 footprint);
53
+
54
+ /// @notice Gets the amount of time remaining until the program expires
55
+ /// @return _secs the time left in seconds (reverts for EVM contracts)
56
+ function programTimeLeft(address program) external view returns (uint64 _secs);
57
+
58
+ /// @notice Gets the conversion rate between gas and ink
59
+ /// @return price the amount of ink 1 gas buys
60
+ function inkPrice() external view returns (uint32 price);
61
+
62
+ /// @notice Gets the wasm stack size limit
63
+ /// @return depth the maximum depth (in wasm words) a wasm stack may grow
64
+ function maxStackDepth() external view returns (uint32 depth);
65
+
66
+ /// @notice Gets the number of free wasm pages a program gets
67
+ /// @return pages the number of wasm pages (2^16 bytes)
68
+ function freePages() external view returns (uint16 pages);
69
+
70
+ /// @notice Gets the base cost of each additional wasm page (2^16 bytes)
71
+ /// @return gas base amount of gas needed to grow another wasm page
72
+ function pageGas() external view returns (uint16 gas);
73
+
74
+ /// @notice Gets the ramp that drives exponential memory costs
75
+ /// @return ramp bits representing the floating point value
76
+ function pageRamp() external view returns (uint64 ramp);
77
+
78
+ /// @notice Gets the maximum number of pages a wasm may allocate
79
+ /// @return limit the number of pages
80
+ function pageLimit() external view returns (uint16 limit);
81
+
82
+ /// @notice Gets the minimum costs to invoke a program
83
+ /// @return gas amount of gas in increments of 256 when not cached
84
+ /// @return cached amount of gas in increments of 64 when cached
85
+ function minInitGas() external view returns (uint8 gas, uint8 cached);
86
+
87
+ /// @notice Gets the linear adjustment made to program init costs.
88
+ /// @return percent the adjustment (100% = no adjustment).
89
+ function initCostScalar() external view returns (uint64 percent);
90
+
91
+ /// @notice Gets the number of days after which programs deactivate
92
+ /// @return _days the number of days
93
+ function expiryDays() external view returns (uint16 _days);
94
+
95
+ /// @notice Gets the age a program must be to perform a keepalive
96
+ /// @return _days the number of days
97
+ function keepaliveDays() external view returns (uint16 _days);
98
+
99
+ /// @notice Gets the number of extra programs ArbOS caches during a given block.
100
+ /// @return count the number of same-block programs.
101
+ function blockCacheSize() external view returns (uint16 count);
102
+
103
+ event ProgramActivated(
104
+ bytes32 indexed codehash,
105
+ bytes32 moduleHash,
106
+ address program,
107
+ uint256 dataFee,
108
+ uint16 version
109
+ );
110
+ event ProgramLifetimeExtended(bytes32 indexed codehash, uint256 dataFee);
111
+
112
+ error ProgramNotWasm();
113
+ error ProgramNotActivated();
114
+ error ProgramNeedsUpgrade(uint16 version, uint16 stylusVersion);
115
+ error ProgramExpired(uint64 ageInSeconds);
116
+ error ProgramUpToDate();
117
+ error ProgramKeepaliveTooSoon(uint64 ageInSeconds);
118
+ error ProgramInsufficientValue(uint256 have, uint256 want);
119
+ }
@@ -0,0 +1,33 @@
1
+ // Copyright 2022-2024, Offchain Labs, Inc.
2
+ // For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE
3
+ // SPDX-License-Identifier: BUSL-1.1
4
+
5
+ pragma solidity >=0.4.21 <0.9.0;
6
+
7
+ /**
8
+ * @title Methods for managing Stylus caches
9
+ * @notice Precompiled contract that exists in every Arbitrum chain at 0x0000000000000000000000000000000000000072.
10
+ */
11
+ interface ArbWasmCache {
12
+ /// @notice See if the user is a cache manager.
13
+ function isCacheManager(address manager) external view returns (bool);
14
+
15
+ /// @notice Retrieve all address managers.
16
+ /// @return managers the list of managers.
17
+ function allCacheManagers() external view returns (address[] memory managers);
18
+
19
+ /// @notice Caches all programs with the given codehash.
20
+ /// @notice Reverts if the programs have expired.
21
+ /// @notice Caller must be a cache manager or chain owner.
22
+ /// @notice If you're looking for how to bid for position, interact with the chain's cache manager contract.
23
+ function cacheCodehash(bytes32 codehash) external;
24
+
25
+ /// @notice Evicts all programs with the given codehash.
26
+ /// @notice Caller must be a cache manager or chain owner.
27
+ function evictCodehash(bytes32 codehash) external;
28
+
29
+ /// @notice Gets whether a program is cached. Note that the program may be expired.
30
+ function codehashIsCached(bytes32 codehash) external view returns (bool);
31
+
32
+ event UpdateProgramCache(address indexed manager, bytes32 indexed codehash, bool cached);
33
+ }