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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (300) hide show
  1. package/README.md +1 -1
  2. package/build/contracts/@openzeppelin/contracts/access/Ownable.sol/Ownable.dbg.json +1 -1
  3. package/build/contracts/@openzeppelin/contracts/interfaces/draft-IERC1822.sol/IERC1822Proxiable.dbg.json +1 -1
  4. package/build/contracts/@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol/ERC1967Proxy.dbg.json +1 -1
  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/transparent/ProxyAdmin.sol/ProxyAdmin.dbg.json +1 -1
  10. package/build/contracts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.dbg.json +1 -1
  11. package/build/contracts/@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol/UUPSUpgradeable.dbg.json +1 -1
  12. package/build/contracts/@openzeppelin/contracts/security/ReentrancyGuard.sol/ReentrancyGuard.dbg.json +1 -1
  13. package/build/contracts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json +1 -1
  14. package/build/contracts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json +1 -1
  15. package/build/contracts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json +1 -1
  16. package/build/contracts/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol/SafeERC20.dbg.json +1 -1
  17. package/build/contracts/@openzeppelin/contracts/utils/Address.sol/Address.dbg.json +1 -1
  18. package/build/contracts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json +1 -1
  19. package/build/contracts/@openzeppelin/contracts/utils/StorageSlot.sol/StorageSlot.dbg.json +1 -1
  20. package/build/contracts/@openzeppelin/contracts/utils/Strings.sol/Strings.dbg.json +4 -0
  21. package/build/contracts/@openzeppelin/contracts/utils/Strings.sol/Strings.json +10 -0
  22. package/build/contracts/@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol/AccessControlUpgradeable.dbg.json +1 -1
  23. package/build/contracts/@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol/IAccessControlUpgradeable.dbg.json +1 -1
  24. package/build/contracts/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol/OwnableUpgradeable.dbg.json +1 -1
  25. package/build/contracts/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol/Initializable.dbg.json +1 -1
  26. package/build/contracts/@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol/PausableUpgradeable.dbg.json +1 -1
  27. package/build/contracts/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol/IERC20Upgradeable.dbg.json +1 -1
  28. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol/AddressUpgradeable.dbg.json +1 -1
  29. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol/ContextUpgradeable.dbg.json +1 -1
  30. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol/StorageSlotUpgradeable.dbg.json +1 -1
  31. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol/StringsUpgradeable.dbg.json +1 -1
  32. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol/ERC165Upgradeable.dbg.json +1 -1
  33. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol/IERC165Upgradeable.dbg.json +1 -1
  34. package/build/contracts/src/bridge/AbsBridge.sol/AbsBridge.dbg.json +1 -1
  35. package/build/contracts/src/bridge/AbsInbox.sol/AbsInbox.dbg.json +1 -1
  36. package/build/contracts/src/bridge/AbsOutbox.sol/AbsOutbox.dbg.json +1 -1
  37. package/build/contracts/src/bridge/Bridge.sol/Bridge.dbg.json +1 -1
  38. package/build/contracts/src/bridge/Bridge.sol/Bridge.json +2 -2
  39. package/build/contracts/src/bridge/ERC20Bridge.sol/ERC20Bridge.dbg.json +1 -1
  40. package/build/contracts/src/bridge/ERC20Bridge.sol/ERC20Bridge.json +26 -2
  41. package/build/contracts/src/bridge/ERC20Inbox.sol/ERC20Inbox.dbg.json +1 -1
  42. package/build/contracts/src/bridge/ERC20Inbox.sol/ERC20Inbox.json +13 -2
  43. package/build/contracts/src/bridge/ERC20Outbox.sol/ERC20Outbox.dbg.json +1 -1
  44. package/build/contracts/src/bridge/ERC20Outbox.sol/ERC20Outbox.json +2 -2
  45. package/build/contracts/src/bridge/GasRefunder.sol/GasRefunder.dbg.json +1 -1
  46. package/build/contracts/src/bridge/IBridge.sol/IBridge.dbg.json +1 -1
  47. package/build/contracts/src/bridge/IDelayedMessageProvider.sol/IDelayedMessageProvider.dbg.json +1 -1
  48. package/build/contracts/src/bridge/IERC20Bridge.sol/IERC20Bridge.dbg.json +1 -1
  49. package/build/contracts/src/bridge/IERC20Bridge.sol/IERC20Bridge.json +13 -0
  50. package/build/contracts/src/bridge/IERC20Inbox.sol/IERC20Inbox.dbg.json +1 -1
  51. package/build/contracts/src/bridge/IEthBridge.sol/IEthBridge.dbg.json +1 -1
  52. package/build/contracts/src/bridge/IInbox.sol/IInbox.dbg.json +1 -1
  53. package/build/contracts/src/bridge/IInboxBase.sol/IInboxBase.dbg.json +1 -1
  54. package/build/contracts/src/bridge/IOutbox.sol/IOutbox.dbg.json +1 -1
  55. package/build/contracts/src/bridge/IOwnable.sol/IOwnable.dbg.json +1 -1
  56. package/build/contracts/src/bridge/ISequencerInbox.sol/ISequencerInbox.dbg.json +1 -1
  57. package/build/contracts/src/bridge/Inbox.sol/Inbox.dbg.json +1 -1
  58. package/build/contracts/src/bridge/Inbox.sol/Inbox.json +2 -2
  59. package/build/contracts/src/bridge/Messages.sol/Messages.dbg.json +1 -1
  60. package/build/contracts/src/bridge/Outbox.sol/Outbox.dbg.json +1 -1
  61. package/build/contracts/src/bridge/Outbox.sol/Outbox.json +2 -2
  62. package/build/contracts/src/bridge/SequencerInbox.sol/SequencerInbox.dbg.json +1 -1
  63. package/build/contracts/src/bridge/SequencerInbox.sol/SequencerInbox.json +2 -2
  64. package/build/contracts/src/chain/CacheManager.sol/CacheManager.dbg.json +4 -0
  65. package/build/contracts/src/chain/CacheManager.sol/CacheManager.json +517 -0
  66. package/build/contracts/src/challenge/ChallengeLib.sol/ChallengeLib.dbg.json +1 -1
  67. package/build/contracts/src/challenge/ChallengeLib.sol/ChallengeLib.json +2 -2
  68. package/build/contracts/src/challenge/ChallengeManager.sol/ChallengeManager.dbg.json +1 -1
  69. package/build/contracts/src/challenge/ChallengeManager.sol/ChallengeManager.json +50 -2
  70. package/build/contracts/src/challenge/IChallengeManager.sol/IChallengeManager.dbg.json +1 -1
  71. package/build/contracts/src/challenge/IChallengeManager.sol/IChallengeManager.json +55 -0
  72. package/build/contracts/src/challenge/IChallengeResultReceiver.sol/IChallengeResultReceiver.dbg.json +1 -1
  73. package/build/contracts/src/libraries/AddressAliasHelper.sol/AddressAliasHelper.dbg.json +1 -1
  74. package/build/contracts/src/libraries/AdminFallbackProxy.sol/AdminFallbackProxy.dbg.json +1 -1
  75. package/build/contracts/src/libraries/AdminFallbackProxy.sol/DoubleLogicERC1967Upgrade.dbg.json +1 -1
  76. package/build/contracts/src/libraries/ArbitrumChecker.sol/ArbitrumChecker.dbg.json +1 -1
  77. package/build/contracts/src/libraries/CryptographyPrimitives.sol/CryptographyPrimitives.dbg.json +1 -1
  78. package/build/contracts/src/libraries/DecimalsConverterHelper.sol/DecimalsConverterHelper.dbg.json +4 -0
  79. package/build/contracts/src/libraries/DecimalsConverterHelper.sol/DecimalsConverterHelper.json +10 -0
  80. package/build/contracts/src/libraries/DelegateCallAware.sol/DelegateCallAware.dbg.json +1 -1
  81. package/build/contracts/src/libraries/DoubleLogicUUPSUpgradeable.sol/DoubleLogicUUPSUpgradeable.dbg.json +1 -1
  82. package/build/contracts/src/libraries/GasRefundEnabled.sol/GasRefundEnabled.dbg.json +1 -1
  83. package/build/contracts/src/libraries/IGasRefunder.sol/IGasRefunder.dbg.json +1 -1
  84. package/build/contracts/src/libraries/IReader4844.sol/IReader4844.dbg.json +1 -1
  85. package/build/contracts/src/libraries/MerkleLib.sol/MerkleLib.dbg.json +1 -1
  86. package/build/contracts/src/libraries/MerkleLib.sol/MerkleLib.json +2 -2
  87. package/build/contracts/src/libraries/UUPSNotUpgradeable.sol/UUPSNotUpgradeable.dbg.json +1 -1
  88. package/build/contracts/src/mocks/Benchmarks.sol/Benchmarks.dbg.json +4 -0
  89. package/build/contracts/src/mocks/Benchmarks.sol/Benchmarks.json +46 -0
  90. package/build/contracts/src/mocks/BridgeStub.sol/BridgeStub.dbg.json +1 -1
  91. package/build/contracts/src/mocks/BridgeStub.sol/BridgeStub.json +28 -2
  92. package/build/contracts/src/mocks/BridgeUnproxied.sol/BridgeUnproxied.dbg.json +1 -1
  93. package/build/contracts/src/mocks/BridgeUnproxied.sol/BridgeUnproxied.json +2 -2
  94. package/build/contracts/src/mocks/InboxStub.sol/InboxStub.dbg.json +1 -1
  95. package/build/contracts/src/mocks/InboxStub.sol/InboxStub.json +2 -2
  96. package/build/contracts/src/mocks/MockResultReceiver.sol/MockResultReceiver.dbg.json +1 -1
  97. package/build/contracts/src/mocks/MockResultReceiver.sol/MockResultReceiver.json +2 -2
  98. package/build/contracts/src/mocks/MultiCallTest.sol/MultiCallTest.dbg.json +4 -0
  99. package/build/contracts/src/mocks/MultiCallTest.sol/MultiCallTest.json +71 -0
  100. package/build/contracts/src/mocks/PendingBlkTimeAndNrAdvanceCheck.sol/PendingBlkTimeAndNrAdvanceCheck.dbg.json +4 -0
  101. package/build/contracts/src/mocks/PendingBlkTimeAndNrAdvanceCheck.sol/PendingBlkTimeAndNrAdvanceCheck.json +36 -0
  102. package/build/contracts/src/mocks/Program.sol/ProgramTest.dbg.json +4 -0
  103. package/build/contracts/src/mocks/Program.sol/ProgramTest.json +142 -0
  104. package/build/contracts/src/mocks/ProxyAdminForBinding.sol/ProxyAdminForBinding.dbg.json +1 -1
  105. package/build/contracts/src/mocks/SdkStorage.sol/SdkStorage.dbg.json +4 -0
  106. package/build/contracts/src/mocks/SdkStorage.sol/SdkStorage.json +25 -0
  107. package/build/contracts/src/mocks/SequencerInboxStub.sol/SequencerInboxStub.dbg.json +1 -1
  108. package/build/contracts/src/mocks/SequencerInboxStub.sol/SequencerInboxStub.json +2 -2
  109. package/build/contracts/src/mocks/Simple.sol/Simple.dbg.json +1 -1
  110. package/build/contracts/src/mocks/SimpleCacheManager.sol/SimpleCacheManager.dbg.json +4 -0
  111. package/build/contracts/src/mocks/SimpleCacheManager.sol/SimpleCacheManager.json +37 -0
  112. package/build/contracts/src/mocks/SimpleProxy.sol/SimpleProxy.dbg.json +1 -1
  113. package/build/contracts/src/mocks/SingleExecutionChallenge.sol/SingleExecutionChallenge.dbg.json +1 -1
  114. package/build/contracts/src/mocks/SingleExecutionChallenge.sol/SingleExecutionChallenge.json +50 -2
  115. package/build/contracts/src/mocks/TimedOutChallengeManager.sol/TimedOutChallengeManager.dbg.json +1 -1
  116. package/build/contracts/src/mocks/TimedOutChallengeManager.sol/TimedOutChallengeManager.json +50 -2
  117. package/build/contracts/src/mocks/UpgradeExecutorMock.sol/UpgradeExecutorMock.dbg.json +1 -1
  118. package/build/contracts/src/node-interface/NodeInterface.sol/NodeInterface.dbg.json +1 -1
  119. package/build/contracts/src/node-interface/NodeInterfaceDebug.sol/NodeInterfaceDebug.dbg.json +1 -1
  120. package/build/contracts/src/osp/HashProofHelper.sol/HashProofHelper.dbg.json +1 -1
  121. package/build/contracts/src/osp/IOneStepProofEntry.sol/IOneStepProofEntry.dbg.json +1 -1
  122. package/build/contracts/src/osp/IOneStepProofEntry.sol/IOneStepProofEntry.json +48 -0
  123. package/build/contracts/src/osp/IOneStepProofEntry.sol/OneStepProofEntryLib.dbg.json +1 -1
  124. package/build/contracts/src/osp/IOneStepProofEntry.sol/OneStepProofEntryLib.json +2 -2
  125. package/build/contracts/src/osp/IOneStepProver.sol/IOneStepProver.dbg.json +1 -1
  126. package/build/contracts/src/osp/IOneStepProver.sol/IOneStepProver.json +88 -0
  127. package/build/contracts/src/osp/OneStepProofEntry.sol/OneStepProofEntry.dbg.json +1 -1
  128. package/build/contracts/src/osp/OneStepProofEntry.sol/OneStepProofEntry.json +50 -2
  129. package/build/contracts/src/osp/OneStepProver0.sol/OneStepProver0.dbg.json +1 -1
  130. package/build/contracts/src/osp/OneStepProver0.sol/OneStepProver0.json +90 -2
  131. package/build/contracts/src/osp/OneStepProverHostIo.sol/OneStepProverHostIo.dbg.json +1 -1
  132. package/build/contracts/src/osp/OneStepProverHostIo.sol/OneStepProverHostIo.json +90 -2
  133. package/build/contracts/src/osp/OneStepProverMath.sol/OneStepProverMath.dbg.json +1 -1
  134. package/build/contracts/src/osp/OneStepProverMath.sol/OneStepProverMath.json +90 -2
  135. package/build/contracts/src/osp/OneStepProverMemory.sol/OneStepProverMemory.dbg.json +1 -1
  136. package/build/contracts/src/osp/OneStepProverMemory.sol/OneStepProverMemory.json +90 -2
  137. package/build/contracts/src/precompiles/ArbAddressTable.sol/ArbAddressTable.dbg.json +1 -1
  138. package/build/contracts/src/precompiles/ArbAggregator.sol/ArbAggregator.dbg.json +1 -1
  139. package/build/contracts/src/precompiles/ArbBLS.sol/ArbBLS.dbg.json +1 -1
  140. package/build/contracts/src/precompiles/ArbDebug.sol/ArbDebug.dbg.json +1 -1
  141. package/build/contracts/src/precompiles/ArbDebug.sol/ArbDebug.json +7 -0
  142. package/build/contracts/src/precompiles/ArbFunctionTable.sol/ArbFunctionTable.dbg.json +1 -1
  143. package/build/contracts/src/precompiles/ArbGasInfo.sol/ArbGasInfo.dbg.json +1 -1
  144. package/build/contracts/src/precompiles/ArbInfo.sol/ArbInfo.dbg.json +1 -1
  145. package/build/contracts/src/precompiles/ArbOwner.sol/ArbOwner.dbg.json +1 -1
  146. package/build/contracts/src/precompiles/ArbOwner.sol/ArbOwner.json +161 -0
  147. package/build/contracts/src/precompiles/ArbOwnerPublic.sol/ArbOwnerPublic.dbg.json +1 -1
  148. package/build/contracts/src/precompiles/ArbRetryableTx.sol/ArbRetryableTx.dbg.json +1 -1
  149. package/build/contracts/src/precompiles/ArbStatistics.sol/ArbStatistics.dbg.json +1 -1
  150. package/build/contracts/src/precompiles/ArbSys.sol/ArbSys.dbg.json +1 -1
  151. package/build/contracts/src/precompiles/ArbWasm.sol/ArbWasm.dbg.json +4 -0
  152. package/build/contracts/src/precompiles/ArbWasm.sol/ArbWasm.json +453 -0
  153. package/build/contracts/src/precompiles/ArbWasmCache.sol/ArbWasmCache.dbg.json +4 -0
  154. package/build/contracts/src/precompiles/ArbWasmCache.sol/ArbWasmCache.json +126 -0
  155. package/build/contracts/src/precompiles/ArbosActs.sol/ArbosActs.dbg.json +1 -1
  156. package/build/contracts/src/precompiles/ArbosTest.sol/ArbosTest.dbg.json +1 -1
  157. package/build/contracts/src/rollup/AbsRollupEventInbox.sol/AbsRollupEventInbox.dbg.json +1 -1
  158. package/build/contracts/src/rollup/BridgeCreator.sol/BridgeCreator.dbg.json +1 -1
  159. package/build/contracts/src/rollup/BridgeCreator.sol/BridgeCreator.json +2 -2
  160. package/build/contracts/src/rollup/DeployHelper.sol/DeployHelper.dbg.json +1 -1
  161. package/build/contracts/src/rollup/DeployHelper.sol/DeployHelper.json +2 -2
  162. package/build/contracts/src/rollup/ERC20RollupEventInbox.sol/ERC20RollupEventInbox.dbg.json +1 -1
  163. package/build/contracts/src/rollup/ERC20RollupEventInbox.sol/ERC20RollupEventInbox.json +2 -2
  164. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/FactoryDeployerHelper.dbg.json +4 -0
  165. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/FactoryDeployerHelper.json +68 -0
  166. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IDeployHelper.dbg.json +4 -0
  167. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IDeployHelper.json +58 -0
  168. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IERC20.dbg.json +4 -0
  169. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IERC20.json +40 -0
  170. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IERC20Bridge.dbg.json +4 -0
  171. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IERC20Bridge.json +24 -0
  172. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IInboxBase.dbg.json +4 -0
  173. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IInboxBase.json +24 -0
  174. package/build/contracts/src/rollup/IRollupAdmin.sol/IRollupAdmin.dbg.json +1 -1
  175. package/build/contracts/src/rollup/IRollupCore.sol/IRollupCore.dbg.json +1 -1
  176. package/build/contracts/src/rollup/IRollupEventInbox.sol/IRollupEventInbox.dbg.json +1 -1
  177. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUser.dbg.json +1 -1
  178. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUser.json +18 -0
  179. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUserAbs.dbg.json +1 -1
  180. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUserAbs.json +18 -0
  181. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUserERC20.dbg.json +1 -1
  182. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUserERC20.json +18 -0
  183. package/build/contracts/src/rollup/Node.sol/NodeLib.dbg.json +1 -1
  184. package/build/contracts/src/rollup/Node.sol/NodeLib.json +2 -2
  185. package/build/contracts/src/rollup/RollupAdminLogic.sol/RollupAdminLogic.dbg.json +1 -1
  186. package/build/contracts/src/rollup/RollupAdminLogic.sol/RollupAdminLogic.json +28 -2
  187. package/build/contracts/src/rollup/RollupCore.sol/RollupCore.dbg.json +1 -1
  188. package/build/contracts/src/rollup/RollupCore.sol/RollupCore.json +13 -0
  189. package/build/contracts/src/rollup/RollupCreator.sol/RollupCreator.dbg.json +1 -1
  190. package/build/contracts/src/rollup/RollupCreator.sol/RollupCreator.json +2 -2
  191. package/build/contracts/src/rollup/RollupEventInbox.sol/RollupEventInbox.dbg.json +1 -1
  192. package/build/contracts/src/rollup/RollupEventInbox.sol/RollupEventInbox.json +2 -2
  193. package/build/contracts/src/rollup/RollupLib.sol/RollupLib.dbg.json +1 -1
  194. package/build/contracts/src/rollup/RollupLib.sol/RollupLib.json +2 -2
  195. package/build/contracts/src/rollup/RollupProxy.sol/RollupProxy.dbg.json +1 -1
  196. package/build/contracts/src/rollup/RollupProxy.sol/RollupProxy.json +2 -2
  197. package/build/contracts/src/rollup/RollupUserLogic.sol/AbsRollupUserLogic.dbg.json +1 -1
  198. package/build/contracts/src/rollup/RollupUserLogic.sol/AbsRollupUserLogic.json +31 -0
  199. package/build/contracts/src/rollup/RollupUserLogic.sol/ERC20RollupUserLogic.dbg.json +1 -1
  200. package/build/contracts/src/rollup/RollupUserLogic.sol/ERC20RollupUserLogic.json +33 -2
  201. package/build/contracts/src/rollup/RollupUserLogic.sol/RollupUserLogic.dbg.json +1 -1
  202. package/build/contracts/src/rollup/RollupUserLogic.sol/RollupUserLogic.json +33 -2
  203. package/build/contracts/src/rollup/ValidatorUtils.sol/ValidatorUtils.dbg.json +1 -1
  204. package/build/contracts/src/rollup/ValidatorUtils.sol/ValidatorUtils.json +2 -2
  205. package/build/contracts/src/rollup/ValidatorWallet.sol/ValidatorWallet.dbg.json +1 -1
  206. package/build/contracts/src/rollup/ValidatorWallet.sol/ValidatorWallet.json +2 -2
  207. package/build/contracts/src/rollup/ValidatorWalletCreator.sol/ValidatorWalletCreator.dbg.json +1 -1
  208. package/build/contracts/src/rollup/ValidatorWalletCreator.sol/ValidatorWalletCreator.json +2 -2
  209. package/build/contracts/src/state/Deserialize.sol/Deserialize.dbg.json +1 -1
  210. package/build/contracts/src/state/Deserialize.sol/Deserialize.json +2 -2
  211. package/build/contracts/src/state/GlobalState.sol/GlobalStateLib.dbg.json +1 -1
  212. package/build/contracts/src/state/Instructions.sol/Instructions.dbg.json +1 -1
  213. package/build/contracts/src/state/Instructions.sol/Instructions.json +2 -2
  214. package/build/contracts/src/state/Machine.sol/MachineLib.dbg.json +1 -1
  215. package/build/contracts/src/state/Machine.sol/MachineLib.json +2 -2
  216. package/build/contracts/src/state/MerkleProof.sol/MerkleProofLib.dbg.json +1 -1
  217. package/build/contracts/src/state/MerkleProof.sol/MerkleProofLib.json +2 -2
  218. package/build/contracts/src/state/Module.sol/ModuleLib.dbg.json +1 -1
  219. package/build/contracts/src/state/Module.sol/ModuleLib.json +2 -2
  220. package/build/contracts/src/state/ModuleMemory.sol/ModuleMemoryLib.dbg.json +1 -1
  221. package/build/contracts/src/state/ModuleMemory.sol/ModuleMemoryLib.json +2 -2
  222. package/build/contracts/src/state/ModuleMemoryCompact.sol/ModuleMemoryCompactLib.dbg.json +1 -1
  223. package/build/contracts/src/state/MultiStack.sol/MultiStackLib.dbg.json +4 -0
  224. package/build/contracts/src/state/MultiStack.sol/MultiStackLib.json +10 -0
  225. package/build/contracts/src/state/PcArray.sol/PcArrayLib.dbg.json +1 -1
  226. package/build/contracts/src/state/StackFrame.sol/StackFrameLib.dbg.json +1 -1
  227. package/build/contracts/src/state/StackFrame.sol/StackFrameLib.json +2 -2
  228. package/build/contracts/src/state/Value.sol/ValueLib.dbg.json +1 -1
  229. package/build/contracts/src/state/Value.sol/ValueLib.json +2 -2
  230. package/build/contracts/src/state/ValueArray.sol/ValueArrayLib.dbg.json +1 -1
  231. package/build/contracts/src/state/ValueArray.sol/ValueArrayLib.json +2 -2
  232. package/build/contracts/src/state/ValueStack.sol/ValueStackLib.dbg.json +1 -1
  233. package/build/contracts/src/state/ValueStack.sol/ValueStackLib.json +2 -2
  234. package/build/contracts/src/test-helpers/BridgeTester.sol/BridgeTester.dbg.json +1 -1
  235. package/build/contracts/src/test-helpers/BridgeTester.sol/BridgeTester.json +28 -2
  236. package/build/contracts/src/test-helpers/CryptographyPrimitivesTester.sol/CryptographyPrimitivesTester.dbg.json +1 -1
  237. package/build/contracts/src/test-helpers/EthVault.sol/EthVault.dbg.json +1 -1
  238. package/build/contracts/src/test-helpers/MessageTester.sol/MessageTester.dbg.json +1 -1
  239. package/build/contracts/src/test-helpers/OutboxWithoutOptTester.sol/OutboxWithoutOptTester.dbg.json +1 -1
  240. package/build/contracts/src/test-helpers/OutboxWithoutOptTester.sol/OutboxWithoutOptTester.json +2 -2
  241. package/build/contracts/src/test-helpers/RollupMock.sol/RollupMock.dbg.json +1 -1
  242. package/build/contracts/src/test-helpers/TestToken.sol/TestToken.dbg.json +1 -1
  243. package/build/contracts/src/test-helpers/ValueArrayTester.sol/ValueArrayTester.dbg.json +1 -1
  244. package/build/contracts/src/test-helpers/ValueArrayTester.sol/ValueArrayTester.json +2 -2
  245. package/package.json +17 -8
  246. package/src/bridge/AbsInbox.sol +16 -4
  247. package/src/bridge/AbsOutbox.sol +11 -2
  248. package/src/bridge/ERC20Bridge.sol +30 -3
  249. package/src/bridge/ERC20Inbox.sol +28 -4
  250. package/src/bridge/ERC20Outbox.sol +10 -1
  251. package/src/bridge/IERC20Bridge.sol +7 -0
  252. package/src/bridge/IERC20Inbox.sol +4 -3
  253. package/src/bridge/IInbox.sol +3 -3
  254. package/src/bridge/Inbox.sol +6 -1
  255. package/src/bridge/Outbox.sol +5 -0
  256. package/src/chain/CacheManager.sol +293 -0
  257. package/src/challenge/ChallengeLib.sol +0 -45
  258. package/src/challenge/ChallengeManager.sol +24 -9
  259. package/src/challenge/IChallengeManager.sol +13 -0
  260. package/src/libraries/Constants.sol +11 -0
  261. package/src/libraries/DecimalsConverterHelper.sol +33 -0
  262. package/src/libraries/Error.sol +6 -0
  263. package/src/mocks/Benchmarks.sol +52 -0
  264. package/src/mocks/BridgeStub.sol +3 -0
  265. package/src/mocks/MultiCallTest.sol +117 -0
  266. package/src/mocks/PendingBlkTimeAndNrAdvanceCheck.sol +29 -0
  267. package/src/mocks/Program.sol +126 -0
  268. package/src/mocks/SdkStorage.sol +176 -0
  269. package/src/mocks/SimpleCacheManager.sol +22 -0
  270. package/src/node-interface/NodeInterface.sol +1 -1
  271. package/src/osp/IOneStepProofEntry.sol +10 -0
  272. package/src/osp/OneStepProofEntry.sol +81 -7
  273. package/src/osp/OneStepProver0.sol +64 -20
  274. package/src/osp/OneStepProverHostIo.sol +201 -2
  275. package/src/osp/OneStepProverMemory.sol +4 -33
  276. package/src/precompiles/ArbDebug.sol +2 -0
  277. package/src/precompiles/ArbOwner.sol +51 -9
  278. package/src/precompiles/ArbWasm.sol +119 -0
  279. package/src/precompiles/ArbWasmCache.sol +36 -0
  280. package/src/rollup/AbsRollupEventInbox.sol +3 -4
  281. package/src/rollup/DeployHelper.sol +22 -11
  282. package/src/rollup/ERC20RollupEventInbox.sol +5 -0
  283. package/src/rollup/FactoryDeployerHelper.sol +54 -0
  284. package/src/rollup/IRollupLogic.sol +2 -0
  285. package/src/rollup/RollupAdminLogic.sol +11 -0
  286. package/src/rollup/RollupCore.sol +1 -0
  287. package/src/rollup/RollupCreator.sol +49 -1
  288. package/src/rollup/RollupEventInbox.sol +8 -0
  289. package/src/rollup/RollupUserLogic.sol +35 -13
  290. package/src/state/Deserialize.sol +88 -47
  291. package/src/state/Instructions.sol +38 -3
  292. package/src/state/Machine.sol +92 -15
  293. package/src/state/MerkleProof.sol +22 -4
  294. package/src/state/Module.sol +3 -1
  295. package/src/state/ModuleMemory.sol +54 -0
  296. package/src/state/MultiStack.sol +58 -0
  297. package/src/state/StackFrame.sol +6 -1
  298. package/src/state/Value.sol +13 -1
  299. package/src/state/ValueStack.sol +6 -1
  300. package/src/test-helpers/BridgeTester.sol +3 -0
