@layerzerolabs/protocol-stellar-v2 0.2.15 → 0.2.19

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 (262) hide show
  1. package/.turbo/turbo-build.log +365 -297
  2. package/.turbo/turbo-lint.log +142 -110
  3. package/.turbo/turbo-test.log +1273 -1222
  4. package/Cargo.lock +20 -5
  5. package/Cargo.toml +4 -1
  6. package/contracts/ERROR_SPEC.md +44 -0
  7. package/contracts/common-macros/src/auth.rs +113 -0
  8. package/contracts/common-macros/src/contract_ttl.rs +84 -0
  9. package/contracts/common-macros/src/lib.rs +181 -30
  10. package/contracts/common-macros/src/lz_contract.rs +83 -0
  11. package/contracts/common-macros/src/tests/{ownable.rs → auth.rs} +48 -15
  12. package/contracts/common-macros/src/tests/contract_ttl.rs +662 -0
  13. package/contracts/common-macros/src/tests/mod.rs +2 -2
  14. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__auth__snapshot_generated_multisig_code.snap +20 -0
  15. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__auth__snapshot_generated_ownable_code.snap +24 -0
  16. package/contracts/common-macros/src/tests/snapshots/{common_macros__tests__ownable__snapshot_only_owner_preserves_function_signature.snap → common_macros__tests__auth__snapshot_only_auth_preserves_function_signature.snap} +4 -4
  17. package/contracts/common-macros/src/tests/snapshots/{common_macros__tests__contract_impl__snapshot_generated_contract_impl_code.snap → common_macros__tests__contract_ttl__snapshot_generated_contractimpl_code.snap} +3 -3
  18. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__contract_ttl__snapshot_generated_contracttrait_code.snap +69 -0
  19. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__ttl_configurable__snapshot_generated_ttl_configurable_code.snap +7 -21
  20. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__upgradeable__snapshot_generated_upgradeable_code.snap +2 -2
  21. package/contracts/common-macros/src/ttl_configurable.rs +19 -34
  22. package/contracts/common-macros/src/ttl_extendable.rs +36 -0
  23. package/contracts/common-macros/src/upgradeable.rs +5 -5
  24. package/contracts/common-macros/src/utils.rs +9 -0
  25. package/contracts/endpoint-v2/src/constants.rs +4 -4
  26. package/contracts/endpoint-v2/src/endpoint_v2.rs +38 -40
  27. package/contracts/endpoint-v2/src/errors.rs +4 -3
  28. package/contracts/endpoint-v2/src/events.rs +1 -1
  29. package/contracts/endpoint-v2/src/message_lib_manager.rs +18 -5
  30. package/contracts/endpoint-v2/src/messaging_channel.rs +11 -1
  31. package/contracts/endpoint-v2/src/messaging_composer.rs +11 -1
  32. package/contracts/endpoint-v2/src/storage.rs +1 -1
  33. package/contracts/endpoint-v2/src/tests/endpoint_v2/pay_messaging_fees.rs +3 -3
  34. package/contracts/endpoint-v2/src/tests/endpoint_v2/quote.rs +1 -1
  35. package/contracts/endpoint-v2/src/tests/endpoint_v2/require_oapp_auth.rs +2 -2
  36. package/contracts/endpoint-v2/src/tests/endpoint_v2/send.rs +3 -3
  37. package/contracts/endpoint-v2/src/tests/endpoint_v2/set_zro.rs +4 -4
  38. package/contracts/endpoint-v2/src/tests/message_lib_manager/require_receive_lib_for_eid.rs +3 -3
  39. package/contracts/endpoint-v2/src/tests/message_lib_manager/require_registered.rs +1 -1
  40. package/contracts/endpoint-v2/src/tests/message_lib_manager/require_send_lib_for_eid.rs +3 -3
  41. package/contracts/endpoint-v2/src/tests/message_lib_manager/require_supported_eid.rs +1 -1
  42. package/contracts/endpoint-v2/src/tests/messaging_channel/clear_payload.rs +4 -4
  43. package/contracts/endpoint-v2/src/tests/messaging_channel/inbound.rs +1 -1
  44. package/contracts/layerzero-views/src/layerzero_view.rs +3 -6
  45. package/contracts/macro-integration-tests/tests/runtime/ownable/mod.rs +2 -2
  46. package/contracts/macro-integration-tests/tests/runtime/ownable/{only_owner_guard.rs → only_auth_guard.rs} +1 -1
  47. package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/configuration.rs +1 -1
  48. package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/freeze.rs +1 -1
  49. package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/mod.rs +0 -1
  50. package/contracts/macro-integration-tests/tests/ui/ownable/fail/{only_owner_missing_env.rs → only_auth_missing_env.rs} +3 -3
  51. package/contracts/macro-integration-tests/tests/ui/ownable/fail/{only_owner_missing_env.stderr → only_auth_missing_env.stderr} +4 -4
  52. package/contracts/macro-integration-tests/tests/ui/ownable/pass/namespacing_and_imports.rs +2 -3
  53. package/contracts/macro-integration-tests/tests/ui/ownable/pass/{only_owner_env_param_variants.rs → only_auth_env_param_variants.rs} +9 -9
  54. package/contracts/macro-integration-tests/tests/ui/ttl_configurable/pass/minimal_contract.rs +6 -6
  55. package/contracts/message-libs/message-lib-common/src/errors.rs +7 -2
  56. package/contracts/message-libs/message-lib-common/src/tests/packet_codec_v1/decode_packet_header.rs +3 -3
  57. package/contracts/message-libs/message-lib-common/src/tests/worker_options/append_lz_receive_option.rs +1 -2
  58. package/contracts/message-libs/message-lib-common/src/tests/worker_options/append_native_drop_option.rs +1 -2
  59. package/contracts/message-libs/message-lib-common/src/tests/worker_options/convert_legacy_options.rs +9 -9
  60. package/contracts/message-libs/message-lib-common/src/tests/worker_options/extract_type_3_options.rs +1 -1
  61. package/contracts/message-libs/message-lib-common/src/tests/worker_options/left_pad_to_bytes32.rs +1 -1
  62. package/contracts/message-libs/message-lib-common/src/tests/worker_options/split_worker_options.rs +2 -2
  63. package/contracts/message-libs/simple-message-lib/src/simple_message_lib.rs +7 -9
  64. package/contracts/message-libs/treasury/src/errors.rs +2 -2
  65. package/contracts/message-libs/treasury/src/events.rs +1 -1
  66. package/contracts/message-libs/treasury/src/interfaces/zro_fee_lib.rs +2 -2
  67. package/contracts/message-libs/treasury/src/storage.rs +1 -1
  68. package/contracts/message-libs/treasury/src/tests/treasury_tests.rs +1 -1
  69. package/contracts/message-libs/treasury/src/treasury.rs +14 -16
  70. package/contracts/message-libs/uln-302/src/receive_uln.rs +13 -2
  71. package/contracts/message-libs/uln-302/src/send_uln.rs +24 -4
  72. package/contracts/message-libs/uln-302/src/uln302.rs +6 -24
  73. package/contracts/oapps/counter/Cargo.toml +14 -1
  74. package/contracts/oapps/counter/integration_tests/mod.rs +4 -1
  75. package/contracts/oapps/counter/integration_tests/{setup.rs → setup_sml.rs} +48 -80
  76. package/contracts/oapps/counter/integration_tests/setup_uln.rs +997 -0
  77. package/contracts/oapps/counter/integration_tests/signing.rs +62 -0
  78. package/contracts/oapps/counter/integration_tests/test_with_sml.rs +24 -55
  79. package/contracts/oapps/counter/integration_tests/test_with_uln.rs +314 -0
  80. package/contracts/oapps/counter/integration_tests/utils.rs +196 -53
  81. package/contracts/oapps/counter/src/counter.rs +67 -43
  82. package/contracts/oapps/counter/src/tests/mod.rs +0 -13
  83. package/contracts/oapps/counter/src/tests/test_counter.rs +5 -7
  84. package/contracts/oapps/oapp/src/errors.rs +5 -1
  85. package/contracts/oapps/oapp/src/macro_tests/test_macros.rs +93 -78
  86. package/contracts/oapps/oapp/src/oapp_core.rs +36 -21
  87. package/contracts/oapps/oapp/src/oapp_options_type3.rs +48 -12
  88. package/contracts/oapps/oapp/src/oapp_receiver.rs +106 -41
  89. package/contracts/oapps/oapp/src/oapp_sender.rs +26 -34
  90. package/contracts/oapps/oapp/src/tests/test_oapp_core.rs +9 -8
  91. package/contracts/oapps/oapp/src/tests/test_oapp_options_type3.rs +25 -17
  92. package/contracts/oapps/oapp/src/tests/test_oapp_receiver.rs +7 -7
  93. package/contracts/oapps/oapp/src/tests/test_oapp_sender.rs +14 -15
  94. package/contracts/oapps/oapp-macros/src/generators.rs +128 -0
  95. package/contracts/oapps/oapp-macros/src/lib.rs +113 -56
  96. package/contracts/oapps/oft/Cargo.toml +10 -7
  97. package/contracts/oapps/{oft-std → oft}/integration-tests/extensions/test_oft_fee.rs +3 -4
  98. package/contracts/oapps/{oft-std → oft}/integration-tests/extensions/test_pausable.rs +2 -3
  99. package/contracts/oapps/{oft-std → oft}/integration-tests/extensions/test_rate_limiter.rs +1 -1
  100. package/contracts/oapps/oft/integration-tests/mod.rs +1 -1
  101. package/contracts/oapps/oft/integration-tests/setup.rs +29 -110
  102. package/contracts/oapps/oft/integration-tests/utils.rs +254 -21
  103. package/contracts/oapps/oft/src/extensions/oft_fee.rs +13 -14
  104. package/contracts/oapps/oft/src/extensions/pausable.rs +4 -4
  105. package/contracts/oapps/oft/src/extensions/rate_limiter.rs +5 -5
  106. package/contracts/oapps/oft/src/lib.rs +11 -13
  107. package/contracts/oapps/oft/src/oft.rs +147 -225
  108. package/contracts/oapps/oft/src/oft_types/lock_unlock.rs +9 -13
  109. package/contracts/oapps/oft/src/oft_types/mint_burn.rs +31 -14
  110. package/contracts/oapps/oft/src/oft_types/mod.rs +13 -0
  111. package/contracts/oapps/{oft-std → oft-core}/Cargo.toml +6 -4
  112. package/contracts/oapps/{oft-std → oft-core}/integration-tests/mod.rs +1 -1
  113. package/contracts/oapps/{oft-std → oft-core}/integration-tests/setup.rs +129 -30
  114. package/contracts/oapps/{oft → oft-core}/integration-tests/test_with_sml.rs +3 -3
  115. package/contracts/oapps/oft-core/integration-tests/utils.rs +201 -0
  116. package/contracts/oapps/oft-core/src/errors.rs +13 -0
  117. package/contracts/oapps/oft-core/src/lib.rs +18 -0
  118. package/contracts/oapps/oft-core/src/oft_core.rs +439 -0
  119. package/contracts/oapps/{oft → oft-core}/src/storage.rs +2 -0
  120. package/contracts/oapps/{oft → oft-core}/src/tests/mod.rs +0 -2
  121. package/contracts/oapps/{oft → oft-core}/src/tests/test_decimals.rs +2 -2
  122. package/contracts/oapps/{oft → oft-core}/src/tests/test_lz_receive.rs +7 -7
  123. package/contracts/oapps/{oft → oft-core}/src/tests/test_oft_msg_codec.rs +4 -5
  124. package/contracts/oapps/{oft → oft-core}/src/tests/test_resolve_address.rs +3 -3
  125. package/contracts/oapps/{oft → oft-core}/src/tests/test_utils.rs +78 -37
  126. package/contracts/oapps/oft-core/src/types.rs +58 -0
  127. package/contracts/oapps/{oft → oft-core}/src/utils.rs +1 -1
  128. package/contracts/upgrader/src/lib.rs +4 -4
  129. package/contracts/utils/src/auth.rs +44 -0
  130. package/contracts/utils/src/errors.rs +31 -5
  131. package/contracts/utils/src/lib.rs +3 -0
  132. package/contracts/utils/src/multisig.rs +211 -0
  133. package/contracts/utils/src/ownable.rs +137 -13
  134. package/contracts/utils/src/tests/buffer_reader.rs +6 -6
  135. package/contracts/utils/src/tests/buffer_writer.rs +6 -6
  136. package/contracts/utils/src/tests/bytes_ext.rs +2 -4
  137. package/contracts/utils/src/tests/mod.rs +1 -0
  138. package/contracts/utils/src/tests/multisig.rs +731 -0
  139. package/contracts/utils/src/tests/option_ext.rs +2 -5
  140. package/contracts/utils/src/tests/ownable.rs +456 -7
  141. package/contracts/utils/src/tests/ttl_configurable.rs +27 -16
  142. package/contracts/utils/src/tests/upgradeable.rs +4 -2
  143. package/contracts/utils/src/ttl_configurable.rs +23 -8
  144. package/contracts/utils/src/ttl_extendable.rs +27 -0
  145. package/contracts/utils/src/upgradeable.rs +2 -0
  146. package/contracts/workers/dvn/Cargo.toml +1 -1
  147. package/contracts/workers/dvn/src/auth.rs +7 -7
  148. package/contracts/workers/dvn/src/dvn.rs +10 -38
  149. package/contracts/workers/dvn/src/errors.rs +0 -7
  150. package/contracts/workers/dvn/src/events.rs +1 -14
  151. package/contracts/workers/dvn/src/interfaces/dvn.rs +2 -2
  152. package/contracts/workers/dvn/src/interfaces/mod.rs +0 -2
  153. package/contracts/workers/dvn/src/storage.rs +3 -13
  154. package/contracts/workers/dvn/src/tests/auth.rs +4 -4
  155. package/contracts/workers/dvn/src/tests/dvn.rs +1 -2
  156. package/contracts/workers/dvn/src/tests/multisig/set_signer.rs +7 -8
  157. package/contracts/workers/dvn/src/tests/multisig/set_threshold.rs +11 -8
  158. package/contracts/workers/dvn/src/tests/multisig/verify_signatures.rs +11 -12
  159. package/contracts/workers/dvn/src/tests/setup.rs +5 -5
  160. package/contracts/workers/dvn-fee-lib/Cargo.toml +1 -1
  161. package/contracts/workers/dvn-fee-lib/src/dvn_fee_lib.rs +3 -6
  162. package/contracts/workers/executor/src/auth.rs +80 -16
  163. package/contracts/workers/executor/src/executor.rs +5 -31
  164. package/contracts/workers/executor/src/storage.rs +2 -9
  165. package/contracts/workers/executor-fee-lib/Cargo.toml +1 -1
  166. package/contracts/workers/executor-fee-lib/src/executor_fee_lib.rs +3 -6
  167. package/contracts/workers/executor-helper/Cargo.toml +1 -1
  168. package/contracts/workers/executor-helper/src/executor_helper.rs +53 -73
  169. package/contracts/workers/price-feed/Cargo.toml +1 -1
  170. package/contracts/workers/price-feed/src/price_feed.rs +7 -10
  171. package/contracts/workers/worker/src/errors.rs +4 -0
  172. package/contracts/workers/worker/src/tests/worker.rs +7 -6
  173. package/contracts/workers/worker/src/worker.rs +20 -16
  174. package/package.json +7 -5
  175. package/sdk/.turbo/turbo-build.log +1 -0
  176. package/sdk/.turbo/turbo-test.log +1019 -0
  177. package/sdk/dist/generated/bml.d.ts +95 -8
  178. package/sdk/dist/generated/bml.js +95 -36
  179. package/sdk/dist/generated/counter.d.ts +289 -44
  180. package/sdk/dist/generated/counter.js +119 -49
  181. package/sdk/dist/generated/dvn.d.ts +312 -229
  182. package/sdk/dist/generated/dvn.js +144 -83
  183. package/sdk/dist/generated/dvn_fee_lib.d.ts +258 -63
  184. package/sdk/dist/generated/dvn_fee_lib.js +95 -26
  185. package/sdk/dist/generated/endpoint.d.ts +219 -24
  186. package/sdk/dist/generated/endpoint.js +108 -41
  187. package/sdk/dist/generated/executor.d.ts +239 -87
  188. package/sdk/dist/generated/executor.js +135 -63
  189. package/sdk/dist/generated/executor_fee_lib.d.ts +278 -74
  190. package/sdk/dist/generated/executor_fee_lib.js +135 -59
  191. package/sdk/dist/generated/executor_helper.d.ts +163 -21
  192. package/sdk/dist/generated/executor_helper.js +124 -52
  193. package/sdk/dist/generated/oft.d.ts +1842 -0
  194. package/sdk/dist/generated/oft.js +345 -0
  195. package/sdk/dist/generated/price_feed.d.ts +258 -63
  196. package/sdk/dist/generated/price_feed.js +95 -26
  197. package/sdk/dist/generated/sml.d.ts +235 -34
  198. package/sdk/dist/generated/sml.js +126 -53
  199. package/sdk/dist/generated/treasury.d.ts +1016 -0
  200. package/sdk/dist/generated/treasury.js +248 -0
  201. package/sdk/dist/generated/uln302.d.ts +235 -34
  202. package/sdk/dist/generated/uln302.js +126 -53
  203. package/sdk/dist/generated/upgrader.d.ts +17 -2
  204. package/sdk/dist/generated/upgrader.js +19 -1
  205. package/sdk/dist/index.d.ts +2 -1
  206. package/sdk/dist/index.js +2 -1
  207. package/sdk/package.json +6 -3
  208. package/sdk/src/index.ts +2 -1
  209. package/sdk/test/counter-sml.test.ts +376 -0
  210. package/sdk/test/counter-uln.test.ts +493 -0
  211. package/sdk/test/{oft.test.ts → oft-sml.test.ts} +196 -321
  212. package/sdk/test/suites/constants.ts +22 -2
  213. package/sdk/test/suites/globalSetup.ts +450 -0
  214. package/sdk/test/suites/localnet.ts +23 -6
  215. package/sdk/test/upgrader.test.ts +7 -16
  216. package/sdk/test/utils.ts +558 -85
  217. package/sdk/turbo.json +8 -0
  218. package/sdk/vitest.config.ts +21 -0
  219. package/tools/ts-bindings-gen/Cargo.toml +2 -0
  220. package/tools/ts-bindings-gen/src/main.rs +52 -4
  221. package/contracts/common-macros/src/contract_impl.rs +0 -52
  222. package/contracts/common-macros/src/ownable.rs +0 -41
  223. package/contracts/common-macros/src/tests/contract_impl.rs +0 -386
  224. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__ownable__snapshot_generated_ownable_code.snap +0 -12
  225. package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/extend_instance_ttl.rs +0 -50
  226. package/contracts/oapps/oapp-macros/src/oapp_core.rs +0 -41
  227. package/contracts/oapps/oapp-macros/src/oapp_full.rs +0 -21
  228. package/contracts/oapps/oapp-macros/src/oapp_options_type3.rs +0 -31
  229. package/contracts/oapps/oapp-macros/src/oapp_receiver.rs +0 -48
  230. package/contracts/oapps/oapp-macros/src/oapp_sender.rs +0 -21
  231. package/contracts/oapps/oapp-macros/src/util.rs +0 -107
  232. package/contracts/oapps/oft/src/constants.rs +0 -5
  233. package/contracts/oapps/oft/src/default_oft_impl.rs +0 -152
  234. package/contracts/oapps/oft/src/errors.rs +0 -8
  235. package/contracts/oapps/oft/src/interfaces/mint_burn_token.rs +0 -23
  236. package/contracts/oapps/oft/src/interfaces/mod.rs +0 -3
  237. package/contracts/oapps/oft/src/tests/extensions/mod.rs +0 -11
  238. package/contracts/oapps/oft/src/tests/extensions/setup.rs +0 -903
  239. package/contracts/oapps/oft/src/tests/extensions/test_oft_fee.rs +0 -749
  240. package/contracts/oapps/oft/src/tests/extensions/test_pausable.rs +0 -432
  241. package/contracts/oapps/oft/src/tests/extensions/test_rate_limiter.rs +0 -1078
  242. package/contracts/oapps/oft/src/types.rs +0 -38
  243. package/contracts/oapps/oft-std/integration-tests/utils.rs +0 -427
  244. package/contracts/oapps/oft-std/src/lib.rs +0 -16
  245. package/contracts/oapps/oft-std/src/oft.rs +0 -156
  246. package/contracts/workers/dvn/src/interfaces/multisig.rs +0 -56
  247. package/contracts/workers/dvn/src/multisig.rs +0 -157
  248. package/sdk/dist/generated/oft_std.d.ts +0 -1544
  249. package/sdk/dist/generated/oft_std.js +0 -271
  250. package/sdk/test/index.test.ts +0 -375
  251. /package/contracts/oapps/{oft-std → oft}/integration-tests/extensions/mod.rs +0 -0
  252. /package/contracts/oapps/{oft → oft-core}/src/codec/mod.rs +0 -0
  253. /package/contracts/oapps/{oft → oft-core}/src/codec/oft_compose_msg_codec.rs +0 -0
  254. /package/contracts/oapps/{oft → oft-core}/src/codec/oft_msg_codec.rs +0 -0
  255. /package/contracts/oapps/{oft → oft-core}/src/events.rs +0 -0
  256. /package/contracts/oapps/{oft → oft-core}/src/tests/test_oft_compose_msg_codec.rs +0 -0
  257. /package/contracts/oapps/{oft → oft-core}/src/tests/test_oft_version.rs +0 -0
  258. /package/contracts/oapps/{oft → oft-core}/src/tests/test_quote_oft.rs +0 -0
  259. /package/contracts/oapps/{oft → oft-core}/src/tests/test_quote_send.rs +0 -0
  260. /package/contracts/oapps/{oft → oft-core}/src/tests/test_send.rs +0 -0
  261. /package/contracts/oapps/{oft → oft-core}/src/tests/test_token.rs +0 -0
  262. /package/sdk/test/suites/{testUpgradeable.ts → dummyContractClient.ts} +0 -0
