@arbitrum/nitro-contracts 2.0.0 → 3.0.0-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (503) hide show
  1. package/build/contracts/@openzeppelin/contracts/access/Ownable.sol/Ownable.dbg.json +1 -1
  2. package/build/contracts/@openzeppelin/contracts/interfaces/draft-IERC1822.sol/IERC1822Proxiable.dbg.json +1 -1
  3. package/build/contracts/@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol/ERC1967Proxy.dbg.json +1 -1
  4. package/build/contracts/@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol/ERC1967Proxy.json +2 -2
  5. package/build/contracts/@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol/ERC1967Upgrade.dbg.json +1 -1
  6. package/build/contracts/@openzeppelin/contracts/proxy/Proxy.sol/Proxy.dbg.json +1 -1
  7. package/build/contracts/@openzeppelin/contracts/proxy/beacon/IBeacon.sol/IBeacon.dbg.json +1 -1
  8. package/build/contracts/@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol/UpgradeableBeacon.dbg.json +1 -1
  9. package/build/contracts/@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol/UpgradeableBeacon.json +2 -2
  10. package/build/contracts/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol/ProxyAdmin.dbg.json +1 -1
  11. package/build/contracts/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol/ProxyAdmin.json +2 -2
  12. package/build/contracts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.dbg.json +1 -1
  13. package/build/contracts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.json +2 -2
  14. package/build/contracts/@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol/UUPSUpgradeable.dbg.json +1 -1
  15. package/build/contracts/@openzeppelin/contracts/security/ReentrancyGuard.sol/ReentrancyGuard.dbg.json +1 -1
  16. package/build/contracts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json +1 -1
  17. package/build/contracts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.json +2 -2
  18. package/build/contracts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json +1 -1
  19. package/build/contracts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json +1 -1
  20. package/build/contracts/@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol/IERC20Permit.dbg.json +4 -0
  21. package/build/contracts/@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol/IERC20Permit.json +86 -0
  22. package/build/contracts/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol/SafeERC20.dbg.json +1 -1
  23. package/build/contracts/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol/SafeERC20.json +2 -2
  24. package/build/contracts/@openzeppelin/contracts/utils/Address.sol/Address.dbg.json +1 -1
  25. package/build/contracts/@openzeppelin/contracts/utils/Address.sol/Address.json +2 -2
  26. package/build/contracts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json +1 -1
  27. package/build/contracts/@openzeppelin/contracts/utils/Create2.sol/Create2.dbg.json +4 -0
  28. package/build/contracts/@openzeppelin/contracts/utils/Create2.sol/Create2.json +10 -0
  29. package/build/contracts/@openzeppelin/contracts/utils/StorageSlot.sol/StorageSlot.dbg.json +1 -1
  30. package/build/contracts/@openzeppelin/contracts/utils/StorageSlot.sol/StorageSlot.json +2 -2
  31. package/build/contracts/@openzeppelin/contracts/utils/Strings.sol/Strings.dbg.json +1 -1
  32. package/build/contracts/@openzeppelin/contracts/utils/Strings.sol/Strings.json +2 -2
  33. package/build/contracts/@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol/AccessControlUpgradeable.dbg.json +1 -1
  34. package/build/contracts/@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol/AccessControlUpgradeable.json +13 -0
  35. package/build/contracts/@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol/IAccessControlUpgradeable.dbg.json +1 -1
  36. package/build/contracts/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol/OwnableUpgradeable.dbg.json +1 -1
  37. package/build/contracts/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol/OwnableUpgradeable.json +13 -0
  38. package/build/contracts/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol/Initializable.dbg.json +1 -1
  39. package/build/contracts/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol/Initializable.json +15 -1
  40. package/build/contracts/@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol/PausableUpgradeable.dbg.json +1 -1
  41. package/build/contracts/@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol/PausableUpgradeable.json +13 -0
  42. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol/AddressUpgradeable.dbg.json +1 -1
  43. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol/AddressUpgradeable.json +2 -2
  44. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol/ContextUpgradeable.dbg.json +1 -1
  45. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol/ContextUpgradeable.json +15 -1
  46. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/Create2Upgradeable.sol/Create2Upgradeable.dbg.json +4 -0
  47. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/Create2Upgradeable.sol/Create2Upgradeable.json +10 -0
  48. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol/StorageSlotUpgradeable.dbg.json +1 -1
  49. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol/StorageSlotUpgradeable.json +2 -2
  50. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol/StringsUpgradeable.dbg.json +1 -1
  51. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol/StringsUpgradeable.json +2 -2
  52. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol/ERC165Upgradeable.dbg.json +1 -1
  53. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol/ERC165Upgradeable.json +13 -0
  54. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol/IERC165Upgradeable.dbg.json +1 -1
  55. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol/EnumerableSetUpgradeable.dbg.json +4 -0
  56. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol/EnumerableSetUpgradeable.json +10 -0
  57. package/build/contracts/src/assertionStakingPool/AbsBoldStakingPool.sol/AbsBoldStakingPool.dbg.json +4 -0
  58. package/build/contracts/{@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol/IERC20Upgradeable.json → src/assertionStakingPool/AbsBoldStakingPool.sol/AbsBoldStakingPool.json} +41 -95
  59. package/build/contracts/src/assertionStakingPool/AssertionStakingPool.sol/AssertionStakingPool.dbg.json +4 -0
  60. package/build/contracts/src/assertionStakingPool/AssertionStakingPool.sol/AssertionStakingPool.json +340 -0
  61. package/build/contracts/src/assertionStakingPool/AssertionStakingPoolCreator.sol/AssertionStakingPoolCreator.dbg.json +4 -0
  62. package/build/contracts/src/assertionStakingPool/AssertionStakingPoolCreator.sol/AssertionStakingPoolCreator.json +89 -0
  63. package/build/contracts/src/assertionStakingPool/EdgeStakingPool.sol/EdgeStakingPool.dbg.json +4 -0
  64. package/build/contracts/src/assertionStakingPool/EdgeStakingPool.sol/EdgeStakingPool.json +248 -0
  65. package/build/contracts/src/assertionStakingPool/EdgeStakingPoolCreator.sol/EdgeStakingPoolCreator.dbg.json +4 -0
  66. package/build/contracts/src/assertionStakingPool/EdgeStakingPoolCreator.sol/EdgeStakingPoolCreator.json +83 -0
  67. package/build/contracts/src/assertionStakingPool/StakingPoolCreatorUtils.sol/StakingPoolCreatorUtils.dbg.json +4 -0
  68. package/build/contracts/src/assertionStakingPool/StakingPoolCreatorUtils.sol/StakingPoolCreatorUtils.json +16 -0
  69. package/build/contracts/src/assertionStakingPool/interfaces/IAbsBoldStakingPool.sol/IAbsBoldStakingPool.dbg.json +4 -0
  70. package/build/contracts/src/assertionStakingPool/interfaces/IAbsBoldStakingPool.sol/IAbsBoldStakingPool.json +140 -0
  71. package/build/contracts/src/assertionStakingPool/interfaces/IAssertionStakingPool.sol/IAssertionStakingPool.dbg.json +4 -0
  72. package/build/contracts/src/assertionStakingPool/interfaces/IAssertionStakingPool.sol/IAssertionStakingPool.json +324 -0
  73. package/build/contracts/src/assertionStakingPool/interfaces/IAssertionStakingPoolCreator.sol/IAssertionStakingPoolCreator.dbg.json +4 -0
  74. package/build/contracts/src/assertionStakingPool/interfaces/IAssertionStakingPoolCreator.sol/IAssertionStakingPoolCreator.json +84 -0
  75. package/build/contracts/src/assertionStakingPool/interfaces/IEdgeStakingPool.sol/IEdgeStakingPool.dbg.json +4 -0
  76. package/build/contracts/src/assertionStakingPool/interfaces/IEdgeStakingPool.sol/IEdgeStakingPool.json +232 -0
  77. package/build/contracts/src/assertionStakingPool/interfaces/IEdgeStakingPoolCreator.sol/IEdgeStakingPoolCreator.dbg.json +4 -0
  78. package/build/contracts/src/assertionStakingPool/interfaces/IEdgeStakingPoolCreator.sol/IEdgeStakingPoolCreator.json +78 -0
  79. package/build/contracts/src/bridge/AbsBridge.sol/AbsBridge.dbg.json +1 -1
  80. package/build/contracts/src/bridge/AbsBridge.sol/AbsBridge.json +13 -0
  81. package/build/contracts/src/bridge/AbsInbox.sol/AbsInbox.dbg.json +1 -1
  82. package/build/contracts/src/bridge/AbsInbox.sol/AbsInbox.json +20 -7
  83. package/build/contracts/src/bridge/AbsOutbox.sol/AbsOutbox.dbg.json +1 -1
  84. package/build/contracts/src/bridge/Bridge.sol/Bridge.dbg.json +1 -1
  85. package/build/contracts/src/bridge/Bridge.sol/Bridge.json +15 -2
  86. package/build/contracts/src/bridge/DelayBuffer.sol/DelayBuffer.dbg.json +4 -0
  87. package/build/contracts/src/bridge/DelayBuffer.sol/DelayBuffer.json +24 -0
  88. package/build/contracts/src/bridge/ERC20Bridge.sol/ERC20Bridge.dbg.json +1 -1
  89. package/build/contracts/src/bridge/ERC20Bridge.sol/ERC20Bridge.json +15 -2
  90. package/build/contracts/src/bridge/ERC20Inbox.sol/ERC20Inbox.dbg.json +1 -1
  91. package/build/contracts/src/bridge/ERC20Inbox.sol/ERC20Inbox.json +22 -9
  92. package/build/contracts/src/bridge/ERC20Outbox.sol/ERC20Outbox.dbg.json +1 -1
  93. package/build/contracts/src/bridge/ERC20Outbox.sol/ERC20Outbox.json +2 -2
  94. package/build/contracts/src/bridge/GasRefunder.sol/GasRefunder.dbg.json +1 -1
  95. package/build/contracts/src/bridge/GasRefunder.sol/GasRefunder.json +2 -2
  96. package/build/contracts/src/bridge/IBridge.sol/IBridge.dbg.json +1 -1
  97. package/build/contracts/src/bridge/IDelayedMessageProvider.sol/IDelayedMessageProvider.dbg.json +1 -1
  98. package/build/contracts/src/bridge/IERC20Bridge.sol/IERC20Bridge.dbg.json +1 -1
  99. package/build/contracts/src/bridge/IERC20Inbox.sol/IERC20Inbox.dbg.json +1 -1
  100. package/build/contracts/src/bridge/IERC20Inbox.sol/IERC20Inbox.json +1 -1
  101. package/build/contracts/src/bridge/IEthBridge.sol/IEthBridge.dbg.json +1 -1
  102. package/build/contracts/src/bridge/IInbox.sol/IInbox.dbg.json +1 -1
  103. package/build/contracts/src/bridge/IInbox.sol/IInbox.json +1 -1
  104. package/build/contracts/src/bridge/IInboxBase.sol/IInboxBase.dbg.json +1 -1
  105. package/build/contracts/src/bridge/IInboxBase.sol/IInboxBase.json +1 -1
  106. package/build/contracts/src/bridge/IOutbox.sol/IOutbox.dbg.json +1 -1
  107. package/build/contracts/src/bridge/IOwnable.sol/IOwnable.dbg.json +1 -1
  108. package/build/contracts/src/bridge/ISequencerInbox.sol/ISequencerInbox.dbg.json +1 -1
  109. package/build/contracts/src/bridge/ISequencerInbox.sol/ISequencerInbox.json +441 -0
  110. package/build/contracts/src/bridge/Inbox.sol/Inbox.dbg.json +1 -1
  111. package/build/contracts/src/bridge/Inbox.sol/Inbox.json +22 -4
  112. package/build/contracts/src/bridge/Messages.sol/Messages.dbg.json +1 -1
  113. package/build/contracts/src/bridge/Messages.sol/Messages.json +2 -2
  114. package/build/contracts/src/bridge/Outbox.sol/Outbox.dbg.json +1 -1
  115. package/build/contracts/src/bridge/Outbox.sol/Outbox.json +2 -2
  116. package/build/contracts/src/bridge/SequencerInbox.sol/SequencerInbox.dbg.json +1 -1
  117. package/build/contracts/src/bridge/SequencerInbox.sol/SequencerInbox.json +564 -7
  118. package/build/contracts/src/chain/CacheManager.sol/CacheManager.dbg.json +1 -1
  119. package/build/contracts/src/chain/CacheManager.sol/CacheManager.json +15 -2
  120. package/build/contracts/src/challengeV2/EdgeChallengeManager.sol/EdgeChallengeManager.dbg.json +4 -0
  121. package/build/contracts/src/challengeV2/EdgeChallengeManager.sol/EdgeChallengeManager.json +1631 -0
  122. package/build/contracts/src/challengeV2/EdgeChallengeManager.sol/IEdgeChallengeManager.dbg.json +4 -0
  123. package/build/contracts/src/challengeV2/EdgeChallengeManager.sol/IEdgeChallengeManager.json +762 -0
  124. package/build/contracts/src/challengeV2/IAssertionChain.sol/IAssertionChain.dbg.json +4 -0
  125. package/build/contracts/src/challengeV2/IAssertionChain.sol/IAssertionChain.json +247 -0
  126. package/build/contracts/src/challengeV2/libraries/ArrayUtilsLib.sol/ArrayUtilsLib.dbg.json +4 -0
  127. package/build/contracts/src/challengeV2/libraries/ArrayUtilsLib.sol/ArrayUtilsLib.json +10 -0
  128. package/build/contracts/src/challengeV2/libraries/ChallengeEdgeLib.sol/ChallengeEdgeLib.dbg.json +4 -0
  129. package/build/contracts/src/challengeV2/libraries/ChallengeEdgeLib.sol/ChallengeEdgeLib.json +10 -0
  130. package/build/contracts/src/challengeV2/libraries/EdgeChallengeManagerLib.sol/EdgeChallengeManagerLib.dbg.json +4 -0
  131. package/build/contracts/src/challengeV2/libraries/EdgeChallengeManagerLib.sol/EdgeChallengeManagerLib.json +24 -0
  132. package/build/contracts/src/challengeV2/libraries/MerkleTreeAccumulatorLib.sol/MerkleTreeAccumulatorLib.dbg.json +4 -0
  133. package/build/contracts/src/challengeV2/libraries/MerkleTreeAccumulatorLib.sol/MerkleTreeAccumulatorLib.json +24 -0
  134. package/build/contracts/src/challengeV2/libraries/UintUtilsLib.sol/UintUtilsLib.dbg.json +4 -0
  135. package/build/contracts/src/challengeV2/libraries/UintUtilsLib.sol/UintUtilsLib.json +10 -0
  136. package/build/contracts/src/libraries/AddressAliasHelper.sol/AddressAliasHelper.dbg.json +1 -1
  137. package/build/contracts/src/libraries/AddressAliasHelper.sol/AddressAliasHelper.json +2 -2
  138. package/build/contracts/src/libraries/AdminFallbackProxy.sol/AdminFallbackProxy.dbg.json +1 -1
  139. package/build/contracts/src/libraries/AdminFallbackProxy.sol/AdminFallbackProxy.json +2 -2
  140. package/build/contracts/src/libraries/AdminFallbackProxy.sol/DoubleLogicERC1967Upgrade.dbg.json +1 -1
  141. package/build/contracts/src/libraries/ArbitrumChecker.sol/ArbitrumChecker.dbg.json +1 -1
  142. package/build/contracts/src/libraries/ArbitrumChecker.sol/ArbitrumChecker.json +2 -2
  143. package/build/contracts/src/libraries/CryptographyPrimitives.sol/CryptographyPrimitives.dbg.json +1 -1
  144. package/build/contracts/src/libraries/CryptographyPrimitives.sol/CryptographyPrimitives.json +2 -2
  145. package/build/contracts/src/libraries/DecimalsConverterHelper.sol/DecimalsConverterHelper.dbg.json +1 -1
  146. package/build/contracts/src/libraries/DecimalsConverterHelper.sol/DecimalsConverterHelper.json +2 -2
  147. package/build/contracts/src/libraries/DelegateCallAware.sol/DelegateCallAware.dbg.json +1 -1
  148. package/build/contracts/src/libraries/DoubleLogicUUPSUpgradeable.sol/DoubleLogicUUPSUpgradeable.dbg.json +1 -1
  149. package/build/contracts/src/libraries/GasRefundEnabled.sol/GasRefundEnabled.dbg.json +1 -1
  150. package/build/contracts/src/libraries/IGasRefunder.sol/IGasRefunder.dbg.json +1 -1
  151. package/build/contracts/src/libraries/IReader4844.sol/IReader4844.dbg.json +1 -1
  152. package/build/contracts/src/libraries/MerkleLib.sol/MerkleLib.dbg.json +1 -1
  153. package/build/contracts/src/libraries/MerkleLib.sol/MerkleLib.json +2 -2
  154. package/build/contracts/src/libraries/UUPSNotUpgradeable.sol/UUPSNotUpgradeable.dbg.json +1 -1
  155. package/build/contracts/src/mocks/Benchmarks.sol/Benchmarks.dbg.json +1 -1
  156. package/build/contracts/src/mocks/Benchmarks.sol/Benchmarks.json +2 -2
  157. package/build/contracts/src/mocks/BridgeStub.sol/BridgeStub.dbg.json +1 -1
  158. package/build/contracts/src/mocks/BridgeStub.sol/BridgeStub.json +8 -8
  159. package/build/contracts/src/mocks/BridgeUnproxied.sol/BridgeUnproxied.dbg.json +1 -1
  160. package/build/contracts/src/mocks/BridgeUnproxied.sol/BridgeUnproxied.json +28 -2
  161. package/build/contracts/src/mocks/InboxStub.sol/InboxStub.dbg.json +1 -1
  162. package/build/contracts/src/mocks/InboxStub.sol/InboxStub.json +2 -2
  163. package/build/contracts/src/mocks/MerkleTreeAccess.sol/MerkleTreeAccess.dbg.json +4 -0
  164. package/build/contracts/src/mocks/MerkleTreeAccess.sol/MerkleTreeAccess.json +227 -0
  165. package/build/contracts/src/mocks/MockRollupEventInbox.sol/MockRollupEventInbox.dbg.json +4 -0
  166. package/build/contracts/src/mocks/MockRollupEventInbox.sol/MockRollupEventInbox.json +133 -0
  167. package/build/contracts/src/mocks/MultiCallTest.sol/MultiCallTest.dbg.json +1 -1
  168. package/build/contracts/src/mocks/MultiCallTest.sol/MultiCallTest.json +2 -2
  169. package/build/contracts/src/mocks/PendingBlkTimeAndNrAdvanceCheck.sol/PendingBlkTimeAndNrAdvanceCheck.dbg.json +1 -1
  170. package/build/contracts/src/mocks/PendingBlkTimeAndNrAdvanceCheck.sol/PendingBlkTimeAndNrAdvanceCheck.json +2 -2
  171. package/build/contracts/src/mocks/Program.sol/ProgramTest.dbg.json +1 -1
  172. package/build/contracts/src/mocks/Program.sol/ProgramTest.json +2 -2
  173. package/build/contracts/src/mocks/ProxyAdminForBinding.sol/ProxyAdminForBinding.dbg.json +1 -1
  174. package/build/contracts/src/mocks/ProxyAdminForBinding.sol/ProxyAdminForBinding.json +2 -2
  175. package/build/contracts/src/mocks/SdkStorage.sol/SdkStorage.dbg.json +1 -1
  176. package/build/contracts/src/mocks/SdkStorage.sol/SdkStorage.json +2 -2
  177. package/build/contracts/src/mocks/SequencerInboxBlobMock.sol/SequencerInboxBlobMock.dbg.json +4 -0
  178. package/build/contracts/src/mocks/SequencerInboxBlobMock.sol/SequencerInboxBlobMock.json +1632 -0
  179. package/build/contracts/src/mocks/SequencerInboxStub.sol/SequencerInboxStub.dbg.json +1 -1
  180. package/build/contracts/src/mocks/SequencerInboxStub.sol/SequencerInboxStub.json +564 -7
  181. package/build/contracts/src/mocks/Simple.sol/Simple.dbg.json +1 -1
  182. package/build/contracts/src/mocks/Simple.sol/Simple.json +2 -2
  183. package/build/contracts/src/mocks/SimpleCacheManager.sol/SimpleCacheManager.dbg.json +1 -1
  184. package/build/contracts/src/mocks/SimpleCacheManager.sol/SimpleCacheManager.json +2 -2
  185. package/build/contracts/src/mocks/SimpleOneStepProofEntry.sol/SimpleOneStepProofEntry.dbg.json +4 -0
  186. package/build/contracts/src/mocks/SimpleOneStepProofEntry.sol/SimpleOneStepProofEntry.json +142 -0
  187. package/build/contracts/src/mocks/SimpleProxy.sol/SimpleProxy.dbg.json +1 -1
  188. package/build/contracts/src/mocks/SimpleProxy.sol/SimpleProxy.json +2 -2
  189. package/build/contracts/src/mocks/TestWETH9.sol/IWETH9.dbg.json +4 -0
  190. package/build/contracts/src/mocks/TestWETH9.sol/IWETH9.json +31 -0
  191. package/build/contracts/src/mocks/TestWETH9.sol/TestWETH9.dbg.json +4 -0
  192. package/build/contracts/src/mocks/TestWETH9.sol/TestWETH9.json +317 -0
  193. package/build/contracts/src/mocks/UpgradeExecutorMock.sol/UpgradeExecutorMock.dbg.json +1 -1
  194. package/build/contracts/src/mocks/UpgradeExecutorMock.sol/UpgradeExecutorMock.json +15 -2
  195. package/build/contracts/src/node-interface/NodeInterface.sol/NodeInterface.dbg.json +1 -1
  196. package/build/contracts/src/node-interface/NodeInterfaceDebug.sol/NodeInterfaceDebug.dbg.json +1 -1
  197. package/build/contracts/src/osp/HashProofHelper.sol/HashProofHelper.dbg.json +1 -1
  198. package/build/contracts/src/osp/HashProofHelper.sol/HashProofHelper.json +2 -2
  199. package/build/contracts/src/osp/IOneStepProofEntry.sol/IOneStepProofEntry.dbg.json +1 -1
  200. package/build/contracts/src/osp/IOneStepProofEntry.sol/IOneStepProofEntry.json +33 -9
  201. package/build/contracts/src/osp/IOneStepProofEntry.sol/OneStepProofEntryLib.dbg.json +1 -1
  202. package/build/contracts/src/osp/IOneStepProofEntry.sol/OneStepProofEntryLib.json +2 -2
  203. package/build/contracts/src/osp/IOneStepProver.sol/IOneStepProver.dbg.json +1 -1
  204. package/build/contracts/src/osp/IOneStepProver.sol/IOneStepProver.json +5 -0
  205. package/build/contracts/src/osp/OneStepProofEntry.sol/OneStepProofEntry.dbg.json +1 -1
  206. package/build/contracts/src/osp/OneStepProofEntry.sol/OneStepProofEntry.json +35 -11
  207. package/build/contracts/src/osp/OneStepProver0.sol/OneStepProver0.dbg.json +1 -1
  208. package/build/contracts/src/osp/OneStepProver0.sol/OneStepProver0.json +7 -2
  209. package/build/contracts/src/osp/OneStepProverHostIo.sol/OneStepProverHostIo.dbg.json +1 -1
  210. package/build/contracts/src/osp/OneStepProverHostIo.sol/OneStepProverHostIo.json +7 -2
  211. package/build/contracts/src/osp/OneStepProverMath.sol/OneStepProverMath.dbg.json +1 -1
  212. package/build/contracts/src/osp/OneStepProverMath.sol/OneStepProverMath.json +7 -2
  213. package/build/contracts/src/osp/OneStepProverMemory.sol/OneStepProverMemory.dbg.json +1 -1
  214. package/build/contracts/src/osp/OneStepProverMemory.sol/OneStepProverMemory.json +7 -2
  215. package/build/contracts/src/precompiles/ArbAddressTable.sol/ArbAddressTable.dbg.json +1 -1
  216. package/build/contracts/src/precompiles/ArbAggregator.sol/ArbAggregator.dbg.json +1 -1
  217. package/build/contracts/src/precompiles/ArbBLS.sol/ArbBLS.dbg.json +1 -1
  218. package/build/contracts/src/precompiles/ArbDebug.sol/ArbDebug.dbg.json +1 -1
  219. package/build/contracts/src/precompiles/ArbFunctionTable.sol/ArbFunctionTable.dbg.json +1 -1
  220. package/build/contracts/src/precompiles/ArbGasInfo.sol/ArbGasInfo.dbg.json +1 -1
  221. package/build/contracts/src/precompiles/ArbInfo.sol/ArbInfo.dbg.json +1 -1
  222. package/build/contracts/src/precompiles/ArbOwner.sol/ArbOwner.dbg.json +1 -1
  223. package/build/contracts/src/precompiles/ArbOwnerPublic.sol/ArbOwnerPublic.dbg.json +1 -1
  224. package/build/contracts/src/precompiles/ArbRetryableTx.sol/ArbRetryableTx.dbg.json +1 -1
  225. package/build/contracts/src/precompiles/ArbStatistics.sol/ArbStatistics.dbg.json +1 -1
  226. package/build/contracts/src/precompiles/ArbSys.sol/ArbSys.dbg.json +1 -1
  227. package/build/contracts/src/precompiles/ArbWasm.sol/ArbWasm.dbg.json +1 -1
  228. package/build/contracts/src/precompiles/ArbWasmCache.sol/ArbWasmCache.dbg.json +1 -1
  229. package/build/contracts/src/precompiles/ArbosActs.sol/ArbosActs.dbg.json +1 -1
  230. package/build/contracts/src/precompiles/ArbosTest.sol/ArbosTest.dbg.json +1 -1
  231. package/build/contracts/src/rollup/AbsRollupEventInbox.sol/AbsRollupEventInbox.dbg.json +1 -1
  232. package/build/contracts/src/rollup/Assertion.sol/AssertionNodeLib.dbg.json +4 -0
  233. package/build/contracts/src/rollup/{Node.sol/NodeLib.json → Assertion.sol/AssertionNodeLib.json} +4 -4
  234. package/build/contracts/src/rollup/AssertionState.sol/AssertionStateLib.dbg.json +4 -0
  235. package/build/contracts/src/{challenge/ChallengeLib.sol/ChallengeLib.json → rollup/AssertionState.sol/AssertionStateLib.json} +4 -4
  236. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/BOLDUpgradeAction.dbg.json +4 -0
  237. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/BOLDUpgradeAction.json +807 -0
  238. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/ConstantArrayStorage.dbg.json +4 -0
  239. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/ConstantArrayStorage.json +35 -0
  240. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/IOldRollup.dbg.json +4 -0
  241. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/IOldRollup.json +361 -0
  242. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/IOldRollupAdmin.dbg.json +4 -0
  243. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/IOldRollupAdmin.json +38 -0
  244. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/ISeqInboxPostUpgradeInit.dbg.json +4 -0
  245. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/ISeqInboxPostUpgradeInit.json +41 -0
  246. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/RollupReader.dbg.json +4 -0
  247. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/RollupReader.json +385 -0
  248. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/StateHashPreImageLookup.dbg.json +4 -0
  249. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/StateHashPreImageLookup.json +203 -0
  250. package/build/contracts/src/rollup/BridgeCreator.sol/BridgeCreator.dbg.json +1 -1
  251. package/build/contracts/src/rollup/BridgeCreator.sol/BridgeCreator.json +62 -10
  252. package/build/contracts/src/rollup/DeployHelper.sol/DeployHelper.dbg.json +1 -1
  253. package/build/contracts/src/rollup/DeployHelper.sol/DeployHelper.json +2 -2
  254. package/build/contracts/src/rollup/ERC20RollupEventInbox.sol/ERC20RollupEventInbox.dbg.json +1 -1
  255. package/build/contracts/src/rollup/ERC20RollupEventInbox.sol/ERC20RollupEventInbox.json +2 -2
  256. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/FactoryDeployerHelper.dbg.json +1 -1
  257. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/FactoryDeployerHelper.json +2 -2
  258. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IDeployHelper.dbg.json +1 -1
  259. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IERC20.dbg.json +1 -1
  260. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IERC20Bridge.dbg.json +1 -1
  261. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IInboxBase.dbg.json +1 -1
  262. package/build/contracts/src/rollup/IRollupAdmin.sol/IRollupAdmin.dbg.json +1 -1
  263. package/build/contracts/src/rollup/IRollupAdmin.sol/IRollupAdmin.json +473 -99
  264. package/build/contracts/src/rollup/IRollupCore.sol/IRollupCore.dbg.json +1 -1
  265. package/build/contracts/src/rollup/IRollupCore.sol/IRollupCore.json +315 -221
  266. package/build/contracts/src/rollup/IRollupEventInbox.sol/IRollupEventInbox.dbg.json +1 -1
  267. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUser.dbg.json +1 -1
  268. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUser.json +678 -494
  269. package/build/contracts/src/rollup/RollupAdminLogic.sol/RollupAdminLogic.dbg.json +1 -1
  270. package/build/contracts/src/rollup/RollupAdminLogic.sol/RollupAdminLogic.json +806 -435
  271. package/build/contracts/src/rollup/RollupCore.sol/RollupCore.dbg.json +1 -1
  272. package/build/contracts/src/rollup/RollupCore.sol/RollupCore.json +323 -235
  273. package/build/contracts/src/rollup/RollupCreator.sol/RollupCreator.dbg.json +1 -1
  274. package/build/contracts/src/rollup/RollupCreator.sol/RollupCreator.json +98 -36
  275. package/build/contracts/src/rollup/RollupEventInbox.sol/RollupEventInbox.dbg.json +1 -1
  276. package/build/contracts/src/rollup/RollupEventInbox.sol/RollupEventInbox.json +2 -2
  277. package/build/contracts/src/rollup/RollupLib.sol/RollupLib.dbg.json +1 -1
  278. package/build/contracts/src/rollup/RollupLib.sol/RollupLib.json +2 -2
  279. package/build/contracts/src/rollup/RollupProxy.sol/RollupProxy.dbg.json +1 -1
  280. package/build/contracts/src/rollup/RollupProxy.sol/RollupProxy.json +97 -16
  281. package/build/contracts/src/rollup/RollupUserLogic.sol/RollupUserLogic.dbg.json +1 -1
  282. package/build/contracts/src/rollup/RollupUserLogic.sol/RollupUserLogic.json +924 -530
  283. package/build/contracts/src/rollup/ValidatorWallet.sol/ValidatorWallet.dbg.json +1 -1
  284. package/build/contracts/src/rollup/ValidatorWallet.sol/ValidatorWallet.json +15 -43
  285. package/build/contracts/src/rollup/ValidatorWalletCreator.sol/ValidatorWalletCreator.dbg.json +1 -1
  286. package/build/contracts/src/rollup/ValidatorWalletCreator.sol/ValidatorWalletCreator.json +2 -2
  287. package/build/contracts/src/state/Deserialize.sol/Deserialize.dbg.json +1 -1
  288. package/build/contracts/src/state/Deserialize.sol/Deserialize.json +2 -2
  289. package/build/contracts/src/state/GlobalState.sol/GlobalStateLib.dbg.json +1 -1
  290. package/build/contracts/src/state/GlobalState.sol/GlobalStateLib.json +2 -2
  291. package/build/contracts/src/state/Instructions.sol/Instructions.dbg.json +1 -1
  292. package/build/contracts/src/state/Instructions.sol/Instructions.json +2 -2
  293. package/build/contracts/src/state/Machine.sol/MachineLib.dbg.json +1 -1
  294. package/build/contracts/src/state/Machine.sol/MachineLib.json +2 -2
  295. package/build/contracts/src/state/MerkleProof.sol/MerkleProofLib.dbg.json +1 -1
  296. package/build/contracts/src/state/MerkleProof.sol/MerkleProofLib.json +2 -2
  297. package/build/contracts/src/state/Module.sol/ModuleLib.dbg.json +1 -1
  298. package/build/contracts/src/state/Module.sol/ModuleLib.json +2 -2
  299. package/build/contracts/src/state/ModuleMemory.sol/ModuleMemoryLib.dbg.json +1 -1
  300. package/build/contracts/src/state/ModuleMemory.sol/ModuleMemoryLib.json +2 -2
  301. package/build/contracts/src/state/ModuleMemoryCompact.sol/ModuleMemoryCompactLib.dbg.json +1 -1
  302. package/build/contracts/src/state/ModuleMemoryCompact.sol/ModuleMemoryCompactLib.json +2 -2
  303. package/build/contracts/src/state/MultiStack.sol/MultiStackLib.dbg.json +1 -1
  304. package/build/contracts/src/state/MultiStack.sol/MultiStackLib.json +2 -2
  305. package/build/contracts/src/state/PcArray.sol/PcArrayLib.dbg.json +1 -1
  306. package/build/contracts/src/state/PcArray.sol/PcArrayLib.json +2 -2
  307. package/build/contracts/src/state/StackFrame.sol/StackFrameLib.dbg.json +1 -1
  308. package/build/contracts/src/state/StackFrame.sol/StackFrameLib.json +2 -2
  309. package/build/contracts/src/state/Value.sol/ValueLib.dbg.json +1 -1
  310. package/build/contracts/src/state/Value.sol/ValueLib.json +2 -2
  311. package/build/contracts/src/state/ValueArray.sol/ValueArrayLib.dbg.json +1 -1
  312. package/build/contracts/src/state/ValueArray.sol/ValueArrayLib.json +2 -2
  313. package/build/contracts/src/state/ValueStack.sol/ValueStackLib.dbg.json +1 -1
  314. package/build/contracts/src/state/ValueStack.sol/ValueStackLib.json +2 -2
  315. package/build/contracts/src/test-helpers/BridgeTester.sol/BridgeTester.dbg.json +1 -1
  316. package/build/contracts/src/test-helpers/BridgeTester.sol/BridgeTester.json +15 -2
  317. package/build/contracts/src/test-helpers/CryptographyPrimitivesTester.sol/CryptographyPrimitivesTester.dbg.json +1 -1
  318. package/build/contracts/src/test-helpers/CryptographyPrimitivesTester.sol/CryptographyPrimitivesTester.json +2 -2
  319. package/build/contracts/src/test-helpers/EthVault.sol/EthVault.dbg.json +1 -1
  320. package/build/contracts/src/test-helpers/EthVault.sol/EthVault.json +2 -2
  321. package/build/contracts/src/test-helpers/MessageTester.sol/MessageTester.dbg.json +1 -1
  322. package/build/contracts/src/test-helpers/MessageTester.sol/MessageTester.json +2 -2
  323. package/build/contracts/src/test-helpers/OutboxWithoutOptTester.sol/OutboxWithoutOptTester.dbg.json +1 -1
  324. package/build/contracts/src/test-helpers/OutboxWithoutOptTester.sol/OutboxWithoutOptTester.json +2 -2
  325. package/build/contracts/src/test-helpers/RollupMock.sol/RollupMock.dbg.json +1 -1
  326. package/build/contracts/src/test-helpers/RollupMock.sol/RollupMock.json +2 -15
  327. package/build/contracts/src/test-helpers/TestToken.sol/TestToken.dbg.json +1 -1
  328. package/build/contracts/src/test-helpers/TestToken.sol/TestToken.json +2 -2
  329. package/build/contracts/src/test-helpers/ValueArrayTester.sol/ValueArrayTester.dbg.json +1 -1
  330. package/build/contracts/src/test-helpers/ValueArrayTester.sol/ValueArrayTester.json +2 -2
  331. package/out/yul/Reader4844.yul/Reader4844.json +1 -1
  332. package/package.json +16 -6
  333. package/src/assertionStakingPool/AbsBoldStakingPool.sol +66 -0
  334. package/src/assertionStakingPool/AssertionStakingPool.sol +70 -0
  335. package/src/assertionStakingPool/AssertionStakingPoolCreator.sol +35 -0
  336. package/src/assertionStakingPool/EdgeStakingPool.sol +57 -0
  337. package/src/assertionStakingPool/EdgeStakingPoolCreator.sol +34 -0
  338. package/src/assertionStakingPool/StakingPoolCreatorUtils.sol +25 -0
  339. package/src/assertionStakingPool/interfaces/IAbsBoldStakingPool.sol +41 -0
  340. package/src/assertionStakingPool/interfaces/IAssertionStakingPool.sol +36 -0
  341. package/src/assertionStakingPool/interfaces/IAssertionStakingPoolCreator.sol +31 -0
  342. package/src/assertionStakingPool/interfaces/IEdgeStakingPool.sol +27 -0
  343. package/src/assertionStakingPool/interfaces/IEdgeStakingPoolCreator.sol +28 -0
  344. package/src/bridge/AbsBridge.sol +38 -48
  345. package/src/bridge/AbsInbox.sol +88 -97
  346. package/src/bridge/AbsOutbox.sol +23 -37
  347. package/src/bridge/Bridge.sol +6 -4
  348. package/src/bridge/DelayBuffer.sol +123 -0
  349. package/src/bridge/DelayBufferTypes.sol +38 -0
  350. package/src/bridge/ERC20Bridge.sol +8 -4
  351. package/src/bridge/ERC20Inbox.sol +46 -53
  352. package/src/bridge/ERC20Outbox.sol +7 -3
  353. package/src/bridge/GasRefunder.sol +38 -24
  354. package/src/bridge/IBridge.sol +30 -21
  355. package/src/bridge/IERC20Bridge.sol +1 -1
  356. package/src/bridge/IERC20Inbox.sol +4 -2
  357. package/src/bridge/IEthBridge.sol +4 -2
  358. package/src/bridge/IInbox.sol +4 -2
  359. package/src/bridge/IInboxBase.sol +17 -13
  360. package/src/bridge/IOutbox.sol +13 -8
  361. package/src/bridge/ISequencerInbox.sol +118 -13
  362. package/src/bridge/Inbox.sol +131 -151
  363. package/src/bridge/Messages.sol +48 -18
  364. package/src/bridge/Outbox.sol +6 -2
  365. package/src/bridge/SequencerInbox.sol +339 -274
  366. package/src/chain/CacheManager.sol +49 -18
  367. package/src/challengeV2/EdgeChallengeManager.sol +783 -0
  368. package/src/challengeV2/IAssertionChain.sol +39 -0
  369. package/src/challengeV2/libraries/ArrayUtilsLib.sol +61 -0
  370. package/src/challengeV2/libraries/ChallengeEdgeLib.sol +333 -0
  371. package/src/challengeV2/libraries/ChallengeErrors.sol +108 -0
  372. package/src/challengeV2/libraries/EdgeChallengeManagerLib.sol +930 -0
  373. package/src/challengeV2/libraries/Enums.sol +26 -0
  374. package/src/challengeV2/libraries/MerkleTreeAccumulatorLib.sol +390 -0
  375. package/src/challengeV2/libraries/UintUtilsLib.sol +74 -0
  376. package/src/libraries/AddressAliasHelper.sol +6 -2
  377. package/src/libraries/AdminFallbackProxy.sol +8 -4
  378. package/src/libraries/ArbitrumChecker.sol +3 -4
  379. package/src/libraries/CryptographyPrimitives.sol +39 -46
  380. package/src/libraries/DecimalsConverterHelper.sol +2 -4
  381. package/src/libraries/DoubleLogicUUPSUpgradeable.sol +10 -7
  382. package/src/libraries/Error.sol +18 -12
  383. package/src/libraries/GasRefundEnabled.sol +3 -4
  384. package/src/libraries/MerkleLib.sol +6 -5
  385. package/src/libraries/UUPSNotUpgradeable.sol +2 -4
  386. package/src/mocks/BridgeStub.sol +50 -48
  387. package/src/mocks/BridgeUnproxied.sol +2 -0
  388. package/src/mocks/InboxStub.sol +22 -17
  389. package/src/mocks/MerkleTreeAccess.sol +72 -0
  390. package/src/mocks/MockRollupEventInbox.sol +59 -0
  391. package/src/mocks/MultiCallTest.sol +3 -1
  392. package/src/mocks/PendingBlkTimeAndNrAdvanceCheck.sol +3 -1
  393. package/src/mocks/Program.sol +9 -7
  394. package/src/mocks/SequencerInboxBlobMock.sol +38 -0
  395. package/src/mocks/SequencerInboxStub.sol +9 -12
  396. package/src/mocks/Simple.sol +13 -25
  397. package/src/mocks/SimpleCacheManager.sol +10 -3
  398. package/src/mocks/SimpleOneStepProofEntry.sol +60 -0
  399. package/src/mocks/SimpleProxy.sol +3 -1
  400. package/src/mocks/TestWETH9.sol +30 -0
  401. package/src/mocks/UpgradeExecutorMock.sol +10 -17
  402. package/src/node-interface/NodeInterface.sol +23 -22
  403. package/src/node-interface/NodeInterfaceDebug.sol +5 -3
  404. package/src/osp/HashProofHelper.sol +9 -10
  405. package/src/osp/IOneStepProofEntry.sol +14 -9
  406. package/src/osp/IOneStepProver.sol +1 -0
  407. package/src/osp/OneStepProofEntry.sol +63 -54
  408. package/src/osp/OneStepProver0.sol +14 -27
  409. package/src/osp/OneStepProverHostIo.sol +31 -58
  410. package/src/osp/OneStepProverMath.sol +15 -23
  411. package/src/osp/OneStepProverMemory.sol +9 -23
  412. package/src/precompiles/ArbAddressTable.sol +19 -9
  413. package/src/precompiles/ArbAggregator.sol +12 -4
  414. package/src/precompiles/ArbBLS.sol +1 -3
  415. package/src/precompiles/ArbDebug.sol +5 -11
  416. package/src/precompiles/ArbFunctionTable.sol +7 -10
  417. package/src/precompiles/ArbGasInfo.sol +9 -43
  418. package/src/precompiles/ArbInfo.sol +6 -2
  419. package/src/precompiles/ArbOwner.sol +101 -34
  420. package/src/precompiles/ArbOwnerPublic.sol +6 -2
  421. package/src/precompiles/ArbRetryableTx.sol +15 -5
  422. package/src/precompiles/ArbStatistics.sol +1 -8
  423. package/src/precompiles/ArbSys.sol +16 -18
  424. package/src/precompiles/ArbWasm.sol +24 -14
  425. package/src/precompiles/ArbWasmCache.sol +15 -5
  426. package/src/precompiles/ArbosTest.sol +3 -1
  427. package/src/rollup/AbsRollupEventInbox.sol +15 -16
  428. package/src/rollup/Assertion.sol +100 -0
  429. package/src/rollup/AssertionState.sol +29 -0
  430. package/src/rollup/BOLDUpgradeAction.sol +631 -0
  431. package/src/rollup/BridgeCreator.sol +42 -15
  432. package/src/rollup/Config.sol +15 -7
  433. package/src/rollup/DeployHelper.sol +12 -31
  434. package/src/rollup/ERC20RollupEventInbox.sol +8 -9
  435. package/src/rollup/FactoryDeployerHelper.sol +8 -10
  436. package/src/rollup/IRollupAdmin.sol +127 -45
  437. package/src/rollup/IRollupCore.sol +64 -84
  438. package/src/rollup/IRollupEventInbox.sol +3 -1
  439. package/src/rollup/IRollupLogic.sol +36 -69
  440. package/src/rollup/RollupAdminLogic.sol +224 -203
  441. package/src/rollup/RollupCore.sol +407 -428
  442. package/src/rollup/RollupCreator.sol +88 -75
  443. package/src/rollup/RollupEventInbox.sol +7 -7
  444. package/src/rollup/RollupLib.sol +50 -86
  445. package/src/rollup/RollupProxy.sol +8 -12
  446. package/src/rollup/RollupUserLogic.sol +279 -642
  447. package/src/rollup/ValidatorUtils.sol +0 -242
  448. package/src/rollup/ValidatorWallet.sol +22 -38
  449. package/src/rollup/ValidatorWalletCreator.sol +8 -8
  450. package/src/state/Deserialize.sol +74 -96
  451. package/src/state/GlobalState.sol +74 -20
  452. package/src/state/Instructions.sol +4 -3
  453. package/src/state/Machine.sol +18 -19
  454. package/src/state/Module.sol +14 -13
  455. package/src/state/ModuleMemory.sol +6 -25
  456. package/src/state/ModuleMemoryCompact.sol +3 -1
  457. package/src/state/MultiStack.sol +16 -20
  458. package/src/state/PcArray.sol +7 -7
  459. package/src/state/StackFrame.sol +21 -14
  460. package/src/state/Value.sol +18 -6
  461. package/src/state/ValueArray.sol +7 -7
  462. package/src/state/ValueStack.sol +9 -3
  463. package/src/test-helpers/BridgeTester.sol +32 -42
  464. package/src/test-helpers/CryptographyPrimitivesTester.sol +12 -13
  465. package/src/test-helpers/EthVault.sol +4 -2
  466. package/src/test-helpers/InterfaceCompatibilityTester.sol +1 -1
  467. package/src/test-helpers/MessageTester.sol +3 -10
  468. package/src/test-helpers/OutboxWithoutOptTester.sol +12 -19
  469. package/src/test-helpers/RollupMock.sol +3 -7
  470. package/src/test-helpers/TestToken.sol +4 -2
  471. package/build/contracts/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol/IERC20Upgradeable.dbg.json +0 -4
  472. package/build/contracts/src/challenge/ChallengeLib.sol/ChallengeLib.dbg.json +0 -4
  473. package/build/contracts/src/challenge/ChallengeManager.sol/ChallengeManager.dbg.json +0 -4
  474. package/build/contracts/src/challenge/ChallengeManager.sol/ChallengeManager.json +0 -746
  475. package/build/contracts/src/challenge/IChallengeManager.sol/IChallengeManager.dbg.json +0 -4
  476. package/build/contracts/src/challenge/IChallengeManager.sol/IChallengeManager.json +0 -441
  477. package/build/contracts/src/challenge/IChallengeResultReceiver.sol/IChallengeResultReceiver.dbg.json +0 -4
  478. package/build/contracts/src/challenge/IChallengeResultReceiver.sol/IChallengeResultReceiver.json +0 -34
  479. package/build/contracts/src/mocks/MockResultReceiver.sol/MockResultReceiver.dbg.json +0 -4
  480. package/build/contracts/src/mocks/MockResultReceiver.sol/MockResultReceiver.json +0 -188
  481. package/build/contracts/src/mocks/SingleExecutionChallenge.sol/SingleExecutionChallenge.dbg.json +0 -4
  482. package/build/contracts/src/mocks/SingleExecutionChallenge.sol/SingleExecutionChallenge.json +0 -797
  483. package/build/contracts/src/mocks/TimedOutChallengeManager.sol/TimedOutChallengeManager.dbg.json +0 -4
  484. package/build/contracts/src/mocks/TimedOutChallengeManager.sol/TimedOutChallengeManager.json +0 -746
  485. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUserAbs.dbg.json +0 -4
  486. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUserAbs.json +0 -1327
  487. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUserERC20.dbg.json +0 -4
  488. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUserERC20.json +0 -1461
  489. package/build/contracts/src/rollup/Node.sol/NodeLib.dbg.json +0 -4
  490. package/build/contracts/src/rollup/RollupUserLogic.sol/AbsRollupUserLogic.dbg.json +0 -4
  491. package/build/contracts/src/rollup/RollupUserLogic.sol/AbsRollupUserLogic.json +0 -1609
  492. package/build/contracts/src/rollup/RollupUserLogic.sol/ERC20RollupUserLogic.dbg.json +0 -4
  493. package/build/contracts/src/rollup/RollupUserLogic.sol/ERC20RollupUserLogic.json +0 -1743
  494. package/build/contracts/src/rollup/ValidatorUtils.sol/ValidatorUtils.dbg.json +0 -4
  495. package/build/contracts/src/rollup/ValidatorUtils.sol/ValidatorUtils.json +0 -379
  496. package/src/challenge/ChallengeLib.sol +0 -88
  497. package/src/challenge/ChallengeManager.sol +0 -375
  498. package/src/challenge/IChallengeManager.sol +0 -86
  499. package/src/challenge/IChallengeResultReceiver.sol +0 -13
  500. package/src/mocks/MockResultReceiver.sol +0 -59
  501. package/src/mocks/SingleExecutionChallenge.sol +0 -41
  502. package/src/mocks/TimedOutChallengeManager.sol +0 -13
  503. package/src/rollup/Node.sol +0 -113