@@ -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,36 @@
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
+ /// @dev Deprecated, replaced with cacheProgram
20
+ function cacheCodehash(bytes32 codehash) external;
21
+
22
+ /// @notice Caches all programs with a codehash equal to the given address.
23
+ /// @notice Reverts if the programs have expired.
24
+ /// @notice Caller must be a cache manager or chain owner.
25
+ /// @notice If you're looking for how to bid for position, interact with the chain's cache manager contract.
26
+ function cacheProgram(address addr) external;
27
+
28
+ /// @notice Evicts all programs with the given codehash.
29
+ /// @notice Caller must be a cache manager or chain owner.
30
+ function evictCodehash(bytes32 codehash) external;
31
+
32
+ /// @notice Gets whether a program is cached. Note that the program may be expired.
33
+ function codehashIsCached(bytes32 codehash) external view returns (bool);
34
+
35
+ event UpdateProgramCache(address indexed manager, bytes32 indexed codehash, bool cached);
36
+ }
@@ -53,10 +53,7 @@ abstract contract AbsRollupEventInbox is
53
53
  {
54
54
  require(bytes(chainConfig).length > 0, "EMPTY_CHAIN_CONFIG");
55
55
  uint8 initMsgVersion = 1;
56
- uint256 currentDataCost = block.basefee;
57
- if (ArbitrumChecker.runningOnArbitrum()) {
58
- currentDataCost += ArbGasInfo(address(0x6c)).getL1BaseFeeEstimate();
59
- }
56
+ uint256 currentDataCost = _currentDataCostToReport();
60
57
  bytes memory initMsg = abi.encodePacked(
61
58
  chainId,
62
59
  initMsgVersion,
@@ -68,4 +65,6 @@ abstract contract AbsRollupEventInbox is
68
65
  }
69
66
 
70
67
  function _enqueueInitializationMsg(bytes memory initMsg) internal virtual returns (uint256);
68
+
69
+ function _currentDataCostToReport() internal virtual returns (uint256);
71
70
  }
