@layerzerolabs/protocol-stellar-v2 0.2.15 → 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 +350 -309
- package/.turbo/turbo-lint.log +146 -108
- package/.turbo/turbo-test.log +1423 -1238
- package/Cargo.lock +12 -0
- package/Cargo.toml +3 -0
- 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 +181 -30
- package/contracts/common-macros/src/lz_contract.rs +83 -0
- 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 +2 -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} +3 -3
- 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__ttl_configurable__snapshot_generated_ttl_configurable_code.snap +7 -21
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__upgradeable__snapshot_generated_upgradeable_code.snap +2 -2
- package/contracts/common-macros/src/ttl_configurable.rs +19 -34
- package/contracts/common-macros/src/ttl_extendable.rs +36 -0
- package/contracts/common-macros/src/upgradeable.rs +5 -5
- 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 +38 -40
- 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_v2/pay_messaging_fees.rs +3 -3
- package/contracts/endpoint-v2/src/tests/endpoint_v2/quote.rs +1 -1
- package/contracts/endpoint-v2/src/tests/endpoint_v2/require_oapp_auth.rs +2 -2
- package/contracts/endpoint-v2/src/tests/endpoint_v2/send.rs +3 -3
- package/contracts/endpoint-v2/src/tests/endpoint_v2/set_zro.rs +4 -4
- package/contracts/endpoint-v2/src/tests/message_lib_manager/require_receive_lib_for_eid.rs +3 -3
- package/contracts/endpoint-v2/src/tests/message_lib_manager/require_registered.rs +1 -1
- package/contracts/endpoint-v2/src/tests/message_lib_manager/require_send_lib_for_eid.rs +3 -3
- package/contracts/endpoint-v2/src/tests/message_lib_manager/require_supported_eid.rs +1 -1
- package/contracts/endpoint-v2/src/tests/messaging_channel/clear_payload.rs +4 -4
- package/contracts/endpoint-v2/src/tests/messaging_channel/inbound.rs +1 -1
- package/contracts/layerzero-views/src/layerzero_view.rs +3 -6
- package/contracts/macro-integration-tests/tests/runtime/ownable/mod.rs +2 -2
- package/contracts/macro-integration-tests/tests/runtime/ownable/{only_owner_guard.rs → only_auth_guard.rs} +1 -1
- package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/configuration.rs +1 -1
- package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/freeze.rs +1 -1
- package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/mod.rs +0 -1
- package/contracts/macro-integration-tests/tests/ui/ownable/fail/{only_owner_missing_env.rs → only_auth_missing_env.rs} +3 -3
- package/contracts/macro-integration-tests/tests/ui/ownable/fail/{only_owner_missing_env.stderr → only_auth_missing_env.stderr} +4 -4
- package/contracts/macro-integration-tests/tests/ui/ownable/pass/namespacing_and_imports.rs +2 -3
- package/contracts/macro-integration-tests/tests/ui/ownable/pass/{only_owner_env_param_variants.rs → only_auth_env_param_variants.rs} +9 -9
- package/contracts/macro-integration-tests/tests/ui/ttl_configurable/pass/minimal_contract.rs +6 -6
- 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 +3 -3
- package/contracts/message-libs/message-lib-common/src/tests/worker_options/append_lz_receive_option.rs +1 -2
- package/contracts/message-libs/message-lib-common/src/tests/worker_options/append_native_drop_option.rs +1 -2
- package/contracts/message-libs/message-lib-common/src/tests/worker_options/convert_legacy_options.rs +9 -9
- package/contracts/message-libs/message-lib-common/src/tests/worker_options/extract_type_3_options.rs +1 -1
- package/contracts/message-libs/message-lib-common/src/tests/worker_options/left_pad_to_bytes32.rs +1 -1
- package/contracts/message-libs/message-lib-common/src/tests/worker_options/split_worker_options.rs +2 -2
- package/contracts/message-libs/simple-message-lib/src/simple_message_lib.rs +7 -9
- package/contracts/message-libs/treasury/src/errors.rs +2 -2
- 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/storage.rs +1 -1
- package/contracts/message-libs/treasury/src/tests/treasury_tests.rs +1 -1
- package/contracts/message-libs/treasury/src/treasury.rs +14 -16
- package/contracts/message-libs/uln-302/src/receive_uln.rs +13 -2
- package/contracts/message-libs/uln-302/src/send_uln.rs +23 -3
- package/contracts/message-libs/uln-302/src/uln302.rs +6 -24
- 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.rs → setup_sml.rs} +48 -80
- 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 -43
- 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 +93 -78
- 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 -8
- package/contracts/oapps/oapp/src/tests/test_oapp_options_type3.rs +25 -17
- package/contracts/oapps/oapp/src/tests/test_oapp_receiver.rs +7 -7
- package/contracts/oapps/oapp/src/tests/test_oapp_sender.rs +14 -15
- package/contracts/oapps/oapp-macros/src/generators.rs +128 -0
- package/contracts/oapps/oapp-macros/src/lib.rs +113 -56
- package/contracts/oapps/oft/integration-tests/setup.rs +25 -7
- package/contracts/oapps/oft/src/errors.rs +6 -1
- package/contracts/oapps/oft/src/extensions/oft_fee.rs +8 -8
- package/contracts/oapps/oft/src/extensions/pausable.rs +4 -4
- package/contracts/oapps/oft/src/extensions/rate_limiter.rs +5 -5
- package/contracts/oapps/oft/src/lib.rs +4 -2
- package/contracts/oapps/oft/src/oft.rs +24 -64
- package/contracts/oapps/oft/src/oft_impl.rs +201 -0
- package/contracts/oapps/oft/src/oft_types/lock_unlock.rs +1 -3
- 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 +36 -22
- 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 +5 -3
- 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_utils.rs +45 -23
- package/contracts/oapps/oft/src/types.rs +20 -0
- package/contracts/oapps/oft-std/integration-tests/setup.rs +4 -2
- package/contracts/oapps/oft-std/src/oft.rs +24 -6
- package/contracts/upgrader/src/lib.rs +4 -4
- package/contracts/utils/src/auth.rs +44 -0
- package/contracts/utils/src/errors.rs +27 -5
- package/contracts/utils/src/lib.rs +3 -0
- package/contracts/utils/src/multisig.rs +211 -0
- package/contracts/utils/src/ownable.rs +12 -10
- 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 +1 -0
- package/contracts/utils/src/tests/multisig.rs +731 -0
- package/contracts/utils/src/tests/option_ext.rs +2 -5
- package/contracts/utils/src/tests/ownable.rs +16 -5
- package/contracts/utils/src/tests/ttl_configurable.rs +27 -16
- package/contracts/utils/src/tests/upgradeable.rs +4 -2
- package/contracts/utils/src/ttl_configurable.rs +23 -8
- package/contracts/utils/src/ttl_extendable.rs +27 -0
- package/contracts/utils/src/upgradeable.rs +2 -0
- package/contracts/workers/dvn/Cargo.toml +1 -1
- package/contracts/workers/dvn/src/auth.rs +7 -7
- package/contracts/workers/dvn/src/dvn.rs +10 -38
- package/contracts/workers/dvn/src/errors.rs +0 -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 +1 -1
- package/contracts/workers/dvn-fee-lib/src/dvn_fee_lib.rs +3 -6
- package/contracts/workers/executor/src/auth.rs +80 -16
- package/contracts/workers/executor/src/executor.rs +5 -31
- 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/executor_fee_lib.rs +3 -6
- package/contracts/workers/executor-helper/Cargo.toml +1 -1
- package/contracts/workers/executor-helper/src/executor_helper.rs +53 -73
- package/contracts/workers/price-feed/Cargo.toml +1 -1
- package/contracts/workers/price-feed/src/price_feed.rs +7 -10
- package/contracts/workers/worker/src/errors.rs +4 -0
- package/contracts/workers/worker/src/tests/worker.rs +7 -6
- package/contracts/workers/worker/src/worker.rs +20 -16
- 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 +65 -8
- package/sdk/dist/generated/bml.js +70 -34
- package/sdk/dist/generated/counter.d.ts +167 -42
- package/sdk/dist/generated/counter.js +86 -45
- package/sdk/dist/generated/dvn.d.ts +282 -229
- package/sdk/dist/generated/dvn.js +119 -81
- package/sdk/dist/generated/dvn_fee_lib.d.ts +142 -67
- package/sdk/dist/generated/dvn_fee_lib.js +64 -24
- package/sdk/dist/generated/endpoint.d.ts +97 -22
- package/sdk/dist/generated/endpoint.js +75 -37
- package/sdk/dist/generated/executor.d.ts +117 -85
- package/sdk/dist/generated/executor.js +102 -59
- package/sdk/dist/generated/executor_fee_lib.d.ts +162 -78
- package/sdk/dist/generated/executor_fee_lib.js +104 -57
- package/sdk/dist/generated/executor_helper.d.ts +133 -21
- package/sdk/dist/generated/executor_helper.js +99 -50
- package/sdk/dist/generated/oft_std.d.ts +233 -55
- package/sdk/dist/generated/oft_std.js +99 -54
- package/sdk/dist/generated/price_feed.d.ts +142 -67
- package/sdk/dist/generated/price_feed.js +64 -24
- package/sdk/dist/generated/sml.d.ts +113 -32
- package/sdk/dist/generated/sml.js +93 -49
- package/sdk/dist/generated/treasury.d.ts +896 -0
- package/sdk/dist/generated/treasury.js +219 -0
- package/sdk/dist/generated/uln302.d.ts +113 -32
- package/sdk/dist/generated/uln302.js +93 -49
- package/sdk/dist/generated/upgrader.d.ts +2 -2
- package/sdk/dist/generated/upgrader.js +1 -1
- package/sdk/dist/index.d.ts +2 -0
- package/sdk/dist/index.js +3 -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 +4 -2
- package/sdk/src/index.ts +4 -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} +185 -310
- package/sdk/test/suites/constants.ts +22 -2
- package/sdk/test/suites/globalSetup.ts +450 -0
- package/sdk/test/suites/localnet.ts +23 -6
- package/sdk/test/upgrader.test.ts +7 -16
- package/sdk/test/utils.ts +558 -85
- package/sdk/vitest.config.ts +21 -0
- package/tools/ts-bindings-gen/src/main.rs +1 -0
- package/turbo.json +2 -0
- package/contracts/common-macros/src/contract_impl.rs +0 -52
- package/contracts/common-macros/src/ownable.rs +0 -41
- package/contracts/common-macros/src/tests/contract_impl.rs +0 -386
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__ownable__snapshot_generated_ownable_code.snap +0 -12
- package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/extend_instance_ttl.rs +0 -50
- package/contracts/oapps/oapp-macros/src/oapp_core.rs +0 -41
- package/contracts/oapps/oapp-macros/src/oapp_full.rs +0 -21
- package/contracts/oapps/oapp-macros/src/oapp_options_type3.rs +0 -31
- package/contracts/oapps/oapp-macros/src/oapp_receiver.rs +0 -48
- package/contracts/oapps/oapp-macros/src/oapp_sender.rs +0 -21
- package/contracts/oapps/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 -152
- package/contracts/workers/dvn/src/interfaces/multisig.rs +0 -56
- package/contracts/workers/dvn/src/multisig.rs +0 -157
- package/sdk/test/index.test.ts +0 -375
- /package/sdk/test/suites/{testUpgradeable.ts → dummyContractClient.ts} +0 -0
|
@@ -239,7 +239,7 @@ fn test_pay_zro_fees_multiple_recipients_zero_amounts_skipped_and_refunded() {
|
|
|
239
239
|
|
|
240
240
|
// ZRO prerequisites / edge cases
|
|
241
241
|
#[test]
|
|
242
|
-
#[should_panic(expected = "Error(Contract, #
|
|
242
|
+
#[should_panic(expected = "Error(Contract, #25)")] // EndpointError::ZROUnavailable
|
|
243
243
|
fn test_panic_pay_in_zro_without_zro_configured() {
|
|
244
244
|
let context = setup();
|
|
245
245
|
let env = &context.env;
|
|
@@ -252,7 +252,7 @@ fn test_panic_pay_in_zro_without_zro_configured() {
|
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
#[test]
|
|
255
|
-
#[should_panic(expected = "Error(Contract, #
|
|
255
|
+
#[should_panic(expected = "Error(Contract, #24)")] // EndpointError::ZeroZROFee
|
|
256
256
|
fn test_panic_pay_in_zro_with_zero_zro_balance() {
|
|
257
257
|
let context = setup();
|
|
258
258
|
let env = &context.env;
|
|
@@ -312,7 +312,7 @@ fn test_pay_in_zro_with_all_zero_zro_recipients_refunds_all_zro() {
|
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
#[test]
|
|
315
|
-
#[should_panic(expected = "Error(Contract, #7)")] // EndpointError::
|
|
315
|
+
#[should_panic(expected = "Error(Contract, #7)")] // EndpointError::InsufficientZroFee
|
|
316
316
|
fn test_panic_pay_zro_fees_insufficient_balance() {
|
|
317
317
|
let context = setup();
|
|
318
318
|
let env = &context.env;
|
|
@@ -120,7 +120,7 @@ fn test_quote_zro_unavailable_when_pay_in_zro() {
|
|
|
120
120
|
let params = default_params(env, dst_eid, true);
|
|
121
121
|
|
|
122
122
|
let result = endpoint_client.try_quote(&sender, ¶ms);
|
|
123
|
-
assert_eq!(result.err().unwrap().ok().unwrap(), EndpointError::
|
|
123
|
+
assert_eq!(result.err().unwrap().ok().unwrap(), EndpointError::ZroUnavailable.into());
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
#[test]
|
|
@@ -20,7 +20,7 @@ use crate::{tests::endpoint_setup::setup, EndpointV2};
|
|
|
20
20
|
|
|
21
21
|
// Unauthorized caller is rejected
|
|
22
22
|
#[test]
|
|
23
|
-
#[should_panic(expected = "Error(Contract, #
|
|
23
|
+
#[should_panic(expected = "Error(Contract, #22)")] // EndpointError::Unauthorized
|
|
24
24
|
fn test_require_oapp_auth_unauthorized() {
|
|
25
25
|
let context = setup();
|
|
26
26
|
let env = &context.env;
|
|
@@ -36,7 +36,7 @@ fn test_require_oapp_auth_unauthorized() {
|
|
|
36
36
|
|
|
37
37
|
// Wrong delegate is rejected
|
|
38
38
|
#[test]
|
|
39
|
-
#[should_panic(expected = "Error(Contract, #
|
|
39
|
+
#[should_panic(expected = "Error(Contract, #22)")] // EndpointError::Unauthorized
|
|
40
40
|
fn test_require_oapp_auth_wrong_delegate() {
|
|
41
41
|
let context = setup();
|
|
42
42
|
let env = &context.env;
|
|
@@ -238,7 +238,7 @@ fn test_send_zro_unavailable_when_pay_in_zro() {
|
|
|
238
238
|
let params = default_params(env, 998u32, true);
|
|
239
239
|
context.mock_auth(&sender, "send", (&sender, ¶ms, &refund_address));
|
|
240
240
|
let result = endpoint_client.try_send(&sender, ¶ms, &refund_address);
|
|
241
|
-
assert_eq!(result.err().unwrap().ok().unwrap(), EndpointError::
|
|
241
|
+
assert_eq!(result.err().unwrap().ok().unwrap(), EndpointError::ZroUnavailable.into());
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
#[test]
|
|
@@ -260,7 +260,7 @@ fn test_send_zero_zro_fee_when_pay_in_zro_true() {
|
|
|
260
260
|
let params = default_params(env, dst_eid, true);
|
|
261
261
|
context.mock_auth(&sender, "send", (&sender, ¶ms, &refund_address));
|
|
262
262
|
let result = endpoint_client.try_send(&sender, ¶ms, &refund_address);
|
|
263
|
-
assert_eq!(result.err().unwrap().ok().unwrap(), EndpointError::
|
|
263
|
+
assert_eq!(result.err().unwrap().ok().unwrap(), EndpointError::ZeroZroFee.into());
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
#[test]
|
|
@@ -285,7 +285,7 @@ fn test_send_insufficient_zro_fee() {
|
|
|
285
285
|
let params = default_params(env, dst_eid, true);
|
|
286
286
|
context.mock_auth(&sender, "send", (&sender, ¶ms, &refund_address));
|
|
287
287
|
let result = endpoint_client.try_send(&sender, ¶ms, &refund_address);
|
|
288
|
-
assert_eq!(result.err().unwrap().ok().unwrap(), EndpointError::
|
|
288
|
+
assert_eq!(result.err().unwrap().ok().unwrap(), EndpointError::InsufficientZroFee.into());
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
// Nonce Management
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
use soroban_sdk::{testutils::Address as _, Address};
|
|
2
2
|
use utils::testing_utils::assert_event;
|
|
3
3
|
|
|
4
|
-
use crate::{events::
|
|
4
|
+
use crate::{events::ZroSet, tests::endpoint_setup::setup, tests::endpoint_setup::TestSetup};
|
|
5
5
|
|
|
6
6
|
// Helpers
|
|
7
7
|
fn set_zro_with_auth(context: &TestSetup, zro: &Address) {
|
|
@@ -23,7 +23,7 @@ fn test_set_zro() {
|
|
|
23
23
|
set_zro_with_auth(&context, &context.zro_token_client.address);
|
|
24
24
|
|
|
25
25
|
// Verify event emission.
|
|
26
|
-
assert_event(env, &endpoint_client.address,
|
|
26
|
+
assert_event(env, &endpoint_client.address, ZroSet { zro: context.zro_token_client.address.clone() });
|
|
27
27
|
|
|
28
28
|
// Verify state update via public interface.
|
|
29
29
|
let zro_token = endpoint_client.zro();
|
|
@@ -43,12 +43,12 @@ fn test_set_zro_overwrites_existing_zro() {
|
|
|
43
43
|
|
|
44
44
|
// Set ZRO to the first address.
|
|
45
45
|
set_zro_with_auth(&context, &context.zro_token_client.address);
|
|
46
|
-
assert_event(env, &endpoint_client.address,
|
|
46
|
+
assert_event(env, &endpoint_client.address, ZroSet { zro: context.zro_token_client.address.clone() });
|
|
47
47
|
assert_eq!(endpoint_client.zro(), Some(context.zro_token_client.address.clone()));
|
|
48
48
|
|
|
49
49
|
// Overwrite ZRO with the second address.
|
|
50
50
|
set_zro_with_auth(&context, &zro_addr_2);
|
|
51
|
-
assert_event(env, &endpoint_client.address,
|
|
51
|
+
assert_event(env, &endpoint_client.address, ZroSet { zro: zro_addr_2.clone() });
|
|
52
52
|
assert_eq!(endpoint_client.zro(), Some(zro_addr_2));
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -4,7 +4,7 @@ use crate::{tests::endpoint_setup::setup, EndpointV2, MessageLibType};
|
|
|
4
4
|
|
|
5
5
|
// The require_receive_lib_for_eid internal validation (registered + type + supported_eid)
|
|
6
6
|
#[test]
|
|
7
|
-
#[should_panic(expected = "Error(Contract, #
|
|
7
|
+
#[should_panic(expected = "Error(Contract, #16)")] // EndpointError::OnlyRegisteredLib
|
|
8
8
|
fn test_require_receive_lib_for_eid_unregistered_lib() {
|
|
9
9
|
let context = setup();
|
|
10
10
|
let env = &context.env;
|
|
@@ -15,7 +15,7 @@ fn test_require_receive_lib_for_eid_unregistered_lib() {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
#[test]
|
|
18
|
-
#[should_panic(expected = "Error(Contract, #
|
|
18
|
+
#[should_panic(expected = "Error(Contract, #15)")] // EndpointError::OnlyReceiveLib
|
|
19
19
|
fn test_require_receive_lib_for_eid_wrong_lib_type() {
|
|
20
20
|
let context = setup();
|
|
21
21
|
let env = &context.env;
|
|
@@ -28,7 +28,7 @@ fn test_require_receive_lib_for_eid_wrong_lib_type() {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
#[test]
|
|
31
|
-
#[should_panic(expected = "Error(Contract, #
|
|
31
|
+
#[should_panic(expected = "Error(Contract, #23)")] // EndpointError::UnsupportedEid
|
|
32
32
|
fn test_require_receive_lib_for_eid_unsupported_eid() {
|
|
33
33
|
let context = setup();
|
|
34
34
|
let env = &context.env;
|
|
@@ -8,7 +8,7 @@ use crate::{
|
|
|
8
8
|
// Unit tests for require functions
|
|
9
9
|
|
|
10
10
|
#[test]
|
|
11
|
-
#[should_panic(expected = "Error(Contract, #
|
|
11
|
+
#[should_panic(expected = "Error(Contract, #16)")] // EndpointError::OnlyRegisteredLib
|
|
12
12
|
fn test_require_registered_with_unregistered_lib() {
|
|
13
13
|
let context = setup();
|
|
14
14
|
let env = &context.env;
|
|
@@ -4,7 +4,7 @@ use crate::{tests::endpoint_setup::setup, EndpointV2, MessageLibType};
|
|
|
4
4
|
|
|
5
5
|
// The require_send_lib_for_eid internal validation (registered + type + supported_eid)
|
|
6
6
|
#[test]
|
|
7
|
-
#[should_panic(expected = "Error(Contract, #
|
|
7
|
+
#[should_panic(expected = "Error(Contract, #16)")] // EndpointError::OnlyRegisteredLib
|
|
8
8
|
fn test_require_send_lib_for_eid_unregistered_lib() {
|
|
9
9
|
let context = setup();
|
|
10
10
|
let env = &context.env;
|
|
@@ -15,7 +15,7 @@ fn test_require_send_lib_for_eid_unregistered_lib() {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
#[test]
|
|
18
|
-
#[should_panic(expected = "Error(Contract, #
|
|
18
|
+
#[should_panic(expected = "Error(Contract, #17)")] // EndpointError::OnlySendLib
|
|
19
19
|
fn test_require_send_lib_for_eid_wrong_lib_type() {
|
|
20
20
|
let context = setup();
|
|
21
21
|
let env = &context.env;
|
|
@@ -28,7 +28,7 @@ fn test_require_send_lib_for_eid_wrong_lib_type() {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
#[test]
|
|
31
|
-
#[should_panic(expected = "Error(Contract, #
|
|
31
|
+
#[should_panic(expected = "Error(Contract, #23)")] // EndpointError::UnsupportedEid
|
|
32
32
|
fn test_require_send_lib_for_eid_unsupported_eid() {
|
|
33
33
|
let context = setup();
|
|
34
34
|
let env = &context.env;
|
|
@@ -15,7 +15,7 @@ fn test_require_supported_eid_with_supported() {
|
|
|
15
15
|
|
|
16
16
|
// The require_supported_eid rejects when the library does not support the EID
|
|
17
17
|
#[test]
|
|
18
|
-
#[should_panic(expected = "Error(Contract, #
|
|
18
|
+
#[should_panic(expected = "Error(Contract, #23)")] // EndpointError::UnsupportedEid
|
|
19
19
|
fn test_require_supported_eid_with_unsupported() {
|
|
20
20
|
let context = setup();
|
|
21
21
|
let env = &context.env;
|
|
@@ -119,7 +119,7 @@ fn test_clear_payload_does_not_update_lazy_nonce_when_nonce_is_not_greater() {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
#[test]
|
|
122
|
-
#[should_panic(expected = "Error(Contract, #
|
|
122
|
+
#[should_panic(expected = "Error(Contract, #20)")] // EndpointError::PayloadHashNotFound
|
|
123
123
|
fn test_clear_payload_payload_hash_not_found_when_nonce_is_checkpointed_but_missing() {
|
|
124
124
|
let context = setup();
|
|
125
125
|
let env = &context.env;
|
|
@@ -143,7 +143,7 @@ fn test_clear_payload_payload_hash_not_found_when_nonce_is_checkpointed_but_miss
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
#[test]
|
|
146
|
-
#[should_panic(expected = "Error(Contract, #
|
|
146
|
+
#[should_panic(expected = "Error(Contract, #20)")] // EndpointError::PayloadHashNotFound
|
|
147
147
|
fn test_clear_payload_wrong_payload() {
|
|
148
148
|
let context = setup();
|
|
149
149
|
let env = &context.env;
|
|
@@ -164,7 +164,7 @@ fn test_clear_payload_wrong_payload() {
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
#[test]
|
|
167
|
-
#[should_panic(expected = "Error(Contract, #
|
|
167
|
+
#[should_panic(expected = "Error(Contract, #11)")] // EndpointError::InvalidNonce
|
|
168
168
|
fn test_clear_payload_not_stored() {
|
|
169
169
|
let context = setup();
|
|
170
170
|
let env = &context.env;
|
|
@@ -179,7 +179,7 @@ fn test_clear_payload_not_stored() {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
#[test]
|
|
182
|
-
#[should_panic(expected = "Error(Contract, #
|
|
182
|
+
#[should_panic(expected = "Error(Contract, #11)")] // EndpointError::InvalidNonce
|
|
183
183
|
fn test_clear_payload_missing_intermediate_nonce() {
|
|
184
184
|
let context = setup();
|
|
185
185
|
let env = &context.env;
|
|
@@ -76,7 +76,7 @@ fn test_inbound_overwrites_same_nonce() {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
#[test]
|
|
79
|
-
#[should_panic(expected = "Error(Contract, #
|
|
79
|
+
#[should_panic(expected = "Error(Contract, #12)")] // EndpointError::InvalidPayloadHash
|
|
80
80
|
fn test_inbound_rejects_empty_payload_hash() {
|
|
81
81
|
let context = setup();
|
|
82
82
|
let env = &context.env;
|
|
@@ -9,17 +9,14 @@ use crate::{
|
|
|
9
9
|
types::{empty_payload_hash, nil_payload_hash, ExecutionState, VerificationState},
|
|
10
10
|
LayerZeroViewError,
|
|
11
11
|
};
|
|
12
|
-
use common_macros::{contract_impl,
|
|
12
|
+
use common_macros::{contract_impl, lz_contract};
|
|
13
13
|
use endpoint_v2::{LayerZeroEndpointV2Client, MessageLibManagerClient, MessagingChannelClient, Origin};
|
|
14
14
|
use message_lib_common::packet_codec_v1::{decode_packet_header, PacketHeader};
|
|
15
|
-
use soroban_sdk::{address_payload::AddressPayload, assert_with_error,
|
|
15
|
+
use soroban_sdk::{address_payload::AddressPayload, assert_with_error, Address, Bytes, BytesN, Env};
|
|
16
16
|
use uln302::ReceiveUln302Client;
|
|
17
17
|
use utils::upgradeable::UpgradeableInternal;
|
|
18
18
|
|
|
19
|
-
#[
|
|
20
|
-
#[ttl_configurable]
|
|
21
|
-
#[upgradeable]
|
|
22
|
-
#[ownable]
|
|
19
|
+
#[lz_contract(upgradeable)]
|
|
23
20
|
pub struct LayerZeroView;
|
|
24
21
|
|
|
25
22
|
#[contract_impl]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
use soroban_sdk::{contract, contractimpl, Address, Env};
|
|
2
2
|
|
|
3
3
|
mod initialization;
|
|
4
|
-
mod
|
|
4
|
+
mod only_auth_guard;
|
|
5
5
|
mod ownership_transfer;
|
|
6
6
|
|
|
7
7
|
/// Shared contract used by ownable runtime tests.
|
|
@@ -15,7 +15,7 @@ impl TestContract {
|
|
|
15
15
|
Self::init_owner(&env, &owner);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
#[common_macros::
|
|
18
|
+
#[common_macros::only_auth]
|
|
19
19
|
pub fn guarded(env: &Env) {
|
|
20
20
|
let _ = env;
|
|
21
21
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// UI (trybuild) negative test: `#[
|
|
1
|
+
// UI (trybuild) negative test: `#[only_auth]` requires an `Env` parameter.
|
|
2
2
|
//
|
|
3
3
|
// Purpose:
|
|
4
4
|
// - Ensures the macro fails compilation when applied to a function that does not accept `Env`.
|
|
5
5
|
// - Validates the downstream UX: macro misuse should surface as a compile-time error.
|
|
6
6
|
|
|
7
|
-
use soroban_sdk::{contract, contractimpl};
|
|
7
|
+
use soroban_sdk::{contract, contractimpl, Address};
|
|
8
8
|
|
|
9
9
|
#[contract]
|
|
10
10
|
#[common_macros::ownable]
|
|
@@ -13,7 +13,7 @@ pub struct MyContract;
|
|
|
13
13
|
#[contractimpl]
|
|
14
14
|
impl MyContract {
|
|
15
15
|
// Intentionally missing `Env`: should fail during macro expansion.
|
|
16
|
-
#[common_macros::
|
|
16
|
+
#[common_macros::only_auth]
|
|
17
17
|
pub fn bad(x: u32) {
|
|
18
18
|
let _ = x;
|
|
19
19
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
error: custom attribute panicked
|
|
2
|
-
--> tests/ui/ownable/fail/
|
|
2
|
+
--> tests/ui/ownable/fail/only_auth_missing_env.rs:16:5
|
|
3
3
|
|
|
|
4
|
-
16 | #[common_macros::
|
|
5
|
-
|
|
|
4
|
+
16 | #[common_macros::only_auth]
|
|
5
|
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
6
6
|
|
|
|
7
7
|
= help: message: function must have an Env argument
|
|
8
8
|
|
|
9
9
|
error[E0599]: no function or associated item named `bad` found for struct `MyContract` in the current scope
|
|
10
|
-
--> tests/ui/ownable/fail/
|
|
10
|
+
--> tests/ui/ownable/fail/only_auth_missing_env.rs:17:12
|
|
11
11
|
|
|
|
12
12
|
11 | pub struct MyContract;
|
|
13
13
|
| --------------------- function or associated item `bad` not found for this struct
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
// UI (trybuild) test: macro expansion
|
|
1
|
+
// UI (trybuild) test: macro expansion works with fully-qualified trait paths.
|
|
2
2
|
//
|
|
3
3
|
// Purpose:
|
|
4
4
|
// - Ensures a downstream crate can use the generated `Ownable` trait impl via a fully-qualified path
|
|
5
5
|
// without importing `utils::ownable::Ownable` into scope.
|
|
6
|
-
// - Catches regressions where the macro-generated code would require extra `use` statements.
|
|
7
6
|
|
|
8
|
-
use soroban_sdk::{contract, contractimpl, Env};
|
|
7
|
+
use soroban_sdk::{contract, contractimpl, Address, Env};
|
|
9
8
|
|
|
10
9
|
#[contract]
|
|
11
10
|
#[common_macros::ownable]
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// UI (trybuild) test: `#[
|
|
1
|
+
// UI (trybuild) test: `#[only_auth]` supports different `Env` parameter placements.
|
|
2
2
|
//
|
|
3
3
|
// Purpose:
|
|
4
|
-
// - Verifies `#[common_macros::
|
|
4
|
+
// - Verifies `#[common_macros::only_auth]` can locate an `Env` argument in the function signature,
|
|
5
5
|
// even when `Env` is not the first parameter.
|
|
6
|
-
// - Uses `&Env` forms to match the most common `
|
|
6
|
+
// - Uses `&Env` forms to match the most common `require_auth` signature shape.
|
|
7
7
|
|
|
8
|
-
use soroban_sdk::{contract, Env};
|
|
8
|
+
use soroban_sdk::{contract, Address, Env};
|
|
9
9
|
|
|
10
10
|
#[contract]
|
|
11
11
|
#[common_macros::ownable]
|
|
@@ -13,31 +13,31 @@ pub struct MyContract;
|
|
|
13
13
|
|
|
14
14
|
impl MyContract {
|
|
15
15
|
// `Env` as the first argument, by reference.
|
|
16
|
-
#[common_macros::
|
|
16
|
+
#[common_macros::only_auth]
|
|
17
17
|
pub fn f1(env: &Env) {
|
|
18
18
|
let _ = env;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
// `Env` not in the first position.
|
|
22
|
-
#[common_macros::
|
|
22
|
+
#[common_macros::only_auth]
|
|
23
23
|
pub fn f2(x: u32, env: &Env) {
|
|
24
24
|
let _ = (x, env);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
// `Env` using a fully-qualified type path.
|
|
28
|
-
#[common_macros::
|
|
28
|
+
#[common_macros::only_auth]
|
|
29
29
|
pub fn f3(env: &soroban_sdk::Env) {
|
|
30
30
|
let _ = env;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
// Env by value
|
|
34
|
-
#[common_macros::
|
|
34
|
+
#[common_macros::only_auth]
|
|
35
35
|
pub fn f4(env: Env) {
|
|
36
36
|
let _ = env;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
// Qualified Env by value, not first param
|
|
40
|
-
#[common_macros::
|
|
40
|
+
#[common_macros::only_auth]
|
|
41
41
|
pub fn f5(x: u32, env: soroban_sdk::Env) {
|
|
42
42
|
let _ = (x, env);
|
|
43
43
|
}
|
package/contracts/macro-integration-tests/tests/ui/ttl_configurable/pass/minimal_contract.rs
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
// UI (trybuild) test: `#[ttl_configurable]` on a minimal contract compiles.
|
|
1
|
+
// UI (trybuild) test: `#[ttl_configurable]` and `#[ttl_extendable]` on a minimal contract compiles.
|
|
2
2
|
//
|
|
3
3
|
// Purpose:
|
|
4
4
|
// - Ensures `#[common_macros::ttl_configurable]` can be applied to a contract struct in a downstream crate.
|
|
5
5
|
// - Validates the macro-generated `utils::ttl::TtlConfigurable` trait impl exists and is callable.
|
|
6
|
-
// - Validates `#[
|
|
7
|
-
// downstream imports or special setup.
|
|
6
|
+
// - Validates `#[ttl_extendable]` generates the `extend_instance_ttl` function.
|
|
8
7
|
// - Avoids snapshotting token output; compilation success + type-checking is the integration contract.
|
|
9
8
|
|
|
10
|
-
use common_macros::{ownable, ttl_configurable};
|
|
9
|
+
use common_macros::{ownable, ttl_configurable, ttl_extendable};
|
|
11
10
|
use soroban_sdk::{contract, contractimpl, Address, Env};
|
|
11
|
+
use utils::ttl_configurable::TtlConfig;
|
|
12
12
|
|
|
13
13
|
#[contract]
|
|
14
14
|
#[ttl_configurable]
|
|
15
|
+
#[ttl_extendable]
|
|
15
16
|
#[ownable]
|
|
16
17
|
pub struct MyContract;
|
|
17
18
|
|
|
@@ -19,7 +20,6 @@ pub struct MyContract;
|
|
|
19
20
|
impl MyContract {
|
|
20
21
|
// Provide a small init entry to type-check the injected ownable helper exists.
|
|
21
22
|
pub fn init(env: Env, owner: Address) {
|
|
22
|
-
// `init_owner` should exist because `#[ttl_configurable]` injects `#[ownable]`.
|
|
23
23
|
Self::init_owner(&env, &owner);
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -36,7 +36,7 @@ impl MyContract {
|
|
|
36
36
|
Self::set_ttl_configs(&env, &none, &none);
|
|
37
37
|
Self::freeze_ttl_configs(&env);
|
|
38
38
|
|
|
39
|
-
// Type-check the
|
|
39
|
+
// Type-check the manual instance TTL extender from #[ttl_extendable].
|
|
40
40
|
Self::extend_instance_ttl(&env, 1, 2);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
use common_macros::contract_error;
|
|
2
2
|
|
|
3
|
+
// Message Lib Common error codes: 1100-1199
|
|
4
|
+
// See ERROR_SPEC.md for allocation rules
|
|
5
|
+
|
|
6
|
+
/// PacketCodecV1Error: 1100-1109
|
|
3
7
|
#[contract_error]
|
|
4
8
|
pub enum PacketCodecV1Error {
|
|
5
|
-
InvalidPacketHeader =
|
|
9
|
+
InvalidPacketHeader = 1100,
|
|
6
10
|
InvalidPacketVersion,
|
|
7
11
|
}
|
|
8
12
|
|
|
13
|
+
/// WorkerOptionsError: 1110-1119
|
|
9
14
|
#[contract_error]
|
|
10
15
|
pub enum WorkerOptionsError {
|
|
11
|
-
InvalidBytesLength =
|
|
16
|
+
InvalidBytesLength = 1110,
|
|
12
17
|
InvalidLegacyOptionsType1,
|
|
13
18
|
InvalidLegacyOptionsType2,
|
|
14
19
|
InvalidOptionType,
|
package/contracts/message-libs/message-lib-common/src/tests/packet_codec_v1/decode_packet_header.rs
CHANGED
|
@@ -3,7 +3,7 @@ use crate::packet_codec_v1::{decode_packet_header, HEADER_LENGTH, PACKET_VERSION
|
|
|
3
3
|
use soroban_sdk::{Bytes, BytesN, Env};
|
|
4
4
|
|
|
5
5
|
#[test]
|
|
6
|
-
#[should_panic(expected = "Error(Contract, #
|
|
6
|
+
#[should_panic(expected = "Error(Contract, #1100)")] // PacketCodecV1Error::InvalidPacketHeader
|
|
7
7
|
fn test_decode_packet_header_rejects_invalid_length() {
|
|
8
8
|
let env = Env::default();
|
|
9
9
|
// Only 3 bytes instead of HEADER_LENGTH.
|
|
@@ -12,7 +12,7 @@ fn test_decode_packet_header_rejects_invalid_length() {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
#[test]
|
|
15
|
-
#[should_panic(expected = "Error(Contract, #
|
|
15
|
+
#[should_panic(expected = "Error(Contract, #1101)")] // PacketCodecV1Error::InvalidPacketVersion
|
|
16
16
|
fn test_decode_packet_header_rejects_invalid_version() {
|
|
17
17
|
let env = Env::default();
|
|
18
18
|
// Correct length, wrong version.
|
|
@@ -23,7 +23,7 @@ fn test_decode_packet_header_rejects_invalid_version() {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
#[test]
|
|
26
|
-
#[should_panic(expected = "Error(Contract, #
|
|
26
|
+
#[should_panic(expected = "Error(Contract, #1100)")] // PacketCodecV1Error::InvalidPacketHeader
|
|
27
27
|
fn test_decode_packet_header_rejects_too_long_length() {
|
|
28
28
|
let env = Env::default();
|
|
29
29
|
// HEADER_LENGTH + 1 bytes should still be rejected (length must be exactly HEADER_LENGTH).
|
package/contracts/message-libs/message-lib-common/src/tests/worker_options/convert_legacy_options.rs
CHANGED
|
@@ -183,7 +183,7 @@ fn test_convert_legacy_options_type2_allows_u128_max_gas_and_amount() {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
#[test]
|
|
186
|
-
#[should_panic(expected = "Error(Contract, #
|
|
186
|
+
#[should_panic(expected = "Error(Contract, #1116)")] // WorkerOptionsError::LegacyOptionsType1GasOverflow
|
|
187
187
|
fn test_convert_legacy_options_type1_rejects_gas_overflow() {
|
|
188
188
|
let env = Env::default();
|
|
189
189
|
// Minimal overflow value: u128::MAX + 1 == 2^128
|
|
@@ -194,7 +194,7 @@ fn test_convert_legacy_options_type1_rejects_gas_overflow() {
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
#[test]
|
|
197
|
-
#[should_panic(expected = "Error(Contract, #
|
|
197
|
+
#[should_panic(expected = "Error(Contract, #1118)")] // WorkerOptionsError::LegacyOptionsType2GasOverflow
|
|
198
198
|
fn test_convert_legacy_options_type2_rejects_gas_overflow() {
|
|
199
199
|
let env = Env::default();
|
|
200
200
|
let legacy_options = Bytes::from_slice(
|
|
@@ -209,7 +209,7 @@ fn test_convert_legacy_options_type2_rejects_gas_overflow() {
|
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
#[test]
|
|
212
|
-
#[should_panic(expected = "Error(Contract, #
|
|
212
|
+
#[should_panic(expected = "Error(Contract, #1117)")] // WorkerOptionsError::LegacyOptionsType2AmountOverflow
|
|
213
213
|
fn test_convert_legacy_options_type2_rejects_amount_overflow() {
|
|
214
214
|
let env = Env::default();
|
|
215
215
|
let legacy_options = Bytes::from_slice(
|
|
@@ -224,7 +224,7 @@ fn test_convert_legacy_options_type2_rejects_amount_overflow() {
|
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
#[test]
|
|
227
|
-
#[should_panic(expected = "Error(Contract, #
|
|
227
|
+
#[should_panic(expected = "Error(Contract, #1112)")] // WorkerOptionsError::InvalidLegacyOptionsType2
|
|
228
228
|
fn test_convert_legacy_options_type2_rejects_receiver_longer_than_32_bytes() {
|
|
229
229
|
let env = Env::default();
|
|
230
230
|
|
|
@@ -239,7 +239,7 @@ fn test_convert_legacy_options_type2_rejects_receiver_longer_than_32_bytes() {
|
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
#[test]
|
|
242
|
-
#[should_panic(expected = "Error(Contract, #
|
|
242
|
+
#[should_panic(expected = "Error(Contract, #1113)")] // WorkerOptionsError::InvalidOptionType
|
|
243
243
|
fn test_convert_legacy_options_rejects_unknown_legacy_type() {
|
|
244
244
|
let env = Env::default();
|
|
245
245
|
let legacy_options = Bytes::from_slice(&env, &[0u8; 32]);
|
|
@@ -247,7 +247,7 @@ fn test_convert_legacy_options_rejects_unknown_legacy_type() {
|
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
#[test]
|
|
250
|
-
#[should_panic(expected = "Error(Contract, #
|
|
250
|
+
#[should_panic(expected = "Error(Contract, #1111)")] // WorkerOptionsError::InvalidLegacyOptionsType1
|
|
251
251
|
fn test_convert_legacy_options_type1_rejects_invalid_size_too_short() {
|
|
252
252
|
let env = Env::default();
|
|
253
253
|
let legacy_options = Bytes::from_slice(&env, &[0u8; 31]); // 31 bytes
|
|
@@ -255,7 +255,7 @@ fn test_convert_legacy_options_type1_rejects_invalid_size_too_short() {
|
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
#[test]
|
|
258
|
-
#[should_panic(expected = "Error(Contract, #
|
|
258
|
+
#[should_panic(expected = "Error(Contract, #1111)")] // WorkerOptionsError::InvalidLegacyOptionsType1
|
|
259
259
|
fn test_convert_legacy_options_type1_rejects_invalid_size_too_long() {
|
|
260
260
|
let env = Env::default();
|
|
261
261
|
let legacy_options = Bytes::from_slice(&env, &[0u8; 33]); // 33 bytes
|
|
@@ -263,7 +263,7 @@ fn test_convert_legacy_options_type1_rejects_invalid_size_too_long() {
|
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
#[test]
|
|
266
|
-
#[should_panic(expected = "Error(Contract, #
|
|
266
|
+
#[should_panic(expected = "Error(Contract, #1112)")] // WorkerOptionsError::InvalidLegacyOptionsType2
|
|
267
267
|
fn test_convert_legacy_options_type2_rejects_invalid_size_too_short() {
|
|
268
268
|
let env = Env::default();
|
|
269
269
|
// 64 bytes (no receiver)
|
|
@@ -272,7 +272,7 @@ fn test_convert_legacy_options_type2_rejects_invalid_size_too_short() {
|
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
#[test]
|
|
275
|
-
#[should_panic(expected = "Error(Contract, #
|
|
275
|
+
#[should_panic(expected = "Error(Contract, #1112)")] // WorkerOptionsError::InvalidLegacyOptionsType2
|
|
276
276
|
fn test_convert_legacy_options_type2_rejects_invalid_size_too_long() {
|
|
277
277
|
let env = Env::default();
|
|
278
278
|
let legacy_options = Bytes::from_slice(&env, &[0u8; 97]); // 97 bytes
|
package/contracts/message-libs/message-lib-common/src/tests/worker_options/extract_type_3_options.rs
CHANGED
|
@@ -116,7 +116,7 @@ fn test_extract_type_3_options_interleaved_executor_and_dvn_keeps_executor_order
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
#[test]
|
|
119
|
-
#[should_panic(expected = "Error(Contract, #
|
|
119
|
+
#[should_panic(expected = "Error(Contract, #1115)")] // WorkerOptionsError::InvalidWorkerId
|
|
120
120
|
fn test_extract_type_3_options_rejects_unknown_worker_id() {
|
|
121
121
|
let env = Env::default();
|
|
122
122
|
// worker_id = 0 (invalid) + option_size = 5 + 5 bytes of dummy data
|
package/contracts/message-libs/message-lib-common/src/tests/worker_options/left_pad_to_bytes32.rs
CHANGED
|
@@ -20,7 +20,7 @@ fn test_left_pad_to_bytes32_pads_left_with_zeros() {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
#[test]
|
|
23
|
-
#[should_panic(expected = "Error(Contract, #
|
|
23
|
+
#[should_panic(expected = "Error(Contract, #1110)")] // WorkerOptionsError::InvalidBytesLength
|
|
24
24
|
fn test_left_pad_to_bytes32_rejects_len_greater_than_32() {
|
|
25
25
|
let env = Env::default();
|
|
26
26
|
let too_long = Bytes::from_slice(&env, &[0u8; 33]);
|
package/contracts/message-libs/message-lib-common/src/tests/worker_options/split_worker_options.rs
CHANGED
|
@@ -122,7 +122,7 @@ fn test_split_worker_options_legacy_type2_converts_to_executor_options() {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
#[test]
|
|
125
|
-
#[should_panic(expected = "Error(Contract, #
|
|
125
|
+
#[should_panic(expected = "Error(Contract, #1114)")] // WorkerOptionsError::InvalidOptions
|
|
126
126
|
fn test_split_worker_options_rejects_too_short_options() {
|
|
127
127
|
let env = Env::default();
|
|
128
128
|
let mut options = Bytes::new(&env);
|
|
@@ -131,7 +131,7 @@ fn test_split_worker_options_rejects_too_short_options() {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
#[test]
|
|
134
|
-
#[should_panic(expected = "Error(Contract, #
|
|
134
|
+
#[should_panic(expected = "Error(Contract, #1114)")] // WorkerOptionsError::InvalidOptions
|
|
135
135
|
fn test_split_worker_options_rejects_empty_options() {
|
|
136
136
|
let env = Env::default();
|
|
137
137
|
let options = Bytes::new(&env);
|