@hyperlane-xyz/core 0.5.0-alpha0

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 (553) hide show
  1. package/README.md +14 -0
  2. package/contracts/AbacusConnectionManager.sol +145 -0
  3. package/contracts/Create2Factory.sol +114 -0
  4. package/contracts/Inbox.sol +148 -0
  5. package/contracts/InterchainGasPaymaster.sol +67 -0
  6. package/contracts/Mailbox.sol +93 -0
  7. package/contracts/MerkleTreeManager.sol +32 -0
  8. package/contracts/Outbox.sol +191 -0
  9. package/contracts/libs/Merkle.sol +208 -0
  10. package/contracts/libs/Message.sol +122 -0
  11. package/contracts/libs/TypeCasts.sol +34 -0
  12. package/contracts/mock/MockInbox.sol +52 -0
  13. package/contracts/mock/MockOutbox.sol +30 -0
  14. package/contracts/test/MysteryMath.sol +21 -0
  15. package/contracts/test/MysteryMathV1.sol +22 -0
  16. package/contracts/test/MysteryMathV2.sol +22 -0
  17. package/contracts/test/TestInbox.sol +54 -0
  18. package/contracts/test/TestMailbox.sol +12 -0
  19. package/contracts/test/TestMerkle.sol +30 -0
  20. package/contracts/test/TestMessage.sol +64 -0
  21. package/contracts/test/TestMultisigValidatorManager.sol +26 -0
  22. package/contracts/test/TestOutbox.sol +46 -0
  23. package/contracts/test/TestRecipient.sol +36 -0
  24. package/contracts/test/TestSendReceiver.sol +65 -0
  25. package/contracts/test/TestValidatorManager.sol +21 -0
  26. package/contracts/test/bad-recipient/BadRecipient1.sol +16 -0
  27. package/contracts/test/bad-recipient/BadRecipient2.sol +6 -0
  28. package/contracts/test/bad-recipient/BadRecipient3.sol +17 -0
  29. package/contracts/test/bad-recipient/BadRecipient5.sol +14 -0
  30. package/contracts/test/bad-recipient/BadRecipient6.sol +14 -0
  31. package/contracts/upgrade/UpgradeBeacon.sol +98 -0
  32. package/contracts/upgrade/UpgradeBeaconController.sol +48 -0
  33. package/contracts/upgrade/UpgradeBeaconProxy.sol +176 -0
  34. package/contracts/upgrade/Versioned.sol +10 -0
  35. package/contracts/validator-manager/InboxValidatorManager.sol +58 -0
  36. package/contracts/validator-manager/MultisigValidatorManager.sol +271 -0
  37. package/contracts/validator-manager/OutboxValidatorManager.sol +244 -0
  38. package/dist/@openzeppelin/contracts/access/Ownable.d.ts +90 -0
  39. package/dist/@openzeppelin/contracts/access/Ownable.d.ts.map +1 -0
  40. package/dist/@openzeppelin/contracts/access/Ownable.js +4 -0
  41. package/dist/@openzeppelin/contracts/access/Ownable.js.map +1 -0
  42. package/dist/@openzeppelin/contracts/access/index.d.ts +2 -0
  43. package/dist/@openzeppelin/contracts/access/index.d.ts.map +1 -0
  44. package/dist/@openzeppelin/contracts/access/index.js +3 -0
  45. package/dist/@openzeppelin/contracts/access/index.js.map +1 -0
  46. package/dist/@openzeppelin/contracts/index.d.ts +3 -0
  47. package/dist/@openzeppelin/contracts/index.d.ts.map +1 -0
  48. package/dist/@openzeppelin/contracts/index.js +4 -0
  49. package/dist/@openzeppelin/contracts/index.js.map +1 -0
  50. package/dist/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.d.ts +99 -0
  51. package/dist/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.d.ts.map +1 -0
  52. package/dist/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.js +4 -0
  53. package/dist/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.js.map +1 -0
  54. package/dist/@openzeppelin/contracts-upgradeable/access/index.d.ts +2 -0
  55. package/dist/@openzeppelin/contracts-upgradeable/access/index.d.ts.map +1 -0
  56. package/dist/@openzeppelin/contracts-upgradeable/access/index.js +3 -0
  57. package/dist/@openzeppelin/contracts-upgradeable/access/index.js.map +1 -0
  58. package/dist/@openzeppelin/contracts-upgradeable/index.d.ts +9 -0
  59. package/dist/@openzeppelin/contracts-upgradeable/index.d.ts.map +1 -0
  60. package/dist/@openzeppelin/contracts-upgradeable/index.js +4 -0
  61. package/dist/@openzeppelin/contracts-upgradeable/index.js.map +1 -0
  62. package/dist/@openzeppelin/contracts-upgradeable/proxy/index.d.ts +3 -0
  63. package/dist/@openzeppelin/contracts-upgradeable/proxy/index.d.ts.map +1 -0
  64. package/dist/@openzeppelin/contracts-upgradeable/proxy/index.js +4 -0
  65. package/dist/@openzeppelin/contracts-upgradeable/proxy/index.js.map +1 -0
  66. package/dist/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.d.ts +40 -0
  67. package/dist/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.d.ts.map +1 -0
  68. package/dist/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.js +4 -0
  69. package/dist/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.js.map +1 -0
  70. package/dist/@openzeppelin/contracts-upgradeable/proxy/utils/index.d.ts +2 -0
  71. package/dist/@openzeppelin/contracts-upgradeable/proxy/utils/index.d.ts.map +1 -0
  72. package/dist/@openzeppelin/contracts-upgradeable/proxy/utils/index.js +3 -0
  73. package/dist/@openzeppelin/contracts-upgradeable/proxy/utils/index.js.map +1 -0
  74. package/dist/@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.d.ts +40 -0
  75. package/dist/@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.d.ts.map +1 -0
  76. package/dist/@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.js +4 -0
  77. package/dist/@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.js.map +1 -0
  78. package/dist/@openzeppelin/contracts-upgradeable/security/index.d.ts +2 -0
  79. package/dist/@openzeppelin/contracts-upgradeable/security/index.d.ts.map +1 -0
  80. package/dist/@openzeppelin/contracts-upgradeable/security/index.js +3 -0
  81. package/dist/@openzeppelin/contracts-upgradeable/security/index.js.map +1 -0
  82. package/dist/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.d.ts +40 -0
  83. package/dist/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.d.ts.map +1 -0
  84. package/dist/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.js +4 -0
  85. package/dist/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.js.map +1 -0
  86. package/dist/@openzeppelin/contracts-upgradeable/utils/index.d.ts +2 -0
  87. package/dist/@openzeppelin/contracts-upgradeable/utils/index.d.ts.map +1 -0
  88. package/dist/@openzeppelin/contracts-upgradeable/utils/index.js +3 -0
  89. package/dist/@openzeppelin/contracts-upgradeable/utils/index.js.map +1 -0
  90. package/dist/@openzeppelin/index.d.ts +5 -0
  91. package/dist/@openzeppelin/index.d.ts.map +1 -0
  92. package/dist/@openzeppelin/index.js +4 -0
  93. package/dist/@openzeppelin/index.js.map +1 -0
  94. package/dist/common.d.ts +22 -0
  95. package/dist/common.d.ts.map +1 -0
  96. package/dist/common.js +4 -0
  97. package/dist/common.js.map +1 -0
  98. package/dist/contracts/AbacusConnectionManager.d.ts +213 -0
  99. package/dist/contracts/AbacusConnectionManager.d.ts.map +1 -0
  100. package/dist/contracts/AbacusConnectionManager.js +4 -0
  101. package/dist/contracts/AbacusConnectionManager.js.map +1 -0
  102. package/dist/contracts/ConstAddressDeployer.d.ts +94 -0
  103. package/dist/contracts/ConstAddressDeployer.d.ts.map +1 -0
  104. package/dist/contracts/ConstAddressDeployer.js +4 -0
  105. package/dist/contracts/ConstAddressDeployer.js.map +1 -0
  106. package/dist/contracts/Create2Factory.d.ts +94 -0
  107. package/dist/contracts/Create2Factory.d.ts.map +1 -0
  108. package/dist/contracts/Create2Factory.js +4 -0
  109. package/dist/contracts/Create2Factory.js.map +1 -0
  110. package/dist/contracts/Inbox.d.ts +207 -0
  111. package/dist/contracts/Inbox.d.ts.map +1 -0
  112. package/dist/contracts/Inbox.js +4 -0
  113. package/dist/contracts/Inbox.js.map +1 -0
  114. package/dist/contracts/InterchainGasPaymaster.d.ts +162 -0
  115. package/dist/contracts/InterchainGasPaymaster.d.ts.map +1 -0
  116. package/dist/contracts/InterchainGasPaymaster.js +4 -0
  117. package/dist/contracts/InterchainGasPaymaster.js.map +1 -0
  118. package/dist/contracts/Mailbox.d.ts +142 -0
  119. package/dist/contracts/Mailbox.d.ts.map +1 -0
  120. package/dist/contracts/Mailbox.js +4 -0
  121. package/dist/contracts/Mailbox.js.map +1 -0
  122. package/dist/contracts/MerkleTreeManager.d.ts +53 -0
  123. package/dist/contracts/MerkleTreeManager.d.ts.map +1 -0
  124. package/dist/contracts/MerkleTreeManager.js +4 -0
  125. package/dist/contracts/MerkleTreeManager.js.map +1 -0
  126. package/dist/contracts/Outbox.d.ts +331 -0
  127. package/dist/contracts/Outbox.d.ts.map +1 -0
  128. package/dist/contracts/Outbox.js +4 -0
  129. package/dist/contracts/Outbox.js.map +1 -0
  130. package/dist/contracts/index.d.ts +16 -0
  131. package/dist/contracts/index.d.ts.map +1 -0
  132. package/dist/contracts/index.js +4 -0
  133. package/dist/contracts/index.js.map +1 -0
  134. package/dist/contracts/mock/MockInbox.d.ts +67 -0
  135. package/dist/contracts/mock/MockInbox.d.ts.map +1 -0
  136. package/dist/contracts/mock/MockInbox.js +4 -0
  137. package/dist/contracts/mock/MockInbox.js.map +1 -0
  138. package/dist/contracts/mock/MockOutbox.d.ts +51 -0
  139. package/dist/contracts/mock/MockOutbox.d.ts.map +1 -0
  140. package/dist/contracts/mock/MockOutbox.js +4 -0
  141. package/dist/contracts/mock/MockOutbox.js.map +1 -0
  142. package/dist/contracts/mock/index.d.ts +3 -0
  143. package/dist/contracts/mock/index.d.ts.map +1 -0
  144. package/dist/contracts/mock/index.js +3 -0
  145. package/dist/contracts/mock/index.js.map +1 -0
  146. package/dist/contracts/test/MysteryMath.d.ts +77 -0
  147. package/dist/contracts/test/MysteryMath.d.ts.map +1 -0
  148. package/dist/contracts/test/MysteryMath.js +4 -0
  149. package/dist/contracts/test/MysteryMath.js.map +1 -0
  150. package/dist/contracts/test/MysteryMathV1.d.ts +85 -0
  151. package/dist/contracts/test/MysteryMathV1.d.ts.map +1 -0
  152. package/dist/contracts/test/MysteryMathV1.js +4 -0
  153. package/dist/contracts/test/MysteryMathV1.js.map +1 -0
  154. package/dist/contracts/test/MysteryMathV2.d.ts +85 -0
  155. package/dist/contracts/test/MysteryMathV2.d.ts.map +1 -0
  156. package/dist/contracts/test/MysteryMathV2.js +4 -0
  157. package/dist/contracts/test/MysteryMathV2.js.map +1 -0
  158. package/dist/contracts/test/TestInbox.d.ts +263 -0
  159. package/dist/contracts/test/TestInbox.d.ts.map +1 -0
  160. package/dist/contracts/test/TestInbox.js +4 -0
  161. package/dist/contracts/test/TestInbox.js.map +1 -0
  162. package/dist/contracts/test/TestMailbox.d.ts +158 -0
  163. package/dist/contracts/test/TestMailbox.d.ts.map +1 -0
  164. package/dist/contracts/test/TestMailbox.js +4 -0
  165. package/dist/contracts/test/TestMailbox.js.map +1 -0
  166. package/dist/contracts/test/TestMerkle.d.ts +87 -0
  167. package/dist/contracts/test/TestMerkle.d.ts.map +1 -0
  168. package/dist/contracts/test/TestMerkle.js +4 -0
  169. package/dist/contracts/test/TestMerkle.js.map +1 -0
  170. package/dist/contracts/test/TestMessage.d.ts +103 -0
  171. package/dist/contracts/test/TestMessage.d.ts.map +1 -0
  172. package/dist/contracts/test/TestMessage.js +4 -0
  173. package/dist/contracts/test/TestMessage.js.map +1 -0
  174. package/dist/contracts/test/TestMultisigValidatorManager.d.ts +247 -0
  175. package/dist/contracts/test/TestMultisigValidatorManager.d.ts.map +1 -0
  176. package/dist/contracts/test/TestMultisigValidatorManager.js +4 -0
  177. package/dist/contracts/test/TestMultisigValidatorManager.js.map +1 -0
  178. package/dist/contracts/test/TestOutbox.d.ts +371 -0
  179. package/dist/contracts/test/TestOutbox.d.ts.map +1 -0
  180. package/dist/contracts/test/TestOutbox.js +4 -0
  181. package/dist/contracts/test/TestOutbox.js.map +1 -0
  182. package/dist/contracts/test/TestRecipient.d.ts +131 -0
  183. package/dist/contracts/test/TestRecipient.d.ts.map +1 -0
  184. package/dist/contracts/test/TestRecipient.js +4 -0
  185. package/dist/contracts/test/TestRecipient.js.map +1 -0
  186. package/dist/contracts/test/TestSendReceiver.d.ts +78 -0
  187. package/dist/contracts/test/TestSendReceiver.d.ts.map +1 -0
  188. package/dist/contracts/test/TestSendReceiver.js +4 -0
  189. package/dist/contracts/test/TestSendReceiver.js.map +1 -0
  190. package/dist/contracts/test/TestValidatorManager.d.ts +58 -0
  191. package/dist/contracts/test/TestValidatorManager.d.ts.map +1 -0
  192. package/dist/contracts/test/TestValidatorManager.js +4 -0
  193. package/dist/contracts/test/TestValidatorManager.js.map +1 -0
  194. package/dist/contracts/test/bad-recipient/BadRecipient1.d.ts +43 -0
  195. package/dist/contracts/test/bad-recipient/BadRecipient1.d.ts.map +1 -0
  196. package/dist/contracts/test/bad-recipient/BadRecipient1.js +4 -0
  197. package/dist/contracts/test/bad-recipient/BadRecipient1.js.map +1 -0
  198. package/dist/contracts/test/bad-recipient/BadRecipient2.d.ts +43 -0
  199. package/dist/contracts/test/bad-recipient/BadRecipient2.d.ts.map +1 -0
  200. package/dist/contracts/test/bad-recipient/BadRecipient2.js +4 -0
  201. package/dist/contracts/test/bad-recipient/BadRecipient2.js.map +1 -0
  202. package/dist/contracts/test/bad-recipient/BadRecipient3.d.ts +43 -0
  203. package/dist/contracts/test/bad-recipient/BadRecipient3.d.ts.map +1 -0
  204. package/dist/contracts/test/bad-recipient/BadRecipient3.js +4 -0
  205. package/dist/contracts/test/bad-recipient/BadRecipient3.js.map +1 -0
  206. package/dist/contracts/test/bad-recipient/BadRecipient5.d.ts +43 -0
  207. package/dist/contracts/test/bad-recipient/BadRecipient5.d.ts.map +1 -0
  208. package/dist/contracts/test/bad-recipient/BadRecipient5.js +4 -0
  209. package/dist/contracts/test/bad-recipient/BadRecipient5.js.map +1 -0
  210. package/dist/contracts/test/bad-recipient/BadRecipient6.d.ts +43 -0
  211. package/dist/contracts/test/bad-recipient/BadRecipient6.d.ts.map +1 -0
  212. package/dist/contracts/test/bad-recipient/BadRecipient6.js +4 -0
  213. package/dist/contracts/test/bad-recipient/BadRecipient6.js.map +1 -0
  214. package/dist/contracts/test/bad-recipient/index.d.ts +6 -0
  215. package/dist/contracts/test/bad-recipient/index.d.ts.map +1 -0
  216. package/dist/contracts/test/bad-recipient/index.js +3 -0
  217. package/dist/contracts/test/bad-recipient/index.js.map +1 -0
  218. package/dist/contracts/test/index.d.ts +15 -0
  219. package/dist/contracts/test/index.d.ts.map +1 -0
  220. package/dist/contracts/test/index.js +4 -0
  221. package/dist/contracts/test/index.js.map +1 -0
  222. package/dist/contracts/upgrade/UpgradeBeacon.d.ts +40 -0
  223. package/dist/contracts/upgrade/UpgradeBeacon.d.ts.map +1 -0
  224. package/dist/contracts/upgrade/UpgradeBeacon.js +4 -0
  225. package/dist/contracts/upgrade/UpgradeBeacon.js.map +1 -0
  226. package/dist/contracts/upgrade/UpgradeBeaconController.d.ts +119 -0
  227. package/dist/contracts/upgrade/UpgradeBeaconController.d.ts.map +1 -0
  228. package/dist/contracts/upgrade/UpgradeBeaconController.js +4 -0
  229. package/dist/contracts/upgrade/UpgradeBeaconController.js.map +1 -0
  230. package/dist/contracts/upgrade/UpgradeBeaconProxy.d.ts +28 -0
  231. package/dist/contracts/upgrade/UpgradeBeaconProxy.d.ts.map +1 -0
  232. package/dist/contracts/upgrade/UpgradeBeaconProxy.js +4 -0
  233. package/dist/contracts/upgrade/UpgradeBeaconProxy.js.map +1 -0
  234. package/dist/contracts/upgrade/Versioned.d.ts +43 -0
  235. package/dist/contracts/upgrade/Versioned.d.ts.map +1 -0
  236. package/dist/contracts/upgrade/Versioned.js +4 -0
  237. package/dist/contracts/upgrade/Versioned.js.map +1 -0
  238. package/dist/contracts/upgrade/index.d.ts +5 -0
  239. package/dist/contracts/upgrade/index.d.ts.map +1 -0
  240. package/dist/contracts/upgrade/index.js +3 -0
  241. package/dist/contracts/upgrade/index.js.map +1 -0
  242. package/dist/contracts/validator-manager/InboxValidatorManager.d.ts +263 -0
  243. package/dist/contracts/validator-manager/InboxValidatorManager.d.ts.map +1 -0
  244. package/dist/contracts/validator-manager/InboxValidatorManager.js +4 -0
  245. package/dist/contracts/validator-manager/InboxValidatorManager.js.map +1 -0
  246. package/dist/contracts/validator-manager/MultisigValidatorManager.d.ts +239 -0
  247. package/dist/contracts/validator-manager/MultisigValidatorManager.d.ts.map +1 -0
  248. package/dist/contracts/validator-manager/MultisigValidatorManager.js +4 -0
  249. package/dist/contracts/validator-manager/MultisigValidatorManager.js.map +1 -0
  250. package/dist/contracts/validator-manager/OutboxValidatorManager.d.ts +335 -0
  251. package/dist/contracts/validator-manager/OutboxValidatorManager.d.ts.map +1 -0
  252. package/dist/contracts/validator-manager/OutboxValidatorManager.js +4 -0
  253. package/dist/contracts/validator-manager/OutboxValidatorManager.js.map +1 -0
  254. package/dist/contracts/validator-manager/index.d.ts +4 -0
  255. package/dist/contracts/validator-manager/index.d.ts.map +1 -0
  256. package/dist/contracts/validator-manager/index.js +3 -0
  257. package/dist/contracts/validator-manager/index.js.map +1 -0
  258. package/dist/factories/@openzeppelin/contracts/access/Ownable__factory.d.ts +43 -0
  259. package/dist/factories/@openzeppelin/contracts/access/Ownable__factory.d.ts.map +1 -0
  260. package/dist/factories/@openzeppelin/contracts/access/Ownable__factory.js +70 -0
  261. package/dist/factories/@openzeppelin/contracts/access/Ownable__factory.js.map +1 -0
  262. package/dist/factories/@openzeppelin/contracts/access/index.d.ts +2 -0
  263. package/dist/factories/@openzeppelin/contracts/access/index.d.ts.map +1 -0
  264. package/dist/factories/@openzeppelin/contracts/access/index.js +9 -0
  265. package/dist/factories/@openzeppelin/contracts/access/index.js.map +1 -0
  266. package/dist/factories/@openzeppelin/contracts/index.d.ts +2 -0
  267. package/dist/factories/@openzeppelin/contracts/index.d.ts.map +1 -0
  268. package/dist/factories/@openzeppelin/contracts/index.js +31 -0
  269. package/dist/factories/@openzeppelin/contracts/index.js.map +1 -0
  270. package/dist/factories/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable__factory.d.ts +43 -0
  271. package/dist/factories/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable__factory.d.ts.map +1 -0
  272. package/dist/factories/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable__factory.js +83 -0
  273. package/dist/factories/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable__factory.js.map +1 -0
  274. package/dist/factories/@openzeppelin/contracts-upgradeable/access/index.d.ts +2 -0
  275. package/dist/factories/@openzeppelin/contracts-upgradeable/access/index.d.ts.map +1 -0
  276. package/dist/factories/@openzeppelin/contracts-upgradeable/access/index.js +9 -0
  277. package/dist/factories/@openzeppelin/contracts-upgradeable/access/index.js.map +1 -0
  278. package/dist/factories/@openzeppelin/contracts-upgradeable/index.d.ts +5 -0
  279. package/dist/factories/@openzeppelin/contracts-upgradeable/index.d.ts.map +1 -0
  280. package/dist/factories/@openzeppelin/contracts-upgradeable/index.js +34 -0
  281. package/dist/factories/@openzeppelin/contracts-upgradeable/index.js.map +1 -0
  282. package/dist/factories/@openzeppelin/contracts-upgradeable/proxy/index.d.ts +2 -0
  283. package/dist/factories/@openzeppelin/contracts-upgradeable/proxy/index.d.ts.map +1 -0
  284. package/dist/factories/@openzeppelin/contracts-upgradeable/proxy/index.js +31 -0
  285. package/dist/factories/@openzeppelin/contracts-upgradeable/proxy/index.js.map +1 -0
  286. package/dist/factories/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable__factory.d.ts +19 -0
  287. package/dist/factories/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable__factory.d.ts.map +1 -0
  288. package/dist/factories/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable__factory.js +31 -0
  289. package/dist/factories/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable__factory.js.map +1 -0
  290. package/dist/factories/@openzeppelin/contracts-upgradeable/proxy/utils/index.d.ts +2 -0
  291. package/dist/factories/@openzeppelin/contracts-upgradeable/proxy/utils/index.d.ts.map +1 -0
  292. package/dist/factories/@openzeppelin/contracts-upgradeable/proxy/utils/index.js +9 -0
  293. package/dist/factories/@openzeppelin/contracts-upgradeable/proxy/utils/index.js.map +1 -0
  294. package/dist/factories/@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable__factory.d.ts +19 -0
  295. package/dist/factories/@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable__factory.d.ts.map +1 -0
  296. package/dist/factories/@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable__factory.js +31 -0
  297. package/dist/factories/@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable__factory.js.map +1 -0
  298. package/dist/factories/@openzeppelin/contracts-upgradeable/security/index.d.ts +2 -0
  299. package/dist/factories/@openzeppelin/contracts-upgradeable/security/index.d.ts.map +1 -0
  300. package/dist/factories/@openzeppelin/contracts-upgradeable/security/index.js +9 -0
  301. package/dist/factories/@openzeppelin/contracts-upgradeable/security/index.js.map +1 -0
  302. package/dist/factories/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable__factory.d.ts +19 -0
  303. package/dist/factories/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable__factory.d.ts.map +1 -0
  304. package/dist/factories/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable__factory.js +31 -0
  305. package/dist/factories/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable__factory.js.map +1 -0
  306. package/dist/factories/@openzeppelin/contracts-upgradeable/utils/index.d.ts +2 -0
  307. package/dist/factories/@openzeppelin/contracts-upgradeable/utils/index.d.ts.map +1 -0
  308. package/dist/factories/@openzeppelin/contracts-upgradeable/utils/index.js +9 -0
  309. package/dist/factories/@openzeppelin/contracts-upgradeable/utils/index.js.map +1 -0
  310. package/dist/factories/@openzeppelin/index.d.ts +3 -0
  311. package/dist/factories/@openzeppelin/index.d.ts.map +1 -0
  312. package/dist/factories/@openzeppelin/index.js +32 -0
  313. package/dist/factories/@openzeppelin/index.js.map +1 -0
  314. package/dist/factories/contracts/AbacusConnectionManager__factory.d.ts +55 -0
  315. package/dist/factories/contracts/AbacusConnectionManager__factory.d.ts.map +1 -0
  316. package/dist/factories/contracts/AbacusConnectionManager__factory.js +276 -0
  317. package/dist/factories/contracts/AbacusConnectionManager__factory.js.map +1 -0
  318. package/dist/factories/contracts/ConstAddressDeployer__factory.d.ts +55 -0
  319. package/dist/factories/contracts/ConstAddressDeployer__factory.d.ts.map +1 -0
  320. package/dist/factories/contracts/ConstAddressDeployer__factory.js +163 -0
  321. package/dist/factories/contracts/ConstAddressDeployer__factory.js.map +1 -0
  322. package/dist/factories/contracts/Create2Factory__factory.d.ts +55 -0
  323. package/dist/factories/contracts/Create2Factory__factory.d.ts.map +1 -0
  324. package/dist/factories/contracts/Create2Factory__factory.js +163 -0
  325. package/dist/factories/contracts/Create2Factory__factory.js.map +1 -0
  326. package/dist/factories/contracts/Inbox__factory.d.ts +59 -0
  327. package/dist/factories/contracts/Inbox__factory.d.ts.map +1 -0
  328. package/dist/factories/contracts/Inbox__factory.js +278 -0
  329. package/dist/factories/contracts/Inbox__factory.js.map +1 -0
  330. package/dist/factories/contracts/InterchainGasPaymaster__factory.d.ts +62 -0
  331. package/dist/factories/contracts/InterchainGasPaymaster__factory.d.ts.map +1 -0
  332. package/dist/factories/contracts/InterchainGasPaymaster__factory.js +173 -0
  333. package/dist/factories/contracts/InterchainGasPaymaster__factory.js.map +1 -0
  334. package/dist/factories/contracts/Mailbox__factory.d.ts +43 -0
  335. package/dist/factories/contracts/Mailbox__factory.d.ts.map +1 -0
  336. package/dist/factories/contracts/Mailbox__factory.js +135 -0
  337. package/dist/factories/contracts/Mailbox__factory.js.map +1 -0
  338. package/dist/factories/contracts/MerkleTreeManager__factory.d.ts +31 -0
  339. package/dist/factories/contracts/MerkleTreeManager__factory.d.ts.map +1 -0
  340. package/dist/factories/contracts/MerkleTreeManager__factory.js +67 -0
  341. package/dist/factories/contracts/MerkleTreeManager__factory.js.map +1 -0
  342. package/dist/factories/contracts/Outbox__factory.d.ts +59 -0
  343. package/dist/factories/contracts/Outbox__factory.d.ts.map +1 -0
  344. package/dist/factories/contracts/Outbox__factory.js +415 -0
  345. package/dist/factories/contracts/Outbox__factory.js.map +1 -0
  346. package/dist/factories/contracts/index.d.ts +12 -0
  347. package/dist/factories/contracts/index.d.ts.map +1 -0
  348. package/dist/factories/contracts/index.js +48 -0
  349. package/dist/factories/contracts/index.js.map +1 -0
  350. package/dist/factories/contracts/mock/MockInbox__factory.d.ts +31 -0
  351. package/dist/factories/contracts/mock/MockInbox__factory.d.ts.map +1 -0
  352. package/dist/factories/contracts/mock/MockInbox__factory.js +76 -0
  353. package/dist/factories/contracts/mock/MockInbox__factory.js.map +1 -0
  354. package/dist/factories/contracts/mock/MockOutbox__factory.d.ts +45 -0
  355. package/dist/factories/contracts/mock/MockOutbox__factory.d.ts.map +1 -0
  356. package/dist/factories/contracts/mock/MockOutbox__factory.js +86 -0
  357. package/dist/factories/contracts/mock/MockOutbox__factory.js.map +1 -0
  358. package/dist/factories/contracts/mock/index.d.ts +3 -0
  359. package/dist/factories/contracts/mock/index.d.ts.map +1 -0
  360. package/dist/factories/contracts/mock/index.js +11 -0
  361. package/dist/factories/contracts/mock/index.js.map +1 -0
  362. package/dist/factories/contracts/test/MysteryMathV1__factory.d.ts +41 -0
  363. package/dist/factories/contracts/test/MysteryMathV1__factory.d.ts.map +1 -0
  364. package/dist/factories/contracts/test/MysteryMathV1__factory.js +122 -0
  365. package/dist/factories/contracts/test/MysteryMathV1__factory.js.map +1 -0
  366. package/dist/factories/contracts/test/MysteryMathV2__factory.d.ts +41 -0
  367. package/dist/factories/contracts/test/MysteryMathV2__factory.d.ts.map +1 -0
  368. package/dist/factories/contracts/test/MysteryMathV2__factory.js +122 -0
  369. package/dist/factories/contracts/test/MysteryMathV2__factory.js.map +1 -0
  370. package/dist/factories/contracts/test/MysteryMath__factory.d.ts +23 -0
  371. package/dist/factories/contracts/test/MysteryMath__factory.d.ts.map +1 -0
  372. package/dist/factories/contracts/test/MysteryMath__factory.js +81 -0
  373. package/dist/factories/contracts/test/MysteryMath__factory.js.map +1 -0
  374. package/dist/factories/contracts/test/TestInbox__factory.d.ts +59 -0
  375. package/dist/factories/contracts/test/TestInbox__factory.d.ts.map +1 -0
  376. package/dist/factories/contracts/test/TestInbox__factory.js +371 -0
  377. package/dist/factories/contracts/test/TestInbox__factory.js.map +1 -0
  378. package/dist/factories/contracts/test/TestMailbox__factory.d.ts +66 -0
  379. package/dist/factories/contracts/test/TestMailbox__factory.d.ts.map +1 -0
  380. package/dist/factories/contracts/test/TestMailbox__factory.js +182 -0
  381. package/dist/factories/contracts/test/TestMailbox__factory.js.map +1 -0
  382. package/dist/factories/contracts/test/TestMerkle__factory.d.ts +41 -0
  383. package/dist/factories/contracts/test/TestMerkle__factory.d.ts.map +1 -0
  384. package/dist/factories/contracts/test/TestMerkle__factory.js +127 -0
  385. package/dist/factories/contracts/test/TestMerkle__factory.js.map +1 -0
  386. package/dist/factories/contracts/test/TestMessage__factory.d.ts +35 -0
  387. package/dist/factories/contracts/test/TestMessage__factory.d.ts.map +1 -0
  388. package/dist/factories/contracts/test/TestMessage__factory.js +179 -0
  389. package/dist/factories/contracts/test/TestMessage__factory.js.map +1 -0
  390. package/dist/factories/contracts/test/TestMultisigValidatorManager__factory.d.ts +59 -0
  391. package/dist/factories/contracts/test/TestMultisigValidatorManager__factory.d.ts.map +1 -0
  392. package/dist/factories/contracts/test/TestMultisigValidatorManager__factory.js +349 -0
  393. package/dist/factories/contracts/test/TestMultisigValidatorManager__factory.js.map +1 -0
  394. package/dist/factories/contracts/test/TestOutbox__factory.d.ts +59 -0
  395. package/dist/factories/contracts/test/TestOutbox__factory.d.ts.map +1 -0
  396. package/dist/factories/contracts/test/TestOutbox__factory.js +483 -0
  397. package/dist/factories/contracts/test/TestOutbox__factory.js.map +1 -0
  398. package/dist/factories/contracts/test/TestRecipient__factory.d.ts +55 -0
  399. package/dist/factories/contracts/test/TestRecipient__factory.d.ts.map +1 -0
  400. package/dist/factories/contracts/test/TestRecipient__factory.js +184 -0
  401. package/dist/factories/contracts/test/TestRecipient__factory.js.map +1 -0
  402. package/dist/factories/contracts/test/TestSendReceiver__factory.d.ts +44 -0
  403. package/dist/factories/contracts/test/TestSendReceiver__factory.d.ts.map +1 -0
  404. package/dist/factories/contracts/test/TestSendReceiver__factory.js +105 -0
  405. package/dist/factories/contracts/test/TestSendReceiver__factory.js.map +1 -0
  406. package/dist/factories/contracts/test/TestValidatorManager__factory.d.ts +31 -0
  407. package/dist/factories/contracts/test/TestValidatorManager__factory.d.ts.map +1 -0
  408. package/dist/factories/contracts/test/TestValidatorManager__factory.js +79 -0
  409. package/dist/factories/contracts/test/TestValidatorManager__factory.js.map +1 -0
  410. package/dist/factories/contracts/test/bad-recipient/BadRecipient1__factory.d.ts +31 -0
  411. package/dist/factories/contracts/test/bad-recipient/BadRecipient1__factory.d.ts.map +1 -0
  412. package/dist/factories/contracts/test/bad-recipient/BadRecipient1__factory.js +64 -0
  413. package/dist/factories/contracts/test/bad-recipient/BadRecipient1__factory.js.map +1 -0
  414. package/dist/factories/contracts/test/bad-recipient/BadRecipient2__factory.d.ts +31 -0
  415. package/dist/factories/contracts/test/bad-recipient/BadRecipient2__factory.d.ts.map +1 -0
  416. package/dist/factories/contracts/test/bad-recipient/BadRecipient2__factory.js +59 -0
  417. package/dist/factories/contracts/test/bad-recipient/BadRecipient2__factory.js.map +1 -0
  418. package/dist/factories/contracts/test/bad-recipient/BadRecipient3__factory.d.ts +31 -0
  419. package/dist/factories/contracts/test/bad-recipient/BadRecipient3__factory.d.ts.map +1 -0
  420. package/dist/factories/contracts/test/bad-recipient/BadRecipient3__factory.js +64 -0
  421. package/dist/factories/contracts/test/bad-recipient/BadRecipient3__factory.js.map +1 -0
  422. package/dist/factories/contracts/test/bad-recipient/BadRecipient5__factory.d.ts +31 -0
  423. package/dist/factories/contracts/test/bad-recipient/BadRecipient5__factory.d.ts.map +1 -0
  424. package/dist/factories/contracts/test/bad-recipient/BadRecipient5__factory.js +64 -0
  425. package/dist/factories/contracts/test/bad-recipient/BadRecipient5__factory.js.map +1 -0
  426. package/dist/factories/contracts/test/bad-recipient/BadRecipient6__factory.d.ts +31 -0
  427. package/dist/factories/contracts/test/bad-recipient/BadRecipient6__factory.d.ts.map +1 -0
  428. package/dist/factories/contracts/test/bad-recipient/BadRecipient6__factory.js +64 -0
  429. package/dist/factories/contracts/test/bad-recipient/BadRecipient6__factory.js.map +1 -0
  430. package/dist/factories/contracts/test/bad-recipient/index.d.ts +6 -0
  431. package/dist/factories/contracts/test/bad-recipient/index.d.ts.map +1 -0
  432. package/dist/factories/contracts/test/bad-recipient/index.js +17 -0
  433. package/dist/factories/contracts/test/bad-recipient/index.js.map +1 -0
  434. package/dist/factories/contracts/test/index.d.ts +14 -0
  435. package/dist/factories/contracts/test/index.d.ts.map +1 -0
  436. package/dist/factories/contracts/test/index.js +55 -0
  437. package/dist/factories/contracts/test/index.js.map +1 -0
  438. package/dist/factories/contracts/upgrade/UpgradeBeaconController__factory.d.ts +55 -0
  439. package/dist/factories/contracts/upgrade/UpgradeBeaconController__factory.d.ts.map +1 -0
  440. package/dist/factories/contracts/upgrade/UpgradeBeaconController__factory.js +130 -0
  441. package/dist/factories/contracts/upgrade/UpgradeBeaconController__factory.js.map +1 -0
  442. package/dist/factories/contracts/upgrade/UpgradeBeaconProxy__factory.d.ts +33 -0
  443. package/dist/factories/contracts/upgrade/UpgradeBeaconProxy__factory.d.ts.map +1 -0
  444. package/dist/factories/contracts/upgrade/UpgradeBeaconProxy__factory.js +65 -0
  445. package/dist/factories/contracts/upgrade/UpgradeBeaconProxy__factory.js.map +1 -0
  446. package/dist/factories/contracts/upgrade/UpgradeBeacon__factory.d.ts +48 -0
  447. package/dist/factories/contracts/upgrade/UpgradeBeacon__factory.d.ts.map +1 -0
  448. package/dist/factories/contracts/upgrade/UpgradeBeacon__factory.js +74 -0
  449. package/dist/factories/contracts/upgrade/UpgradeBeacon__factory.js.map +1 -0
  450. package/dist/factories/contracts/upgrade/Versioned__factory.d.ts +31 -0
  451. package/dist/factories/contracts/upgrade/Versioned__factory.d.ts.map +1 -0
  452. package/dist/factories/contracts/upgrade/Versioned__factory.js +54 -0
  453. package/dist/factories/contracts/upgrade/Versioned__factory.js.map +1 -0
  454. package/dist/factories/contracts/upgrade/index.d.ts +5 -0
  455. package/dist/factories/contracts/upgrade/index.d.ts.map +1 -0
  456. package/dist/factories/contracts/upgrade/index.js +15 -0
  457. package/dist/factories/contracts/upgrade/index.js.map +1 -0
  458. package/dist/factories/contracts/validator-manager/InboxValidatorManager__factory.d.ts +59 -0
  459. package/dist/factories/contracts/validator-manager/InboxValidatorManager__factory.d.ts.map +1 -0
  460. package/dist/factories/contracts/validator-manager/InboxValidatorManager__factory.js +373 -0
  461. package/dist/factories/contracts/validator-manager/InboxValidatorManager__factory.js.map +1 -0
  462. package/dist/factories/contracts/validator-manager/MultisigValidatorManager__factory.d.ts +36 -0
  463. package/dist/factories/contracts/validator-manager/MultisigValidatorManager__factory.d.ts.map +1 -0
  464. package/dist/factories/contracts/validator-manager/MultisigValidatorManager__factory.js +286 -0
  465. package/dist/factories/contracts/validator-manager/MultisigValidatorManager__factory.js.map +1 -0
  466. package/dist/factories/contracts/validator-manager/OutboxValidatorManager__factory.d.ts +59 -0
  467. package/dist/factories/contracts/validator-manager/OutboxValidatorManager__factory.d.ts.map +1 -0
  468. package/dist/factories/contracts/validator-manager/OutboxValidatorManager__factory.js +560 -0
  469. package/dist/factories/contracts/validator-manager/OutboxValidatorManager__factory.js.map +1 -0
  470. package/dist/factories/contracts/validator-manager/index.d.ts +4 -0
  471. package/dist/factories/contracts/validator-manager/index.d.ts.map +1 -0
  472. package/dist/factories/contracts/validator-manager/index.js +13 -0
  473. package/dist/factories/contracts/validator-manager/index.js.map +1 -0
  474. package/dist/factories/index.d.ts +4 -0
  475. package/dist/factories/index.d.ts.map +1 -0
  476. package/dist/factories/index.js +33 -0
  477. package/dist/factories/index.js.map +1 -0
  478. package/dist/factories/interfaces/IAbacusConnectionManager__factory.d.ts +23 -0
  479. package/dist/factories/interfaces/IAbacusConnectionManager__factory.d.ts.map +1 -0
  480. package/dist/factories/interfaces/IAbacusConnectionManager__factory.js +63 -0
  481. package/dist/factories/interfaces/IAbacusConnectionManager__factory.js.map +1 -0
  482. package/dist/factories/interfaces/IInbox__factory.d.ts +29 -0
  483. package/dist/factories/interfaces/IInbox__factory.d.ts.map +1 -0
  484. package/dist/factories/interfaces/IInbox__factory.js +90 -0
  485. package/dist/factories/interfaces/IInbox__factory.js.map +1 -0
  486. package/dist/factories/interfaces/IInterchainGasPaymaster__factory.d.ts +19 -0
  487. package/dist/factories/interfaces/IInterchainGasPaymaster__factory.d.ts.map +1 -0
  488. package/dist/factories/interfaces/IInterchainGasPaymaster__factory.js +41 -0
  489. package/dist/factories/interfaces/IInterchainGasPaymaster__factory.js.map +1 -0
  490. package/dist/factories/interfaces/IMailbox__factory.d.ts +19 -0
  491. package/dist/factories/interfaces/IMailbox__factory.d.ts.map +1 -0
  492. package/dist/factories/interfaces/IMailbox__factory.js +44 -0
  493. package/dist/factories/interfaces/IMailbox__factory.js.map +1 -0
  494. package/dist/factories/interfaces/IMessageRecipient__factory.d.ts +19 -0
  495. package/dist/factories/interfaces/IMessageRecipient__factory.d.ts.map +1 -0
  496. package/dist/factories/interfaces/IMessageRecipient__factory.js +41 -0
  497. package/dist/factories/interfaces/IMessageRecipient__factory.js.map +1 -0
  498. package/dist/factories/interfaces/IMultisigValidatorManager__factory.d.ts +19 -0
  499. package/dist/factories/interfaces/IMultisigValidatorManager__factory.d.ts.map +1 -0
  500. package/dist/factories/interfaces/IMultisigValidatorManager__factory.js +57 -0
  501. package/dist/factories/interfaces/IMultisigValidatorManager__factory.js.map +1 -0
  502. package/dist/factories/interfaces/IOutbox__factory.d.ts +23 -0
  503. package/dist/factories/interfaces/IOutbox__factory.d.ts.map +1 -0
  504. package/dist/factories/interfaces/IOutbox__factory.js +155 -0
  505. package/dist/factories/interfaces/IOutbox__factory.js.map +1 -0
  506. package/dist/factories/interfaces/index.d.ts +8 -0
  507. package/dist/factories/interfaces/index.d.ts.map +1 -0
  508. package/dist/factories/interfaces/index.js +21 -0
  509. package/dist/factories/interfaces/index.js.map +1 -0
  510. package/dist/index.d.ts +98 -0
  511. package/dist/index.d.ts.map +1 -0
  512. package/dist/index.js +119 -0
  513. package/dist/index.js.map +1 -0
  514. package/dist/interfaces/IAbacusConnectionManager.d.ts +59 -0
  515. package/dist/interfaces/IAbacusConnectionManager.d.ts.map +1 -0
  516. package/dist/interfaces/IAbacusConnectionManager.js +4 -0
  517. package/dist/interfaces/IAbacusConnectionManager.js.map +1 -0
  518. package/dist/interfaces/IInbox.d.ts +83 -0
  519. package/dist/interfaces/IInbox.d.ts.map +1 -0
  520. package/dist/interfaces/IInbox.js +4 -0
  521. package/dist/interfaces/IInbox.js.map +1 -0
  522. package/dist/interfaces/IInterchainGasPaymaster.d.ts +51 -0
  523. package/dist/interfaces/IInterchainGasPaymaster.d.ts.map +1 -0
  524. package/dist/interfaces/IInterchainGasPaymaster.js +4 -0
  525. package/dist/interfaces/IInterchainGasPaymaster.js.map +1 -0
  526. package/dist/interfaces/IMailbox.d.ts +51 -0
  527. package/dist/interfaces/IMailbox.d.ts.map +1 -0
  528. package/dist/interfaces/IMailbox.js +4 -0
  529. package/dist/interfaces/IMailbox.js.map +1 -0
  530. package/dist/interfaces/IMessageRecipient.d.ts +51 -0
  531. package/dist/interfaces/IMessageRecipient.d.ts.map +1 -0
  532. package/dist/interfaces/IMessageRecipient.js +4 -0
  533. package/dist/interfaces/IMessageRecipient.js.map +1 -0
  534. package/dist/interfaces/IMultisigValidatorManager.d.ts +59 -0
  535. package/dist/interfaces/IMultisigValidatorManager.d.ts.map +1 -0
  536. package/dist/interfaces/IMultisigValidatorManager.js +4 -0
  537. package/dist/interfaces/IMultisigValidatorManager.js.map +1 -0
  538. package/dist/interfaces/IOutbox.d.ts +148 -0
  539. package/dist/interfaces/IOutbox.d.ts.map +1 -0
  540. package/dist/interfaces/IOutbox.js +4 -0
  541. package/dist/interfaces/IOutbox.js.map +1 -0
  542. package/dist/interfaces/index.d.ts +8 -0
  543. package/dist/interfaces/index.d.ts.map +1 -0
  544. package/dist/interfaces/index.js +3 -0
  545. package/dist/interfaces/index.js.map +1 -0
  546. package/interfaces/IAbacusConnectionManager.sol +12 -0
  547. package/interfaces/IInbox.sol +16 -0
  548. package/interfaces/IInterchainGasPaymaster.sol +15 -0
  549. package/interfaces/IMailbox.sol +8 -0
  550. package/interfaces/IMessageRecipient.sol +10 -0
  551. package/interfaces/IMultisigValidatorManager.sol +11 -0
  552. package/interfaces/IOutbox.sol +27 -0
  553. package/package.json +53 -0
