@layerzerolabs/protocol-stellar-v2 0.2.13 → 0.2.18
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 +484 -337
- package/.turbo/turbo-lint.log +126 -56
- package/.turbo/turbo-test.log +1403 -984
- package/Cargo.lock +142 -3
- package/Cargo.toml +5 -1
- package/contracts/ERROR_SPEC.md +44 -0
- package/contracts/common-macros/src/auth.rs +113 -0
- package/contracts/common-macros/src/contract_ttl.rs +84 -0
- package/contracts/common-macros/src/lib.rs +219 -29
- package/contracts/common-macros/src/lz_contract.rs +83 -0
- package/contracts/common-macros/src/storage.rs +1 -1
- package/contracts/common-macros/src/tests/{ownable.rs → auth.rs} +48 -15
- package/contracts/common-macros/src/tests/contract_ttl.rs +662 -0
- package/contracts/common-macros/src/tests/mod.rs +3 -2
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__auth__snapshot_generated_multisig_code.snap +20 -0
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__auth__snapshot_generated_ownable_code.snap +24 -0
- package/contracts/common-macros/src/tests/snapshots/{common_macros__tests__ownable__snapshot_only_owner_preserves_function_signature.snap → common_macros__tests__auth__snapshot_only_auth_preserves_function_signature.snap} +4 -4
- package/contracts/common-macros/src/tests/snapshots/{common_macros__tests__contract_impl__snapshot_generated_contract_impl_code.snap → common_macros__tests__contract_ttl__snapshot_generated_contractimpl_code.snap} +26 -10
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__contract_ttl__snapshot_generated_contracttrait_code.snap +69 -0
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__storage__snapshot_generated_storage_code.snap +48 -48
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__ttl_configurable__snapshot_generated_ttl_configurable_code.snap +7 -41
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__upgradeable__snapshot_generated_upgradeable_code.snap +21 -0
- package/contracts/common-macros/src/tests/upgradeable.rs +31 -0
- package/contracts/common-macros/src/ttl_configurable.rs +21 -66
- package/contracts/common-macros/src/ttl_extendable.rs +36 -0
- package/contracts/common-macros/src/upgradeable.rs +76 -0
- package/contracts/common-macros/src/utils.rs +9 -0
- package/contracts/endpoint-v2/src/constants.rs +4 -4
- package/contracts/endpoint-v2/src/endpoint_v2.rs +58 -36
- package/contracts/endpoint-v2/src/errors.rs +4 -3
- package/contracts/endpoint-v2/src/events.rs +1 -1
- package/contracts/endpoint-v2/src/message_lib_manager.rs +18 -5
- package/contracts/endpoint-v2/src/messaging_channel.rs +11 -1
- package/contracts/endpoint-v2/src/messaging_composer.rs +11 -1
- package/contracts/endpoint-v2/src/storage.rs +1 -1
- package/contracts/endpoint-v2/src/tests/endpoint_setup.rs +175 -8
- package/contracts/endpoint-v2/src/tests/endpoint_v2/build_outbound_packet.rs +76 -0
- package/contracts/endpoint-v2/src/tests/endpoint_v2/clear.rs +342 -159
- package/contracts/endpoint-v2/src/tests/endpoint_v2/delegate.rs +3 -15
- package/contracts/endpoint-v2/src/tests/endpoint_v2/initializable.rs +20 -31
- package/contracts/endpoint-v2/src/tests/endpoint_v2/lz_receive_alert.rs +126 -164
- package/contracts/endpoint-v2/src/tests/endpoint_v2/mod.rs +1 -0
- package/contracts/endpoint-v2/src/tests/endpoint_v2/native_token.rs +0 -1
- package/contracts/endpoint-v2/src/tests/endpoint_v2/owner.rs +0 -1
- package/contracts/endpoint-v2/src/tests/endpoint_v2/pay_messaging_fees.rs +311 -304
- package/contracts/endpoint-v2/src/tests/endpoint_v2/quote.rs +423 -96
- package/contracts/endpoint-v2/src/tests/endpoint_v2/recover_token.rs +1 -1
- package/contracts/endpoint-v2/src/tests/endpoint_v2/require_oapp_auth.rs +47 -20
- package/contracts/endpoint-v2/src/tests/endpoint_v2/send.rs +373 -403
- package/contracts/endpoint-v2/src/tests/endpoint_v2/set_delegate.rs +96 -22
- package/contracts/endpoint-v2/src/tests/endpoint_v2/set_zro.rs +62 -10
- package/contracts/endpoint-v2/src/tests/endpoint_v2/transfer_ownership.rs +4 -4
- package/contracts/endpoint-v2/src/tests/endpoint_v2/ttl_config.rs +8 -11
- package/contracts/endpoint-v2/src/tests/endpoint_v2/verifiable.rs +81 -30
- package/contracts/endpoint-v2/src/tests/endpoint_v2/verify.rs +209 -76
- package/contracts/endpoint-v2/src/tests/endpoint_v2/zro.rs +0 -1
- package/contracts/endpoint-v2/src/tests/message_lib_manager/default_receive_library.rs +24 -0
- package/contracts/endpoint-v2/src/tests/message_lib_manager/default_receive_library_timeout.rs +40 -0
- package/contracts/endpoint-v2/src/tests/message_lib_manager/default_send_library.rs +24 -0
- package/contracts/endpoint-v2/src/tests/message_lib_manager/get_config.rs +108 -0
- package/contracts/endpoint-v2/src/tests/message_lib_manager/get_library_index.rs +52 -0
- package/contracts/endpoint-v2/src/tests/message_lib_manager/get_receive_library.rs +92 -0
- package/contracts/endpoint-v2/src/tests/message_lib_manager/get_registered_libraries.rs +74 -0
- package/contracts/endpoint-v2/src/tests/message_lib_manager/get_send_library.rs +83 -0
- package/contracts/endpoint-v2/src/tests/message_lib_manager/is_registered_library.rs +32 -0
- package/contracts/endpoint-v2/src/tests/message_lib_manager/is_supported_eid.rs +28 -0
- package/contracts/endpoint-v2/src/tests/message_lib_manager/is_valid_receive_library.rs +261 -0
- package/contracts/endpoint-v2/src/tests/message_lib_manager/mod.rs +16 -0
- package/contracts/endpoint-v2/src/tests/message_lib_manager/receive_library_timeout.rs +62 -0
- package/contracts/endpoint-v2/src/tests/message_lib_manager/register_library.rs +65 -43
- package/contracts/endpoint-v2/src/tests/message_lib_manager/registered_libraries_count.rs +42 -0
- package/contracts/endpoint-v2/src/tests/message_lib_manager/require_receive_lib_for_eid.rs +61 -0
- package/contracts/endpoint-v2/src/tests/message_lib_manager/require_registered.rs +4 -6
- package/contracts/endpoint-v2/src/tests/message_lib_manager/require_send_lib_for_eid.rs +59 -0
- package/contracts/endpoint-v2/src/tests/message_lib_manager/require_supported_eid.rs +16 -2
- package/contracts/endpoint-v2/src/tests/message_lib_manager/set_config.rs +155 -51
- package/contracts/endpoint-v2/src/tests/message_lib_manager/set_default_receive_lib_timeout.rs +114 -92
- package/contracts/endpoint-v2/src/tests/message_lib_manager/set_default_receive_library.rs +235 -132
- package/contracts/endpoint-v2/src/tests/message_lib_manager/set_default_send_library.rs +93 -87
- package/contracts/endpoint-v2/src/tests/message_lib_manager/set_receive_library.rs +346 -245
- package/contracts/endpoint-v2/src/tests/message_lib_manager/set_receive_library_timeout.rs +406 -60
- package/contracts/endpoint-v2/src/tests/message_lib_manager/set_send_library.rs +252 -78
- package/contracts/endpoint-v2/src/tests/message_lib_manager/timeout.rs +102 -0
- package/contracts/endpoint-v2/src/tests/messaging_channel/burn.rs +212 -273
- package/contracts/endpoint-v2/src/tests/messaging_channel/clear_payload.rs +203 -0
- package/contracts/endpoint-v2/src/tests/messaging_channel/inbound.rs +94 -0
- package/contracts/endpoint-v2/src/tests/messaging_channel/inbound_nonce.rs +78 -248
- package/contracts/endpoint-v2/src/tests/messaging_channel/inbound_payload_hash.rs +7 -282
- package/contracts/endpoint-v2/src/tests/messaging_channel/lazy_inbound_nonce.rs +6 -274
- package/contracts/endpoint-v2/src/tests/messaging_channel/mod.rs +3 -2
- package/contracts/endpoint-v2/src/tests/messaging_channel/next_guid.rs +86 -178
- package/contracts/endpoint-v2/src/tests/messaging_channel/nilify.rs +328 -212
- package/contracts/endpoint-v2/src/tests/messaging_channel/outbound.rs +68 -0
- package/contracts/endpoint-v2/src/tests/messaging_channel/outbound_nonce.rs +6 -209
- package/contracts/endpoint-v2/src/tests/messaging_channel/skip.rs +207 -159
- package/contracts/endpoint-v2/src/tests/messaging_composer/clear_compose.rs +142 -153
- package/contracts/endpoint-v2/src/tests/messaging_composer/compose_queue.rs +6 -179
- package/contracts/endpoint-v2/src/tests/messaging_composer/lz_compose_alert.rs +163 -221
- package/contracts/endpoint-v2/src/tests/messaging_composer/send_compose.rs +90 -121
- package/contracts/endpoint-v2/src/tests/mock.rs +18 -4
- package/contracts/endpoint-v2/src/tests/util/build_payload.rs +4 -70
- package/contracts/endpoint-v2/src/tests/util/compute_guid.rs +2 -1
- package/contracts/endpoint-v2/src/tests/util/keccak256.rs +17 -106
- package/contracts/layerzero-views/Cargo.toml +35 -0
- package/contracts/layerzero-views/src/errors.rs +10 -0
- package/contracts/layerzero-views/src/layerzero_view.rs +226 -0
- package/contracts/layerzero-views/src/lib.rs +38 -0
- package/contracts/layerzero-views/src/storage.rs +18 -0
- package/contracts/layerzero-views/src/tests/layerzero_view_tests.rs +423 -0
- package/contracts/layerzero-views/src/tests/mod.rs +4 -0
- package/contracts/layerzero-views/src/tests/setup.rs +377 -0
- package/contracts/layerzero-views/src/types.rs +50 -0
- package/contracts/macro-integration-tests/Cargo.toml +30 -0
- package/contracts/macro-integration-tests/src/lib.rs +1 -0
- package/contracts/macro-integration-tests/tests/runtime/ownable/initialization.rs +62 -0
- package/contracts/macro-integration-tests/tests/runtime/ownable/mod.rs +22 -0
- package/contracts/macro-integration-tests/tests/runtime/ownable/only_auth_guard.rs +97 -0
- package/contracts/macro-integration-tests/tests/runtime/ownable/ownership_transfer.rs +101 -0
- package/contracts/macro-integration-tests/tests/runtime/storage/keyed_roundtrip.rs +225 -0
- package/contracts/macro-integration-tests/tests/runtime/storage/mod.rs +4 -0
- package/contracts/macro-integration-tests/tests/runtime/storage/name_override_runtime.rs +52 -0
- package/contracts/macro-integration-tests/tests/runtime/storage/ttl_extension.rs +261 -0
- package/contracts/macro-integration-tests/tests/runtime/storage/unkeyed_roundtrip.rs +137 -0
- package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/configuration.rs +113 -0
- package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/freeze.rs +139 -0
- package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/mod.rs +2 -0
- package/contracts/macro-integration-tests/tests/runtime.rs +5 -0
- package/contracts/macro-integration-tests/tests/ui/error/fail/attr_not_empty.rs +12 -0
- package/contracts/macro-integration-tests/tests/ui/error/fail/attr_not_empty.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/error/fail/decreasing_discriminant.rs +12 -0
- package/contracts/macro-integration-tests/tests/ui/error/fail/decreasing_discriminant.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/error/fail/non_int_discriminant.rs +21 -0
- package/contracts/macro-integration-tests/tests/ui/error/fail/non_int_discriminant.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/error/fail/non_unit_variant.rs +13 -0
- package/contracts/macro-integration-tests/tests/ui/error/fail/non_unit_variant.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/error/pass/attr_on_variant_allowed.rs +20 -0
- package/contracts/macro-integration-tests/tests/ui/error/pass/basic_auto_discriminants.rs +15 -0
- package/contracts/macro-integration-tests/tests/ui/error/pass/mixed_discriminants.rs +16 -0
- package/contracts/macro-integration-tests/tests/ui/ownable/fail/only_auth_missing_env.rs +22 -0
- package/contracts/macro-integration-tests/tests/ui/ownable/fail/only_auth_missing_env.stderr +16 -0
- package/contracts/macro-integration-tests/tests/ui/ownable/pass/minimal_contract.rs +26 -0
- package/contracts/macro-integration-tests/tests/ui/ownable/pass/namespacing_and_imports.rs +21 -0
- package/contracts/macro-integration-tests/tests/ui/ownable/pass/only_auth_env_param_variants.rs +46 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/invalid_storage_type_param.rs +13 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/invalid_storage_type_param.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/missing_storage_type_param.rs +13 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/missing_storage_type_param.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_storage_kinds.rs +10 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_storage_kinds.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_type_params.rs +12 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_type_params.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/no_ttl_extension_on_non_persistent.rs +10 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/no_ttl_extension_on_non_persistent.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/non_enum_input.rs +10 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/non_enum_input.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/storage_attr_rejects_args.rs +12 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/storage_attr_rejects_args.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/tuple_variant_rejected.rs +13 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/tuple_variant_rejected.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/unknown_variant_attr.rs +13 -0
- package/contracts/macro-integration-tests/tests/ui/storage/fail/unknown_variant_attr.stderr +7 -0
- package/contracts/macro-integration-tests/tests/ui/storage/pass/default_value_on_variant.rs +14 -0
- package/contracts/macro-integration-tests/tests/ui/storage/pass/enum_instance_unit_basic.rs +14 -0
- package/contracts/macro-integration-tests/tests/ui/storage/pass/enum_persistent_named_fields_keyed.rs +16 -0
- package/contracts/macro-integration-tests/tests/ui/storage/pass/enum_temporary_unit_option.rs +15 -0
- package/contracts/macro-integration-tests/tests/ui/storage/pass/name_override.rs +14 -0
- package/contracts/macro-integration-tests/tests/ui/storage/pass/no_auto_ttl_extension.rs +19 -0
- package/contracts/macro-integration-tests/tests/ui/storage/pass/ttl_provider_basic.rs +15 -0
- package/contracts/macro-integration-tests/tests/ui/ttl_configurable/pass/minimal_contract.rs +44 -0
- package/contracts/macro-integration-tests/tests/ui_error.rs +11 -0
- package/contracts/macro-integration-tests/tests/ui_ownable.rs +11 -0
- package/contracts/macro-integration-tests/tests/ui_storage.rs +11 -0
- package/contracts/macro-integration-tests/tests/ui_ttl_configurable.rs +12 -0
- package/contracts/message-libs/blocked-message-lib/src/lib.rs +17 -17
- package/contracts/message-libs/message-lib-common/src/errors.rs +7 -2
- package/contracts/message-libs/message-lib-common/src/tests/packet_codec_v1/decode_packet_header.rs +64 -0
- package/contracts/message-libs/message-lib-common/src/tests/packet_codec_v1/encode_packet.rs +58 -0
- package/contracts/message-libs/message-lib-common/src/tests/packet_codec_v1/encode_packet_header.rs +138 -0
- package/contracts/message-libs/message-lib-common/src/tests/packet_codec_v1/mod.rs +6 -0
- package/contracts/message-libs/message-lib-common/src/tests/packet_codec_v1/payload.rs +30 -0
- package/contracts/message-libs/message-lib-common/src/tests/packet_codec_v1/payload_hash.rs +15 -0
- package/contracts/message-libs/message-lib-common/src/tests/packet_codec_v1/test_helper.rs +39 -0
- package/contracts/message-libs/message-lib-common/src/tests/worker_options/append_dvn_option.rs +57 -0
- package/contracts/message-libs/message-lib-common/src/tests/worker_options/append_lz_receive_option.rs +49 -0
- package/contracts/message-libs/message-lib-common/src/tests/worker_options/append_native_drop_option.rs +73 -0
- package/contracts/message-libs/message-lib-common/src/tests/worker_options/convert_legacy_options.rs +280 -0
- package/contracts/message-libs/message-lib-common/src/tests/worker_options/extract_type_3_options.rs +126 -0
- package/contracts/message-libs/message-lib-common/src/tests/worker_options/left_pad_to_bytes32.rs +48 -0
- package/contracts/message-libs/message-lib-common/src/tests/worker_options/mod.rs +7 -0
- package/contracts/message-libs/message-lib-common/src/tests/worker_options/split_worker_options.rs +139 -0
- package/contracts/message-libs/message-lib-common/src/worker_options.rs +31 -1
- package/contracts/message-libs/simple-message-lib/src/simple_message_lib.rs +7 -9
- package/contracts/message-libs/treasury/src/errors.rs +2 -3
- package/contracts/message-libs/treasury/src/events.rs +1 -1
- package/contracts/message-libs/treasury/src/interfaces/zro_fee_lib.rs +2 -2
- package/contracts/message-libs/treasury/src/lib.rs +3 -3
- package/contracts/message-libs/treasury/src/storage.rs +3 -1
- package/contracts/message-libs/treasury/src/tests/treasury_tests.rs +1 -1
- package/contracts/message-libs/treasury/src/treasury.rs +23 -26
- package/contracts/message-libs/uln-302/Cargo.toml +1 -1
- package/contracts/message-libs/uln-302/src/errors.rs +0 -5
- package/contracts/message-libs/uln-302/src/events.rs +5 -6
- package/contracts/message-libs/uln-302/src/receive_uln.rs +37 -56
- package/contracts/message-libs/uln-302/src/send_uln.rs +112 -138
- package/contracts/message-libs/uln-302/src/storage.rs +5 -5
- package/contracts/message-libs/uln-302/src/tests/receive_uln302/effective_receive_uln_config.rs +5 -7
- package/contracts/message-libs/uln-302/src/tests/receive_uln302/set_default_receive_uln_configs.rs +3 -3
- package/contracts/message-libs/uln-302/src/tests/send_uln302/effective_send_uln_config.rs +6 -9
- package/contracts/message-libs/uln-302/src/tests/send_uln302/set_default_executor_configs.rs +2 -2
- package/contracts/message-libs/uln-302/src/tests/send_uln302/set_default_send_uln_configs.rs +3 -3
- package/contracts/message-libs/uln-302/src/tests/setup.rs +9 -0
- package/contracts/message-libs/uln-302/src/tests/testing_utils.rs +5 -0
- package/contracts/message-libs/uln-302/src/tests/uln302/get_app_receive_uln_config.rs +1 -2
- package/contracts/message-libs/uln-302/src/tests/uln302/get_app_send_uln_config.rs +1 -2
- package/contracts/message-libs/uln-302/src/tests/uln302/set_config.rs +37 -55
- package/contracts/message-libs/uln-302/src/uln302.rs +10 -25
- package/contracts/oapps/counter/Cargo.toml +14 -1
- package/contracts/oapps/counter/integration_tests/mod.rs +4 -1
- package/contracts/oapps/counter/integration_tests/setup_sml.rs +169 -0
- package/contracts/oapps/counter/integration_tests/setup_uln.rs +997 -0
- package/contracts/oapps/counter/integration_tests/signing.rs +62 -0
- package/contracts/oapps/counter/integration_tests/test_with_sml.rs +24 -55
- package/contracts/oapps/counter/integration_tests/test_with_uln.rs +314 -0
- package/contracts/oapps/counter/integration_tests/utils.rs +196 -53
- package/contracts/oapps/counter/src/counter.rs +67 -44
- package/contracts/oapps/counter/src/tests/mod.rs +0 -13
- package/contracts/oapps/counter/src/tests/test_counter.rs +5 -7
- package/contracts/oapps/oapp/src/errors.rs +5 -1
- package/contracts/oapps/oapp/src/macro_tests/test_macros.rs +318 -221
- package/contracts/oapps/oapp/src/oapp_core.rs +36 -21
- package/contracts/oapps/oapp/src/oapp_options_type3.rs +48 -12
- package/contracts/oapps/oapp/src/oapp_receiver.rs +106 -41
- package/contracts/oapps/oapp/src/oapp_sender.rs +26 -34
- package/contracts/oapps/oapp/src/tests/test_oapp_core.rs +9 -9
- package/contracts/oapps/oapp/src/tests/test_oapp_options_type3.rs +25 -18
- package/contracts/oapps/oapp/src/tests/test_oapp_receiver.rs +7 -8
- package/contracts/oapps/oapp/src/tests/test_oapp_sender.rs +14 -16
- package/contracts/oapps/oapp-macros/src/generators.rs +128 -0
- package/contracts/oapps/oapp-macros/src/lib.rs +211 -0
- package/contracts/oapps/oft/integration-tests/setup.rs +34 -9
- package/contracts/oapps/oft/integration-tests/utils.rs +1 -1
- package/contracts/oapps/oft/src/errors.rs +6 -1
- package/contracts/oapps/oft/src/extensions/oft_fee.rs +13 -13
- package/contracts/oapps/oft/src/extensions/pausable.rs +5 -5
- package/contracts/oapps/oft/src/extensions/rate_limiter.rs +23 -23
- package/contracts/oapps/oft/src/lib.rs +4 -2
- package/contracts/oapps/oft/src/oft.rs +31 -71
- package/contracts/oapps/oft/src/oft_impl.rs +201 -0
- package/contracts/oapps/oft/src/oft_types/lock_unlock.rs +2 -4
- package/contracts/oapps/oft/src/oft_types/mint_burn.rs +1 -4
- package/contracts/oapps/oft/src/storage.rs +2 -0
- package/contracts/oapps/oft/src/tests/extensions/setup.rs +60 -31
- package/contracts/oapps/oft/src/tests/extensions/test_oft_fee.rs +5 -3
- package/contracts/oapps/oft/src/tests/extensions/test_pausable.rs +5 -3
- package/contracts/oapps/oft/src/tests/extensions/test_rate_limiter.rs +6 -4
- package/contracts/oapps/oft/src/tests/test_decimals.rs +2 -2
- package/contracts/oapps/oft/src/tests/test_oft_msg_codec.rs +1 -2
- package/contracts/oapps/oft/src/tests/test_send.rs +4 -4
- package/contracts/oapps/oft/src/tests/test_utils.rs +122 -81
- package/contracts/oapps/oft/src/types.rs +20 -0
- package/contracts/oapps/oft-std/Cargo.toml +6 -0
- package/contracts/oapps/oft-std/integration-tests/extensions/mod.rs +3 -0
- package/contracts/oapps/oft-std/integration-tests/extensions/test_oft_fee.rs +157 -0
- package/contracts/oapps/oft-std/integration-tests/extensions/test_pausable.rs +162 -0
- package/contracts/oapps/oft-std/integration-tests/extensions/test_rate_limiter.rs +186 -0
- package/contracts/oapps/oft-std/integration-tests/mod.rs +3 -0
- package/contracts/oapps/{counter/integration_tests → oft-std/integration-tests}/setup.rs +76 -30
- package/contracts/oapps/oft-std/integration-tests/utils.rs +427 -0
- package/contracts/oapps/oft-std/src/lib.rs +12 -1
- package/contracts/oapps/oft-std/src/oft.rs +141 -26
- package/contracts/upgrader/Cargo.toml +19 -0
- package/contracts/upgrader/src/lib.rs +96 -0
- package/contracts/upgrader/src/tests/mod.rs +1 -0
- package/contracts/upgrader/src/tests/test_data/test_upgradeable_contract1.wasm +0 -0
- package/contracts/upgrader/src/tests/test_data/test_upgradeable_contract2.wasm +0 -0
- package/contracts/upgrader/src/tests/test_upgrader.rs +120 -0
- package/contracts/utils/src/auth.rs +44 -0
- package/contracts/utils/src/errors.rs +32 -5
- package/contracts/utils/src/lib.rs +5 -1
- package/contracts/utils/src/multisig.rs +211 -0
- package/contracts/utils/src/ownable.rs +50 -60
- package/contracts/utils/src/tests/buffer_reader.rs +6 -6
- package/contracts/utils/src/tests/buffer_writer.rs +6 -6
- package/contracts/utils/src/tests/bytes_ext.rs +2 -4
- package/contracts/utils/src/tests/mod.rs +4 -1
- package/contracts/utils/src/tests/multisig.rs +731 -0
- package/contracts/utils/src/tests/option_ext.rs +18 -0
- package/contracts/utils/src/tests/ownable.rs +22 -70
- package/contracts/utils/src/tests/ttl_configurable.rs +607 -0
- package/contracts/utils/src/tests/upgradeable.rs +290 -0
- package/contracts/utils/src/ttl_configurable.rs +153 -0
- package/contracts/utils/src/ttl_extendable.rs +27 -0
- package/contracts/utils/src/upgradeable.rs +56 -0
- package/contracts/workers/dvn/Cargo.toml +2 -2
- package/contracts/workers/dvn/src/auth.rs +24 -35
- package/contracts/workers/dvn/src/dvn.rs +23 -14
- package/contracts/workers/dvn/src/errors.rs +1 -7
- package/contracts/workers/dvn/src/events.rs +1 -14
- package/contracts/workers/dvn/src/interfaces/dvn.rs +2 -2
- package/contracts/workers/dvn/src/interfaces/mod.rs +0 -2
- package/contracts/workers/dvn/src/storage.rs +3 -13
- package/contracts/workers/dvn/src/tests/auth.rs +4 -4
- package/contracts/workers/dvn/src/tests/dvn.rs +1 -2
- package/contracts/workers/dvn/src/tests/multisig/set_signer.rs +7 -8
- package/contracts/workers/dvn/src/tests/multisig/set_threshold.rs +11 -8
- package/contracts/workers/dvn/src/tests/multisig/verify_signatures.rs +11 -12
- package/contracts/workers/dvn/src/tests/setup.rs +5 -5
- package/contracts/workers/dvn-fee-lib/Cargo.toml +0 -1
- package/contracts/workers/dvn-fee-lib/src/dvn_fee_lib.rs +45 -16
- package/contracts/workers/dvn-fee-lib/src/errors.rs +3 -2
- package/contracts/workers/dvn-fee-lib/src/lib.rs +5 -11
- package/contracts/workers/dvn-fee-lib/src/tests/dvn_fee_lib.rs +30 -16
- package/contracts/workers/executor/src/auth.rs +80 -16
- package/contracts/workers/executor/src/executor.rs +17 -29
- package/contracts/workers/executor/src/storage.rs +2 -9
- package/contracts/workers/executor-fee-lib/Cargo.toml +1 -1
- package/contracts/workers/executor-fee-lib/src/errors.rs +9 -7
- package/contracts/workers/executor-fee-lib/src/executor_fee_lib.rs +153 -121
- package/contracts/workers/executor-helper/Cargo.toml +1 -6
- package/contracts/workers/executor-helper/src/executor_helper.rs +53 -73
- package/contracts/workers/executor-helper/src/lib.rs +1 -7
- package/contracts/workers/price-feed/Cargo.toml +1 -2
- package/contracts/workers/price-feed/src/errors.rs +3 -2
- package/contracts/workers/price-feed/src/lib.rs +5 -6
- package/contracts/workers/price-feed/src/price_feed.rs +42 -23
- package/contracts/workers/worker/Cargo.toml +4 -0
- package/contracts/workers/worker/src/errors.rs +4 -0
- package/contracts/workers/worker/src/interfaces/price_feed.rs +3 -3
- package/contracts/workers/worker/src/lib.rs +2 -2
- package/contracts/workers/worker/src/tests/mod.rs +4 -0
- package/contracts/workers/worker/src/tests/setup.rs +147 -0
- package/contracts/workers/worker/src/tests/worker.rs +502 -0
- package/contracts/workers/worker/src/worker.rs +28 -30
- package/package.json +8 -5
- package/sdk/.turbo/turbo-build.log +1 -0
- package/sdk/.turbo/turbo-test.log +1009 -0
- package/sdk/dist/generated/bml.d.ts +104 -37
- package/sdk/dist/generated/bml.js +83 -42
- package/sdk/dist/generated/counter.d.ts +334 -175
- package/sdk/dist/generated/counter.js +109 -63
- package/sdk/dist/generated/dvn.d.ts +1985 -0
- package/sdk/dist/generated/dvn.js +326 -0
- package/sdk/dist/generated/dvn_fee_lib.d.ts +690 -0
- package/sdk/dist/generated/dvn_fee_lib.js +163 -0
- package/sdk/dist/generated/endpoint.d.ts +155 -46
- package/sdk/dist/generated/endpoint.js +93 -50
- package/sdk/dist/generated/executor.d.ts +1841 -0
- package/sdk/dist/generated/executor.js +312 -0
- package/sdk/dist/generated/executor_fee_lib.d.ts +1083 -0
- package/sdk/dist/generated/executor_fee_lib.js +255 -0
- package/sdk/dist/generated/executor_helper.d.ts +981 -0
- package/sdk/dist/generated/executor_helper.js +236 -0
- package/sdk/dist/generated/oft_std.d.ts +1722 -0
- package/sdk/dist/generated/oft_std.js +316 -0
- package/sdk/dist/generated/price_feed.d.ts +1077 -0
- package/sdk/dist/generated/price_feed.js +210 -0
- package/sdk/dist/generated/sml.d.ts +171 -56
- package/sdk/dist/generated/sml.js +111 -62
- package/sdk/dist/generated/treasury.d.ts +896 -0
- package/sdk/dist/generated/treasury.js +219 -0
- package/sdk/dist/generated/uln302.d.ts +175 -75
- package/sdk/dist/generated/uln302.js +126 -82
- package/sdk/dist/generated/upgrader.d.ts +70 -0
- package/sdk/dist/generated/upgrader.js +19 -0
- package/sdk/dist/index.d.ts +10 -0
- package/sdk/dist/index.js +14 -0
- package/sdk/dist/wasm/blocked-message-lib.d.ts +1 -0
- package/sdk/dist/wasm/blocked-message-lib.js +2 -0
- package/sdk/dist/wasm/counter.d.ts +1 -0
- package/sdk/dist/wasm/counter.js +2 -0
- package/sdk/dist/wasm/dvn-fee-lib.d.ts +1 -0
- package/sdk/dist/wasm/dvn-fee-lib.js +2 -0
- package/sdk/dist/wasm/dvn.d.ts +1 -0
- package/sdk/dist/wasm/dvn.js +2 -0
- package/sdk/dist/wasm/endpoint-v2.d.ts +1 -0
- package/sdk/dist/wasm/endpoint-v2.js +2 -0
- package/sdk/dist/wasm/executor-fee-lib.d.ts +1 -0
- package/sdk/dist/wasm/executor-fee-lib.js +2 -0
- package/sdk/dist/wasm/executor-helper.d.ts +1 -0
- package/sdk/dist/wasm/executor-helper.js +2 -0
- package/sdk/dist/wasm/executor.d.ts +1 -0
- package/sdk/dist/wasm/executor.js +2 -0
- package/sdk/dist/wasm/layerzero-views.d.ts +1 -0
- package/sdk/dist/wasm/layerzero-views.js +2 -0
- package/sdk/dist/wasm/oft-std.d.ts +1 -0
- package/sdk/dist/wasm/oft-std.js +2 -0
- package/sdk/dist/wasm/price-feed.d.ts +1 -0
- package/sdk/dist/wasm/price-feed.js +2 -0
- package/sdk/dist/wasm/simple-message-lib.d.ts +1 -0
- package/sdk/dist/wasm/simple-message-lib.js +2 -0
- package/sdk/dist/wasm/treasury.d.ts +1 -0
- package/sdk/dist/wasm/treasury.js +2 -0
- package/sdk/dist/wasm/uln302.d.ts +1 -0
- package/sdk/dist/wasm/uln302.js +2 -0
- package/sdk/dist/wasm/upgrader.d.ts +1 -0
- package/sdk/dist/wasm/upgrader.js +2 -0
- package/sdk/dist/wasm.d.ts +15 -0
- package/sdk/dist/wasm.js +15 -0
- package/sdk/package.json +7 -4
- package/sdk/src/index.ts +17 -0
- package/sdk/test/counter-sml.test.ts +376 -0
- package/sdk/test/counter-uln.test.ts +493 -0
- package/sdk/test/{oft.test.ts → oft-sml.test.ts} +187 -323
- package/sdk/test/suites/constants.ts +22 -2
- package/sdk/test/suites/dummyContractClient.ts +169 -0
- package/sdk/test/suites/globalSetup.ts +450 -0
- package/sdk/test/suites/localnet.ts +23 -6
- package/sdk/test/upgrader.test.ts +300 -0
- package/sdk/test/utils.ts +558 -85
- package/sdk/vitest.config.ts +21 -0
- package/tools/ts-bindings-gen/src/main.rs +12 -1
- package/turbo.json +2 -0
- package/contracts/common-macros/src/contract_impl.rs +0 -47
- package/contracts/common-macros/src/ownable.rs +0 -59
- package/contracts/common-macros/src/tests/contract_impl.rs +0 -381
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__ownable__snapshot_generated_ownable_code.snap +0 -32
- package/contracts/endpoint-v2/src/tests/messaging_channel/clear.rs +0 -316
- package/contracts/endpoint-v2/src/tests/messaging_channel/internal.rs +0 -388
- package/contracts/message-libs/message-lib-common/src/tests/packet_codec_v1.rs +0 -162
- package/contracts/message-libs/message-lib-common/src/tests/worker_options.rs +0 -319
- package/contracts/oapp-macros/src/lib.rs +0 -154
- package/contracts/oapp-macros/src/oapp_core.rs +0 -40
- package/contracts/oapp-macros/src/oapp_full.rs +0 -21
- package/contracts/oapp-macros/src/oapp_options_type3.rs +0 -31
- package/contracts/oapp-macros/src/oapp_receiver.rs +0 -48
- package/contracts/oapp-macros/src/oapp_sender.rs +0 -21
- package/contracts/oapp-macros/src/util.rs +0 -107
- package/contracts/oapps/oft/src/constants.rs +0 -5
- package/contracts/oapps/oft/src/default_oft_impl.rs +0 -146
- package/contracts/utils/src/tests/ttl.rs +0 -421
- package/contracts/utils/src/ttl.rs +0 -123
- package/contracts/workers/dvn/src/interfaces/multisig.rs +0 -56
- package/contracts/workers/dvn/src/multisig.rs +0 -153
- package/sdk/test/index.test.ts +0 -376
- /package/contracts/{oapp-macros → oapps/oapp-macros}/Cargo.toml +0 -0
package/Cargo.lock
CHANGED
|
@@ -332,14 +332,26 @@ version = "0.0.1"
|
|
|
332
332
|
dependencies = [
|
|
333
333
|
"assert_unordered",
|
|
334
334
|
"common-macros",
|
|
335
|
+
"dvn",
|
|
336
|
+
"dvn-fee-lib",
|
|
337
|
+
"ed25519-dalek",
|
|
335
338
|
"endpoint-v2",
|
|
336
339
|
"executor",
|
|
340
|
+
"executor-fee-lib",
|
|
341
|
+
"executor-helper",
|
|
342
|
+
"k256",
|
|
337
343
|
"message-lib-common",
|
|
338
344
|
"oapp",
|
|
339
345
|
"oapp-macros",
|
|
346
|
+
"price-feed",
|
|
347
|
+
"rand",
|
|
348
|
+
"sha3",
|
|
340
349
|
"simple-message-lib",
|
|
341
350
|
"soroban-sdk",
|
|
351
|
+
"treasury",
|
|
352
|
+
"uln302",
|
|
342
353
|
"utils",
|
|
354
|
+
"worker",
|
|
343
355
|
]
|
|
344
356
|
|
|
345
357
|
[[package]]
|
|
@@ -609,7 +621,6 @@ dependencies = [
|
|
|
609
621
|
name = "dvn-fee-lib"
|
|
610
622
|
version = "0.0.1"
|
|
611
623
|
dependencies = [
|
|
612
|
-
"cfg-if",
|
|
613
624
|
"common-macros",
|
|
614
625
|
"message-lib-common",
|
|
615
626
|
"soroban-sdk",
|
|
@@ -750,7 +761,6 @@ dependencies = [
|
|
|
750
761
|
name = "executor-helper"
|
|
751
762
|
version = "0.0.1"
|
|
752
763
|
dependencies = [
|
|
753
|
-
"cfg-if",
|
|
754
764
|
"common-macros",
|
|
755
765
|
"endpoint-v2",
|
|
756
766
|
"executor",
|
|
@@ -1038,6 +1048,19 @@ dependencies = [
|
|
|
1038
1048
|
"cpufeatures",
|
|
1039
1049
|
]
|
|
1040
1050
|
|
|
1051
|
+
[[package]]
|
|
1052
|
+
name = "layerzero-views"
|
|
1053
|
+
version = "0.0.1"
|
|
1054
|
+
dependencies = [
|
|
1055
|
+
"cfg-if",
|
|
1056
|
+
"common-macros",
|
|
1057
|
+
"endpoint-v2",
|
|
1058
|
+
"message-lib-common",
|
|
1059
|
+
"soroban-sdk",
|
|
1060
|
+
"uln302",
|
|
1061
|
+
"utils",
|
|
1062
|
+
]
|
|
1063
|
+
|
|
1041
1064
|
[[package]]
|
|
1042
1065
|
name = "libc"
|
|
1043
1066
|
version = "0.2.177"
|
|
@@ -1056,6 +1079,19 @@ version = "0.4.28"
|
|
|
1056
1079
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1057
1080
|
checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
|
|
1058
1081
|
|
|
1082
|
+
[[package]]
|
|
1083
|
+
name = "macro-integration-tests"
|
|
1084
|
+
version = "0.0.1"
|
|
1085
|
+
dependencies = [
|
|
1086
|
+
"common-macros",
|
|
1087
|
+
"endpoint-v2",
|
|
1088
|
+
"oapp",
|
|
1089
|
+
"oapp-macros",
|
|
1090
|
+
"soroban-sdk",
|
|
1091
|
+
"trybuild",
|
|
1092
|
+
"utils",
|
|
1093
|
+
]
|
|
1094
|
+
|
|
1059
1095
|
[[package]]
|
|
1060
1096
|
name = "macro-string"
|
|
1061
1097
|
version = "0.1.4"
|
|
@@ -1182,9 +1218,11 @@ version = "0.0.1"
|
|
|
1182
1218
|
dependencies = [
|
|
1183
1219
|
"common-macros",
|
|
1184
1220
|
"endpoint-v2",
|
|
1221
|
+
"message-lib-common",
|
|
1185
1222
|
"oapp",
|
|
1186
1223
|
"oapp-macros",
|
|
1187
1224
|
"oft",
|
|
1225
|
+
"simple-message-lib",
|
|
1188
1226
|
"soroban-sdk",
|
|
1189
1227
|
"utils",
|
|
1190
1228
|
]
|
|
@@ -1259,7 +1297,6 @@ name = "price-feed"
|
|
|
1259
1297
|
version = "0.0.1"
|
|
1260
1298
|
dependencies = [
|
|
1261
1299
|
"common-macros",
|
|
1262
|
-
"endpoint-v2",
|
|
1263
1300
|
"soroban-sdk",
|
|
1264
1301
|
"utils",
|
|
1265
1302
|
"worker",
|
|
@@ -1471,6 +1508,15 @@ dependencies = [
|
|
|
1471
1508
|
"serde_core",
|
|
1472
1509
|
]
|
|
1473
1510
|
|
|
1511
|
+
[[package]]
|
|
1512
|
+
name = "serde_spanned"
|
|
1513
|
+
version = "1.0.4"
|
|
1514
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1515
|
+
checksum = "f8bbf91e5a4d6315eee45e704372590b30e260ee83af6639d64557f51b067776"
|
|
1516
|
+
dependencies = [
|
|
1517
|
+
"serde_core",
|
|
1518
|
+
]
|
|
1519
|
+
|
|
1474
1520
|
[[package]]
|
|
1475
1521
|
name = "serde_with"
|
|
1476
1522
|
version = "3.15.1"
|
|
@@ -1910,6 +1956,21 @@ dependencies = [
|
|
|
1910
1956
|
"unicode-ident",
|
|
1911
1957
|
]
|
|
1912
1958
|
|
|
1959
|
+
[[package]]
|
|
1960
|
+
name = "target-triple"
|
|
1961
|
+
version = "1.0.0"
|
|
1962
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1963
|
+
checksum = "591ef38edfb78ca4771ee32cf494cb8771944bee237a9b91fc9c1424ac4b777b"
|
|
1964
|
+
|
|
1965
|
+
[[package]]
|
|
1966
|
+
name = "termcolor"
|
|
1967
|
+
version = "1.4.1"
|
|
1968
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1969
|
+
checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
|
|
1970
|
+
dependencies = [
|
|
1971
|
+
"winapi-util",
|
|
1972
|
+
]
|
|
1973
|
+
|
|
1913
1974
|
[[package]]
|
|
1914
1975
|
name = "thiserror"
|
|
1915
1976
|
version = "1.0.69"
|
|
@@ -1961,6 +2022,45 @@ dependencies = [
|
|
|
1961
2022
|
"time-core",
|
|
1962
2023
|
]
|
|
1963
2024
|
|
|
2025
|
+
[[package]]
|
|
2026
|
+
name = "toml"
|
|
2027
|
+
version = "0.9.10+spec-1.1.0"
|
|
2028
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2029
|
+
checksum = "0825052159284a1a8b4d6c0c86cbc801f2da5afd2b225fa548c72f2e74002f48"
|
|
2030
|
+
dependencies = [
|
|
2031
|
+
"indexmap 2.12.0",
|
|
2032
|
+
"serde_core",
|
|
2033
|
+
"serde_spanned",
|
|
2034
|
+
"toml_datetime",
|
|
2035
|
+
"toml_parser",
|
|
2036
|
+
"toml_writer",
|
|
2037
|
+
"winnow",
|
|
2038
|
+
]
|
|
2039
|
+
|
|
2040
|
+
[[package]]
|
|
2041
|
+
name = "toml_datetime"
|
|
2042
|
+
version = "0.7.5+spec-1.1.0"
|
|
2043
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2044
|
+
checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347"
|
|
2045
|
+
dependencies = [
|
|
2046
|
+
"serde_core",
|
|
2047
|
+
]
|
|
2048
|
+
|
|
2049
|
+
[[package]]
|
|
2050
|
+
name = "toml_parser"
|
|
2051
|
+
version = "1.0.6+spec-1.1.0"
|
|
2052
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2053
|
+
checksum = "a3198b4b0a8e11f09dd03e133c0280504d0801269e9afa46362ffde1cbeebf44"
|
|
2054
|
+
dependencies = [
|
|
2055
|
+
"winnow",
|
|
2056
|
+
]
|
|
2057
|
+
|
|
2058
|
+
[[package]]
|
|
2059
|
+
name = "toml_writer"
|
|
2060
|
+
version = "1.0.6+spec-1.1.0"
|
|
2061
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2062
|
+
checksum = "ab16f14aed21ee8bfd8ec22513f7287cd4a91aa92e44edfe2c17ddd004e92607"
|
|
2063
|
+
|
|
1964
2064
|
[[package]]
|
|
1965
2065
|
name = "treasury"
|
|
1966
2066
|
version = "0.0.1"
|
|
@@ -1974,6 +2074,21 @@ dependencies = [
|
|
|
1974
2074
|
"utils",
|
|
1975
2075
|
]
|
|
1976
2076
|
|
|
2077
|
+
[[package]]
|
|
2078
|
+
name = "trybuild"
|
|
2079
|
+
version = "1.0.114"
|
|
2080
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2081
|
+
checksum = "3e17e807bff86d2a06b52bca4276746584a78375055b6e45843925ce2802b335"
|
|
2082
|
+
dependencies = [
|
|
2083
|
+
"glob",
|
|
2084
|
+
"serde",
|
|
2085
|
+
"serde_derive",
|
|
2086
|
+
"serde_json",
|
|
2087
|
+
"target-triple",
|
|
2088
|
+
"termcolor",
|
|
2089
|
+
"toml",
|
|
2090
|
+
]
|
|
2091
|
+
|
|
1977
2092
|
[[package]]
|
|
1978
2093
|
name = "ts-bindings-gen"
|
|
1979
2094
|
version = "0.0.1"
|
|
@@ -2006,6 +2121,15 @@ version = "1.0.22"
|
|
|
2006
2121
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2007
2122
|
checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
|
|
2008
2123
|
|
|
2124
|
+
[[package]]
|
|
2125
|
+
name = "upgrader"
|
|
2126
|
+
version = "0.0.1"
|
|
2127
|
+
dependencies = [
|
|
2128
|
+
"common-macros",
|
|
2129
|
+
"soroban-sdk",
|
|
2130
|
+
"utils",
|
|
2131
|
+
]
|
|
2132
|
+
|
|
2009
2133
|
[[package]]
|
|
2010
2134
|
name = "utils"
|
|
2011
2135
|
version = "0.0.1"
|
|
@@ -2136,6 +2260,15 @@ version = "0.4.0"
|
|
|
2136
2260
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2137
2261
|
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
|
2138
2262
|
|
|
2263
|
+
[[package]]
|
|
2264
|
+
name = "winapi-util"
|
|
2265
|
+
version = "0.1.11"
|
|
2266
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2267
|
+
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
|
2268
|
+
dependencies = [
|
|
2269
|
+
"windows-sys",
|
|
2270
|
+
]
|
|
2271
|
+
|
|
2139
2272
|
[[package]]
|
|
2140
2273
|
name = "winapi-x86_64-pc-windows-gnu"
|
|
2141
2274
|
version = "0.4.0"
|
|
@@ -2274,6 +2407,12 @@ version = "0.52.6"
|
|
|
2274
2407
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2275
2408
|
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
|
2276
2409
|
|
|
2410
|
+
[[package]]
|
|
2411
|
+
name = "winnow"
|
|
2412
|
+
version = "0.7.14"
|
|
2413
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2414
|
+
checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829"
|
|
2415
|
+
|
|
2277
2416
|
[[package]]
|
|
2278
2417
|
name = "worker"
|
|
2279
2418
|
version = "0.0.1"
|
package/Cargo.toml
CHANGED
|
@@ -20,8 +20,9 @@ hex-literal = "1.0.0"
|
|
|
20
20
|
endpoint-v2 = { path = "contracts/endpoint-v2", default-features = false }
|
|
21
21
|
utils = { path = "contracts/utils" }
|
|
22
22
|
common-macros = { path = "contracts/common-macros" }
|
|
23
|
-
oapp-macros = { path = "contracts/oapp-macros" }
|
|
23
|
+
oapp-macros = { path = "contracts/oapps/oapp-macros" }
|
|
24
24
|
message-lib-common = { path = "contracts/message-libs/message-lib-common" }
|
|
25
|
+
uln302 = { path = "contracts/message-libs/uln-302", default-features = false }
|
|
25
26
|
oapp = { path = "contracts/oapps/oapp" }
|
|
26
27
|
simple-message-lib = { path = "contracts/message-libs/simple-message-lib" }
|
|
27
28
|
treasury = { path = "contracts/message-libs/treasury" }
|
|
@@ -29,6 +30,9 @@ worker = { path = "contracts/workers/worker" }
|
|
|
29
30
|
executor = { path = "contracts/workers/executor" }
|
|
30
31
|
executor-helper = { path = "contracts/workers/executor-helper" }
|
|
31
32
|
executor-fee-lib = { path = "contracts/workers/executor-fee-lib" }
|
|
33
|
+
dvn = { path = "contracts/workers/dvn" }
|
|
34
|
+
dvn-fee-lib = { path = "contracts/workers/dvn-fee-lib" }
|
|
35
|
+
price-feed = { path = "contracts/workers/price-feed" }
|
|
32
36
|
oft = { path = "contracts/oapps/oft" }
|
|
33
37
|
stellar-macros = { git = "https://github.com/OpenZeppelin/stellar-contracts.git", tag = "v0.5.1" }
|
|
34
38
|
stellar-tokens = { git = "https://github.com/OpenZeppelin/stellar-contracts.git", tag = "v0.5.1" }
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Stellar LayerZero Protocol - Error Code Specification
|
|
2
|
+
|
|
3
|
+
This document defines the error code allocation strategy for the Stellar LayerZero contracts.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
Each library has a unique error code range to:
|
|
8
|
+
|
|
9
|
+
- **Prevent collisions**: Avoid error code conflicts between different libraries
|
|
10
|
+
- **Enable traceability**: Quickly identify which library an error originated from based on its code
|
|
11
|
+
- **Simplify debugging**: Error codes are globally unique, making it easier to track and diagnose issues
|
|
12
|
+
|
|
13
|
+
## Allocation Rules
|
|
14
|
+
|
|
15
|
+
- **Library allocation**: Each library is allocated a 100-unit block (e.g., 1000-1099, 1100-1199). Total errors in one library should not exceed 100.
|
|
16
|
+
- **Sub-range allocation**: Each error type within a library is allocated a 10-unit block. Example from `utils` (1000-1099):
|
|
17
|
+
|
|
18
|
+
- BufferReaderError: 1000-1009
|
|
19
|
+
- BufferWriterError: 1010-1019
|
|
20
|
+
- TtlConfigurableError: 1020-1029
|
|
21
|
+
- OwnableError: 1030-1039
|
|
22
|
+
- BytesExtError: 1040-1049
|
|
23
|
+
- UpgradeableError: 1050-1059
|
|
24
|
+
- MultisigError: 1060-1069
|
|
25
|
+
|
|
26
|
+
If an error type exceeds 10 errors (e.g., 12 errors), it extends into the next block but the following error type should start at the next 10-unit boundary (e.g., if errors are 1000-1011, next sub-range starts at 1020).
|
|
27
|
+
|
|
28
|
+
- **Auto-increment**: Within each error enum, values auto-increment from the starting value.
|
|
29
|
+
|
|
30
|
+
## Error Code Ranges
|
|
31
|
+
|
|
32
|
+
| Range | Category | Library | Description |
|
|
33
|
+
| ----------- | --------------- | ------------------ | ------------------------------------------------------------ |
|
|
34
|
+
| 1 - 999 | Contract Errors | - | Application-specific contract errors (auto-increment from 1) |
|
|
35
|
+
| 1000 - 1099 | Protocol Lib | utils | `utils/src/errors.rs` |
|
|
36
|
+
| 1100 - 1199 | Protocol Lib | message-lib-common | `message-libs/message-lib-common/src/errors.rs` |
|
|
37
|
+
| 1200 - 1299 | Protocol Lib | worker | `workers/worker/src/errors.rs` |
|
|
38
|
+
| 1300 - 1999 | Protocol Lib | (reserved) | Future protocol libs |
|
|
39
|
+
| 2000 - 2099 | OApp Lib | oapp | `oapps/oapp/src/errors.rs` |
|
|
40
|
+
| 2100 - 2999 | OApp Lib | (reserved) | Future OApp libs |
|
|
41
|
+
| 3000 - 3099 | OFT Lib | oft | `oapps/oft/src/errors.rs` |
|
|
42
|
+
| 3100 - 3999 | OFT Lib | (reserved) | Future OFT libs |
|
|
43
|
+
|
|
44
|
+
---
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
//! Authorization macros for Stellar contracts.
|
|
2
|
+
//!
|
|
3
|
+
//! This module provides macros for implementing authorization patterns:
|
|
4
|
+
//! - `#[ownable]` - Owner-based access control (external owner address)
|
|
5
|
+
//! - `#[multisig]` - Multisig-based access control (self-owning pattern)
|
|
6
|
+
//! - `#[only_auth]` - Authorization check attribute for functions
|
|
7
|
+
|
|
8
|
+
use crate::utils;
|
|
9
|
+
use proc_macro2::TokenStream;
|
|
10
|
+
use quote::{quote, ToTokens};
|
|
11
|
+
use syn::{parse_quote, ItemFn, ItemStruct};
|
|
12
|
+
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// Ownable Macro Implementation
|
|
15
|
+
// ============================================================================
|
|
16
|
+
|
|
17
|
+
/// Generates the ownable implementation from the `#[ownable]` attribute macro.
|
|
18
|
+
///
|
|
19
|
+
/// This macro implements both `Auth` and `Ownable` traits for the contract:
|
|
20
|
+
/// - `Auth::authorizer()` returns the stored owner address
|
|
21
|
+
/// - `Ownable` provides ownership management (transfer, renounce)
|
|
22
|
+
pub fn generate_ownable_impl(input: TokenStream) -> TokenStream {
|
|
23
|
+
let item_struct: ItemStruct = syn::parse2(input).unwrap_or_else(|e| panic!("failed to parse struct: {}", e));
|
|
24
|
+
let name = &item_struct.ident;
|
|
25
|
+
let impl_mod = utils::impl_mod_ident(name, "ownable");
|
|
26
|
+
|
|
27
|
+
quote! {
|
|
28
|
+
#item_struct
|
|
29
|
+
|
|
30
|
+
use utils::{auth::Auth as _, ownable::{Ownable as _, OwnableInitializer as _}};
|
|
31
|
+
|
|
32
|
+
#[doc(hidden)]
|
|
33
|
+
mod #impl_mod {
|
|
34
|
+
use super::*;
|
|
35
|
+
use utils::{
|
|
36
|
+
auth::Auth,
|
|
37
|
+
errors::OwnableError,
|
|
38
|
+
option_ext::OptionExt as _,
|
|
39
|
+
ownable::{Ownable, OwnableInitializer},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
impl OwnableInitializer for #name {}
|
|
43
|
+
|
|
44
|
+
#[common_macros::contract_impl]
|
|
45
|
+
impl Auth for #name {
|
|
46
|
+
fn authorizer(env: &soroban_sdk::Env) -> soroban_sdk::Address {
|
|
47
|
+
<Self as Ownable>::owner(env).unwrap_or_panic(env, OwnableError::OwnerNotSet)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
#[common_macros::contract_impl(contracttrait)]
|
|
52
|
+
impl Ownable for #name {}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ============================================================================
|
|
58
|
+
// Multisig Macro Implementation
|
|
59
|
+
// ============================================================================
|
|
60
|
+
|
|
61
|
+
/// Generates the multisig implementation from the `#[multisig]` attribute macro.
|
|
62
|
+
///
|
|
63
|
+
/// This macro implements both `Auth` and `Multisig` traits for the contract:
|
|
64
|
+
/// - `Auth::authorizer()` returns the contract's own address (self-owning pattern)
|
|
65
|
+
/// - `Multisig` provides signature verification and signer management
|
|
66
|
+
pub fn generate_multisig_impl(input: TokenStream) -> TokenStream {
|
|
67
|
+
let item_struct: ItemStruct = syn::parse2(input).unwrap_or_else(|e| panic!("failed to parse struct: {}", e));
|
|
68
|
+
let name = &item_struct.ident;
|
|
69
|
+
let impl_mod = utils::impl_mod_ident(name, "multisig");
|
|
70
|
+
|
|
71
|
+
quote! {
|
|
72
|
+
#item_struct
|
|
73
|
+
|
|
74
|
+
use utils::{auth::Auth as _, multisig::Multisig as _};
|
|
75
|
+
|
|
76
|
+
#[doc(hidden)]
|
|
77
|
+
mod #impl_mod {
|
|
78
|
+
use super::*;
|
|
79
|
+
use utils::{auth::Auth, multisig::Multisig};
|
|
80
|
+
|
|
81
|
+
#[common_macros::contract_impl]
|
|
82
|
+
impl Auth for #name {
|
|
83
|
+
fn authorizer(env: &soroban_sdk::Env) -> soroban_sdk::Address {
|
|
84
|
+
env.current_contract_address()
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
#[common_macros::contract_impl(contracttrait)]
|
|
89
|
+
impl Multisig for #name {}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// ============================================================================
|
|
95
|
+
// Only Auth Macro Implementation
|
|
96
|
+
// ============================================================================
|
|
97
|
+
|
|
98
|
+
/// Prepends an auth check to a method using the `Auth` trait.
|
|
99
|
+
///
|
|
100
|
+
/// Works with any contract that implements the `Auth` trait, including both
|
|
101
|
+
/// `Ownable` and `Multisig` contracts.
|
|
102
|
+
pub fn prepend_only_auth_check(input: TokenStream) -> TokenStream {
|
|
103
|
+
let mut input_fn: ItemFn = syn::parse2(input).unwrap_or_else(|e| panic!("failed to parse function: {}", e));
|
|
104
|
+
|
|
105
|
+
let env_param = utils::expect_env_param(&input_fn.sig.inputs);
|
|
106
|
+
|
|
107
|
+
// Get a reference to env (handles both `Env` and `&Env` parameter types)
|
|
108
|
+
let env_ref = env_param.as_ref_tokens();
|
|
109
|
+
|
|
110
|
+
// Insert the auth check at the beginning of the function body
|
|
111
|
+
input_fn.block.stmts.insert(0, parse_quote!(utils::auth::require_auth::<Self>(#env_ref);));
|
|
112
|
+
input_fn.into_token_stream()
|
|
113
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
use crate::utils;
|
|
2
|
+
use proc_macro2::TokenStream;
|
|
3
|
+
use quote::quote;
|
|
4
|
+
use syn::{ImplItem, ItemImpl, ItemTrait, TraitItem, Visibility};
|
|
5
|
+
|
|
6
|
+
/// Generates a `#[soroban_sdk::contractimpl]` with automatic instance TTL extension.
|
|
7
|
+
pub fn contractimpl_with_ttl(attr: TokenStream, input: TokenStream) -> TokenStream {
|
|
8
|
+
let mut impl_block: ItemImpl = syn::parse2(input).unwrap_or_else(|e| panic!("failed to parse impl block: {}", e));
|
|
9
|
+
|
|
10
|
+
let is_trait_impl = impl_block.trait_.is_some();
|
|
11
|
+
|
|
12
|
+
for item in &mut impl_block.items {
|
|
13
|
+
let ImplItem::Fn(method) = item else { continue };
|
|
14
|
+
|
|
15
|
+
// For trait impls, process all methods; for inherent impls, only public methods
|
|
16
|
+
if !is_trait_impl && !matches!(method.vis, Visibility::Public(_)) {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Skip the constructor as TTL config is typically not set during initialization
|
|
21
|
+
if method.sig.ident == "__constructor" {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Skip methods without Env parameter
|
|
26
|
+
let Some(env_param) = utils::find_env_param(&method.sig.inputs) else { continue };
|
|
27
|
+
|
|
28
|
+
// Inject TTL extension at the start of the method body
|
|
29
|
+
method.block.stmts.insert(0, extend_instance_ttl_stmt(&env_param));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let contract_attr = if attr.is_empty() {
|
|
33
|
+
quote! { #[soroban_sdk::contractimpl]}
|
|
34
|
+
} else {
|
|
35
|
+
quote! { #[soroban_sdk::contractimpl(#attr)] }
|
|
36
|
+
};
|
|
37
|
+
quote! {
|
|
38
|
+
#contract_attr
|
|
39
|
+
#impl_block
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/// Generates a `#[soroban_sdk::contracttrait]` with automatic instance TTL extension.
|
|
44
|
+
///
|
|
45
|
+
/// This macro processes trait definitions and injects TTL extension logic into
|
|
46
|
+
/// default method implementations that have an `Env` parameter.
|
|
47
|
+
pub fn contracttrait_with_ttl(attr: TokenStream, input: TokenStream) -> TokenStream {
|
|
48
|
+
let mut trait_def: ItemTrait =
|
|
49
|
+
syn::parse2(input).unwrap_or_else(|e| panic!("failed to parse trait definition: {}", e));
|
|
50
|
+
|
|
51
|
+
for item in &mut trait_def.items {
|
|
52
|
+
let TraitItem::Fn(method) = item else { continue };
|
|
53
|
+
|
|
54
|
+
// Only process methods with default implementations (have a body)
|
|
55
|
+
let Some(ref mut block) = method.default else { continue };
|
|
56
|
+
|
|
57
|
+
// Skip methods without Env parameter
|
|
58
|
+
let Some(env_param) = utils::find_env_param(&method.sig.inputs) else { continue };
|
|
59
|
+
|
|
60
|
+
// Inject TTL extension at the start of the method body
|
|
61
|
+
block.stmts.insert(0, extend_instance_ttl_stmt(&env_param));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
let trait_attr = if attr.is_empty() {
|
|
65
|
+
quote! { #[soroban_sdk::contracttrait]}
|
|
66
|
+
} else {
|
|
67
|
+
quote! { #[soroban_sdk::contracttrait(#attr)] }
|
|
68
|
+
};
|
|
69
|
+
quote! {
|
|
70
|
+
#trait_attr
|
|
71
|
+
#trait_def
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/// Generates a statement that extends instance TTL if configured.
|
|
76
|
+
fn extend_instance_ttl_stmt(env_param: &utils::EnvParam<'_>) -> syn::Stmt {
|
|
77
|
+
let env_ref = env_param.as_ref_tokens();
|
|
78
|
+
let env_ident = env_param.ident;
|
|
79
|
+
syn::parse_quote! {
|
|
80
|
+
if let Some(instance_ttl) = utils::ttl_configurable::TtlConfigStorage::instance(#env_ref) {
|
|
81
|
+
#env_ident.storage().instance().extend_ttl(instance_ttl.threshold, instance_ttl.extend_to);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|