@@ -0,0 +1,783 @@
1
+ // Copyright 2023, Offchain Labs, Inc.
2
+ // For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE
3
+ // SPDX-License-Identifier: BUSL-1.1
4
+ //
5
+ pragma solidity ^0.8.17;
6
+
7
+ import "../rollup/Assertion.sol";
8
+ import "./libraries/UintUtilsLib.sol";
9
+ import "./IAssertionChain.sol";
10
+ import "./libraries/EdgeChallengeManagerLib.sol";
11
+ import "../libraries/Constants.sol";
12
+ import "../state/Machine.sol";
13
+
14
+ import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
15
+ import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
16
+
17
+ /// @title EdgeChallengeManager interface
18
+ interface IEdgeChallengeManager {
19
+ /// @notice Initialize the EdgeChallengeManager. EdgeChallengeManagers are upgradeable
20
+ /// so use the initializer paradigm
21
+ /// @param _assertionChain The assertion chain contract
22
+ /// @param _challengePeriodBlocks The amount of cumulative time an edge must spend unrivaled before it can be confirmed
23
+ /// This should be the censorship period + the cumulative amount of time needed to do any
24
+ /// offchain calculation. We currently estimate around 10 mins for each layer zero edge and 1
25
+ /// one minute for each other edge.
26
+ /// @param _oneStepProofEntry The one step proof logic
27
+ /// @param layerZeroBlockEdgeHeight The end height of layer zero edges of type Block
28
+ /// @param layerZeroBigStepEdgeHeight The end height of layer zero edges of type BigStep
29
+ /// @param layerZeroSmallStepEdgeHeight The end height of layer zero edges of type SmallStep
30
+ /// @param _stakeToken The token that stake will be provided in when creating zero layer block edges
31
+ /// @param _excessStakeReceiver The address that excess stake will be sent to when 2nd+ block edge is created
32
+ /// @param _numBigStepLevel The number of bigstep levels
33
+ /// @param _stakeAmounts The stake amount for each level. (first element is for block level)
34
+ function initialize(
35
+ IAssertionChain _assertionChain,
36
+ uint64 _challengePeriodBlocks,
37
+ IOneStepProofEntry _oneStepProofEntry,
38
+ uint256 layerZeroBlockEdgeHeight,
39
+ uint256 layerZeroBigStepEdgeHeight,
40
+ uint256 layerZeroSmallStepEdgeHeight,
41
+ IERC20 _stakeToken,
42
+ address _excessStakeReceiver,
43
+ uint8 _numBigStepLevel,
44
+ uint256[] calldata _stakeAmounts
45
+ ) external;
46
+
47
+ function challengePeriodBlocks() external view returns (uint64);
48
+
49
+ /// @notice The one step proof resolver used to decide between rival SmallStep edges of length 1
50
+ function oneStepProofEntry() external view returns (IOneStepProofEntry);
51
+
52
+ /// @notice Performs necessary checks and creates a new layer zero edge
53
+ /// @param args Edge creation args
54
+ function createLayerZeroEdge(
55
+ CreateEdgeArgs calldata args
56
+ ) external returns (bytes32);
57
+
58
+ /// @notice Bisect an edge. This creates two child edges:
59
+ /// lowerChild: has the same start root and height as this edge, but a different end root and height
60
+ /// upperChild: has the same end root and height as this edge, but a different start root and height
61
+ /// The lower child end root and height are equal to the upper child start root and height. This height
62
+ /// is the mandatoryBisectionHeight.
63
+ /// The lower child may already exist, however it's not possible for the upper child to exist as that would
64
+ /// mean that the edge has already been bisected
65
+ /// @param edgeId Edge to bisect
66
+ /// @param bisectionHistoryRoot The new history root to be used in the lower and upper children
67
+ /// @param prefixProof A proof to show that the bisectionHistoryRoot commits to a prefix of the current endHistoryRoot
68
+ /// @return lowerChildId The id of the newly created lower child edge
69
+ /// @return upperChildId The id of the newly created upper child edge
70
+ function bisectEdge(
71
+ bytes32 edgeId,
72
+ bytes32 bisectionHistoryRoot,
73
+ bytes calldata prefixProof
74
+ ) external returns (bytes32, bytes32);
75
+
76
+ /// @notice An edge can be confirmed if the total amount of time it and a single chain of its direct ancestors
77
+ /// has spent unrivaled is greater than the challenge period.
78
+ /// @dev Edges inherit time from their parents, so the sum of unrivaled timers is compared against the threshold.
79
+ /// Given that an edge cannot become unrivaled after becoming rivaled, once the threshold is passed
80
+ /// it will always remain passed. The direct ancestors of an edge are linked by parent-child links for edges
81
+ /// of the same level, and claimId-edgeId links for zero layer edges that claim an edge in the level below.
82
+ /// This method also includes the amount of time the assertion being claimed spent without a sibling
83
+ /// @param edgeId The id of the edge to confirm
84
+ function confirmEdgeByTime(
85
+ bytes32 edgeId,
86
+ AssertionStateData calldata claimStateData
87
+ ) external;
88
+
89
+ /// @notice Update multiple edges' timer cache by their children. Equivalent to calling updateTimerCacheByChildren for each edge.
90
+ /// May update timer cache above maximum if the last edge's timer cache was below maximumCachedTime.
91
+ /// Revert when the last edge's timer cache is already equal to or above maximumCachedTime.
92
+ /// @param edgeIds The ids of the edges to update
93
+ /// @param maximumCachedTime The maximum amount of cached time allowed on the last edge (β∗)
94
+ function multiUpdateTimeCacheByChildren(
95
+ bytes32[] calldata edgeIds,
96
+ uint256 maximumCachedTime
97
+ ) external;
98
+
99
+ /// @notice Update an edge's timer cache by its children.
100
+ /// Sets the edge's timer cache to its timeUnrivaled + (minimum timer cache of its children).
101
+ /// May update timer cache above maximum if the last edge's timer cache was below maximumCachedTime.
102
+ /// Revert when the edge's timer cache is already equal to or above maximumCachedTime.
103
+ /// @param edgeId The id of the edge to update
104
+ /// @param maximumCachedTime The maximum amount of cached time allowed on the edge (β∗)
105
+ function updateTimerCacheByChildren(bytes32 edgeId, uint256 maximumCachedTime) external;
106
+
107
+ /// @notice Given a one step fork edge and an edge with matching claim id,
108
+ /// set the one step fork edge's timer cache to its timeUnrivaled + claiming edge's timer cache.
109
+ /// May update timer cache above maximum if the last edge's timer cache was below maximumCachedTime.
110
+ /// Revert when the edge's timer cache is already equal to or above maximumCachedTime.
111
+ /// @param edgeId The id of the edge to update
112
+ /// @param claimingEdgeId The id of the edge which has a claimId equal to edgeId
113
+ /// @param maximumCachedTime The maximum amount of cached time allowed on the edge (β∗)
114
+ function updateTimerCacheByClaim(
115
+ bytes32 edgeId,
116
+ bytes32 claimingEdgeId,
117
+ uint256 maximumCachedTime
118
+ ) external;
119
+
120
+ /// @notice Confirm an edge by executing a one step proof
121
+ /// @dev One step proofs can only be executed against edges that have length one and of type SmallStep
122
+ /// @param edgeId The id of the edge to confirm
123
+ /// @param oneStepData Input data to the one step proof
124
+ /// @param prevConfig Data about the config set in prev
125
+ /// @param beforeHistoryInclusionProof Proof that the state which is the start of the edge is committed to by the startHistoryRoot
126
+ /// @param afterHistoryInclusionProof Proof that the state which is the end of the edge is committed to by the endHistoryRoot
127
+ function confirmEdgeByOneStepProof(
128
+ bytes32 edgeId,
129
+ OneStepData calldata oneStepData,
130
+ ConfigData calldata prevConfig,
131
+ bytes32[] calldata beforeHistoryInclusionProof,
132
+ bytes32[] calldata afterHistoryInclusionProof
133
+ ) external;
134
+
135
+ /// @notice When zero layer block edges are created a stake is also provided
136
+ /// The stake on this edge can be refunded if the edge is confirme
137
+ function refundStake(
138
+ bytes32 edgeId
139
+ ) external;
140
+
141
+ /// @notice Zero layer edges have to be a fixed height.
142
+ /// This function returns the end height for a given edge type
143
+ function getLayerZeroEndHeight(
144
+ EdgeType eType
145
+ ) external view returns (uint256);
146
+
147
+ /// @notice Calculate the unique id of an edge
148
+ /// @param level The level of the edge
149
+ /// @param originId The origin id of the edge
150
+ /// @param startHeight The start height of the edge
151
+ /// @param startHistoryRoot The start history root of the edge
152
+ /// @param endHeight The end height of the edge
153
+ /// @param endHistoryRoot The end history root of the edge
154
+ function calculateEdgeId(
155
+ uint8 level,
156
+ bytes32 originId,
157
+ uint256 startHeight,
158
+ bytes32 startHistoryRoot,
159
+ uint256 endHeight,
160
+ bytes32 endHistoryRoot
161
+ ) external pure returns (bytes32);
162
+
163
+ /// @notice Calculate the mutual id of the edge
164
+ /// Edges that are rivals share the same mutual id
165
+ /// @param level The level of the edge
166
+ /// @param originId The origin id of the edge
167
+ /// @param startHeight The start height of the edge
168
+ /// @param startHistoryRoot The start history root of the edge
169
+ /// @param endHeight The end height of the edge
170
+ function calculateMutualId(
171
+ uint8 level,
172
+ bytes32 originId,
173
+ uint256 startHeight,
174
+ bytes32 startHistoryRoot,
175
+ uint256 endHeight
176
+ ) external pure returns (bytes32);
177
+
178
+ /// @notice Has the edge already been stored in the manager
179
+ function edgeExists(
180
+ bytes32 edgeId
181
+ ) external view returns (bool);
182
+
183
+ /// @notice Get full edge data for an edge
184
+ function getEdge(
185
+ bytes32 edgeId
186
+ ) external view returns (ChallengeEdge memory);
187
+
188
+ /// @notice The length of the edge, from start height to end height
189
+ function edgeLength(
190
+ bytes32 edgeId
191
+ ) external view returns (uint256);
192
+
193
+ /// @notice Does this edge currently have one or more rivals
194
+ /// Rival edges share the same mutual id
195
+ function hasRival(
196
+ bytes32 edgeId
197
+ ) external view returns (bool);
198
+
199
+ /// @notice The confirmed rival of this mutual id
200
+ /// Returns 0 if one does not exist
201
+ function confirmedRival(
202
+ bytes32 mutualId
203
+ ) external view returns (bytes32);
204
+
205
+ /// @notice Does the edge have at least one rival, and it has length one
206
+ function hasLengthOneRival(
207
+ bytes32 edgeId
208
+ ) external view returns (bool);
209
+
210
+ /// @notice The amount of time this edge has spent without rivals
211
+ /// This value is increasing whilst an edge is unrivaled, once a rival is created
212
+ /// it is fixed. If an edge has rivals from the moment it is created then it will have
213
+ /// a zero time unrivaled
214
+ function timeUnrivaled(
215
+ bytes32 edgeId
216
+ ) external view returns (uint256);
217
+
218
+ /// @notice Get the id of the prev assertion that this edge is originates from
219
+ /// @dev Uses the parent chain to traverse upwards SmallStep->BigStep->Block->Assertion
220
+ /// until it gets to the origin assertion
221
+ function getPrevAssertionHash(
222
+ bytes32 edgeId
223
+ ) external view returns (bytes32);
224
+
225
+ /// @notice Fetch the raw first rival record for the given mutual id
226
+ /// @dev Returns 0 if there is no edge with the given mutual id
227
+ /// Returns a magic value if there is one edge but it is unrivaled
228
+ /// Returns the id of the second edge created with the mutual id, if > 1 exists
229
+ function firstRival(
230
+ bytes32 mutualId
231
+ ) external view returns (bytes32);
232
+
233
+ /// @notice True if an account has made a layer zero edge with the given mutual id.
234
+ /// This is only tracked when the validator whitelist is enabled
235
+ function hasMadeLayerZeroRival(
236
+ address account,
237
+ bytes32 mutualId
238
+ ) external view returns (bool);
239
+ }
240
+
241
+ /// @title A challenge manager that uses edge structures to decide between Assertions
242
+ /// @notice When two assertions are created that have the same predecessor the protocol needs to decide which of the two is correct
243
+ /// This challenge manager allows the staker who has created the valid assertion to enforce that it will be confirmed, and all
244
+ /// other rival assertions will be rejected. The challenge is all-vs-all in that all assertions with the same
245
+ /// predecessor will vie for succession against each other. Stakers compete by creating edges that reference the assertion they
246
+ /// believe in. These edges are then bisected, reducing the size of the disagreement with each bisection, and narrowing in on the
247
+ /// exact point of disagreement. Eventually, at step size 1, the step can be proved on-chain directly proving that the related assertion
248
+ /// must be invalid.
249
+ contract EdgeChallengeManager is IEdgeChallengeManager, Initializable {
250
+ using EdgeChallengeManagerLib for EdgeStore;
251
+ using ChallengeEdgeLib for ChallengeEdge;
252
+ using SafeERC20 for IERC20;
253
+
254
+ /// @notice A new edge has been added to the challenge manager
255
+ /// @param edgeId The id of the newly added edge
256
+ /// @param mutualId The mutual id of the added edge - all rivals share the same mutual id
257
+ /// @param originId The origin id of the added edge - origin ids link an edge to the level below
258
+ /// @param hasRival Does the newly added edge have a rival upon creation
259
+ /// @param length The length of the new edge
260
+ /// @param level The level of the new edge
261
+ /// @param isLayerZero Whether the new edge was added at layer zero - has a claim and a staker
262
+ event EdgeAdded(
263
+ bytes32 indexed edgeId,
264
+ bytes32 indexed mutualId,
265
+ bytes32 indexed originId,
266
+ bytes32 claimId,
267
+ uint256 length,
268
+ uint8 level,
269
+ bool hasRival,
270
+ bool isLayerZero
271
+ );
272
+
273
+ /// @notice An edge has been bisected
274
+ /// @param edgeId The id of the edge that was bisected
275
+ /// @param lowerChildId The id of the lower child created during bisection
276
+ /// @param upperChildId The id of the upper child created during bisection
277
+ /// @param lowerChildAlreadyExists When an edge is bisected the lower child may already exist - created by a rival.
278
+ event EdgeBisected(
279
+ bytes32 indexed edgeId,
280
+ bytes32 indexed lowerChildId,
281
+ bytes32 indexed upperChildId,
282
+ bool lowerChildAlreadyExists
283
+ );
284
+
285
+ /// @notice An edge can be confirmed if the cumulative time (in blocks) unrivaled of it and a direct chain of ancestors is greater than a threshold
286
+ /// @param edgeId The edge that was confirmed
287
+ /// @param mutualId The mutual id of the confirmed edge
288
+ /// @param totalTimeUnrivaled The cumulative amount of time (in blocks) this edge spent unrivaled
289
+ event EdgeConfirmedByTime(
290
+ bytes32 indexed edgeId, bytes32 indexed mutualId, uint256 totalTimeUnrivaled
291
+ );
292
+
293
+ /// @notice A SmallStep edge of length 1 can be confirmed via a one step proof
294
+ /// @param edgeId The edge that was confirmed
295
+ /// @param mutualId The mutual id of the confirmed edge
296
+ event EdgeConfirmedByOneStepProof(bytes32 indexed edgeId, bytes32 indexed mutualId);
297
+
298
+ /// @notice An edge's timer cache has been updated
299
+ /// @param edgeId The edge that was updated
300
+ /// @param newValue The new value of its timer cache
301
+ event TimerCacheUpdated(bytes32 indexed edgeId, uint256 newValue);
302
+
303
+ /// @notice A stake has been refunded for a confirmed layer zero block edge
304
+ /// @param edgeId The edge that was confirmed
305
+ /// @param mutualId The mutual id of the confirmed edge
306
+ /// @param stakeToken The ERC20 being refunded
307
+ /// @param stakeAmount The amount of tokens being refunded
308
+ event EdgeRefunded(
309
+ bytes32 indexed edgeId, bytes32 indexed mutualId, address stakeToken, uint256 stakeAmount
310
+ );
311
+
312
+ /// @dev Store for all edges and rival data
313
+ /// All edges, including edges from different challenges, are stored together in the same store
314
+ /// Since edge ids include the origin id, which is unique for each challenge, we can be sure that
315
+ /// edges from different challenges cannot have the same id, and so can be stored in the same store
316
+ EdgeStore internal store;
317
+
318
+ /// @notice When creating a zero layer block edge a stake must be supplied. However since we know that only
319
+ /// one edge in a group of rivals can ever be confirmed, we only need to keep one stake in this contract
320
+ /// to later refund for that edge. Other stakes can immediately be sent to an excess stake receiver.
321
+ /// This excess stake receiver can then choose to refund the gas of participants who aided in the confirmation
322
+ /// of the winning edge
323
+ address public excessStakeReceiver;
324
+
325
+ /// @notice The token to supply stake in
326
+ IERC20 public stakeToken;
327
+
328
+ /// @notice The amount of stake token to be supplied when creating a zero layer block edge at a given level
329
+ uint256[] public stakeAmounts;
330
+
331
+ /// @notice The number of blocks accumulated on an edge before it can be confirmed by time
332
+ uint64 public challengePeriodBlocks;
333
+
334
+ /// @notice The assertion chain about which challenges are created
335
+ IAssertionChain public assertionChain;
336
+
337
+ /// @inheritdoc IEdgeChallengeManager
338
+ IOneStepProofEntry public override oneStepProofEntry;
339
+
340
+ /// @notice The end height of layer zero Block edges
341
+ uint256 public LAYERZERO_BLOCKEDGE_HEIGHT;
342
+ /// @notice The end height of layer zero BigStep edges
343
+ uint256 public LAYERZERO_BIGSTEPEDGE_HEIGHT;
344
+ /// @notice The end height of layer zero SmallStep edges
345
+ uint256 public LAYERZERO_SMALLSTEPEDGE_HEIGHT;
346
+ /// @notice The number of big step levels configured for this challenge manager
347
+ /// There is 1 block level, 1 small step level and N big step levels
348
+ uint8 public NUM_BIGSTEP_LEVEL;
349
+
350
+ constructor() {
351
+ _disableInitializers();
352
+ }
353
+
354
+ /// @inheritdoc IEdgeChallengeManager
355
+ function initialize(
356
+ IAssertionChain _assertionChain,
357
+ uint64 _challengePeriodBlocks,
358
+ IOneStepProofEntry _oneStepProofEntry,
359
+ uint256 layerZeroBlockEdgeHeight,
360
+ uint256 layerZeroBigStepEdgeHeight,
361
+ uint256 layerZeroSmallStepEdgeHeight,
362
+ IERC20 _stakeToken,
363
+ address _excessStakeReceiver,
364
+ uint8 _numBigStepLevel,
365
+ uint256[] calldata _stakeAmounts
366
+ ) public initializer {
367
+ if (address(_assertionChain) == address(0)) {
368
+ revert EmptyAssertionChain();
369
+ }
370
+ assertionChain = _assertionChain;
371
+ if (address(_oneStepProofEntry) == address(0)) {
372
+ revert EmptyOneStepProofEntry();
373
+ }
374
+ oneStepProofEntry = _oneStepProofEntry;
375
+ if (_challengePeriodBlocks == 0) {
376
+ revert EmptyChallengePeriod();
377
+ }
378
+ challengePeriodBlocks = _challengePeriodBlocks;
379
+
380
+ stakeToken = _stakeToken;
381
+ if (_excessStakeReceiver == address(0)) {
382
+ revert EmptyStakeReceiver();
383
+ }
384
+ excessStakeReceiver = _excessStakeReceiver;
385
+
386
+ if (!EdgeChallengeManagerLib.isPowerOfTwo(layerZeroBlockEdgeHeight)) {
387
+ revert NotPowerOfTwo(layerZeroBlockEdgeHeight);
388
+ }
389
+ LAYERZERO_BLOCKEDGE_HEIGHT = layerZeroBlockEdgeHeight;
390
+ if (!EdgeChallengeManagerLib.isPowerOfTwo(layerZeroBigStepEdgeHeight)) {
391
+ revert NotPowerOfTwo(layerZeroBigStepEdgeHeight);
392
+ }
393
+ LAYERZERO_BIGSTEPEDGE_HEIGHT = layerZeroBigStepEdgeHeight;
394
+ if (!EdgeChallengeManagerLib.isPowerOfTwo(layerZeroSmallStepEdgeHeight)) {
395
+ revert NotPowerOfTwo(layerZeroSmallStepEdgeHeight);
396
+ }
397
+ LAYERZERO_SMALLSTEPEDGE_HEIGHT = layerZeroSmallStepEdgeHeight;
398
+
399
+ // ensure that there is at least on of each type of level
400
+ if (_numBigStepLevel == 0) {
401
+ revert ZeroBigStepLevels();
402
+ }
403
+ // ensure there's also space for the block level and the small step level
404
+ // in total level parameters
405
+ if (_numBigStepLevel > 253) {
406
+ revert BigStepLevelsTooMany(_numBigStepLevel);
407
+ }
408
+ NUM_BIGSTEP_LEVEL = _numBigStepLevel;
409
+
410
+ if (_numBigStepLevel + 2 != _stakeAmounts.length) {
411
+ revert StakeAmountsMismatch(_stakeAmounts.length, _numBigStepLevel + 2);
412
+ }
413
+ stakeAmounts = _stakeAmounts;
414
+ }
415
+
416
+ /////////////////////////////
417
+ // STATE MUTATING SECTIION //
418
+ /////////////////////////////
419
+
420
+ /// @inheritdoc IEdgeChallengeManager
421
+ function createLayerZeroEdge(
422
+ CreateEdgeArgs calldata args
423
+ ) external returns (bytes32) {
424
+ // Check if whitelist is enabled in the Rollup
425
+ // We only enforce whitelist in this function as it may exhaust resources
426
+ bool whitelistEnabled = !assertionChain.validatorWhitelistDisabled();
427
+
428
+ if (whitelistEnabled && !assertionChain.isValidator(msg.sender)) {
429
+ revert NotValidator(msg.sender);
430
+ }
431
+
432
+ EdgeAddedData memory edgeAdded;
433
+ EdgeType eType = ChallengeEdgeLib.levelToType(args.level, NUM_BIGSTEP_LEVEL);
434
+ uint256 expectedEndHeight = getLayerZeroEndHeight(eType);
435
+ AssertionReferenceData memory ard;
436
+
437
+ if (eType == EdgeType.Block) {
438
+ // for block type edges we need to provide some extra assertion data context
439
+ if (args.proof.length == 0) {
440
+ revert EmptyEdgeSpecificProof();
441
+ }
442
+ (
443
+ ,
444
+ AssertionStateData memory predecessorStateData,
445
+ AssertionStateData memory claimStateData
446
+ ) = abi.decode(args.proof, (bytes32[], AssertionStateData, AssertionStateData));
447
+
448
+ assertionChain.validateAssertionHash(
449
+ args.claimId,
450
+ claimStateData.assertionState,
451
+ claimStateData.prevAssertionHash,
452
+ claimStateData.inboxAcc
453
+ );
454
+
455
+ assertionChain.validateAssertionHash(
456
+ claimStateData.prevAssertionHash,
457
+ predecessorStateData.assertionState,
458
+ predecessorStateData.prevAssertionHash,
459
+ predecessorStateData.inboxAcc
460
+ );
461
+
462
+ if (args.endHistoryRoot != claimStateData.assertionState.endHistoryRoot) {
463
+ revert EndHistoryRootMismatch(
464
+ args.endHistoryRoot, claimStateData.assertionState.endHistoryRoot
465
+ );
466
+ }
467
+
468
+ ard = AssertionReferenceData(
469
+ args.claimId,
470
+ claimStateData.prevAssertionHash,
471
+ assertionChain.isPending(args.claimId),
472
+ assertionChain.getSecondChildCreationBlock(claimStateData.prevAssertionHash) > 0,
473
+ predecessorStateData.assertionState,
474
+ claimStateData.assertionState
475
+ );
476
+ }
477
+ edgeAdded = store.createLayerZeroEdge(
478
+ args, ard, oneStepProofEntry, expectedEndHeight, NUM_BIGSTEP_LEVEL, whitelistEnabled
479
+ );
480
+
481
+ IERC20 st = stakeToken;
482
+ uint256 sa = stakeAmounts[args.level];
483
+ // when a zero layer edge is created it must include stake amount. Each time a zero layer
484
+ // edge is created it forces the honest participants to do some work, so we want to disincentive
485
+ // their creation. The amount should also be enough to pay for the gas costs incurred by the honest
486
+ // participant. This can be arranged out of bound by the excess stake receiver.
487
+ // The contract initializer can disable staking by setting zeros for token or amount, to change
488
+ // this a new challenge manager needs to be deployed and its address updated in the assertion chain
489
+ if (address(st) != address(0) && sa != 0) {
490
+ // since only one edge in a group of rivals can ever be confirmed, we know that we
491
+ // will never need to refund more than one edge. Therefore we can immediately send
492
+ // all stakes provided after the first one to an excess stake receiver.
493
+ address receiver = edgeAdded.hasRival ? excessStakeReceiver : address(this);
494
+ st.safeTransferFrom(msg.sender, receiver, sa);
495
+ }
496
+
497
+ emit EdgeAdded(
498
+ edgeAdded.edgeId,
499
+ edgeAdded.mutualId,
500
+ edgeAdded.originId,
501
+ edgeAdded.claimId,
502
+ edgeAdded.length,
503
+ edgeAdded.level,
504
+ edgeAdded.hasRival,
505
+ edgeAdded.isLayerZero
506
+ );
507
+ return edgeAdded.edgeId;
508
+ }
509
+
510
+ /// @inheritdoc IEdgeChallengeManager
511
+ function bisectEdge(
512
+ bytes32 edgeId,
513
+ bytes32 bisectionHistoryRoot,
514
+ bytes calldata prefixProof
515
+ ) external returns (bytes32, bytes32) {
516
+ (
517
+ bytes32 lowerChildId,
518
+ EdgeAddedData memory lowerChildAdded,
519
+ EdgeAddedData memory upperChildAdded
520
+ ) = store.bisectEdge(edgeId, bisectionHistoryRoot, prefixProof);
521
+
522
+ bool lowerChildAlreadyExists = lowerChildAdded.edgeId == 0;
523
+ // the lower child might already exist, if it didnt then a new
524
+ // edge was added
525
+ if (!lowerChildAlreadyExists) {
526
+ emit EdgeAdded(
527
+ lowerChildAdded.edgeId,
528
+ lowerChildAdded.mutualId,
529
+ lowerChildAdded.originId,
530
+ lowerChildAdded.claimId,
531
+ lowerChildAdded.length,
532
+ lowerChildAdded.level,
533
+ lowerChildAdded.hasRival,
534
+ lowerChildAdded.isLayerZero
535
+ );
536
+ }
537
+ // upper child is always added
538
+ emit EdgeAdded(
539
+ upperChildAdded.edgeId,
540
+ upperChildAdded.mutualId,
541
+ upperChildAdded.originId,
542
+ upperChildAdded.claimId,
543
+ upperChildAdded.length,
544
+ upperChildAdded.level,
545
+ upperChildAdded.hasRival,
546
+ upperChildAdded.isLayerZero
547
+ );
548
+
549
+ emit EdgeBisected(edgeId, lowerChildId, upperChildAdded.edgeId, lowerChildAlreadyExists);
550
+
551
+ return (lowerChildId, upperChildAdded.edgeId);
552
+ }
553
+
554
+ /// @inheritdoc IEdgeChallengeManager
555
+ function multiUpdateTimeCacheByChildren(
556
+ bytes32[] calldata edgeIds,
557
+ uint256 maximumCachedTime
558
+ ) public {
559
+ if (edgeIds.length == 0) revert EmptyArray();
560
+ // revert early if the last edge already has sufficient time
561
+ store.validateCurrentTimer(edgeIds[edgeIds.length - 1], maximumCachedTime);
562
+ for (uint256 i = 0; i < edgeIds.length; i++) {
563
+ updateTimerCacheByChildren(edgeIds[i], type(uint256).max);
564
+ }
565
+ }
566
+
567
+ /// @inheritdoc IEdgeChallengeManager
568
+ function updateTimerCacheByChildren(bytes32 edgeId, uint256 maximumCachedTime) public {
569
+ (bool updated, uint256 newValue) =
570
+ store.updateTimerCacheByChildren(edgeId, maximumCachedTime);
571
+ if (updated) emit TimerCacheUpdated(edgeId, newValue);
572
+ }
573
+
574
+ /// @inheritdoc IEdgeChallengeManager
575
+ function updateTimerCacheByClaim(
576
+ bytes32 edgeId,
577
+ bytes32 claimingEdgeId,
578
+ uint256 maximumCachedTime
579
+ ) public {
580
+ (bool updated, uint256 newValue) = store.updateTimerCacheByClaim(
581
+ edgeId, claimingEdgeId, NUM_BIGSTEP_LEVEL, maximumCachedTime
582
+ );
583
+ if (updated) emit TimerCacheUpdated(edgeId, newValue);
584
+ }
585
+
586
+ /// @inheritdoc IEdgeChallengeManager
587
+ function confirmEdgeByTime(bytes32 edgeId, AssertionStateData calldata claimStateData) public {
588
+ ChallengeEdge storage topEdge = store.get(edgeId);
589
+ if (!topEdge.isLayerZero()) {
590
+ revert EdgeNotLayerZero(topEdge.id(), topEdge.staker, topEdge.claimId);
591
+ }
592
+
593
+ uint64 assertionBlocks = 0;
594
+ // if the edge is block level and the assertion being claimed against was the first child of its predecessor
595
+ // then we are able to count the time between the first and second child as time towards
596
+ // the this edge
597
+ bool isBlockLevel =
598
+ ChallengeEdgeLib.levelToType(topEdge.level, NUM_BIGSTEP_LEVEL) == EdgeType.Block;
599
+ if (isBlockLevel && assertionChain.isFirstChild(topEdge.claimId)) {
600
+ assertionChain.validateAssertionHash(
601
+ topEdge.claimId,
602
+ claimStateData.assertionState,
603
+ claimStateData.prevAssertionHash,
604
+ claimStateData.inboxAcc
605
+ );
606
+ assertionBlocks = assertionChain.getSecondChildCreationBlock(
607
+ claimStateData.prevAssertionHash
608
+ ) - assertionChain.getFirstChildCreationBlock(claimStateData.prevAssertionHash);
609
+ }
610
+
611
+ uint256 totalTimeUnrivaled =
612
+ store.confirmEdgeByTime(edgeId, assertionBlocks, challengePeriodBlocks);
613
+
614
+ emit EdgeConfirmedByTime(edgeId, store.edges[edgeId].mutualId(), totalTimeUnrivaled);
615
+ }
616
+
617
+ /// @inheritdoc IEdgeChallengeManager
618
+ function confirmEdgeByOneStepProof(
619
+ bytes32 edgeId,
620
+ OneStepData calldata oneStepData,
621
+ ConfigData calldata prevConfig,
622
+ bytes32[] calldata beforeHistoryInclusionProof,
623
+ bytes32[] calldata afterHistoryInclusionProof
624
+ ) public {
625
+ bytes32 prevAssertionHash = store.getPrevAssertionHash(edgeId);
626
+
627
+ assertionChain.validateConfig(prevAssertionHash, prevConfig);
628
+
629
+ ExecutionContext memory execCtx = ExecutionContext({
630
+ maxInboxMessagesRead: prevConfig.nextInboxPosition,
631
+ bridge: assertionChain.bridge(),
632
+ initialWasmModuleRoot: prevConfig.wasmModuleRoot
633
+ });
634
+
635
+ store.confirmEdgeByOneStepProof(
636
+ edgeId,
637
+ oneStepProofEntry,
638
+ oneStepData,
639
+ execCtx,
640
+ beforeHistoryInclusionProof,
641
+ afterHistoryInclusionProof,
642
+ NUM_BIGSTEP_LEVEL,
643
+ LAYERZERO_BIGSTEPEDGE_HEIGHT,
644
+ LAYERZERO_SMALLSTEPEDGE_HEIGHT
645
+ );
646
+
647
+ emit EdgeConfirmedByOneStepProof(edgeId, store.edges[edgeId].mutualId());
648
+ }
649
+
650
+ /// @inheritdoc IEdgeChallengeManager
651
+ function refundStake(
652
+ bytes32 edgeId
653
+ ) public {
654
+ ChallengeEdge storage edge = store.get(edgeId);
655
+ // setting refunded also do checks that the edge cannot be refunded twice
656
+ edge.setRefunded();
657
+
658
+ IERC20 st = stakeToken;
659
+ uint256 sa = stakeAmounts[edge.level];
660
+ // no need to refund with the token or amount where zero'd out
661
+ if (address(st) != address(0) && sa != 0) {
662
+ st.safeTransfer(edge.staker, sa);
663
+ }
664
+
665
+ emit EdgeRefunded(edgeId, store.edges[edgeId].mutualId(), address(st), sa);
666
+ }
667
+
668
+ ///////////////////////
669
+ // VIEW ONLY SECTION //
670
+ ///////////////////////
671
+ /// @inheritdoc IEdgeChallengeManager
672
+ function getLayerZeroEndHeight(
673
+ EdgeType eType
674
+ ) public view returns (uint256) {
675
+ if (eType == EdgeType.Block) {
676
+ return LAYERZERO_BLOCKEDGE_HEIGHT;
677
+ } else if (eType == EdgeType.BigStep) {
678
+ return LAYERZERO_BIGSTEPEDGE_HEIGHT;
679
+ } else if (eType == EdgeType.SmallStep) {
680
+ return LAYERZERO_SMALLSTEPEDGE_HEIGHT;
681
+ } else {
682
+ revert InvalidEdgeType(eType);
683
+ }
684
+ }
685
+
686
+ /// @inheritdoc IEdgeChallengeManager
687
+ function calculateEdgeId(
688
+ uint8 level,
689
+ bytes32 originId,
690
+ uint256 startHeight,
691
+ bytes32 startHistoryRoot,
692
+ uint256 endHeight,
693
+ bytes32 endHistoryRoot
694
+ ) public pure returns (bytes32) {
695
+ return ChallengeEdgeLib.idComponent(
696
+ level, originId, startHeight, startHistoryRoot, endHeight, endHistoryRoot
697
+ );
698
+ }
699
+
700
+ /// @inheritdoc IEdgeChallengeManager
701
+ function calculateMutualId(
702
+ uint8 level,
703
+ bytes32 originId,
704
+ uint256 startHeight,
705
+ bytes32 startHistoryRoot,
706
+ uint256 endHeight
707
+ ) public pure returns (bytes32) {
708
+ return ChallengeEdgeLib.mutualIdComponent(
709
+ level, originId, startHeight, startHistoryRoot, endHeight
710
+ );
711
+ }
712
+
713
+ /// @inheritdoc IEdgeChallengeManager
714
+ function edgeExists(
715
+ bytes32 edgeId
716
+ ) public view returns (bool) {
717
+ return store.edges[edgeId].exists();
718
+ }
719
+
720
+ /// @inheritdoc IEdgeChallengeManager
721
+ function getEdge(
722
+ bytes32 edgeId
723
+ ) public view returns (ChallengeEdge memory) {
724
+ return store.get(edgeId);
725
+ }
726
+
727
+ /// @inheritdoc IEdgeChallengeManager
728
+ function edgeLength(
729
+ bytes32 edgeId
730
+ ) public view returns (uint256) {
731
+ return store.get(edgeId).length();
732
+ }
733
+
734
+ /// @inheritdoc IEdgeChallengeManager
735
+ function hasRival(
736
+ bytes32 edgeId
737
+ ) public view returns (bool) {
738
+ return store.hasRival(edgeId);
739
+ }
740
+
741
+ /// @inheritdoc IEdgeChallengeManager
742
+ function confirmedRival(
743
+ bytes32 mutualId
744
+ ) public view returns (bytes32) {
745
+ return store.confirmedRivals[mutualId];
746
+ }
747
+
748
+ /// @inheritdoc IEdgeChallengeManager
749
+ function hasLengthOneRival(
750
+ bytes32 edgeId
751
+ ) public view returns (bool) {
752
+ return store.hasLengthOneRival(edgeId);
753
+ }
754
+
755
+ /// @inheritdoc IEdgeChallengeManager
756
+ function timeUnrivaled(
757
+ bytes32 edgeId
758
+ ) public view returns (uint256) {
759
+ return store.timeUnrivaled(edgeId);
760
+ }
761
+
762
+ /// @inheritdoc IEdgeChallengeManager
763
+ function getPrevAssertionHash(
764
+ bytes32 edgeId
765
+ ) public view returns (bytes32) {
766
+ return store.getPrevAssertionHash(edgeId);
767
+ }
768
+
769
+ /// @inheritdoc IEdgeChallengeManager
770
+ function firstRival(
771
+ bytes32 mutualId
772
+ ) public view returns (bytes32) {
773
+ return store.firstRivals[mutualId];
774
+ }
775
+
776
+ /// @inheritdoc IEdgeChallengeManager
777
+ function hasMadeLayerZeroRival(
778
+ address account,
779
+ bytes32 mutualId
780
+ ) external view returns (bool) {
781
+ return store.hasMadeLayerZeroRival[account][mutualId];
782
+ }
783
+ }