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

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 (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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arbitrum/nitro-contracts",
3
- "version": "1.2.1",
3
+ "version": "2.0.0-beta.1",
4
4
  "description": "Layer 2 precompiles and rollup for Arbitrum Nitro",
5
5
  "author": "Offchain Labs, Inc.",
6
6
  "license": "BUSL-1.1",
@@ -18,12 +18,15 @@
18
18
  "url": "https://github.com/offchainlabs/nitro-contracts/issues"
19
19
  },
20
20
  "scripts": {
21
+ "audit:ci": "audit-ci --config ./audit-ci.jsonc",
22
+ "audit:fix": "yarn-audit-fix",
21
23
  "prepublishOnly": "hardhat clean && forge clean && hardhat compile && yarn build:forge:yul",
22
24
  "build:all": "yarn build && yarn build:forge",
23
25
  "build": "hardhat compile",
24
26
  "build:forge:sol": "forge build --skip *.yul",
25
27
  "build:forge:yul": "FOUNDRY_PROFILE=yul forge build --skip *.sol",
26
28
  "build:forge": "yarn build:forge:sol && yarn build:forge:yul",
29
+ "contract:size": "STRICT=true hardhat size-contracts",
27
30
  "lint:test": "eslint ./test",
28
31
  "solhint": "solhint -f table src/**/*.sol",
29
32
  "prettier:solidity": "prettier --write src/**/*.sol",
@@ -39,17 +42,20 @@
39
42
  "postinstall": "patch-package",
40
43
  "deploy-factory": "hardhat run scripts/deployment.ts",
41
44
  "deploy-eth-rollup": "hardhat run scripts/createEthRollup.ts",
42
- "deploy-erc20-rollup": "hardhat run scripts/createERC20Rollup.ts"
45
+ "deploy-erc20-rollup": "hardhat run scripts/createERC20Rollup.ts",
46
+ "create-rollup-testnode": "hardhat run scripts/local-deployment/deployCreatorAndCreateRollup.ts",
47
+ "deploy-cachemanager-testnode": "hardhat run scripts/local-deployment/deployCacheManager.ts"
43
48
  },
44
49
  "dependencies": {
45
50
  "@offchainlabs/upgrade-executor": "1.1.0-beta.0",
46
51
  "@openzeppelin/contracts": "4.5.0",
47
52
  "@openzeppelin/contracts-upgradeable": "4.5.2",
48
- "patch-package": "^6.4.7"
53
+ "patch-package": "^6.4.7",
54
+ "solady": "0.0.182"
49
55
  },
50
56
  "private": false,
51
57
  "devDependencies": {
52
- "@arbitrum/sdk": "^3.1.3",
58
+ "@arbitrum/sdk": "^3.4.1",
53
59
  "@ethersproject/providers": "^5.7.2",
54
60
  "@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.13",
55
61
  "@nomiclabs/hardhat-etherscan": "^3.1.0",
@@ -63,15 +69,17 @@
63
69
  "@typescript-eslint/eslint-plugin": "^5.14.0",
64
70
  "@typescript-eslint/eslint-plugin-tslint": "^5.27.1",
65
71
  "@typescript-eslint/parser": "^5.14.0",
72
+ "audit-ci": "^6.6.1",
66
73
  "chai": "^4.3.4",
67
74
  "dotenv": "^16.3.1",
68
75
  "eslint": "^8.23.1",
69
76
  "eslint-config-prettier": "^8.3.0",
70
77
  "eslint-plugin-mocha": "^9.0.0",
71
78
  "eslint-plugin-prettier": "^4.0.0",
72
- "ethereum-waffle": "^3.4.0",
73
- "ethers": "^5.5.2",
79
+ "ethereum-waffle": "^4.0.10",
80
+ "ethers": "^5.5.4",
74
81
  "hardhat": "^2.17.2",
82
+ "hardhat-contract-sizer": "^2.10.0",
75
83
  "hardhat-deploy": "^0.11.37",
76
84
  "hardhat-gas-reporter": "^1.0.9",
77
85
  "hardhat-ignore-warnings": "^0.2.9",
@@ -83,7 +91,8 @@
83
91
  "solidity-coverage": "^0.8.4",
84
92
  "ts-node": "^10.4.0",
85
93
  "tslint": "^6.1.3",
86
- "typechain": "^8.0.0",
87
- "typescript": "^4.5.4"
94
+ "typechain": "^8.3.2",
95
+ "typescript": "^4.5.4",
96
+ "yarn-audit-fix": "^10.0.7"
88
97
  }
