@layerzerolabs/protocol-stellar-v2 0.2.13 → 0.2.15

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 (319) hide show
  1. package/.turbo/turbo-build.log +384 -278
  2. package/.turbo/turbo-lint.log +110 -78
  3. package/.turbo/turbo-test.log +1248 -1014
  4. package/Cargo.lock +130 -3
  5. package/Cargo.toml +2 -1
  6. package/contracts/common-macros/src/contract_impl.rs +6 -1
  7. package/contracts/common-macros/src/lib.rs +47 -8
  8. package/contracts/common-macros/src/ownable.rs +7 -25
  9. package/contracts/common-macros/src/storage.rs +1 -1
  10. package/contracts/common-macros/src/tests/contract_impl.rs +5 -0
  11. package/contracts/common-macros/src/tests/mod.rs +1 -0
  12. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__contract_impl__snapshot_generated_contract_impl_code.snap +23 -7
  13. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__ownable__snapshot_generated_ownable_code.snap +5 -25
  14. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__storage__snapshot_generated_storage_code.snap +48 -48
  15. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__ttl_configurable__snapshot_generated_ttl_configurable_code.snap +5 -25
  16. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__upgradeable__snapshot_generated_upgradeable_code.snap +21 -0
  17. package/contracts/common-macros/src/tests/upgradeable.rs +31 -0
  18. package/contracts/common-macros/src/ttl_configurable.rs +14 -44
  19. package/contracts/common-macros/src/upgradeable.rs +76 -0
  20. package/contracts/endpoint-v2/src/endpoint_v2.rs +25 -1
  21. package/contracts/endpoint-v2/src/tests/endpoint_setup.rs +175 -8
  22. package/contracts/endpoint-v2/src/tests/endpoint_v2/build_outbound_packet.rs +76 -0
  23. package/contracts/endpoint-v2/src/tests/endpoint_v2/clear.rs +342 -159
  24. package/contracts/endpoint-v2/src/tests/endpoint_v2/delegate.rs +3 -15
  25. package/contracts/endpoint-v2/src/tests/endpoint_v2/initializable.rs +20 -31
  26. package/contracts/endpoint-v2/src/tests/endpoint_v2/lz_receive_alert.rs +126 -164
  27. package/contracts/endpoint-v2/src/tests/endpoint_v2/mod.rs +1 -0
  28. package/contracts/endpoint-v2/src/tests/endpoint_v2/native_token.rs +0 -1
  29. package/contracts/endpoint-v2/src/tests/endpoint_v2/owner.rs +0 -1
  30. package/contracts/endpoint-v2/src/tests/endpoint_v2/pay_messaging_fees.rs +311 -304
  31. package/contracts/endpoint-v2/src/tests/endpoint_v2/quote.rs +423 -96
  32. package/contracts/endpoint-v2/src/tests/endpoint_v2/recover_token.rs +1 -1
  33. package/contracts/endpoint-v2/src/tests/endpoint_v2/require_oapp_auth.rs +47 -20
  34. package/contracts/endpoint-v2/src/tests/endpoint_v2/send.rs +373 -403
  35. package/contracts/endpoint-v2/src/tests/endpoint_v2/set_delegate.rs +96 -22
  36. package/contracts/endpoint-v2/src/tests/endpoint_v2/set_zro.rs +61 -9
  37. package/contracts/endpoint-v2/src/tests/endpoint_v2/transfer_ownership.rs +4 -4
  38. package/contracts/endpoint-v2/src/tests/endpoint_v2/ttl_config.rs +8 -11
  39. package/contracts/endpoint-v2/src/tests/endpoint_v2/verifiable.rs +81 -30
  40. package/contracts/endpoint-v2/src/tests/endpoint_v2/verify.rs +209 -76
  41. package/contracts/endpoint-v2/src/tests/endpoint_v2/zro.rs +0 -1
  42. package/contracts/endpoint-v2/src/tests/message_lib_manager/default_receive_library.rs +24 -0
  43. package/contracts/endpoint-v2/src/tests/message_lib_manager/default_receive_library_timeout.rs +40 -0
  44. package/contracts/endpoint-v2/src/tests/message_lib_manager/default_send_library.rs +24 -0
  45. package/contracts/endpoint-v2/src/tests/message_lib_manager/get_config.rs +108 -0
  46. package/contracts/endpoint-v2/src/tests/message_lib_manager/get_library_index.rs +52 -0
  47. package/contracts/endpoint-v2/src/tests/message_lib_manager/get_receive_library.rs +92 -0
  48. package/contracts/endpoint-v2/src/tests/message_lib_manager/get_registered_libraries.rs +74 -0
  49. package/contracts/endpoint-v2/src/tests/message_lib_manager/get_send_library.rs +83 -0
  50. package/contracts/endpoint-v2/src/tests/message_lib_manager/is_registered_library.rs +32 -0
  51. package/contracts/endpoint-v2/src/tests/message_lib_manager/is_supported_eid.rs +28 -0
  52. package/contracts/endpoint-v2/src/tests/message_lib_manager/is_valid_receive_library.rs +261 -0
  53. package/contracts/endpoint-v2/src/tests/message_lib_manager/mod.rs +16 -0
  54. package/contracts/endpoint-v2/src/tests/message_lib_manager/receive_library_timeout.rs +62 -0
  55. package/contracts/endpoint-v2/src/tests/message_lib_manager/register_library.rs +65 -43
  56. package/contracts/endpoint-v2/src/tests/message_lib_manager/registered_libraries_count.rs +42 -0
  57. package/contracts/endpoint-v2/src/tests/message_lib_manager/require_receive_lib_for_eid.rs +61 -0
  58. package/contracts/endpoint-v2/src/tests/message_lib_manager/require_registered.rs +3 -5
  59. package/contracts/endpoint-v2/src/tests/message_lib_manager/require_send_lib_for_eid.rs +59 -0
  60. package/contracts/endpoint-v2/src/tests/message_lib_manager/require_supported_eid.rs +15 -1
  61. package/contracts/endpoint-v2/src/tests/message_lib_manager/set_config.rs +155 -51
  62. package/contracts/endpoint-v2/src/tests/message_lib_manager/set_default_receive_lib_timeout.rs +114 -92
  63. package/contracts/endpoint-v2/src/tests/message_lib_manager/set_default_receive_library.rs +235 -132
  64. package/contracts/endpoint-v2/src/tests/message_lib_manager/set_default_send_library.rs +93 -87
  65. package/contracts/endpoint-v2/src/tests/message_lib_manager/set_receive_library.rs +346 -245
  66. package/contracts/endpoint-v2/src/tests/message_lib_manager/set_receive_library_timeout.rs +406 -60
  67. package/contracts/endpoint-v2/src/tests/message_lib_manager/set_send_library.rs +252 -78
  68. package/contracts/endpoint-v2/src/tests/message_lib_manager/timeout.rs +102 -0
  69. package/contracts/endpoint-v2/src/tests/messaging_channel/burn.rs +212 -273
  70. package/contracts/endpoint-v2/src/tests/messaging_channel/clear_payload.rs +203 -0
  71. package/contracts/endpoint-v2/src/tests/messaging_channel/inbound.rs +94 -0
  72. package/contracts/endpoint-v2/src/tests/messaging_channel/inbound_nonce.rs +78 -248
  73. package/contracts/endpoint-v2/src/tests/messaging_channel/inbound_payload_hash.rs +7 -282
  74. package/contracts/endpoint-v2/src/tests/messaging_channel/lazy_inbound_nonce.rs +6 -274
  75. package/contracts/endpoint-v2/src/tests/messaging_channel/mod.rs +3 -2
  76. package/contracts/endpoint-v2/src/tests/messaging_channel/next_guid.rs +86 -178
  77. package/contracts/endpoint-v2/src/tests/messaging_channel/nilify.rs +328 -212
  78. package/contracts/endpoint-v2/src/tests/messaging_channel/outbound.rs +68 -0
  79. package/contracts/endpoint-v2/src/tests/messaging_channel/outbound_nonce.rs +6 -209
  80. package/contracts/endpoint-v2/src/tests/messaging_channel/skip.rs +207 -159
  81. package/contracts/endpoint-v2/src/tests/messaging_composer/clear_compose.rs +142 -153
  82. package/contracts/endpoint-v2/src/tests/messaging_composer/compose_queue.rs +6 -179
  83. package/contracts/endpoint-v2/src/tests/messaging_composer/lz_compose_alert.rs +163 -221
  84. package/contracts/endpoint-v2/src/tests/messaging_composer/send_compose.rs +90 -121
  85. package/contracts/endpoint-v2/src/tests/mock.rs +18 -4
  86. package/contracts/endpoint-v2/src/tests/util/build_payload.rs +4 -70
  87. package/contracts/endpoint-v2/src/tests/util/compute_guid.rs +2 -1
  88. package/contracts/endpoint-v2/src/tests/util/keccak256.rs +17 -106
  89. package/contracts/layerzero-views/Cargo.toml +35 -0
  90. package/contracts/layerzero-views/src/errors.rs +10 -0
  91. package/contracts/layerzero-views/src/layerzero_view.rs +229 -0
  92. package/contracts/layerzero-views/src/lib.rs +38 -0
  93. package/contracts/layerzero-views/src/storage.rs +18 -0
  94. package/contracts/layerzero-views/src/tests/layerzero_view_tests.rs +423 -0
  95. package/contracts/layerzero-views/src/tests/mod.rs +4 -0
  96. package/contracts/layerzero-views/src/tests/setup.rs +377 -0
  97. package/contracts/layerzero-views/src/types.rs +50 -0
  98. package/contracts/macro-integration-tests/Cargo.toml +30 -0
  99. package/contracts/macro-integration-tests/src/lib.rs +1 -0
  100. package/contracts/macro-integration-tests/tests/runtime/ownable/initialization.rs +62 -0
  101. package/contracts/macro-integration-tests/tests/runtime/ownable/mod.rs +22 -0
  102. package/contracts/macro-integration-tests/tests/runtime/ownable/only_owner_guard.rs +97 -0
  103. package/contracts/macro-integration-tests/tests/runtime/ownable/ownership_transfer.rs +101 -0
  104. package/contracts/macro-integration-tests/tests/runtime/storage/keyed_roundtrip.rs +225 -0
  105. package/contracts/macro-integration-tests/tests/runtime/storage/mod.rs +4 -0
  106. package/contracts/macro-integration-tests/tests/runtime/storage/name_override_runtime.rs +52 -0
  107. package/contracts/macro-integration-tests/tests/runtime/storage/ttl_extension.rs +261 -0
  108. package/contracts/macro-integration-tests/tests/runtime/storage/unkeyed_roundtrip.rs +137 -0
  109. package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/configuration.rs +113 -0
  110. package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/extend_instance_ttl.rs +50 -0
  111. package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/freeze.rs +139 -0
  112. package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/mod.rs +3 -0
  113. package/contracts/macro-integration-tests/tests/runtime.rs +5 -0
  114. package/contracts/macro-integration-tests/tests/ui/error/fail/attr_not_empty.rs +12 -0
  115. package/contracts/macro-integration-tests/tests/ui/error/fail/attr_not_empty.stderr +7 -0
  116. package/contracts/macro-integration-tests/tests/ui/error/fail/decreasing_discriminant.rs +12 -0
  117. package/contracts/macro-integration-tests/tests/ui/error/fail/decreasing_discriminant.stderr +7 -0
  118. package/contracts/macro-integration-tests/tests/ui/error/fail/non_int_discriminant.rs +21 -0
  119. package/contracts/macro-integration-tests/tests/ui/error/fail/non_int_discriminant.stderr +7 -0
  120. package/contracts/macro-integration-tests/tests/ui/error/fail/non_unit_variant.rs +13 -0
  121. package/contracts/macro-integration-tests/tests/ui/error/fail/non_unit_variant.stderr +7 -0
  122. package/contracts/macro-integration-tests/tests/ui/error/pass/attr_on_variant_allowed.rs +20 -0
  123. package/contracts/macro-integration-tests/tests/ui/error/pass/basic_auto_discriminants.rs +15 -0
  124. package/contracts/macro-integration-tests/tests/ui/error/pass/mixed_discriminants.rs +16 -0
  125. package/contracts/macro-integration-tests/tests/ui/ownable/fail/only_owner_missing_env.rs +22 -0
  126. package/contracts/macro-integration-tests/tests/ui/ownable/fail/only_owner_missing_env.stderr +16 -0
  127. package/contracts/macro-integration-tests/tests/ui/ownable/pass/minimal_contract.rs +26 -0
  128. package/contracts/macro-integration-tests/tests/ui/ownable/pass/namespacing_and_imports.rs +22 -0
  129. package/contracts/macro-integration-tests/tests/ui/ownable/pass/only_owner_env_param_variants.rs +46 -0
  130. package/contracts/macro-integration-tests/tests/ui/storage/fail/invalid_storage_type_param.rs +13 -0
  131. package/contracts/macro-integration-tests/tests/ui/storage/fail/invalid_storage_type_param.stderr +7 -0
  132. package/contracts/macro-integration-tests/tests/ui/storage/fail/missing_storage_type_param.rs +13 -0
  133. package/contracts/macro-integration-tests/tests/ui/storage/fail/missing_storage_type_param.stderr +7 -0
  134. package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_storage_kinds.rs +10 -0
  135. package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_storage_kinds.stderr +7 -0
  136. package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_type_params.rs +12 -0
  137. package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_type_params.stderr +7 -0
  138. package/contracts/macro-integration-tests/tests/ui/storage/fail/no_ttl_extension_on_non_persistent.rs +10 -0
  139. package/contracts/macro-integration-tests/tests/ui/storage/fail/no_ttl_extension_on_non_persistent.stderr +7 -0
  140. package/contracts/macro-integration-tests/tests/ui/storage/fail/non_enum_input.rs +10 -0
  141. package/contracts/macro-integration-tests/tests/ui/storage/fail/non_enum_input.stderr +7 -0
  142. package/contracts/macro-integration-tests/tests/ui/storage/fail/storage_attr_rejects_args.rs +12 -0
  143. package/contracts/macro-integration-tests/tests/ui/storage/fail/storage_attr_rejects_args.stderr +7 -0
  144. package/contracts/macro-integration-tests/tests/ui/storage/fail/tuple_variant_rejected.rs +13 -0
  145. package/contracts/macro-integration-tests/tests/ui/storage/fail/tuple_variant_rejected.stderr +7 -0
  146. package/contracts/macro-integration-tests/tests/ui/storage/fail/unknown_variant_attr.rs +13 -0
  147. package/contracts/macro-integration-tests/tests/ui/storage/fail/unknown_variant_attr.stderr +7 -0
  148. package/contracts/macro-integration-tests/tests/ui/storage/pass/default_value_on_variant.rs +14 -0
  149. package/contracts/macro-integration-tests/tests/ui/storage/pass/enum_instance_unit_basic.rs +14 -0
  150. package/contracts/macro-integration-tests/tests/ui/storage/pass/enum_persistent_named_fields_keyed.rs +16 -0
  151. package/contracts/macro-integration-tests/tests/ui/storage/pass/enum_temporary_unit_option.rs +15 -0
  152. package/contracts/macro-integration-tests/tests/ui/storage/pass/name_override.rs +14 -0
  153. package/contracts/macro-integration-tests/tests/ui/storage/pass/no_auto_ttl_extension.rs +19 -0
  154. package/contracts/macro-integration-tests/tests/ui/storage/pass/ttl_provider_basic.rs +15 -0
  155. package/contracts/macro-integration-tests/tests/ui/ttl_configurable/pass/minimal_contract.rs +44 -0
  156. package/contracts/macro-integration-tests/tests/ui_error.rs +11 -0
  157. package/contracts/macro-integration-tests/tests/ui_ownable.rs +11 -0
  158. package/contracts/macro-integration-tests/tests/ui_storage.rs +11 -0
  159. package/contracts/macro-integration-tests/tests/ui_ttl_configurable.rs +12 -0
  160. package/contracts/message-libs/blocked-message-lib/src/lib.rs +17 -17
  161. package/contracts/message-libs/message-lib-common/src/tests/packet_codec_v1/decode_packet_header.rs +64 -0
  162. package/contracts/message-libs/message-lib-common/src/tests/packet_codec_v1/encode_packet.rs +58 -0
  163. package/contracts/message-libs/message-lib-common/src/tests/packet_codec_v1/encode_packet_header.rs +138 -0
  164. package/contracts/message-libs/message-lib-common/src/tests/packet_codec_v1/mod.rs +6 -0
  165. package/contracts/message-libs/message-lib-common/src/tests/packet_codec_v1/payload.rs +30 -0
  166. package/contracts/message-libs/message-lib-common/src/tests/packet_codec_v1/payload_hash.rs +15 -0
  167. package/contracts/message-libs/message-lib-common/src/tests/packet_codec_v1/test_helper.rs +39 -0
  168. package/contracts/message-libs/message-lib-common/src/tests/worker_options/append_dvn_option.rs +57 -0
  169. package/contracts/message-libs/message-lib-common/src/tests/worker_options/append_lz_receive_option.rs +50 -0
  170. package/contracts/message-libs/message-lib-common/src/tests/worker_options/append_native_drop_option.rs +74 -0
  171. package/contracts/message-libs/message-lib-common/src/tests/worker_options/convert_legacy_options.rs +280 -0
  172. package/contracts/message-libs/message-lib-common/src/tests/worker_options/extract_type_3_options.rs +126 -0
  173. package/contracts/message-libs/message-lib-common/src/tests/worker_options/left_pad_to_bytes32.rs +48 -0
  174. package/contracts/message-libs/message-lib-common/src/tests/worker_options/mod.rs +7 -0
  175. package/contracts/message-libs/message-lib-common/src/tests/worker_options/split_worker_options.rs +139 -0
  176. package/contracts/message-libs/message-lib-common/src/worker_options.rs +31 -1
  177. package/contracts/message-libs/simple-message-lib/src/simple_message_lib.rs +2 -2
  178. package/contracts/message-libs/treasury/src/errors.rs +0 -1
  179. package/contracts/message-libs/treasury/src/lib.rs +3 -3
  180. package/contracts/message-libs/treasury/src/storage.rs +2 -0
  181. package/contracts/message-libs/treasury/src/treasury.rs +12 -13
  182. package/contracts/message-libs/uln-302/Cargo.toml +1 -1
  183. package/contracts/message-libs/uln-302/src/errors.rs +0 -5
  184. package/contracts/message-libs/uln-302/src/events.rs +5 -6
  185. package/contracts/message-libs/uln-302/src/receive_uln.rs +24 -54
  186. package/contracts/message-libs/uln-302/src/send_uln.rs +89 -135
  187. package/contracts/message-libs/uln-302/src/storage.rs +5 -5
  188. package/contracts/message-libs/uln-302/src/tests/receive_uln302/effective_receive_uln_config.rs +5 -7
  189. package/contracts/message-libs/uln-302/src/tests/receive_uln302/set_default_receive_uln_configs.rs +3 -3
  190. package/contracts/message-libs/uln-302/src/tests/send_uln302/effective_send_uln_config.rs +6 -9
  191. package/contracts/message-libs/uln-302/src/tests/send_uln302/set_default_executor_configs.rs +2 -2
  192. package/contracts/message-libs/uln-302/src/tests/send_uln302/set_default_send_uln_configs.rs +3 -3
  193. package/contracts/message-libs/uln-302/src/tests/setup.rs +9 -0
  194. package/contracts/message-libs/uln-302/src/tests/testing_utils.rs +5 -0
  195. package/contracts/message-libs/uln-302/src/tests/uln302/get_app_receive_uln_config.rs +1 -2
  196. package/contracts/message-libs/uln-302/src/tests/uln302/get_app_send_uln_config.rs +1 -2
  197. package/contracts/message-libs/uln-302/src/tests/uln302/set_config.rs +37 -55
  198. package/contracts/message-libs/uln-302/src/uln302.rs +8 -5
  199. package/contracts/oapps/counter/src/counter.rs +0 -1
  200. package/contracts/oapps/oapp/src/macro_tests/test_macros.rs +306 -224
  201. package/contracts/oapps/oapp/src/tests/test_oapp_core.rs +0 -1
  202. package/contracts/oapps/oapp/src/tests/test_oapp_options_type3.rs +0 -1
  203. package/contracts/oapps/oapp/src/tests/test_oapp_receiver.rs +0 -1
  204. package/contracts/oapps/oapp/src/tests/test_oapp_sender.rs +0 -1
  205. package/contracts/{oapp-macros → oapps/oapp-macros}/src/oapp_core.rs +1 -0
  206. package/contracts/oapps/oft/integration-tests/setup.rs +10 -3
  207. package/contracts/oapps/oft/integration-tests/utils.rs +1 -1
  208. package/contracts/oapps/oft/src/default_oft_impl.rs +9 -3
  209. package/contracts/oapps/oft/src/extensions/oft_fee.rs +5 -5
  210. package/contracts/oapps/oft/src/extensions/pausable.rs +1 -1
  211. package/contracts/oapps/oft/src/extensions/rate_limiter.rs +18 -18
  212. package/contracts/oapps/oft/src/oft.rs +9 -9
  213. package/contracts/oapps/oft/src/oft_types/lock_unlock.rs +1 -1
  214. package/contracts/oapps/oft/src/tests/extensions/setup.rs +26 -11
  215. package/contracts/oapps/oft/src/tests/extensions/test_rate_limiter.rs +1 -1
  216. package/contracts/oapps/oft/src/tests/test_send.rs +4 -4
  217. package/contracts/oapps/oft/src/tests/test_utils.rs +93 -74
  218. package/contracts/oapps/oft-std/Cargo.toml +6 -0
  219. package/contracts/oapps/oft-std/integration-tests/extensions/mod.rs +3 -0
  220. package/contracts/oapps/oft-std/integration-tests/extensions/test_oft_fee.rs +157 -0
  221. package/contracts/oapps/oft-std/integration-tests/extensions/test_pausable.rs +162 -0
  222. package/contracts/oapps/oft-std/integration-tests/extensions/test_rate_limiter.rs +186 -0
  223. package/contracts/oapps/oft-std/integration-tests/mod.rs +3 -0
  224. package/contracts/oapps/oft-std/integration-tests/setup.rs +245 -0
  225. package/contracts/oapps/oft-std/integration-tests/utils.rs +427 -0
  226. package/contracts/oapps/oft-std/src/lib.rs +12 -1
  227. package/contracts/oapps/oft-std/src/oft.rs +122 -25
  228. package/contracts/upgrader/Cargo.toml +19 -0
  229. package/contracts/upgrader/src/lib.rs +96 -0
  230. package/contracts/upgrader/src/tests/mod.rs +1 -0
  231. package/contracts/upgrader/src/tests/test_data/test_upgradeable_contract1.wasm +0 -0
  232. package/contracts/upgrader/src/tests/test_data/test_upgradeable_contract2.wasm +0 -0
  233. package/contracts/upgrader/src/tests/test_upgrader.rs +120 -0
  234. package/contracts/utils/src/errors.rs +6 -1
  235. package/contracts/utils/src/lib.rs +2 -1
  236. package/contracts/utils/src/ownable.rs +49 -61
  237. package/contracts/utils/src/tests/mod.rs +3 -1
  238. package/contracts/utils/src/tests/option_ext.rs +21 -0
  239. package/contracts/utils/src/tests/ownable.rs +10 -69
  240. package/contracts/utils/src/tests/ttl_configurable.rs +596 -0
  241. package/contracts/utils/src/tests/upgradeable.rs +288 -0
  242. package/contracts/utils/src/{ttl.rs → ttl_configurable.rs} +67 -52
  243. package/contracts/utils/src/upgradeable.rs +54 -0
  244. package/contracts/workers/dvn/Cargo.toml +1 -1
  245. package/contracts/workers/dvn/src/auth.rs +21 -32
  246. package/contracts/workers/dvn/src/dvn.rs +40 -3
  247. package/contracts/workers/dvn/src/errors.rs +1 -0
  248. package/contracts/workers/dvn/src/multisig.rs +10 -6
  249. package/contracts/workers/dvn/src/tests/multisig/set_threshold.rs +2 -2
  250. package/contracts/workers/dvn/src/tests/multisig/verify_signatures.rs +4 -4
  251. package/contracts/workers/dvn-fee-lib/Cargo.toml +1 -2
  252. package/contracts/workers/dvn-fee-lib/src/dvn_fee_lib.rs +46 -14
  253. package/contracts/workers/dvn-fee-lib/src/errors.rs +3 -2
  254. package/contracts/workers/dvn-fee-lib/src/lib.rs +5 -11
  255. package/contracts/workers/dvn-fee-lib/src/tests/dvn_fee_lib.rs +30 -16
  256. package/contracts/workers/executor/src/executor.rs +16 -2
  257. package/contracts/workers/executor-fee-lib/src/errors.rs +9 -7
  258. package/contracts/workers/executor-fee-lib/src/executor_fee_lib.rs +154 -119
  259. package/contracts/workers/executor-helper/Cargo.toml +0 -5
  260. package/contracts/workers/executor-helper/src/lib.rs +1 -7
  261. package/contracts/workers/price-feed/Cargo.toml +0 -1
  262. package/contracts/workers/price-feed/src/errors.rs +3 -2
  263. package/contracts/workers/price-feed/src/lib.rs +5 -6
  264. package/contracts/workers/price-feed/src/price_feed.rs +39 -17
  265. package/contracts/workers/worker/Cargo.toml +4 -0
  266. package/contracts/workers/worker/src/interfaces/price_feed.rs +3 -3
  267. package/contracts/workers/worker/src/lib.rs +2 -2
  268. package/contracts/workers/worker/src/tests/mod.rs +4 -0
  269. package/contracts/workers/worker/src/tests/setup.rs +147 -0
  270. package/contracts/workers/worker/src/tests/worker.rs +501 -0
  271. package/contracts/workers/worker/src/worker.rs +10 -16
  272. package/package.json +3 -3
  273. package/sdk/dist/generated/bml.d.ts +40 -30
  274. package/sdk/dist/generated/bml.js +16 -11
  275. package/sdk/dist/generated/counter.d.ts +168 -134
  276. package/sdk/dist/generated/counter.js +26 -21
  277. package/sdk/dist/generated/dvn.d.ts +1932 -0
  278. package/sdk/dist/generated/dvn.js +288 -0
  279. package/sdk/dist/generated/dvn_fee_lib.d.ts +615 -0
  280. package/sdk/dist/generated/dvn_fee_lib.js +123 -0
  281. package/sdk/dist/generated/endpoint.d.ts +75 -41
  282. package/sdk/dist/generated/endpoint.js +22 -17
  283. package/sdk/dist/generated/executor.d.ts +1809 -0
  284. package/sdk/dist/generated/executor.js +269 -0
  285. package/sdk/dist/generated/executor_fee_lib.d.ts +999 -0
  286. package/sdk/dist/generated/executor_fee_lib.js +208 -0
  287. package/sdk/dist/generated/executor_helper.d.ts +869 -0
  288. package/sdk/dist/generated/executor_helper.js +187 -0
  289. package/sdk/dist/generated/oft_std.d.ts +1544 -0
  290. package/sdk/dist/generated/oft_std.js +271 -0
  291. package/sdk/dist/generated/price_feed.d.ts +1002 -0
  292. package/sdk/dist/generated/price_feed.js +170 -0
  293. package/sdk/dist/generated/sml.d.ts +75 -41
  294. package/sdk/dist/generated/sml.js +22 -17
  295. package/sdk/dist/generated/uln302.d.ts +79 -60
  296. package/sdk/dist/generated/uln302.js +37 -37
  297. package/sdk/dist/generated/upgrader.d.ts +70 -0
  298. package/sdk/dist/generated/upgrader.js +19 -0
  299. package/sdk/dist/index.d.ts +8 -0
  300. package/sdk/dist/index.js +11 -0
  301. package/sdk/package.json +4 -3
  302. package/sdk/src/index.ts +13 -0
  303. package/sdk/test/index.test.ts +0 -1
  304. package/sdk/test/oft.test.ts +12 -23
  305. package/sdk/test/suites/testUpgradeable.ts +169 -0
  306. package/sdk/test/upgrader.test.ts +309 -0
  307. package/tools/ts-bindings-gen/src/main.rs +11 -1
  308. package/contracts/endpoint-v2/src/tests/messaging_channel/clear.rs +0 -316
  309. package/contracts/endpoint-v2/src/tests/messaging_channel/internal.rs +0 -388
  310. package/contracts/message-libs/message-lib-common/src/tests/packet_codec_v1.rs +0 -162
  311. package/contracts/message-libs/message-lib-common/src/tests/worker_options.rs +0 -319
  312. package/contracts/utils/src/tests/ttl.rs +0 -421
  313. /package/contracts/{oapp-macros → oapps/oapp-macros}/Cargo.toml +0 -0
  314. /package/contracts/{oapp-macros → oapps/oapp-macros}/src/lib.rs +0 -0
  315. /package/contracts/{oapp-macros → oapps/oapp-macros}/src/oapp_full.rs +0 -0
  316. /package/contracts/{oapp-macros → oapps/oapp-macros}/src/oapp_options_type3.rs +0 -0
  317. /package/contracts/{oapp-macros → oapps/oapp-macros}/src/oapp_receiver.rs +0 -0
  318. /package/contracts/{oapp-macros → oapps/oapp-macros}/src/oapp_sender.rs +0 -0
  319. /package/contracts/{oapp-macros → oapps/oapp-macros}/src/util.rs +0 -0
