@arbitrum/nitro-contracts 2.1.1-beta.0 → 3.0.0-alpha.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 (541) 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/{src/express-lane-auction/ELCRound.sol/LatestELCRoundsLib.json → @openzeppelin/contracts/utils/Create2.sol/Create2.json} +4 -4
  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 +1 -1
  56. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol/EnumerableSetUpgradeable.json +2 -2
  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/{@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol/IERC20MetadataUpgradeable.json → src/assertionStakingPool/interfaces/IEdgeStakingPool.sol/IEdgeStakingPool.json} +109 -110
  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 +14 -1
  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 +16 -3
  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/IEthBridge.sol/IEthBridge.dbg.json +1 -1
  101. package/build/contracts/src/bridge/IInbox.sol/IInbox.dbg.json +1 -1
  102. package/build/contracts/src/bridge/IInboxBase.sol/IInboxBase.dbg.json +1 -1
  103. package/build/contracts/src/bridge/IOutbox.sol/IOutbox.dbg.json +1 -1
  104. package/build/contracts/src/bridge/IOwnable.sol/IOwnable.dbg.json +1 -1
  105. package/build/contracts/src/bridge/ISequencerInbox.sol/ISequencerInbox.dbg.json +1 -1
  106. package/build/contracts/src/bridge/ISequencerInbox.sol/ISequencerInbox.json +441 -0
  107. package/build/contracts/src/bridge/Inbox.sol/Inbox.dbg.json +1 -1
  108. package/build/contracts/src/bridge/Inbox.sol/Inbox.json +20 -2
  109. package/build/contracts/src/bridge/Messages.sol/Messages.dbg.json +1 -1
  110. package/build/contracts/src/bridge/Messages.sol/Messages.json +2 -2
  111. package/build/contracts/src/bridge/Outbox.sol/Outbox.dbg.json +1 -1
  112. package/build/contracts/src/bridge/Outbox.sol/Outbox.json +2 -2
  113. package/build/contracts/src/bridge/SequencerInbox.sol/SequencerInbox.dbg.json +1 -1
  114. package/build/contracts/src/bridge/SequencerInbox.sol/SequencerInbox.json +566 -9
  115. package/build/contracts/src/chain/CacheManager.sol/CacheManager.dbg.json +1 -1
  116. package/build/contracts/src/chain/CacheManager.sol/CacheManager.json +15 -2
  117. package/build/contracts/src/challengeV2/EdgeChallengeManager.sol/EdgeChallengeManager.dbg.json +4 -0
  118. package/build/contracts/src/challengeV2/EdgeChallengeManager.sol/EdgeChallengeManager.json +1631 -0
  119. package/build/contracts/src/challengeV2/IAssertionChain.sol/IAssertionChain.dbg.json +4 -0
  120. package/build/contracts/src/challengeV2/IAssertionChain.sol/IAssertionChain.json +247 -0
  121. package/build/contracts/src/challengeV2/IEdgeChallengeManager.sol/IEdgeChallengeManager.dbg.json +4 -0
  122. package/build/contracts/src/challengeV2/IEdgeChallengeManager.sol/IEdgeChallengeManager.json +762 -0
  123. package/build/contracts/src/challengeV2/libraries/ArrayUtilsLib.sol/ArrayUtilsLib.dbg.json +4 -0
  124. package/build/contracts/src/challengeV2/libraries/ArrayUtilsLib.sol/ArrayUtilsLib.json +10 -0
  125. package/build/contracts/src/challengeV2/libraries/ChallengeEdgeLib.sol/ChallengeEdgeLib.dbg.json +4 -0
  126. package/build/contracts/{@openzeppelin/contracts/utils/cryptography/ECDSA.sol/ECDSA.json → src/challengeV2/libraries/ChallengeEdgeLib.sol/ChallengeEdgeLib.json} +4 -4
  127. package/build/contracts/src/challengeV2/libraries/EdgeChallengeManagerLib.sol/EdgeChallengeManagerLib.dbg.json +4 -0
  128. package/build/contracts/src/challengeV2/libraries/EdgeChallengeManagerLib.sol/EdgeChallengeManagerLib.json +24 -0
  129. package/build/contracts/src/challengeV2/libraries/MerkleTreeAccumulatorLib.sol/MerkleTreeAccumulatorLib.dbg.json +4 -0
  130. package/build/contracts/src/challengeV2/libraries/MerkleTreeAccumulatorLib.sol/MerkleTreeAccumulatorLib.json +24 -0
  131. package/build/contracts/src/challengeV2/libraries/UintUtilsLib.sol/UintUtilsLib.dbg.json +4 -0
  132. package/build/contracts/src/challengeV2/libraries/UintUtilsLib.sol/UintUtilsLib.json +10 -0
  133. package/build/contracts/src/libraries/AddressAliasHelper.sol/AddressAliasHelper.dbg.json +1 -1
  134. package/build/contracts/src/libraries/AddressAliasHelper.sol/AddressAliasHelper.json +2 -2
  135. package/build/contracts/src/libraries/AdminFallbackProxy.sol/AdminFallbackProxy.dbg.json +1 -1
  136. package/build/contracts/src/libraries/AdminFallbackProxy.sol/AdminFallbackProxy.json +2 -2
  137. package/build/contracts/src/libraries/AdminFallbackProxy.sol/DoubleLogicERC1967Upgrade.dbg.json +1 -1
  138. package/build/contracts/src/libraries/ArbitrumChecker.sol/ArbitrumChecker.dbg.json +1 -1
  139. package/build/contracts/src/libraries/ArbitrumChecker.sol/ArbitrumChecker.json +2 -2
  140. package/build/contracts/src/libraries/CallerChecker.sol/CallerChecker.dbg.json +4 -0
  141. package/build/contracts/src/{challenge/ChallengeLib.sol/ChallengeLib.json → libraries/CallerChecker.sol/CallerChecker.json} +4 -4
  142. package/build/contracts/src/libraries/CryptographyPrimitives.sol/CryptographyPrimitives.dbg.json +1 -1
  143. package/build/contracts/src/libraries/CryptographyPrimitives.sol/CryptographyPrimitives.json +2 -2
  144. package/build/contracts/src/libraries/DecimalsConverterHelper.sol/DecimalsConverterHelper.dbg.json +1 -1
  145. package/build/contracts/src/libraries/DecimalsConverterHelper.sol/DecimalsConverterHelper.json +2 -2
  146. package/build/contracts/src/libraries/DelegateCallAware.sol/DelegateCallAware.dbg.json +1 -1
  147. package/build/contracts/src/libraries/DoubleLogicUUPSUpgradeable.sol/DoubleLogicUUPSUpgradeable.dbg.json +1 -1
  148. package/build/contracts/src/libraries/GasRefundEnabled.sol/GasRefundEnabled.dbg.json +1 -1
  149. package/build/contracts/src/libraries/IGasRefunder.sol/IGasRefunder.dbg.json +1 -1
  150. package/build/contracts/src/libraries/IReader4844.sol/IReader4844.dbg.json +1 -1
  151. package/build/contracts/src/libraries/MerkleLib.sol/MerkleLib.dbg.json +1 -1
  152. package/build/contracts/src/libraries/MerkleLib.sol/MerkleLib.json +2 -2
  153. package/build/contracts/src/libraries/UUPSNotUpgradeable.sol/UUPSNotUpgradeable.dbg.json +1 -1
  154. package/build/contracts/src/mocks/Benchmarks.sol/Benchmarks.dbg.json +1 -1
  155. package/build/contracts/src/mocks/Benchmarks.sol/Benchmarks.json +2 -2
  156. package/build/contracts/src/mocks/BridgeStub.sol/BridgeStub.dbg.json +1 -1
  157. package/build/contracts/src/mocks/BridgeStub.sol/BridgeStub.json +8 -8
  158. package/build/contracts/src/mocks/BridgeUnproxied.sol/BridgeUnproxied.dbg.json +1 -1
  159. package/build/contracts/src/mocks/BridgeUnproxied.sol/BridgeUnproxied.json +15 -2
  160. package/build/contracts/src/mocks/CreateTest.sol/CreateTest.dbg.json +1 -1
  161. package/build/contracts/src/mocks/CreateTest.sol/CreateTest.json +2 -2
  162. package/build/contracts/src/mocks/HostioTest.sol/HostioTest.dbg.json +1 -1
  163. package/build/contracts/src/mocks/HostioTest.sol/HostioTest.json +2 -2
  164. package/build/contracts/src/mocks/InboxStub.sol/InboxStub.dbg.json +1 -1
  165. package/build/contracts/src/mocks/InboxStub.sol/InboxStub.json +2 -2
  166. package/build/contracts/src/mocks/MerkleTreeAccess.sol/MerkleTreeAccess.dbg.json +4 -0
  167. package/build/contracts/src/mocks/MerkleTreeAccess.sol/MerkleTreeAccess.json +227 -0
  168. package/build/contracts/src/mocks/MockRollupEventInbox.sol/MockRollupEventInbox.dbg.json +4 -0
  169. package/build/contracts/src/mocks/MockRollupEventInbox.sol/MockRollupEventInbox.json +133 -0
  170. package/build/contracts/src/mocks/MultiCallTest.sol/MultiCallTest.dbg.json +1 -1
  171. package/build/contracts/src/mocks/MultiCallTest.sol/MultiCallTest.json +2 -2
  172. package/build/contracts/src/mocks/PendingBlkTimeAndNrAdvanceCheck.sol/PendingBlkTimeAndNrAdvanceCheck.dbg.json +1 -1
  173. package/build/contracts/src/mocks/PendingBlkTimeAndNrAdvanceCheck.sol/PendingBlkTimeAndNrAdvanceCheck.json +2 -2
  174. package/build/contracts/src/mocks/Program.sol/ProgramTest.dbg.json +1 -1
  175. package/build/contracts/src/mocks/Program.sol/ProgramTest.json +2 -2
  176. package/build/contracts/src/mocks/ProxyAdminForBinding.sol/ProxyAdminForBinding.dbg.json +1 -1
  177. package/build/contracts/src/mocks/ProxyAdminForBinding.sol/ProxyAdminForBinding.json +2 -2
  178. package/build/contracts/src/mocks/SdkStorage.sol/SdkStorage.dbg.json +1 -1
  179. package/build/contracts/src/mocks/SdkStorage.sol/SdkStorage.json +2 -2
  180. package/build/contracts/src/mocks/SequencerInboxBlobMock.sol/SequencerInboxBlobMock.dbg.json +4 -0
  181. package/build/contracts/src/mocks/SequencerInboxBlobMock.sol/SequencerInboxBlobMock.json +1632 -0
  182. package/build/contracts/src/mocks/SequencerInboxStub.sol/SequencerInboxStub.dbg.json +1 -1
  183. package/build/contracts/src/mocks/SequencerInboxStub.sol/SequencerInboxStub.json +566 -9
  184. package/build/contracts/src/mocks/Simple.sol/Simple.dbg.json +1 -1
  185. package/build/contracts/src/mocks/Simple.sol/Simple.json +2 -2
  186. package/build/contracts/src/mocks/SimpleCacheManager.sol/SimpleCacheManager.dbg.json +1 -1
  187. package/build/contracts/src/mocks/SimpleCacheManager.sol/SimpleCacheManager.json +2 -2
  188. package/build/contracts/src/mocks/SimpleOneStepProofEntry.sol/SimpleOneStepProofEntry.dbg.json +4 -0
  189. package/build/contracts/src/mocks/SimpleOneStepProofEntry.sol/SimpleOneStepProofEntry.json +142 -0
  190. package/build/contracts/src/mocks/SimpleProxy.sol/SimpleProxy.dbg.json +1 -1
  191. package/build/contracts/src/mocks/SimpleProxy.sol/SimpleProxy.json +2 -2
  192. package/build/contracts/src/mocks/TestWETH9.sol/IWETH9.dbg.json +4 -0
  193. package/build/contracts/src/mocks/TestWETH9.sol/IWETH9.json +31 -0
  194. package/build/contracts/src/mocks/TestWETH9.sol/TestWETH9.dbg.json +4 -0
  195. package/build/contracts/src/mocks/TestWETH9.sol/TestWETH9.json +317 -0
  196. package/build/contracts/src/mocks/UpgradeExecutorMock.sol/UpgradeExecutorMock.dbg.json +1 -1
  197. package/build/contracts/src/mocks/UpgradeExecutorMock.sol/UpgradeExecutorMock.json +15 -2
  198. package/build/contracts/src/node-interface/NodeInterface.sol/NodeInterface.dbg.json +1 -1
  199. package/build/contracts/src/node-interface/NodeInterfaceDebug.sol/NodeInterfaceDebug.dbg.json +1 -1
  200. package/build/contracts/src/osp/HashProofHelper.sol/HashProofHelper.dbg.json +1 -1
  201. package/build/contracts/src/osp/HashProofHelper.sol/HashProofHelper.json +2 -2
  202. package/build/contracts/src/osp/IOneStepProofEntry.sol/IOneStepProofEntry.dbg.json +1 -1
  203. package/build/contracts/src/osp/IOneStepProofEntry.sol/IOneStepProofEntry.json +33 -9
  204. package/build/contracts/src/osp/IOneStepProofEntry.sol/OneStepProofEntryLib.dbg.json +1 -1
  205. package/build/contracts/src/osp/IOneStepProofEntry.sol/OneStepProofEntryLib.json +2 -2
  206. package/build/contracts/src/osp/IOneStepProver.sol/IOneStepProver.dbg.json +1 -1
  207. package/build/contracts/src/osp/IOneStepProver.sol/IOneStepProver.json +5 -0
  208. package/build/contracts/src/osp/OneStepProofEntry.sol/OneStepProofEntry.dbg.json +1 -1
  209. package/build/contracts/src/osp/OneStepProofEntry.sol/OneStepProofEntry.json +35 -11
  210. package/build/contracts/src/osp/OneStepProver0.sol/OneStepProver0.dbg.json +1 -1
  211. package/build/contracts/src/osp/OneStepProver0.sol/OneStepProver0.json +7 -2
  212. package/build/contracts/src/osp/OneStepProverHostIo.sol/OneStepProverHostIo.dbg.json +1 -1
  213. package/build/contracts/src/osp/OneStepProverHostIo.sol/OneStepProverHostIo.json +7 -2
  214. package/build/contracts/src/osp/OneStepProverMath.sol/OneStepProverMath.dbg.json +1 -1
  215. package/build/contracts/src/osp/OneStepProverMath.sol/OneStepProverMath.json +7 -2
  216. package/build/contracts/src/osp/OneStepProverMemory.sol/OneStepProverMemory.dbg.json +1 -1
  217. package/build/contracts/src/osp/OneStepProverMemory.sol/OneStepProverMemory.json +7 -2
  218. package/build/contracts/src/precompiles/ArbAddressTable.sol/ArbAddressTable.dbg.json +1 -1
  219. package/build/contracts/src/precompiles/ArbAggregator.sol/ArbAggregator.dbg.json +1 -1
  220. package/build/contracts/src/precompiles/ArbBLS.sol/ArbBLS.dbg.json +1 -1
  221. package/build/contracts/src/precompiles/ArbDebug.sol/ArbDebug.dbg.json +1 -1
  222. package/build/contracts/src/precompiles/ArbFunctionTable.sol/ArbFunctionTable.dbg.json +1 -1
  223. package/build/contracts/src/precompiles/ArbGasInfo.sol/ArbGasInfo.dbg.json +1 -1
  224. package/build/contracts/src/precompiles/ArbInfo.sol/ArbInfo.dbg.json +1 -1
  225. package/build/contracts/src/precompiles/ArbOwner.sol/ArbOwner.dbg.json +1 -1
  226. package/build/contracts/src/precompiles/ArbOwnerPublic.sol/ArbOwnerPublic.dbg.json +1 -1
  227. package/build/contracts/src/precompiles/ArbRetryableTx.sol/ArbRetryableTx.dbg.json +1 -1
  228. package/build/contracts/src/precompiles/ArbStatistics.sol/ArbStatistics.dbg.json +1 -1
  229. package/build/contracts/src/precompiles/ArbSys.sol/ArbSys.dbg.json +1 -1
  230. package/build/contracts/src/precompiles/ArbWasm.sol/ArbWasm.dbg.json +1 -1
  231. package/build/contracts/src/precompiles/ArbWasmCache.sol/ArbWasmCache.dbg.json +1 -1
  232. package/build/contracts/src/precompiles/ArbosActs.sol/ArbosActs.dbg.json +1 -1
  233. package/build/contracts/src/precompiles/ArbosTest.sol/ArbosTest.dbg.json +1 -1
  234. package/build/contracts/src/rollup/AbsRollupEventInbox.sol/AbsRollupEventInbox.dbg.json +1 -1
  235. package/build/contracts/src/rollup/Assertion.sol/AssertionNodeLib.dbg.json +4 -0
  236. package/build/contracts/src/rollup/{Node.sol/NodeLib.json → Assertion.sol/AssertionNodeLib.json} +4 -4
  237. package/build/contracts/src/rollup/AssertionState.sol/AssertionStateLib.dbg.json +4 -0
  238. package/build/contracts/src/{express-lane-auction/Balance.sol/BalanceLib.json → rollup/AssertionState.sol/AssertionStateLib.json} +4 -4
  239. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/BOLDUpgradeAction.dbg.json +4 -0
  240. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/BOLDUpgradeAction.json +807 -0
  241. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/ConstantArrayStorage.dbg.json +4 -0
  242. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/ConstantArrayStorage.json +35 -0
  243. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/IOldRollup.dbg.json +4 -0
  244. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/IOldRollup.json +361 -0
  245. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/IOldRollupAdmin.dbg.json +4 -0
  246. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/IOldRollupAdmin.json +38 -0
  247. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/ISeqInboxPostUpgradeInit.dbg.json +4 -0
  248. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/ISeqInboxPostUpgradeInit.json +41 -0
  249. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/RollupReader.dbg.json +4 -0
  250. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/RollupReader.json +385 -0
  251. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/StateHashPreImageLookup.dbg.json +4 -0
  252. package/build/contracts/src/rollup/BOLDUpgradeAction.sol/StateHashPreImageLookup.json +203 -0
  253. package/build/contracts/src/rollup/BridgeCreator.sol/BridgeCreator.dbg.json +1 -1
  254. package/build/contracts/src/rollup/BridgeCreator.sol/BridgeCreator.json +62 -10
  255. package/build/contracts/src/rollup/DeployHelper.sol/DeployHelper.dbg.json +1 -1
  256. package/build/contracts/src/rollup/DeployHelper.sol/DeployHelper.json +2 -2
  257. package/build/contracts/src/rollup/ERC20RollupEventInbox.sol/ERC20RollupEventInbox.dbg.json +1 -1
  258. package/build/contracts/src/rollup/ERC20RollupEventInbox.sol/ERC20RollupEventInbox.json +2 -2
  259. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/FactoryDeployerHelper.dbg.json +1 -1
  260. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/FactoryDeployerHelper.json +2 -2
  261. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IDeployHelper.dbg.json +1 -1
  262. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IERC20.dbg.json +1 -1
  263. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IERC20Bridge.dbg.json +1 -1
  264. package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IInboxBase.dbg.json +1 -1
  265. package/build/contracts/src/rollup/IRollupAdmin.sol/IRollupAdmin.dbg.json +1 -1
  266. package/build/contracts/src/rollup/IRollupAdmin.sol/IRollupAdmin.json +473 -99
  267. package/build/contracts/src/rollup/IRollupCore.sol/IRollupCore.dbg.json +1 -1
  268. package/build/contracts/src/rollup/IRollupCore.sol/IRollupCore.json +315 -221
  269. package/build/contracts/src/rollup/IRollupEventInbox.sol/IRollupEventInbox.dbg.json +1 -1
  270. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUser.dbg.json +1 -1
  271. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUser.json +678 -499
  272. package/build/contracts/src/rollup/RollupAdminLogic.sol/RollupAdminLogic.dbg.json +1 -1
  273. package/build/contracts/src/rollup/RollupAdminLogic.sol/RollupAdminLogic.json +806 -435
  274. package/build/contracts/src/rollup/RollupCore.sol/RollupCore.dbg.json +1 -1
  275. package/build/contracts/src/rollup/RollupCore.sol/RollupCore.json +323 -235
  276. package/build/contracts/src/rollup/RollupCreator.sol/RollupCreator.dbg.json +1 -1
  277. package/build/contracts/src/rollup/RollupCreator.sol/RollupCreator.json +98 -36
  278. package/build/contracts/src/rollup/RollupEventInbox.sol/RollupEventInbox.dbg.json +1 -1
  279. package/build/contracts/src/rollup/RollupEventInbox.sol/RollupEventInbox.json +2 -2
  280. package/build/contracts/src/rollup/RollupLib.sol/RollupLib.dbg.json +1 -1
  281. package/build/contracts/src/rollup/RollupLib.sol/RollupLib.json +2 -2
  282. package/build/contracts/src/rollup/RollupProxy.sol/RollupProxy.dbg.json +1 -1
  283. package/build/contracts/src/rollup/RollupProxy.sol/RollupProxy.json +97 -16
  284. package/build/contracts/src/rollup/RollupUserLogic.sol/RollupUserLogic.dbg.json +1 -1
  285. package/build/contracts/src/rollup/RollupUserLogic.sol/RollupUserLogic.json +924 -535
  286. package/build/contracts/src/rollup/ValidatorWallet.sol/ValidatorWallet.dbg.json +1 -1
  287. package/build/contracts/src/rollup/ValidatorWallet.sol/ValidatorWallet.json +15 -43
  288. package/build/contracts/src/rollup/ValidatorWalletCreator.sol/ValidatorWalletCreator.dbg.json +1 -1
  289. package/build/contracts/src/rollup/ValidatorWalletCreator.sol/ValidatorWalletCreator.json +2 -2
  290. package/build/contracts/src/state/Deserialize.sol/Deserialize.dbg.json +1 -1
  291. package/build/contracts/src/state/Deserialize.sol/Deserialize.json +2 -2
  292. package/build/contracts/src/state/GlobalState.sol/GlobalStateLib.dbg.json +1 -1
  293. package/build/contracts/src/state/GlobalState.sol/GlobalStateLib.json +2 -2
  294. package/build/contracts/src/state/Instructions.sol/Instructions.dbg.json +1 -1
  295. package/build/contracts/src/state/Instructions.sol/Instructions.json +2 -2
  296. package/build/contracts/src/state/Machine.sol/MachineLib.dbg.json +1 -1
  297. package/build/contracts/src/state/Machine.sol/MachineLib.json +2 -2
  298. package/build/contracts/src/state/MerkleProof.sol/MerkleProofLib.dbg.json +1 -1
  299. package/build/contracts/src/state/MerkleProof.sol/MerkleProofLib.json +2 -2
  300. package/build/contracts/src/state/Module.sol/ModuleLib.dbg.json +1 -1
  301. package/build/contracts/src/state/Module.sol/ModuleLib.json +2 -2
  302. package/build/contracts/src/state/ModuleMemory.sol/ModuleMemoryLib.dbg.json +1 -1
  303. package/build/contracts/src/state/ModuleMemory.sol/ModuleMemoryLib.json +2 -2
  304. package/build/contracts/src/state/ModuleMemoryCompact.sol/ModuleMemoryCompactLib.dbg.json +1 -1
  305. package/build/contracts/src/state/ModuleMemoryCompact.sol/ModuleMemoryCompactLib.json +2 -2
  306. package/build/contracts/src/state/MultiStack.sol/MultiStackLib.dbg.json +1 -1
  307. package/build/contracts/src/state/MultiStack.sol/MultiStackLib.json +2 -2
  308. package/build/contracts/src/state/PcArray.sol/PcArrayLib.dbg.json +1 -1
  309. package/build/contracts/src/state/PcArray.sol/PcArrayLib.json +2 -2
  310. package/build/contracts/src/state/StackFrame.sol/StackFrameLib.dbg.json +1 -1
  311. package/build/contracts/src/state/StackFrame.sol/StackFrameLib.json +2 -2
  312. package/build/contracts/src/state/Value.sol/ValueLib.dbg.json +1 -1
  313. package/build/contracts/src/state/Value.sol/ValueLib.json +2 -2
  314. package/build/contracts/src/state/ValueArray.sol/ValueArrayLib.dbg.json +1 -1
  315. package/build/contracts/src/state/ValueArray.sol/ValueArrayLib.json +2 -2
  316. package/build/contracts/src/state/ValueStack.sol/ValueStackLib.dbg.json +1 -1
  317. package/build/contracts/src/state/ValueStack.sol/ValueStackLib.json +2 -2
  318. package/build/contracts/src/test-helpers/BridgeTester.sol/BridgeTester.dbg.json +1 -1
  319. package/build/contracts/src/test-helpers/BridgeTester.sol/BridgeTester.json +15 -2
  320. package/build/contracts/src/test-helpers/CryptographyPrimitivesTester.sol/CryptographyPrimitivesTester.dbg.json +1 -1
  321. package/build/contracts/src/test-helpers/CryptographyPrimitivesTester.sol/CryptographyPrimitivesTester.json +2 -2
  322. package/build/contracts/src/test-helpers/EthVault.sol/EthVault.dbg.json +1 -1
  323. package/build/contracts/src/test-helpers/EthVault.sol/EthVault.json +2 -2
  324. package/build/contracts/src/test-helpers/MessageTester.sol/MessageTester.dbg.json +1 -1
  325. package/build/contracts/src/test-helpers/MessageTester.sol/MessageTester.json +2 -2
  326. package/build/contracts/src/test-helpers/OutboxWithoutOptTester.sol/OutboxWithoutOptTester.dbg.json +1 -1
  327. package/build/contracts/src/test-helpers/OutboxWithoutOptTester.sol/OutboxWithoutOptTester.json +2 -2
  328. package/build/contracts/src/test-helpers/RollupMock.sol/RollupMock.dbg.json +1 -1
  329. package/build/contracts/src/test-helpers/RollupMock.sol/RollupMock.json +2 -15
  330. package/build/contracts/src/test-helpers/TestToken.sol/TestToken.dbg.json +1 -1
  331. package/build/contracts/src/test-helpers/TestToken.sol/TestToken.json +2 -2
  332. package/build/contracts/src/test-helpers/ValueArrayTester.sol/ValueArrayTester.dbg.json +1 -1
  333. package/build/contracts/src/test-helpers/ValueArrayTester.sol/ValueArrayTester.json +2 -2
  334. package/out/yul/Reader4844.yul/Reader4844.json +1 -1
  335. package/package.json +11 -4
  336. package/src/assertionStakingPool/AbsBoldStakingPool.sol +66 -0
  337. package/src/assertionStakingPool/AssertionStakingPool.sol +70 -0
  338. package/src/assertionStakingPool/AssertionStakingPoolCreator.sol +35 -0
  339. package/src/assertionStakingPool/EdgeStakingPool.sol +57 -0
  340. package/src/assertionStakingPool/EdgeStakingPoolCreator.sol +34 -0
  341. package/src/assertionStakingPool/StakingPoolCreatorUtils.sol +25 -0
  342. package/src/assertionStakingPool/interfaces/IAbsBoldStakingPool.sol +41 -0
  343. package/src/assertionStakingPool/interfaces/IAssertionStakingPool.sol +36 -0
  344. package/src/assertionStakingPool/interfaces/IAssertionStakingPoolCreator.sol +31 -0
  345. package/src/assertionStakingPool/interfaces/IEdgeStakingPool.sol +27 -0
  346. package/src/assertionStakingPool/interfaces/IEdgeStakingPoolCreator.sol +28 -0
  347. package/src/bridge/AbsBridge.sol +38 -48
  348. package/src/bridge/AbsInbox.sol +89 -92
  349. package/src/bridge/AbsOutbox.sol +23 -37
  350. package/src/bridge/Bridge.sol +6 -4
  351. package/src/bridge/DelayBuffer.sol +123 -0
  352. package/src/bridge/DelayBufferTypes.sol +38 -0
  353. package/src/bridge/ERC20Bridge.sol +8 -4
  354. package/src/bridge/ERC20Inbox.sol +46 -53
  355. package/src/bridge/ERC20Outbox.sol +7 -3
  356. package/src/bridge/GasRefunder.sol +38 -24
  357. package/src/bridge/IBridge.sol +30 -21
  358. package/src/bridge/IERC20Bridge.sol +1 -1
  359. package/src/bridge/IERC20Inbox.sol +4 -2
  360. package/src/bridge/IEthBridge.sol +4 -2
  361. package/src/bridge/IInbox.sol +4 -2
  362. package/src/bridge/IInboxBase.sol +16 -8
  363. package/src/bridge/IOutbox.sol +13 -8
  364. package/src/bridge/ISequencerInbox.sol +118 -13
  365. package/src/bridge/Inbox.sol +134 -151
  366. package/src/bridge/Messages.sol +48 -18
  367. package/src/bridge/Outbox.sol +6 -2
  368. package/src/bridge/SequencerInbox.sol +343 -279
  369. package/src/chain/CacheManager.sol +49 -18
  370. package/src/challengeV2/EdgeChallengeManager.sol +559 -0
  371. package/src/challengeV2/IAssertionChain.sol +39 -0
  372. package/src/challengeV2/IEdgeChallengeManager.sol +233 -0
  373. package/src/challengeV2/libraries/ArrayUtilsLib.sol +61 -0
  374. package/src/challengeV2/libraries/ChallengeEdgeLib.sol +277 -0
  375. package/src/challengeV2/libraries/ChallengeErrors.sol +108 -0
  376. package/src/challengeV2/libraries/EdgeChallengeManagerLib.sol +819 -0
  377. package/src/challengeV2/libraries/Enums.sol +26 -0
  378. package/src/challengeV2/libraries/MerkleTreeAccumulatorLib.sol +390 -0
  379. package/src/challengeV2/libraries/Structs.sol +176 -0
  380. package/src/challengeV2/libraries/UintUtilsLib.sol +74 -0
  381. package/src/libraries/AddressAliasHelper.sol +6 -2
  382. package/src/libraries/AdminFallbackProxy.sol +8 -4
  383. package/src/libraries/ArbitrumChecker.sol +3 -4
  384. package/src/libraries/CallerChecker.sol +18 -0
  385. package/src/libraries/CryptographyPrimitives.sol +39 -46
  386. package/src/libraries/DecimalsConverterHelper.sol +2 -4
  387. package/src/libraries/DoubleLogicUUPSUpgradeable.sol +10 -7
  388. package/src/libraries/Error.sol +21 -3
  389. package/src/libraries/GasRefundEnabled.sol +5 -6
  390. package/src/libraries/MerkleLib.sol +6 -5
  391. package/src/libraries/UUPSNotUpgradeable.sol +2 -4
  392. package/src/mocks/BridgeStub.sol +50 -48
  393. package/src/mocks/CreateTest.sol +3 -1
  394. package/src/mocks/HostioTest.sol +20 -16
  395. package/src/mocks/InboxStub.sol +22 -17
  396. package/src/mocks/MerkleTreeAccess.sol +72 -0
  397. package/src/mocks/MockRollupEventInbox.sol +59 -0
  398. package/src/mocks/MultiCallTest.sol +3 -1
  399. package/src/mocks/PendingBlkTimeAndNrAdvanceCheck.sol +3 -1
  400. package/src/mocks/Program.sol +9 -7
  401. package/src/mocks/SequencerInboxBlobMock.sol +38 -0
  402. package/src/mocks/SequencerInboxStub.sol +9 -12
  403. package/src/mocks/Simple.sol +13 -25
  404. package/src/mocks/SimpleCacheManager.sol +10 -3
  405. package/src/mocks/SimpleOneStepProofEntry.sol +60 -0
  406. package/src/mocks/SimpleProxy.sol +3 -1
  407. package/src/mocks/TestWETH9.sol +30 -0
  408. package/src/mocks/UpgradeExecutorMock.sol +10 -17
  409. package/src/node-interface/NodeInterface.sol +23 -22
  410. package/src/node-interface/NodeInterfaceDebug.sol +5 -3
  411. package/src/osp/HashProofHelper.sol +9 -10
  412. package/src/osp/IOneStepProofEntry.sol +14 -9
  413. package/src/osp/IOneStepProver.sol +1 -0
  414. package/src/osp/OneStepProofEntry.sol +63 -54
  415. package/src/osp/OneStepProver0.sol +14 -27
  416. package/src/osp/OneStepProverHostIo.sol +31 -58
  417. package/src/osp/OneStepProverMath.sol +15 -23
  418. package/src/osp/OneStepProverMemory.sol +9 -23
  419. package/src/precompiles/ArbAddressTable.sol +19 -9
  420. package/src/precompiles/ArbAggregator.sol +12 -4
  421. package/src/precompiles/ArbBLS.sol +1 -3
  422. package/src/precompiles/ArbDebug.sol +5 -11
  423. package/src/precompiles/ArbFunctionTable.sol +7 -10
  424. package/src/precompiles/ArbGasInfo.sol +9 -43
  425. package/src/precompiles/ArbInfo.sol +6 -2
  426. package/src/precompiles/ArbOwner.sol +101 -34
  427. package/src/precompiles/ArbOwnerPublic.sol +6 -2
  428. package/src/precompiles/ArbRetryableTx.sol +15 -5
  429. package/src/precompiles/ArbStatistics.sol +1 -8
  430. package/src/precompiles/ArbSys.sol +16 -18
  431. package/src/precompiles/ArbWasm.sol +24 -14
  432. package/src/precompiles/ArbWasmCache.sol +15 -5
  433. package/src/precompiles/ArbosTest.sol +3 -1
  434. package/src/rollup/AbsRollupEventInbox.sol +15 -16
  435. package/src/rollup/Assertion.sol +100 -0
  436. package/src/rollup/AssertionState.sol +29 -0
  437. package/src/rollup/BOLDUpgradeAction.sol +631 -0
  438. package/src/rollup/BridgeCreator.sol +42 -15
  439. package/src/rollup/Config.sol +15 -7
  440. package/src/rollup/DeployHelper.sol +12 -31
  441. package/src/rollup/ERC20RollupEventInbox.sol +8 -9
  442. package/src/rollup/FactoryDeployerHelper.sol +8 -10
  443. package/src/rollup/IRollupAdmin.sol +127 -45
  444. package/src/rollup/IRollupCore.sol +64 -84
  445. package/src/rollup/IRollupEventInbox.sol +3 -1
  446. package/src/rollup/IRollupLogic.sol +35 -72
  447. package/src/rollup/RollupAdminLogic.sol +224 -203
  448. package/src/rollup/RollupCore.sol +407 -428
  449. package/src/rollup/RollupCreator.sol +84 -71
  450. package/src/rollup/RollupEventInbox.sol +7 -7
  451. package/src/rollup/RollupLib.sol +50 -86
  452. package/src/rollup/RollupProxy.sol +8 -12
  453. package/src/rollup/RollupUserLogic.sol +279 -644
  454. package/src/rollup/ValidatorUtils.sol +0 -242
  455. package/src/rollup/ValidatorWallet.sol +22 -38
  456. package/src/rollup/ValidatorWalletCreator.sol +8 -8
  457. package/src/state/Deserialize.sol +74 -96
  458. package/src/state/GlobalState.sol +74 -20
  459. package/src/state/Instructions.sol +4 -3
  460. package/src/state/Machine.sol +18 -19
  461. package/src/state/Module.sol +14 -13
  462. package/src/state/ModuleMemory.sol +6 -25
  463. package/src/state/ModuleMemoryCompact.sol +3 -1
  464. package/src/state/MultiStack.sol +16 -20
  465. package/src/state/PcArray.sol +7 -7
  466. package/src/state/StackFrame.sol +21 -14
  467. package/src/state/Value.sol +18 -6
  468. package/src/state/ValueArray.sol +7 -7
  469. package/src/state/ValueStack.sol +9 -3
  470. package/src/test-helpers/BridgeTester.sol +32 -42
  471. package/src/test-helpers/CryptographyPrimitivesTester.sol +12 -13
  472. package/src/test-helpers/EthVault.sol +4 -2
  473. package/src/test-helpers/InterfaceCompatibilityTester.sol +1 -1
  474. package/src/test-helpers/MessageTester.sol +3 -10
  475. package/src/test-helpers/OutboxWithoutOptTester.sol +12 -19
  476. package/src/test-helpers/RollupMock.sol +3 -7
  477. package/src/test-helpers/TestToken.sol +4 -2
  478. package/build/contracts/@openzeppelin/contracts/utils/cryptography/ECDSA.sol/ECDSA.dbg.json +0 -4
  479. package/build/contracts/@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol/AccessControlEnumerableUpgradeable.dbg.json +0 -4
  480. package/build/contracts/@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol/AccessControlEnumerableUpgradeable.json +0 -258
  481. package/build/contracts/@openzeppelin/contracts-upgradeable/access/IAccessControlEnumerableUpgradeable.sol/IAccessControlEnumerableUpgradeable.dbg.json +0 -4
  482. package/build/contracts/@openzeppelin/contracts-upgradeable/access/IAccessControlEnumerableUpgradeable.sol/IAccessControlEnumerableUpgradeable.json +0 -226
  483. package/build/contracts/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol/ERC20Upgradeable.dbg.json +0 -4
  484. package/build/contracts/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol/ERC20Upgradeable.json +0 -281
  485. package/build/contracts/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol/IERC20Upgradeable.dbg.json +0 -4
  486. package/build/contracts/@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol/ERC20BurnableUpgradeable.dbg.json +0 -4
  487. package/build/contracts/@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol/ERC20BurnableUpgradeable.json +0 -312
  488. package/build/contracts/@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol/IERC20MetadataUpgradeable.dbg.json +0 -4
  489. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol/ECDSAUpgradeable.dbg.json +0 -4
  490. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol/ECDSAUpgradeable.json +0 -10
  491. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol/EIP712Upgradeable.dbg.json +0 -4
  492. package/build/contracts/@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol/EIP712Upgradeable.json +0 -10
  493. package/build/contracts/src/challenge/ChallengeLib.sol/ChallengeLib.dbg.json +0 -4
  494. package/build/contracts/src/challenge/ChallengeManager.sol/ChallengeManager.dbg.json +0 -4
  495. package/build/contracts/src/challenge/ChallengeManager.sol/ChallengeManager.json +0 -746
  496. package/build/contracts/src/challenge/IChallengeManager.sol/IChallengeManager.dbg.json +0 -4
  497. package/build/contracts/src/challenge/IChallengeManager.sol/IChallengeManager.json +0 -441
  498. package/build/contracts/src/challenge/IChallengeResultReceiver.sol/IChallengeResultReceiver.dbg.json +0 -4
  499. package/build/contracts/src/challenge/IChallengeResultReceiver.sol/IChallengeResultReceiver.json +0 -34
  500. package/build/contracts/src/express-lane-auction/Balance.sol/BalanceLib.dbg.json +0 -4
  501. package/build/contracts/src/express-lane-auction/Burner.sol/Burner.dbg.json +0 -4
  502. package/build/contracts/src/express-lane-auction/Burner.sol/Burner.json +0 -47
  503. package/build/contracts/src/express-lane-auction/ELCRound.sol/LatestELCRoundsLib.dbg.json +0 -4
  504. package/build/contracts/src/express-lane-auction/ExpressLaneAuction.sol/ExpressLaneAuction.dbg.json +0 -4
  505. package/build/contracts/src/express-lane-auction/ExpressLaneAuction.sol/ExpressLaneAuction.json +0 -1588
  506. package/build/contracts/src/express-lane-auction/IExpressLaneAuction.sol/IExpressLaneAuction.dbg.json +0 -4
  507. package/build/contracts/src/express-lane-auction/IExpressLaneAuction.sol/IExpressLaneAuction.json +0 -1296
  508. package/build/contracts/src/express-lane-auction/RoundTimingInfo.sol/RoundTimingInfoLib.dbg.json +0 -4
  509. package/build/contracts/src/express-lane-auction/RoundTimingInfo.sol/RoundTimingInfoLib.json +0 -10
  510. package/build/contracts/src/mocks/MockResultReceiver.sol/MockResultReceiver.dbg.json +0 -4
  511. package/build/contracts/src/mocks/MockResultReceiver.sol/MockResultReceiver.json +0 -188
  512. package/build/contracts/src/mocks/SingleExecutionChallenge.sol/SingleExecutionChallenge.dbg.json +0 -4
  513. package/build/contracts/src/mocks/SingleExecutionChallenge.sol/SingleExecutionChallenge.json +0 -797
  514. package/build/contracts/src/mocks/TimedOutChallengeManager.sol/TimedOutChallengeManager.dbg.json +0 -4
  515. package/build/contracts/src/mocks/TimedOutChallengeManager.sol/TimedOutChallengeManager.json +0 -746
  516. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUserAbs.dbg.json +0 -4
  517. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUserAbs.json +0 -1332
  518. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUserERC20.dbg.json +0 -4
  519. package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUserERC20.json +0 -1466
  520. package/build/contracts/src/rollup/Node.sol/NodeLib.dbg.json +0 -4
  521. package/build/contracts/src/rollup/RollupUserLogic.sol/AbsRollupUserLogic.dbg.json +0 -4
  522. package/build/contracts/src/rollup/RollupUserLogic.sol/AbsRollupUserLogic.json +0 -1614
  523. package/build/contracts/src/rollup/RollupUserLogic.sol/ERC20RollupUserLogic.dbg.json +0 -4
  524. package/build/contracts/src/rollup/RollupUserLogic.sol/ERC20RollupUserLogic.json +0 -1748
  525. package/build/contracts/src/rollup/ValidatorUtils.sol/ValidatorUtils.dbg.json +0 -4
  526. package/build/contracts/src/rollup/ValidatorUtils.sol/ValidatorUtils.json +0 -379
  527. package/src/challenge/ChallengeLib.sol +0 -88
  528. package/src/challenge/ChallengeManager.sol +0 -375
  529. package/src/challenge/IChallengeManager.sol +0 -86
  530. package/src/challenge/IChallengeResultReceiver.sol +0 -13
  531. package/src/express-lane-auction/Balance.sol +0 -142
  532. package/src/express-lane-auction/Burner.sol +0 -25
  533. package/src/express-lane-auction/ELCRound.sol +0 -73
  534. package/src/express-lane-auction/Errors.sol +0 -31
  535. package/src/express-lane-auction/ExpressLaneAuction.sol +0 -565
  536. package/src/express-lane-auction/IExpressLaneAuction.sol +0 -421
  537. package/src/express-lane-auction/RoundTimingInfo.sol +0 -115
  538. package/src/mocks/MockResultReceiver.sol +0 -59
  539. package/src/mocks/SingleExecutionChallenge.sol +0 -41
  540. package/src/mocks/TimedOutChallengeManager.sol +0 -13
  541. package/src/rollup/Node.sol +0 -113