89
98
  }
@@ -231,11 +231,14 @@ abstract contract AbsInbox is DelegateCallAware, PausableUpgradeable, IInboxBase
231
231
  uint256 amount,
232
232
  bytes calldata data
233
233
  ) internal returns (uint256) {
234
- // ensure the user's deposit alone will make submission succeed
235
- if (amount < (maxSubmissionCost + l2CallValue + gasLimit * maxFeePerGas)) {
234
+ // Ensure the user's deposit alone will make submission succeed.
235
+ // In case of native token having non-18 decimals: 'amount' is denominated in native token's decimals. All other
236
+ // value params - l2CallValue, maxSubmissionCost and maxFeePerGas are denominated in child chain's native 18 decimals.
237
+ uint256 amountToBeMintedOnL2 = _fromNativeTo18Decimals(amount);
238
+ if (amountToBeMintedOnL2 < (maxSubmissionCost + l2CallValue + gasLimit * maxFeePerGas)) {
236
239
  revert InsufficientValue(
237
240
  maxSubmissionCost + l2CallValue + gasLimit * maxFeePerGas,
238
- amount
241
+ amountToBeMintedOnL2
239
242
  );
240
243
  }
241
244
 
@@ -308,7 +311,7 @@ abstract contract AbsInbox is DelegateCallAware, PausableUpgradeable, IInboxBase
308
311
  abi.encodePacked(
309
312
  uint256(uint160(to)),
310
313
  l2CallValue,
311
- amount,
314
+ _fromNativeTo18Decimals(amount),
312
315
  maxSubmissionCost,
313
316
  uint256(uint160(excessFeeRefundAddress)),
314
317
  uint256(uint160(callValueRefundAddress)),
@@ -347,6 +350,15 @@ abstract contract AbsInbox is DelegateCallAware, PausableUpgradeable, IInboxBase
347
350
  virtual
348
351
  returns (uint256);
349
352
 
353
+ /// @notice get amount of ETH/token to mint on child chain based on provided value.
354
+ /// In case of ETH-based rollup this amount will always equal the provided
355
+ /// value. In case of ERC20-based rollup where native token has number of
356
+ /// decimals different thatn 18, amount will be re-adjusted to reflect 18
357
+ /// decimals used for native currency on child chain.
358
+ /// @dev provided value has to be less than 'type(uint256).max/10**(18-decimalsIn)'
359
+ /// or otherwise it will overflow.
360
+ function _fromNativeTo18Decimals(uint256 value) internal view virtual returns (uint256);
361
+
350
362
  /**
351
363
  * @dev This empty reserved space is put in place to allow future versions to add new
352
364
  * variables without shifting down storage in the inheritance chain.
@@ -205,6 +205,10 @@ abstract contract AbsOutbox is DelegateCallAware, IOutbox {
205
205
  ) internal {
206
206
  emit OutBoxTransactionExecuted(to, l2Sender, 0, outputId);
207
207
 
208
+ // get amount to unlock based on provided value. It might differ in case
209
+ // of native token which uses number of decimals different than 18
210
+ uint256 amountToUnlock = _getAmountToUnlock(value);
211
+
208
212
  // we temporarily store the previous values so the outbox can naturally
209
213
  // unwind itself when there are nested calls to `executeTransaction`
210
214
  L2ToL1Context memory prevContext = context;
@@ -215,11 +219,11 @@ abstract contract AbsOutbox is DelegateCallAware, IOutbox {
215
219
  l1Block: uint96(l1Block),
216
220
  timestamp: uint128(l2Timestamp),
217
221
  outputId: bytes32(outputId),
218
- withdrawalAmount: _amountToSetInContext(value)
222
+ withdrawalAmount: _amountToSetInContext(amountToUnlock)
219
223
  });
220
224
 
221
225
  // set and reset vars around execution so they remain valid during call
222
- executeBridgeCall(to, value, data);
226
+ executeBridgeCall(to, amountToUnlock, data);
223
227
 
224
228
  context = prevContext;
225
229
  }
@@ -311,6 +315,11 @@ abstract contract AbsOutbox is DelegateCallAware, IOutbox {
311
315
  /// @return default 'amount' in case of ERC20-based rollup is type(uint256).max, or 0 in case of ETH-based rollup
312
316
  function _defaultContextAmount() internal pure virtual returns (uint256);
313
317
 
318
+ /// @notice based on provided value, get amount of ETH/token to unlock. In case of ETH-based rollup this amount
319
+ /// will always equal the provided value. In case of ERC20-based rollup, amount will be re-adjusted to
320
+ /// reflect the number of decimals used by native token, in case it is different than 18.
321
+ function _getAmountToUnlock(uint256 value) internal view virtual returns (uint256);
322
+
314
323
  /// @notice value to be set for 'amount' field in L2ToL1Context during L2 to L1 transaction execution.
315
324
  /// In case of ERC20-based rollup this is the amount of native token being withdrawn. In case of standard ETH-based
316
325
  /// rollup this amount shall always be 0, because amount of ETH being withdrawn can be read from msg.value.
@@ -7,9 +7,18 @@ pragma solidity ^0.8.4;
7
7
  import "./AbsBridge.sol";
8
8
  import "./IERC20Bridge.sol";
9
9
  import "../libraries/AddressAliasHelper.sol";
10
- import {InvalidTokenSet, CallTargetNotAllowed, CallNotAllowed} from "../libraries/Error.sol";
11
- import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
12
- import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
10
+ import {
11
+ InvalidTokenSet,
12
+ CallTargetNotAllowed,
13
+ CallNotAllowed,
14
+ NativeTokenDecimalsTooLarge
15
+ } from "../libraries/Error.sol";
16
+ import {DecimalsConverterHelper} from "../libraries/DecimalsConverterHelper.sol";
17
+ import {MAX_ALLOWED_NATIVE_TOKEN_DECIMALS} from "../libraries/Constants.sol";
18
+
19
+ import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
20
+ import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
21
+ import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
13
22
 
14
23
  /**
15
24
  * @title Staging ground for incoming and outgoing messages
@@ -20,6 +29,8 @@ import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
20
29
  * - The token must only be transferrable via a call to the token address itself
21
30
  * - The token must only be able to set allowance via a call to the token address itself
22
31
  * - The token must not have a callback on transfer, and more generally a user must not be able to make a transfer to themselves revert
32
+ * - The token must have a max of 2^256 - 1 wei total supply unscaled
33
+ * - The token must have a max of 2^256 - 1 wei total supply when scaled to 18 decimals
23
34
  */
24
35
  contract ERC20Bridge is AbsBridge, IERC20Bridge {
25
36
  using SafeERC20 for IERC20;
@@ -27,12 +38,28 @@ contract ERC20Bridge is AbsBridge, IERC20Bridge {
27
38
  /// @inheritdoc IERC20Bridge
28
39
  address public nativeToken;
29
40
 
41
+ /// @inheritdoc IERC20Bridge
42
+ uint8 public nativeTokenDecimals;
43
+
30
44
  /// @inheritdoc IERC20Bridge
31
45
  function initialize(IOwnable rollup_, address nativeToken_) external initializer onlyDelegated {
32
46
  if (nativeToken_ == address(0)) revert InvalidTokenSet(nativeToken_);
33
47
  nativeToken = nativeToken_;
34
48
  _activeOutbox = EMPTY_ACTIVEOUTBOX;
35
49
  rollup = rollup_;
50
+
51
+ // store number of decimals used by native token
52
+ try ERC20(nativeToken_).decimals() returns (uint8 decimals) {
53
+ if (decimals > MAX_ALLOWED_NATIVE_TOKEN_DECIMALS) {
54
+ revert NativeTokenDecimalsTooLarge(decimals);
55
+ }
56
+ nativeTokenDecimals = decimals;
57
+ } catch {
58
+ // decimal is not part of the ERC20 spec
59
+ // assume it have 0 decimals if it does not have decimals() method
60
+ // we do this to align with the token bridge behavior
61
+ nativeTokenDecimals = 0;
62
+ }
36
63
  }
37
64
 
38
65
  /// @inheritdoc IERC20Bridge
@@ -9,9 +9,14 @@ import "./IERC20Inbox.sol";
9
9
  import "./IERC20Bridge.sol";
10
10
  import "../libraries/AddressAliasHelper.sol";
11
11
  import {L1MessageType_ethDeposit} from "../libraries/MessageTypes.sol";
12
- import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
12
+ import {AmountTooLarge} from "../libraries/Error.sol";
13
+ import {MAX_UPSCALE_AMOUNT} from "../libraries/Constants.sol";
14
+
15
+ import {DecimalsConverterHelper} from "../libraries/DecimalsConverterHelper.sol";
16
+
17
+ import {AddressUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
13
18
  import {IERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
14
- import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
19
+ import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
15
20
 
16
21
  /**
17
22
  * @title Inbox for user and contract originated messages
@@ -33,7 +38,7 @@ contract ERC20Inbox is AbsInbox, IERC20Inbox {
33
38
 
34
39
  // inbox holds native token in transit used to pay for retryable tickets, approve bridge to use it
35
40
  address nativeToken = IERC20Bridge(address(bridge)).nativeToken();
36
- IERC20(nativeToken).approve(address(bridge), type(uint256).max);
41
+ IERC20(nativeToken).safeApprove(address(bridge), type(uint256).max);
37
42
  }
38
43
 
39
44
  /// @inheritdoc IERC20Inbox
@@ -46,11 +51,12 @@ contract ERC20Inbox is AbsInbox, IERC20Inbox {
46
51
  dest = AddressAliasHelper.applyL1ToL2Alias(msg.sender);
47
52
  }
48
53
 
54
+ uint256 amountToMintOnL2 = _fromNativeTo18Decimals(amount);
49
55
  return
50
56
  _deliverMessage(
51
57
  L1MessageType_ethDeposit,
52
58
  msg.sender,
53
- abi.encodePacked(dest, amount),
59
+ abi.encodePacked(dest, amountToMintOnL2),
54
60
  amount
55
61
  );
56
62
  }
@@ -141,4 +147,22 @@ contract ERC20Inbox is AbsInbox, IERC20Inbox {
141
147
  tokenAmount
142
148
  );
143
149
  }
150
+
151
+ /// @inheritdoc AbsInbox
152
+ function _fromNativeTo18Decimals(uint256 value) internal view override returns (uint256) {
153
+ // In order to keep compatibility of child chain's native currency with external 3rd party tooling we
154
+ // expect 18 decimals to be always used for native currency. If native token uses different number of
155
+ // decimals then here it will be normalized to 18. Keep in mind, when withdrawing from child chain back
156
+ // to parent chain then the amount has to match native token's granularity, otherwise it will be rounded
157
+ // down.
158
+ uint8 nativeTokenDecimals = IERC20Bridge(address(bridge)).nativeTokenDecimals();
159
+
160
+ // Also make sure that inflated amount does not overflow uint256
161
+ if (nativeTokenDecimals < 18) {
162
+ if (value > MAX_UPSCALE_AMOUNT) {
163
+ revert AmountTooLarge(value);
164
+ }
165
+ }
166
+ return DecimalsConverterHelper.adjustDecimals(value, nativeTokenDecimals, 18);
167
+ }
144
168
  }
@@ -5,9 +5,11 @@
5
5
  pragma solidity ^0.8.4;
6
6
 
7
7
  import "./AbsOutbox.sol";
8
+ import {IERC20Bridge} from "./IERC20Bridge.sol";
9
+ import {DecimalsConverterHelper} from "../libraries/DecimalsConverterHelper.sol";
8
10
 
9
11
  contract ERC20Outbox is AbsOutbox {
10
- // it is assumed that arb-os never assigns this value to a valid leaf to be redeemed
12
+ /// @dev it is assumed that arb-os never assigns this value to a valid leaf to be redeemed
11
13
  uint256 private constant AMOUNT_DEFAULT_CONTEXT = type(uint256).max;
12
14
 
13
15
  function l2ToL1WithdrawalAmount() external view returns (uint256) {
@@ -22,6 +24,13 @@ contract ERC20Outbox is AbsOutbox {
22
24
  return AMOUNT_DEFAULT_CONTEXT;
23
25
  }
24
26
 
27
+ /// @inheritdoc AbsOutbox
28
+ function _getAmountToUnlock(uint256 value) internal view override returns (uint256) {
29
+ uint8 nativeTokenDecimals = IERC20Bridge(address(bridge)).nativeTokenDecimals();
30
+ // this might revert due to overflow, but we assume the token supply is less than 2^256
31
+ return DecimalsConverterHelper.adjustDecimals(value, 18, nativeTokenDecimals);
32
+ }
33
+
25
34
  /// @inheritdoc AbsOutbox
26
35
  function _amountToSetInContext(uint256 value) internal pure override returns (uint256) {
27
36
  // native token withdrawal amount which can be fetched from context
@@ -19,6 +19,13 @@ interface IERC20Bridge is IBridge {
19
19
  */
20
20
  function nativeToken() external view returns (address);
21
21
 
22
+ /**
23
+ * @dev number of decimals used by the native token
24
+ * This is set on bridge initialization using nativeToken.decimals()
25
+ * If the token does not have decimals() method, we assume it have 0 decimals
26
+ */
27
+ function nativeTokenDecimals() external view returns (uint8);
28
+
22
29
  /**
23
30
  * @dev Enqueue a message in the delayed inbox accumulator.
24
31
  * These messages are later sequenced in the SequencerInbox, either
@@ -20,11 +20,12 @@ interface IERC20Inbox is IInboxBase {
20
20
  * @notice Put a message in the L2 inbox that can be reexecuted for some fixed amount of time if it reverts
21
21
  * @dev all tokenTotalFeeAmount will be deposited to callValueRefundAddress on L2
22
22
  * @dev Gas limit and maxFeePerGas should not be set to 1 as that is used to trigger the RetryableData error
23
+ * @dev In case of native token having non-18 decimals: tokenTotalFeeAmount is denominated in native token's decimals. All other value params - l2CallValue, maxSubmissionCost and maxFeePerGas are denominated in child chain's native 18 decimals.
23
24
  * @param to destination L2 contract address
24
25
  * @param l2CallValue call value for retryable L2 message
25
26
  * @param maxSubmissionCost Max gas deducted from user's L2 balance to cover base submission fee
26
- * @param excessFeeRefundAddress gasLimit x maxFeePerGas - execution cost gets credited here on L2 balance
27
- * @param callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled
27
+ * @param excessFeeRefundAddress the address which receives the difference between execution fee paid and the actual execution cost. In case this address is a contract, funds will be received in its alias on L2.
28
+ * @param callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled. In case this address is a contract, funds will be received in its alias on L2.
28
29
  * @param gasLimit Max gas deducted from user's L2 balance to cover L2 execution. Should not be set to 1 (magic value used to trigger the RetryableData error)
29
30
  * @param maxFeePerGas price bid for L2 execution. Should not be set to 1 (magic value used to trigger the RetryableData error)
30
31
  * @param tokenTotalFeeAmount amount of fees to be deposited in native token to cover for retryable ticket cost
@@ -53,7 +54,7 @@ interface IERC20Inbox is IInboxBase {
53
54
  * @param to destination L2 contract address
54
55
  * @param l2CallValue call value for retryable L2 message
55
56
  * @param maxSubmissionCost Max gas deducted from user's L2 balance to cover base submission fee
56
- * @param excessFeeRefundAddress gasLimit x maxFeePerGas - execution cost gets credited here on L2 balance
57
+ * @param excessFeeRefundAddress the address which receives the difference between execution fee paid and the actual execution cost
57
58
  * @param callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled
58
59
  * @param gasLimit Max gas deducted from user's L2 balance to cover L2 execution. Should not be set to 1 (magic value used to trigger the RetryableData error)
59
60
  * @param maxFeePerGas price bid for L2 execution. Should not be set to 1 (magic value used to trigger the RetryableData error)
@@ -77,8 +77,8 @@ interface IInbox is IInboxBase {
77
77
  * @param to destination L2 contract address
78
78
  * @param l2CallValue call value for retryable L2 message
79
79
  * @param maxSubmissionCost Max gas deducted from user's L2 balance to cover base submission fee
80
- * @param excessFeeRefundAddress gasLimit x maxFeePerGas - execution cost gets credited here on L2 balance
81
- * @param callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled
80
+ * @param excessFeeRefundAddress the address which receives the difference between execution fee paid and the actual execution cost. In case this address is a contract, funds will be received in its alias on L2.
81
+ * @param callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled. In case this address is a contract, funds will be received in its alias on L2.
82
82
  * @param gasLimit Max gas deducted from user's L2 balance to cover L2 execution. Should not be set to 1 (magic value used to trigger the RetryableData error)
83
83
  * @param maxFeePerGas price bid for L2 execution. Should not be set to 1 (magic value used to trigger the RetryableData error)
84
84
  * @param data ABI encoded data of L2 message
@@ -105,7 +105,7 @@ interface IInbox is IInboxBase {
105
105
  * @param to destination L2 contract address
106
106
  * @param l2CallValue call value for retryable L2 message
107
107
  * @param maxSubmissionCost Max gas deducted from user's L2 balance to cover base submission fee
108
- * @param excessFeeRefundAddress gasLimit x maxFeePerGas - execution cost gets credited here on L2 balance
108
+ * @param excessFeeRefundAddress the address which receives the difference between execution fee paid and the actual execution cost
109
109
  * @param callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled
110
110
  * @param gasLimit Max gas deducted from user's L2 balance to cover L2 execution. Should not be set to 1 (magic value used to trigger the RetryableData error)
111
111
  * @param maxFeePerGas price bid for L2 execution. Should not be set to 1 (magic value used to trigger the RetryableData error)
@@ -238,7 +238,7 @@ contract Inbox is AbsInbox, IInbox {
238
238
  * @param to destination L2 contract address
239
239
  * @param l2CallValue call value for retryable L2 message
240
240
  * @param maxSubmissionCost Max gas deducted from user's L2 balance to cover base submission fee
241
- * @param excessFeeRefundAddress gasLimit x maxFeePerGas - execution cost gets credited here on L2 balance
241
+ * @param excessFeeRefundAddress the address which receives the difference between execution fee paid and the actual execution cost
242
242
  * @param callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled
243
243
  * @param gasLimit Max gas deducted from user's L2 balance to cover L2 execution. Should not be set to 1 (magic value used to trigger the RetryableData error)
244
244
  * @param maxFeePerGas price bid for L2 execution. Should not be set to 1 (magic value used to trigger the RetryableData error)
@@ -343,4 +343,9 @@ contract Inbox is AbsInbox, IInbox {
343
343
  messageDataHash
344
344
  );
345
345
  }
346
+
347
+ /// @inheritdoc AbsInbox
348
+ function _fromNativeTo18Decimals(uint256 value) internal pure override returns (uint256) {
349
+ return value;
350
+ }
346
351
  }
@@ -14,6 +14,11 @@ contract Outbox is AbsOutbox {
14
14
  return 0;
15
15
  }
16
16
 
17
+ /// @inheritdoc AbsOutbox
18
+ function _getAmountToUnlock(uint256 value) internal pure override returns (uint256) {
19
+ return value;
20
+ }
21
+
17
22
  /// @inheritdoc AbsOutbox
18
23
  function _amountToSetInContext(uint256) internal pure override returns (uint256) {
19
24
  // In ETH-based chains withdrawal amount can be read from msg.value. For that reason