@@ -0,0 +1,22 @@
1
+ // UI (trybuild) test: macro expansion does not rely on downstream imports.
2
+ //
3
+ // Purpose:
4
+ // - Ensures a downstream crate can use the generated `Ownable` trait impl via a fully-qualified path
5
+ // without importing `utils::ownable::Ownable` into scope.
6
+ // - Catches regressions where the macro-generated code would require extra `use` statements.
7
+
8
+ use soroban_sdk::{contract, contractimpl, Env};
9
+
10
+ #[contract]
11
+ #[common_macros::ownable]
12
+ pub struct MyContract;
13
+
14
+ #[contractimpl]
15
+ impl MyContract {
16
+ pub fn foo(env: Env) {
17
+ // Call using the fully-qualified trait path without importing the trait.
18
+ let _ = <Self as utils::ownable::Ownable>::owner(&env);
19
+ }
20
+ }
21
+
22
+ fn main() {}
@@ -0,0 +1,46 @@
1
+ // UI (trybuild) test: `#[only_owner]` supports different `Env` parameter placements.
2
+ //
3
+ // Purpose:
4
+ // - Verifies `#[common_macros::only_owner]` can locate an `Env` argument in the function signature,
5
+ // even when `Env` is not the first parameter.
6
+ // - Uses `&Env` forms to match the most common `require_owner_auth` signature shape.
7
+
8
+ use soroban_sdk::{contract, Env};
9
+
10
+ #[contract]
11
+ #[common_macros::ownable]
12
+ pub struct MyContract;
13
+
14
+ impl MyContract {
15
+ // `Env` as the first argument, by reference.
16
+ #[common_macros::only_owner]
17
+ pub fn f1(env: &Env) {
18
+ let _ = env;
19
+ }
20
+
21
+ // `Env` not in the first position.
22
+ #[common_macros::only_owner]
23
+ pub fn f2(x: u32, env: &Env) {
24
+ let _ = (x, env);
25
+ }
26
+
27
+ // `Env` using a fully-qualified type path.
28
+ #[common_macros::only_owner]
29
+ pub fn f3(env: &soroban_sdk::Env) {
30
+ let _ = env;
31
+ }
32
+
33
+ // Env by value
34
+ #[common_macros::only_owner]
35
+ pub fn f4(env: Env) {
36
+ let _ = env;
37
+ }
38
+
39
+ // Qualified Env by value, not first param
40
+ #[common_macros::only_owner]
41
+ pub fn f5(x: u32, env: soroban_sdk::Env) {
42
+ let _ = (x, env);
43
+ }
44
+ }
45
+
46
+ fn main() {}
@@ -0,0 +1,13 @@
1
+ // UI (trybuild) negative test: invalid storage value type parameter is rejected.
2
+ //
3
+ // Purpose:
4
+ // - Ensures the type parameter must parse as a Rust type (`syn::Type`).
5
+ // - Locks down downstream UX for invalid inputs like string literals.
6
+
7
+ #[common_macros::storage]
8
+ pub enum StorageKey {
9
+ #[persistent("not_a_type")]
10
+ Bad,
11
+ }
12
+
13
+ fn main() {}
@@ -0,0 +1,7 @@
1
+ error: custom attribute panicked
2
+ --> tests/ui/storage/fail/invalid_storage_type_param.rs:7:1
3
+ |
4
+ 7 | #[common_macros::storage]
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
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
@@ -0,0 +1,13 @@
1
+ // UI (trybuild) negative test: missing storage value type parameter is rejected.
2
+ //
3
+ // Purpose:
4
+ // - Ensures storage kind attributes (instance/persistent/temporary) require exactly one type parameter.
5
+ // - Locks down downstream UX for the common mistake: `#[instance]` (missing type).
6
+
7
+ #[common_macros::storage]
8
+ pub enum StorageKey {
9
+ #[instance]
10
+ Counter,
11
+ }
12
+
13
+ fn main() {}
@@ -0,0 +1,7 @@
1
+ error: custom attribute panicked
2
+ --> tests/ui/storage/fail/missing_storage_type_param.rs:7:1
3
+ |
4
+ 7 | #[common_macros::storage]
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
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
@@ -0,0 +1,10 @@
1
+ // UI (trybuild) negative test: variant must specify exactly one storage kind.
2
+
3
+ #[common_macros::storage]
4
+ pub enum StorageKey {
5
+ #[instance(u32)]
6
+ #[persistent(u32)]
7
+ Counter,
8
+ }
9
+
10
+ fn main() {}
@@ -0,0 +1,7 @@
1
+ error: custom attribute panicked
2
+ --> tests/ui/storage/fail/multiple_storage_kinds.rs:3:1
3
+ |
4
+ 3 | #[common_macros::storage]
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
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 at least 2 elements when exactly one was expected
@@ -0,0 +1,12 @@
1
+ // UI (trybuild) negative test: storage type attribute must have exactly one type parameter.
2
+ //
3
+ // Purpose:
4
+ // - Ensures multiple type parameters are rejected (e.g., #[persistent(u32, i32)]).
5
+
6
+ #[common_macros::storage]
7
+ pub enum StorageKey {
8
+ #[persistent(u32, i32)]
9
+ A,
10
+ }
11
+
12
+ fn main() {}
@@ -0,0 +1,7 @@
1
+ error: custom attribute panicked
2
+ --> tests/ui/storage/fail/multiple_type_params.rs:6:1
3
+ |
4
+ 6 | #[common_macros::storage]
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
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
@@ -0,0 +1,10 @@
1
+ // UI (trybuild) negative test: #[no_ttl_extension] is only valid on persistent storage variants.
2
+
3
+ #[common_macros::storage]
4
+ pub enum StorageKey {
5
+ #[instance(u32)]
6
+ #[no_ttl_extension]
7
+ Counter,
8
+ }
9
+
10
+ fn main() {}
@@ -0,0 +1,7 @@
1
+ error: custom attribute panicked
2
+ --> tests/ui/storage/fail/no_ttl_extension_on_non_persistent.rs:3:1
3
+ |
4
+ 3 | #[common_macros::storage]
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
6
+ |
7
+ = help: message: failed to parse storage variant for Counter: #[no_ttl_extension] can only be used with #[persistent(...)] storage
@@ -0,0 +1,10 @@
1
+ // UI (trybuild) negative test: `#[storage]` must be applied to an enum.
2
+ //
3
+ // Purpose:
4
+ // - Ensures non-enum input (struct) is rejected at compile time.
5
+ // - Locks down the enum-only contract for downstream users.
6
+
7
+ #[common_macros::storage]
8
+ pub struct NotAnEnum;
9
+
10
+ fn main() {}
@@ -0,0 +1,7 @@
1
+ error: custom attribute panicked
2
+ --> tests/ui/storage/fail/non_enum_input.rs:7:1
3
+ |
4
+ 7 | #[common_macros::storage]
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
6
+ |
7
+ = help: message: failed to parse enum: expected `enum`
@@ -0,0 +1,12 @@
1
+ // UI (trybuild) negative test: `#[storage(...)]` does not accept arguments.
2
+ //
3
+ // Purpose:
4
+ // - Ensures the `#[common_macros::storage]` attribute is argument-less; passing any tokens should fail.
5
+
6
+ #[common_macros::storage("not_a_path")]
7
+ pub enum StorageKey {
8
+ #[instance(u32)]
9
+ A,
10
+ }
11
+
12
+ fn main() {}
@@ -0,0 +1,7 @@
1
+ error: custom attribute panicked
2
+ --> tests/ui/storage/fail/storage_attr_rejects_args.rs:6:1
3
+ |
4
+ 6 | #[common_macros::storage("not_a_path")]
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6
+ |
7
+ = help: message: the #[storage] attribute does not accept arguments
@@ -0,0 +1,13 @@
1
+ // UI (trybuild) negative test: tuple variants are rejected.
2
+ //
3
+ // Purpose:
4
+ // - Ensures only unit variants or named-fields variants are supported.
5
+ // - Tuple variants (e.g., Foo(u32)) must fail compilation.
6
+
7
+ #[common_macros::storage]
8
+ pub enum StorageKey {
9
+ #[instance(u32)]
10
+ Tuple(u32),
11
+ }
12
+
13
+ fn main() {}
@@ -0,0 +1,7 @@
1
+ error: custom attribute panicked
2
+ --> tests/ui/storage/fail/tuple_variant_rejected.rs:7:1
3
+ |
4
+ 7 | #[common_macros::storage]
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
6
+ |
7
+ = help: message: only unit variants or named fields are supported in storage enums
@@ -0,0 +1,13 @@
1
+ // UI (trybuild) negative test: unknown attribute on a variant is rejected.
2
+ //
3
+ // Purpose:
4
+ // - Ensures the storage macro rejects unsupported attributes on variants.
5
+
6
+ #[common_macros::storage]
7
+ pub enum StorageKey {
8
+ #[instance(u32)]
9
+ #[wat]
10
+ Counter,
11
+ }
12
+
13
+ fn main() {}
@@ -0,0 +1,7 @@
1
+ error: custom attribute panicked
2
+ --> tests/ui/storage/fail/unknown_variant_attr.rs:6:1
3
+ |
4
+ 6 | #[common_macros::storage]
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
6
+ |
7
+ = help: message: failed to parse storage variant for Counter: unknown attribute 'wat' on variant 'Counter'. Supported attributes are: doc, instance, persistent, temporary, default, name, no_ttl_extension
@@ -0,0 +1,14 @@
1
+ // UI (trybuild) test: default value attribute on a variant compiles.
2
+ //
3
+ // Purpose:
4
+ // - Ensures `#[default(...)]` is accepted and parsed.
5
+ // - Avoids asserting runtime semantics here (handled by runtime tests); this is compile-time contract only.
6
+
7
+ #[common_macros::storage]
8
+ pub enum StorageKey {
9
+ #[instance(u32)]
10
+ #[default(0)]
11
+ Counter,
12
+ }
13
+
14
+ fn main() {}
@@ -0,0 +1,14 @@
1
+ // UI (trybuild) test: basic instance storage on a unit variant compiles.
2
+ //
3
+ // Purpose:
4
+ // - Ensures `#[common_macros::storage]` works on enums (enum-only contract).
5
+ // - Ensures unit variants are supported.
6
+ // - Ensures `#[instance(T)]` accepts exactly one type parameter.
7
+
8
+ #[common_macros::storage]
9
+ pub enum StorageKey {
10
+ #[instance(u32)]
11
+ Counter,
12
+ }
13
+
14
+ fn main() {}
@@ -0,0 +1,16 @@
1
+ // UI (trybuild) test: persistent storage on a named-fields (keyed) variant compiles.
2
+ //
3
+ // Purpose:
4
+ // - Ensures named-fields variants are supported (keyed patterns).
5
+ // - Ensures `#[persistent(T)]` accepts exactly one type parameter.
6
+ // - Uses a Soroban type as key to reflect realistic usage.
7
+
8
+ use soroban_sdk::BytesN;
9
+
10
+ #[common_macros::storage]
11
+ pub enum StorageKey {
12
+ #[persistent(i128)]
13
+ Balance { key: BytesN<32> },
14
+ }
15
+
16
+ fn main() {}
@@ -0,0 +1,15 @@
1
+ // UI (trybuild) test: temporary storage with Option value type compiles.
2
+ //
3
+ // Purpose:
4
+ // - Ensures `#[temporary(T)]` works with `Option<...>` value types.
5
+ // - Covers the "temporary + option value type" parsing path.
6
+
7
+ use soroban_sdk::Address;
8
+
9
+ #[common_macros::storage]
10
+ pub enum StorageKey {
11
+ #[temporary(Option<Address>)]
12
+ MaybeOwner,
13
+ }
14
+
15
+ fn main() {}
@@ -0,0 +1,14 @@
1
+ // UI (trybuild) test: name override attribute compiles.
2
+ //
3
+ // Purpose:
4
+ // - Ensures `#[name("...")]` is accepted and parsed.
5
+ // - Locks down compile-time contract for custom key naming.
6
+
7
+ #[common_macros::storage]
8
+ pub enum StorageKey {
9
+ #[instance(bool)]
10
+ #[name("custom_flag")]
11
+ Flag,
12
+ }
13
+
14
+ fn main() {}
@@ -0,0 +1,19 @@
1
+ // UI (trybuild) test: `#[no_ttl_extension]` compiles.
2
+ //
3
+ // Purpose:
4
+ // - Ensures `#[no_ttl_extension]` is accepted on variants.
5
+ // - Does NOT assert runtime TTL extension behavior (covered by runtime tests).
6
+
7
+ use soroban_sdk::BytesN;
8
+
9
+ #[common_macros::storage]
10
+ pub enum StorageKey {
11
+ #[persistent(i128)]
12
+ #[no_ttl_extension]
13
+ Balance { key: BytesN<32> },
14
+
15
+ #[persistent(i128)]
16
+ Balance2 { key: BytesN<32> },
17
+ }
18
+
19
+ fn main() {}
@@ -0,0 +1,15 @@
1
+ // UI (trybuild) test: storage macro compiles.
2
+ //
3
+ // Purpose:
4
+ // - Ensures `#[common_macros::storage]` compiles in a downstream crate.
5
+ // - Does NOT assert runtime TTL extension semantics (covered by runtime tests).
6
+
7
+ use soroban_sdk::BytesN;
8
+
9
+ #[common_macros::storage]
10
+ pub enum StorageKey {
11
+ #[persistent(i128)]
12
+ Balance { key: BytesN<32> },
13
+ }
14
+
15
+ fn main() {}
@@ -0,0 +1,44 @@
1
+ // UI (trybuild) test: `#[ttl_configurable]` on a minimal contract compiles.
2
+ //
3
+ // Purpose:
4
+ // - Ensures `#[common_macros::ttl_configurable]` can be applied to a contract struct in a downstream crate.
5
+ // - Validates the macro-generated `utils::ttl::TtlConfigurable` trait impl exists and is callable.
6
+ // - Validates `#[ttl_configurable]` also injects `#[ownable]` (so init_owner exists) without requiring
7
+ // downstream imports or special setup.
8
+ // - Avoids snapshotting token output; compilation success + type-checking is the integration contract.
9
+
10
+ use common_macros::{ownable, ttl_configurable};
11
+ use soroban_sdk::{contract, contractimpl, Address, Env};
12
+
13
+ #[contract]
14
+ #[ttl_configurable]
15
+ #[ownable]
16
+ pub struct MyContract;
17
+
18
+ #[contractimpl]
19
+ impl MyContract {
20
+ // Provide a small init entry to type-check the injected ownable helper exists.
21
+ pub fn init(env: Env, owner: Address) {
22
+ // `init_owner` should exist because `#[ttl_configurable]` injects `#[ownable]`.
23
+ Self::init_owner(&env, &owner);
24
+ }
25
+
26
+ // Provide a method that type-checks the TtlConfigurable trait impl exists.
27
+ pub fn smoke(env: Env) {
28
+ // Read current TTL configs.
29
+ let _cfg: (Option<TtlConfig>, Option<TtlConfig>) = Self::ttl_configs(&env);
30
+
31
+ // Read frozen flag.
32
+ let _frozen: bool = Self::is_ttl_configs_frozen(&env);
33
+
34
+ // Type-check setter and freezer signatures.
35
+ let none: Option<TtlConfig> = None;
36
+ Self::set_ttl_configs(&env, &none, &none);
37
+ Self::freeze_ttl_configs(&env);
38
+
39
+ // Type-check the inherent manual instance TTL extender exists.
40
+ Self::extend_instance_ttl(&env, 1, 2);
41
+ }
42
+ }
43
+
44
+ fn main() {}
@@ -0,0 +1,11 @@
1
+ #[test]
2
+ fn ui_error() {
3
+ // Important: set this before trybuild::TestCases::new() so each shard has
4
+ // its own trybuild project directory + lock + artifacts.
5
+ let target_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("target/trybuild-shards/ui_error");
6
+ std::env::set_var("CARGO_TARGET_DIR", target_dir.as_os_str());
7
+
8
+ let t = trybuild::TestCases::new();
9
+ t.pass("tests/ui/error/**/pass/*.rs");
10
+ t.compile_fail("tests/ui/error/**/fail/*.rs");
11
+ }
@@ -0,0 +1,11 @@
1
+ #[test]
2
+ fn ui_ownable() {
3
+ // Important: set this before trybuild::TestCases::new() so each shard has
4
+ // its own trybuild project directory + lock + artifacts.
5
+ let target_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("target/trybuild-shards/ui_ownable");
6
+ std::env::set_var("CARGO_TARGET_DIR", target_dir.as_os_str());
7
+
8
+ let t = trybuild::TestCases::new();
9
+ t.pass("tests/ui/ownable/**/pass/*.rs");
10
+ t.compile_fail("tests/ui/ownable/**/fail/*.rs");
11
+ }
@@ -0,0 +1,11 @@
1
+ #[test]
2
+ fn ui_storage() {
3
+ // Important: set this before trybuild::TestCases::new() so each shard has
4
+ // its own trybuild project directory + lock + artifacts.
5
+ let target_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("target/trybuild-shards/ui_storage");
6
+ std::env::set_var("CARGO_TARGET_DIR", target_dir.as_os_str());
7
+
8
+ let t = trybuild::TestCases::new();
9
+ t.pass("tests/ui/storage/**/pass/*.rs");
10
+ t.compile_fail("tests/ui/storage/**/fail/*.rs");
11
+ }
@@ -0,0 +1,12 @@
1
+ #[test]
2
+ fn ui_ttl_configurable() {
3
+ // Important: set this before trybuild::TestCases::new() so each shard has
4
+ // its own trybuild project directory + lock + artifacts.
5
+ let target_dir =
6
+ std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("target/trybuild-shards/ui_ttl_configurable");
7
+ std::env::set_var("CARGO_TARGET_DIR", target_dir.as_os_str());
8
+
9
+ let t = trybuild::TestCases::new();
10
+ t.pass("tests/ui/ttl_configurable/**/pass/*.rs");
11
+ t.compile_fail("tests/ui/ttl_configurable/**/fail/*.rs");
12
+ }
@@ -20,19 +20,24 @@ use endpoint_v2::{
20
20
  use soroban_sdk::{contract, panic_with_error, Address, Bytes, Env, Vec};
21
21
 
22
22
  #[contract_error]
23
- enum BlockMessageLibError {
23
+ enum BlockedMessageLibError {
24
24
  NotImplemented,
25
25
  }
26
26
 
27
27
  /// Block Message Library contract that rejects all messaging operations.
28
28
  #[contract]
29
- pub struct BlockMessageLib; // TODO: rename to BlockedMessageLib
29
+ pub struct BlockedMessageLib;
30
30
 
31
31
  #[contract_impl]
32
- impl IMessageLib for BlockMessageLib {
32
+ impl IMessageLib for BlockedMessageLib {
33
+ /// Always panics - config modification is not supported.
34
+ fn set_config(env: &Env, _oapp: &Address, _param: &Vec<SetConfigParam>) {
35
+ panic_with_error!(&env, BlockedMessageLibError::NotImplemented);
36
+ }
37
+
33
38
  /// Always panics - config retrieval is not supported.
34
39
  fn get_config(env: &Env, _eid: u32, _oapp: &Address, _config_type: u32) -> Bytes {
35
- panic_with_error!(&env, BlockMessageLibError::NotImplemented);
40
+ panic_with_error!(&env, BlockedMessageLibError::NotImplemented);
36
41
  }
37
42
 
38
43
  /// Returns true for all EIDs to allow assignment as a blocking library.
@@ -40,31 +45,26 @@ impl IMessageLib for BlockMessageLib {
40
45
  true
41
46
  }
42
47
 
43
- /// Returns SendAndReceive to indicate it can block both directions.
44
- fn message_lib_type(_env: &Env) -> MessageLibType {
45
- MessageLibType::SendAndReceive
46
- }
47
-
48
- /// Always panics - config modification is not supported.
49
- fn set_config(env: &Env, _oapp: &Address, _param: &Vec<SetConfigParam>) {
50
- panic_with_error!(&env, BlockMessageLibError::NotImplemented);
51
- }
52
-
53
48
  /// Returns max version to ensure it's recognized as a valid library.
54
49
  fn version(_env: &Env) -> MessageLibVersion {
55
50
  MessageLibVersion { major: u64::MAX, minor: u8::MAX as u32, endpoint_version: 2 }
56
51
  }
52
+
53
+ /// Returns SendAndReceive to indicate it can block both directions.
54
+ fn message_lib_type(_env: &Env) -> MessageLibType {
55
+ MessageLibType::SendAndReceive
56
+ }
57
57
  }
58
58
 
59
59
  #[contract_impl]
60
- impl ISendLib for BlockMessageLib {
60
+ impl ISendLib for BlockedMessageLib {
61
61
  /// Always panics - quoting is blocked.
62
62
  fn quote(env: &Env, _packet: &OutboundPacket, _options: &Bytes, _pay_in_zro: bool) -> MessagingFee {
63
- panic_with_error!(&env, BlockMessageLibError::NotImplemented);
63
+ panic_with_error!(&env, BlockedMessageLibError::NotImplemented);
64
64
  }
65
65
 
66
66
  /// Always panics - sending is blocked.
67
67
  fn send(env: &Env, _packet: &OutboundPacket, _options: &Bytes, _pay_in_zro: bool) -> FeesAndPacket {
68
- panic_with_error!(&env, BlockMessageLibError::NotImplemented);
68
+ panic_with_error!(&env, BlockedMessageLibError::NotImplemented);
69
69
  }
70
70
  }
@@ -0,0 +1,64 @@
1
+ use super::test_helper::*;
2
+ use crate::packet_codec_v1::{decode_packet_header, HEADER_LENGTH, PACKET_VERSION};
3
+ use soroban_sdk::{Bytes, BytesN, Env};
4
+
5
+ #[test]
6
+ #[should_panic(expected = "Error(Contract, #1001)")] // PacketCodecV1Error::InvalidPacketHeader
7
+ fn test_decode_packet_header_rejects_invalid_length() {
8
+ let env = Env::default();
9
+ // Only 3 bytes instead of HEADER_LENGTH.
10
+ let invalid_header = Bytes::from_array(&env, &[0x01, 0x02, 0x03]);
11
+ decode_packet_header(&env, &invalid_header);
12
+ }
13
+
14
+ #[test]
15
+ #[should_panic(expected = "Error(Contract, #1002)")] // PacketCodecV1Error::InvalidPacketVersion
16
+ fn test_decode_packet_header_rejects_invalid_version() {
17
+ let env = Env::default();
18
+ // Correct length, wrong version.
19
+ let mut invalid_header_bytes: [u8; HEADER_LENGTH as usize] = [0u8; HEADER_LENGTH as usize];
20
+ invalid_header_bytes[0] = 2; // Wrong version (should be 1)
21
+ let invalid_header = Bytes::from_array(&env, &invalid_header_bytes);
22
+ decode_packet_header(&env, &invalid_header);
23
+ }
24
+
25
+ #[test]
26
+ #[should_panic(expected = "Error(Contract, #1001)")] // PacketCodecV1Error::InvalidPacketHeader
27
+ fn test_decode_packet_header_rejects_too_long_length() {
28
+ let env = Env::default();
29
+ // HEADER_LENGTH + 1 bytes should still be rejected (length must be exactly HEADER_LENGTH).
30
+ let too_long_header = Bytes::from_array(&env, &[0u8; (HEADER_LENGTH as usize) + 1]);
31
+ decode_packet_header(&env, &too_long_header);
32
+ }
33
+
34
+ #[test]
35
+ fn test_decode_packet_header_parses_expected_offsets_and_big_endian() {
36
+ let env = Env::default();
37
+
38
+ // Construct raw header bytes directly (do not depend on encode_packet_header).
39
+ // Layout:
40
+ // [0] version
41
+ // [1..9] nonce (u64 BE)
42
+ // [9..13] src_eid (u32 BE)
43
+ // [13..45] sender (32)
44
+ // [45..49] dst_eid (u32 BE)
45
+ // [49..81] receiver (32)
46
+ let mut raw: [u8; HEADER_LENGTH as usize] = [0u8; HEADER_LENGTH as usize];
47
+ raw[0] = PACKET_VERSION;
48
+
49
+ raw[1..9].copy_from_slice(&TEST_NONCE.to_be_bytes());
50
+ raw[9..13].copy_from_slice(&TEST_SRC_EID.to_be_bytes());
51
+ raw[13..45].copy_from_slice(&TEST_SENDER_BYTES);
52
+ raw[45..49].copy_from_slice(&TEST_DST_EID.to_be_bytes());
53
+ raw[49..81].copy_from_slice(&TEST_RECEIVER_BYTES);
54
+
55
+ let encoded_header = Bytes::from_array(&env, &raw);
56
+ let decoded = decode_packet_header(&env, &encoded_header);
57
+
58
+ assert_eq!(decoded.version, PACKET_VERSION);
59
+ assert_eq!(decoded.nonce, TEST_NONCE);
60
+ assert_eq!(decoded.src_eid, TEST_SRC_EID);
61
+ assert_eq!(decoded.dst_eid, TEST_DST_EID);
62
+ assert_eq!(decoded.sender, BytesN::from_array(&env, &TEST_SENDER_BYTES));
63
+ assert_eq!(decoded.receiver, BytesN::from_array(&env, &TEST_RECEIVER_BYTES));
64
+ }