@layerzerolabs/protocol-stellar-v2 0.2.21 → 0.2.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +347 -271
- package/.turbo/turbo-lint.log +277 -208
- package/.turbo/turbo-test.log +1700 -1370
- package/Cargo.lock +22 -51
- package/Cargo.toml +6 -1
- package/contracts/common-macros/src/auth.rs +10 -9
- package/contracts/common-macros/src/contract_ttl.rs +1 -4
- package/contracts/common-macros/src/error.rs +1 -3
- package/contracts/common-macros/src/lib.rs +65 -61
- package/contracts/common-macros/src/storage.rs +212 -65
- package/contracts/common-macros/src/tests/auth.rs +75 -6
- package/contracts/common-macros/src/tests/contract_ttl.rs +383 -350
- package/contracts/common-macros/src/tests/error.rs +9 -21
- package/contracts/common-macros/src/tests/lz_contract.rs +80 -0
- package/contracts/common-macros/src/tests/mod.rs +2 -0
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__auth__snapshot_generated_multisig_code.snap +20 -3
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__auth__snapshot_generated_ownable_code.snap +28 -1
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__contract_ttl__snapshot_generated_contractimpl_code.snap +8 -43
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__contract_ttl__snapshot_generated_contracttrait_code.snap +6 -29
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__lz_contract__snapshot_generated_lz_contract_code.snap +31 -0
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__ttl_extendable__snapshot_generated_ttl_extendable_code.snap +8 -0
- package/contracts/common-macros/src/tests/storage/extract_fields.rs +87 -0
- package/contracts/common-macros/src/tests/storage/gen_accessor_methods.rs +223 -0
- package/contracts/common-macros/src/tests/storage/gen_args.rs +65 -0
- package/contracts/common-macros/src/tests/storage/gen_enum_variant.rs +78 -0
- package/contracts/common-macros/src/tests/storage/gen_key.rs +108 -0
- package/contracts/common-macros/src/tests/storage/gen_params.rs +105 -0
- package/contracts/common-macros/src/tests/{storage.rs → storage/generate_storage.rs} +54 -129
- package/contracts/common-macros/src/tests/storage/is_primitive_type.rs +48 -0
- package/contracts/common-macros/src/tests/storage/mod.rs +16 -0
- package/contracts/common-macros/src/tests/storage/parse_default.rs +164 -0
- package/contracts/common-macros/src/tests/storage/parse_name.rs +159 -0
- package/contracts/common-macros/src/tests/storage/parse_no_ttl_extension.rs +124 -0
- package/contracts/common-macros/src/tests/storage/parse_storage_type.rs +174 -0
- package/contracts/common-macros/src/tests/storage/snapshots/common_macros__tests__storage__generate_storage__snapshot_generated_storage_code.snap +412 -0
- package/contracts/common-macros/src/tests/storage/storage_kind.rs +39 -0
- package/contracts/common-macros/src/tests/storage/test_setup.rs +25 -0
- package/contracts/common-macros/src/tests/storage/validate_attrs.rs +138 -0
- package/contracts/common-macros/src/tests/storage/variant_config.rs +226 -0
- package/contracts/common-macros/src/tests/test_helpers.rs +4 -10
- package/contracts/common-macros/src/tests/ttl_configurable.rs +2 -2
- package/contracts/common-macros/src/tests/ttl_extendable.rs +32 -0
- package/contracts/common-macros/src/tests/upgradeable.rs +118 -2
- package/contracts/common-macros/src/ttl_configurable.rs +1 -4
- package/contracts/common-macros/src/upgradeable.rs +21 -3
- package/contracts/endpoint-v2/Cargo.toml +0 -4
- package/contracts/endpoint-v2/src/endpoint_v2.rs +37 -17
- package/contracts/endpoint-v2/src/errors.rs +26 -1
- package/contracts/endpoint-v2/src/interfaces/layerzero_endpoint_v2.rs +1 -1
- package/contracts/endpoint-v2/src/interfaces/message_lib_manager.rs +4 -4
- package/contracts/endpoint-v2/src/interfaces/messaging_composer.rs +2 -2
- package/contracts/endpoint-v2/src/lib.rs +0 -1
- package/contracts/endpoint-v2/src/message_lib_manager.rs +39 -8
- package/contracts/endpoint-v2/src/messaging_channel.rs +36 -4
- package/contracts/endpoint-v2/src/messaging_composer.rs +18 -4
- package/contracts/endpoint-v2/src/storage.rs +9 -1
- package/contracts/endpoint-v2/src/tests/endpoint_setup.rs +2 -2
- package/contracts/endpoint-v2/src/tests/endpoint_v2/pay_messaging_fees.rs +1 -1
- package/contracts/endpoint-v2/src/tests/endpoint_v2/require_oapp_auth.rs +2 -2
- package/contracts/endpoint-v2/src/tests/message_lib_manager/register_library.rs +3 -3
- package/contracts/endpoint-v2/src/tests/message_lib_manager/require_receive_lib_for_eid.rs +5 -5
- package/contracts/endpoint-v2/src/tests/message_lib_manager/require_registered.rs +2 -2
- package/contracts/endpoint-v2/src/tests/message_lib_manager/require_send_lib_for_eid.rs +5 -5
- package/contracts/endpoint-v2/src/tests/message_lib_manager/require_supported_eid.rs +3 -3
- package/contracts/endpoint-v2/src/tests/messaging_channel/nilify.rs +1 -1
- package/contracts/endpoint-v2/src/tests/messaging_composer/clear_compose.rs +4 -3
- package/contracts/endpoint-v2/src/tests/messaging_composer/lz_compose_alert.rs +7 -2
- package/contracts/endpoint-v2/src/tests/messaging_composer/mod.rs +4 -0
- package/contracts/endpoint-v2/src/tests/messaging_composer/send_compose.rs +7 -2
- package/contracts/layerzero-views/src/layerzero_view.rs +0 -1
- package/contracts/layerzero-views/src/tests/mod.rs +1 -0
- package/contracts/layerzero-views/src/tests/types_tests.rs +31 -0
- package/contracts/layerzero-views/src/types.rs +2 -3
- package/contracts/macro-integration-tests/tests/runtime/contract_ttl/constructor.rs +61 -0
- package/contracts/macro-integration-tests/tests/runtime/contract_ttl/contract_impl_ttl_extension.rs +97 -0
- package/contracts/macro-integration-tests/tests/runtime/contract_ttl/contract_trait_ttl_extension.rs +99 -0
- package/contracts/macro-integration-tests/tests/runtime/contract_ttl/mod.rs +3 -0
- package/contracts/macro-integration-tests/tests/runtime/lz_contract/mod.rs +5 -0
- package/contracts/macro-integration-tests/tests/runtime/lz_contract/wrapper_default.rs +86 -0
- package/contracts/macro-integration-tests/tests/runtime/lz_contract/wrapper_multisig.rs +47 -0
- package/contracts/macro-integration-tests/tests/runtime/lz_contract/wrapper_multisig_upgradeable.rs +77 -0
- package/contracts/macro-integration-tests/tests/runtime/lz_contract/wrapper_upgradeable.rs +114 -0
- package/contracts/macro-integration-tests/tests/runtime/lz_contract/wrapper_upgradeable_no_migration.rs +105 -0
- package/contracts/macro-integration-tests/tests/runtime/multisig/admin_entrypoints.rs +242 -0
- package/contracts/macro-integration-tests/tests/runtime/multisig/mod.rs +9 -0
- package/contracts/macro-integration-tests/tests/runtime/multisig/self_auth.rs +54 -0
- package/contracts/macro-integration-tests/tests/runtime/ownable/initialization.rs +13 -0
- package/contracts/macro-integration-tests/tests/runtime/ownable/mod.rs +1 -0
- package/contracts/macro-integration-tests/tests/runtime/ownable/ownership_transfer.rs +70 -1
- package/contracts/macro-integration-tests/tests/runtime/ownable/two_step_transfer.rs +219 -0
- package/contracts/macro-integration-tests/tests/runtime/storage/keyed_roundtrip.rs +41 -0
- package/contracts/macro-integration-tests/tests/runtime/storage/ttl_extension.rs +48 -16
- package/contracts/macro-integration-tests/tests/runtime/storage/unkeyed_roundtrip.rs +10 -0
- package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/configuration.rs +96 -3
- package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/freeze.rs +4 -0
- package/contracts/macro-integration-tests/tests/runtime/ttl_extendable/extend_instance_ttl.rs +64 -0
- package/contracts/macro-integration-tests/tests/runtime/ttl_extendable/mod.rs +16 -0
- package/contracts/macro-integration-tests/tests/runtime/upgradeable/migrate_guard_and_state.rs +305 -0
- package/contracts/macro-integration-tests/tests/runtime/upgradeable/mod.rs +3 -0
- package/contracts/macro-integration-tests/tests/runtime/upgradeable/no_migration.rs +59 -0
- package/contracts/macro-integration-tests/tests/runtime/upgradeable/upgrade_then_migrate.rs +88 -0
- package/contracts/macro-integration-tests/tests/runtime.rs +5 -0
- package/contracts/macro-integration-tests/tests/ui/contract_impl/fail/not_impl_item.rs +6 -0
- package/contracts/macro-integration-tests/tests/ui/contract_impl/fail/not_impl_item.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/contract_impl/pass/basic.rs +102 -0
- package/contracts/macro-integration-tests/tests/ui/contract_trait/fail/not_a_trait.rs +6 -0
- package/contracts/macro-integration-tests/tests/ui/contract_trait/fail/not_a_trait.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/contract_trait/pass/basic.rs +83 -0
- package/contracts/macro-integration-tests/tests/ui/error/fail/discriminant_too_large.rs +11 -0
- package/contracts/macro-integration-tests/tests/ui/error/fail/discriminant_too_large.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/error/fail/non_enum_input.rs +11 -0
- package/contracts/macro-integration-tests/tests/ui/error/fail/non_enum_input.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/error/pass/basic.rs +22 -0
- package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/invalid_option.rs +6 -0
- package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/invalid_option.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/multisig_rejects_ownable_api.rs +20 -0
- package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/multisig_rejects_ownable_api.stderr +20 -0
- package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/not_a_struct.rs +8 -0
- package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/not_a_struct.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/upgradeable_invalid_inner_option.rs +10 -0
- package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/upgradeable_invalid_inner_option.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/upgradeable_missing_internal.rs +20 -0
- package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/upgradeable_missing_internal.stderr +86 -0
- package/contracts/macro-integration-tests/tests/ui/lz_contract/pass/basic.rs +45 -0
- package/contracts/macro-integration-tests/tests/ui/lz_contract/pass/multisig.rs +34 -0
- package/contracts/macro-integration-tests/tests/ui/lz_contract/pass/multisig_upgradeable.rs +30 -0
- package/contracts/macro-integration-tests/tests/ui/lz_contract/pass/upgradeable.rs +39 -0
- package/contracts/macro-integration-tests/tests/ui/lz_contract/pass/upgradeable_no_migration.rs +28 -0
- package/contracts/macro-integration-tests/tests/ui/multisig/fail/non_struct_input.rs +8 -0
- package/contracts/macro-integration-tests/tests/ui/multisig/fail/non_struct_input.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/multisig/fail/rejects_ownable_api.rs +20 -0
- package/contracts/macro-integration-tests/tests/ui/multisig/fail/rejects_ownable_api.stderr +12 -0
- package/contracts/macro-integration-tests/tests/ui/multisig/fail/rejects_ownable_trait.rs +20 -0
- package/contracts/macro-integration-tests/tests/ui/multisig/fail/rejects_ownable_trait.stderr +5 -0
- package/contracts/macro-integration-tests/tests/ui/multisig/pass/basic.rs +49 -0
- package/contracts/macro-integration-tests/tests/ui/ownable/fail/non_struct_input.rs +8 -0
- package/contracts/macro-integration-tests/tests/ui/ownable/fail/non_struct_input.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/ownable/fail/only_auth_missing_auth.rs +19 -0
- package/contracts/macro-integration-tests/tests/ui/ownable/fail/only_auth_missing_auth.stderr +12 -0
- package/contracts/macro-integration-tests/tests/ui/ownable/fail/only_auth_missing_env.rs +1 -1
- package/contracts/macro-integration-tests/tests/ui/ownable/fail/only_auth_missing_env.stderr +0 -8
- package/contracts/macro-integration-tests/tests/ui/ownable/pass/basic.rs +39 -0
- package/contracts/macro-integration-tests/tests/ui/ownable/pass/only_auth_env_param_variants.rs +7 -1
- package/contracts/macro-integration-tests/tests/ui/storage/fail/invalid_storage_type_param.stderr +1 -1
- package/contracts/macro-integration-tests/tests/ui/storage/fail/missing_storage_type_param.stderr +1 -1
- package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_default_values.rs +11 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_default_values.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_name_attrs.rs +11 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_name_attrs.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_no_ttl_extension.rs +11 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_no_ttl_extension.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_type_params.stderr +1 -1
- package/contracts/macro-integration-tests/tests/ui/storage/fail/no_ttl_extension_rejects_args.rs +13 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/no_ttl_extension_rejects_args.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/storage/pass/api_surface.rs +102 -0
- package/contracts/macro-integration-tests/tests/ui/storage/pass/basic.rs +43 -0
- package/contracts/macro-integration-tests/tests/ui/storage/pass/multi_key.rs +38 -0
- package/contracts/macro-integration-tests/tests/ui/ttl_configurable/fail/missing_auth_trait.rs +14 -0
- package/contracts/macro-integration-tests/tests/ui/ttl_configurable/fail/missing_auth_trait.stderr +71 -0
- package/contracts/macro-integration-tests/tests/ui/ttl_configurable/fail/non_struct_input.rs +8 -0
- package/contracts/macro-integration-tests/tests/ui/ttl_configurable/fail/non_struct_input.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/ttl_configurable/pass/{minimal_contract.rs → basic.rs} +2 -0
- package/contracts/macro-integration-tests/tests/ui/ttl_configurable/pass/multisig_contract.rs +28 -0
- package/contracts/macro-integration-tests/tests/ui/ttl_configurable/pass/ownable_contract.rs +32 -0
- package/contracts/macro-integration-tests/tests/ui/ttl_extendable/fail/non_struct_input.rs +8 -0
- package/contracts/macro-integration-tests/tests/ui/ttl_extendable/fail/non_struct_input.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/ttl_extendable/pass/basic.rs +23 -0
- package/contracts/macro-integration-tests/tests/ui/ttl_extendable/pass/no_user_contractimpl.rs +21 -0
- package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/attr_args.rs +11 -0
- package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/attr_args.stderr +29 -0
- package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/missing_auth_trait.rs +20 -0
- package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/missing_auth_trait.stderr +71 -0
- package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/missing_upgradeable_internal.rs +10 -0
- package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/missing_upgradeable_internal.stderr +79 -0
- package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/non_struct_input.rs +8 -0
- package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/non_struct_input.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/upgradeable/pass/basic.rs +43 -0
- package/contracts/macro-integration-tests/tests/ui/upgradeable/pass/multisig_contract.rs +35 -0
- package/contracts/macro-integration-tests/tests/ui/upgradeable/pass/no_migration.rs +30 -0
- package/contracts/macro-integration-tests/tests/ui/upgradeable/pass/no_user_contractimpl.rs +29 -0
- package/contracts/macro-integration-tests/tests/ui_contract_impl.rs +12 -0
- package/contracts/macro-integration-tests/tests/ui_contract_trait.rs +12 -0
- package/contracts/macro-integration-tests/tests/ui_lz_contract.rs +11 -0
- package/contracts/macro-integration-tests/tests/ui_multisig.rs +11 -0
- package/contracts/macro-integration-tests/tests/ui_ttl_extendable.rs +12 -0
- package/contracts/macro-integration-tests/tests/ui_upgradeable.rs +11 -0
- package/contracts/message-libs/blocked-message-lib/Cargo.toml +1 -1
- package/contracts/message-libs/blocked-message-lib/src/lib.rs +4 -1
- package/contracts/message-libs/blocked-message-lib/src/tests/blocked_message_lib_tests.rs +108 -0
- package/contracts/message-libs/blocked-message-lib/src/tests/mod.rs +4 -0
- package/contracts/message-libs/blocked-message-lib/src/tests/setup.rs +40 -0
- package/contracts/message-libs/simple-message-lib/src/lib.rs +1 -1
- package/contracts/message-libs/simple-message-lib/src/tests/mod.rs +2 -0
- package/contracts/message-libs/simple-message-lib/src/tests/setup.rs +124 -0
- package/contracts/message-libs/simple-message-lib/src/tests/simple_message_lib_tests.rs +309 -0
- package/contracts/message-libs/uln-302/src/errors.rs +21 -0
- package/contracts/message-libs/uln-302/src/interfaces/receive_uln.rs +1 -1
- package/contracts/message-libs/uln-302/src/receive_uln.rs +6 -4
- package/contracts/message-libs/uln-302/src/send_uln.rs +15 -6
- package/contracts/message-libs/uln-302/src/storage.rs +5 -5
- package/contracts/message-libs/uln-302/src/tests/uln302/get_config.rs +71 -0
- package/contracts/message-libs/uln-302/src/tests/uln302/mod.rs +1 -0
- package/contracts/message-libs/uln-302/src/uln302.rs +3 -0
- package/contracts/oapps/counter/Cargo.toml +2 -0
- package/contracts/oapps/counter/integration_tests/mod.rs +1 -0
- package/contracts/oapps/counter/integration_tests/setup_sml.rs +6 -4
- package/contracts/oapps/counter/integration_tests/setup_uln.rs +12 -5
- package/contracts/oapps/counter/integration_tests/test_with_blocked.rs +67 -0
- package/contracts/oapps/counter/src/tests/mod.rs +1 -0
- package/contracts/oapps/counter/src/tests/test_u256_ext.rs +48 -0
- package/contracts/oapps/oapp/src/lib.rs +0 -3
- package/contracts/oapps/oapp/src/tests/mod.rs +1 -0
- package/contracts/oapps/oft/integration-tests/setup.rs +2 -3
- package/contracts/oapps/oft/src/lib.rs +3 -0
- package/contracts/oapps/oft/src/tests/extensions/mod.rs +3 -0
- package/contracts/oapps/oft/src/tests/extensions/oft_fee.rs +240 -0
- package/contracts/oapps/oft/src/tests/extensions/pausable.rs +141 -0
- package/contracts/oapps/oft/src/tests/extensions/rate_limiter.rs +447 -0
- package/contracts/oapps/oft/src/tests/mod.rs +2 -0
- package/contracts/oapps/oft/src/tests/oft_types/lock_unlock.rs +180 -0
- package/contracts/oapps/oft/src/tests/oft_types/mod.rs +1 -0
- package/contracts/oapps/oft-core/integration-tests/setup.rs +2 -3
- package/contracts/oapps/oft-core/src/lib.rs +2 -2
- package/contracts/oapps/oft-core/src/tests/mod.rs +1 -1
- package/contracts/oapps/oft-core/src/tests/{test_oft_version.rs → test_oft_version_and_approval.rs} +9 -0
- package/contracts/oapps/oft-core/src/tests/test_utils.rs +0 -43
- package/contracts/upgrader/src/tests/test_upgrader.rs +18 -0
- package/contracts/utils/src/auth.rs +2 -2
- package/contracts/utils/src/buffer_reader.rs +61 -10
- package/contracts/utils/src/buffer_writer.rs +35 -20
- package/contracts/utils/src/bytes_ext.rs +1 -2
- package/contracts/utils/src/errors.rs +5 -3
- package/contracts/utils/src/multisig.rs +59 -36
- package/contracts/utils/src/option_ext.rs +3 -3
- package/contracts/utils/src/ownable.rs +12 -6
- package/contracts/utils/src/tests/auth.rs +179 -0
- package/contracts/utils/src/tests/buffer_reader.rs +203 -1
- package/contracts/utils/src/tests/buffer_writer.rs +176 -5
- package/contracts/utils/src/tests/mod.rs +2 -0
- package/contracts/utils/src/tests/multisig.rs +170 -141
- package/contracts/utils/src/tests/option_ext.rs +1 -1
- package/contracts/utils/src/tests/ownable.rs +156 -161
- package/contracts/utils/src/tests/test_helper.rs +21 -1
- package/contracts/utils/src/tests/testing_utils.rs +84 -2
- package/contracts/utils/src/tests/ttl_configurable.rs +66 -86
- package/contracts/utils/src/tests/ttl_extendable.rs +64 -0
- package/contracts/utils/src/tests/upgradeable.rs +115 -6
- package/contracts/utils/src/ttl_configurable.rs +22 -12
- package/contracts/utils/src/ttl_extendable.rs +1 -3
- package/contracts/utils/src/upgradeable.rs +21 -24
- package/contracts/workers/dvn/src/auth.rs +1 -1
- package/contracts/workers/dvn/src/interfaces/dvn.rs +2 -2
- package/contracts/workers/dvn/src/storage.rs +1 -1
- package/contracts/workers/dvn/src/tests/auth.rs +136 -3
- package/contracts/workers/dvn/src/tests/mod.rs +0 -1
- package/contracts/workers/dvn/src/tests/setup.rs +4 -10
- package/contracts/workers/executor-helper/src/tests/executor_helper.rs +279 -0
- package/contracts/workers/executor-helper/src/tests/setup.rs +106 -1
- package/contracts/workers/worker/src/worker.rs +1 -1
- package/docs/oft-guide.md +5 -5
- package/package.json +5 -7
- package/sdk/.turbo/turbo-test.log +662 -466
- package/sdk/LICENSE +23 -0
- package/sdk/dist/generated/bml.d.ts +101 -106
- package/sdk/dist/generated/bml.js +108 -26
- package/sdk/dist/generated/counter.d.ts +123 -484
- package/sdk/dist/generated/counter.js +103 -25
- package/sdk/dist/generated/dvn.d.ts +141 -699
- package/sdk/dist/generated/dvn.js +106 -28
- package/sdk/dist/generated/dvn_fee_lib.d.ts +31 -248
- package/sdk/dist/generated/dvn_fee_lib.js +27 -24
- package/sdk/dist/generated/endpoint.d.ts +158 -836
- package/sdk/dist/generated/endpoint.js +107 -29
- package/sdk/dist/generated/executor.d.ts +139 -671
- package/sdk/dist/generated/executor.js +106 -28
- package/sdk/dist/generated/executor_fee_lib.d.ts +109 -264
- package/sdk/dist/generated/executor_fee_lib.js +106 -28
- package/sdk/dist/generated/executor_helper.d.ts +95 -92
- package/sdk/dist/generated/executor_helper.js +103 -25
- package/sdk/dist/generated/layerzero_view.d.ts +178 -335
- package/sdk/dist/generated/layerzero_view.js +172 -33
- package/sdk/dist/generated/oft.d.ts +137 -680
- package/sdk/dist/generated/oft.js +103 -25
- package/sdk/dist/generated/price_feed.d.ts +45 -444
- package/sdk/dist/generated/price_feed.js +27 -24
- package/sdk/dist/generated/sml.d.ts +119 -428
- package/sdk/dist/generated/sml.js +103 -25
- package/sdk/dist/generated/treasury.d.ts +109 -288
- package/sdk/dist/generated/treasury.js +103 -25
- package/sdk/dist/generated/uln302.d.ts +190 -527
- package/sdk/dist/generated/uln302.js +170 -31
- package/sdk/dist/generated/upgrader.d.ts +14 -34
- package/sdk/dist/generated/upgrader.js +24 -21
- package/sdk/package.json +3 -4
- package/sdk/test/counter-sml.test.ts +218 -142
- package/sdk/test/counter-uln.test.ts +189 -145
- package/sdk/test/oft-sml.test.ts +173 -156
- package/sdk/test/suites/constants.ts +7 -1
- package/sdk/test/suites/globalSetup.ts +140 -74
- package/sdk/turbo.json +1 -1
- package/tools/ts-bindings-gen/Cargo.toml +4 -4
- package/tools/ts-bindings-gen/src/main.rs +4 -0
- package/turbo.json +3 -0
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__storage__snapshot_generated_storage_code.snap +0 -1072
- package/contracts/endpoint-v2/src/constants.rs +0 -52
- package/contracts/macro-integration-tests/tests/ui/error/fail/attr_not_empty.rs +0 -12
- package/contracts/macro-integration-tests/tests/ui/error/fail/attr_not_empty.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/error/pass/attr_on_variant_allowed.rs +0 -20
- package/contracts/macro-integration-tests/tests/ui/error/pass/basic_auto_discriminants.rs +0 -15
- package/contracts/macro-integration-tests/tests/ui/error/pass/mixed_discriminants.rs +0 -16
- package/contracts/macro-integration-tests/tests/ui/ownable/pass/minimal_contract.rs +0 -26
- package/contracts/macro-integration-tests/tests/ui/ownable/pass/namespacing_and_imports.rs +0 -21
- package/contracts/macro-integration-tests/tests/ui/storage/fail/storage_attr_rejects_args.rs +0 -12
- package/contracts/macro-integration-tests/tests/ui/storage/fail/storage_attr_rejects_args.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/storage/pass/default_value_on_variant.rs +0 -14
- package/contracts/macro-integration-tests/tests/ui/storage/pass/enum_instance_unit_basic.rs +0 -14
- package/contracts/macro-integration-tests/tests/ui/storage/pass/enum_persistent_named_fields_keyed.rs +0 -16
- package/contracts/macro-integration-tests/tests/ui/storage/pass/enum_temporary_unit_option.rs +0 -15
- package/contracts/macro-integration-tests/tests/ui/storage/pass/name_override.rs +0 -14
- package/contracts/macro-integration-tests/tests/ui/storage/pass/no_auto_ttl_extension.rs +0 -19
- package/contracts/macro-integration-tests/tests/ui/storage/pass/ttl_provider_basic.rs +0 -15
- package/contracts/message-libs/simple-message-lib/src/test.rs +0 -280
- package/contracts/oapps/oapp/src/macro_tests/mod.rs +0 -1
- package/contracts/workers/dvn/src/tests/multisig/mod.rs +0 -3
- package/contracts/workers/dvn/src/tests/multisig/set_signer.rs +0 -132
- package/contracts/workers/dvn/src/tests/multisig/set_threshold.rs +0 -109
- package/contracts/workers/dvn/src/tests/multisig/verify_signatures.rs +0 -106
- /package/contracts/oapps/oapp/src/{macro_tests → tests}/test_macros.rs +0 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// UI (trybuild) test: `#[contract_trait]` on a trait definition compiles.
|
|
2
|
+
//
|
|
3
|
+
// Purpose:
|
|
4
|
+
// - Verifies `#[common_macros::contract_trait]` can wrap a trait definition.
|
|
5
|
+
// - Covers the "pass" surface area:
|
|
6
|
+
// - Default methods with an `Env` parameter are instrumented (by ref / owned / mut ref).
|
|
7
|
+
// - Default methods without `Env` are skipped.
|
|
8
|
+
// - Fully-qualified `soroban_sdk::Env` type path is accepted.
|
|
9
|
+
// - Abstract methods remain valid alongside default methods.
|
|
10
|
+
|
|
11
|
+
use soroban_sdk::Env;
|
|
12
|
+
|
|
13
|
+
#[common_macros::contract_trait]
|
|
14
|
+
pub trait MyTrait {
|
|
15
|
+
// Default method with `&Env`.
|
|
16
|
+
fn ping(env: &Env) {
|
|
17
|
+
let _ = env;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Parameter name can be underscore-prefixed (still detected and used by injection).
|
|
21
|
+
fn ping_underscore(_env: &Env) {
|
|
22
|
+
let _ = _env;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Default method with owned `Env`.
|
|
26
|
+
fn ping_owned(env: Env) {
|
|
27
|
+
let _ = &env;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Owned `Env` can be declared mutable (pattern is still `Pat::Ident`).
|
|
31
|
+
fn ping_owned_mut(mut env: Env) {
|
|
32
|
+
let _ = &mut env;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Default method with extra args + return.
|
|
36
|
+
fn ping_with_args(env: &Env, x: u32) -> u32 {
|
|
37
|
+
let _ = env;
|
|
38
|
+
x
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Default method with fully-qualified Env path.
|
|
42
|
+
fn ping_fq_env(env: &soroban_sdk::Env) {
|
|
43
|
+
let _ = env;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// `&mut Env` should still work via coercion to `&Env` for the TTL-config lookup.
|
|
47
|
+
fn ping_mut_ref(env: &mut Env) {
|
|
48
|
+
let _ = env;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Default method without `Env` is skipped by the macro (should still compile).
|
|
52
|
+
fn no_env_default(x: u32) -> u32 {
|
|
53
|
+
x
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
fn abstract_method(env: &Env) -> u32;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// UI: attribute arguments are forwarded to `#[soroban_sdk::contracttrait(...)]`.
|
|
60
|
+
#[common_macros::contract_trait(crate_path = "soroban_sdk")]
|
|
61
|
+
pub trait MyTraitWithAttr {
|
|
62
|
+
fn ping(env: &Env) {
|
|
63
|
+
let _ = env;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// UI: trait items other than methods should remain valid (associated types/constants).
|
|
68
|
+
#[common_macros::contract_trait]
|
|
69
|
+
pub trait TraitWithAssociatedItems {
|
|
70
|
+
type Assoc;
|
|
71
|
+
const VERSION: u32 = 1;
|
|
72
|
+
|
|
73
|
+
// Abstract method should remain valid alongside associated items.
|
|
74
|
+
fn abstract_method(env: &Env) -> u32;
|
|
75
|
+
|
|
76
|
+
// Default method with `Env` (still instrumented).
|
|
77
|
+
fn default_method(env: &Env) -> u32 {
|
|
78
|
+
let _ = env;
|
|
79
|
+
Self::VERSION
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
fn main() {}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
error: custom attribute panicked
|
|
2
|
+
--> tests/ui/error/fail/discriminant_too_large.rs:6:1
|
|
3
|
+
|
|
|
4
|
+
6 | #[common_macros::contract_error]
|
|
5
|
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
6
|
+
|
|
|
7
|
+
= help: message: Error enum discriminant must be a valid u32 integer: Error("number too large to fit in target type")
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// UI (trybuild) negative test: `#[contract_error]` must be applied to an enum.
|
|
2
|
+
//
|
|
3
|
+
// Purpose:
|
|
4
|
+
// - Ensures non-enum input (struct) is rejected at compile time.
|
|
5
|
+
// - Locks down the enum-only contract for downstream users.
|
|
6
|
+
|
|
7
|
+
#[common_macros::contract_error]
|
|
8
|
+
pub struct NotAnEnum;
|
|
9
|
+
|
|
10
|
+
fn main() {}
|
|
11
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// UI (trybuild) test: `#[contract_error]` basic pass coverage.
|
|
2
|
+
//
|
|
3
|
+
// Purpose:
|
|
4
|
+
// - Covers auto discriminants (no explicit values).
|
|
5
|
+
// - Covers mixed discriminants (explicit + implicit).
|
|
6
|
+
// - Ensures variant attributes (e.g. doc strings) are allowed/preserved.
|
|
7
|
+
|
|
8
|
+
#[common_macros::contract_error]
|
|
9
|
+
pub enum MyError {
|
|
10
|
+
// Auto discriminants + variant attributes
|
|
11
|
+
#[doc = "A documented error variant (auto discriminant)."]
|
|
12
|
+
A,
|
|
13
|
+
|
|
14
|
+
#[doc = "Another documented error variant (auto discriminant)."]
|
|
15
|
+
B,
|
|
16
|
+
|
|
17
|
+
// Mixed discriminants
|
|
18
|
+
C = 20,
|
|
19
|
+
D,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
fn main() {}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
error: custom attribute panicked
|
|
2
|
+
--> tests/ui/lz_contract/fail/invalid_option.rs:3:1
|
|
3
|
+
|
|
|
4
|
+
3 | #[common_macros::lz_contract(unknown_option)]
|
|
5
|
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
6
|
+
|
|
|
7
|
+
= help: message: failed to parse lz_contract config: expected one of `upgradeable`, `multisig`
|
package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/multisig_rejects_ownable_api.rs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// UI (trybuild) negative test: `#[lz_contract(multisig)]` should NOT expose ownable APIs.
|
|
2
|
+
//
|
|
3
|
+
// Purpose:
|
|
4
|
+
// - Ensures selecting `multisig` switches auth from ownable -> multisig.
|
|
5
|
+
// - `init_owner` is an ownable initializer API and should not exist on multisig contracts.
|
|
6
|
+
|
|
7
|
+
use soroban_sdk::{contractimpl, Address, BytesN, Env, Vec};
|
|
8
|
+
|
|
9
|
+
#[common_macros::lz_contract(multisig)]
|
|
10
|
+
pub struct MyContract;
|
|
11
|
+
|
|
12
|
+
#[contractimpl]
|
|
13
|
+
impl MyContract {
|
|
14
|
+
pub fn should_not_compile(env: Env, owner: Address) {
|
|
15
|
+
// This should fail to compile if `#[ownable]` is not applied.
|
|
16
|
+
Self::init_owner(&env, &owner);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
fn main() {}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
warning: unused imports: `BytesN` and `Vec`
|
|
2
|
+
--> tests/ui/lz_contract/fail/multisig_rejects_ownable_api.rs:7:42
|
|
3
|
+
|
|
|
4
|
+
7 | use soroban_sdk::{contractimpl, Address, BytesN, Env, Vec};
|
|
5
|
+
| ^^^^^^ ^^^
|
|
6
|
+
|
|
|
7
|
+
= note: `#[warn(unused_imports)]` on by default
|
|
8
|
+
|
|
9
|
+
error[E0599]: no function or associated item named `init_owner` found for struct `MyContract` in the current scope
|
|
10
|
+
--> tests/ui/lz_contract/fail/multisig_rejects_ownable_api.rs:16:15
|
|
11
|
+
|
|
|
12
|
+
10 | pub struct MyContract;
|
|
13
|
+
| --------------------- function or associated item `init_owner` not found for this struct
|
|
14
|
+
...
|
|
15
|
+
16 | Self::init_owner(&env, &owner);
|
|
16
|
+
| ^^^^^^^^^^ function or associated item not found in `MyContract`
|
|
17
|
+
|
|
|
18
|
+
= help: items from traits can only be used if the trait is implemented and in scope
|
|
19
|
+
= note: the following trait defines an item `init_owner`, perhaps you need to implement it:
|
|
20
|
+
candidate #1: `OwnableInitializer`
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// UI (trybuild) negative test: `#[lz_contract(upgradeable(...))]` only accepts `no_migration`.
|
|
2
|
+
//
|
|
3
|
+
// Purpose:
|
|
4
|
+
// - Ensures nested option parsing rejects unknown inner identifiers.
|
|
5
|
+
// - Boundary coverage for the wrapper's config parser.
|
|
6
|
+
|
|
7
|
+
#[common_macros::lz_contract(upgradeable(bad_inner))]
|
|
8
|
+
pub struct MyContract;
|
|
9
|
+
|
|
10
|
+
fn main() {}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
error: custom attribute panicked
|
|
2
|
+
--> tests/ui/lz_contract/fail/upgradeable_invalid_inner_option.rs:7:1
|
|
3
|
+
|
|
|
4
|
+
7 | #[common_macros::lz_contract(upgradeable(bad_inner))]
|
|
5
|
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
6
|
+
|
|
|
7
|
+
= help: message: failed to parse lz_contract config: expected `no_migration`
|
package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/upgradeable_missing_internal.rs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// UI (trybuild) negative test: `#[lz_contract(upgradeable)]` should require `UpgradeableInternal`.
|
|
2
|
+
//
|
|
3
|
+
// Purpose:
|
|
4
|
+
// - Ensures the wrapper forwards the `upgradeable` behavior: the contract must implement
|
|
5
|
+
// `utils::upgradeable::UpgradeableInternal` (unless using `upgradeable(no_migration)`).
|
|
6
|
+
// - Prevents regressions where the wrapper would silently stop requiring migration hooks.
|
|
7
|
+
#![allow(dead_code)]
|
|
8
|
+
|
|
9
|
+
use soroban_sdk::{BytesN, Env};
|
|
10
|
+
|
|
11
|
+
#[common_macros::lz_contract(upgradeable)]
|
|
12
|
+
pub struct MyContract;
|
|
13
|
+
|
|
14
|
+
fn smoke(env: &Env) {
|
|
15
|
+
let hash = BytesN::<32>::from_array(env, &[0u8; 32]);
|
|
16
|
+
// This call should fail to type-check because `UpgradeableInternal` is not implemented.
|
|
17
|
+
MyContract::upgrade(env, &hash);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
fn main() {}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
error[E0277]: the trait bound `MyContract: UpgradeableInternal` is not satisfied
|
|
2
|
+
--> tests/ui/lz_contract/fail/upgradeable_missing_internal.rs:12:12
|
|
3
|
+
|
|
|
4
|
+
12 | pub struct MyContract;
|
|
5
|
+
| ^^^^^^^^^^ the trait `UpgradeableInternal` is not implemented for `MyContract`
|
|
6
|
+
|
|
|
7
|
+
note: required by a bound in `Upgradeable`
|
|
8
|
+
--> $WORKSPACE/contracts/utils/src/upgradeable.rs
|
|
9
|
+
|
|
|
10
|
+
| pub trait Upgradeable: UpgradeableInternal + Auth {
|
|
11
|
+
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `Upgradeable`
|
|
12
|
+
|
|
13
|
+
error[E0277]: the trait bound `MyContract: UpgradeableInternal` is not satisfied
|
|
14
|
+
--> tests/ui/lz_contract/fail/upgradeable_missing_internal.rs:12:12
|
|
15
|
+
|
|
|
16
|
+
12 | pub struct MyContract;
|
|
17
|
+
| ^^^^^^^^^^ the trait `UpgradeableInternal` is not implemented for `MyContract`
|
|
18
|
+
|
|
|
19
|
+
note: required by a bound in `upgrade`
|
|
20
|
+
--> $WORKSPACE/contracts/utils/src/upgradeable.rs
|
|
21
|
+
|
|
|
22
|
+
| pub trait Upgradeable: UpgradeableInternal + Auth {
|
|
23
|
+
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `Upgradeable::upgrade`
|
|
24
|
+
...
|
|
25
|
+
| fn upgrade(env: &soroban_sdk::Env, new_wasm_hash: &soroban_sdk::BytesN<32>) {
|
|
26
|
+
| ------- required by a bound in this associated function
|
|
27
|
+
|
|
28
|
+
error[E0277]: the trait bound `MyContract: UpgradeableInternal` is not satisfied
|
|
29
|
+
--> tests/ui/lz_contract/fail/upgradeable_missing_internal.rs:12:12
|
|
30
|
+
|
|
|
31
|
+
12 | pub struct MyContract;
|
|
32
|
+
| ^^^^^^^^^^ the trait `UpgradeableInternal` is not implemented for `MyContract`
|
|
33
|
+
|
|
|
34
|
+
note: required by a bound in `migrate`
|
|
35
|
+
--> $WORKSPACE/contracts/utils/src/upgradeable.rs
|
|
36
|
+
|
|
|
37
|
+
| pub trait Upgradeable: UpgradeableInternal + Auth {
|
|
38
|
+
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `Upgradeable::migrate`
|
|
39
|
+
...
|
|
40
|
+
| fn migrate(env: &soroban_sdk::Env, migration_data: &soroban_sdk::Bytes) {
|
|
41
|
+
| ------- required by a bound in this associated function
|
|
42
|
+
|
|
43
|
+
error[E0277]: the trait bound `MyContract: UpgradeableInternal` is not satisfied
|
|
44
|
+
--> tests/ui/lz_contract/fail/upgradeable_missing_internal.rs:12:12
|
|
45
|
+
|
|
|
46
|
+
12 | pub struct MyContract;
|
|
47
|
+
| ^^^^^^^^^^ the trait `UpgradeableInternal` is not implemented for `MyContract`
|
|
48
|
+
|
|
|
49
|
+
note: required by a bound in `freeze`
|
|
50
|
+
--> $WORKSPACE/contracts/utils/src/upgradeable.rs
|
|
51
|
+
|
|
|
52
|
+
| pub trait Upgradeable: UpgradeableInternal + Auth {
|
|
53
|
+
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `Upgradeable::freeze`
|
|
54
|
+
...
|
|
55
|
+
| fn freeze(env: &soroban_sdk::Env) {
|
|
56
|
+
| ------ required by a bound in this associated function
|
|
57
|
+
|
|
58
|
+
error[E0277]: the trait bound `MyContract: UpgradeableInternal` is not satisfied
|
|
59
|
+
--> tests/ui/lz_contract/fail/upgradeable_missing_internal.rs:12:12
|
|
60
|
+
|
|
|
61
|
+
12 | pub struct MyContract;
|
|
62
|
+
| ^^^^^^^^^^ the trait `UpgradeableInternal` is not implemented for `MyContract`
|
|
63
|
+
|
|
|
64
|
+
note: required by a bound in `is_frozen`
|
|
65
|
+
--> $WORKSPACE/contracts/utils/src/upgradeable.rs
|
|
66
|
+
|
|
|
67
|
+
| pub trait Upgradeable: UpgradeableInternal + Auth {
|
|
68
|
+
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `Upgradeable::is_frozen`
|
|
69
|
+
...
|
|
70
|
+
| fn is_frozen(env: &soroban_sdk::Env) -> bool {
|
|
71
|
+
| --------- required by a bound in this associated function
|
|
72
|
+
|
|
73
|
+
error[E0277]: the trait bound `MyContract: UpgradeableInternal` is not satisfied
|
|
74
|
+
--> tests/ui/lz_contract/fail/upgradeable_missing_internal.rs:17:5
|
|
75
|
+
|
|
|
76
|
+
17 | MyContract::upgrade(env, &hash);
|
|
77
|
+
| ^^^^^^^^^^ the trait `UpgradeableInternal` is not implemented for `MyContract`
|
|
78
|
+
|
|
|
79
|
+
note: required by a bound in `upgrade`
|
|
80
|
+
--> $WORKSPACE/contracts/utils/src/upgradeable.rs
|
|
81
|
+
|
|
|
82
|
+
| pub trait Upgradeable: UpgradeableInternal + Auth {
|
|
83
|
+
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `Upgradeable::upgrade`
|
|
84
|
+
...
|
|
85
|
+
| fn upgrade(env: &soroban_sdk::Env, new_wasm_hash: &soroban_sdk::BytesN<32>) {
|
|
86
|
+
| ------- required by a bound in this associated function
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// UI (trybuild) test: `#[lz_contract]` wrapper macro compiles (default options).
|
|
2
|
+
//
|
|
3
|
+
// Purpose:
|
|
4
|
+
// - Ensures `#[common_macros::lz_contract]` expands to a usable `#[contract]` with
|
|
5
|
+
// ttl_configurable + ttl_extendable + ownable.
|
|
6
|
+
//
|
|
7
|
+
// Note: renamed from `minimal_contract.rs` to `basic.rs` for consistency.
|
|
8
|
+
|
|
9
|
+
use soroban_sdk::{contractimpl, Address, Env};
|
|
10
|
+
use utils::ttl_configurable::TtlConfig;
|
|
11
|
+
|
|
12
|
+
#[common_macros::lz_contract]
|
|
13
|
+
pub struct MyContract;
|
|
14
|
+
|
|
15
|
+
#[contractimpl]
|
|
16
|
+
impl MyContract {
|
|
17
|
+
pub fn init(env: Env, owner: Address) {
|
|
18
|
+
Self::init_owner(&env, &owner);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
pub fn smoke(env: Env) {
|
|
22
|
+
// Auth impl exists (provided by ownable/multisig, here: ownable).
|
|
23
|
+
let _authorizer: Address = <Self as utils::auth::Auth>::authorizer(&env);
|
|
24
|
+
let _owner: Option<Address> = <Self as utils::ownable::Ownable>::owner(&env);
|
|
25
|
+
|
|
26
|
+
let _cfg: (Option<TtlConfig>, Option<TtlConfig>) = Self::ttl_configs(&env);
|
|
27
|
+
let _frozen: bool = Self::is_ttl_configs_frozen(&env);
|
|
28
|
+
|
|
29
|
+
// Type-check setters/signatures.
|
|
30
|
+
let none: Option<TtlConfig> = None;
|
|
31
|
+
Self::set_ttl_configs(&env, &none, &none);
|
|
32
|
+
Self::freeze_ttl_configs(&env);
|
|
33
|
+
|
|
34
|
+
// From ttl_extendable
|
|
35
|
+
Self::extend_instance_ttl(&env, 1, 2);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// `only_auth` should be usable on lz_contract (it provides an Auth impl).
|
|
39
|
+
#[common_macros::only_auth]
|
|
40
|
+
pub fn protected(env: Env) {
|
|
41
|
+
let _ = env;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
fn main() {}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// UI (trybuild) test: `#[lz_contract(multisig)]` wrapper option compiles.
|
|
2
|
+
//
|
|
3
|
+
// Purpose:
|
|
4
|
+
// - Ensures the `multisig` option switches auth from ownable -> multisig.
|
|
5
|
+
|
|
6
|
+
use soroban_sdk::{contractimpl, BytesN, Env};
|
|
7
|
+
use utils::ttl_configurable::TtlConfig;
|
|
8
|
+
|
|
9
|
+
#[common_macros::lz_contract(multisig)]
|
|
10
|
+
pub struct MyContract;
|
|
11
|
+
|
|
12
|
+
#[contractimpl]
|
|
13
|
+
impl MyContract {
|
|
14
|
+
pub fn smoke(env: Env) {
|
|
15
|
+
// Auth impl exists (provided by ownable/multisig, here: multisig).
|
|
16
|
+
let _authorizer = <Self as utils::auth::Auth>::authorizer(&env);
|
|
17
|
+
|
|
18
|
+
// MultiSig trait impl exists and is callable.
|
|
19
|
+
let _threshold: u32 = <Self as utils::multisig::MultiSig>::threshold(&env);
|
|
20
|
+
let signer = BytesN::<20>::from_array(&env, &[1u8; 20]);
|
|
21
|
+
let _is_signer: bool = <Self as utils::multisig::MultiSig>::is_signer(&env, &signer);
|
|
22
|
+
|
|
23
|
+
let _cfg: (Option<TtlConfig>, Option<TtlConfig>) = Self::ttl_configs(&env);
|
|
24
|
+
Self::extend_instance_ttl(&env, 1, 2);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// `only_auth` should be usable on multisig lz_contract (it provides an Auth impl).
|
|
28
|
+
#[common_macros::only_auth]
|
|
29
|
+
pub fn protected(env: Env) {
|
|
30
|
+
let _ = env;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
fn main() {}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// UI (trybuild) test: `#[lz_contract(multisig, upgradeable)]` wrapper options compile.
|
|
2
|
+
//
|
|
3
|
+
// Purpose:
|
|
4
|
+
// - Ensures options can be combined and still produce a contract with upgrade entrypoints.
|
|
5
|
+
|
|
6
|
+
use soroban_sdk::{contractimpl, Bytes, BytesN, Env};
|
|
7
|
+
use utils::upgradeable::UpgradeableInternal;
|
|
8
|
+
|
|
9
|
+
#[common_macros::lz_contract(multisig, upgradeable)]
|
|
10
|
+
pub struct MyContract;
|
|
11
|
+
|
|
12
|
+
impl UpgradeableInternal for MyContract {
|
|
13
|
+
type MigrationData = ();
|
|
14
|
+
|
|
15
|
+
fn __migrate(env: &Env, _migration_data: &Self::MigrationData) {
|
|
16
|
+
env.storage().instance().set(&soroban_sdk::Symbol::new(env, "migrated"), &true);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
#[contractimpl]
|
|
21
|
+
impl MyContract {
|
|
22
|
+
pub fn smoke(env: Env) {
|
|
23
|
+
let hash = BytesN::<32>::from_array(&env, &[0u8; 32]);
|
|
24
|
+
let migration_data = Bytes::new(&env);
|
|
25
|
+
Self::upgrade(&env, &hash);
|
|
26
|
+
Self::migrate(&env, &migration_data);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
fn main() {}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// UI (trybuild) test: `#[lz_contract(upgradeable)]` wrapper option compiles.
|
|
2
|
+
//
|
|
3
|
+
// Purpose:
|
|
4
|
+
// - Ensures the `upgradeable` option adds `#[upgradeable]` and the generated entrypoints type-check.
|
|
5
|
+
|
|
6
|
+
use soroban_sdk::{contractimpl, Address, Bytes, BytesN, Env};
|
|
7
|
+
use utils::ttl_configurable::TtlConfig;
|
|
8
|
+
use utils::upgradeable::UpgradeableInternal;
|
|
9
|
+
|
|
10
|
+
#[common_macros::lz_contract(upgradeable)]
|
|
11
|
+
pub struct MyContract;
|
|
12
|
+
|
|
13
|
+
impl UpgradeableInternal for MyContract {
|
|
14
|
+
type MigrationData = ();
|
|
15
|
+
|
|
16
|
+
fn __migrate(env: &Env, _migration_data: &Self::MigrationData) {
|
|
17
|
+
env.storage().instance().set(&soroban_sdk::Symbol::new(env, "migrated"), &true);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
#[contractimpl]
|
|
22
|
+
impl MyContract {
|
|
23
|
+
pub fn init(env: Env, owner: Address) {
|
|
24
|
+
Self::init_owner(&env, &owner);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
pub fn smoke(env: Env) {
|
|
28
|
+
// Wrapper always includes ttl_configurable + ttl_extendable.
|
|
29
|
+
let _cfg: (Option<TtlConfig>, Option<TtlConfig>) = Self::ttl_configs(&env);
|
|
30
|
+
Self::extend_instance_ttl(&env, 1, 2);
|
|
31
|
+
|
|
32
|
+
let hash = BytesN::<32>::from_array(&env, &[0u8; 32]);
|
|
33
|
+
let migration_data = Bytes::new(&env);
|
|
34
|
+
Self::upgrade(&env, &hash);
|
|
35
|
+
Self::migrate(&env, &migration_data);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
fn main() {}
|
package/contracts/macro-integration-tests/tests/ui/lz_contract/pass/upgradeable_no_migration.rs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// UI (trybuild) test: `#[lz_contract(upgradeable(no_migration))]` wrapper option compiles.
|
|
2
|
+
//
|
|
3
|
+
// Purpose:
|
|
4
|
+
// - Ensures `upgradeable(no_migration)` is accepted through the wrapper.
|
|
5
|
+
// - Ensures the auto-generated no-op `UpgradeableInternal` impl exists downstream.
|
|
6
|
+
// - Ensures upgrade entrypoints type-check.
|
|
7
|
+
|
|
8
|
+
use soroban_sdk::{contractimpl, Address, Bytes, BytesN, Env};
|
|
9
|
+
|
|
10
|
+
#[common_macros::lz_contract(upgradeable(no_migration))]
|
|
11
|
+
pub struct MyContract;
|
|
12
|
+
|
|
13
|
+
#[contractimpl]
|
|
14
|
+
impl MyContract {
|
|
15
|
+
pub fn init(env: Env, owner: Address) {
|
|
16
|
+
Self::init_owner(&env, &owner);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
pub fn smoke(env: Env) {
|
|
20
|
+
let hash = BytesN::<32>::from_array(&env, &[0u8; 32]);
|
|
21
|
+
let migration_data = Bytes::new(&env);
|
|
22
|
+
Self::upgrade(&env, &hash);
|
|
23
|
+
Self::migrate(&env, &migration_data);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
fn main() {}
|
|
28
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// UI (trybuild) negative test: `#[multisig]` should NOT expose ownable initializer APIs.
|
|
2
|
+
//
|
|
3
|
+
// Purpose:
|
|
4
|
+
// - Ensures multisig contracts are self-owning and do not implement OwnableInitializer.
|
|
5
|
+
|
|
6
|
+
use soroban_sdk::{contract, contractimpl, Address, Env};
|
|
7
|
+
|
|
8
|
+
#[contract]
|
|
9
|
+
#[common_macros::multisig]
|
|
10
|
+
pub struct MyContract;
|
|
11
|
+
|
|
12
|
+
#[contractimpl]
|
|
13
|
+
impl MyContract {
|
|
14
|
+
pub fn should_not_compile(env: Env, owner: Address) {
|
|
15
|
+
// This should fail to compile because OwnableInitializer is not implemented.
|
|
16
|
+
Self::init_owner(&env, &owner);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
fn main() {}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
error[E0599]: no function or associated item named `init_owner` found for struct `MyContract` in the current scope
|
|
2
|
+
--> tests/ui/multisig/fail/rejects_ownable_api.rs:16:15
|
|
3
|
+
|
|
|
4
|
+
10 | pub struct MyContract;
|
|
5
|
+
| --------------------- function or associated item `init_owner` not found for this struct
|
|
6
|
+
...
|
|
7
|
+
16 | Self::init_owner(&env, &owner);
|
|
8
|
+
| ^^^^^^^^^^ function or associated item not found in `MyContract`
|
|
9
|
+
|
|
|
10
|
+
= help: items from traits can only be used if the trait is implemented and in scope
|
|
11
|
+
= note: the following trait defines an item `init_owner`, perhaps you need to implement it:
|
|
12
|
+
candidate #1: `OwnableInitializer`
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// UI (trybuild) negative test: `#[multisig]` should NOT implement the `Ownable` trait.
|
|
2
|
+
//
|
|
3
|
+
// Purpose:
|
|
4
|
+
// - MultiSig uses a self-owning authorization pattern (Auth::authorizer = contract address).
|
|
5
|
+
// - It should not expose `utils::ownable::Ownable` APIs like `owner()`.
|
|
6
|
+
|
|
7
|
+
use soroban_sdk::{contract, contractimpl, Env};
|
|
8
|
+
|
|
9
|
+
#[contract]
|
|
10
|
+
#[common_macros::multisig]
|
|
11
|
+
pub struct MyContract;
|
|
12
|
+
|
|
13
|
+
#[contractimpl]
|
|
14
|
+
impl MyContract {
|
|
15
|
+
pub fn should_not_compile(env: Env) {
|
|
16
|
+
let _ = <Self as utils::ownable::Ownable>::owner(&env);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
fn main() {}
|