@layerzerolabs/protocol-stellar-v2 0.2.21 → 0.2.23

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 (328) hide show
  1. package/.turbo/turbo-build.log +347 -271
  2. package/.turbo/turbo-lint.log +277 -208
  3. package/.turbo/turbo-test.log +1700 -1370
  4. package/Cargo.lock +22 -51
  5. package/Cargo.toml +6 -1
  6. package/contracts/common-macros/src/auth.rs +10 -9
  7. package/contracts/common-macros/src/contract_ttl.rs +1 -4
  8. package/contracts/common-macros/src/error.rs +1 -3
  9. package/contracts/common-macros/src/lib.rs +65 -61
  10. package/contracts/common-macros/src/storage.rs +212 -65
  11. package/contracts/common-macros/src/tests/auth.rs +75 -6
  12. package/contracts/common-macros/src/tests/contract_ttl.rs +383 -350
  13. package/contracts/common-macros/src/tests/error.rs +9 -21
  14. package/contracts/common-macros/src/tests/lz_contract.rs +80 -0
  15. package/contracts/common-macros/src/tests/mod.rs +2 -0
  16. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__auth__snapshot_generated_multisig_code.snap +20 -3
  17. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__auth__snapshot_generated_ownable_code.snap +28 -1
  18. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__contract_ttl__snapshot_generated_contractimpl_code.snap +8 -43
  19. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__contract_ttl__snapshot_generated_contracttrait_code.snap +6 -29
  20. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__lz_contract__snapshot_generated_lz_contract_code.snap +31 -0
  21. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__ttl_extendable__snapshot_generated_ttl_extendable_code.snap +8 -0
  22. package/contracts/common-macros/src/tests/storage/extract_fields.rs +87 -0
  23. package/contracts/common-macros/src/tests/storage/gen_accessor_methods.rs +223 -0
  24. package/contracts/common-macros/src/tests/storage/gen_args.rs +65 -0
  25. package/contracts/common-macros/src/tests/storage/gen_enum_variant.rs +78 -0
  26. package/contracts/common-macros/src/tests/storage/gen_key.rs +108 -0
  27. package/contracts/common-macros/src/tests/storage/gen_params.rs +105 -0
  28. package/contracts/common-macros/src/tests/{storage.rs → storage/generate_storage.rs} +54 -129
  29. package/contracts/common-macros/src/tests/storage/is_primitive_type.rs +48 -0
  30. package/contracts/common-macros/src/tests/storage/mod.rs +16 -0
  31. package/contracts/common-macros/src/tests/storage/parse_default.rs +164 -0
  32. package/contracts/common-macros/src/tests/storage/parse_name.rs +159 -0
  33. package/contracts/common-macros/src/tests/storage/parse_no_ttl_extension.rs +124 -0
  34. package/contracts/common-macros/src/tests/storage/parse_storage_type.rs +174 -0
  35. package/contracts/common-macros/src/tests/storage/snapshots/common_macros__tests__storage__generate_storage__snapshot_generated_storage_code.snap +412 -0
  36. package/contracts/common-macros/src/tests/storage/storage_kind.rs +39 -0
  37. package/contracts/common-macros/src/tests/storage/test_setup.rs +25 -0
  38. package/contracts/common-macros/src/tests/storage/validate_attrs.rs +138 -0
  39. package/contracts/common-macros/src/tests/storage/variant_config.rs +226 -0
  40. package/contracts/common-macros/src/tests/test_helpers.rs +4 -10
  41. package/contracts/common-macros/src/tests/ttl_configurable.rs +2 -2
  42. package/contracts/common-macros/src/tests/ttl_extendable.rs +32 -0
  43. package/contracts/common-macros/src/tests/upgradeable.rs +118 -2
  44. package/contracts/common-macros/src/ttl_configurable.rs +1 -4
  45. package/contracts/common-macros/src/upgradeable.rs +21 -3
  46. package/contracts/endpoint-v2/Cargo.toml +0 -4
  47. package/contracts/endpoint-v2/src/endpoint_v2.rs +37 -17
  48. package/contracts/endpoint-v2/src/errors.rs +26 -1
  49. package/contracts/endpoint-v2/src/interfaces/layerzero_endpoint_v2.rs +1 -1
  50. package/contracts/endpoint-v2/src/interfaces/message_lib_manager.rs +4 -4
  51. package/contracts/endpoint-v2/src/interfaces/messaging_composer.rs +2 -2
  52. package/contracts/endpoint-v2/src/lib.rs +0 -1
  53. package/contracts/endpoint-v2/src/message_lib_manager.rs +39 -8
  54. package/contracts/endpoint-v2/src/messaging_channel.rs +36 -4
  55. package/contracts/endpoint-v2/src/messaging_composer.rs +18 -4
  56. package/contracts/endpoint-v2/src/storage.rs +9 -1
  57. package/contracts/endpoint-v2/src/tests/endpoint_setup.rs +2 -2
  58. package/contracts/endpoint-v2/src/tests/endpoint_v2/pay_messaging_fees.rs +1 -1
  59. package/contracts/endpoint-v2/src/tests/endpoint_v2/require_oapp_auth.rs +2 -2
  60. package/contracts/endpoint-v2/src/tests/message_lib_manager/register_library.rs +3 -3
  61. package/contracts/endpoint-v2/src/tests/message_lib_manager/require_receive_lib_for_eid.rs +5 -5
  62. package/contracts/endpoint-v2/src/tests/message_lib_manager/require_registered.rs +2 -2
  63. package/contracts/endpoint-v2/src/tests/message_lib_manager/require_send_lib_for_eid.rs +5 -5
  64. package/contracts/endpoint-v2/src/tests/message_lib_manager/require_supported_eid.rs +3 -3
  65. package/contracts/endpoint-v2/src/tests/messaging_channel/nilify.rs +1 -1
  66. package/contracts/endpoint-v2/src/tests/messaging_composer/clear_compose.rs +4 -3
  67. package/contracts/endpoint-v2/src/tests/messaging_composer/lz_compose_alert.rs +7 -2
  68. package/contracts/endpoint-v2/src/tests/messaging_composer/mod.rs +4 -0
  69. package/contracts/endpoint-v2/src/tests/messaging_composer/send_compose.rs +7 -2
  70. package/contracts/layerzero-views/src/layerzero_view.rs +0 -1
  71. package/contracts/layerzero-views/src/tests/mod.rs +1 -0
  72. package/contracts/layerzero-views/src/tests/types_tests.rs +31 -0
  73. package/contracts/layerzero-views/src/types.rs +2 -3
  74. package/contracts/macro-integration-tests/tests/runtime/contract_ttl/constructor.rs +61 -0
  75. package/contracts/macro-integration-tests/tests/runtime/contract_ttl/contract_impl_ttl_extension.rs +97 -0
  76. package/contracts/macro-integration-tests/tests/runtime/contract_ttl/contract_trait_ttl_extension.rs +99 -0
  77. package/contracts/macro-integration-tests/tests/runtime/contract_ttl/mod.rs +3 -0
  78. package/contracts/macro-integration-tests/tests/runtime/lz_contract/mod.rs +5 -0
  79. package/contracts/macro-integration-tests/tests/runtime/lz_contract/wrapper_default.rs +86 -0
  80. package/contracts/macro-integration-tests/tests/runtime/lz_contract/wrapper_multisig.rs +47 -0
  81. package/contracts/macro-integration-tests/tests/runtime/lz_contract/wrapper_multisig_upgradeable.rs +77 -0
  82. package/contracts/macro-integration-tests/tests/runtime/lz_contract/wrapper_upgradeable.rs +114 -0
  83. package/contracts/macro-integration-tests/tests/runtime/lz_contract/wrapper_upgradeable_no_migration.rs +105 -0
  84. package/contracts/macro-integration-tests/tests/runtime/multisig/admin_entrypoints.rs +242 -0
  85. package/contracts/macro-integration-tests/tests/runtime/multisig/mod.rs +9 -0
  86. package/contracts/macro-integration-tests/tests/runtime/multisig/self_auth.rs +54 -0
  87. package/contracts/macro-integration-tests/tests/runtime/ownable/initialization.rs +13 -0
  88. package/contracts/macro-integration-tests/tests/runtime/ownable/mod.rs +1 -0
  89. package/contracts/macro-integration-tests/tests/runtime/ownable/ownership_transfer.rs +70 -1
  90. package/contracts/macro-integration-tests/tests/runtime/ownable/two_step_transfer.rs +219 -0
  91. package/contracts/macro-integration-tests/tests/runtime/storage/keyed_roundtrip.rs +41 -0
  92. package/contracts/macro-integration-tests/tests/runtime/storage/ttl_extension.rs +48 -16
  93. package/contracts/macro-integration-tests/tests/runtime/storage/unkeyed_roundtrip.rs +10 -0
  94. package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/configuration.rs +96 -3
  95. package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/freeze.rs +4 -0
  96. package/contracts/macro-integration-tests/tests/runtime/ttl_extendable/extend_instance_ttl.rs +64 -0
  97. package/contracts/macro-integration-tests/tests/runtime/ttl_extendable/mod.rs +16 -0
  98. package/contracts/macro-integration-tests/tests/runtime/upgradeable/migrate_guard_and_state.rs +305 -0
  99. package/contracts/macro-integration-tests/tests/runtime/upgradeable/mod.rs +3 -0
  100. package/contracts/macro-integration-tests/tests/runtime/upgradeable/no_migration.rs +59 -0
  101. package/contracts/macro-integration-tests/tests/runtime/upgradeable/upgrade_then_migrate.rs +88 -0
  102. package/contracts/macro-integration-tests/tests/runtime.rs +5 -0
  103. package/contracts/macro-integration-tests/tests/ui/contract_impl/fail/not_impl_item.rs +6 -0
  104. package/contracts/macro-integration-tests/tests/ui/contract_impl/fail/not_impl_item.stderr +7 -0
  105. package/contracts/macro-integration-tests/tests/ui/contract_impl/pass/basic.rs +102 -0
  106. package/contracts/macro-integration-tests/tests/ui/contract_trait/fail/not_a_trait.rs +6 -0
  107. package/contracts/macro-integration-tests/tests/ui/contract_trait/fail/not_a_trait.stderr +7 -0
  108. package/contracts/macro-integration-tests/tests/ui/contract_trait/pass/basic.rs +83 -0
  109. package/contracts/macro-integration-tests/tests/ui/error/fail/discriminant_too_large.rs +11 -0
  110. package/contracts/macro-integration-tests/tests/ui/error/fail/discriminant_too_large.stderr +7 -0
  111. package/contracts/macro-integration-tests/tests/ui/error/fail/non_enum_input.rs +11 -0
  112. package/contracts/macro-integration-tests/tests/ui/error/fail/non_enum_input.stderr +7 -0
  113. package/contracts/macro-integration-tests/tests/ui/error/pass/basic.rs +22 -0
  114. package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/invalid_option.rs +6 -0
  115. package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/invalid_option.stderr +7 -0
  116. package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/multisig_rejects_ownable_api.rs +20 -0
  117. package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/multisig_rejects_ownable_api.stderr +20 -0
  118. package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/not_a_struct.rs +8 -0
  119. package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/not_a_struct.stderr +7 -0
  120. package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/upgradeable_invalid_inner_option.rs +10 -0
  121. package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/upgradeable_invalid_inner_option.stderr +7 -0
  122. package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/upgradeable_missing_internal.rs +20 -0
  123. package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/upgradeable_missing_internal.stderr +86 -0
  124. package/contracts/macro-integration-tests/tests/ui/lz_contract/pass/basic.rs +45 -0
  125. package/contracts/macro-integration-tests/tests/ui/lz_contract/pass/multisig.rs +34 -0
  126. package/contracts/macro-integration-tests/tests/ui/lz_contract/pass/multisig_upgradeable.rs +30 -0
  127. package/contracts/macro-integration-tests/tests/ui/lz_contract/pass/upgradeable.rs +39 -0
  128. package/contracts/macro-integration-tests/tests/ui/lz_contract/pass/upgradeable_no_migration.rs +28 -0
  129. package/contracts/macro-integration-tests/tests/ui/multisig/fail/non_struct_input.rs +8 -0
  130. package/contracts/macro-integration-tests/tests/ui/multisig/fail/non_struct_input.stderr +7 -0
  131. package/contracts/macro-integration-tests/tests/ui/multisig/fail/rejects_ownable_api.rs +20 -0
  132. package/contracts/macro-integration-tests/tests/ui/multisig/fail/rejects_ownable_api.stderr +12 -0
  133. package/contracts/macro-integration-tests/tests/ui/multisig/fail/rejects_ownable_trait.rs +20 -0
  134. package/contracts/macro-integration-tests/tests/ui/multisig/fail/rejects_ownable_trait.stderr +5 -0
  135. package/contracts/macro-integration-tests/tests/ui/multisig/pass/basic.rs +49 -0
  136. package/contracts/macro-integration-tests/tests/ui/ownable/fail/non_struct_input.rs +8 -0
  137. package/contracts/macro-integration-tests/tests/ui/ownable/fail/non_struct_input.stderr +7 -0
  138. package/contracts/macro-integration-tests/tests/ui/ownable/fail/only_auth_missing_auth.rs +19 -0
  139. package/contracts/macro-integration-tests/tests/ui/ownable/fail/only_auth_missing_auth.stderr +12 -0
  140. package/contracts/macro-integration-tests/tests/ui/ownable/fail/only_auth_missing_env.rs +1 -1
  141. package/contracts/macro-integration-tests/tests/ui/ownable/fail/only_auth_missing_env.stderr +0 -8
  142. package/contracts/macro-integration-tests/tests/ui/ownable/pass/basic.rs +39 -0
  143. package/contracts/macro-integration-tests/tests/ui/ownable/pass/only_auth_env_param_variants.rs +7 -1
  144. package/contracts/macro-integration-tests/tests/ui/storage/fail/invalid_storage_type_param.stderr +1 -1
  145. package/contracts/macro-integration-tests/tests/ui/storage/fail/missing_storage_type_param.stderr +1 -1
  146. package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_default_values.rs +11 -0
  147. package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_default_values.stderr +7 -0
  148. package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_name_attrs.rs +11 -0
  149. package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_name_attrs.stderr +7 -0
  150. package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_no_ttl_extension.rs +11 -0
  151. package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_no_ttl_extension.stderr +7 -0
  152. package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_type_params.stderr +1 -1
  153. package/contracts/macro-integration-tests/tests/ui/storage/fail/no_ttl_extension_rejects_args.rs +13 -0
  154. package/contracts/macro-integration-tests/tests/ui/storage/fail/no_ttl_extension_rejects_args.stderr +7 -0
  155. package/contracts/macro-integration-tests/tests/ui/storage/pass/api_surface.rs +102 -0
  156. package/contracts/macro-integration-tests/tests/ui/storage/pass/basic.rs +43 -0
  157. package/contracts/macro-integration-tests/tests/ui/storage/pass/multi_key.rs +38 -0
  158. package/contracts/macro-integration-tests/tests/ui/ttl_configurable/fail/missing_auth_trait.rs +14 -0
  159. package/contracts/macro-integration-tests/tests/ui/ttl_configurable/fail/missing_auth_trait.stderr +71 -0
  160. package/contracts/macro-integration-tests/tests/ui/ttl_configurable/fail/non_struct_input.rs +8 -0
  161. package/contracts/macro-integration-tests/tests/ui/ttl_configurable/fail/non_struct_input.stderr +7 -0
  162. package/contracts/macro-integration-tests/tests/ui/ttl_configurable/pass/{minimal_contract.rs → basic.rs} +2 -0
  163. package/contracts/macro-integration-tests/tests/ui/ttl_configurable/pass/multisig_contract.rs +28 -0
  164. package/contracts/macro-integration-tests/tests/ui/ttl_configurable/pass/ownable_contract.rs +32 -0
  165. package/contracts/macro-integration-tests/tests/ui/ttl_extendable/fail/non_struct_input.rs +8 -0
  166. package/contracts/macro-integration-tests/tests/ui/ttl_extendable/fail/non_struct_input.stderr +7 -0
  167. package/contracts/macro-integration-tests/tests/ui/ttl_extendable/pass/basic.rs +23 -0
  168. package/contracts/macro-integration-tests/tests/ui/ttl_extendable/pass/no_user_contractimpl.rs +21 -0
  169. package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/attr_args.rs +11 -0
  170. package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/attr_args.stderr +29 -0
  171. package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/missing_auth_trait.rs +20 -0
  172. package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/missing_auth_trait.stderr +71 -0
  173. package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/missing_upgradeable_internal.rs +10 -0
  174. package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/missing_upgradeable_internal.stderr +79 -0
  175. package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/non_struct_input.rs +8 -0
  176. package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/non_struct_input.stderr +7 -0
  177. package/contracts/macro-integration-tests/tests/ui/upgradeable/pass/basic.rs +43 -0
  178. package/contracts/macro-integration-tests/tests/ui/upgradeable/pass/multisig_contract.rs +35 -0
  179. package/contracts/macro-integration-tests/tests/ui/upgradeable/pass/no_migration.rs +30 -0
  180. package/contracts/macro-integration-tests/tests/ui/upgradeable/pass/no_user_contractimpl.rs +29 -0
  181. package/contracts/macro-integration-tests/tests/ui_contract_impl.rs +12 -0
  182. package/contracts/macro-integration-tests/tests/ui_contract_trait.rs +12 -0
  183. package/contracts/macro-integration-tests/tests/ui_lz_contract.rs +11 -0
  184. package/contracts/macro-integration-tests/tests/ui_multisig.rs +11 -0
  185. package/contracts/macro-integration-tests/tests/ui_ttl_extendable.rs +12 -0
  186. package/contracts/macro-integration-tests/tests/ui_upgradeable.rs +11 -0
  187. package/contracts/message-libs/blocked-message-lib/Cargo.toml +1 -1
  188. package/contracts/message-libs/blocked-message-lib/src/lib.rs +4 -1
  189. package/contracts/message-libs/blocked-message-lib/src/tests/blocked_message_lib_tests.rs +108 -0
  190. package/contracts/message-libs/blocked-message-lib/src/tests/mod.rs +4 -0
  191. package/contracts/message-libs/blocked-message-lib/src/tests/setup.rs +40 -0
  192. package/contracts/message-libs/simple-message-lib/src/lib.rs +1 -1
  193. package/contracts/message-libs/simple-message-lib/src/tests/mod.rs +2 -0
  194. package/contracts/message-libs/simple-message-lib/src/tests/setup.rs +124 -0
  195. package/contracts/message-libs/simple-message-lib/src/tests/simple_message_lib_tests.rs +309 -0
  196. package/contracts/message-libs/uln-302/src/errors.rs +21 -0
  197. package/contracts/message-libs/uln-302/src/interfaces/receive_uln.rs +1 -1
  198. package/contracts/message-libs/uln-302/src/receive_uln.rs +6 -4
  199. package/contracts/message-libs/uln-302/src/send_uln.rs +15 -6
  200. package/contracts/message-libs/uln-302/src/storage.rs +5 -5
  201. package/contracts/message-libs/uln-302/src/tests/uln302/get_config.rs +71 -0
  202. package/contracts/message-libs/uln-302/src/tests/uln302/mod.rs +1 -0
  203. package/contracts/message-libs/uln-302/src/uln302.rs +3 -0
  204. package/contracts/oapps/counter/Cargo.toml +2 -0
  205. package/contracts/oapps/counter/integration_tests/mod.rs +1 -0
  206. package/contracts/oapps/counter/integration_tests/setup_sml.rs +6 -4
  207. package/contracts/oapps/counter/integration_tests/setup_uln.rs +12 -5
  208. package/contracts/oapps/counter/integration_tests/test_with_blocked.rs +67 -0
  209. package/contracts/oapps/counter/src/tests/mod.rs +1 -0
  210. package/contracts/oapps/counter/src/tests/test_u256_ext.rs +48 -0
  211. package/contracts/oapps/oapp/src/lib.rs +0 -3
  212. package/contracts/oapps/oapp/src/tests/mod.rs +1 -0
  213. package/contracts/oapps/oft/integration-tests/setup.rs +2 -3
  214. package/contracts/oapps/oft/src/lib.rs +3 -0
  215. package/contracts/oapps/oft/src/tests/extensions/mod.rs +3 -0
  216. package/contracts/oapps/oft/src/tests/extensions/oft_fee.rs +240 -0
  217. package/contracts/oapps/oft/src/tests/extensions/pausable.rs +141 -0
  218. package/contracts/oapps/oft/src/tests/extensions/rate_limiter.rs +447 -0
  219. package/contracts/oapps/oft/src/tests/mod.rs +2 -0
  220. package/contracts/oapps/oft/src/tests/oft_types/lock_unlock.rs +180 -0
  221. package/contracts/oapps/oft/src/tests/oft_types/mod.rs +1 -0
  222. package/contracts/oapps/oft-core/integration-tests/setup.rs +2 -3
  223. package/contracts/oapps/oft-core/src/lib.rs +2 -2
  224. package/contracts/oapps/oft-core/src/tests/mod.rs +1 -1
  225. package/contracts/oapps/oft-core/src/tests/{test_oft_version.rs → test_oft_version_and_approval.rs} +9 -0
  226. package/contracts/oapps/oft-core/src/tests/test_utils.rs +0 -43
  227. package/contracts/upgrader/src/tests/test_upgrader.rs +18 -0
  228. package/contracts/utils/src/auth.rs +2 -2
  229. package/contracts/utils/src/buffer_reader.rs +61 -10
  230. package/contracts/utils/src/buffer_writer.rs +35 -20
  231. package/contracts/utils/src/bytes_ext.rs +1 -2
  232. package/contracts/utils/src/errors.rs +5 -3
  233. package/contracts/utils/src/multisig.rs +59 -36
  234. package/contracts/utils/src/option_ext.rs +3 -3
  235. package/contracts/utils/src/ownable.rs +12 -6
  236. package/contracts/utils/src/tests/auth.rs +179 -0
  237. package/contracts/utils/src/tests/buffer_reader.rs +203 -1
  238. package/contracts/utils/src/tests/buffer_writer.rs +176 -5
  239. package/contracts/utils/src/tests/mod.rs +2 -0
  240. package/contracts/utils/src/tests/multisig.rs +170 -141
  241. package/contracts/utils/src/tests/option_ext.rs +1 -1
  242. package/contracts/utils/src/tests/ownable.rs +156 -161
  243. package/contracts/utils/src/tests/test_helper.rs +21 -1
  244. package/contracts/utils/src/tests/testing_utils.rs +84 -2
  245. package/contracts/utils/src/tests/ttl_configurable.rs +66 -86
  246. package/contracts/utils/src/tests/ttl_extendable.rs +64 -0
  247. package/contracts/utils/src/tests/upgradeable.rs +115 -6
  248. package/contracts/utils/src/ttl_configurable.rs +22 -12
  249. package/contracts/utils/src/ttl_extendable.rs +1 -3
  250. package/contracts/utils/src/upgradeable.rs +21 -24
  251. package/contracts/workers/dvn/src/auth.rs +1 -1
  252. package/contracts/workers/dvn/src/interfaces/dvn.rs +2 -2
  253. package/contracts/workers/dvn/src/storage.rs +1 -1
  254. package/contracts/workers/dvn/src/tests/auth.rs +136 -3
  255. package/contracts/workers/dvn/src/tests/mod.rs +0 -1
  256. package/contracts/workers/dvn/src/tests/setup.rs +4 -10
  257. package/contracts/workers/executor-helper/src/tests/executor_helper.rs +279 -0
  258. package/contracts/workers/executor-helper/src/tests/setup.rs +106 -1
  259. package/contracts/workers/worker/src/worker.rs +1 -1
  260. package/docs/oft-guide.md +5 -5
  261. package/package.json +5 -7
  262. package/sdk/.turbo/turbo-test.log +662 -466
  263. package/sdk/LICENSE +23 -0
  264. package/sdk/dist/generated/bml.d.ts +101 -106
  265. package/sdk/dist/generated/bml.js +108 -26
  266. package/sdk/dist/generated/counter.d.ts +123 -484
  267. package/sdk/dist/generated/counter.js +103 -25
  268. package/sdk/dist/generated/dvn.d.ts +141 -699
  269. package/sdk/dist/generated/dvn.js +106 -28
  270. package/sdk/dist/generated/dvn_fee_lib.d.ts +31 -248
  271. package/sdk/dist/generated/dvn_fee_lib.js +27 -24
  272. package/sdk/dist/generated/endpoint.d.ts +158 -836
  273. package/sdk/dist/generated/endpoint.js +107 -29
  274. package/sdk/dist/generated/executor.d.ts +139 -671
  275. package/sdk/dist/generated/executor.js +106 -28
  276. package/sdk/dist/generated/executor_fee_lib.d.ts +109 -264
  277. package/sdk/dist/generated/executor_fee_lib.js +106 -28
  278. package/sdk/dist/generated/executor_helper.d.ts +95 -92
  279. package/sdk/dist/generated/executor_helper.js +103 -25
  280. package/sdk/dist/generated/layerzero_view.d.ts +178 -335
  281. package/sdk/dist/generated/layerzero_view.js +172 -33
  282. package/sdk/dist/generated/oft.d.ts +137 -680
  283. package/sdk/dist/generated/oft.js +103 -25
  284. package/sdk/dist/generated/price_feed.d.ts +45 -444
  285. package/sdk/dist/generated/price_feed.js +27 -24
  286. package/sdk/dist/generated/sml.d.ts +119 -428
  287. package/sdk/dist/generated/sml.js +103 -25
  288. package/sdk/dist/generated/treasury.d.ts +109 -288
  289. package/sdk/dist/generated/treasury.js +103 -25
  290. package/sdk/dist/generated/uln302.d.ts +190 -527
  291. package/sdk/dist/generated/uln302.js +170 -31
  292. package/sdk/dist/generated/upgrader.d.ts +14 -34
  293. package/sdk/dist/generated/upgrader.js +24 -21
  294. package/sdk/package.json +3 -4
  295. package/sdk/test/counter-sml.test.ts +218 -142
  296. package/sdk/test/counter-uln.test.ts +189 -145
  297. package/sdk/test/oft-sml.test.ts +173 -156
  298. package/sdk/test/suites/constants.ts +7 -1
  299. package/sdk/test/suites/globalSetup.ts +140 -74
  300. package/sdk/turbo.json +1 -1
  301. package/tools/ts-bindings-gen/Cargo.toml +4 -4
  302. package/tools/ts-bindings-gen/src/main.rs +4 -0
  303. package/turbo.json +3 -0
  304. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__storage__snapshot_generated_storage_code.snap +0 -1072
  305. package/contracts/endpoint-v2/src/constants.rs +0 -52
  306. package/contracts/macro-integration-tests/tests/ui/error/fail/attr_not_empty.rs +0 -12
  307. package/contracts/macro-integration-tests/tests/ui/error/fail/attr_not_empty.stderr +0 -7
  308. package/contracts/macro-integration-tests/tests/ui/error/pass/attr_on_variant_allowed.rs +0 -20
  309. package/contracts/macro-integration-tests/tests/ui/error/pass/basic_auto_discriminants.rs +0 -15
  310. package/contracts/macro-integration-tests/tests/ui/error/pass/mixed_discriminants.rs +0 -16
  311. package/contracts/macro-integration-tests/tests/ui/ownable/pass/minimal_contract.rs +0 -26
  312. package/contracts/macro-integration-tests/tests/ui/ownable/pass/namespacing_and_imports.rs +0 -21
  313. package/contracts/macro-integration-tests/tests/ui/storage/fail/storage_attr_rejects_args.rs +0 -12
  314. package/contracts/macro-integration-tests/tests/ui/storage/fail/storage_attr_rejects_args.stderr +0 -7
  315. package/contracts/macro-integration-tests/tests/ui/storage/pass/default_value_on_variant.rs +0 -14
  316. package/contracts/macro-integration-tests/tests/ui/storage/pass/enum_instance_unit_basic.rs +0 -14
  317. package/contracts/macro-integration-tests/tests/ui/storage/pass/enum_persistent_named_fields_keyed.rs +0 -16
  318. package/contracts/macro-integration-tests/tests/ui/storage/pass/enum_temporary_unit_option.rs +0 -15
  319. package/contracts/macro-integration-tests/tests/ui/storage/pass/name_override.rs +0 -14
  320. package/contracts/macro-integration-tests/tests/ui/storage/pass/no_auto_ttl_extension.rs +0 -19
  321. package/contracts/macro-integration-tests/tests/ui/storage/pass/ttl_provider_basic.rs +0 -15
  322. package/contracts/message-libs/simple-message-lib/src/test.rs +0 -280
  323. package/contracts/oapps/oapp/src/macro_tests/mod.rs +0 -1
  324. package/contracts/workers/dvn/src/tests/multisig/mod.rs +0 -3
  325. package/contracts/workers/dvn/src/tests/multisig/set_signer.rs +0 -132
  326. package/contracts/workers/dvn/src/tests/multisig/set_threshold.rs +0 -109
  327. package/contracts/workers/dvn/src/tests/multisig/verify_signatures.rs +0 -106
  328. /package/contracts/oapps/oapp/src/{macro_tests → tests}/test_macros.rs +0 -0