@@ -0,0 +1,191 @@
1
+ // SPDX-License-Identifier: MIT OR Apache-2.0
2
+ pragma solidity >=0.8.0;
3
+
4
+ // ============ Internal Imports ============
5
+ import {Versioned} from "./upgrade/Versioned.sol";
6
+ import {Mailbox} from "./Mailbox.sol";
7
+ import {MerkleLib} from "./libs/Merkle.sol";
8
+ import {Message} from "./libs/Message.sol";
9
+ import {TypeCasts} from "./libs/TypeCasts.sol";
10
+ import {MerkleTreeManager} from "./MerkleTreeManager.sol";
11
+ import {IOutbox} from "../interfaces/IOutbox.sol";
12
+
13
+ /**
14
+ * @title Outbox
15
+ * @author Celo Labs Inc.
16
+ * @notice Accepts messages to be dispatched to remote chains,
17
+ * constructs a Merkle tree of the messages,
18
+ * and accepts signatures from a bonded Validator
19
+ * which notarize the Merkle tree roots.
20
+ * Accepts submissions of fraudulent signatures
21
+ * by the Validator and slashes the Validator in this case.
22
+ */
23
+ contract Outbox is IOutbox, Versioned, MerkleTreeManager, Mailbox {
24
+ // ============ Libraries ============
25
+
26
+ using MerkleLib for MerkleLib.Tree;
27
+ using TypeCasts for address;
28
+
29
+ // ============ Constants ============
30
+
31
+ // Maximum bytes per message = 2 KiB
32
+ // (somewhat arbitrarily set to begin)
33
+ uint256 public constant MAX_MESSAGE_BODY_BYTES = 2 * 2**10;
34
+
35
+ // ============ Enums ============
36
+
37
+ // States:
38
+ // 0 - UnInitialized - before initialize function is called
39
+ // note: the contract is initialized at deploy time, so it should never be in this state
40
+ // 1 - Active - as long as the contract has not become fraudulent
41
+ // 2 - Failed - after a valid fraud proof has been submitted;
42
+ // contract will no longer accept updates or new messages
43
+ enum States {
44
+ UnInitialized,
45
+ Active,
46
+ Failed
47
+ }
48
+
49
+ // ============ Public Storage Variables ============
50
+
51
+ // Cached checkpoints, mapping root => leaf index.
52
+ // Cached checkpoints must have index > 0 as the presence of such
53
+ // a checkpoint cannot be distinguished from its absence.
54
+ mapping(bytes32 => uint256) public cachedCheckpoints;
55
+ // The latest cached root
56
+ bytes32 public latestCachedRoot;
57
+ // Current state of contract
58
+ States public state;
59
+
60
+ // ============ Upgrade Gap ============
61
+
62
+ // gap for upgrade safety
63
+ uint256[47] private __GAP;
64
+
65
+ // ============ Events ============
66
+
67
+ /**
68
+ * @notice Emitted when a checkpoint is cached.
69
+ * @param root Merkle root
70
+ * @param index Leaf index
71
+ */
72
+ event CheckpointCached(bytes32 indexed root, uint256 indexed index);
73
+
74
+ /**
75
+ * @notice Emitted when a new message is dispatched via Abacus
76
+ * @param leafIndex Index of message's leaf in merkle tree
77
+ * @param message Raw bytes of message
78
+ */
79
+ event Dispatch(uint256 indexed leafIndex, bytes message);
80
+
81
+ event Fail();
82
+
83
+ // ============ Constructor ============
84
+
85
+ constructor(uint32 _localDomain) Mailbox(_localDomain) {} // solhint-disable-line no-empty-blocks
86
+
87
+ // ============ Initializer ============
88
+
89
+ function initialize(address _validatorManager) external initializer {
90
+ __Mailbox_initialize(_validatorManager);
91
+ state = States.Active;
92
+ }
93
+
94
+ // ============ Modifiers ============
95
+
96
+ /**
97
+ * @notice Ensures that contract state != FAILED when the function is called
98
+ */
99
+ modifier notFailed() {
100
+ require(state != States.Failed, "failed state");
101
+ _;
102
+ }
103
+
104
+ // ============ External Functions ============
105
+
106
+ /**
107
+ * @notice Dispatch the message it to the destination domain & recipient
108
+ * @dev Format the message, insert its hash into Merkle tree,
109
+ * and emit `Dispatch` event with message information.
110
+ * @param _destinationDomain Domain of destination chain
111
+ * @param _recipientAddress Address of recipient on destination chain as bytes32
112
+ * @param _messageBody Raw bytes content of message
113
+ * @return The leaf index of the dispatched message's hash in the Merkle tree.
114
+ */
115
+ function dispatch(
116
+ uint32 _destinationDomain,
117
+ bytes32 _recipientAddress,
118
+ bytes calldata _messageBody
119
+ ) external override notFailed returns (uint256) {
120
+ require(_messageBody.length <= MAX_MESSAGE_BODY_BYTES, "msg too long");
121
+ // The leaf has not been inserted yet at this point
122
+ uint256 _leafIndex = count();
123
+ // format the message into packed bytes
124
+ bytes memory _message = Message.formatMessage(
125
+ localDomain,
126
+ msg.sender.addressToBytes32(),
127
+ _destinationDomain,
128
+ _recipientAddress,
129
+ _messageBody
130
+ );
131
+ // insert the hashed message into the Merkle tree
132
+ bytes32 _messageHash = keccak256(
133
+ abi.encodePacked(_message, _leafIndex)
134
+ );
135
+ tree.insert(_messageHash);
136
+ emit Dispatch(_leafIndex, _message);
137
+ return _leafIndex;
138
+ }
139
+
140
+ /**
141
+ * @notice Caches the current merkle root and index.
142
+ * @dev emits CheckpointCached event
143
+ */
144
+ function cacheCheckpoint() external override notFailed {
145
+ (bytes32 _root, uint256 _index) = latestCheckpoint();
146
+ require(_index > 0, "!index");
147
+ cachedCheckpoints[_root] = _index;
148
+ latestCachedRoot = _root;
149
+ emit CheckpointCached(_root, _index);
150
+ }
151
+
152
+ /**
153
+ * @notice Set contract state to FAILED.
154
+ * @dev Called by the validator manager when fraud is proven.
155
+ */
156
+ function fail() external override onlyValidatorManager {
157
+ // set contract to FAILED
158
+ state = States.Failed;
159
+ emit Fail();
160
+ }
161
+
162
+ /**
163
+ * @notice Returns the latest entry in the checkpoint cache.
164
+ * @return root Latest cached root
165
+ * @return index Latest cached index
166
+ */
167
+ function latestCachedCheckpoint()
168
+ external
169
+ view
170
+ returns (bytes32 root, uint256 index)
171
+ {
172
+ root = latestCachedRoot;
173
+ index = cachedCheckpoints[root];
174
+ }
175
+
176
+ /**
177
+ * @notice Returns the number of inserted leaves in the tree
178
+ */
179
+ function count() public view returns (uint256) {
180
+ return tree.count;
181
+ }
182
+
183
+ /**
184
+ * @notice Returns a checkpoint representing the current merkle tree.
185
+ * @return root The root of the Outbox's merkle tree.
186
+ * @return index The index of the last element in the tree.
187
+ */
188
+ function latestCheckpoint() public view returns (bytes32, uint256) {
189
+ return (root(), count() - 1);
190
+ }
191
+ }
@@ -0,0 +1,208 @@
1
+ // SPDX-License-Identifier: MIT OR Apache-2.0
2
+ pragma solidity >=0.6.11;
3
+
4
+ // work based on eth2 deposit contract, which is used under CC0-1.0
5
+
6
+ /**
7
+ * @title MerkleLib
8
+ * @author Celo Labs Inc.
9
+ * @notice An incremental merkle tree modeled on the eth2 deposit contract.
10
+ **/
11
+ library MerkleLib {
12
+ uint256 internal constant TREE_DEPTH = 32;
13
+ uint256 internal constant MAX_LEAVES = 2**TREE_DEPTH - 1;
14
+
15
+ /**
16
+ * @notice Struct representing incremental merkle tree. Contains current
17
+ * branch and the number of inserted leaves in the tree.
18
+ **/
19
+ struct Tree {
20
+ bytes32[TREE_DEPTH] branch;
21
+ uint256 count;
22
+ }
23
+
24
+ /**
25
+ * @notice Inserts `_node` into merkle tree
26
+ * @dev Reverts if tree is full
27
+ * @param _node Element to insert into tree
28
+ **/
29
+ function insert(Tree storage _tree, bytes32 _node) internal {
30
+ require(_tree.count < MAX_LEAVES, "merkle tree full");
31
+
32
+ _tree.count += 1;
33
+ uint256 size = _tree.count;
34
+ for (uint256 i = 0; i < TREE_DEPTH; i++) {
35
+ if ((size & 1) == 1) {
36
+ _tree.branch[i] = _node;
37
+ return;
38
+ }
39
+ _node = keccak256(abi.encodePacked(_tree.branch[i], _node));
40
+ size /= 2;
41
+ }
42
+ // As the loop should always end prematurely with the `return` statement,
43
+ // this code should be unreachable. We assert `false` just to be safe.
44
+ assert(false);
45
+ }
46
+
47
+ /**
48
+ * @notice Calculates and returns`_tree`'s current root given array of zero
49
+ * hashes
50
+ * @param _zeroes Array of zero hashes
51
+ * @return _current Calculated root of `_tree`
52
+ **/
53
+ function rootWithCtx(Tree storage _tree, bytes32[TREE_DEPTH] memory _zeroes)
54
+ internal
55
+ view
56
+ returns (bytes32 _current)
57
+ {
58
+ uint256 _index = _tree.count;
59
+
60
+ for (uint256 i = 0; i < TREE_DEPTH; i++) {
61
+ uint256 _ithBit = (_index >> i) & 0x01;
62
+ bytes32 _next = _tree.branch[i];
63
+ if (_ithBit == 1) {
64
+ _current = keccak256(abi.encodePacked(_next, _current));
65
+ } else {
66
+ _current = keccak256(abi.encodePacked(_current, _zeroes[i]));
67
+ }
68
+ }
69
+ }
70
+
71
+ /// @notice Calculates and returns`_tree`'s current root
72
+ function root(Tree storage _tree) internal view returns (bytes32) {
73
+ return rootWithCtx(_tree, zeroHashes());
74
+ }
75
+
76
+ /// @notice Returns array of TREE_DEPTH zero hashes
77
+ /// @return _zeroes Array of TREE_DEPTH zero hashes
78
+ function zeroHashes()
79
+ internal
80
+ pure
81
+ returns (bytes32[TREE_DEPTH] memory _zeroes)
82
+ {
83
+ _zeroes[0] = Z_0;
84
+ _zeroes[1] = Z_1;
85
+ _zeroes[2] = Z_2;
86
+ _zeroes[3] = Z_3;
87
+ _zeroes[4] = Z_4;
88
+ _zeroes[5] = Z_5;
89
+ _zeroes[6] = Z_6;
90
+ _zeroes[7] = Z_7;
91
+ _zeroes[8] = Z_8;
92
+ _zeroes[9] = Z_9;
93
+ _zeroes[10] = Z_10;
94
+ _zeroes[11] = Z_11;
95
+ _zeroes[12] = Z_12;
96
+ _zeroes[13] = Z_13;
97
+ _zeroes[14] = Z_14;
98
+ _zeroes[15] = Z_15;
99
+ _zeroes[16] = Z_16;
100
+ _zeroes[17] = Z_17;
101
+ _zeroes[18] = Z_18;
102
+ _zeroes[19] = Z_19;
103
+ _zeroes[20] = Z_20;
104
+ _zeroes[21] = Z_21;
105
+ _zeroes[22] = Z_22;
106
+ _zeroes[23] = Z_23;
107
+ _zeroes[24] = Z_24;
108
+ _zeroes[25] = Z_25;
109
+ _zeroes[26] = Z_26;
110
+ _zeroes[27] = Z_27;
111
+ _zeroes[28] = Z_28;
112
+ _zeroes[29] = Z_29;
113
+ _zeroes[30] = Z_30;
114
+ _zeroes[31] = Z_31;
115
+ }
116
+
117
+ /**
118
+ * @notice Calculates and returns the merkle root for the given leaf
119
+ * `_item`, a merkle branch, and the index of `_item` in the tree.
120
+ * @param _item Merkle leaf
121
+ * @param _branch Merkle proof
122
+ * @param _index Index of `_item` in tree
123
+ * @return _current Calculated merkle root
124
+ **/
125
+ function branchRoot(
126
+ bytes32 _item,
127
+ bytes32[TREE_DEPTH] memory _branch,
128
+ uint256 _index
129
+ ) internal pure returns (bytes32 _current) {
130
+ _current = _item;
131
+
132
+ for (uint256 i = 0; i < TREE_DEPTH; i++) {
133
+ uint256 _ithBit = (_index >> i) & 0x01;
134
+ bytes32 _next = _branch[i];
135
+ if (_ithBit == 1) {
136
+ _current = keccak256(abi.encodePacked(_next, _current));
137
+ } else {
138
+ _current = keccak256(abi.encodePacked(_current, _next));
139
+ }
140
+ }
141
+ }
142
+
143
+ // keccak256 zero hashes
144
+ bytes32 internal constant Z_0 =
145
+ hex"0000000000000000000000000000000000000000000000000000000000000000";
146
+ bytes32 internal constant Z_1 =
147
+ hex"ad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5";
148
+ bytes32 internal constant Z_2 =
149
+ hex"b4c11951957c6f8f642c4af61cd6b24640fec6dc7fc607ee8206a99e92410d30";
150
+ bytes32 internal constant Z_3 =
151
+ hex"21ddb9a356815c3fac1026b6dec5df3124afbadb485c9ba5a3e3398a04b7ba85";
152
+ bytes32 internal constant Z_4 =
153
+ hex"e58769b32a1beaf1ea27375a44095a0d1fb664ce2dd358e7fcbfb78c26a19344";
154
+ bytes32 internal constant Z_5 =
155
+ hex"0eb01ebfc9ed27500cd4dfc979272d1f0913cc9f66540d7e8005811109e1cf2d";
156
+ bytes32 internal constant Z_6 =
157
+ hex"887c22bd8750d34016ac3c66b5ff102dacdd73f6b014e710b51e8022af9a1968";
158
+ bytes32 internal constant Z_7 =
159
+ hex"ffd70157e48063fc33c97a050f7f640233bf646cc98d9524c6b92bcf3ab56f83";
160
+ bytes32 internal constant Z_8 =
161
+ hex"9867cc5f7f196b93bae1e27e6320742445d290f2263827498b54fec539f756af";
162
+ bytes32 internal constant Z_9 =
163
+ hex"cefad4e508c098b9a7e1d8feb19955fb02ba9675585078710969d3440f5054e0";
164
+ bytes32 internal constant Z_10 =
165
+ hex"f9dc3e7fe016e050eff260334f18a5d4fe391d82092319f5964f2e2eb7c1c3a5";
166
+ bytes32 internal constant Z_11 =
167
+ hex"f8b13a49e282f609c317a833fb8d976d11517c571d1221a265d25af778ecf892";
168
+ bytes32 internal constant Z_12 =
169
+ hex"3490c6ceeb450aecdc82e28293031d10c7d73bf85e57bf041a97360aa2c5d99c";
170
+ bytes32 internal constant Z_13 =
171
+ hex"c1df82d9c4b87413eae2ef048f94b4d3554cea73d92b0f7af96e0271c691e2bb";
172
+ bytes32 internal constant Z_14 =
173
+ hex"5c67add7c6caf302256adedf7ab114da0acfe870d449a3a489f781d659e8becc";
174
+ bytes32 internal constant Z_15 =
175
+ hex"da7bce9f4e8618b6bd2f4132ce798cdc7a60e7e1460a7299e3c6342a579626d2";
176
+ bytes32 internal constant Z_16 =
177
+ hex"2733e50f526ec2fa19a22b31e8ed50f23cd1fdf94c9154ed3a7609a2f1ff981f";
178
+ bytes32 internal constant Z_17 =
179
+ hex"e1d3b5c807b281e4683cc6d6315cf95b9ade8641defcb32372f1c126e398ef7a";
180
+ bytes32 internal constant Z_18 =
181
+ hex"5a2dce0a8a7f68bb74560f8f71837c2c2ebbcbf7fffb42ae1896f13f7c7479a0";
182
+ bytes32 internal constant Z_19 =
183
+ hex"b46a28b6f55540f89444f63de0378e3d121be09e06cc9ded1c20e65876d36aa0";
184
+ bytes32 internal constant Z_20 =
185
+ hex"c65e9645644786b620e2dd2ad648ddfcbf4a7e5b1a3a4ecfe7f64667a3f0b7e2";
186
+ bytes32 internal constant Z_21 =
187
+ hex"f4418588ed35a2458cffeb39b93d26f18d2ab13bdce6aee58e7b99359ec2dfd9";
188
+ bytes32 internal constant Z_22 =
189
+ hex"5a9c16dc00d6ef18b7933a6f8dc65ccb55667138776f7dea101070dc8796e377";
190
+ bytes32 internal constant Z_23 =
191
+ hex"4df84f40ae0c8229d0d6069e5c8f39a7c299677a09d367fc7b05e3bc380ee652";
192
+ bytes32 internal constant Z_24 =
193
+ hex"cdc72595f74c7b1043d0e1ffbab734648c838dfb0527d971b602bc216c9619ef";
194
+ bytes32 internal constant Z_25 =
195
+ hex"0abf5ac974a1ed57f4050aa510dd9c74f508277b39d7973bb2dfccc5eeb0618d";
196
+ bytes32 internal constant Z_26 =
197
+ hex"b8cd74046ff337f0a7bf2c8e03e10f642c1886798d71806ab1e888d9e5ee87d0";
198
+ bytes32 internal constant Z_27 =
199
+ hex"838c5655cb21c6cb83313b5a631175dff4963772cce9108188b34ac87c81c41e";
200
+ bytes32 internal constant Z_28 =
201
+ hex"662ee4dd2dd7b2bc707961b1e646c4047669dcb6584f0d8d770daf5d7e7deb2e";
202
+ bytes32 internal constant Z_29 =
203
+ hex"388ab20e2573d171a88108e79d820e98f26c0b84aa8b2f4aa4968dbb818ea322";
204
+ bytes32 internal constant Z_30 =
205
+ hex"93237c50ba75ee485f4c22adf2f741400bdf8d6a9cc7df7ecae576221665d735";
206
+ bytes32 internal constant Z_31 =
207
+ hex"8448818bb4ae4562849e949e17ac16e0be16688e156b5cf15e098c627c0056a9";
208
+ }
@@ -0,0 +1,122 @@
1
+ // SPDX-License-Identifier: MIT OR Apache-2.0
2
+ pragma solidity >=0.8.0;
3
+
4
+ import {TypeCasts} from "./TypeCasts.sol";
5
+
6
+ /**
7
+ * @title Message Library
8
+ * @author Celo Labs Inc.
9
+ * @notice Library for formatted messages used by Outbox and Replica.
10
+ **/
11
+ library Message {
12
+ using TypeCasts for bytes32;
13
+
14
+ /**
15
+ * @notice Returns formatted (packed) message with provided fields
16
+ * @dev This function should only be used in memory message construction.
17
+ * @param _originDomain Domain of home chain
18
+ * @param _sender Address of sender as bytes32
19
+ * @param _destinationDomain Domain of destination chain
20
+ * @param _recipient Address of recipient on destination chain as bytes32
21
+ * @param _messageBody Raw bytes of message body
22
+ * @return Formatted message
23
+ **/
24
+ function formatMessage(
25
+ uint32 _originDomain,
26
+ bytes32 _sender,
27
+ uint32 _destinationDomain,
28
+ bytes32 _recipient,
29
+ bytes calldata _messageBody
30
+ ) internal pure returns (bytes memory) {
31
+ return
32
+ abi.encodePacked(
33
+ _originDomain,
34
+ _sender,
35
+ _destinationDomain,
36
+ _recipient,
37
+ _messageBody
38
+ );
39
+ }
40
+
41
+ /**
42
+ * @notice Returns leaf of formatted message with provided fields.
43
+ * @dev hash of abi packed message and leaf index.
44
+ * @param _message Raw bytes of message contents.
45
+ * @param _leafIndex Index of the message in the tree
46
+ * @return Leaf (hash) of formatted message
47
+ */
48
+ function leaf(bytes calldata _message, uint256 _leafIndex)
49
+ internal
50
+ pure
51
+ returns (bytes32)
52
+ {
53
+ return keccak256(abi.encodePacked(_message, _leafIndex));
54
+ }
55
+
56
+ /**
57
+ * @notice Decode raw message bytes into structured message fields.
58
+ * @dev Efficiently slices calldata into structured message fields.
59
+ * @param _message Raw bytes of message contents.
60
+ * @return origin Domain of home chain
61
+ * @return sender Address of sender as bytes32
62
+ * @return destination Domain of destination chain
63
+ * @return recipient Address of recipient on destination chain as bytes32
64
+ * @return body Raw bytes of message body
65
+ */
66
+ function destructure(bytes calldata _message)
67
+ internal
68
+ pure
69
+ returns (
70
+ uint32 origin,
71
+ bytes32 sender,
72
+ uint32 destination,
73
+ bytes32 recipient,
74
+ bytes calldata body
75
+ )
76
+ {
77
+ return (
78
+ uint32(bytes4(_message[0:4])),
79
+ bytes32(_message[4:36]),
80
+ uint32(bytes4(_message[36:40])),
81
+ bytes32(_message[40:72]),
82
+ bytes(_message[72:])
83
+ );
84
+ }
85
+
86
+ /**
87
+ * @notice Decode raw message bytes into structured message fields.
88
+ * @dev Efficiently slices calldata into structured message fields.
89
+ * @param _message Raw bytes of message contents.
90
+ * @return origin Domain of home chain
91
+ * @return sender Address of sender as address (bytes20)
92
+ * @return destination Domain of destination chain
93
+ * @return recipient Address of recipient on destination chain as address (bytes20)
94
+ * @return body Raw bytes of message body
95
+ */
96
+ function destructureAddresses(bytes calldata _message)
97
+ internal
98
+ pure
99
+ returns (
100
+ uint32,
101
+ address,
102
+ uint32,
103
+ address,
104
+ bytes calldata
105
+ )
106
+ {
107
+ (
108
+ uint32 _origin,
109
+ bytes32 _sender,
110
+ uint32 destination,
111
+ bytes32 _recipient,
112
+ bytes calldata body
113
+ ) = destructure(_message);
114
+ return (
115
+ _origin,
116
+ _sender.bytes32ToAddress(),
117
+ destination,
118
+ _recipient.bytes32ToAddress(),
119
+ body
120
+ );
121
+ }
122
+ }
@@ -0,0 +1,34 @@
1
+ // SPDX-License-Identifier: MIT OR Apache-2.0
2
+ pragma solidity >=0.6.11;
3
+
4
+ library TypeCasts {
5
+ // treat it as a null-terminated string of max 32 bytes
6
+ function coerceString(bytes32 _buf)
7
+ internal
8
+ pure
9
+ returns (string memory _newStr)
10
+ {
11
+ uint8 _slen = 0;
12
+ while (_slen < 32 && _buf[_slen] != 0) {
13
+ _slen++;
14
+ }
15
+
16
+ // solhint-disable-next-line no-inline-assembly
17
+ assembly {
18
+ _newStr := mload(0x40)
19
+ mstore(0x40, add(_newStr, 0x40)) // may end up with extra
20
+ mstore(_newStr, _slen)
21
+ mstore(add(_newStr, 0x20), _buf)
22
+ }
23
+ }
24
+
25
+ // alignment preserving cast
26
+ function addressToBytes32(address _addr) internal pure returns (bytes32) {
27
+ return bytes32(uint256(uint160(_addr)));
28
+ }
29
+
30
+ // alignment preserving cast
31
+ function bytes32ToAddress(bytes32 _buf) internal pure returns (address) {
32
+ return address(uint160(uint256(_buf)));
33
+ }
34
+ }
@@ -0,0 +1,52 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.0;
3
+
4
+ import {TypeCasts} from "../libs/TypeCasts.sol";
5
+ import {IMessageRecipient} from "../../interfaces/IMessageRecipient.sol";
6
+
7
+ contract MockInbox {
8
+ using TypeCasts for bytes32;
9
+
10
+ struct PendingMessage {
11
+ uint32 originDomain;
12
+ bytes32 sender;
13
+ bytes32 recipient;
14
+ bytes messageBody;
15
+ }
16
+
17
+ mapping(uint256 => PendingMessage) pendingMessages;
18
+ uint256 totalMessages = 0;
19
+ uint256 messageProcessed = 0;
20
+
21
+ function addPendingMessage(
22
+ uint32 _originDomain,
23
+ bytes32 _sender,
24
+ bytes32 _recipient,
25
+ bytes memory _messageBody
26
+ ) external {
27
+ pendingMessages[totalMessages] = PendingMessage(
28
+ _originDomain,
29
+ _sender,
30
+ _recipient,
31
+ _messageBody
32
+ );
33
+ totalMessages += 1;
34
+ }
35
+
36
+ function processNextPendingMessage() public {
37
+ PendingMessage memory pendingMessage = pendingMessages[
38
+ messageProcessed
39
+ ];
40
+
41
+ address recipient = pendingMessage.recipient.bytes32ToAddress();
42
+
43
+ IMessageRecipient(recipient).handle(
44
+ // This is completely arbitrary and consumers should not rely
45
+ // on domain handling in the mock mailbox contracts.
46
+ pendingMessage.originDomain,
47
+ pendingMessage.sender,
48
+ pendingMessage.messageBody
49
+ );
50
+ messageProcessed += 1;
51
+ }
52
+ }
@@ -0,0 +1,30 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.0;
3
+
4
+ import {MockInbox} from "./MockInbox.sol";
5
+ import {TypeCasts} from "../libs/TypeCasts.sol";
6
+
7
+ contract MockOutbox {
8
+ MockInbox inbox;
9
+ uint32 domain;
10
+ using TypeCasts for address;
11
+
12
+ constructor(uint32 _domain, address _inbox) {
13
+ domain = _domain;
14
+ inbox = MockInbox(_inbox);
15
+ }
16
+
17
+ function dispatch(
18
+ uint32,
19
+ bytes32 _recipientAddress,
20
+ bytes calldata _messageBody
21
+ ) external returns (uint256) {
22
+ inbox.addPendingMessage(
23
+ domain,
24
+ msg.sender.addressToBytes32(),
25
+ _recipientAddress,
26
+ _messageBody
27
+ );
28
+ return 1;
29
+ }
30
+ }
@@ -0,0 +1,21 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity >=0.8.0;
4
+
5
+ abstract contract MysteryMath {
6
+ uint256 public stateVar;
7
+
8
+ function setState(uint256 _var) external {
9
+ stateVar = _var;
10
+ }
11
+
12
+ function getState() external view returns (uint256) {
13
+ return stateVar;
14
+ }
15
+
16
+ function doMath(uint256 a, uint256 b)
17
+ external
18
+ pure
19
+ virtual
20
+ returns (uint256 _result);
21
+ }
@@ -0,0 +1,22 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity >=0.8.0;
4
+
5
+ import "./MysteryMath.sol";
6
+
7
+ contract MysteryMathV1 is MysteryMath {
8
+ uint32 public immutable version;
9
+
10
+ constructor() {
11
+ version = 1;
12
+ }
13
+
14
+ function doMath(uint256 a, uint256 b)
15
+ external
16
+ pure
17
+ override
18
+ returns (uint256 _result)
19
+ {
20
+ _result = a + b;
21
+ }
22
+ }