@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
@@ -1,8 +1,10 @@
1
1
  use crate::{
2
+ self as utils,
3
+ auth::{require_auth, Auth},
2
4
  errors::TtlConfigurableError,
3
- ownable::{require_owner_auth, Ownable},
4
5
  };
5
- use soroban_sdk::{assert_with_error, contractevent, contracttrait, contracttype, Env};
6
+ use common_macros::contract_trait;
7
+ use soroban_sdk::{assert_with_error, contractevent, contracttype, Env};
6
8
 
7
9
  /// Ledgers per day (~5 second close time).
8
10
  pub const LEDGERS_PER_DAY: u32 = (24 * 3600) / 5;
@@ -75,15 +77,28 @@ pub enum TtlConfigStorage {
75
77
  Persistent,
76
78
  }
77
79
 
80
+ /// Initializes TTL configs with the default values (threshold: 29 days, extend_to: 30 days).
81
+ ///
82
+ /// This sets both instance and persistent TTL configs to `DEFAULT_TTL_CONFIG`.
83
+ pub fn init_default_ttl_configs(env: &Env) {
84
+ let default_ttl_config = TtlConfig::new(29 * LEDGERS_PER_DAY, 30 * LEDGERS_PER_DAY);
85
+ TtlConfigStorage::set_instance(env, &default_ttl_config);
86
+ TtlConfigStorage::set_persistent(env, &default_ttl_config);
87
+ }
88
+
78
89
  /// Trait for contracts that support configurable TTL (Time-To-Live) management.
79
90
  ///
80
- /// Allows the contract owner to configure how long instance and persistent storage entries
91
+ /// Allows the contract authorizer to configure how long instance and persistent storage entries
81
92
  /// remain alive on Stellar.
82
93
  ///
83
- /// The owner can also permanently freeze the configuration to prevent future changes,
94
+ /// The authorizer can also permanently freeze the configuration to prevent future changes,
84
95
  /// providing immutability guarantees to users.
