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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (291) 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/ERC20Outbox.sol/ERC20Outbox.json +2 -2
  65. package/build/contracts/src/bridge/GasRefunder.sol/GasRefunder.dbg.json +1 -1
  66. package/build/contracts/src/bridge/GasRefunder.sol/GasRefunder.json +2 -2
  67. package/build/contracts/src/bridge/IBridge.sol/IBridge.dbg.json +1 -1
  68. package/build/contracts/src/bridge/IDelayedMessageProvider.sol/IDelayedMessageProvider.dbg.json +1 -1
  69. package/build/contracts/src/bridge/IERC20Bridge.sol/IERC20Bridge.dbg.json +1 -1
  70. package/build/contracts/src/bridge/IERC20Inbox.sol/IERC20Inbox.dbg.json +1 -1
  71. package/build/contracts/src/bridge/IEthBridge.sol/IEthBridge.dbg.json +1 -1
  72. package/build/contracts/src/bridge/IInbox.sol/IInbox.dbg.json +1 -1
  73. package/build/contracts/src/bridge/IInboxBase.sol/IInboxBase.dbg.json +1 -1
  74. package/build/contracts/src/bridge/IOutbox.sol/IOutbox.dbg.json +1 -1
  75. package/build/contracts/src/bridge/IOwnable.sol/IOwnable.dbg.json +1 -1
  76. package/build/contracts/src/bridge/ISequencerInbox.sol/ISequencerInbox.dbg.json +1 -1
  77. package/build/contracts/src/bridge/ISequencerInbox.sol/ISequencerInbox.json +16 -16
  78. package/build/contracts/src/bridge/Inbox.sol/Inbox.dbg.json +1 -1
  79. package/build/contracts/src/bridge/Inbox.sol/Inbox.json +15 -2
  80. package/build/contracts/src/bridge/Messages.sol/Messages.dbg.json +1 -1
  81. package/build/contracts/src/bridge/Outbox.sol/Outbox.dbg.json +1 -1
  82. package/build/contracts/src/bridge/Outbox.sol/Outbox.json +2 -2
  83. package/build/contracts/src/bridge/SequencerInbox.sol/SequencerInbox.dbg.json +1 -1
  84. package/build/contracts/src/bridge/SequencerInbox.sol/SequencerInbox.json +23 -18
  85. package/build/contracts/src/chain/CacheManager.sol/CacheManager.dbg.json +4 -0
  86. package/build/contracts/src/chain/CacheManager.sol/CacheManager.json +490 -0
  87. package/build/contracts/src/challenge/ChallengeLib.sol/ChallengeLib.dbg.json +1 -1
  88. package/build/contracts/src/challenge/ChallengeLib.sol/ChallengeLib.json +2 -2
  89. package/build/contracts/src/challenge/ChallengeManager.sol/ChallengeManager.dbg.json +1 -1
  90. package/build/contracts/src/challenge/ChallengeManager.sol/ChallengeManager.json +50 -2
  91. package/build/contracts/src/challenge/IChallengeManager.sol/IChallengeManager.dbg.json +1 -1
  92. package/build/contracts/src/challenge/IChallengeManager.sol/IChallengeManager.json +55 -0
  93. package/build/contracts/src/challenge/IChallengeResultReceiver.sol/IChallengeResultReceiver.dbg.json +1 -1
  94. package/build/contracts/src/libraries/AddressAliasHelper.sol/AddressAliasHelper.dbg.json +1 -1
  95. package/build/contracts/src/libraries/AdminFallbackProxy.sol/AdminFallbackProxy.dbg.json +1 -1
  96. package/build/contracts/src/libraries/AdminFallbackProxy.sol/AdminFallbackProxy.json +2 -2
  97. package/build/contracts/src/libraries/AdminFallbackProxy.sol/DoubleLogicERC1967Upgrade.dbg.json +1 -1
  98. package/build/contracts/src/libraries/ArbitrumChecker.sol/ArbitrumChecker.dbg.json +1 -1
  99. package/build/contracts/src/libraries/CryptographyPrimitives.sol/CryptographyPrimitives.dbg.json +1 -1
  100. package/build/contracts/src/libraries/DelegateCallAware.sol/DelegateCallAware.dbg.json +1 -1
  101. package/build/contracts/src/libraries/DoubleLogicUUPSUpgradeable.sol/DoubleLogicUUPSUpgradeable.dbg.json +1 -1
  102. package/build/contracts/src/libraries/GasRefundEnabled.sol/GasRefundEnabled.dbg.json +1 -1
  103. package/build/contracts/src/libraries/IGasRefunder.sol/IGasRefunder.dbg.json +1 -1
  104. package/build/contracts/src/libraries/IReader4844.sol/IReader4844.dbg.json +1 -1
  105. package/build/contracts/src/libraries/MerkleLib.sol/MerkleLib.dbg.json +1 -1
  106. package/build/contracts/src/libraries/MerkleLib.sol/MerkleLib.json +2 -2
  107. package/build/contracts/src/libraries/UUPSNotUpgradeable.sol/UUPSNotUpgradeable.dbg.json +1 -1
  108. package/build/contracts/src/mocks/Benchmarks.sol/Benchmarks.dbg.json +4 -0
  109. package/build/contracts/src/mocks/Benchmarks.sol/Benchmarks.json +46 -0
  110. package/build/contracts/src/mocks/BridgeStub.sol/BridgeStub.dbg.json +1 -1
  111. package/build/contracts/src/mocks/BridgeStub.sol/BridgeStub.json +2 -2
  112. package/build/contracts/src/mocks/BridgeUnproxied.sol/BridgeUnproxied.dbg.json +1 -1
  113. package/build/contracts/src/mocks/BridgeUnproxied.sol/BridgeUnproxied.json +15 -2
  114. package/build/contracts/src/mocks/InboxStub.sol/InboxStub.dbg.json +1 -1
  115. package/build/contracts/src/mocks/InboxStub.sol/InboxStub.json +2 -2
  116. package/build/contracts/src/mocks/MockResultReceiver.sol/MockResultReceiver.dbg.json +1 -1
  117. package/build/contracts/src/mocks/MockResultReceiver.sol/MockResultReceiver.json +2 -2
  118. package/build/contracts/src/mocks/MultiCallTest.sol/MultiCallTest.dbg.json +4 -0
  119. package/build/contracts/src/mocks/MultiCallTest.sol/MultiCallTest.json +71 -0
  120. package/build/contracts/src/mocks/PendingBlkTimeAndNrAdvanceCheck.sol/PendingBlkTimeAndNrAdvanceCheck.dbg.json +4 -0
  121. package/build/contracts/src/mocks/PendingBlkTimeAndNrAdvanceCheck.sol/PendingBlkTimeAndNrAdvanceCheck.json +36 -0
  122. package/build/contracts/src/mocks/Program.sol/ProgramTest.dbg.json +4 -0
  123. package/build/contracts/src/mocks/Program.sol/ProgramTest.json +142 -0
  124. package/build/contracts/src/mocks/ProxyAdminForBinding.sol/ProxyAdminForBinding.dbg.json +1 -1
  125. package/build/contracts/src/mocks/ProxyAdminForBinding.sol/ProxyAdminForBinding.json +2 -2
  126. package/build/contracts/src/mocks/SdkStorage.sol/SdkStorage.dbg.json +4 -0
  127. package/build/contracts/src/mocks/SdkStorage.sol/SdkStorage.json +25 -0
  128. package/build/contracts/src/mocks/SequencerInboxStub.sol/SequencerInboxStub.dbg.json +1 -1
  129. package/build/contracts/src/mocks/SequencerInboxStub.sol/SequencerInboxStub.json +31 -26
  130. package/build/contracts/src/mocks/Simple.sol/Simple.dbg.json +1 -1
  131. package/build/contracts/src/mocks/Simple.sol/Simple.json +2 -2
  132. package/build/contracts/src/mocks/SimpleCacheManager.sol/SimpleCacheManager.dbg.json +4 -0
  133. package/build/contracts/src/mocks/SimpleCacheManager.sol/SimpleCacheManager.json +37 -0
  134. package/build/contracts/src/mocks/SimpleProxy.sol/SimpleProxy.dbg.json +1 -1
  135. package/build/contracts/src/mocks/SimpleProxy.sol/SimpleProxy.json +2 -2
  136. package/build/contracts/src/mocks/SingleExecutionChallenge.sol/SingleExecutionChallenge.dbg.json +1 -1
  137. package/build/contracts/src/mocks/SingleExecutionChallenge.sol/SingleExecutionChallenge.json +50 -2
  138. package/build/contracts/src/mocks/TimedOutChallengeManager.sol/TimedOutChallengeManager.dbg.json +1 -1
  139. package/build/contracts/src/mocks/TimedOutChallengeManager.sol/TimedOutChallengeManager.json +50 -2
  140. package/build/contracts/src/mocks/UpgradeExecutorMock.sol/UpgradeExecutorMock.dbg.json +1 -1
  141. package/build/contracts/src/mocks/UpgradeExecutorMock.sol/UpgradeExecutorMock.json +15 -2
  142. package/build/contracts/src/node-interface/NodeInterface.sol/NodeInterface.dbg.json +1 -1
  143. package/build/contracts/src/node-interface/NodeInterfaceDebug.sol/NodeInterfaceDebug.dbg.json +1 -1
  144. package/build/contracts/src/osp/HashProofHelper.sol/HashProofHelper.dbg.json +1 -1
  145. package/build/contracts/src/osp/IOneStepProofEntry.sol/IOneStepProofEntry.dbg.json +1 -1
  146. package/build/contracts/src/osp/IOneStepProofEntry.sol/IOneStepProofEntry.json +48 -0
  147. package/build/contracts/src/osp/IOneStepProofEntry.sol/OneStepProofEntryLib.dbg.json +1 -1
  148. package/build/contracts/src/osp/IOneStepProofEntry.sol/OneStepProofEntryLib.json +2 -2
  149. package/build/contracts/src/osp/IOneStepProver.sol/IOneStepProver.dbg.json +1 -1
  150. package/build/contracts/src/osp/IOneStepProver.sol/IOneStepProver.json +88 -0
  151. package/build/contracts/src/osp/OneStepProofEntry.sol/OneStepProofEntry.dbg.json +1 -1
  152. package/build/contracts/src/osp/OneStepProofEntry.sol/OneStepProofEntry.json +50 -2
  153. package/build/contracts/src/osp/OneStepProver0.sol/OneStepProver0.dbg.json +1 -1
  154. package/build/contracts/src/osp/OneStepProver0.sol/OneStepProver0.json +90 -2
  155. package/build/contracts/src/osp/OneStepProverHostIo.sol/OneStepProverHostIo.dbg.json +1 -1
  156. package/build/contracts/src/osp/OneStepProverHostIo.sol/OneStepProverHostIo.json +90 -2
  157. package/build/contracts/src/osp/OneStepProverMath.sol/OneStepProverMath.dbg.json +1 -1
  158. package/build/contracts/src/osp/OneStepProverMath.sol/OneStepProverMath.json +90 -2
  159. package/build/contracts/src/osp/OneStepProverMemory.sol/OneStepProverMemory.dbg.json +1 -1
  160. package/build/contracts/src/osp/OneStepProverMemory.sol/OneStepProverMemory.json +90 -2
  161. package/build/contracts/src/precompiles/ArbAddressTable.sol/ArbAddressTable.dbg.json +1 -1
  162. package/build/contracts/src/precompiles/ArbAggregator.sol/ArbAggregator.dbg.json +1 -1
  163. package/build/contracts/src/precompiles/ArbBLS.sol/ArbBLS.dbg.json +1 -1
  164. package/build/contracts/src/precompiles/ArbDebug.sol/ArbDebug.dbg.json +1 -1
  165. package/build/contracts/src/precompiles/ArbDebug.sol/ArbDebug.json +7 -0
  166. package/build/contracts/src/precompiles/ArbFunctionTable.sol/ArbFunctionTable.dbg.json +1 -1
  167. package/build/contracts/src/precompiles/ArbGasInfo.sol/ArbGasInfo.dbg.json +1 -1
  168. package/build/contracts/src/precompiles/ArbInfo.sol/ArbInfo.dbg.json +1 -1
  169. package/build/contracts/src/precompiles/ArbOwner.sol/ArbOwner.dbg.json +1 -1
  170. package/build/contracts/src/precompiles/ArbOwner.sol/ArbOwner.json +161 -0
  171. package/build/contracts/src/precompiles/ArbOwnerPublic.sol/ArbOwnerPublic.dbg.json +1 -1
  172. package/build/contracts/src/precompiles/ArbRetryableTx.sol/ArbRetryableTx.dbg.json +1 -1
  173. package/build/contracts/src/precompiles/ArbStatistics.sol/ArbStatistics.dbg.json +1 -1
  174. package/build/contracts/src/precompiles/ArbSys.sol/ArbSys.dbg.json +1 -1
  175. package/build/contracts/src/precompiles/ArbWasm.sol/ArbWasm.dbg.json +4 -0
  176. package/build/contracts/src/precompiles/ArbWasm.sol/ArbWasm.json +453 -0
  177. package/build/contracts/src/precompiles/ArbWasmCache.sol/ArbWasmCache.dbg.json +4 -0
  178. package/build/contracts/src/precompiles/ArbWasmCache.sol/ArbWasmCache.json +113 -0
  179. package/build/contracts/src/precompiles/ArbosActs.sol/ArbosActs.dbg.json +1 -1
  180. package/build/contracts/src/precompiles/ArbosTest.sol/ArbosTest.dbg.json +1 -1
  181. package/build/contracts/src/rollup/AbsRollupEventInbox.sol/AbsRollupEventInbox.dbg.json +1 -1
  182. package/build/contracts/src/rollup/BridgeCreator.sol/BridgeCreator.dbg.json +1 -1
  183. package/build/contracts/src/rollup/BridgeCreator.sol/BridgeCreator.json +10 -10
  184. package/build/contracts/src/rollup/DeployHelper.sol/DeployHelper.dbg.json +1 -1
  185. package/build/contracts/src/rollup/DeployHelper.sol/DeployHelper.json +2 -2
  186. package/build/contracts/src/rollup/ERC20RollupEventInbox.sol/ERC20RollupEventInbox.dbg.json +1 -1
  187. package/build/contracts/src/rollup/ERC20RollupEventInbox.sol/ERC20RollupEventInbox.json +2 -2
  188. package/build/contracts/src/rollup/IRollupAdmin.sol/IRollupAdmin.dbg.json +1 -1
  189. package/build/contracts/src/rollup/IRollupAdmin.sol/IRollupAdmin.json +8 -8
  190. package/build/contracts/src/rollup/IRollupCore.sol/IRollupCore.dbg.json +1 -1
  191. package/build/contracts/src/rollup/IRollupEventInbox.sol/IRollupEventInbox.dbg.json +1 -1
  192. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUser.dbg.json +1 -1
  193. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUserAbs.dbg.json +1 -1
  194. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUserERC20.dbg.json +1 -1
  195. package/build/contracts/src/rollup/Node.sol/NodeLib.dbg.json +1 -1
  196. package/build/contracts/src/rollup/Node.sol/NodeLib.json +2 -2
  197. package/build/contracts/src/rollup/RollupAdminLogic.sol/RollupAdminLogic.dbg.json +1 -1
  198. package/build/contracts/src/rollup/RollupAdminLogic.sol/RollupAdminLogic.json +23 -10
  199. package/build/contracts/src/rollup/RollupCore.sol/RollupCore.dbg.json +1 -1
  200. package/build/contracts/src/rollup/RollupCore.sol/RollupCore.json +13 -0
  201. package/build/contracts/src/rollup/RollupCreator.sol/RollupCreator.dbg.json +1 -1
  202. package/build/contracts/src/rollup/RollupCreator.sol/RollupCreator.json +10 -10
  203. package/build/contracts/src/rollup/RollupEventInbox.sol/RollupEventInbox.dbg.json +1 -1
  204. package/build/contracts/src/rollup/RollupEventInbox.sol/RollupEventInbox.json +2 -2
  205. package/build/contracts/src/rollup/RollupLib.sol/RollupLib.dbg.json +1 -1
  206. package/build/contracts/src/rollup/RollupLib.sol/RollupLib.json +2 -2
  207. package/build/contracts/src/rollup/RollupProxy.sol/RollupProxy.dbg.json +1 -1
  208. package/build/contracts/src/rollup/RollupProxy.sol/RollupProxy.json +10 -10
  209. package/build/contracts/src/rollup/RollupUserLogic.sol/AbsRollupUserLogic.dbg.json +1 -1
  210. package/build/contracts/src/rollup/RollupUserLogic.sol/AbsRollupUserLogic.json +13 -0
  211. package/build/contracts/src/rollup/RollupUserLogic.sol/ERC20RollupUserLogic.dbg.json +1 -1
  212. package/build/contracts/src/rollup/RollupUserLogic.sol/ERC20RollupUserLogic.json +15 -2
  213. package/build/contracts/src/rollup/RollupUserLogic.sol/RollupUserLogic.dbg.json +1 -1
  214. package/build/contracts/src/rollup/RollupUserLogic.sol/RollupUserLogic.json +15 -2
  215. package/build/contracts/src/rollup/ValidatorUtils.sol/ValidatorUtils.dbg.json +1 -1
  216. package/build/contracts/src/rollup/ValidatorUtils.sol/ValidatorUtils.json +2 -2
  217. package/build/contracts/src/rollup/ValidatorWallet.sol/ValidatorWallet.dbg.json +1 -1
  218. package/build/contracts/src/rollup/ValidatorWallet.sol/ValidatorWallet.json +15 -2
  219. package/build/contracts/src/rollup/ValidatorWalletCreator.sol/ValidatorWalletCreator.dbg.json +1 -1
  220. package/build/contracts/src/rollup/ValidatorWalletCreator.sol/ValidatorWalletCreator.json +2 -2
  221. package/build/contracts/src/state/Deserialize.sol/Deserialize.dbg.json +1 -1
  222. package/build/contracts/src/state/Deserialize.sol/Deserialize.json +2 -2
  223. package/build/contracts/src/state/GlobalState.sol/GlobalStateLib.dbg.json +1 -1
  224. package/build/contracts/src/state/Instructions.sol/Instructions.dbg.json +1 -1
  225. package/build/contracts/src/state/Instructions.sol/Instructions.json +2 -2
  226. package/build/contracts/src/state/Machine.sol/MachineLib.dbg.json +1 -1
  227. package/build/contracts/src/state/Machine.sol/MachineLib.json +2 -2
  228. package/build/contracts/src/state/MerkleProof.sol/MerkleProofLib.dbg.json +1 -1
  229. package/build/contracts/src/state/MerkleProof.sol/MerkleProofLib.json +2 -2
  230. package/build/contracts/src/state/Module.sol/ModuleLib.dbg.json +1 -1
  231. package/build/contracts/src/state/Module.sol/ModuleLib.json +2 -2
  232. package/build/contracts/src/state/ModuleMemory.sol/ModuleMemoryLib.dbg.json +1 -1
  233. package/build/contracts/src/state/ModuleMemory.sol/ModuleMemoryLib.json +2 -2
  234. package/build/contracts/src/state/ModuleMemoryCompact.sol/ModuleMemoryCompactLib.dbg.json +1 -1
  235. package/build/contracts/src/state/MultiStack.sol/MultiStackLib.dbg.json +4 -0
  236. package/build/contracts/src/state/MultiStack.sol/MultiStackLib.json +10 -0
  237. package/build/contracts/src/state/PcArray.sol/PcArrayLib.dbg.json +1 -1
  238. package/build/contracts/src/state/StackFrame.sol/StackFrameLib.dbg.json +1 -1
  239. package/build/contracts/src/state/StackFrame.sol/StackFrameLib.json +2 -2
  240. package/build/contracts/src/state/Value.sol/ValueLib.dbg.json +1 -1
  241. package/build/contracts/src/state/Value.sol/ValueLib.json +2 -2
  242. package/build/contracts/src/state/ValueArray.sol/ValueArrayLib.dbg.json +1 -1
  243. package/build/contracts/src/state/ValueArray.sol/ValueArrayLib.json +2 -2
  244. package/build/contracts/src/state/ValueStack.sol/ValueStackLib.dbg.json +1 -1
  245. package/build/contracts/src/state/ValueStack.sol/ValueStackLib.json +2 -2
  246. package/build/contracts/src/test-helpers/BridgeTester.sol/BridgeTester.dbg.json +1 -1
  247. package/build/contracts/src/test-helpers/BridgeTester.sol/BridgeTester.json +15 -2
  248. package/build/contracts/src/test-helpers/CryptographyPrimitivesTester.sol/CryptographyPrimitivesTester.dbg.json +1 -1
  249. package/build/contracts/src/test-helpers/EthVault.sol/EthVault.dbg.json +1 -1
  250. package/build/contracts/src/test-helpers/MessageTester.sol/MessageTester.dbg.json +1 -1
  251. package/build/contracts/src/test-helpers/OutboxWithoutOptTester.sol/OutboxWithoutOptTester.dbg.json +1 -1
  252. package/build/contracts/src/test-helpers/OutboxWithoutOptTester.sol/OutboxWithoutOptTester.json +2 -2
  253. package/build/contracts/src/test-helpers/RollupMock.sol/RollupMock.dbg.json +1 -1
  254. package/build/contracts/src/test-helpers/TestToken.sol/TestToken.dbg.json +1 -1
  255. package/build/contracts/src/test-helpers/TestToken.sol/TestToken.json +2 -2
  256. package/build/contracts/src/test-helpers/ValueArrayTester.sol/ValueArrayTester.dbg.json +1 -1
  257. package/build/contracts/src/test-helpers/ValueArrayTester.sol/ValueArrayTester.json +2 -2
  258. package/package.json +14 -7
  259. package/src/bridge/ISequencerInbox.sol +4 -4
  260. package/src/bridge/SequencerInbox.sol +38 -30
  261. package/src/chain/CacheManager.sol +283 -0
  262. package/src/challenge/ChallengeLib.sol +0 -45
  263. package/src/challenge/ChallengeManager.sol +24 -9
  264. package/src/challenge/IChallengeManager.sol +13 -0
  265. package/src/libraries/Error.sol +3 -9
  266. package/src/mocks/Benchmarks.sol +52 -0
  267. package/src/mocks/MultiCallTest.sol +117 -0
  268. package/src/mocks/PendingBlkTimeAndNrAdvanceCheck.sol +29 -0
  269. package/src/mocks/Program.sol +126 -0
  270. package/src/mocks/SdkStorage.sol +176 -0
  271. package/src/mocks/SequencerInboxStub.sol +4 -4
  272. package/src/mocks/SimpleCacheManager.sol +22 -0
  273. package/src/osp/IOneStepProofEntry.sol +10 -0
  274. package/src/osp/OneStepProofEntry.sol +81 -7
  275. package/src/osp/OneStepProver0.sol +64 -20
  276. package/src/osp/OneStepProverHostIo.sol +201 -2
  277. package/src/osp/OneStepProverMemory.sol +4 -33
  278. package/src/precompiles/ArbDebug.sol +2 -0
  279. package/src/precompiles/ArbOwner.sol +51 -9
  280. package/src/precompiles/ArbWasm.sol +119 -0
  281. package/src/precompiles/ArbWasmCache.sol +33 -0
  282. package/src/state/Deserialize.sol +88 -47
  283. package/src/state/Instructions.sol +38 -3
  284. package/src/state/Machine.sol +92 -15
  285. package/src/state/MerkleProof.sol +22 -4
  286. package/src/state/Module.sol +3 -1
  287. package/src/state/ModuleMemory.sol +54 -0
  288. package/src/state/MultiStack.sol +58 -0
  289. package/src/state/StackFrame.sol +6 -1
  290. package/src/state/Value.sol +13 -1
  291. package/src/state/ValueStack.sol +6 -1
@@ -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
+ }