@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,32 @@
|
|
|
1
|
+
// UI (trybuild) test: `#[ttl_configurable]` compiles with `#[ownable]` auth (no ttl_extendable).
|
|
2
|
+
//
|
|
3
|
+
// Purpose:
|
|
4
|
+
// - Mirrors the multisig pass case, ensuring ttl_configurable works in the ownable pattern too.
|
|
5
|
+
// - Type-checks the generated `TtlConfigurable` methods are callable without relying on other macros.
|
|
6
|
+
|
|
7
|
+
use common_macros::{ownable, ttl_configurable};
|
|
8
|
+
use soroban_sdk::{contract, contractimpl, Address, Env};
|
|
9
|
+
use utils::ttl_configurable::TtlConfig;
|
|
10
|
+
|
|
11
|
+
#[contract]
|
|
12
|
+
#[ttl_configurable]
|
|
13
|
+
#[ownable]
|
|
14
|
+
pub struct MyContract;
|
|
15
|
+
|
|
16
|
+
#[contractimpl]
|
|
17
|
+
impl MyContract {
|
|
18
|
+
pub fn init(env: Env, owner: Address) {
|
|
19
|
+
Self::init_owner(&env, &owner);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
pub fn smoke(env: Env) {
|
|
23
|
+
let _cfg: (Option<TtlConfig>, Option<TtlConfig>) = Self::ttl_configs(&env);
|
|
24
|
+
let _frozen: bool = Self::is_ttl_configs_frozen(&env);
|
|
25
|
+
|
|
26
|
+
let none: Option<TtlConfig> = None;
|
|
27
|
+
Self::set_ttl_configs(&env, &none, &none);
|
|
28
|
+
Self::freeze_ttl_configs(&env);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
fn main() {}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// UI (trybuild) test: `#[ttl_extendable]` on a contract struct compiles.
|
|
2
|
+
//
|
|
3
|
+
// Purpose:
|
|
4
|
+
// - Ensures `#[common_macros::ttl_extendable]` can be applied to a contract struct in a downstream crate.
|
|
5
|
+
// - Validates the macro-generated `TtlExtendable` contract entry exists and is callable.
|
|
6
|
+
//
|
|
7
|
+
// Note: renamed from `minimal_contract.rs` to `basic.rs` for consistency.
|
|
8
|
+
|
|
9
|
+
use common_macros::ttl_extendable;
|
|
10
|
+
use soroban_sdk::{contract, contractimpl, Env};
|
|
11
|
+
|
|
12
|
+
#[contract]
|
|
13
|
+
#[ttl_extendable]
|
|
14
|
+
pub struct MyContract;
|
|
15
|
+
|
|
16
|
+
#[contractimpl]
|
|
17
|
+
impl MyContract {
|
|
18
|
+
pub fn smoke(env: Env) {
|
|
19
|
+
Self::extend_instance_ttl(&env, 1, 2);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
fn main() {}
|
package/contracts/macro-integration-tests/tests/ui/ttl_extendable/pass/no_user_contractimpl.rs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// UI (trybuild) test: `#[ttl_extendable]` works without a user `#[contractimpl]` block.
|
|
2
|
+
//
|
|
3
|
+
// Purpose:
|
|
4
|
+
// - Ensures the macro-generated `#[contractimpl(contracttrait)] impl TtlExtendable for Contract`
|
|
5
|
+
// is sufficient to provide the `extend_instance_ttl` entrypoint.
|
|
6
|
+
// - Covers the common pattern where a contract wants only the TTL extension entrypoint.
|
|
7
|
+
|
|
8
|
+
use common_macros::ttl_extendable;
|
|
9
|
+
use soroban_sdk::{contract, Env};
|
|
10
|
+
|
|
11
|
+
#[contract]
|
|
12
|
+
#[ttl_extendable]
|
|
13
|
+
pub struct MyContract;
|
|
14
|
+
|
|
15
|
+
#[allow(dead_code)]
|
|
16
|
+
fn typecheck(env: &Env) {
|
|
17
|
+
MyContract::extend_instance_ttl(env, 1, 2);
|
|
18
|
+
<MyContract as utils::ttl_extendable::TtlExtendable>::extend_instance_ttl(env, 1, 2);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
fn main() {}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
error: custom attribute panicked
|
|
2
|
+
--> tests/ui/upgradeable/fail/attr_args.rs:7:1
|
|
3
|
+
|
|
|
4
|
+
7 | #[common_macros::upgradeable(not_migration)]
|
|
5
|
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
6
|
+
|
|
|
7
|
+
= help: message: failed to parse upgradeable config: expected `no_migration`
|
|
8
|
+
|
|
9
|
+
error[E0433]: failed to resolve: could not find `MyContract` in the crate root
|
|
10
|
+
--> tests/ui/upgradeable/fail/attr_args.rs:6:1
|
|
11
|
+
|
|
|
12
|
+
6 | #[common_macros::ownable]
|
|
13
|
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ could not find `MyContract` in the crate root
|
|
14
|
+
|
|
|
15
|
+
= note: this error originates in the attribute macro `soroban_sdk::contractimpl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
16
|
+
|
|
17
|
+
error[E0412]: cannot find type `MyContract` in this scope
|
|
18
|
+
--> tests/ui/upgradeable/fail/attr_args.rs:8:12
|
|
19
|
+
|
|
|
20
|
+
8 | pub struct MyContract;
|
|
21
|
+
| ^^^^^^^^^^ not found in this scope
|
|
22
|
+
|
|
23
|
+
error[E0412]: cannot find type `MyContract` in this scope
|
|
24
|
+
--> tests/ui/upgradeable/fail/attr_args.rs:6:1
|
|
25
|
+
|
|
|
26
|
+
6 | #[common_macros::ownable]
|
|
27
|
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
|
|
28
|
+
|
|
|
29
|
+
= note: this error originates in the attribute macro `soroban_sdk::contractimpl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// UI (trybuild) negative test: `#[upgradeable]` requires `Self: utils::auth::Auth`.
|
|
2
|
+
//
|
|
3
|
+
// Purpose:
|
|
4
|
+
// - Ensures a contract using `#[upgradeable]` must also implement `Auth`
|
|
5
|
+
// (e.g. via `#[ownable]` or `#[multisig]`).
|
|
6
|
+
|
|
7
|
+
use soroban_sdk::{contract, Env};
|
|
8
|
+
use utils::upgradeable::UpgradeableInternal;
|
|
9
|
+
|
|
10
|
+
#[contract]
|
|
11
|
+
#[common_macros::upgradeable]
|
|
12
|
+
pub struct MyContract;
|
|
13
|
+
|
|
14
|
+
impl UpgradeableInternal for MyContract {
|
|
15
|
+
type MigrationData = ();
|
|
16
|
+
|
|
17
|
+
fn __migrate(_env: &Env, _migration_data: &Self::MigrationData) {}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
fn main() {}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
error[E0277]: the trait bound `MyContract: utils::auth::Auth` is not satisfied
|
|
2
|
+
--> tests/ui/upgradeable/fail/missing_auth_trait.rs:12:12
|
|
3
|
+
|
|
|
4
|
+
12 | pub struct MyContract;
|
|
5
|
+
| ^^^^^^^^^^ the trait `utils::auth::Auth` is not implemented for `MyContract`
|
|
6
|
+
|
|
|
7
|
+
note: required by a bound in `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: utils::auth::Auth` is not satisfied
|
|
14
|
+
--> tests/ui/upgradeable/fail/missing_auth_trait.rs:12:12
|
|
15
|
+
|
|
|
16
|
+
12 | pub struct MyContract;
|
|
17
|
+
| ^^^^^^^^^^ the trait `utils::auth::Auth` is not implemented for `MyContract`
|
|
18
|
+
|
|
|
19
|
+
note: required by a bound in `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: utils::auth::Auth` is not satisfied
|
|
29
|
+
--> tests/ui/upgradeable/fail/missing_auth_trait.rs:12:12
|
|
30
|
+
|
|
|
31
|
+
12 | pub struct MyContract;
|
|
32
|
+
| ^^^^^^^^^^ the trait `utils::auth::Auth` is not implemented for `MyContract`
|
|
33
|
+
|
|
|
34
|
+
note: required by a bound in `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: utils::auth::Auth` is not satisfied
|
|
44
|
+
--> tests/ui/upgradeable/fail/missing_auth_trait.rs:12:12
|
|
45
|
+
|
|
|
46
|
+
12 | pub struct MyContract;
|
|
47
|
+
| ^^^^^^^^^^ the trait `utils::auth::Auth` is not implemented for `MyContract`
|
|
48
|
+
|
|
|
49
|
+
note: required by a bound in `freeze`
|
|
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: utils::auth::Auth` is not satisfied
|
|
59
|
+
--> tests/ui/upgradeable/fail/missing_auth_trait.rs:12:12
|
|
60
|
+
|
|
|
61
|
+
12 | pub struct MyContract;
|
|
62
|
+
| ^^^^^^^^^^ the trait `utils::auth::Auth` is not implemented for `MyContract`
|
|
63
|
+
|
|
|
64
|
+
note: required by a bound in `is_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
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
warning: unused import: `Address`
|
|
2
|
+
--> tests/ui/upgradeable/fail/missing_upgradeable_internal.rs:3:29
|
|
3
|
+
|
|
|
4
|
+
3 | use soroban_sdk::{contract, Address};
|
|
5
|
+
| ^^^^^^^
|
|
6
|
+
|
|
|
7
|
+
= note: `#[warn(unused_imports)]` on by default
|
|
8
|
+
|
|
9
|
+
error[E0277]: the trait bound `MyContract: UpgradeableInternal` is not satisfied
|
|
10
|
+
--> tests/ui/upgradeable/fail/missing_upgradeable_internal.rs:8:12
|
|
11
|
+
|
|
|
12
|
+
8 | pub struct MyContract;
|
|
13
|
+
| ^^^^^^^^^^ the trait `UpgradeableInternal` is not implemented for `MyContract`
|
|
14
|
+
|
|
|
15
|
+
note: required by a bound in `Upgradeable`
|
|
16
|
+
--> $WORKSPACE/contracts/utils/src/upgradeable.rs
|
|
17
|
+
|
|
|
18
|
+
| pub trait Upgradeable: UpgradeableInternal + Auth {
|
|
19
|
+
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `Upgradeable`
|
|
20
|
+
|
|
21
|
+
error[E0277]: the trait bound `MyContract: UpgradeableInternal` is not satisfied
|
|
22
|
+
--> tests/ui/upgradeable/fail/missing_upgradeable_internal.rs:8:12
|
|
23
|
+
|
|
|
24
|
+
8 | pub struct MyContract;
|
|
25
|
+
| ^^^^^^^^^^ the trait `UpgradeableInternal` is not implemented for `MyContract`
|
|
26
|
+
|
|
|
27
|
+
note: required by a bound in `upgrade`
|
|
28
|
+
--> $WORKSPACE/contracts/utils/src/upgradeable.rs
|
|
29
|
+
|
|
|
30
|
+
| pub trait Upgradeable: UpgradeableInternal + Auth {
|
|
31
|
+
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `Upgradeable::upgrade`
|
|
32
|
+
...
|
|
33
|
+
| fn upgrade(env: &soroban_sdk::Env, new_wasm_hash: &soroban_sdk::BytesN<32>) {
|
|
34
|
+
| ------- required by a bound in this associated function
|
|
35
|
+
|
|
36
|
+
error[E0277]: the trait bound `MyContract: UpgradeableInternal` is not satisfied
|
|
37
|
+
--> tests/ui/upgradeable/fail/missing_upgradeable_internal.rs:8:12
|
|
38
|
+
|
|
|
39
|
+
8 | pub struct MyContract;
|
|
40
|
+
| ^^^^^^^^^^ the trait `UpgradeableInternal` is not implemented for `MyContract`
|
|
41
|
+
|
|
|
42
|
+
note: required by a bound in `migrate`
|
|
43
|
+
--> $WORKSPACE/contracts/utils/src/upgradeable.rs
|
|
44
|
+
|
|
|
45
|
+
| pub trait Upgradeable: UpgradeableInternal + Auth {
|
|
46
|
+
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `Upgradeable::migrate`
|
|
47
|
+
...
|
|
48
|
+
| fn migrate(env: &soroban_sdk::Env, migration_data: &soroban_sdk::Bytes) {
|
|
49
|
+
| ------- required by a bound in this associated function
|
|
50
|
+
|
|
51
|
+
error[E0277]: the trait bound `MyContract: UpgradeableInternal` is not satisfied
|
|
52
|
+
--> tests/ui/upgradeable/fail/missing_upgradeable_internal.rs:8:12
|
|
53
|
+
|
|
|
54
|
+
8 | pub struct MyContract;
|
|
55
|
+
| ^^^^^^^^^^ the trait `UpgradeableInternal` is not implemented for `MyContract`
|
|
56
|
+
|
|
|
57
|
+
note: required by a bound in `freeze`
|
|
58
|
+
--> $WORKSPACE/contracts/utils/src/upgradeable.rs
|
|
59
|
+
|
|
|
60
|
+
| pub trait Upgradeable: UpgradeableInternal + Auth {
|
|
61
|
+
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `Upgradeable::freeze`
|
|
62
|
+
...
|
|
63
|
+
| fn freeze(env: &soroban_sdk::Env) {
|
|
64
|
+
| ------ required by a bound in this associated function
|
|
65
|
+
|
|
66
|
+
error[E0277]: the trait bound `MyContract: UpgradeableInternal` is not satisfied
|
|
67
|
+
--> tests/ui/upgradeable/fail/missing_upgradeable_internal.rs:8:12
|
|
68
|
+
|
|
|
69
|
+
8 | pub struct MyContract;
|
|
70
|
+
| ^^^^^^^^^^ the trait `UpgradeableInternal` is not implemented for `MyContract`
|
|
71
|
+
|
|
|
72
|
+
note: required by a bound in `is_frozen`
|
|
73
|
+
--> $WORKSPACE/contracts/utils/src/upgradeable.rs
|
|
74
|
+
|
|
|
75
|
+
| pub trait Upgradeable: UpgradeableInternal + Auth {
|
|
76
|
+
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `Upgradeable::is_frozen`
|
|
77
|
+
...
|
|
78
|
+
| fn is_frozen(env: &soroban_sdk::Env) -> bool {
|
|
79
|
+
| --------- required by a bound in this associated function
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// UI (trybuild) test: minimal upgradeable usage compiles.
|
|
2
|
+
//
|
|
3
|
+
// Purpose:
|
|
4
|
+
// - Verifies `#[common_macros::upgradeable]` can be applied on a contract struct.
|
|
5
|
+
// - Verifies the contract is required to implement `UpgradeableInternal`.
|
|
6
|
+
// - Verifies macro-generated `Upgradeable` entrypoints exist and are type-checkable.
|
|
7
|
+
//
|
|
8
|
+
// Note: renamed from `minimal_contract.rs` to `basic.rs` for consistency.
|
|
9
|
+
|
|
10
|
+
use soroban_sdk::{contract, contractimpl, Address, Bytes, BytesN, Env};
|
|
11
|
+
use utils::upgradeable::UpgradeableInternal;
|
|
12
|
+
|
|
13
|
+
#[contract]
|
|
14
|
+
#[common_macros::ownable]
|
|
15
|
+
#[common_macros::upgradeable]
|
|
16
|
+
pub struct MyContract;
|
|
17
|
+
|
|
18
|
+
impl UpgradeableInternal for MyContract {
|
|
19
|
+
type MigrationData = ();
|
|
20
|
+
|
|
21
|
+
fn __migrate(env: &Env, _migration_data: &Self::MigrationData) {
|
|
22
|
+
env.storage().instance().set(&soroban_sdk::Symbol::new(env, "migrated"), &true);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
#[contractimpl]
|
|
27
|
+
impl MyContract {
|
|
28
|
+
pub fn init(env: Env, owner: Address) {
|
|
29
|
+
Self::init_owner(&env, &owner);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
pub fn smoke(env: Env) {
|
|
33
|
+
let hash = BytesN::<32>::from_array(&env, &[0u8; 32]);
|
|
34
|
+
let migration_data = Bytes::new(&env);
|
|
35
|
+
// Type-check generated entrypoints.
|
|
36
|
+
Self::upgrade(&env, &hash);
|
|
37
|
+
Self::migrate(&env, &migration_data);
|
|
38
|
+
Self::freeze(&env);
|
|
39
|
+
let _frozen: bool = Self::is_frozen(&env);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
fn main() {}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// UI (trybuild) test: upgradeable usage compiles with multisig auth.
|
|
2
|
+
//
|
|
3
|
+
// Purpose:
|
|
4
|
+
// - Ensures `#[common_macros::upgradeable]` works when the contract uses `#[multisig]`.
|
|
5
|
+
// - Verifies macro-generated `Upgradeable` entrypoints exist and are callable.
|
|
6
|
+
|
|
7
|
+
use soroban_sdk::{contract, contractimpl, Bytes, BytesN, Env};
|
|
8
|
+
use utils::upgradeable::UpgradeableInternal;
|
|
9
|
+
|
|
10
|
+
#[contract]
|
|
11
|
+
#[common_macros::multisig]
|
|
12
|
+
#[common_macros::upgradeable]
|
|
13
|
+
pub struct MyContract;
|
|
14
|
+
|
|
15
|
+
impl UpgradeableInternal for MyContract {
|
|
16
|
+
type MigrationData = ();
|
|
17
|
+
|
|
18
|
+
fn __migrate(env: &Env, _migration_data: &Self::MigrationData) {
|
|
19
|
+
env.storage().instance().set(&soroban_sdk::Symbol::new(env, "migrated"), &true);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
#[contractimpl]
|
|
24
|
+
impl MyContract {
|
|
25
|
+
pub fn smoke(env: Env) {
|
|
26
|
+
let hash = BytesN::<32>::from_array(&env, &[0u8; 32]);
|
|
27
|
+
let migration_data = Bytes::new(&env);
|
|
28
|
+
Self::upgrade(&env, &hash);
|
|
29
|
+
Self::migrate(&env, &migration_data);
|
|
30
|
+
Self::freeze(&env);
|
|
31
|
+
let _frozen: bool = Self::is_frozen(&env);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
fn main() {}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// UI (trybuild) test: `#[upgradeable(no_migration)]` compiles without manual UpgradeableInternal.
|
|
2
|
+
//
|
|
3
|
+
// Purpose:
|
|
4
|
+
// - Ensures the macro-generated no-op `UpgradeableInternal` impl exists downstream.
|
|
5
|
+
// - Ensures `Upgradeable` entrypoints are type-checkable.
|
|
6
|
+
|
|
7
|
+
use soroban_sdk::{contract, contractimpl, Address, Bytes, BytesN, Env};
|
|
8
|
+
|
|
9
|
+
#[contract]
|
|
10
|
+
#[common_macros::ownable]
|
|
11
|
+
#[common_macros::upgradeable(no_migration)]
|
|
12
|
+
pub struct MyContract;
|
|
13
|
+
|
|
14
|
+
#[contractimpl]
|
|
15
|
+
impl MyContract {
|
|
16
|
+
pub fn init(env: Env, owner: Address) {
|
|
17
|
+
Self::init_owner(&env, &owner);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
pub fn smoke(env: Env) {
|
|
21
|
+
let hash = BytesN::<32>::from_array(&env, &[0u8; 32]);
|
|
22
|
+
let migration_data = Bytes::new(&env);
|
|
23
|
+
Self::upgrade(&env, &hash);
|
|
24
|
+
Self::migrate(&env, &migration_data);
|
|
25
|
+
Self::freeze(&env);
|
|
26
|
+
let _frozen: bool = Self::is_frozen(&env);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
fn main() {}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// UI (trybuild) test: `#[upgradeable]` works without a user `#[contractimpl]` block.
|
|
2
|
+
//
|
|
3
|
+
// Purpose:
|
|
4
|
+
// - Ensures the macro-generated `impl utils::upgradeable::Upgradeable for Contract` is enough to
|
|
5
|
+
// provide the upgrade/migrate/freeze entrypoints.
|
|
6
|
+
// - Covers the common pattern where the contract does not define any custom entrypoints.
|
|
7
|
+
|
|
8
|
+
use soroban_sdk::{contract, Address, Bytes, BytesN, Env};
|
|
9
|
+
|
|
10
|
+
#[contract]
|
|
11
|
+
#[common_macros::ownable]
|
|
12
|
+
#[common_macros::upgradeable(no_migration)]
|
|
13
|
+
pub struct MyContract;
|
|
14
|
+
|
|
15
|
+
#[allow(dead_code)]
|
|
16
|
+
fn typecheck(env: &Env, owner: &Address) {
|
|
17
|
+
// Ownable initializer helper exists (not necessarily an entrypoint).
|
|
18
|
+
MyContract::init_owner(env, owner);
|
|
19
|
+
|
|
20
|
+
// Upgradeable entrypoints exist (generated by the macro).
|
|
21
|
+
let hash = BytesN::<32>::from_array(env, &[0u8; 32]);
|
|
22
|
+
let migration_data = Bytes::new(env);
|
|
23
|
+
MyContract::upgrade(env, &hash);
|
|
24
|
+
MyContract::migrate(env, &migration_data);
|
|
25
|
+
MyContract::freeze(env);
|
|
26
|
+
let _frozen: bool = MyContract::is_frozen(env);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
fn main() {}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#[test]
|
|
2
|
+
fn ui_contract_impl() {
|
|
3
|
+
// Important: set this before trybuild::TestCases::new() so each shard has
|
|
4
|
+
// its own trybuild project directory + lock + artifacts.
|
|
5
|
+
let target_dir =
|
|
6
|
+
std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("target/trybuild-shards/ui_contract_impl");
|
|
7
|
+
std::env::set_var("CARGO_TARGET_DIR", target_dir.as_os_str());
|
|
8
|
+
|
|
9
|
+
let t = trybuild::TestCases::new();
|
|
10
|
+
t.pass("tests/ui/contract_impl/**/pass/*.rs");
|
|
11
|
+
t.compile_fail("tests/ui/contract_impl/**/fail/*.rs");
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#[test]
|
|
2
|
+
fn ui_contract_trait() {
|
|
3
|
+
// Important: set this before trybuild::TestCases::new() so each shard has
|
|
4
|
+
// its own trybuild project directory + lock + artifacts.
|
|
5
|
+
let target_dir =
|
|
6
|
+
std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("target/trybuild-shards/ui_contract_trait");
|
|
7
|
+
std::env::set_var("CARGO_TARGET_DIR", target_dir.as_os_str());
|
|
8
|
+
|
|
9
|
+
let t = trybuild::TestCases::new();
|
|
10
|
+
t.pass("tests/ui/contract_trait/**/pass/*.rs");
|
|
11
|
+
t.compile_fail("tests/ui/contract_trait/**/fail/*.rs");
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#[test]
|
|
2
|
+
fn ui_lz_contract() {
|
|
3
|
+
// Important: set this before trybuild::TestCases::new() so each shard has
|
|
4
|
+
// its own trybuild project directory + lock + artifacts.
|
|
5
|
+
let target_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("target/trybuild-shards/ui_lz_contract");
|
|
6
|
+
std::env::set_var("CARGO_TARGET_DIR", target_dir.as_os_str());
|
|
7
|
+
|
|
8
|
+
let t = trybuild::TestCases::new();
|
|
9
|
+
t.pass("tests/ui/lz_contract/**/pass/*.rs");
|
|
10
|
+
t.compile_fail("tests/ui/lz_contract/**/fail/*.rs");
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#[test]
|
|
2
|
+
fn ui_multisig() {
|
|
3
|
+
// Important: set this before trybuild::TestCases::new() so each shard has
|
|
4
|
+
// its own trybuild project directory + lock + artifacts.
|
|
5
|
+
let target_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("target/trybuild-shards/ui_multisig");
|
|
6
|
+
std::env::set_var("CARGO_TARGET_DIR", target_dir.as_os_str());
|
|
7
|
+
|
|
8
|
+
let t = trybuild::TestCases::new();
|
|
9
|
+
t.pass("tests/ui/multisig/**/pass/*.rs");
|
|
10
|
+
t.compile_fail("tests/ui/multisig/**/fail/*.rs");
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#[test]
|
|
2
|
+
fn ui_ttl_extendable() {
|
|
3
|
+
// Important: set this before trybuild::TestCases::new() so each shard has
|
|
4
|
+
// its own trybuild project directory + lock + artifacts.
|
|
5
|
+
let target_dir =
|
|
6
|
+
std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("target/trybuild-shards/ui_ttl_extendable");
|
|
7
|
+
std::env::set_var("CARGO_TARGET_DIR", target_dir.as_os_str());
|
|
8
|
+
|
|
9
|
+
let t = trybuild::TestCases::new();
|
|
10
|
+
t.pass("tests/ui/ttl_extendable/**/pass/*.rs");
|
|
11
|
+
t.compile_fail("tests/ui/ttl_extendable/**/fail/*.rs");
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#[test]
|
|
2
|
+
fn ui_upgradeable() {
|
|
3
|
+
// Important: set this before trybuild::TestCases::new() so each shard has
|
|
4
|
+
// its own trybuild project directory + lock + artifacts.
|
|
5
|
+
let target_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("target/trybuild-shards/ui_upgradeable");
|
|
6
|
+
std::env::set_var("CARGO_TARGET_DIR", target_dir.as_os_str());
|
|
7
|
+
|
|
8
|
+
let t = trybuild::TestCases::new();
|
|
9
|
+
t.pass("tests/ui/upgradeable/**/pass/*.rs");
|
|
10
|
+
t.compile_fail("tests/ui/upgradeable/**/fail/*.rs");
|
|
11
|
+
}
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
|
|
13
13
|
#![no_std]
|
|
14
14
|
|
|
15
|
+
#[cfg(test)]
|
|
16
|
+
mod tests;
|
|
17
|
+
|
|
15
18
|
use common_macros::{contract_error, contract_impl};
|
|
16
19
|
use endpoint_v2::{
|
|
17
20
|
FeesAndPacket, IMessageLib, ISendLib, MessageLibType, MessageLibVersion, MessagingFee, OutboundPacket,
|
|
@@ -20,7 +23,7 @@ use endpoint_v2::{
|
|
|
20
23
|
use soroban_sdk::{contract, panic_with_error, Address, Bytes, Env, Vec};
|
|
21
24
|
|
|
22
25
|
#[contract_error]
|
|
23
|
-
enum BlockedMessageLibError {
|
|
26
|
+
pub enum BlockedMessageLibError {
|
|
24
27
|
NotImplemented,
|
|
25
28
|
}
|
|
26
29
|
|