@@ -6,8 +6,8 @@ pragma solidity ^0.8.0;
6
6
 
7
7
  import {IInbox} from "../bridge/IInbox.sol";
8
8
  import {IInboxBase} from "../bridge/IInboxBase.sol";
9
- import {IERC20Bridge} from "../bridge/IERC20Bridge.sol";
10
9
  import {IERC20Inbox} from "../bridge/ERC20Inbox.sol";
10
+ import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
11
11
 
12
12
  /// @notice Helper contract for deploying some keyless deployment to Arbitrum using delayed inbox
13
13
  contract DeployHelper {
@@ -48,7 +48,7 @@ contract DeployHelper {
48
48
  uint256 _value,
49
49
  address _l2Address,
50
50
  bytes memory payload,
51
- bool _isUsingFeeToken,
51
+ address _nativeToken,
52
52
  uint256 maxFeePerGas
53
53
  ) internal {
54
54
  uint256 submissionCost = IInboxBase(inbox).calculateRetryableSubmissionFee(
@@ -58,7 +58,20 @@ contract DeployHelper {
58
58
  uint256 feeAmount = _value + submissionCost + GASLIMIT * maxFeePerGas;
59
59
 
60
60
  // fund the target L2 address
61
- if (_isUsingFeeToken) {
61
+ if (_nativeToken != address(0)) {
62
+ // calculate the fee amount in the native token's decimals
63
+ uint256 feeAmountNativeDenominated = feeAmount;
64
+ uint8 decimals = ERC20(_nativeToken).decimals();
65
+ if (decimals < 18) {
66
+ feeAmountNativeDenominated = feeAmount / (10**(18 - decimals));
67
+ // round up if necessary
68
+ if (feeAmountNativeDenominated * (10**(18 - decimals)) < feeAmount) {
69
+ feeAmountNativeDenominated++;
70
+ }
71
+ } else if (decimals > 18) {
72
+ feeAmountNativeDenominated = feeAmount * (10**(decimals - 18));
73
+ }
74
+
62
75
  IERC20Inbox(inbox).createRetryableTicket({
63
76
  to: _l2Address,
64
77
  l2CallValue: _value,
@@ -67,7 +80,7 @@ contract DeployHelper {
67
80
  callValueRefundAddress: msg.sender,
68
81
  gasLimit: GASLIMIT,
69
82
  maxFeePerGas: maxFeePerGas,
70
- tokenTotalFeeAmount: feeAmount,
83
+ tokenTotalFeeAmount: feeAmountNativeDenominated,
71
84
  data: ""
72
85
  });
73
86
  } else {
@@ -91,14 +104,12 @@ contract DeployHelper {
91
104
  address _nativeToken,
92
105
  uint256 _maxFeePerGas
93
106
  ) external payable {
94
- bool isUsingFeeToken = _nativeToken != address(0);
95
-
96
107
  _fundAndDeploy(
97
108
  _inbox,
98
109
  NICK_CREATE2_VALUE,
99
110
  NICK_CREATE2_DEPLOYER,
100
111
  NICK_CREATE2_PAYLOAD,
101
- isUsingFeeToken,
112
+ _nativeToken,
102
113
  _maxFeePerGas
103
114
  );
104
115
  _fundAndDeploy(
@@ -106,7 +117,7 @@ contract DeployHelper {
106
117
  ERC2470_VALUE,
107
118
  ERC2470_DEPLOYER,
108
119
  ERC2470_PAYLOAD,
109
- isUsingFeeToken,
120
+ _nativeToken,
110
121
  _maxFeePerGas
111
122
  );
112
123
  _fundAndDeploy(
@@ -114,7 +125,7 @@ contract DeployHelper {
114
125
  ZOLTU_VALUE,
115
126
  ZOLTU_CREATE2_DEPLOYER,
116
127
  ZOLTU_CREATE2_PAYLOAD,
117
- isUsingFeeToken,
128
+ _nativeToken,
118
129
  _maxFeePerGas
119
130
  );
120
131
  _fundAndDeploy(
@@ -122,12 +133,12 @@ contract DeployHelper {
122
133
  ERC1820_VALUE,
123
134
  ERC1820_DEPLOYER,
124
135
  ERC1820_PAYLOAD,
125
- isUsingFeeToken,
136
+ _nativeToken,
126
137
  _maxFeePerGas
127
138
  );
128
139
 
129
140
  // if paying with ETH refund the caller
130
- if (!isUsingFeeToken) {
141
+ if (_nativeToken == address(0)) {
131
142
  payable(msg.sender).transfer(address(this).balance);
132
143
  }
133
144
  }
@@ -23,4 +23,9 @@ contract ERC20RollupEventInbox is AbsRollupEventInbox {
23
23
  tokenAmount
24
24
  );
25
25
  }
26
+
27
+ function _currentDataCostToReport() internal pure override returns (uint256) {
28
+ // at the moment chains using fee token in Anytrust mode do not charge for the data posting fees
29
+ return 0;
30
+ }
26
31
  }