@@ -0,0 +1,819 @@
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 "./UintUtilsLib.sol";
8
+ import "./MerkleTreeAccumulatorLib.sol";
9
+ import "./ChallengeEdgeLib.sol";
10
+ import "../../osp/IOneStepProofEntry.sol";
11
+ import "../../libraries/Constants.sol";
12
+ import "./ChallengeErrors.sol";
13
+ import "./Structs.sol";
14
+ /// @title Core functionality for the Edge Challenge Manager
15
+ /// @notice The edge manager library allows edges to be added and bisected, and keeps track of the amount
16
+ /// of time an edge remained unrivaled.
17
+
18
+ library EdgeChallengeManagerLib {
19
+ using ChallengeEdgeLib for ChallengeEdge;
20
+ using GlobalStateLib for GlobalState;
21
+ using AssertionStateLib for AssertionState;
22
+
23
+ /// @dev Magic string hash to represent that a edges with a given mutual id have no rivals
24
+ bytes32 public constant UNRIVALED = keccak256(abi.encodePacked("UNRIVALED"));
25
+
26
+ /// @notice Get an edge from the store
27
+ /// @dev Throws if the edge does not exist in the store
28
+ /// @param store The edge store to fetch an id from
29
+ /// @param edgeId The id of the edge to fetch
30
+ function get(
31
+ EdgeStore storage store,
32
+ bytes32 edgeId
33
+ ) internal view returns (ChallengeEdge storage) {
34
+ if (!store.edges[edgeId].exists()) {
35
+ revert EdgeNotExists(edgeId);
36
+ }
37
+ return store.edges[edgeId];
38
+ }
39
+
40
+ /// @notice Gets an edge from the store without checking if it exists
41
+ /// @dev Useful where you already know the edge exists in the store - avoid a storage lookup
42
+ /// @param store The edge store to fetch an id from
43
+ /// @param edgeId The id of the edge to fetch
44
+ function getNoCheck(
45
+ EdgeStore storage store,
46
+ bytes32 edgeId
47
+ ) internal view returns (ChallengeEdge storage) {
48
+ return store.edges[edgeId];
49
+ }
50
+
51
+ /// @notice Adds a new edge to the store
52
+ /// @dev Updates first rival info for later use in calculating time unrivaled
53
+ /// @param store The store to add the edge to
54
+ /// @param edge The edge to add
55
+ function add(
56
+ EdgeStore storage store,
57
+ ChallengeEdge memory edge
58
+ ) internal returns (EdgeAddedData memory) {
59
+ bytes32 eId = edge.idMem();
60
+ // add the edge if it doesnt exist already
61
+ if (store.edges[eId].exists()) {
62
+ revert EdgeAlreadyExists(eId);
63
+ }
64
+ store.edges[eId] = edge;
65
+
66
+ // edges that are rivals share the same mutual id
67
+ // we use records of whether a mutual id has ever been added to decide if
68
+ // the new edge is a rival. This will later allow us to calculate time an edge
69
+ // stayed unrivaled
70
+ bytes32 mutualId = ChallengeEdgeLib.mutualIdComponent(
71
+ edge.level, edge.originId, edge.startHeight, edge.startHistoryRoot, edge.endHeight
72
+ );
73
+ bytes32 firstRival = store.firstRivals[mutualId];
74
+
75
+ // the first time we add a mutual id we store a magic string hash against it
76
+ // We do this to distinguish from there being no edges
77
+ // with this mutual. And to distinguish it from the first rival, where we
78
+ // will use an actual edge id so that we can look up the created when time
79
+ // of the first rival, and use it for calculating time unrivaled
80
+ if (firstRival == 0) {
81
+ store.firstRivals[mutualId] = UNRIVALED;
82
+ } else if (firstRival == UNRIVALED) {
83
+ store.firstRivals[mutualId] = eId;
84
+ } else {
85
+ // after we've stored the first rival we dont need to keep a record of any
86
+ // other rival edges - they will all have a zero time unrivaled
87
+ }
88
+
89
+ return EdgeAddedData(
90
+ eId,
91
+ mutualId,
92
+ edge.originId,
93
+ edge.claimId,
94
+ store.edges[eId].length(),
95
+ edge.level,
96
+ firstRival != 0,
97
+ edge.claimId != 0
98
+ );
99
+ }
100
+
101
+ /// @notice Conduct checks that are specific to the edge type.
102
+ /// @dev Since different edge types also require different proofs, we also include the specific
103
+ /// proof parsing logic and return the common parts for later use.
104
+ /// @param store The store containing current edges
105
+ /// @param args The edge creation args
106
+ /// @param ard Data about the assertion data is is also need to when creating a Block edge type
107
+ /// The created edge must be shown to be consistent with the states in the assertion chain
108
+ /// Empty for non block edge type edges
109
+ /// @param oneStepProofEntry The one step proof contract that defines how machine states are hashed
110
+ /// @return Data parsed from the proof, or fetched from elsewhere. Also the origin id for the edge to be created.
111
+ function layerZeroTypeSpecificChecks(
112
+ EdgeStore storage store,
113
+ CreateEdgeArgs calldata args,
114
+ AssertionReferenceData memory ard,
115
+ IOneStepProofEntry oneStepProofEntry,
116
+ uint8 numBigStepLevel
117
+ ) private view returns (ProofData memory, bytes32) {
118
+ if (ChallengeEdgeLib.levelToType(args.level, numBigStepLevel) == EdgeType.Block) {
119
+ // origin id is the assertion which is the root of challenge
120
+ // all rivals and their children share the same origin id - it is a link to the information
121
+ // they agree on
122
+ bytes32 originId = ard.predecessorId;
123
+
124
+ // Sanity check: The assertion reference data should be related to the claim
125
+ // Of course the caller can provide whatever args they wish, so this is really just a helpful
126
+ // check to avoid mistakes
127
+ if (ard.assertionHash == 0) {
128
+ revert AssertionHashEmpty();
129
+ }
130
+ if (ard.assertionHash != args.claimId) {
131
+ revert AssertionHashMismatch(ard.assertionHash, args.claimId);
132
+ }
133
+
134
+ // if the assertion is already confirmed or rejected then it cant be referenced as a claim
135
+ if (!ard.isPending) {
136
+ revert AssertionNotPending();
137
+ }
138
+
139
+ // if the claim doesnt have a sibling then it is undisputed, there's no need
140
+ // to open challenge edges for it
141
+ if (!ard.hasSibling) {
142
+ revert AssertionNoSibling();
143
+ }
144
+
145
+ // parse the inclusion proof for later use
146
+ if (args.proof.length == 0) {
147
+ revert EmptyEdgeSpecificProof();
148
+ }
149
+ (bytes32[] memory inclusionProof,,) =
150
+ abi.decode(args.proof, (bytes32[], AssertionStateData, AssertionStateData));
151
+
152
+ // check the start and end execution states exist, the block hash entry should be non zero
153
+ if (ard.startState.machineStatus == MachineStatus.RUNNING) {
154
+ revert EmptyStartMachineStatus();
155
+ }
156
+ if (ard.endState.machineStatus == MachineStatus.RUNNING) {
157
+ revert EmptyEndMachineStatus();
158
+ }
159
+
160
+ // Create machine hashes out of the proven state
161
+ bytes32 startStateHash =
162
+ oneStepProofEntry.getMachineHash(ard.startState.toExecutionState());
163
+ bytes32 endStateHash = oneStepProofEntry.getMachineHash(ard.endState.toExecutionState());
164
+
165
+ return (ProofData(startStateHash, endStateHash, inclusionProof), originId);
166
+ } else {
167
+ // Claim must be length one. If it is unrivaled then its unrivaled time is ticking up, so there's
168
+ // no need to create claims against it
169
+ if (!hasLengthOneRival(store, args.claimId)) {
170
+ revert ClaimEdgeNotLengthOneRival(args.claimId);
171
+ }
172
+
173
+ // hasLengthOneRival checks existance, so we can use getNoCheck
174
+ ChallengeEdge storage claimEdge = getNoCheck(store, args.claimId);
175
+
176
+ // origin id is the mutual id of the claim
177
+ // all rivals and their children share the same origin id - it is a link to the information
178
+ // they agree on
179
+ bytes32 originId = claimEdge.mutualId();
180
+
181
+ // once a claim is confirmed it's status can never become pending again, so there is no point
182
+ // opening a challenge that references it
183
+ if (claimEdge.status != EdgeStatus.Pending) {
184
+ revert ClaimEdgeNotPending();
185
+ }
186
+
187
+ // the edge must be a level up from the claim
188
+ if (args.level != nextEdgeLevel(claimEdge.level, numBigStepLevel)) {
189
+ revert ClaimEdgeInvalidLevel(args.level, claimEdge.level);
190
+ }
191
+
192
+ // parse the proofs
193
+ if (args.proof.length == 0) {
194
+ revert EmptyEdgeSpecificProof();
195
+ }
196
+ (
197
+ bytes32 startState,
198
+ bytes32 endState,
199
+ bytes32[] memory claimStartInclusionProof,
200
+ bytes32[] memory claimEndInclusionProof,
201
+ bytes32[] memory edgeInclusionProof
202
+ ) = abi.decode(args.proof, (bytes32, bytes32, bytes32[], bytes32[], bytes32[]));
203
+
204
+ // if the start and end states are consistent with the claim edge
205
+ // this guarantees that the edge we're creating is a 'continuation' of the claim edge, it is
206
+ // a commitment to the states that between start and end states of the claim
207
+ MerkleTreeAccumulatorLib.verifyInclusionProof(
208
+ claimEdge.startHistoryRoot,
209
+ startState,
210
+ claimEdge.startHeight,
211
+ claimStartInclusionProof
212
+ );
213
+
214
+ // it's doubly important to check the end state since if the end state since the claim id is
215
+ // not part of the edge id, so we need to ensure that it's not possible to create two edges of the
216
+ // same id, but with different claim id. Ensuring that the end state is linked to the claim,
217
+ // and later ensuring that the end state is part of the history commitment of the new edge ensures
218
+ // that the end history root of the new edge will be different for different claim ids, and therefore
219
+ // the edge ids will be different
220
+ MerkleTreeAccumulatorLib.verifyInclusionProof(
221
+ claimEdge.endHistoryRoot, endState, claimEdge.endHeight, claimEndInclusionProof
222
+ );
223
+
224
+ return (ProofData(startState, endState, edgeInclusionProof), originId);
225
+ }
226
+ }
227
+
228
+ /// @notice Check that a uint is a power of 2
229
+ function isPowerOfTwo(
230
+ uint256 x
231
+ ) internal pure returns (bool) {
232
+ // zero is not a power of 2
233
+ if (x == 0) {
234
+ return false;
235
+ }
236
+
237
+ // if x is a power of 2, then this will be 0111111
238
+ uint256 y = x - 1;
239
+
240
+ // if x is a power of 2 then y will share no bits with x
241
+ return ((x & y) == 0);
242
+ }
243
+
244
+ /// @notice Common checks that apply to all layer zero edges
245
+ /// @param proofData Data extracted from supplied proof
246
+ /// @param args The edge creation args
247
+ /// @param expectedEndHeight Edges have a deterministic end height dependent on their level
248
+ function layerZeroCommonChecks(
249
+ ProofData memory proofData,
250
+ CreateEdgeArgs calldata args,
251
+ uint256 expectedEndHeight
252
+ ) private pure returns (bytes32) {
253
+ // since zero layer edges have a start height of zero, we know that they are a size
254
+ // one tree containing only the start state. We can then compute the history root directly
255
+ bytes32 startHistoryRoot = MerkleTreeAccumulatorLib.root(
256
+ MerkleTreeAccumulatorLib.appendLeaf(new bytes32[](0), proofData.startState)
257
+ );
258
+
259
+ // all end heights are expected to be a power of 2, the specific power is defined by the
260
+ // edge challenge manager itself
261
+ if (!isPowerOfTwo(expectedEndHeight)) {
262
+ revert NotPowerOfTwo(expectedEndHeight);
263
+ }
264
+
265
+ // It isnt strictly necessary to pass in the end height, we know what it
266
+ // should be so we could just use the end height that we get from getLayerZeroEndHeight
267
+ // However it's a nice sanity check for the calling code to check that their local edge
268
+ // will have the same height as the one created here
269
+ if (args.endHeight != expectedEndHeight) {
270
+ revert InvalidEndHeight(args.endHeight, expectedEndHeight);
271
+ }
272
+
273
+ // the end state is checked/determined as part of the specific edge level
274
+ // We then ensure that that same end state is part of the end history root we're creating
275
+ // This ensures continuity of states between levels - the state is present in both this
276
+ // level and the one below
277
+ MerkleTreeAccumulatorLib.verifyInclusionProof(
278
+ args.endHistoryRoot, proofData.endState, args.endHeight, proofData.inclusionProof
279
+ );
280
+
281
+ // start root must always be a prefix of end root, we ensure that
282
+ // this new edge adheres to this. Future bisections will ensure that this
283
+ // property is conserved
284
+ if (args.prefixProof.length == 0) {
285
+ revert EmptyPrefixProof();
286
+ }
287
+ (bytes32[] memory preExpansion, bytes32[] memory preProof) =
288
+ abi.decode(args.prefixProof, (bytes32[], bytes32[]));
289
+ MerkleTreeAccumulatorLib.verifyPrefixProof(
290
+ startHistoryRoot, 1, args.endHistoryRoot, args.endHeight + 1, preExpansion, preProof
291
+ );
292
+
293
+ return (startHistoryRoot);
294
+ }
295
+
296
+ /// @notice Creates a new layer zero edges from edge creation args
297
+ function toLayerZeroEdge(
298
+ bytes32 originId,
299
+ bytes32 startHistoryRoot,
300
+ CreateEdgeArgs calldata args
301
+ ) private view returns (ChallengeEdge memory) {
302
+ return ChallengeEdgeLib.newLayerZeroEdge(
303
+ originId,
304
+ startHistoryRoot,
305
+ 0,
306
+ args.endHistoryRoot,
307
+ args.endHeight,
308
+ args.claimId,
309
+ msg.sender,
310
+ args.level
311
+ );
312
+ }
313
+
314
+ /// @notice Performs necessary checks and creates a new layer zero edge
315
+ /// @param store The store containing existing edges
316
+ /// @param args Edge data
317
+ /// @param ard If the edge being added is of Block type then additional assertion data is required
318
+ /// to check if the edge can be added. Empty if edge is not of type Block.
319
+ /// The supplied assertion data must be related to the assertion that is being claimed
320
+ /// by the supplied edge args
321
+ /// @param oneStepProofEntry The one step proof contract that defines how machine states are hashed
322
+ /// @param expectedEndHeight The expected end height of an edge. Layer zero block edges have predefined heights.
323
+ /// @param numBigStepLevel The number of big step levels in this challenge
324
+ function createLayerZeroEdge(
325
+ EdgeStore storage store,
326
+ CreateEdgeArgs calldata args,
327
+ AssertionReferenceData memory ard,
328
+ IOneStepProofEntry oneStepProofEntry,
329
+ uint256 expectedEndHeight,
330
+ uint8 numBigStepLevel,
331
+ bool whitelistEnabled
332
+ ) internal returns (EdgeAddedData memory) {
333
+ // each edge type requires some specific checks
334
+ (ProofData memory proofData, bytes32 originId) =
335
+ layerZeroTypeSpecificChecks(store, args, ard, oneStepProofEntry, numBigStepLevel);
336
+ // all edge types share some common checks
337
+ (bytes32 startHistoryRoot) = layerZeroCommonChecks(proofData, args, expectedEndHeight);
338
+ // we only wrap the struct creation in a function as doing so with exceeds the stack limit
339
+ ChallengeEdge memory ce = toLayerZeroEdge(originId, startHistoryRoot, args);
340
+
341
+ // if the validator whitelist is enabled, we can enforce that a single party cannot create two layer zero edges that rival each other
342
+ // if the validator whitelist is disabled, this check serves no purpose since an attacker can create new accounts
343
+ if (whitelistEnabled) {
344
+ bytes32 mutualId = ce.mutualIdMem();
345
+ if (store.hasMadeLayerZeroRival[msg.sender][mutualId]) {
346
+ revert AccountHasMadeLayerZeroRival(msg.sender, mutualId);
347
+ }
348
+ store.hasMadeLayerZeroRival[msg.sender][mutualId] = true;
349
+ }
350
+
351
+ return add(store, ce);
352
+ }
353
+
354
+ /// @notice From any given edge, get the id of the previous assertion
355
+ /// @param edgeId The edge to get the prev assertion hash
356
+ function getPrevAssertionHash(
357
+ EdgeStore storage store,
358
+ bytes32 edgeId
359
+ ) internal view returns (bytes32) {
360
+ ChallengeEdge storage edge = get(store, edgeId);
361
+ while (edge.level > 0) {
362
+ // the origin id gives us a link to the lower level
363
+ // we know a first rival must exist, since otherwise we would not have had a one step fork
364
+ // and we wouldnt be able to go to the next level
365
+ // we can use the first rival to get an edge id, and from there get the next origin id
366
+ bytes32 lowerLevelId = store.firstRivals[edge.originId];
367
+ edge = get(store, lowerLevelId);
368
+ }
369
+
370
+ // For Block type edges the origin id is the assertion hash of claim prev
371
+ return edge.originId;
372
+ }
373
+
374
+ /// @notice Does this edge currently have one or more rivals
375
+ /// Rival edges share the same startHeight, startHistoryCommitment and the same endHeight,
376
+ /// but they have a different endHistoryRoot. Rival edges have the same mutualId
377
+ /// @param store The edge store containing the edge
378
+ /// @param edgeId The edge if to test if it is unrivaled
379
+ function hasRival(EdgeStore storage store, bytes32 edgeId) internal view returns (bool) {
380
+ if (!store.edges[edgeId].exists()) {
381
+ revert EdgeNotExists(edgeId);
382
+ }
383
+
384
+ // rivals have the same mutual id
385
+ bytes32 mutualId = store.edges[edgeId].mutualId();
386
+ bytes32 firstRival = store.firstRivals[mutualId];
387
+ // Sanity check: it should never be possible to create an edge without having an entry in firstRivals
388
+ if (firstRival == 0) {
389
+ revert EmptyFirstRival();
390
+ }
391
+
392
+ // can only have no rival if the firstRival is the UNRIVALED magic hash
393
+ return firstRival != UNRIVALED;
394
+ }
395
+
396
+ /// @notice Is the edge a single step in length, and does it have at least one rival.
397
+ /// @param store The edge store containing the edge
398
+ /// @param edgeId The edge id to test for single step and rivaled
399
+ function hasLengthOneRival(
400
+ EdgeStore storage store,
401
+ bytes32 edgeId
402
+ ) internal view returns (bool) {
403
+ // must be length 1 and have rivals - all rivals have the same length
404
+ return (hasRival(store, edgeId) && store.edges[edgeId].length() == 1);
405
+ }
406
+
407
+ function timeUnrivaledTotal(
408
+ EdgeStore storage store,
409
+ bytes32 edgeId
410
+ ) internal view returns (uint256) {
411
+ uint256 totalTimeUnrivaled = timeUnrivaled(store, edgeId);
412
+ if (store.edges[edgeId].lowerChildId != bytes32(0)) {
413
+ uint256 lowerTimer =
414
+ store.edges[store.edges[edgeId].lowerChildId].totalTimeUnrivaledCache;
415
+ uint256 upperTimer =
416
+ store.edges[store.edges[edgeId].upperChildId].totalTimeUnrivaledCache;
417
+ totalTimeUnrivaled += lowerTimer < upperTimer ? lowerTimer : upperTimer;
418
+ }
419
+ return totalTimeUnrivaled;
420
+ }
421
+
422
+ /// @dev revert if the current totalTimeUnrivaledCache on the edge is greater than or equal to maximumCachedTime
423
+ /// @return the current totalTimeUnrivaledCache on the edge
424
+ function validateCurrentTimer(
425
+ EdgeStore storage store,
426
+ bytes32 edgeId,
427
+ uint256 maximumCachedTime
428
+ ) internal view returns (uint256) {
429
+ uint256 currentAccuTimer = store.edges[edgeId].totalTimeUnrivaledCache;
430
+ if (currentAccuTimer >= maximumCachedTime) {
431
+ revert CachedTimeSufficient(currentAccuTimer, maximumCachedTime);
432
+ }
433
+ return currentAccuTimer;
434
+ }
435
+
436
+ /// @notice Update the timer cache for an edge
437
+ /// @dev The cache is only updated if the new value is greater than the current value.
438
+ /// If the new value is greater than uint64 max then the cache is set to uint64 max
439
+ /// @return (bool, uint256) A boolean indicating if the cache was updated, and the value of the cache
440
+ function updateTimerCache(
441
+ EdgeStore storage store,
442
+ bytes32 edgeId,
443
+ uint256 newValue,
444
+ uint256 maximumCachedTime
445
+ ) internal returns (bool, uint256) {
446
+ uint256 currentAccuTimer = validateCurrentTimer(store, edgeId, maximumCachedTime);
447
+ newValue = newValue > type(uint64).max ? type(uint64).max : newValue;
448
+ // only update when increased
449
+ if (newValue > currentAccuTimer) {
450
+ store.edges[edgeId].totalTimeUnrivaledCache = uint64(newValue);
451
+ return (true, newValue);
452
+ }
453
+ return (false, currentAccuTimer);
454
+ }
455
+
456
+ function updateTimerCacheByChildren(
457
+ EdgeStore storage store,
458
+ bytes32 edgeId,
459
+ uint256 maximumCachedTime
460
+ ) internal returns (bool, uint256) {
461
+ return updateTimerCache(store, edgeId, timeUnrivaledTotal(store, edgeId), maximumCachedTime);
462
+ }
463
+
464
+ function updateTimerCacheByClaim(
465
+ EdgeStore storage store,
466
+ bytes32 edgeId,
467
+ bytes32 claimingEdgeId,
468
+ uint8 numBigStepLevel,
469
+ uint256 maximumCachedTime
470
+ ) internal returns (bool, uint256) {
471
+ // calculate the time unrivaled without inheritance
472
+ uint256 totalTimeUnrivaled = timeUnrivaled(store, edgeId);
473
+ checkClaimIdLink(store, edgeId, claimingEdgeId, numBigStepLevel);
474
+ totalTimeUnrivaled += store.edges[claimingEdgeId].totalTimeUnrivaledCache;
475
+ return updateTimerCache(store, edgeId, totalTimeUnrivaled, maximumCachedTime);
476
+ }
477
+
478
+ /// @notice The amount of time (in blocks) this edge has spent without rivals
479
+ /// This value is increasing whilst an edge is unrivaled, once a rival is created
480
+ /// it is fixed. If an edge has rivals from the moment it is created then it will have
481
+ /// a zero time unrivaled
482
+ function timeUnrivaled(
483
+ EdgeStore storage store,
484
+ bytes32 edgeId
485
+ ) internal view returns (uint256) {
486
+ if (!store.edges[edgeId].exists()) {
487
+ revert EdgeNotExists(edgeId);
488
+ }
489
+
490
+ bytes32 mutualId = store.edges[edgeId].mutualId();
491
+ bytes32 firstRival = store.firstRivals[mutualId];
492
+ // Sanity check: it's not possible to have a 0 first rival for an edge that exists
493
+ if (firstRival == 0) {
494
+ revert EmptyFirstRival();
495
+ }
496
+
497
+ // this edge has no rivals, the time is still going up
498
+ // we give the current amount of time unrivaled
499
+ if (firstRival == UNRIVALED) {
500
+ return block.number - store.edges[edgeId].createdAtBlock;
501
+ } else {
502
+ // Sanity check: it's not possible an edge does not exist for a first rival record
503
+ if (!store.edges[firstRival].exists()) {
504
+ revert EdgeNotExists(firstRival);
505
+ }
506
+
507
+ // rivals exist for this edge
508
+ uint256 firstRivalCreatedAtBlock = store.edges[firstRival].createdAtBlock;
509
+ uint256 edgeCreatedAtBlock = store.edges[edgeId].createdAtBlock;
510
+ if (firstRivalCreatedAtBlock > edgeCreatedAtBlock) {
511
+ // if this edge was created before the first rival then we return the difference
512
+ // in createdAtBlock number
513
+ return firstRivalCreatedAtBlock - edgeCreatedAtBlock;
514
+ } else {
515
+ // if this was created at the same time as, or after the the first rival
516
+ // then we return 0
517
+ return 0;
518
+ }
519
+ }
520
+ }
521
+
522
+ /// @notice Given a start and an endpoint determine the bisection height
523
+ /// @dev Returns the highest power of 2 in the differing lower bits of start and end
524
+ function mandatoryBisectionHeight(uint256 start, uint256 end) internal pure returns (uint256) {
525
+ if (end - start < 2) {
526
+ revert HeightDiffLtTwo(start, end);
527
+ }
528
+ if (end - start == 2) {
529
+ return start + 1;
530
+ }
531
+
532
+ uint256 diff = (end - 1) ^ start;
533
+ uint256 mostSignificantSharedBit = UintUtilsLib.mostSignificantBit(diff);
534
+ uint256 mask = type(uint256).max << mostSignificantSharedBit;
535
+ return ((end - 1) & mask);
536
+ }
537
+
538
+ /// @notice Bisect and edge. This creates two child edges:
539
+ /// lowerChild: has the same start root and height as this edge, but a different end root and height
540
+ /// upperChild: has the same end root and height as this edge, but a different start root and height
541
+ /// The lower child end root and height are equal to the upper child start root and height. This height
542
+ /// is the mandatoryBisectionHeight.
543
+ /// The lower child may already exist, however it's not possible for the upper child to exist as that would
544
+ /// mean that the edge has already been bisected
545
+ /// @param store The edge store containing the edge to bisect
546
+ /// @param edgeId Edge to bisect
547
+ /// @param bisectionHistoryRoot The new history root to be used in the lower and upper children
548
+ /// @param prefixProof A proof to show that the bisectionHistoryRoot commits to a prefix of the current endHistoryRoot
549
+ /// @return lowerChildId The id of the newly created lower child edge
550
+ /// @return lowerChildAdded Data about the lower child edge, empty if the lower child already existed
551
+ /// @return upperChildAdded Data about the upper child edge, never empty
552
+ function bisectEdge(
553
+ EdgeStore storage store,
554
+ bytes32 edgeId,
555
+ bytes32 bisectionHistoryRoot,
556
+ bytes memory prefixProof
557
+ ) internal returns (bytes32, EdgeAddedData memory, EdgeAddedData memory) {
558
+ if (store.edges[edgeId].status != EdgeStatus.Pending) {
559
+ revert EdgeNotPending(edgeId, store.edges[edgeId].status);
560
+ }
561
+ if (!hasRival(store, edgeId)) {
562
+ revert EdgeUnrivaled(edgeId);
563
+ }
564
+
565
+ // cannot bisect an edge twice
566
+ // has rival above checks the edge - so no need to check again
567
+ ChallengeEdge memory ce = getNoCheck(store, edgeId);
568
+
569
+ // bisections occur at deterministic heights, this ensures that
570
+ // rival edges bisect at the same height, and create the same child if they agree
571
+ uint256 middleHeight = mandatoryBisectionHeight(ce.startHeight, ce.endHeight);
572
+ {
573
+ (bytes32[] memory preExpansion, bytes32[] memory proof) =
574
+ abi.decode(prefixProof, (bytes32[], bytes32[]));
575
+ MerkleTreeAccumulatorLib.verifyPrefixProof(
576
+ bisectionHistoryRoot,
577
+ middleHeight + 1,
578
+ ce.endHistoryRoot,
579
+ ce.endHeight + 1,
580
+ preExpansion,
581
+ proof
582
+ );
583
+ }
584
+
585
+ bytes32 lowerChildId;
586
+ EdgeAddedData memory lowerChildAdded;
587
+ {
588
+ // midpoint proof it valid, create and store the children
589
+ ChallengeEdge memory lowerChild = ChallengeEdgeLib.newChildEdge(
590
+ ce.originId,
591
+ ce.startHistoryRoot,
592
+ ce.startHeight,
593
+ bisectionHistoryRoot,
594
+ middleHeight,
595
+ ce.level
596
+ );
597
+ lowerChildId = lowerChild.idMem();
598
+ // it's possible that the store already has the lower child if it was created by a rival
599
+ // (aka a merge move)
600
+ if (!store.edges[lowerChildId].exists()) {
601
+ lowerChildAdded = add(store, lowerChild);
602
+ }
603
+ }
604
+
605
+ EdgeAddedData memory upperChildAdded;
606
+ {
607
+ ChallengeEdge memory upperChild = ChallengeEdgeLib.newChildEdge(
608
+ ce.originId,
609
+ bisectionHistoryRoot,
610
+ middleHeight,
611
+ ce.endHistoryRoot,
612
+ ce.endHeight,
613
+ ce.level
614
+ );
615
+
616
+ // add checks existence and throws if the id already exists
617
+ upperChildAdded = add(store, upperChild);
618
+ }
619
+
620
+ store.edges[edgeId].setChildren(lowerChildId, upperChildAdded.edgeId);
621
+
622
+ return (lowerChildId, lowerChildAdded, upperChildAdded);
623
+ }
624
+
625
+ /// @notice Store that an edge has been confirmed. Recorded against the mutual id
626
+ /// so that rivals can look up rival confirmed edges
627
+ /// @dev Checks that a rival edge has not already been confirmed
628
+ function setConfirmedRival(EdgeStore storage store, bytes32 edgeId) internal {
629
+ bytes32 mutualId = store.edges[edgeId].mutualId();
630
+ bytes32 confirmedRivalId = store.confirmedRivals[mutualId];
631
+ if (confirmedRivalId != bytes32(0)) {
632
+ revert RivalEdgeConfirmed(edgeId, confirmedRivalId);
633
+ }
634
+ store.confirmedRivals[mutualId] = edgeId;
635
+ }
636
+
637
+ /// @notice Returns the sub edge level of the provided edge level
638
+ /// @param level The edge level to fetch the next of
639
+ /// @param numBigStepLevel The number of big step levels in this challenge
640
+ function nextEdgeLevel(uint8 level, uint8 numBigStepLevel) internal pure returns (uint8) {
641
+ uint8 nextLevel = level + 1;
642
+
643
+ // levelToType throws an error when level is not a valid type
644
+ ChallengeEdgeLib.levelToType(nextLevel, numBigStepLevel);
645
+
646
+ return nextLevel;
647
+ }
648
+
649
+ /// @notice Check that the originId of a claiming edge matched the mutualId() of a supplied edge
650
+ /// @dev Does some additional sanity checks to ensure that the claim id link is valid
651
+ /// @param store The store containing all edges and rivals
652
+ /// @param edgeId The edge being claimed
653
+ /// @param claimingEdgeId The edge with a claim id equal to edge id
654
+ /// @param numBigStepLevel The number of big step levels in this challenge
655
+ function checkClaimIdLink(
656
+ EdgeStore storage store,
657
+ bytes32 edgeId,
658
+ bytes32 claimingEdgeId,
659
+ uint8 numBigStepLevel
660
+ ) private view {
661
+ if (edgeId != store.edges[claimingEdgeId].claimId) {
662
+ revert EdgeClaimMismatch(edgeId, store.edges[claimingEdgeId].claimId);
663
+ }
664
+ // we do some extra checks that edge being claimed is eligible to be claimed by the claiming edge
665
+ // these shouldn't be necessary since it should be impossible to add layer zero edges that do not
666
+ // satisfy the checks below, but we conduct these checks anyway for double safety
667
+
668
+ // the origin id of an edge should be the mutual id of the edge in the level below
669
+ if (store.edges[edgeId].mutualId() != store.edges[claimingEdgeId].originId) {
670
+ revert OriginIdMutualIdMismatch(
671
+ store.edges[edgeId].mutualId(), store.edges[claimingEdgeId].originId
672
+ );
673
+ }
674
+ // the claiming edge must be exactly one level below
675
+ if (
676
+ nextEdgeLevel(store.edges[edgeId].level, numBigStepLevel)
677
+ != store.edges[claimingEdgeId].level
678
+ ) {
679
+ revert EdgeLevelInvalid(
680
+ edgeId,
681
+ claimingEdgeId,
682
+ nextEdgeLevel(store.edges[edgeId].level, numBigStepLevel),
683
+ store.edges[claimingEdgeId].level
684
+ );
685
+ }
686
+ }
687
+
688
+ /// @notice An edge can be confirmed if the total amount of time (in blocks) it and a single chain of its direct ancestors
689
+ /// has spent unrivaled is greater than the challenge period.
690
+ /// @dev Edges inherit time from their parents, so the sum of unrivaled timer is compared against the threshold.
691
+ /// Given that an edge cannot become unrivaled after becoming rivaled, once the threshold is passed
692
+ /// it will always remain passed. The direct ancestors of an edge are linked by parent-child links for edges
693
+ /// of the same level, and claimId-edgeId links for zero layer edges that claim an edge in the level below.
694
+ /// @param store The edge store containing all edges and rival data
695
+ /// @param edgeId The id of the edge to confirm
696
+ /// @param claimedAssertionUnrivaledBlocks The number of blocks that the assertion ultimately being claimed by this edge spent unrivaled
697
+ /// @param confirmationThresholdBlock The number of blocks that the total unrivaled time of an ancestor chain needs to exceed in
698
+ /// order to be confirmed
699
+ function confirmEdgeByTime(
700
+ EdgeStore storage store,
701
+ bytes32 edgeId,
702
+ uint64 claimedAssertionUnrivaledBlocks,
703
+ uint64 confirmationThresholdBlock
704
+ ) internal returns (uint256) {
705
+ if (!store.edges[edgeId].exists()) {
706
+ revert EdgeNotExists(edgeId);
707
+ }
708
+
709
+ uint256 totalTimeUnrivaled = timeUnrivaledTotal(store, edgeId);
710
+
711
+ // since sibling assertions have the same predecessor, they can be viewed as
712
+ // rival edges. Adding the assertion unrivaled time allows us to start the confirmation
713
+ // timer from the moment the first assertion is made, rather than having to wait until the
714
+ // second assertion is made.
715
+ totalTimeUnrivaled += claimedAssertionUnrivaledBlocks;
716
+
717
+ if (totalTimeUnrivaled < confirmationThresholdBlock) {
718
+ revert InsufficientConfirmationBlocks(totalTimeUnrivaled, confirmationThresholdBlock);
719
+ }
720
+
721
+ // we also check the edge is pending in setConfirmed()
722
+ store.edges[edgeId].setConfirmed();
723
+
724
+ // also checks that no other rival has been confirmed
725
+ setConfirmedRival(store, edgeId);
726
+
727
+ return totalTimeUnrivaled;
728
+ }
729
+
730
+ /// @notice Confirm an edge by executing a one step proof
731
+ /// @dev One step proofs can only be executed against edges that have length one and of type SmallStep
732
+ /// @param store The edge store containing all edges and rival data
733
+ /// @param edgeId The id of the edge to confirm
734
+ /// @param oneStepProofEntry The one step proof contract
735
+ /// @param oneStepData Input data to the one step proof
736
+ /// @param execCtx The execution context to be supplied to the one step proof entry
737
+ /// @param beforeHistoryInclusionProof Proof that the state which is the start of the edge is committed to by the startHistoryRoot
738
+ /// @param afterHistoryInclusionProof Proof that the state which is the end of the edge is committed to by the endHistoryRoot
739
+ /// @param numBigStepLevel The number of big step levels in this challenge
740
+ /// @param bigStepHeight The height of the zero layer levels of big step type
741
+ /// @param smallStepHeight The height of the zero layer levels of big step type
742
+ function confirmEdgeByOneStepProof(
743
+ EdgeStore storage store,
744
+ bytes32 edgeId,
745
+ IOneStepProofEntry oneStepProofEntry,
746
+ OneStepData calldata oneStepData,
747
+ ExecutionContext memory execCtx,
748
+ bytes32[] calldata beforeHistoryInclusionProof,
749
+ bytes32[] calldata afterHistoryInclusionProof,
750
+ uint8 numBigStepLevel,
751
+ uint256 bigStepHeight,
752
+ uint256 smallStepHeight
753
+ ) internal {
754
+ if (!store.edges[edgeId].exists()) {
755
+ revert EdgeNotExists(edgeId);
756
+ }
757
+
758
+ // edge must of type SmallStep
759
+ if (
760
+ ChallengeEdgeLib.levelToType(store.edges[edgeId].level, numBigStepLevel)
761
+ != EdgeType.SmallStep
762
+ ) {
763
+ revert EdgeTypeNotSmallStep(store.edges[edgeId].level);
764
+ }
765
+
766
+ // edge must be length one to execute one step proofs against
767
+ if (store.edges[edgeId].length() != 1) {
768
+ revert EdgeNotLengthOne(store.edges[edgeId].length());
769
+ }
770
+
771
+ // Get the machine step that corresponds to the start height of this edge
772
+ // To do this we sum the machine steps of the edges in each of the preceeding levels.
773
+ // We do not include the block height, since each step at the block level is a new block
774
+ // and new blocks reset the machine step to 0.
775
+ uint256 machineStep = store.edges[edgeId].startHeight;
776
+ {
777
+ bytes32 cursor = edgeId;
778
+ uint256 stepSize = smallStepHeight;
779
+ while (store.edges[cursor].level > 1) {
780
+ bytes32 nextEdgeId = store.edges[cursor].originId;
781
+ // We can traverse to previous levels using the origin id
782
+ cursor = store.firstRivals[nextEdgeId];
783
+ // sum the stepSize * offset from 0 at this level
784
+ machineStep += stepSize * store.edges[cursor].startHeight;
785
+ // the step size at each level is the product of the heights at all succeeding levels
786
+ stepSize *= bigStepHeight;
787
+ }
788
+ }
789
+
790
+ // the state in the onestep data must be committed to by the startHistoryRoot
791
+ MerkleTreeAccumulatorLib.verifyInclusionProof(
792
+ store.edges[edgeId].startHistoryRoot,
793
+ oneStepData.beforeHash,
794
+ machineStep,
795
+ beforeHistoryInclusionProof
796
+ );
797
+
798
+ // execute the single step to produce the after state
799
+ bytes32 afterHash = oneStepProofEntry.proveOneStep(
800
+ execCtx, machineStep, oneStepData.beforeHash, oneStepData.proof
801
+ );
802
+
803
+ // check that the after state was indeed committed to by the endHistoryRoot
804
+ MerkleTreeAccumulatorLib.verifyInclusionProof(
805
+ store.edges[edgeId].endHistoryRoot,
806
+ afterHash,
807
+ machineStep + 1,
808
+ afterHistoryInclusionProof
809
+ );
810
+
811
+ // we also check the edge is pending in setConfirmed()
812
+ store.edges[edgeId].setConfirmed();
813
+
814
+ // also checks that no other rival has been confirmed
815
+ setConfirmedRival(store, edgeId);
816
+
817
+ store.edges[edgeId].totalTimeUnrivaledCache = type(uint64).max;
818
+ }
819
+ }