@@ -239,7 +239,7 @@ fn test_pay_zro_fees_multiple_recipients_zero_amounts_skipped_and_refunded() {
239
239
 
240
240
  // ZRO prerequisites / edge cases
241
241
  #[test]
242
- #[should_panic(expected = "Error(Contract, #24)")] // EndpointError::ZROUnavailable
242
+ #[should_panic(expected = "Error(Contract, #25)")] // EndpointError::ZROUnavailable
243
243
  fn test_panic_pay_in_zro_without_zro_configured() {
244
244
  let context = setup();
245
245
  let env = &context.env;
@@ -252,7 +252,7 @@ fn test_panic_pay_in_zro_without_zro_configured() {
252
252
  }
253
253
 
254
254
  #[test]
255
- #[should_panic(expected = "Error(Contract, #23)")] // EndpointError::ZeroZROFee
255
+ #[should_panic(expected = "Error(Contract, #24)")] // EndpointError::ZeroZROFee
256
256
  fn test_panic_pay_in_zro_with_zero_zro_balance() {
257
257
  let context = setup();
258
258
  let env = &context.env;
@@ -312,7 +312,7 @@ fn test_pay_in_zro_with_all_zero_zro_recipients_refunds_all_zro() {
312
312
  }
313
313
 
314
314
  #[test]
315
- #[should_panic(expected = "Error(Contract, #7)")] // EndpointError::InsufficientZROFee
315
+ #[should_panic(expected = "Error(Contract, #7)")] // EndpointError::InsufficientZroFee
316
316
  fn test_panic_pay_zro_fees_insufficient_balance() {
317
317
  let context = setup();
318
318
  let env = &context.env;
@@ -120,7 +120,7 @@ fn test_quote_zro_unavailable_when_pay_in_zro() {
120
120
  let params = default_params(env, dst_eid, true);
121
121
 
122
122
  let result = endpoint_client.try_quote(&sender, &params);
123
- assert_eq!(result.err().unwrap().ok().unwrap(), EndpointError::ZROUnavailable.into());
123
+ assert_eq!(result.err().unwrap().ok().unwrap(), EndpointError::ZroUnavailable.into());
124
124
  }
125
125
 
126
126
  #[test]
@@ -20,7 +20,7 @@ use crate::{tests::endpoint_setup::setup, EndpointV2};
20
20
 
21
21
  // Unauthorized caller is rejected
22
22
  #[test]
23
- #[should_panic(expected = "Error(Contract, #21)")] // EndpointError::Unauthorized
23
+ #[should_panic(expected = "Error(Contract, #22)")] // EndpointError::Unauthorized
24
24
  fn test_require_oapp_auth_unauthorized() {
25
25
  let context = setup();
26
26
  let env = &context.env;
@@ -36,7 +36,7 @@ fn test_require_oapp_auth_unauthorized() {
36
36
 
37
37
  // Wrong delegate is rejected
38
38
  #[test]
39
- #[should_panic(expected = "Error(Contract, #21)")] // EndpointError::Unauthorized
39
+ #[should_panic(expected = "Error(Contract, #22)")] // EndpointError::Unauthorized
40
40
  fn test_require_oapp_auth_wrong_delegate() {
41
41
  let context = setup();
42
42
  let env = &context.env;
@@ -238,7 +238,7 @@ fn test_send_zro_unavailable_when_pay_in_zro() {
238
238
  let params = default_params(env, 998u32, true);
239
239
  context.mock_auth(&sender, "send", (&sender, &params, &refund_address));
240
240
  let result = endpoint_client.try_send(&sender, &params, &refund_address);
241
- assert_eq!(result.err().unwrap().ok().unwrap(), EndpointError::ZROUnavailable.into());
241
+ assert_eq!(result.err().unwrap().ok().unwrap(), EndpointError::ZroUnavailable.into());
242
242
  }
243
243
 
244
244
  #[test]
@@ -260,7 +260,7 @@ fn test_send_zero_zro_fee_when_pay_in_zro_true() {
260
260
  let params = default_params(env, dst_eid, true);
261
261
  context.mock_auth(&sender, "send", (&sender, &params, &refund_address));
262
262
  let result = endpoint_client.try_send(&sender, &params, &refund_address);
263
- assert_eq!(result.err().unwrap().ok().unwrap(), EndpointError::ZeroZROFee.into());
263
+ assert_eq!(result.err().unwrap().ok().unwrap(), EndpointError::ZeroZroFee.into());
264
264
  }
265
265
 
266
266
  #[test]
@@ -285,7 +285,7 @@ fn test_send_insufficient_zro_fee() {
285
285
  let params = default_params(env, dst_eid, true);
286
286
  context.mock_auth(&sender, "send", (&sender, &params, &refund_address));
287
287
  let result = endpoint_client.try_send(&sender, &params, &refund_address);
288
- assert_eq!(result.err().unwrap().ok().unwrap(), EndpointError::InsufficientZROFee.into());
288
+ assert_eq!(result.err().unwrap().ok().unwrap(), EndpointError::InsufficientZroFee.into());
289
289
  }
290
290
 
291
291
  // Nonce Management
@@ -1,7 +1,7 @@
1
1
  use soroban_sdk::{testutils::Address as _, Address};
2
2
  use utils::testing_utils::assert_event;
3
3
 
4
- use crate::{events::ZROSet, tests::endpoint_setup::setup, tests::endpoint_setup::TestSetup};
4
+ use crate::{events::ZroSet, tests::endpoint_setup::setup, tests::endpoint_setup::TestSetup};
5
5
 
6
6
  // Helpers
7
7
  fn set_zro_with_auth(context: &TestSetup, zro: &Address) {
@@ -23,7 +23,7 @@ fn test_set_zro() {
23
23
  set_zro_with_auth(&context, &context.zro_token_client.address);
24
24
 
25
25
  // Verify event emission.
26
- assert_event(env, &endpoint_client.address, ZROSet { zro: context.zro_token_client.address.clone() });
26
+ assert_event(env, &endpoint_client.address, ZroSet { zro: context.zro_token_client.address.clone() });
27
27
 
28
28
  // Verify state update via public interface.
29
29
  let zro_token = endpoint_client.zro();
@@ -43,12 +43,12 @@ fn test_set_zro_overwrites_existing_zro() {
43
43
 
44
44
  // Set ZRO to the first address.
45
45
  set_zro_with_auth(&context, &context.zro_token_client.address);
46
- assert_event(env, &endpoint_client.address, ZROSet { zro: context.zro_token_client.address.clone() });
46
+ assert_event(env, &endpoint_client.address, ZroSet { zro: context.zro_token_client.address.clone() });
47
47
  assert_eq!(endpoint_client.zro(), Some(context.zro_token_client.address.clone()));
48
48
 
49
49
  // Overwrite ZRO with the second address.
50
50
  set_zro_with_auth(&context, &zro_addr_2);
51
- assert_event(env, &endpoint_client.address, ZROSet { zro: zro_addr_2.clone() });
51
+ assert_event(env, &endpoint_client.address, ZroSet { zro: zro_addr_2.clone() });
52
52
  assert_eq!(endpoint_client.zro(), Some(zro_addr_2));
53
53
  }
54
54
 
@@ -4,7 +4,7 @@ use crate::{tests::endpoint_setup::setup, EndpointV2, MessageLibType};
4
4
 
5
5
  // The require_receive_lib_for_eid internal validation (registered + type + supported_eid)
6
6
  #[test]
7
- #[should_panic(expected = "Error(Contract, #15)")] // EndpointError::OnlyRegisteredLib
7
+ #[should_panic(expected = "Error(Contract, #16)")] // EndpointError::OnlyRegisteredLib
8
8
  fn test_require_receive_lib_for_eid_unregistered_lib() {
9
9
  let context = setup();
10
10
  let env = &context.env;
@@ -15,7 +15,7 @@ fn test_require_receive_lib_for_eid_unregistered_lib() {
15
15
  }
16
16
 
17
17
  #[test]
18
- #[should_panic(expected = "Error(Contract, #14)")] // EndpointError::OnlyReceiveLib
18
+ #[should_panic(expected = "Error(Contract, #15)")] // EndpointError::OnlyReceiveLib
19
19
  fn test_require_receive_lib_for_eid_wrong_lib_type() {
20
20
  let context = setup();
21
21
  let env = &context.env;
@@ -28,7 +28,7 @@ fn test_require_receive_lib_for_eid_wrong_lib_type() {
28
28
  }
29
29
 
30
30
  #[test]
31
- #[should_panic(expected = "Error(Contract, #22)")] // EndpointError::UnsupportedEid
31
+ #[should_panic(expected = "Error(Contract, #23)")] // EndpointError::UnsupportedEid
32
32
  fn test_require_receive_lib_for_eid_unsupported_eid() {
33
33
  let context = setup();
34
34
  let env = &context.env;
@@ -8,7 +8,7 @@ use crate::{
8
8
  // Unit tests for require functions
9
9
 
10
10
  #[test]
11
- #[should_panic(expected = "Error(Contract, #15)")] // EndpointError::OnlyRegisteredLib
11
+ #[should_panic(expected = "Error(Contract, #16)")] // EndpointError::OnlyRegisteredLib
12
12
  fn test_require_registered_with_unregistered_lib() {
13
13
  let context = setup();
14
14
  let env = &context.env;
@@ -4,7 +4,7 @@ use crate::{tests::endpoint_setup::setup, EndpointV2, MessageLibType};
4
4
 
5
5
  // The require_send_lib_for_eid internal validation (registered + type + supported_eid)
6
6
  #[test]
7
- #[should_panic(expected = "Error(Contract, #15)")] // EndpointError::OnlyRegisteredLib
7
+ #[should_panic(expected = "Error(Contract, #16)")] // EndpointError::OnlyRegisteredLib
8
8
  fn test_require_send_lib_for_eid_unregistered_lib() {
9
9
  let context = setup();
10
10
  let env = &context.env;
@@ -15,7 +15,7 @@ fn test_require_send_lib_for_eid_unregistered_lib() {
15
15
  }
16
16
 
17
17
  #[test]
18
- #[should_panic(expected = "Error(Contract, #16)")] // EndpointError::OnlySendLib
18
+ #[should_panic(expected = "Error(Contract, #17)")] // EndpointError::OnlySendLib
19
19
  fn test_require_send_lib_for_eid_wrong_lib_type() {
20
20
  let context = setup();
21
21
  let env = &context.env;
@@ -28,7 +28,7 @@ fn test_require_send_lib_for_eid_wrong_lib_type() {
28
28
  }
29
29
 
30
30
  #[test]
31
- #[should_panic(expected = "Error(Contract, #22)")] // EndpointError::UnsupportedEid
31
+ #[should_panic(expected = "Error(Contract, #23)")] // EndpointError::UnsupportedEid
32
32
  fn test_require_send_lib_for_eid_unsupported_eid() {
33
33
  let context = setup();
34
34
  let env = &context.env;
@@ -15,7 +15,7 @@ fn test_require_supported_eid_with_supported() {
15
15
 
16
16
  // The require_supported_eid rejects when the library does not support the EID
17
17
  #[test]
18
- #[should_panic(expected = "Error(Contract, #22)")] // EndpointError::UnsupportedEid
18
+ #[should_panic(expected = "Error(Contract, #23)")] // EndpointError::UnsupportedEid
19
19
  fn test_require_supported_eid_with_unsupported() {
20
20
  let context = setup();
21
21
  let env = &context.env;
@@ -119,7 +119,7 @@ fn test_clear_payload_does_not_update_lazy_nonce_when_nonce_is_not_greater() {
119
119
  }
120
120
 
121
121
  #[test]
122
- #[should_panic(expected = "Error(Contract, #19)")] // EndpointError::PayloadHashNotFound
122
+ #[should_panic(expected = "Error(Contract, #20)")] // EndpointError::PayloadHashNotFound
123
123
  fn test_clear_payload_payload_hash_not_found_when_nonce_is_checkpointed_but_missing() {
124
124
  let context = setup();
125
125
  let env = &context.env;
@@ -143,7 +143,7 @@ fn test_clear_payload_payload_hash_not_found_when_nonce_is_checkpointed_but_miss
143
143
  }
144
144
 
145
145
  #[test]
146
- #[should_panic(expected = "Error(Contract, #19)")] // EndpointError::PayloadHashNotFound
146
+ #[should_panic(expected = "Error(Contract, #20)")] // EndpointError::PayloadHashNotFound
147
147
  fn test_clear_payload_wrong_payload() {
148
148
  let context = setup();
149
149
  let env = &context.env;
@@ -164,7 +164,7 @@ fn test_clear_payload_wrong_payload() {
164
164
  }
165
165
 
166
166
  #[test]
167
- #[should_panic(expected = "Error(Contract, #10)")] // EndpointError::InvalidNonce
167
+ #[should_panic(expected = "Error(Contract, #11)")] // EndpointError::InvalidNonce
168
168
  fn test_clear_payload_not_stored() {
169
169
  let context = setup();
170
170
  let env = &context.env;
@@ -179,7 +179,7 @@ fn test_clear_payload_not_stored() {
179
179
  }
180
180
 
181
181
  #[test]
182
- #[should_panic(expected = "Error(Contract, #10)")] // EndpointError::InvalidNonce
182
+ #[should_panic(expected = "Error(Contract, #11)")] // EndpointError::InvalidNonce
183
183
  fn test_clear_payload_missing_intermediate_nonce() {
184
184
  let context = setup();
185
185
  let env = &context.env;
@@ -76,7 +76,7 @@ fn test_inbound_overwrites_same_nonce() {
76
76
  }
77
77
 
78
78
  #[test]
79
- #[should_panic(expected = "Error(Contract, #11)")] // EndpointError::InvalidPayloadHash
79
+ #[should_panic(expected = "Error(Contract, #12)")] // EndpointError::InvalidPayloadHash
80
80
  fn test_inbound_rejects_empty_payload_hash() {
81
81
  let context = setup();
82
82
  let env = &context.env;
@@ -9,17 +9,14 @@ use crate::{
9
9
  types::{empty_payload_hash, nil_payload_hash, ExecutionState, VerificationState},
10
10
  LayerZeroViewError,
11
11
  };
12
- use common_macros::{contract_impl, ownable, ttl_configurable, upgradeable};
12
+ use common_macros::{contract_impl, lz_contract};
13
13
  use endpoint_v2::{LayerZeroEndpointV2Client, MessageLibManagerClient, MessagingChannelClient, Origin};
14
14
  use message_lib_common::packet_codec_v1::{decode_packet_header, PacketHeader};
15
- use soroban_sdk::{address_payload::AddressPayload, assert_with_error, contract, Address, Bytes, BytesN, Env};
15
+ use soroban_sdk::{address_payload::AddressPayload, assert_with_error, Address, Bytes, BytesN, Env};
16
16
  use uln302::ReceiveUln302Client;
17
17
  use utils::upgradeable::UpgradeableInternal;
18
18
 
19
- #[contract]
20
- #[ttl_configurable]
21
- #[upgradeable]
22
- #[ownable]
19
+ #[lz_contract(upgradeable)]
23
20
  pub struct LayerZeroView;
24
21
 
25
22
  #[contract_impl]
@@ -1,7 +1,7 @@
1
1
  use soroban_sdk::{contract, contractimpl, Address, Env};
2
2
 
3
3
  mod initialization;
4
- mod only_owner_guard;
4
+ mod only_auth_guard;
5
5
  mod ownership_transfer;
6
6
 
7
7
  /// Shared contract used by ownable runtime tests.
@@ -15,7 +15,7 @@ impl TestContract {
15
15
  Self::init_owner(&env, &owner);
16
16
  }
17
17
 
18
- #[common_macros::only_owner]
18
+ #[common_macros::only_auth]
19
19
  pub fn guarded(env: &Env) {
20
20
  let _ = env;
21
21
  }
@@ -1,4 +1,4 @@
1
- // Runtime tests: `#[only_owner]` guard behavior.
1
+ // Runtime tests: `#[only_auth]` guard behavior.
2
2
  //
3
3
  // Tests covered:
4
4
  // - Guard enforces owner authorization (unauthorized fails, authorized succeeds).
@@ -12,7 +12,7 @@ use soroban_sdk::{
12
12
  xdr::{ScErrorCode, ScErrorType},
13
13
  Address, Env, Error, IntoVal,
14
14
  };
15
- use utils::errors::TtlConfigurableError;
15
+ use utils::{errors::TtlConfigurableError, ttl_configurable::TtlConfig};
16
16
 
17
17
  #[contract]
18
18
  #[ttl_configurable]
@@ -12,7 +12,7 @@ use soroban_sdk::{
12
12
  xdr::{ScErrorCode, ScErrorType},
13
13
  Address, Env, Error, IntoVal,
14
14
  };
15
- use utils::errors::TtlConfigurableError;
15
+ use utils::{errors::TtlConfigurableError, ttl_configurable::TtlConfig};
16
16
 
17
17
  #[contract]
18
18
  #[ttl_configurable]
@@ -1,3 +1,2 @@
1
1
  mod configuration;
2
- mod extend_instance_ttl;
3
2
  mod freeze;
@@ -1,10 +1,10 @@
1
- // UI (trybuild) negative test: `#[only_owner]` requires an `Env` parameter.
1
+ // UI (trybuild) negative test: `#[only_auth]` requires an `Env` parameter.
2
2
  //
3
3
  // Purpose:
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};
7
+ use soroban_sdk::{contract, contractimpl, Address};
8
8
 
9
9
  #[contract]
10
10
  #[common_macros::ownable]
@@ -13,7 +13,7 @@ pub struct MyContract;
13
13
  #[contractimpl]
14
14
  impl MyContract {
15
15
  // Intentionally missing `Env`: should fail during macro expansion.
16
- #[common_macros::only_owner]
16
+ #[common_macros::only_auth]
17
17
  pub fn bad(x: u32) {
18
18
  let _ = x;
19
19
  }
@@ -1,13 +1,13 @@
1
1
  error: custom attribute panicked
2
- --> tests/ui/ownable/fail/only_owner_missing_env.rs:16:5
2
+ --> tests/ui/ownable/fail/only_auth_missing_env.rs:16:5
3
3
  |
4
- 16 | #[common_macros::only_owner]
5
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4
+ 16 | #[common_macros::only_auth]
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
6
6
  |
7
7
  = help: message: function must have an Env argument
8
8
 
9
9
  error[E0599]: no function or associated item named `bad` found for struct `MyContract` in the current scope
10
- --> tests/ui/ownable/fail/only_owner_missing_env.rs:17:12
10
+ --> tests/ui/ownable/fail/only_auth_missing_env.rs:17:12
11
11
  |
12
12
  11 | pub struct MyContract;
13
13
  | --------------------- function or associated item `bad` not found for this struct
@@ -1,11 +1,10 @@
1
- // UI (trybuild) test: macro expansion does not rely on downstream imports.
1
+ // UI (trybuild) test: macro expansion works with fully-qualified trait paths.
2
2
  //
3
3
  // Purpose:
4
4
  // - Ensures a downstream crate can use the generated `Ownable` trait impl via a fully-qualified path
5
5
  // without importing `utils::ownable::Ownable` into scope.
6
- // - Catches regressions where the macro-generated code would require extra `use` statements.
7
6
 
8
- use soroban_sdk::{contract, contractimpl, Env};
7
+ use soroban_sdk::{contract, contractimpl, Address, Env};
9
8
 
10
9
  #[contract]
11
10
  #[common_macros::ownable]
@@ -1,11 +1,11 @@
1
- // UI (trybuild) test: `#[only_owner]` supports different `Env` parameter placements.
1
+ // UI (trybuild) test: `#[only_auth]` supports different `Env` parameter placements.
2
2
  //
3
3
  // Purpose:
4
- // - Verifies `#[common_macros::only_owner]` can locate an `Env` argument in the function signature,
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_owner_auth` signature shape.
6
+ // - Uses `&Env` forms to match the most common `require_auth` signature shape.
7
7
 
8
- use soroban_sdk::{contract, Env};
8
+ use soroban_sdk::{contract, Address, Env};
9
9
 
10
10
  #[contract]
11
11
  #[common_macros::ownable]
@@ -13,31 +13,31 @@ pub struct MyContract;
13
13
 
14
14
  impl MyContract {
15
15
  // `Env` as the first argument, by reference.
16
- #[common_macros::only_owner]
16
+ #[common_macros::only_auth]
17
17
  pub fn f1(env: &Env) {
18
18
  let _ = env;
19
19
  }
20
20
 
21
21
  // `Env` not in the first position.
22
- #[common_macros::only_owner]
22
+ #[common_macros::only_auth]
23
23
  pub fn f2(x: u32, env: &Env) {
24
24
  let _ = (x, env);
25
25
  }
26
26
 
27
27
  // `Env` using a fully-qualified type path.
28
- #[common_macros::only_owner]
28
+ #[common_macros::only_auth]
29
29
  pub fn f3(env: &soroban_sdk::Env) {
30
30
  let _ = env;
31
31
  }
32
32
 
33
33
  // Env by value
34
- #[common_macros::only_owner]
34
+ #[common_macros::only_auth]
35
35
  pub fn f4(env: Env) {
36
36
  let _ = env;
37
37
  }
38
38
 
39
39
  // Qualified Env by value, not first param
40
- #[common_macros::only_owner]
40
+ #[common_macros::only_auth]
41
41
  pub fn f5(x: u32, env: soroban_sdk::Env) {
42
42
  let _ = (x, env);
43
43
  }
@@ -1,17 +1,18 @@
1
- // UI (trybuild) test: `#[ttl_configurable]` on a minimal contract compiles.
1
+ // UI (trybuild) test: `#[ttl_configurable]` and `#[ttl_extendable]` on a minimal contract compiles.
2
2
  //
3
3
  // Purpose:
4
4
  // - Ensures `#[common_macros::ttl_configurable]` can be applied to a contract struct in a downstream crate.
5
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.
6
+ // - Validates `#[ttl_extendable]` generates the `extend_instance_ttl` function.
8
7
  // - Avoids snapshotting token output; compilation success + type-checking is the integration contract.
9
8
 
10
- use common_macros::{ownable, ttl_configurable};
9
+ use common_macros::{ownable, ttl_configurable, ttl_extendable};
11
10
  use soroban_sdk::{contract, contractimpl, Address, Env};
11
+ use utils::ttl_configurable::TtlConfig;
12
12
 
13
13
  #[contract]
14
14
  #[ttl_configurable]
15
+ #[ttl_extendable]
15
16
  #[ownable]
16
17
  pub struct MyContract;
17
18
 
@@ -19,7 +20,6 @@ pub struct MyContract;
19
20
  impl MyContract {
20
21
  // Provide a small init entry to type-check the injected ownable helper exists.
21
22
  pub fn init(env: Env, owner: Address) {
22
- // `init_owner` should exist because `#[ttl_configurable]` injects `#[ownable]`.
23
23
  Self::init_owner(&env, &owner);
24
24
  }
25
25
 
@@ -36,7 +36,7 @@ impl MyContract {
36
36
  Self::set_ttl_configs(&env, &none, &none);
37
37
  Self::freeze_ttl_configs(&env);
38
38
 
39
- // Type-check the inherent manual instance TTL extender exists.
39
+ // Type-check the manual instance TTL extender from #[ttl_extendable].
40
40
  Self::extend_instance_ttl(&env, 1, 2);
41
41
  }
42
42
  }
@@ -1,14 +1,19 @@
1
1
  use common_macros::contract_error;
2
2
 
3
+ // Message Lib Common error codes: 1100-1199
4
+ // See ERROR_SPEC.md for allocation rules
5
+
6
+ /// PacketCodecV1Error: 1100-1109
3
7
  #[contract_error]
4
8
  pub enum PacketCodecV1Error {
5
- InvalidPacketHeader = 1001,
9
+ InvalidPacketHeader = 1100,
6
10
  InvalidPacketVersion,
7
11
  }
8
12
 
13
+ /// WorkerOptionsError: 1110-1119
9
14
  #[contract_error]
10
15
  pub enum WorkerOptionsError {
11
- InvalidBytesLength = 1101,
16
+ InvalidBytesLength = 1110,
12
17
  InvalidLegacyOptionsType1,
13
18
  InvalidLegacyOptionsType2,
14
19
  InvalidOptionType,
@@ -3,7 +3,7 @@ use crate::packet_codec_v1::{decode_packet_header, HEADER_LENGTH, PACKET_VERSION
3
3
  use soroban_sdk::{Bytes, BytesN, Env};
4
4
 
5
5
  #[test]
6
- #[should_panic(expected = "Error(Contract, #1001)")] // PacketCodecV1Error::InvalidPacketHeader
6
+ #[should_panic(expected = "Error(Contract, #1100)")] // PacketCodecV1Error::InvalidPacketHeader
7
7
  fn test_decode_packet_header_rejects_invalid_length() {
8
8
  let env = Env::default();
9
9
  // Only 3 bytes instead of HEADER_LENGTH.
@@ -12,7 +12,7 @@ fn test_decode_packet_header_rejects_invalid_length() {
12
12
  }
13
13
 
14
14
  #[test]
15
- #[should_panic(expected = "Error(Contract, #1002)")] // PacketCodecV1Error::InvalidPacketVersion
15
+ #[should_panic(expected = "Error(Contract, #1101)")] // PacketCodecV1Error::InvalidPacketVersion
16
16
  fn test_decode_packet_header_rejects_invalid_version() {
17
17
  let env = Env::default();
18
18
  // Correct length, wrong version.
@@ -23,7 +23,7 @@ fn test_decode_packet_header_rejects_invalid_version() {
23
23
  }
24
24
 
25
25
  #[test]
26
- #[should_panic(expected = "Error(Contract, #1001)")] // PacketCodecV1Error::InvalidPacketHeader
26
+ #[should_panic(expected = "Error(Contract, #1100)")] // PacketCodecV1Error::InvalidPacketHeader
27
27
  fn test_decode_packet_header_rejects_too_long_length() {
28
28
  let env = Env::default();
29
29
  // HEADER_LENGTH + 1 bytes should still be rejected (length must be exactly HEADER_LENGTH).
@@ -1,5 +1,4 @@
1
- use crate::worker_options::test;
2
- use crate::worker_options::*;
1
+ use crate::worker_options::{test, *};
3
2
  use hex_literal::hex;
4
3
  use soroban_sdk::{Bytes, Env};
5
4
  use utils::buffer_reader::BufferReader;
@@ -1,5 +1,4 @@
1
- use crate::worker_options::test;
2
- use crate::worker_options::*;
1
+ use crate::worker_options::{test, *};
3
2
  use hex_literal::hex;
4
3
  use soroban_sdk::{Bytes, BytesN, Env};
5
4
  use utils::buffer_reader::BufferReader;
@@ -183,7 +183,7 @@ fn test_convert_legacy_options_type2_allows_u128_max_gas_and_amount() {
183
183
  }
184
184
 
185
185
  #[test]
186
- #[should_panic(expected = "Error(Contract, #1107)")] // WorkerOptionsError::LegacyOptionsType1GasOverflow
186
+ #[should_panic(expected = "Error(Contract, #1116)")] // WorkerOptionsError::LegacyOptionsType1GasOverflow
187
187
  fn test_convert_legacy_options_type1_rejects_gas_overflow() {
188
188
  let env = Env::default();
189
189
  // Minimal overflow value: u128::MAX + 1 == 2^128
@@ -194,7 +194,7 @@ fn test_convert_legacy_options_type1_rejects_gas_overflow() {
194
194
  }
195
195
 
196
196
  #[test]
197
- #[should_panic(expected = "Error(Contract, #1109)")] // WorkerOptionsError::LegacyOptionsType2GasOverflow
197
+ #[should_panic(expected = "Error(Contract, #1118)")] // WorkerOptionsError::LegacyOptionsType2GasOverflow
198
198
  fn test_convert_legacy_options_type2_rejects_gas_overflow() {
199
199
  let env = Env::default();
200
200
  let legacy_options = Bytes::from_slice(
@@ -209,7 +209,7 @@ fn test_convert_legacy_options_type2_rejects_gas_overflow() {
209
209
  }
210
210
 
211
211
  #[test]
212
- #[should_panic(expected = "Error(Contract, #1108)")] // WorkerOptionsError::LegacyOptionsType2AmountOverflow
212
+ #[should_panic(expected = "Error(Contract, #1117)")] // WorkerOptionsError::LegacyOptionsType2AmountOverflow
213
213
  fn test_convert_legacy_options_type2_rejects_amount_overflow() {
214
214
  let env = Env::default();
215
215
  let legacy_options = Bytes::from_slice(
@@ -224,7 +224,7 @@ fn test_convert_legacy_options_type2_rejects_amount_overflow() {
224
224
  }
225
225
 
226
226
  #[test]
227
- #[should_panic(expected = "Error(Contract, #1103)")] // WorkerOptionsError::InvalidLegacyOptionsType2
227
+ #[should_panic(expected = "Error(Contract, #1112)")] // WorkerOptionsError::InvalidLegacyOptionsType2
228
228
  fn test_convert_legacy_options_type2_rejects_receiver_longer_than_32_bytes() {
229
229
  let env = Env::default();
230
230
 
@@ -239,7 +239,7 @@ fn test_convert_legacy_options_type2_rejects_receiver_longer_than_32_bytes() {
239
239
  }
240
240
 
241
241
  #[test]
242
- #[should_panic(expected = "Error(Contract, #1104)")] // WorkerOptionsError::InvalidOptionType
242
+ #[should_panic(expected = "Error(Contract, #1113)")] // WorkerOptionsError::InvalidOptionType
243
243
  fn test_convert_legacy_options_rejects_unknown_legacy_type() {
244
244
  let env = Env::default();
245
245
  let legacy_options = Bytes::from_slice(&env, &[0u8; 32]);
@@ -247,7 +247,7 @@ fn test_convert_legacy_options_rejects_unknown_legacy_type() {
247
247
  }
248
248
 
249
249
  #[test]
250
- #[should_panic(expected = "Error(Contract, #1102)")] // WorkerOptionsError::InvalidLegacyOptionsType1
250
+ #[should_panic(expected = "Error(Contract, #1111)")] // WorkerOptionsError::InvalidLegacyOptionsType1
251
251
  fn test_convert_legacy_options_type1_rejects_invalid_size_too_short() {
252
252
  let env = Env::default();
253
253
  let legacy_options = Bytes::from_slice(&env, &[0u8; 31]); // 31 bytes
@@ -255,7 +255,7 @@ fn test_convert_legacy_options_type1_rejects_invalid_size_too_short() {
255
255
  }
256
256
 
257
257
  #[test]
258
- #[should_panic(expected = "Error(Contract, #1102)")] // WorkerOptionsError::InvalidLegacyOptionsType1
258
+ #[should_panic(expected = "Error(Contract, #1111)")] // WorkerOptionsError::InvalidLegacyOptionsType1
259
259
  fn test_convert_legacy_options_type1_rejects_invalid_size_too_long() {
260
260
  let env = Env::default();
261
261
  let legacy_options = Bytes::from_slice(&env, &[0u8; 33]); // 33 bytes
@@ -263,7 +263,7 @@ fn test_convert_legacy_options_type1_rejects_invalid_size_too_long() {
263
263
  }
264
264
 
265
265
  #[test]
266
- #[should_panic(expected = "Error(Contract, #1103)")] // WorkerOptionsError::InvalidLegacyOptionsType2
266
+ #[should_panic(expected = "Error(Contract, #1112)")] // WorkerOptionsError::InvalidLegacyOptionsType2
267
267
  fn test_convert_legacy_options_type2_rejects_invalid_size_too_short() {
268
268
  let env = Env::default();
269
269
  // 64 bytes (no receiver)
@@ -272,7 +272,7 @@ fn test_convert_legacy_options_type2_rejects_invalid_size_too_short() {
272
272
  }
273
273
 
274
274
  #[test]
275
- #[should_panic(expected = "Error(Contract, #1103)")] // WorkerOptionsError::InvalidLegacyOptionsType2
275
+ #[should_panic(expected = "Error(Contract, #1112)")] // WorkerOptionsError::InvalidLegacyOptionsType2
276
276
  fn test_convert_legacy_options_type2_rejects_invalid_size_too_long() {
277
277
  let env = Env::default();
278
278
  let legacy_options = Bytes::from_slice(&env, &[0u8; 97]); // 97 bytes
@@ -116,7 +116,7 @@ fn test_extract_type_3_options_interleaved_executor_and_dvn_keeps_executor_order
116
116
  }
117
117
 
118
118
  #[test]
119
- #[should_panic(expected = "Error(Contract, #1106)")] // WorkerOptionsError::InvalidWorkerId
119
+ #[should_panic(expected = "Error(Contract, #1115)")] // WorkerOptionsError::InvalidWorkerId
120
120
  fn test_extract_type_3_options_rejects_unknown_worker_id() {
121
121
  let env = Env::default();
122
122
  // worker_id = 0 (invalid) + option_size = 5 + 5 bytes of dummy data
@@ -20,7 +20,7 @@ fn test_left_pad_to_bytes32_pads_left_with_zeros() {
20
20
  }
21
21
 
22
22
  #[test]
23
- #[should_panic(expected = "Error(Contract, #1101)")] // WorkerOptionsError::InvalidBytesLength
23
+ #[should_panic(expected = "Error(Contract, #1110)")] // WorkerOptionsError::InvalidBytesLength
24
24
  fn test_left_pad_to_bytes32_rejects_len_greater_than_32() {
25
25
  let env = Env::default();
26
26
  let too_long = Bytes::from_slice(&env, &[0u8; 33]);
@@ -122,7 +122,7 @@ fn test_split_worker_options_legacy_type2_converts_to_executor_options() {
122
122
  }
123
123
 
124
124
  #[test]
125
- #[should_panic(expected = "Error(Contract, #1105)")] // WorkerOptionsError::InvalidOptions
125
+ #[should_panic(expected = "Error(Contract, #1114)")] // WorkerOptionsError::InvalidOptions
126
126
  fn test_split_worker_options_rejects_too_short_options() {
127
127
  let env = Env::default();
128
128
  let mut options = Bytes::new(&env);
@@ -131,7 +131,7 @@ fn test_split_worker_options_rejects_too_short_options() {
131
131
  }
132
132
 
133
133
  #[test]
134
- #[should_panic(expected = "Error(Contract, #1105)")] // WorkerOptionsError::InvalidOptions
134
+ #[should_panic(expected = "Error(Contract, #1114)")] // WorkerOptionsError::InvalidOptions
135
135
  fn test_split_worker_options_rejects_empty_options() {
136
136
  let env = Env::default();
137
137
  let options = Bytes::new(&env);