@@ -0,0 +1,49 @@
1
+ // UI (trybuild) test: minimal multisig usage compiles.
2
+ //
3
+ // Purpose:
4
+ // - Verifies `#[common_macros::multisig]` can be applied on a contract struct.
5
+ // - Verifies the macro-generated trait impls exist and are type-checkable from downstream code:
6
+ // - `utils::auth::Auth` trait impl for the contract (self-owning authorizer)
7
+ // - `utils::multisig::MultiSig` trait impl for the contract
8
+ //
9
+ // Note: renamed from `minimal_contract.rs` to `basic.rs` for consistency.
10
+
11
+ use soroban_sdk::{contract, contractimpl, BytesN, Env, Vec};
12
+
13
+ #[contract]
14
+ #[common_macros::multisig]
15
+ pub struct MyContract;
16
+
17
+ #[contractimpl]
18
+ impl MyContract {
19
+ pub fn smoke(env: Env) {
20
+ // Auth impl exists.
21
+ let _authorizer = <Self as utils::auth::Auth>::authorizer(&env);
22
+
23
+ // MultiSig APIs exist (view + mutation + verification).
24
+ let _threshold: u32 = <Self as utils::multisig::MultiSig>::threshold(&env);
25
+ let signer = BytesN::<20>::from_array(&env, &[1u8; 20]);
26
+ let _is_signer: bool = <Self as utils::multisig::MultiSig>::is_signer(&env, &signer);
27
+
28
+ let _signers: Vec<BytesN<20>> = <Self as utils::multisig::MultiSig>::get_signers(&env);
29
+ let _total_signers: u32 = <Self as utils::multisig::MultiSig>::total_signers(&env);
30
+
31
+ <Self as utils::multisig::MultiSig>::set_signer(&env, &signer, true);
32
+ <Self as utils::multisig::MultiSig>::set_threshold(&env, 1);
33
+
34
+ let digest = BytesN::<32>::from_array(&env, &[0u8; 32]);
35
+ let sig = BytesN::<65>::from_array(&env, &[0u8; 65]);
36
+ let mut signatures = Vec::<BytesN<65>>::new(&env);
37
+ signatures.push_back(sig);
38
+ <Self as utils::multisig::MultiSig>::verify_signatures(&env, &digest, &signatures);
39
+ <Self as utils::multisig::MultiSig>::verify_n_signatures(&env, &digest, &signatures, 1);
40
+ }
41
+
42
+ // `only_auth` should be usable with multisig contracts (they implement `Auth`).
43
+ #[common_macros::only_auth]
44
+ pub fn protected(env: Env) {
45
+ let _ = env;
46
+ }
47
+ }
48
+
49
+ fn main() {}
@@ -0,0 +1,8 @@
1
+ // UI (trybuild) negative test: `#[ownable]` must be applied to a struct.
2
+
3
+ #[common_macros::ownable]
4
+ pub enum NotAStruct {
5
+ A,
6
+ }
7
+
8
+ fn main() {}
@@ -0,0 +1,7 @@
1
+ error: custom attribute panicked
2
+ --> tests/ui/ownable/fail/non_struct_input.rs:3:1
3
+ |
4
+ 3 | #[common_macros::ownable]
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
6
+ |
7
+ = help: message: failed to parse struct: expected `struct`
@@ -0,0 +1,19 @@
1
+ // UI (trybuild) negative test: `#[only_auth]` requires `Self: utils::auth::Auth`.
2
+ //
3
+ // Purpose:
4
+ // - Ensures we get a compile-time failure when a contract uses `#[only_auth]`
5
+ // without implementing the `Auth` trait (e.g. missing `#[ownable]` / `#[multisig]`).
6
+
7
+ use soroban_sdk::{contract, Env};
8
+
9
+ #[contract]
10
+ pub struct MyContract;
11
+
12
+ impl MyContract {
13
+ #[common_macros::only_auth]
14
+ pub fn protected(env: &Env) {
15
+ let _ = env;
16
+ }
17
+ }
18
+
19
+ fn main() {}
@@ -0,0 +1,12 @@
1
+ error[E0277]: the trait bound `MyContract: utils::auth::Auth` is not satisfied
2
+ --> tests/ui/ownable/fail/only_auth_missing_auth.rs:13:5
3
+ |
4
+ 13 | #[common_macros::only_auth]
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `utils::auth::Auth` is not implemented for `MyContract`
6
+ |
7
+ note: required by a bound in `require_auth`
8
+ --> $WORKSPACE/contracts/utils/src/auth.rs
9
+ |
10
+ | pub fn require_auth<T: Auth>(env: &Env) {
11
+ | ^^^^ required by this bound in `require_auth`
12
+ = note: this error originates in the attribute macro `common_macros::only_auth` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -4,7 +4,7 @@
4
4
  // - Ensures the macro fails compilation when applied to a function that does not accept `Env`.
5
5
  // - Validates the downstream UX: macro misuse should surface as a compile-time error.
6
6
 
7
- use soroban_sdk::{contract, contractimpl, Address};
7
+ use soroban_sdk::{contract, contractimpl};
8
8
 
9
9
  #[contract]
10
10
  #[common_macros::ownable]
@@ -6,14 +6,6 @@ error: custom attribute panicked
6
6
  |
7
7
  = help: message: function must have an Env argument
8
8
 
9
- warning: unused import: `Address`
10
- --> tests/ui/ownable/fail/only_auth_missing_env.rs:7:43
11
- |
12
- 7 | use soroban_sdk::{contract, contractimpl, Address};
13
- | ^^^^^^^
14
- |
15
- = note: `#[warn(unused_imports)]` on by default
16
-
17
9
  error[E0599]: no function or associated item named `bad` found for struct `MyContract` in the current scope
18
10
  --> tests/ui/ownable/fail/only_auth_missing_env.rs:17:12
19
11
  |
@@ -0,0 +1,39 @@
1
+ // UI (trybuild) test: consolidated `#[ownable]` pass coverage.
2
+ //
3
+ // This file covers the core `#[ownable]` "pass" surface area:
4
+ // - OwnableInitializer helper (`init_owner`) and UFCS form
5
+ // - Auth impl exists
6
+ // - Ownable trait methods type-check
7
+ // - Macro expansion doesn't rely on downstream trait imports
8
+
9
+ use soroban_sdk::{contract, contractimpl, Address, Env};
10
+
11
+ #[contract]
12
+ #[common_macros::ownable]
13
+ pub struct MyContract;
14
+
15
+ #[contractimpl]
16
+ impl MyContract {
17
+ pub fn init(env: Env, owner: Address) {
18
+ // `init_owner` helper exists.
19
+ Self::init_owner(&env, &owner);
20
+
21
+ // Also usable via fully-qualified trait path (doesn't rely on imports).
22
+ <Self as utils::ownable::OwnableInitializer>::init_owner(&env, &owner);
23
+
24
+ // Auth impl exists (type-check only).
25
+ let _authorizer: Address = <Self as utils::auth::Auth>::authorizer(&env);
26
+
27
+ // Ownable trait impl exists (type-check only).
28
+ let _owner: Option<Address> = <Self as utils::ownable::Ownable>::owner(&env);
29
+ let _pending_owner: Option<Address> = <Self as utils::ownable::Ownable>::pending_owner(&env);
30
+
31
+ // A couple key Ownable APIs type-check.
32
+ <Self as utils::ownable::Ownable>::transfer_ownership(&env, &owner);
33
+ <Self as utils::ownable::Ownable>::propose_ownership_transfer(&env, &owner, 1);
34
+ <Self as utils::ownable::Ownable>::accept_ownership(&env);
35
+ <Self as utils::ownable::Ownable>::renounce_ownership(&env);
36
+ }
37
+ }
38
+
39
+ fn main() {}
@@ -3,7 +3,7 @@
3
3
  // Purpose:
4
4
  // - Verifies `#[common_macros::only_auth]` can locate an `Env` argument in the function signature,
5
5
  // even when `Env` is not the first parameter.
6
- // - Uses `&Env` forms to match the most common `require_auth` signature shape.
6
+ // - Covers borrowed/owned, qualified paths, and `&mut Env`.
7
7
 
8
8
  use soroban_sdk::{contract, Env};
9
9
 
@@ -41,6 +41,12 @@ impl MyContract {
41
41
  pub fn f5(x: u32, env: soroban_sdk::Env) {
42
42
  let _ = (x, env);
43
43
  }
44
+
45
+ // Mutable reference Env
46
+ #[common_macros::only_auth]
47
+ pub fn f6(env: &mut Env) {
48
+ let _ = env;
49
+ }
44
50
  }
45
51
 
46
52
  fn main() {}
@@ -4,4 +4,4 @@ error: custom attribute panicked
4
4
  7 | #[common_macros::storage]
5
5
  | ^^^^^^^^^^^^^^^^^^^^^^^^^
6
6
  |
7
- = help: message: failed to parse storage variant for Bad: storage type must be specified exactly once as '#[instance(Type)]', '#[persistent(Type)]', or '#[temporary(Type)]': got zero elements when exactly one was expected
7
+ = help: message: failed to parse storage type for #[persistent(...)] : expected one of: `for`, parentheses, `fn`, `unsafe`, `extern`, identifier, `::`, `<`, `dyn`, square brackets, `*`, `&`, `!`, `impl`, `_`, lifetime
@@ -4,4 +4,4 @@ error: custom attribute panicked
4
4
  7 | #[common_macros::storage]
5
5
  | ^^^^^^^^^^^^^^^^^^^^^^^^^
6
6
  |
7
- = help: message: failed to parse storage variant for Counter: storage type must be specified exactly once as '#[instance(Type)]', '#[persistent(Type)]', or '#[temporary(Type)]': got zero elements when exactly one was expected
7
+ = help: message: failed to parse storage type for #[instance(...)] : expected attribute arguments in parentheses: #[instance(...)]
@@ -0,0 +1,11 @@
1
+ // UI (trybuild) negative test: multiple `#[default(...)]` attributes are rejected.
2
+
3
+ #[common_macros::storage]
4
+ pub enum StorageKey {
5
+ #[persistent(u32)]
6
+ #[default(0)]
7
+ #[default(1)]
8
+ Counter,
9
+ }
10
+
11
+ fn main() {}
@@ -0,0 +1,7 @@
1
+ error: custom attribute panicked
2
+ --> tests/ui/storage/fail/multiple_default_values.rs:3:1
3
+ |
4
+ 3 | #[common_macros::storage]
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
6
+ |
7
+ = help: message: failed to parse storage variant for Counter: multiple default values specified: got at least 2 elements when exactly one was expected
@@ -0,0 +1,11 @@
1
+ // UI (trybuild) negative test: multiple `#[name("...")]` attributes are rejected.
2
+
3
+ #[common_macros::storage]
4
+ pub enum StorageKey {
5
+ #[persistent(u32)]
6
+ #[name("a")]
7
+ #[name("b")]
8
+ Counter,
9
+ }
10
+
11
+ fn main() {}
@@ -0,0 +1,7 @@
1
+ error: custom attribute panicked
2
+ --> tests/ui/storage/fail/multiple_name_attrs.rs:3:1
3
+ |
4
+ 3 | #[common_macros::storage]
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
6
+ |
7
+ = help: message: failed to parse storage variant for Counter: multiple name attributes specified: got at least 2 elements when exactly one was expected
@@ -0,0 +1,11 @@
1
+ // UI (trybuild) negative test: multiple `#[no_ttl_extension]` attributes are rejected.
2
+
3
+ #[common_macros::storage]
4
+ pub enum StorageKey {
5
+ #[persistent(u32)]
6
+ #[no_ttl_extension]
7
+ #[no_ttl_extension]
8
+ Counter,
9
+ }
10
+
11
+ fn main() {}
@@ -0,0 +1,7 @@
1
+ error: custom attribute panicked
2
+ --> tests/ui/storage/fail/multiple_no_ttl_extension.rs:3:1
3
+ |
4
+ 3 | #[common_macros::storage]
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
6
+ |
7
+ = help: message: failed to parse storage variant for Counter: multiple #[no_ttl_extension] attributes specified: got at least 2 elements when exactly one was expected
@@ -4,4 +4,4 @@ error: custom attribute panicked
4
4
  6 | #[common_macros::storage]
5
5
  | ^^^^^^^^^^^^^^^^^^^^^^^^^
6
6
  |
7
- = help: message: failed to parse storage variant for A: storage type must be specified exactly once as '#[instance(Type)]', '#[persistent(Type)]', or '#[temporary(Type)]': got zero elements when exactly one was expected
7
+ = help: message: failed to parse storage type for #[persistent(...)] : unexpected token
@@ -0,0 +1,13 @@
1
+ // UI (trybuild) negative test: `#[no_ttl_extension]` rejects arguments.
2
+ //
3
+ // Purpose:
4
+ // - Boundary coverage for attribute parsing (Meta::Path only).
5
+
6
+ #[common_macros::storage]
7
+ pub enum StorageKey {
8
+ #[persistent(u32)]
9
+ #[no_ttl_extension(true)]
10
+ Value,
11
+ }
12
+
13
+ fn main() {}
@@ -0,0 +1,7 @@
1
+ error: custom attribute panicked
2
+ --> tests/ui/storage/fail/no_ttl_extension_rejects_args.rs:6:1
3
+ |
4
+ 6 | #[common_macros::storage]
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
6
+ |
7
+ = help: message: failed to parse storage variant for Value: #[no_ttl_extension] does not accept arguments
@@ -0,0 +1,102 @@
1
+ // UI (trybuild) test: generated storage API surface type-checks.
2
+ //
3
+ // Purpose:
4
+ // - Ensures the macro-generated methods are callable with the intended signatures:
5
+ // - unit vs named-fields variants
6
+ // - primitive keys passed by value, non-primitive by reference
7
+ // - default getter return type is `T` (not `Option<T>`)
8
+ // - extend_ttl signatures differ for instance vs persistent/temporary
9
+
10
+ use soroban_sdk::{Address, BytesN, Env};
11
+
12
+ #[common_macros::storage]
13
+ pub enum StorageKey {
14
+ // Unit instance storage.
15
+ #[instance(u32)]
16
+ Counter,
17
+
18
+ // Unit instance storage with a default value (getter returns u32).
19
+ #[instance(u32)]
20
+ #[default(0)]
21
+ CounterWithDefault,
22
+
23
+ // Persistent storage with non-primitive key (key passed by reference).
24
+ #[persistent(i128)]
25
+ Balance { key: BytesN<32> },
26
+
27
+ // Persistent storage + no_ttl_extension still generates the same API surface.
28
+ #[persistent(i128)]
29
+ #[no_ttl_extension]
30
+ BalanceNoTtl { key: BytesN<32> },
31
+
32
+ // Persistent storage with primitive key (key passed by value).
33
+ #[persistent(u32)]
34
+ PrimKey { key: u32 },
35
+
36
+ // Temporary storage with non-primitive key (key passed by reference).
37
+ #[temporary(bool)]
38
+ TempFlag { user: Address },
39
+
40
+ // Name override attribute changes generated function names.
41
+ #[instance(bool)]
42
+ #[name("custom_flag")]
43
+ Flag,
44
+ }
45
+
46
+ #[allow(dead_code)]
47
+ fn typecheck_api(env: &Env, bytes: &BytesN<32>, addr: &Address) {
48
+ // Unit instance variant API
49
+ let _: Option<u32> = StorageKey::counter(env);
50
+ StorageKey::set_counter(env, &1u32);
51
+ StorageKey::set_or_remove_counter(env, &Some(1u32));
52
+ StorageKey::remove_counter(env);
53
+ let _: bool = StorageKey::has_counter(env);
54
+
55
+ // Unit instance + default getter return type
56
+ let _: u32 = StorageKey::counter_with_default(env);
57
+ StorageKey::set_counter_with_default(env, &2u32);
58
+ StorageKey::set_or_remove_counter_with_default(env, &Some(2u32));
59
+ StorageKey::remove_counter_with_default(env);
60
+ let _: bool = StorageKey::has_counter_with_default(env);
61
+
62
+ // Persistent + non-primitive key uses &BytesN<32>
63
+ let _: Option<i128> = StorageKey::balance(env, bytes);
64
+ StorageKey::set_balance(env, bytes, &5i128);
65
+ StorageKey::set_or_remove_balance(env, bytes, &Some(5i128));
66
+ StorageKey::remove_balance(env, bytes);
67
+ let _: bool = StorageKey::has_balance(env, bytes);
68
+ StorageKey::extend_balance_ttl(env, bytes, 1, 2);
69
+
70
+ // Persistent + no_ttl_extension (same signatures)
71
+ let _: Option<i128> = StorageKey::balance_no_ttl(env, bytes);
72
+ StorageKey::set_balance_no_ttl(env, bytes, &6i128);
73
+ StorageKey::set_or_remove_balance_no_ttl(env, bytes, &Some(6i128));
74
+ StorageKey::remove_balance_no_ttl(env, bytes);
75
+ let _: bool = StorageKey::has_balance_no_ttl(env, bytes);
76
+ StorageKey::extend_balance_no_ttl_ttl(env, bytes, 1, 2);
77
+
78
+ // Persistent + primitive key uses u32 by value
79
+ let _: Option<u32> = StorageKey::prim_key(env, 7u32);
80
+ StorageKey::set_prim_key(env, 7u32, &9u32);
81
+ StorageKey::set_or_remove_prim_key(env, 7u32, &Some(9u32));
82
+ StorageKey::remove_prim_key(env, 7u32);
83
+ let _: bool = StorageKey::has_prim_key(env, 7u32);
84
+ StorageKey::extend_prim_key_ttl(env, 7u32, 1, 2);
85
+
86
+ // Temporary + non-primitive key uses &Address
87
+ let _: Option<bool> = StorageKey::temp_flag(env, addr);
88
+ StorageKey::set_temp_flag(env, addr, &true);
89
+ StorageKey::set_or_remove_temp_flag(env, addr, &Some(true));
90
+ StorageKey::remove_temp_flag(env, addr);
91
+ let _: bool = StorageKey::has_temp_flag(env, addr);
92
+ StorageKey::extend_temp_flag_ttl(env, addr, 1, 2);
93
+
94
+ // Name override uses the custom name for method generation.
95
+ let _: Option<bool> = StorageKey::custom_flag(env);
96
+ StorageKey::set_custom_flag(env, &true);
97
+ StorageKey::set_or_remove_custom_flag(env, &Some(true));
98
+ StorageKey::remove_custom_flag(env);
99
+ let _: bool = StorageKey::has_custom_flag(env);
100
+ }
101
+
102
+ fn main() {}
@@ -0,0 +1,43 @@
1
+ // UI (trybuild) test: consolidated storage macro "basic" pass coverage.
2
+ //
3
+ // This replaces several small fixtures by covering them all in one enum:
4
+ // - instance unit variant
5
+ // - default value on variant
6
+ // - persistent named-fields (keyed) variant
7
+ // - temporary unit variant with Option value type
8
+ // - name override attribute
9
+ // - no_ttl_extension (persistent only) + normal persistent variant
10
+
11
+ use soroban_sdk::{Address, BytesN};
12
+
13
+ #[common_macros::storage]
14
+ pub enum StorageKey {
15
+ // Instance unit variant (basic).
16
+ #[instance(u32)]
17
+ Counter,
18
+
19
+ // Default value on variant (getter return type changes, covered elsewhere too).
20
+ #[instance(u32)]
21
+ #[default(0)]
22
+ CounterWithDefault,
23
+
24
+ // Persistent named-fields (keyed) variant (also covers "storage macro compiles" baseline).
25
+ #[persistent(i128)]
26
+ Balance { key: BytesN<32> },
27
+
28
+ // no_ttl_extension accepted on persistent variants.
29
+ #[persistent(i128)]
30
+ #[no_ttl_extension]
31
+ BalanceNoTtl { key: BytesN<32> },
32
+
33
+ // Temporary storage with Option value type.
34
+ #[temporary(Option<Address>)]
35
+ MaybeOwner,
36
+
37
+ // Name override attribute on a variant.
38
+ #[instance(bool)]
39
+ #[name("custom_flag")]
40
+ Flag,
41
+ }
42
+
43
+ fn main() {}
@@ -0,0 +1,38 @@
1
+ // UI (trybuild) test: storage macro supports multi-field (named) keys.
2
+ //
3
+ // Purpose:
4
+ // - Ensures named-fields variants with multiple fields generate correct signatures:
5
+ // - primitive key fields are passed by value
6
+ // - non-primitive key fields are passed by reference (and cloned into the key)
7
+
8
+ use soroban_sdk::{Address, BytesN, Env};
9
+
10
+ #[common_macros::storage]
11
+ pub enum StorageKey {
12
+ // Mixed key fields: &Address (non-primitive) + u32 (primitive)
13
+ #[persistent(i128)]
14
+ Nonce { user: Address, nonce: u32 },
15
+
16
+ // Two non-primitive key fields: both by reference
17
+ #[temporary(bool)]
18
+ TempPair { a: BytesN<32>, b: BytesN<32> },
19
+ }
20
+
21
+ #[allow(dead_code)]
22
+ fn typecheck_api(env: &Env, user: &Address, a: &BytesN<32>, b: &BytesN<32>) {
23
+ let _: Option<i128> = StorageKey::nonce(env, user, 1u32);
24
+ StorageKey::set_nonce(env, user, 1u32, &5i128);
25
+ StorageKey::set_or_remove_nonce(env, user, 1u32, &Some(5i128));
26
+ StorageKey::remove_nonce(env, user, 1u32);
27
+ let _: bool = StorageKey::has_nonce(env, user, 1u32);
28
+ StorageKey::extend_nonce_ttl(env, user, 1u32, 1, 2);
29
+
30
+ let _: Option<bool> = StorageKey::temp_pair(env, a, b);
31
+ StorageKey::set_temp_pair(env, a, b, &true);
32
+ StorageKey::set_or_remove_temp_pair(env, a, b, &Some(true));
33
+ StorageKey::remove_temp_pair(env, a, b);
34
+ let _: bool = StorageKey::has_temp_pair(env, a, b);
35
+ StorageKey::extend_temp_pair_ttl(env, a, b, 1, 2);
36
+ }
37
+
38
+ fn main() {}
@@ -0,0 +1,14 @@
1
+ // UI (trybuild) negative test: `#[ttl_configurable]` requires `Self: utils::auth::Auth`.
2
+ //
3
+ // Purpose:
4
+ // - Ensures we fail compilation when a contract uses `#[ttl_configurable]` without
5
+ // also implementing `Auth` (e.g. missing `#[ownable]` / `#[multisig]`).
6
+
7
+ use common_macros::ttl_configurable;
8
+ use soroban_sdk::contract;
9
+
10
+ #[contract]
11
+ #[ttl_configurable]
12
+ pub struct MyContract;
13
+
14
+ fn main() {}
@@ -0,0 +1,71 @@
1
+ error[E0277]: the trait bound `MyContract: utils::auth::Auth` is not satisfied
2
+ --> tests/ui/ttl_configurable/fail/missing_auth_trait.rs:12:12
3
+ |
4
+ 12 | pub struct MyContract;
5
+ | ^^^^^^^^^^ the trait `utils::auth::Auth` is not implemented for `MyContract`
6
+ |
7
+ note: required by a bound in `TtlConfigurable`
8
+ --> $WORKSPACE/contracts/utils/src/ttl_configurable.rs
9
+ |
10
+ | pub trait TtlConfigurable: Auth {
11
+ | ^^^^ required by this bound in `TtlConfigurable`
12
+
13
+ error[E0277]: the trait bound `MyContract: utils::auth::Auth` is not satisfied
14
+ --> tests/ui/ttl_configurable/fail/missing_auth_trait.rs:12:12
15
+ |
16
+ 12 | pub struct MyContract;
17
+ | ^^^^^^^^^^ the trait `utils::auth::Auth` is not implemented for `MyContract`
18
+ |
19
+ note: required by a bound in `set_ttl_configs`
20
+ --> $WORKSPACE/contracts/utils/src/ttl_configurable.rs
21
+ |
22
+ | pub trait TtlConfigurable: Auth {
23
+ | ^^^^ required by this bound in `TtlConfigurable::set_ttl_configs`
24
+ ...
25
+ | fn set_ttl_configs(
26
+ | --------------- required by a bound in this associated function
27
+
28
+ error[E0277]: the trait bound `MyContract: utils::auth::Auth` is not satisfied
29
+ --> tests/ui/ttl_configurable/fail/missing_auth_trait.rs:12:12
30
+ |
31
+ 12 | pub struct MyContract;
32
+ | ^^^^^^^^^^ the trait `utils::auth::Auth` is not implemented for `MyContract`
33
+ |
34
+ note: required by a bound in `ttl_configs`
35
+ --> $WORKSPACE/contracts/utils/src/ttl_configurable.rs
36
+ |
37
+ | pub trait TtlConfigurable: Auth {
38
+ | ^^^^ required by this bound in `TtlConfigurable::ttl_configs`
39
+ ...
40
+ | fn ttl_configs(
41
+ | ----------- required by a bound in this associated function
42
+
43
+ error[E0277]: the trait bound `MyContract: utils::auth::Auth` is not satisfied
44
+ --> tests/ui/ttl_configurable/fail/missing_auth_trait.rs:12:12
45
+ |
46
+ 12 | pub struct MyContract;
47
+ | ^^^^^^^^^^ the trait `utils::auth::Auth` is not implemented for `MyContract`
48
+ |
49
+ note: required by a bound in `freeze_ttl_configs`
50
+ --> $WORKSPACE/contracts/utils/src/ttl_configurable.rs
51
+ |
52
+ | pub trait TtlConfigurable: Auth {
53
+ | ^^^^ required by this bound in `TtlConfigurable::freeze_ttl_configs`
54
+ ...
55
+ | fn freeze_ttl_configs(env: &soroban_sdk::Env) {
56
+ | ------------------ required by a bound in this associated function
57
+
58
+ error[E0277]: the trait bound `MyContract: utils::auth::Auth` is not satisfied
59
+ --> tests/ui/ttl_configurable/fail/missing_auth_trait.rs:12:12
60
+ |
61
+ 12 | pub struct MyContract;
62
+ | ^^^^^^^^^^ the trait `utils::auth::Auth` is not implemented for `MyContract`
63
+ |
64
+ note: required by a bound in `is_ttl_configs_frozen`
65
+ --> $WORKSPACE/contracts/utils/src/ttl_configurable.rs
66
+ |
67
+ | pub trait TtlConfigurable: Auth {
68
+ | ^^^^ required by this bound in `TtlConfigurable::is_ttl_configs_frozen`
69
+ ...
70
+ | fn is_ttl_configs_frozen(env: &soroban_sdk::Env) -> bool {
71
+ | --------------------- required by a bound in this associated function
@@ -0,0 +1,8 @@
1
+ // UI (trybuild) negative test: `#[ttl_configurable]` must be applied to a struct.
2
+
3
+ #[common_macros::ttl_configurable]
4
+ pub enum NotAStruct {
5
+ A,
6
+ }
7
+
8
+ fn main() {}
@@ -0,0 +1,7 @@
1
+ error: custom attribute panicked
2
+ --> tests/ui/ttl_configurable/fail/non_struct_input.rs:3:1
3
+ |
4
+ 3 | #[common_macros::ttl_configurable]
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6
+ |
7
+ = help: message: failed to parse struct: expected `struct`
@@ -5,6 +5,8 @@
5
5
  // - Validates the macro-generated `utils::ttl::TtlConfigurable` trait impl exists and is callable.
6
6
  // - Validates `#[ttl_extendable]` generates the `extend_instance_ttl` function.
7
7
  // - Avoids snapshotting token output; compilation success + type-checking is the integration contract.
8
+ //
9
+ // Note: renamed from `minimal_contract.rs` to `basic.rs` for consistency.
8
10
 
9
11
  use common_macros::{ownable, ttl_configurable, ttl_extendable};
10
12
  use soroban_sdk::{contract, contractimpl, Address, Env};
@@ -0,0 +1,28 @@
1
+ // UI (trybuild) test: `#[ttl_configurable]` compiles with `#[multisig]` auth.
2
+ //
3
+ // Purpose:
4
+ // - Ensures `#[common_macros::ttl_configurable]` works when the contract uses multisig auth.
5
+ // - Type-checks the generated `TtlConfigurable` trait methods are callable.
6
+
7
+ use common_macros::{multisig, ttl_configurable};
8
+ use soroban_sdk::{contract, contractimpl, Env};
9
+ use utils::ttl_configurable::TtlConfig;
10
+
11
+ #[contract]
12
+ #[ttl_configurable]
13
+ #[multisig]
14
+ pub struct MyContract;
15
+
16
+ #[contractimpl]
17
+ impl MyContract {
18
+ pub fn smoke(env: Env) {
19
+ let _cfg: (Option<TtlConfig>, Option<TtlConfig>) = Self::ttl_configs(&env);
20
+ let _frozen: bool = Self::is_ttl_configs_frozen(&env);
21
+
22
+ let none: Option<TtlConfig> = None;
23
+ Self::set_ttl_configs(&env, &none, &none);
24
+ Self::freeze_ttl_configs(&env);
25
+ }
26
+ }
27
+
28
+ fn main() {}