85
- #[contracttrait]
86
- pub trait TtlConfigurable: Ownable {
96
+ ///
97
+ /// Requires the `Auth` trait to be implemented, which can be provided by either:
98
+ /// - `#[ownable]` macro for single-owner contracts
99
+ /// - `Multisig` trait for multisig-controlled contracts
100
+ #[contract_trait]
101
+ pub trait TtlConfigurable: Auth {
87
102
  /// Sets TTL configs for instance and persistent storage.
88
103
  ///
89
104
  /// - `None` values remove the corresponding config (disables auto-extension for that type)
@@ -97,7 +112,7 @@ pub trait TtlConfigurable: Ownable {
97
112
  /// - `TtlConfigFrozen` if configs are frozen
98
113
  /// - `InvalidTtlConfig` if validation fails
99
114
  fn set_ttl_configs(env: &Env, instance: &Option<TtlConfig>, persistent: &Option<TtlConfig>) {
100
- require_owner_auth::<Self>(env);
115
+ require_auth::<Self>(env);
101
116
  assert_with_error!(env, !Self::is_ttl_configs_frozen(env), TtlConfigurableError::TtlConfigFrozen);
102
117
 
103
118
  let max_ttl = u32::min(MAX_TTL, env.storage().max_ttl());
@@ -123,7 +138,7 @@ pub trait TtlConfigurable: Ownable {
123
138
  /// # Panics
124
139
  /// - `TtlConfigAlreadyFrozen` if already frozen
125
140
  fn freeze_ttl_configs(env: &Env) {
126
- require_owner_auth::<Self>(env);
141
+ require_auth::<Self>(env);
127
142
  assert_with_error!(env, !Self::is_ttl_configs_frozen(env), TtlConfigurableError::TtlConfigAlreadyFrozen);
128
143
 
129
144
  TtlConfigStorage::set_frozen(env, &true);
@@ -0,0 +1,27 @@
1
+ //! TtlExtendable trait for manual instance TTL extension.
2
+ //!
3
+ //! This module provides the `TtlExtendable` trait which allows external callers
4
+ //! to extend a contract's instance storage TTL, keeping the contract alive.
5
+
6
+ use soroban_sdk::Env;
7
+
8
+ /// Trait for contracts that support manual instance TTL extension.
9
+ ///
10
+ /// This trait provides a public contract function to extend the instance storage TTL,
11
+ /// allowing external callers to keep the contract alive by paying for TTL extension.
12
+ ///
13
+ /// Uses `#[soroban_sdk::contracttrait]` directly (not `#[common_macros::contract_trait]`)
14
+ /// because auto TTL extension would be redundant for a trait whose purpose is manual
15
+ /// TTL control.
16
+ #[soroban_sdk::contracttrait]
17
+ pub trait TtlExtendable {
18
+ /// Extends the instance TTL.
19
+ ///
20
+ /// # Arguments
21
+ ///
22
+ /// * `threshold` - The threshold to extend the TTL (if current TTL is below this, extend).
23
+ /// * `extend_to` - The TTL to extend to.
24
+ fn extend_instance_ttl(env: &Env, threshold: u32, extend_to: u32) {
25
+ env.storage().instance().extend_ttl(threshold, extend_to);
26
+ }
27
+ }
@@ -52,3 +52,5 @@ pub fn migrate<T: UpgradeableInternal>(env: &Env, migration_data: &T::MigrationD
52
52
  UpgradeableStorage::set_migrating(env, &false);
53
53
  T::__migrate(env, migration_data);
54
54
  }
55
+
56
+ // TODO (hanson): review and polish this
@@ -10,7 +10,7 @@ library = []
10
10
  testutils = []
11
11
 
12
12
  [lib]
13
- crate-type = ["cdylib"]
13
+ crate-type = ["cdylib", "rlib"]
14
14
  doctest = false
15
15
 
16
16
  [dependencies]
@@ -1,9 +1,8 @@
1
1
  use super::*;
2
-
3
2
  use soroban_sdk::{
4
3
  address_payload::AddressPayload,
5
4
  auth::{Context, CustomAccountInterface},
6
- contractimpl, contracttype,
5
+ contracttype,
7
6
  crypto::Hash,
8
7
  vec, Symbol,
9
8
  };
@@ -43,7 +42,7 @@ pub struct TransactionAuthData {
43
42
  // Custom Account Interface Implementation
44
43
  // ============================================================================
45
44
 
46
- #[contractimpl]
45
+ #[contract_impl]
47
46
  impl CustomAccountInterface for LzDVN {
48
47
  type Signature = TransactionAuthData;
49
48
  type Error = DvnError;
@@ -125,9 +124,10 @@ impl LzDVN {
125
124
  ///
126
125
  /// Used to allow quorum-only admin changes without requiring existing admin authorization.
127
126
  fn is_invoking_quorum_change_admin(env: &Env, auth_contexts: &Vec<Context>) -> bool {
128
- auth_contexts.first().is_some_and(|ctx| {
129
- let Context::Contract(c) = ctx else { return false };
130
- c.contract == env.current_contract_address() && c.fn_name == Symbol::new(env, "quorum_change_admin")
131
- })
127
+ auth_contexts.len() == 1
128
+ && auth_contexts.first().is_some_and(|ctx| {
129
+ let Context::Contract(c) = ctx else { return false };
130
+ c.contract == env.current_contract_address() && c.fn_name == Symbol::new(env, "quorum_change_admin")
131
+ })
132
132
  }
133
133
  }
@@ -5,17 +5,14 @@
5
5
  //! signatures for authorization and implements Soroban's custom account
6
6
  //! interface for transaction signing.
7
7
 
8
- use crate::{
9
- errors::DvnError, events::SetDstConfig, storage::DvnStorage, Call, DstConfig, DstConfigParam, IMultisig, IDVN,
10
- };
11
- use common_macros::{contract_impl, ttl_configurable, upgradeable};
8
+ use crate::{errors::DvnError, events::SetDstConfig, storage::DvnStorage, Call, DstConfig, DstConfigParam, IDVN};
9
+ use common_macros::{contract_impl, lz_contract};
12
10
  use endpoint_v2::FeeRecipient;
13
11
  use message_lib_common::interfaces::ILayerZeroDVN;
14
- use soroban_sdk::panic_with_error;
15
- use soroban_sdk::{contract, xdr::ToXdr, Address, Bytes, BytesN, Env, Vec};
16
- use utils::option_ext::OptionExt;
17
- use utils::{buffer_writer::BufferWriter, ownable::Ownable};
18
- use utils::upgradeable::UpgradeableInternal;
12
+ use soroban_sdk::{xdr::ToXdr, Address, Bytes, BytesN, Env, Vec};
13
+ use utils::{
14
+ buffer_writer::BufferWriter, multisig, option_ext::OptionExt, ttl_configurable, upgradeable::UpgradeableInternal,
15
+ };
19
16
  use worker::{
20
17
  assert_acl, assert_not_paused, assert_supported_message_lib, init_worker, require_admin_auth, set_admin_by_admin,
21
18
  set_admin_by_owner, DvnFeeLibClient, DvnFeeParams, Worker,
@@ -25,9 +22,7 @@ use worker::{
25
22
  ///
26
23
  /// Implements multisig-based verification with custom account authorization.
27
24
  /// The contract owns itself, allowing the multisig quorum to authorize operations.
28
- #[contract]
29
- #[ttl_configurable]
30
- #[upgradeable]
25
+ #[lz_contract(multisig, upgradeable)]
31
26
  pub struct LzDVN;
32
27
 
33
28
  // ============================================================================
@@ -60,7 +55,8 @@ impl LzDVN {
60
55
  worker_fee_lib: &Address,
61
56
  deposit_address: &Address,
62
57
  ) {
63
- Self::init_multisig(env, signers, threshold);
58
+ ttl_configurable::init_default_ttl_configs(env);
59
+ multisig::init_multisig(env, signers, threshold);
64
60
  init_worker::<Self>(
65
61
  env,
66
62
  admins,
@@ -219,32 +215,8 @@ impl UpgradeableInternal for LzDVN {
219
215
  }
220
216
 
221
217
  // ============================================================================
222
- // Ownable impl for LzDVN
223
- // ============================================================================
224
-
225
- /// Self-owning contract: the DVN owns itself.
226
- ///
227
- /// This allows multisig quorum approval to serve as owner authorization.
228
- /// Ownership transfer and renouncement are disabled since the contract is self-owned.
229
- impl Ownable for LzDVN {
230
- fn owner(env: &Env) -> Option<Address> {
231
- Some(env.current_contract_address())
232
- }
233
-
234
- fn transfer_ownership(env: &Env, _new_owner: &Address) {
235
- panic_with_error!(env, DvnError::InvalidInvocation);
236
- }
237
-
238
- fn renounce_ownership(env: &Env) {
239
- panic_with_error!(env, DvnError::InvalidInvocation);
240
- }
241
- }
242
-
243
- // ============================================================================
244
- // Include SubModules
218
+ // Include Auth Module
245
219
  // ============================================================================
246
220
 
247
221
  #[path = "auth.rs"]
248
222
  pub mod auth;
249
- #[path = "multisig.rs"]
250
- pub mod multisig;
@@ -6,14 +6,7 @@ pub enum DvnError {
6
6
  EidNotSupported,
7
7
  HashAlreadyUsed,
8
8
  InvalidInvocation,
9
- InvalidSigner,
10
9
  InvalidVid,
11
10
  NonContractInvoke,
12
11
  OnlyAdmin,
13
- SignatureError,
14
- SignerAlreadyExists,
15
- SignerNotFound,
16
- TotalSignersLessThanThreshold,
17
- UnsortedSigners,
18
- ZeroThreshold,
19
12
  }
@@ -1,18 +1,5 @@
1
1
  use crate::DstConfigParam;
2
- use soroban_sdk::{contractevent, BytesN, Vec};
3
-
4
- #[contractevent]
5
- #[derive(Clone, Debug, Eq, PartialEq)]
6
- pub struct SignerSet {
7
- pub signer: BytesN<20>,
8
- pub active: bool,
9
- }
10
-
11
- #[contractevent]
12
- #[derive(Clone, Debug, Eq, PartialEq)]
13
- pub struct ThresholdSet {
14
- pub threshold: u32,
15
- }
2
+ use soroban_sdk::{contractevent, Vec};
16
3
 
17
4
  #[contractevent]
18
5
  #[derive(Clone, Debug, Eq, PartialEq)]
@@ -1,6 +1,6 @@
1
- use crate::IMultisig;
2
1
  use message_lib_common::interfaces::ILayerZeroDVN;
3
2
  use soroban_sdk::{contractclient, contracttype, Address, BytesN, Env, Symbol, Val, Vec};
3
+ use utils::multisig::Multisig;
4
4
  use worker::Worker;
5
5
 
6
6
  /// Configuration for a destination chain.
@@ -47,7 +47,7 @@ pub struct Call {
47
47
  /// Extends the LayerZero DVN interface with destination configuration management
48
48
  /// and multisig capabilities for secure cross-chain message verification.
49
49
  #[contractclient(name = "DVNClient")]
50
- pub trait IDVN: ILayerZeroDVN + Worker + IMultisig {
50
+ pub trait IDVN: ILayerZeroDVN + Worker + Multisig {
51
51
  /// Sets the configuration for one or more destination chains.
52
52
  ///
53
53
  /// # Arguments
@@ -1,5 +1,3 @@
1
1
  mod dvn;
2
- mod multisig;
3
2
 
4
3
  pub use dvn::*;
5
- pub use multisig::*;
@@ -1,22 +1,12 @@
1
1
  use crate::DstConfig;
2
2
  use common_macros::storage;
3
- use soroban_sdk::{BytesN, Vec};
3
+ use soroban_sdk::BytesN;
4
4
 
5
5
  /// DVN contract storage keys.
6
+ ///
7
+ /// Note: Multisig storage (Signers, Threshold) is provided by `utils::multisig::MultisigStorage`.
6
8
  #[storage]
7
9
  pub enum DvnStorage {
8
- // ======================== Multisig ========================
9
- /// List of authorized signer addresses (20-byte Ethereum addresses).
10
- #[persistent(Vec<BytesN<20>>)]
11
- #[default(Vec::new(env))]
12
- Signers,
13
-
14
- /// Minimum number of signatures required for multisig operations.
15
- #[instance(u32)]
16
- #[default(0)]
17
- Threshold,
18
-
19
- // ======================== DVN ============================
20
10
  /// Verifier ID - unique identifier for this DVN instance.
21
11
  #[instance(u32)]
22
12
  Vid,
@@ -1,7 +1,7 @@
1
- use crate::tests::setup::{TestSetup, VID};
2
1
  use crate::{
3
2
  dvn::auth::{Sender, TransactionAuthData},
4
3
  errors::DvnError,
4
+ tests::setup::{TestSetup, VID},
5
5
  };
6
6
  use ed25519_dalek::{Signer, SigningKey};
7
7
  use rand::thread_rng;
@@ -134,15 +134,15 @@ fn test_check_auth_wrong_signer_fails() {
134
134
  sender: Sender::Admin(public_key, signature),
135
135
  };
136
136
 
137
- // verify_signatures panics with DvnError::SignerNotFound when signer is not found
138
- let res = env.try_invoke_contract_check_auth::<DvnError>(
137
+ // verify_signatures panics with MultisigError::SignerNotFound when signer is not found
138
+ let res = env.try_invoke_contract_check_auth::<utils::errors::MultisigError>(
139
139
  &setup.contract_id,
140
140
  &payload,
141
141
  tx_auth.into_val(&env),
142
142
  &auth_contexts,
143
143
  );
144
144
 
145
- assert_eq!(res, Err(Ok(DvnError::SignerNotFound)));
145
+ assert_eq!(res, Err(Ok(utils::errors::MultisigError::SignerNotFound)));
146
146
  }
147
147
 
148
148
  #[test]
@@ -1,5 +1,4 @@
1
- use crate::tests::setup::TestSetup;
2
- use crate::{dvn::LzDVN, DVNClient, DstConfig, DstConfigParam, IDVN};
1
+ use crate::{dvn::LzDVN, tests::setup::TestSetup, DVNClient, DstConfig, DstConfigParam, IDVN};
3
2
  use endpoint_v2::FeeRecipient;
4
3
  use message_lib_common::interfaces::ILayerZeroDVN;
5
4
  use soroban_sdk::{
@@ -1,10 +1,9 @@
1
- use crate::errors::DvnError;
2
- use crate::storage::DvnStorage;
3
1
  use crate::tests::setup::TestSetup;
4
2
  use soroban_sdk::{
5
3
  testutils::{AuthorizedFunction, BytesN as _},
6
4
  BytesN, Env, IntoVal, Symbol,
7
5
  };
6
+ use utils::errors::MultisigError;
8
7
 
9
8
  fn random_signer(env: &Env) -> BytesN<20> {
10
9
  BytesN::random(env)
@@ -12,7 +11,7 @@ fn random_signer(env: &Env) -> BytesN<20> {
12
11
 
13
12
  fn clear_signers(setup: &TestSetup) {
14
13
  setup.env.as_contract(&setup.contract_id, || {
15
- DvnStorage::remove_signers(&setup.env);
14
+ utils::multisig::MultisigStorage::remove_signers(&setup.env);
16
15
  });
17
16
  }
18
17
 
@@ -48,7 +47,7 @@ fn test_set_signer_duplicate_fails() {
48
47
  setup.multisig_client.set_signer(&signer, &true);
49
48
  let res = setup.multisig_client.try_set_signer(&signer, &true);
50
49
 
51
- assert_eq!(res.err().unwrap().ok().unwrap(), DvnError::SignerAlreadyExists.into());
50
+ assert_eq!(res.err().unwrap().ok().unwrap(), MultisigError::SignerAlreadyExists.into());
52
51
  }
53
52
 
54
53
  #[test]
@@ -69,7 +68,7 @@ fn test_set_signer_remove_not_found() {
69
68
  let signer = random_signer(&setup.env);
70
69
 
71
70
  let res = setup.multisig_client.try_set_signer(&signer, &false);
72
- assert_eq!(res.err().unwrap().ok().unwrap(), DvnError::SignerNotFound.into());
71
+ assert_eq!(res.err().unwrap().ok().unwrap(), MultisigError::SignerNotFound.into());
73
72
  }
74
73
 
75
74
  #[test]
@@ -78,7 +77,7 @@ fn test_set_signer_invalid_signer_zero_address() {
78
77
  let zero = BytesN::from_array(&setup.env, &[0u8; 20]);
79
78
 
80
79
  let res = setup.multisig_client.try_set_signer(&zero, &true);
81
- assert_eq!(res.err().unwrap().ok().unwrap(), DvnError::InvalidSigner.into());
80
+ assert_eq!(res.err().unwrap().ok().unwrap(), MultisigError::InvalidSigner.into());
82
81
  }
83
82
 
84
83
  #[test]
@@ -115,7 +114,7 @@ fn test_remove_signer_when_no_signers() {
115
114
 
116
115
  let signer = random_signer(&setup.env);
117
116
  let res = setup.multisig_client.try_set_signer(&signer, &false);
118
- assert_eq!(res.err().unwrap().ok().unwrap(), DvnError::SignerNotFound.into());
117
+ assert_eq!(res.err().unwrap().ok().unwrap(), MultisigError::SignerNotFound.into());
119
118
  }
120
119
 
121
120
  #[test]
@@ -129,5 +128,5 @@ fn test_remove_signer_violates_threshold() {
129
128
 
130
129
  // Removing a signer should fail because it would leave only 1 signer with threshold 2
131
130
  let res = setup.multisig_client.try_set_signer(&signer_to_remove, &false);
132
- assert_eq!(res.err().unwrap().ok().unwrap(), DvnError::TotalSignersLessThanThreshold.into());
131
+ assert_eq!(res.err().unwrap().ok().unwrap(), MultisigError::TotalSignersLessThanThreshold.into());
133
132
  }
@@ -1,9 +1,12 @@
1
- use crate::tests::setup::{TestSetup, DEFAULT_MULTIPLIER_BPS, VID};
2
- use crate::{dvn::LzDVN, errors::DvnError, storage::DvnStorage};
1
+ use crate::{
2
+ dvn::LzDVN,
3
+ tests::setup::{TestSetup, DEFAULT_MULTIPLIER_BPS, VID},
4
+ };
3
5
  use soroban_sdk::{
4
6
  testutils::{Address as _, AuthorizedFunction, BytesN as _},
5
7
  vec, Address, BytesN, Env, IntoVal, Symbol, Vec,
6
8
  };
9
+ use utils::errors::MultisigError;
7
10
 
8
11
  fn random_signer(env: &Env) -> BytesN<20> {
9
12
  BytesN::random(env)
@@ -66,7 +69,7 @@ fn test_set_threshold_zero_fails() {
66
69
  let setup = TestSetup::new(1);
67
70
 
68
71
  let res = setup.multisig_client.try_set_threshold(&0);
69
- assert_eq!(res.err().unwrap().ok().unwrap(), DvnError::ZeroThreshold.into());
72
+ assert_eq!(res.err().unwrap().ok().unwrap(), MultisigError::ZeroThreshold.into());
70
73
  }
71
74
 
72
75
  #[test]
@@ -74,7 +77,7 @@ fn test_set_threshold_above_signers_fails() {
74
77
  let setup = TestSetup::new(2);
75
78
 
76
79
  let res = setup.multisig_client.try_set_threshold(&3);
77
- assert_eq!(res.err().unwrap().ok().unwrap(), DvnError::TotalSignersLessThanThreshold.into());
80
+ assert_eq!(res.err().unwrap().ok().unwrap(), MultisigError::TotalSignersLessThanThreshold.into());
78
81
  }
79
82
 
80
83
  #[test]
@@ -82,15 +85,15 @@ fn test_set_threshold_with_no_signers_fails() {
82
85
  let setup = TestSetup::new(1);
83
86
 
84
87
  setup.env.as_contract(&setup.contract_id, || {
85
- DvnStorage::remove_signers(&setup.env);
88
+ utils::multisig::MultisigStorage::remove_signers(&setup.env);
86
89
  });
87
90
 
88
91
  let res = setup.multisig_client.try_set_threshold(&1);
89
- assert_eq!(res.err().unwrap().ok().unwrap(), DvnError::TotalSignersLessThanThreshold.into());
92
+ assert_eq!(res.err().unwrap().ok().unwrap(), MultisigError::TotalSignersLessThanThreshold.into());
90
93
  }
91
94
 
92
95
  #[test]
93
- #[should_panic(expected = "Error(Contract, #14)")] // DvnError::ZeroThreshold
96
+ #[should_panic(expected = "Error(Contract, #1067)")] // ZeroThreshold
94
97
  fn test_constructor_threshold_zero_panics() {
95
98
  let env = Env::default();
96
99
  env.mock_all_auths();
@@ -99,7 +102,7 @@ fn test_constructor_threshold_zero_panics() {
99
102
  }
100
103
 
101
104
  #[test]
102
- #[should_panic(expected = "Error(Contract, #12)")] // DvnError::TotalSignersLessThanThreshold
105
+ #[should_panic(expected = "Error(Contract, #1065)")] // TotalSignersLessThanThreshold
103
106
  fn test_constructor_signers_less_than_threshold_panics() {
104
107
  let env = Env::default();
105
108
  env.mock_all_auths();
@@ -1,9 +1,8 @@
1
1
  extern crate std;
2
2
 
3
- use crate::storage::DvnStorage;
4
- use crate::tests::key_pair::KeyPair;
5
- use crate::tests::setup::TestSetup;
3
+ use crate::tests::{key_pair::KeyPair, setup::TestSetup};
6
4
  use soroban_sdk::{vec, Bytes, BytesN, Vec};
5
+ use utils::errors::MultisigError;
7
6
 
8
7
  fn hash(env: &soroban_sdk::Env, label: &[u8]) -> BytesN<32> {
9
8
  env.crypto().keccak256(&Bytes::from_slice(env, label)).to_bytes()
@@ -59,7 +58,6 @@ fn test_verify_signatures_raw_v_path() {
59
58
  }
60
59
 
61
60
  #[test]
62
- #[should_panic(expected = "Error(Contract, #11)")] // DvnError::SignerNotFound
63
61
  fn test_verify_signatures_with_wrong_signer() {
64
62
  let setup = TestSetup::new(1);
65
63
  let digest = hash(&setup.env, b"test");
@@ -67,22 +65,22 @@ fn test_verify_signatures_with_wrong_signer() {
67
65
  let signature = wrong_key_pair.sign(&digest.to_array());
68
66
  let signatures: Vec<BytesN<65>> = vec![&setup.env, BytesN::from_array(&setup.env, &signature)];
69
67
 
70
- setup.multisig_client.verify_signatures(&digest, &signatures);
68
+ let res = setup.multisig_client.try_verify_signatures(&digest, &signatures);
69
+ assert_eq!(res.err().unwrap().ok().unwrap(), MultisigError::SignerNotFound.into());
71
70
  }
72
71
 
73
72
  #[test]
74
- #[should_panic(expected = "Error(Contract, #9)")] // DvnError::SignatureError
75
73
  fn test_verify_signatures_insufficient_signatures() {
76
74
  let setup = TestSetup::new(2);
77
75
  let digest = hash(&setup.env, b"insufficient");
78
76
 
79
77
  let signatures: Vec<BytesN<65>> = vec![&setup.env, sign(&setup, 0, &digest)];
80
78
 
81
- setup.multisig_client.verify_signatures(&digest, &signatures);
79
+ let res = setup.multisig_client.try_verify_signatures(&digest, &signatures);
80
+ assert_eq!(res.err().unwrap().ok().unwrap(), MultisigError::SignatureError.into());
82
81
  }
83
82
 
84
83
  #[test]
85
- #[should_panic(expected = "Error(Contract, #13)")] // DvnError::UnsortedSigners
86
84
  fn test_verify_signatures_duplicate_signer() {
87
85
  let setup = TestSetup::new(2);
88
86
  let digest = hash(&setup.env, b"duplicate");
@@ -90,20 +88,21 @@ fn test_verify_signatures_duplicate_signer() {
90
88
  let sig1 = sign(&setup, 0, &digest);
91
89
  let signatures: Vec<BytesN<65>> = vec![&setup.env, sig1.clone(), sig1];
92
90
 
93
- setup.multisig_client.verify_signatures(&digest, &signatures);
91
+ let res = setup.multisig_client.try_verify_signatures(&digest, &signatures);
92
+ assert_eq!(res.err().unwrap().ok().unwrap(), MultisigError::UnsortedSigners.into());
94
93
  }
95
94
 
96
95
  #[test]
97
- #[should_panic(expected = "Error(Contract, #14)")] // DvnError::ZeroThreshold
98
96
  fn test_verify_signatures_threshold_zero() {
99
97
  let setup = TestSetup::new(1);
100
98
  // Force threshold to 0 via storage to hit ZeroThreshold branch
101
99
  setup.env.as_contract(&setup.contract_id, || {
102
- DvnStorage::set_threshold(&setup.env, &0);
100
+ utils::multisig::MultisigStorage::set_threshold(&setup.env, &0);
103
101
  });
104
102
  let digest = hash(&setup.env, b"threshold_zero");
105
103
 
106
104
  let signatures: Vec<BytesN<65>> = vec![&setup.env, sign(&setup, 0, &digest)];
107
105
 
108
- setup.multisig_client.verify_signatures(&digest, &signatures);
106
+ let res = setup.multisig_client.try_verify_signatures(&digest, &signatures);
107
+ assert_eq!(res.err().unwrap().ok().unwrap(), MultisigError::ZeroThreshold.into());
109
108
  }
@@ -2,9 +2,9 @@
2
2
 
3
3
  extern crate std;
4
4
 
5
- use crate::tests::key_pair::KeyPair;
6
- use crate::{dvn::LzDVN, interfaces::MultiSigClient};
5
+ use crate::{dvn::LzDVN, tests::key_pair::KeyPair};
7
6
  use soroban_sdk::{address_payload::AddressPayload, testutils::Address as _, vec, Address, BytesN, Env, Vec};
7
+ use utils::multisig::MultisigClient;
8
8
  use std::vec::Vec as StdVec;
9
9
 
10
10
  pub const VID: u32 = 1;
@@ -13,7 +13,7 @@ pub const DEFAULT_MULTIPLIER_BPS: u32 = 10000;
13
13
  pub struct TestSetup<'a> {
14
14
  pub env: Env,
15
15
  pub contract_id: Address,
16
- pub multisig_client: MultiSigClient<'a>,
16
+ pub multisig_client: MultisigClient<'a>,
17
17
  pub key_pairs: StdVec<KeyPair>,
18
18
  pub admins: Vec<Address>,
19
19
  }
@@ -58,7 +58,7 @@ impl<'a> TestSetup<'a> {
58
58
  ),
59
59
  );
60
60
 
61
- let multisig_client = MultiSigClient::new(&env, &contract_id);
61
+ let multisig_client = MultisigClient::new(&env, &contract_id);
62
62
 
63
63
  Self { env, contract_id, multisig_client, key_pairs, admins }
64
64
  }
@@ -102,7 +102,7 @@ impl<'a> TestSetup<'a> {
102
102
  ),
103
103
  );
104
104
 
105
- let multisig_client = MultiSigClient::new(&env, &contract_id);
105
+ let multisig_client = MultisigClient::new(&env, &contract_id);
106
106
 
107
107
  Self { env, contract_id, multisig_client, key_pairs, admins }
108
108
  }
@@ -10,7 +10,7 @@ library = []
10
10
  testutils = []
11
11
 
12
12
  [lib]
13
- crate-type = ["cdylib"]
13
+ crate-type = ["cdylib", "rlib"]
14
14
  doctest = false
15
15
 
16
16
  [dependencies]
@@ -1,6 +1,6 @@
1
1
  use crate::errors::DvnFeeLibError;
2
- use common_macros::{contract_impl, ownable, ttl_configurable, upgradeable};
3
- use soroban_sdk::{assert_with_error, contract, Address, Env};
2
+ use common_macros::{contract_impl, lz_contract};
3
+ use soroban_sdk::{assert_with_error, Address, Env};
4
4
  use utils::upgradeable::UpgradeableInternal;
5
5
  use worker::{DvnFeeParams, IDvnFeeLib, LayerZeroPriceFeedClient};
6
6
 
@@ -28,10 +28,7 @@ pub(crate) const NATIVE_DECIMALS_RATE: u128 = 10_000_000;
28
28
  /// Provides fee calculation logic based on quorum size, destination gas costs,
29
29
  /// and current gas prices from the price feed. Handles fee multipliers and
30
30
  /// floor margins.
31
- #[contract]
32
- #[ownable]
33
- #[ttl_configurable]
34
- #[upgradeable]
31
+ #[lz_contract(upgradeable)]
35
32
  pub struct DvnFeeLib;
36
33
 
37
34
  #[contract_impl]