@layerzerolabs/protocol-stellar-v2 0.2.19 → 0.2.21
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 +795 -791
- package/.turbo/turbo-lint.log +325 -155
- package/.turbo/turbo-test.log +1398 -1277
- package/Cargo.lock +122 -111
- package/Cargo.toml +32 -16
- package/contracts/common-macros/Cargo.toml +7 -7
- package/contracts/common-macros/src/auth.rs +18 -37
- package/contracts/common-macros/src/contract_ttl.rs +18 -7
- package/contracts/common-macros/src/lib.rs +31 -14
- package/contracts/common-macros/src/lz_contract.rs +38 -7
- package/contracts/common-macros/src/storage.rs +251 -292
- package/contracts/common-macros/src/tests/contract_ttl.rs +1 -1
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__auth__snapshot_generated_multisig_code.snap +6 -12
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__auth__snapshot_generated_ownable_code.snap +12 -17
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__contract_ttl__snapshot_generated_contractimpl_code.snap +2 -1
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__ttl_configurable__snapshot_generated_ttl_configurable_code.snap +2 -7
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__upgradeable__snapshot_generated_upgradeable_code.snap +20 -14
- package/contracts/common-macros/src/tests/upgradeable.rs +26 -4
- package/contracts/common-macros/src/ttl_configurable.rs +2 -10
- package/contracts/common-macros/src/ttl_extendable.rs +2 -10
- package/contracts/common-macros/src/upgradeable.rs +61 -26
- package/contracts/common-macros/src/utils.rs +0 -9
- package/contracts/endpoint-v2/src/lib.rs +3 -2
- package/contracts/endpoint-v2/src/tests/endpoint_v2/clear.rs +2 -2
- package/contracts/endpoint-v2/src/tests/endpoint_v2/lz_receive_alert.rs +3 -3
- package/contracts/endpoint-v2/src/tests/endpoint_v2/send.rs +4 -4
- package/contracts/endpoint-v2/src/tests/endpoint_v2/set_delegate.rs +17 -5
- package/contracts/endpoint-v2/src/tests/endpoint_v2/set_zro.rs +4 -4
- package/contracts/endpoint-v2/src/tests/endpoint_v2/verify.rs +2 -2
- package/contracts/endpoint-v2/src/tests/message_lib_manager/register_library.rs +2 -2
- package/contracts/endpoint-v2/src/tests/message_lib_manager/set_default_receive_lib_timeout.rs +6 -6
- package/contracts/endpoint-v2/src/tests/message_lib_manager/set_default_receive_library.rs +67 -37
- package/contracts/endpoint-v2/src/tests/message_lib_manager/set_default_send_library.rs +5 -5
- package/contracts/endpoint-v2/src/tests/message_lib_manager/set_receive_library.rs +44 -54
- package/contracts/endpoint-v2/src/tests/message_lib_manager/set_receive_library_timeout.rs +7 -7
- package/contracts/endpoint-v2/src/tests/message_lib_manager/set_send_library.rs +8 -8
- package/contracts/endpoint-v2/src/tests/messaging_channel/burn.rs +3 -3
- package/contracts/endpoint-v2/src/tests/messaging_channel/nilify.rs +4 -4
- package/contracts/endpoint-v2/src/tests/messaging_channel/skip.rs +3 -3
- package/contracts/endpoint-v2/src/tests/messaging_composer/clear_compose.rs +2 -2
- package/contracts/endpoint-v2/src/tests/messaging_composer/lz_compose_alert.rs +3 -3
- package/contracts/endpoint-v2/src/tests/messaging_composer/send_compose.rs +2 -2
- package/contracts/layerzero-views/Cargo.toml +0 -1
- package/contracts/layerzero-views/src/layerzero_view.rs +1 -13
- package/contracts/macro-integration-tests/Cargo.toml +5 -15
- package/contracts/macro-integration-tests/tests/runtime/oapp/mod.rs +48 -0
- package/contracts/macro-integration-tests/tests/runtime/oapp/oapp_core.rs +170 -0
- package/contracts/macro-integration-tests/tests/runtime/oapp/options_type3.rs +154 -0
- package/contracts/macro-integration-tests/tests/runtime/oapp/receiver.rs +338 -0
- package/contracts/macro-integration-tests/tests/runtime/oapp/sender.rs +435 -0
- package/contracts/macro-integration-tests/tests/runtime.rs +1 -0
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/custom_wrong_value.rs +8 -0
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/custom_wrong_value.stderr +5 -0
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/missing_lz_receive_internal.rs +8 -0
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/missing_lz_receive_internal.stderr +71 -0
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/non_struct_input.rs +10 -0
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/non_struct_input.stderr +5 -0
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/unknown_custom_option.rs +8 -0
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/unknown_custom_option.stderr +5 -0
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/wrong_key.rs +8 -0
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/wrong_key.stderr +5 -0
- package/contracts/macro-integration-tests/tests/ui/oapp/pass/custom_all.rs +38 -0
- package/contracts/macro-integration-tests/tests/ui/oapp/pass/custom_single_trait.rs +96 -0
- package/contracts/macro-integration-tests/tests/ui/oapp/pass/minimal_contract.rs +64 -0
- package/contracts/macro-integration-tests/tests/ui/oapp/pass/struct_with_fields.rs +46 -0
- package/contracts/macro-integration-tests/tests/ui/ownable/fail/only_auth_missing_env.stderr +8 -0
- package/contracts/macro-integration-tests/tests/ui/ownable/pass/namespacing_and_imports.rs +1 -1
- package/contracts/macro-integration-tests/tests/ui/ownable/pass/only_auth_env_param_variants.rs +1 -1
- package/contracts/macro-integration-tests/tests/ui_oapp.rs +11 -0
- package/contracts/message-libs/message-lib-common/Cargo.toml +0 -1
- package/contracts/message-libs/message-lib-common/src/errors.rs +1 -1
- package/contracts/message-libs/treasury/Cargo.toml +0 -2
- package/contracts/message-libs/treasury/src/tests/treasury_tests.rs +2 -2
- package/contracts/message-libs/uln-302/src/events.rs +4 -0
- package/contracts/message-libs/uln-302/src/send_uln.rs +22 -6
- package/contracts/message-libs/uln-302/src/tests/receive_uln302/effective_receive_uln_config.rs +2 -2
- package/contracts/message-libs/uln-302/src/tests/receive_uln302/set_default_receive_uln_configs.rs +2 -2
- package/contracts/message-libs/uln-302/src/tests/receive_uln302/verify.rs +2 -2
- package/contracts/message-libs/uln-302/src/tests/send_uln302/effective_executor_config.rs +2 -2
- package/contracts/message-libs/uln-302/src/tests/send_uln302/effective_send_uln_config.rs +2 -2
- package/contracts/message-libs/uln-302/src/tests/send_uln302/send.rs +21 -67
- 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 +2 -2
- package/contracts/oapps/counter/Cargo.toml +5 -6
- package/contracts/oapps/counter/integration_tests/setup_uln.rs +1 -1
- package/contracts/oapps/counter/integration_tests/utils.rs +19 -12
- package/contracts/oapps/oapp/src/errors.rs +1 -1
- package/contracts/oapps/oapp/src/interfaces/mod.rs +3 -0
- package/contracts/oapps/oapp/src/interfaces/oapp_msg_inspector.rs +47 -0
- package/contracts/oapps/oapp/src/lib.rs +1 -0
- package/contracts/oapps/oapp/src/macro_tests/test_macros.rs +4 -4
- package/contracts/oapps/oapp/src/oapp_core.rs +5 -5
- package/contracts/oapps/oapp/src/oapp_options_type3.rs +12 -4
- package/contracts/oapps/oapp/src/oapp_receiver.rs +14 -9
- package/contracts/oapps/oapp/src/tests/mod.rs +4 -4
- package/contracts/oapps/oapp/src/tests/oapp_core.rs +223 -0
- package/contracts/oapps/oapp/src/tests/oapp_options_type3.rs +240 -0
- package/contracts/oapps/oapp/src/tests/oapp_receiver.rs +381 -0
- package/contracts/oapps/oapp/src/tests/oapp_sender.rs +569 -0
- package/contracts/oapps/oapp-macros/Cargo.toml +8 -4
- package/contracts/oapps/oapp-macros/src/generators.rs +9 -34
- package/contracts/oapps/oapp-macros/src/lib.rs +3 -0
- package/contracts/oapps/oapp-macros/src/tests/mod.rs +2 -0
- package/contracts/oapps/oapp-macros/src/tests/oapp.rs +88 -0
- package/contracts/oapps/oapp-macros/src/tests/parse_custom_impls.rs +86 -0
- package/contracts/oapps/oapp-macros/src/tests/snapshots/oapp_macros__tests__oapp__snapshot_generate_oapp.snap +103 -0
- package/contracts/oapps/oft/integration-tests/utils.rs +28 -8
- package/contracts/oapps/oft/src/extensions/oft_fee.rs +153 -75
- package/contracts/oapps/oft/src/extensions/pausable.rs +61 -12
- package/contracts/oapps/oft/src/extensions/rate_limiter.rs +198 -134
- package/contracts/oapps/oft/src/oft.rs +45 -50
- package/contracts/oapps/oft/src/oft_types/lock_unlock.rs +1 -1
- package/contracts/oapps/oft/src/oft_types/mint_burn.rs +4 -26
- package/contracts/oapps/oft-core/Cargo.toml +1 -4
- package/contracts/oapps/oft-core/integration-tests/setup.rs +3 -3
- package/contracts/oapps/oft-core/integration-tests/utils.rs +21 -3
- package/contracts/oapps/oft-core/src/errors.rs +3 -2
- package/contracts/oapps/oft-core/src/events.rs +6 -0
- package/contracts/oapps/oft-core/src/lib.rs +1 -1
- package/contracts/oapps/oft-core/src/oft_core.rs +341 -246
- package/contracts/oapps/oft-core/src/storage.rs +7 -3
- package/contracts/oapps/oft-core/src/tests/mod.rs +1 -0
- package/contracts/oapps/oft-core/src/tests/test_decimals.rs +37 -2
- package/contracts/oapps/oft-core/src/tests/test_lz_receive.rs +2 -2
- package/contracts/oapps/oft-core/src/tests/test_msg_inspector.rs +323 -0
- package/contracts/oapps/oft-core/src/tests/test_send.rs +2 -2
- package/contracts/oapps/oft-core/src/tests/test_utils.rs +61 -16
- package/contracts/upgrader/src/lib.rs +30 -57
- 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 +44 -35
- package/contracts/utils/Cargo.toml +0 -1
- package/contracts/utils/src/buffer_reader.rs +1 -0
- package/contracts/utils/src/errors.rs +4 -2
- package/contracts/utils/src/multisig.rs +17 -8
- package/contracts/utils/src/ownable.rs +6 -6
- package/contracts/utils/src/testing_utils.rs +124 -54
- package/contracts/utils/src/tests/multisig.rs +12 -12
- package/contracts/utils/src/tests/ownable.rs +6 -6
- package/contracts/utils/src/tests/testing_utils.rs +50 -167
- package/contracts/utils/src/tests/ttl_configurable.rs +5 -5
- package/contracts/utils/src/tests/upgradeable.rs +372 -175
- package/contracts/utils/src/ttl_configurable.rs +13 -7
- package/contracts/utils/src/upgradeable.rs +48 -23
- package/contracts/workers/dvn/Cargo.toml +6 -6
- package/contracts/workers/dvn/src/auth.rs +12 -42
- package/contracts/workers/dvn/src/dvn.rs +15 -40
- package/contracts/workers/dvn/src/errors.rs +0 -1
- package/contracts/workers/dvn/src/interfaces/dvn.rs +35 -0
- package/contracts/workers/dvn/src/lib.rs +4 -3
- package/contracts/workers/dvn/src/tests/auth.rs +1 -1
- package/contracts/workers/dvn/src/tests/dvn.rs +19 -15
- package/contracts/workers/dvn/src/tests/multisig/set_threshold.rs +2 -4
- package/contracts/workers/dvn/src/tests/multisig/verify_signatures.rs +1 -3
- package/contracts/workers/dvn/src/tests/setup.rs +5 -9
- package/contracts/workers/dvn-fee-lib/Cargo.toml +2 -2
- package/contracts/workers/dvn-fee-lib/src/dvn_fee_lib.rs +38 -22
- package/contracts/workers/dvn-fee-lib/src/lib.rs +12 -2
- package/contracts/workers/dvn-fee-lib/src/tests/dvn_fee_lib.rs +17 -16
- package/contracts/workers/executor/Cargo.toml +4 -0
- package/contracts/workers/executor/src/executor.rs +15 -36
- package/contracts/workers/executor/src/lib.rs +2 -2
- package/contracts/workers/executor/src/tests/auth.rs +394 -0
- package/contracts/workers/executor/src/tests/executor.rs +410 -0
- package/contracts/workers/executor/src/tests/mod.rs +3 -0
- package/contracts/workers/executor/src/tests/setup.rs +250 -0
- package/contracts/workers/executor-fee-lib/Cargo.toml +7 -1
- package/contracts/workers/executor-fee-lib/src/executor_fee_lib.rs +62 -15
- package/contracts/workers/executor-fee-lib/src/executor_option.rs +28 -1
- package/contracts/workers/executor-fee-lib/src/lib.rs +11 -2
- package/contracts/workers/executor-fee-lib/src/tests/executor_fee_lib.rs +701 -0
- package/contracts/workers/executor-fee-lib/src/tests/executor_option.rs +370 -0
- package/contracts/workers/executor-fee-lib/src/tests/mod.rs +4 -0
- package/contracts/workers/executor-fee-lib/src/tests/setup.rs +60 -0
- package/contracts/workers/executor-helper/Cargo.toml +0 -1
- package/contracts/workers/executor-helper/src/lib.rs +3 -0
- package/contracts/workers/executor-helper/src/tests/executor_helper.rs +184 -0
- package/contracts/workers/executor-helper/src/tests/mod.rs +2 -0
- package/contracts/workers/executor-helper/src/tests/setup.rs +366 -0
- package/contracts/workers/fee-lib-interfaces/Cargo.toml +14 -0
- package/contracts/workers/{worker/src/interfaces/mod.rs → fee-lib-interfaces/src/lib.rs} +4 -3
- package/contracts/workers/price-feed/Cargo.toml +7 -1
- package/contracts/workers/price-feed/src/events.rs +1 -1
- package/contracts/workers/price-feed/src/lib.rs +12 -4
- package/contracts/workers/price-feed/src/price_feed.rs +5 -21
- package/contracts/workers/price-feed/src/storage.rs +1 -1
- package/contracts/workers/price-feed/src/tests/mod.rs +2 -0
- package/contracts/workers/price-feed/src/tests/price_feed.rs +869 -0
- package/contracts/workers/price-feed/src/tests/setup.rs +70 -0
- package/contracts/workers/price-feed/src/types.rs +1 -1
- package/contracts/workers/worker/src/errors.rs +1 -4
- package/contracts/workers/worker/src/lib.rs +0 -2
- package/contracts/workers/worker/src/storage.rs +32 -29
- package/contracts/workers/worker/src/tests/setup.rs +2 -8
- package/contracts/workers/worker/src/tests/worker.rs +96 -74
- package/contracts/workers/worker/src/worker.rs +75 -75
- package/docs/error-spec.md +55 -0
- package/docs/layerzero-v2-on-stellar.md +447 -0
- package/docs/oapp-guide.md +212 -0
- package/docs/oft-guide.md +314 -0
- package/package.json +3 -3
- package/sdk/.turbo/turbo-test.log +268 -263
- package/sdk/dist/generated/bml.d.ts +12 -4
- package/sdk/dist/generated/bml.js +9 -7
- package/sdk/dist/generated/counter.d.ts +306 -298
- package/sdk/dist/generated/counter.js +48 -46
- package/sdk/dist/generated/dvn.d.ts +450 -411
- package/sdk/dist/generated/dvn.js +66 -64
- package/sdk/dist/generated/dvn_fee_lib.d.ts +294 -338
- package/sdk/dist/generated/dvn_fee_lib.js +33 -64
- package/sdk/dist/generated/endpoint.d.ts +108 -100
- package/sdk/dist/generated/endpoint.js +21 -19
- package/sdk/dist/generated/executor.d.ts +414 -370
- package/sdk/dist/generated/executor.js +58 -55
- package/sdk/dist/generated/executor_fee_lib.d.ts +333 -377
- package/sdk/dist/generated/executor_fee_lib.js +34 -65
- package/sdk/dist/generated/executor_helper.d.ts +26 -190
- package/sdk/dist/generated/executor_helper.js +23 -28
- package/sdk/dist/generated/layerzero_view.d.ts +1271 -0
- package/sdk/dist/generated/layerzero_view.js +294 -0
- package/sdk/dist/generated/oft.d.ts +408 -385
- package/sdk/dist/generated/oft.js +89 -92
- package/sdk/dist/generated/price_feed.d.ts +385 -429
- package/sdk/dist/generated/price_feed.js +50 -81
- package/sdk/dist/generated/sml.d.ts +108 -100
- package/sdk/dist/generated/sml.js +21 -19
- package/sdk/dist/generated/treasury.d.ts +108 -100
- package/sdk/dist/generated/treasury.js +21 -19
- package/sdk/dist/generated/uln302.d.ts +108 -100
- package/sdk/dist/generated/uln302.js +23 -21
- package/sdk/dist/generated/upgrader.d.ts +189 -18
- package/sdk/dist/generated/upgrader.js +84 -4
- package/sdk/dist/index.d.ts +1 -0
- package/sdk/dist/index.js +2 -0
- package/sdk/package.json +1 -1
- package/sdk/src/index.ts +3 -0
- package/sdk/test/oft-sml.test.ts +4 -4
- package/sdk/test/suites/localnet.ts +84 -20
- package/sdk/test/upgrader.test.ts +2 -3
- package/tools/ts-bindings-gen/src/main.rs +2 -1
- package/contracts/ERROR_SPEC.md +0 -44
- package/contracts/endpoint-v2/ARCHITECTURE.md +0 -233
- package/contracts/oapps/oapp/src/tests/test_oapp_core.rs +0 -175
- package/contracts/oapps/oapp/src/tests/test_oapp_options_type3.rs +0 -212
- package/contracts/oapps/oapp/src/tests/test_oapp_receiver.rs +0 -153
- package/contracts/oapps/oapp/src/tests/test_oapp_sender.rs +0 -294
- /package/contracts/workers/{worker/src/interfaces → fee-lib-interfaces/src}/dvn_fee_lib.rs +0 -0
- /package/contracts/workers/{worker/src/interfaces → fee-lib-interfaces/src}/executor_fee_lib.rs +0 -0
- /package/contracts/workers/{worker/src/interfaces → fee-lib-interfaces/src}/price_feed.rs +0 -0
|
@@ -2,7 +2,7 @@ use soroban_sdk::{
|
|
|
2
2
|
testutils::{Address as _, Ledger},
|
|
3
3
|
vec, Address,
|
|
4
4
|
};
|
|
5
|
-
use utils::testing_utils::
|
|
5
|
+
use utils::testing_utils::{assert_contains_event, assert_contains_events};
|
|
6
6
|
|
|
7
7
|
use crate::{
|
|
8
8
|
errors::EndpointError,
|
|
@@ -94,12 +94,14 @@ fn test_set_default_receive_library_success() {
|
|
|
94
94
|
context.set_default_receive_library_with_auth(context.eid, &receive_lib, 0);
|
|
95
95
|
|
|
96
96
|
// Verify event emission.
|
|
97
|
-
|
|
97
|
+
assert_contains_events(
|
|
98
98
|
env,
|
|
99
99
|
&endpoint_client.address,
|
|
100
|
-
|
|
100
|
+
&[
|
|
101
|
+
&DefaultReceiveLibrarySet { src_eid: context.eid, new_lib: receive_lib.clone() },
|
|
102
|
+
&DefaultReceiveLibTimeoutSet { src_eid: context.eid, timeout: None },
|
|
103
|
+
],
|
|
101
104
|
);
|
|
102
|
-
assert_event(env, &endpoint_client.address, DefaultReceiveLibTimeoutSet { src_eid: context.eid, timeout: None });
|
|
103
105
|
|
|
104
106
|
// Verify state update via public interface.
|
|
105
107
|
assert_eq!(endpoint_client.default_receive_library(&context.eid), Some(receive_lib.clone()));
|
|
@@ -137,15 +139,13 @@ fn test_set_default_receive_library_success_with_grace_period() {
|
|
|
137
139
|
let expected_timeout = Some(Timeout { lib: receive_lib.clone(), expiry: current_timestamp + grace_period });
|
|
138
140
|
|
|
139
141
|
// Verify event emission (from the second call).
|
|
140
|
-
|
|
142
|
+
assert_contains_events(
|
|
141
143
|
env,
|
|
142
144
|
&endpoint_client.address,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
&endpoint_client.address,
|
|
148
|
-
DefaultReceiveLibTimeoutSet { src_eid: context.eid, timeout: expected_timeout.clone() },
|
|
145
|
+
&[
|
|
146
|
+
&DefaultReceiveLibrarySet { src_eid: context.eid, new_lib: new_receive_lib.clone() },
|
|
147
|
+
&DefaultReceiveLibTimeoutSet { src_eid: context.eid, timeout: expected_timeout.clone() },
|
|
148
|
+
],
|
|
149
149
|
);
|
|
150
150
|
|
|
151
151
|
// Verify state update via public interface.
|
|
@@ -170,12 +170,14 @@ fn test_set_default_receive_library_grace_period_with_no_previous_default_sets_n
|
|
|
170
170
|
context.set_default_receive_library_with_auth(context.eid, &receive_lib, grace_period);
|
|
171
171
|
|
|
172
172
|
// Timeout must be None because there was no previous default to keep alive.
|
|
173
|
-
|
|
173
|
+
assert_contains_events(
|
|
174
174
|
env,
|
|
175
175
|
&endpoint_client.address,
|
|
176
|
-
|
|
176
|
+
&[
|
|
177
|
+
&DefaultReceiveLibrarySet { src_eid: context.eid, new_lib: receive_lib.clone() },
|
|
178
|
+
&DefaultReceiveLibTimeoutSet { src_eid: context.eid, timeout: None },
|
|
179
|
+
],
|
|
177
180
|
);
|
|
178
|
-
assert_event(env, &endpoint_client.address, DefaultReceiveLibTimeoutSet { src_eid: context.eid, timeout: None });
|
|
179
181
|
|
|
180
182
|
assert_eq!(endpoint_client.default_receive_library(&context.eid), Some(receive_lib));
|
|
181
183
|
assert_eq!(endpoint_client.default_receive_library_timeout(&context.eid), None);
|
|
@@ -206,23 +208,31 @@ fn test_set_default_receive_library_grace_period_zero_clears_timeout() {
|
|
|
206
208
|
|
|
207
209
|
// A: initial set (no timeout).
|
|
208
210
|
context.set_default_receive_library_with_auth(src_eid, &lib_a, 0);
|
|
209
|
-
|
|
210
|
-
|
|
211
|
+
assert_contains_events(
|
|
212
|
+
env,
|
|
213
|
+
&endpoint_client.address,
|
|
214
|
+
&[
|
|
215
|
+
&DefaultReceiveLibrarySet { src_eid, new_lib: lib_a.clone() },
|
|
216
|
+
&DefaultReceiveLibTimeoutSet { src_eid, timeout: None },
|
|
217
|
+
],
|
|
218
|
+
);
|
|
211
219
|
|
|
212
220
|
// B: rotate with grace -> timeout for A must be set.
|
|
213
221
|
context.set_default_receive_library_with_auth(src_eid, &lib_b, grace_period);
|
|
214
222
|
let expected_timeout_b = Some(Timeout { lib: lib_a.clone(), expiry: current_timestamp + grace_period });
|
|
215
|
-
|
|
216
|
-
assert_event(
|
|
223
|
+
assert_contains_events(
|
|
217
224
|
env,
|
|
218
225
|
&endpoint_client.address,
|
|
219
|
-
|
|
226
|
+
&[
|
|
227
|
+
&DefaultReceiveLibrarySet { src_eid, new_lib: lib_b.clone() },
|
|
228
|
+
&DefaultReceiveLibTimeoutSet { src_eid, timeout: expected_timeout_b.clone() },
|
|
229
|
+
],
|
|
220
230
|
);
|
|
221
231
|
|
|
222
232
|
// C: rotate with grace=0 -> timeout must be cleared (None).
|
|
223
233
|
context.set_default_receive_library_with_auth(src_eid, &lib_c, 0);
|
|
224
|
-
|
|
225
|
-
|
|
234
|
+
assert_contains_event(env, &endpoint_client.address, DefaultReceiveLibrarySet { src_eid, new_lib: lib_c.clone() });
|
|
235
|
+
assert_contains_event(env, &endpoint_client.address, DefaultReceiveLibTimeoutSet { src_eid, timeout: None });
|
|
226
236
|
|
|
227
237
|
assert_eq!(endpoint_client.default_receive_library(&src_eid), Some(lib_c));
|
|
228
238
|
assert_eq!(endpoint_client.default_receive_library_timeout(&src_eid), None);
|
|
@@ -252,14 +262,26 @@ fn test_set_default_receive_library_multi_rotation_timeout_uses_immediate_previo
|
|
|
252
262
|
|
|
253
263
|
// A initial.
|
|
254
264
|
context.set_default_receive_library_with_auth(src_eid, &lib_a, 0);
|
|
255
|
-
|
|
256
|
-
|
|
265
|
+
assert_contains_events(
|
|
266
|
+
env,
|
|
267
|
+
&endpoint_client.address,
|
|
268
|
+
&[
|
|
269
|
+
&DefaultReceiveLibrarySet { src_eid, new_lib: lib_a.clone() },
|
|
270
|
+
&DefaultReceiveLibTimeoutSet { src_eid, timeout: None },
|
|
271
|
+
],
|
|
272
|
+
);
|
|
257
273
|
|
|
258
274
|
// Rotate A -> B with grace=1000 => keep A.
|
|
259
275
|
context.set_default_receive_library_with_auth(src_eid, &lib_b, 1_000);
|
|
260
276
|
let expected_timeout_b = Some(Timeout { lib: lib_a.clone(), expiry: t0 + 1_000 });
|
|
261
|
-
|
|
262
|
-
|
|
277
|
+
assert_contains_events(
|
|
278
|
+
env,
|
|
279
|
+
&endpoint_client.address,
|
|
280
|
+
&[
|
|
281
|
+
&DefaultReceiveLibrarySet { src_eid, new_lib: lib_b.clone() },
|
|
282
|
+
&DefaultReceiveLibTimeoutSet { src_eid, timeout: expected_timeout_b },
|
|
283
|
+
],
|
|
284
|
+
);
|
|
263
285
|
|
|
264
286
|
// Advance time, then rotate B -> C with grace=500 => must keep B (not A).
|
|
265
287
|
let t1 = t0 + 10;
|
|
@@ -268,11 +290,13 @@ fn test_set_default_receive_library_multi_rotation_timeout_uses_immediate_previo
|
|
|
268
290
|
});
|
|
269
291
|
context.set_default_receive_library_with_auth(src_eid, &lib_c, 500);
|
|
270
292
|
let expected_timeout_c = Some(Timeout { lib: lib_b.clone(), expiry: t1 + 500 });
|
|
271
|
-
|
|
272
|
-
assert_event(
|
|
293
|
+
assert_contains_events(
|
|
273
294
|
env,
|
|
274
295
|
&endpoint_client.address,
|
|
275
|
-
|
|
296
|
+
&[
|
|
297
|
+
&DefaultReceiveLibrarySet { src_eid, new_lib: lib_c.clone() },
|
|
298
|
+
&DefaultReceiveLibTimeoutSet { src_eid, timeout: expected_timeout_c.clone() },
|
|
299
|
+
],
|
|
276
300
|
);
|
|
277
301
|
|
|
278
302
|
assert_eq!(endpoint_client.default_receive_library(&src_eid), Some(lib_c));
|
|
@@ -296,20 +320,24 @@ fn test_set_default_receive_library_is_scoped_by_src_eid() {
|
|
|
296
320
|
context.register_library_with_auth(&lib_2);
|
|
297
321
|
|
|
298
322
|
context.set_default_receive_library_with_auth(src_eid_1, &lib_1, 0);
|
|
299
|
-
|
|
323
|
+
assert_contains_events(
|
|
300
324
|
env,
|
|
301
325
|
&endpoint_client.address,
|
|
302
|
-
|
|
326
|
+
&[
|
|
327
|
+
&DefaultReceiveLibrarySet { src_eid: src_eid_1, new_lib: lib_1.clone() },
|
|
328
|
+
&DefaultReceiveLibTimeoutSet { src_eid: src_eid_1, timeout: None },
|
|
329
|
+
],
|
|
303
330
|
);
|
|
304
|
-
assert_event(env, &endpoint_client.address, DefaultReceiveLibTimeoutSet { src_eid: src_eid_1, timeout: None });
|
|
305
331
|
|
|
306
332
|
context.set_default_receive_library_with_auth(src_eid_2, &lib_2, 0);
|
|
307
|
-
|
|
333
|
+
assert_contains_events(
|
|
308
334
|
env,
|
|
309
335
|
&endpoint_client.address,
|
|
310
|
-
|
|
336
|
+
&[
|
|
337
|
+
&DefaultReceiveLibrarySet { src_eid: src_eid_2, new_lib: lib_2.clone() },
|
|
338
|
+
&DefaultReceiveLibTimeoutSet { src_eid: src_eid_2, timeout: None },
|
|
339
|
+
],
|
|
311
340
|
);
|
|
312
|
-
assert_event(env, &endpoint_client.address, DefaultReceiveLibTimeoutSet { src_eid: src_eid_2, timeout: None });
|
|
313
341
|
|
|
314
342
|
assert_eq!(endpoint_client.default_receive_library(&src_eid_1), Some(lib_1));
|
|
315
343
|
assert_eq!(endpoint_client.default_receive_library_timeout(&src_eid_1), None);
|
|
@@ -372,12 +400,14 @@ fn test_set_default_receive_library_with_send_and_receive_type() {
|
|
|
372
400
|
context.set_default_receive_library_with_auth(context.eid, &send_and_receive_lib, 0);
|
|
373
401
|
|
|
374
402
|
// Verify event emission.
|
|
375
|
-
|
|
403
|
+
assert_contains_events(
|
|
376
404
|
env,
|
|
377
405
|
&endpoint_client.address,
|
|
378
|
-
|
|
406
|
+
&[
|
|
407
|
+
&DefaultReceiveLibrarySet { src_eid: context.eid, new_lib: send_and_receive_lib.clone() },
|
|
408
|
+
&DefaultReceiveLibTimeoutSet { src_eid: context.eid, timeout: None },
|
|
409
|
+
],
|
|
379
410
|
);
|
|
380
|
-
assert_event(env, &endpoint_client.address, DefaultReceiveLibTimeoutSet { src_eid: context.eid, timeout: None });
|
|
381
411
|
|
|
382
412
|
// Verify state update via public interface.
|
|
383
413
|
assert_eq!(endpoint_client.default_receive_library(&context.eid), Some(send_and_receive_lib));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
use soroban_sdk::{testutils::Address as _, vec, Address};
|
|
2
|
-
use utils::testing_utils::
|
|
2
|
+
use utils::testing_utils::assert_eq_event;
|
|
3
3
|
|
|
4
4
|
use crate::{
|
|
5
5
|
errors::EndpointError, events::DefaultSendLibrarySet, tests::endpoint_setup::setup,
|
|
@@ -79,7 +79,7 @@ fn test_set_default_send_library_success() {
|
|
|
79
79
|
context.set_default_send_library_with_auth(context.eid, &send_lib);
|
|
80
80
|
|
|
81
81
|
// Verify event emission.
|
|
82
|
-
|
|
82
|
+
assert_eq_event(
|
|
83
83
|
env,
|
|
84
84
|
&endpoint_client.address,
|
|
85
85
|
DefaultSendLibrarySet { dst_eid: context.eid, new_lib: send_lib.clone() },
|
|
@@ -105,7 +105,7 @@ fn test_set_default_send_library_success_with_send_and_receive_type() {
|
|
|
105
105
|
context.set_default_send_library_with_auth(context.eid, &send_and_receive_lib);
|
|
106
106
|
|
|
107
107
|
// Verify event emission.
|
|
108
|
-
|
|
108
|
+
assert_eq_event(
|
|
109
109
|
env,
|
|
110
110
|
&endpoint_client.address,
|
|
111
111
|
DefaultSendLibrarySet { dst_eid: context.eid, new_lib: send_and_receive_lib.clone() },
|
|
@@ -130,7 +130,7 @@ fn test_set_default_send_library_can_change_default_library() {
|
|
|
130
130
|
|
|
131
131
|
// Set A as the default first.
|
|
132
132
|
context.set_default_send_library_with_auth(context.eid, &send_lib_a);
|
|
133
|
-
|
|
133
|
+
assert_eq_event(
|
|
134
134
|
env,
|
|
135
135
|
&endpoint_client.address,
|
|
136
136
|
DefaultSendLibrarySet { dst_eid: context.eid, new_lib: send_lib_a.clone() },
|
|
@@ -139,7 +139,7 @@ fn test_set_default_send_library_can_change_default_library() {
|
|
|
139
139
|
|
|
140
140
|
// Then change the default to B.
|
|
141
141
|
context.set_default_send_library_with_auth(context.eid, &send_lib_b);
|
|
142
|
-
|
|
142
|
+
assert_eq_event(
|
|
143
143
|
env,
|
|
144
144
|
&endpoint_client.address,
|
|
145
145
|
DefaultSendLibrarySet { dst_eid: context.eid, new_lib: send_lib_b.clone() },
|
|
@@ -2,7 +2,7 @@ use soroban_sdk::{
|
|
|
2
2
|
testutils::{Address as _, Ledger},
|
|
3
3
|
vec, Address,
|
|
4
4
|
};
|
|
5
|
-
use utils::testing_utils::
|
|
5
|
+
use utils::testing_utils::{assert_contains_event, assert_contains_events};
|
|
6
6
|
|
|
7
7
|
use crate::{
|
|
8
8
|
errors::EndpointError,
|
|
@@ -73,15 +73,13 @@ fn test_set_receive_library_allows_delegate() {
|
|
|
73
73
|
context.set_receive_library_with_auth(&delegate, &oapp, context.eid, &Some(receive_lib.clone()), 0);
|
|
74
74
|
|
|
75
75
|
// Verify event emission.
|
|
76
|
-
|
|
76
|
+
assert_contains_events(
|
|
77
77
|
env,
|
|
78
78
|
&endpoint_client.address,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
&endpoint_client.address,
|
|
84
|
-
ReceiveLibraryTimeoutSet { receiver: oapp.clone(), eid: context.eid, timeout: None },
|
|
79
|
+
&[
|
|
80
|
+
&ReceiveLibrarySet { receiver: oapp.clone(), src_eid: context.eid, new_lib: Some(receive_lib.clone()) },
|
|
81
|
+
&ReceiveLibraryTimeoutSet { receiver: oapp.clone(), eid: context.eid, timeout: None },
|
|
82
|
+
],
|
|
85
83
|
);
|
|
86
84
|
|
|
87
85
|
// Verify state update via public interface.
|
|
@@ -166,15 +164,13 @@ fn test_set_receive_library_success() {
|
|
|
166
164
|
context.set_receive_library_with_auth(&oapp, &oapp, context.eid, &Some(receive_lib.clone()), 0);
|
|
167
165
|
|
|
168
166
|
// Verify event emission.
|
|
169
|
-
|
|
170
|
-
env,
|
|
171
|
-
&endpoint_client.address,
|
|
172
|
-
ReceiveLibrarySet { receiver: oapp.clone(), src_eid: context.eid, new_lib: Some(receive_lib.clone()) },
|
|
173
|
-
);
|
|
174
|
-
assert_event(
|
|
167
|
+
assert_contains_events(
|
|
175
168
|
env,
|
|
176
169
|
&endpoint_client.address,
|
|
177
|
-
|
|
170
|
+
&[
|
|
171
|
+
&ReceiveLibrarySet { receiver: oapp.clone(), src_eid: context.eid, new_lib: Some(receive_lib.clone()) },
|
|
172
|
+
&ReceiveLibraryTimeoutSet { receiver: oapp.clone(), eid: context.eid, timeout: None },
|
|
173
|
+
],
|
|
178
174
|
);
|
|
179
175
|
|
|
180
176
|
// Verify state update via public interface.
|
|
@@ -202,15 +198,17 @@ fn test_set_receive_library_success_with_send_and_receive_type() {
|
|
|
202
198
|
context.set_receive_library_with_auth(&oapp, &oapp, context.eid, &Some(send_and_receive_lib.clone()), 0);
|
|
203
199
|
|
|
204
200
|
// Verify event emission.
|
|
205
|
-
|
|
201
|
+
assert_contains_events(
|
|
206
202
|
env,
|
|
207
203
|
&endpoint_client.address,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
204
|
+
&[
|
|
205
|
+
&ReceiveLibrarySet {
|
|
206
|
+
receiver: oapp.clone(),
|
|
207
|
+
src_eid: context.eid,
|
|
208
|
+
new_lib: Some(send_and_receive_lib.clone()),
|
|
209
|
+
},
|
|
210
|
+
&ReceiveLibraryTimeoutSet { receiver: oapp.clone(), eid: context.eid, timeout: None },
|
|
211
|
+
],
|
|
214
212
|
);
|
|
215
213
|
|
|
216
214
|
assert_eq!(
|
|
@@ -251,15 +249,13 @@ fn test_set_receive_library_success_with_grace_period() {
|
|
|
251
249
|
let expected_timeout = Some(Timeout { lib: old_receive_lib.clone(), expiry: current_timestamp + grace_period });
|
|
252
250
|
|
|
253
251
|
// Verify event emission (from the second call).
|
|
254
|
-
|
|
255
|
-
env,
|
|
256
|
-
&endpoint_client.address,
|
|
257
|
-
ReceiveLibrarySet { receiver: oapp.clone(), src_eid: context.eid, new_lib: Some(new_receive_lib.clone()) },
|
|
258
|
-
);
|
|
259
|
-
assert_event(
|
|
252
|
+
assert_contains_events(
|
|
260
253
|
env,
|
|
261
254
|
&endpoint_client.address,
|
|
262
|
-
|
|
255
|
+
&[
|
|
256
|
+
&ReceiveLibrarySet { receiver: oapp.clone(), src_eid: context.eid, new_lib: Some(new_receive_lib.clone()) },
|
|
257
|
+
&ReceiveLibraryTimeoutSet { receiver: oapp.clone(), eid: context.eid, timeout: expected_timeout.clone() },
|
|
258
|
+
],
|
|
263
259
|
);
|
|
264
260
|
|
|
265
261
|
// Verify state update via public interface.
|
|
@@ -352,41 +348,37 @@ fn test_set_receive_library_grace_period_zero_clears_timeout() {
|
|
|
352
348
|
|
|
353
349
|
// A: initial set (no timeout).
|
|
354
350
|
context.set_receive_library_with_auth(&oapp, &oapp, src_eid, &Some(lib_a.clone()), 0);
|
|
355
|
-
|
|
356
|
-
env,
|
|
357
|
-
&endpoint_client.address,
|
|
358
|
-
ReceiveLibrarySet { receiver: oapp.clone(), src_eid, new_lib: Some(lib_a.clone()) },
|
|
359
|
-
);
|
|
360
|
-
assert_event(
|
|
351
|
+
assert_contains_events(
|
|
361
352
|
env,
|
|
362
353
|
&endpoint_client.address,
|
|
363
|
-
|
|
354
|
+
&[
|
|
355
|
+
&ReceiveLibrarySet { receiver: oapp.clone(), src_eid, new_lib: Some(lib_a.clone()) },
|
|
356
|
+
&ReceiveLibraryTimeoutSet { receiver: oapp.clone(), eid: src_eid, timeout: None },
|
|
357
|
+
],
|
|
364
358
|
);
|
|
365
359
|
|
|
366
360
|
// B: rotate with grace -> timeout for A must be set.
|
|
367
361
|
let grace_period = 1_000u64;
|
|
368
362
|
context.set_receive_library_with_auth(&oapp, &oapp, src_eid, &Some(lib_b.clone()), grace_period);
|
|
369
363
|
let expected_timeout_b = Some(Timeout { lib: lib_a.clone(), expiry: t0 + grace_period });
|
|
370
|
-
|
|
364
|
+
assert_contains_events(
|
|
371
365
|
env,
|
|
372
366
|
&endpoint_client.address,
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
&endpoint_client.address,
|
|
378
|
-
ReceiveLibraryTimeoutSet { receiver: oapp.clone(), eid: src_eid, timeout: expected_timeout_b.clone() },
|
|
367
|
+
&[
|
|
368
|
+
&ReceiveLibrarySet { receiver: oapp.clone(), src_eid, new_lib: Some(lib_b.clone()) },
|
|
369
|
+
&ReceiveLibraryTimeoutSet { receiver: oapp.clone(), eid: src_eid, timeout: expected_timeout_b.clone() },
|
|
370
|
+
],
|
|
379
371
|
);
|
|
380
372
|
assert_eq!(endpoint_client.receive_library_timeout(&oapp, &src_eid), expected_timeout_b.clone());
|
|
381
373
|
|
|
382
374
|
// C: rotate with grace=0 -> timeout must be cleared (None).
|
|
383
375
|
context.set_receive_library_with_auth(&oapp, &oapp, src_eid, &Some(lib_c.clone()), 0);
|
|
384
|
-
|
|
376
|
+
assert_contains_event(
|
|
385
377
|
env,
|
|
386
378
|
&endpoint_client.address,
|
|
387
379
|
ReceiveLibrarySet { receiver: oapp.clone(), src_eid, new_lib: Some(lib_c.clone()) },
|
|
388
380
|
);
|
|
389
|
-
|
|
381
|
+
assert_contains_event(
|
|
390
382
|
env,
|
|
391
383
|
&endpoint_client.address,
|
|
392
384
|
ReceiveLibraryTimeoutSet { receiver: oapp.clone(), eid: src_eid, timeout: None },
|
|
@@ -417,15 +409,13 @@ fn test_set_receive_library_clear_to_none() {
|
|
|
417
409
|
context.set_receive_library_with_auth(&oapp, &oapp, context.eid, &None, 0);
|
|
418
410
|
|
|
419
411
|
// Verify event emission.
|
|
420
|
-
|
|
421
|
-
env,
|
|
422
|
-
&endpoint_client.address,
|
|
423
|
-
ReceiveLibrarySet { receiver: oapp.clone(), src_eid: context.eid, new_lib: None },
|
|
424
|
-
);
|
|
425
|
-
assert_event(
|
|
412
|
+
assert_contains_events(
|
|
426
413
|
env,
|
|
427
414
|
&endpoint_client.address,
|
|
428
|
-
|
|
415
|
+
&[
|
|
416
|
+
&ReceiveLibrarySet { receiver: oapp.clone(), src_eid: context.eid, new_lib: None },
|
|
417
|
+
&ReceiveLibraryTimeoutSet { receiver: oapp.clone(), eid: context.eid, timeout: None },
|
|
418
|
+
],
|
|
429
419
|
);
|
|
430
420
|
|
|
431
421
|
// Verify state update via public interface (should fall back to default).
|
|
@@ -452,7 +442,7 @@ fn test_set_receive_library_can_change_library() {
|
|
|
452
442
|
|
|
453
443
|
// Set A first.
|
|
454
444
|
context.set_receive_library_with_auth(&oapp, &oapp, context.eid, &Some(receive_lib_a.clone()), 0);
|
|
455
|
-
|
|
445
|
+
assert_contains_event(
|
|
456
446
|
env,
|
|
457
447
|
&endpoint_client.address,
|
|
458
448
|
ReceiveLibrarySet { receiver: oapp.clone(), src_eid: context.eid, new_lib: Some(receive_lib_a.clone()) },
|
|
@@ -464,7 +454,7 @@ fn test_set_receive_library_can_change_library() {
|
|
|
464
454
|
|
|
465
455
|
// Then change to B.
|
|
466
456
|
context.set_receive_library_with_auth(&oapp, &oapp, context.eid, &Some(receive_lib_b.clone()), 0);
|
|
467
|
-
|
|
457
|
+
assert_contains_event(
|
|
468
458
|
env,
|
|
469
459
|
&endpoint_client.address,
|
|
470
460
|
ReceiveLibrarySet { receiver: oapp.clone(), src_eid: context.eid, new_lib: Some(receive_lib_b.clone()) },
|
|
@@ -2,7 +2,7 @@ use soroban_sdk::{
|
|
|
2
2
|
testutils::{Address as _, Ledger},
|
|
3
3
|
vec, Address,
|
|
4
4
|
};
|
|
5
|
-
use utils::testing_utils::
|
|
5
|
+
use utils::testing_utils::assert_eq_event;
|
|
6
6
|
|
|
7
7
|
use crate::{
|
|
8
8
|
errors::EndpointError, events::ReceiveLibraryTimeoutSet, tests::endpoint_setup::setup,
|
|
@@ -230,7 +230,7 @@ fn test_set_receive_library_timeout_success() {
|
|
|
230
230
|
set_receive_library_timeout_with_auth(&context, &oapp, &oapp, src_eid, &timeout);
|
|
231
231
|
|
|
232
232
|
// Verify event emission.
|
|
233
|
-
|
|
233
|
+
assert_eq_event(
|
|
234
234
|
env,
|
|
235
235
|
&endpoint_client.address,
|
|
236
236
|
ReceiveLibraryTimeoutSet { receiver: oapp.clone(), eid: src_eid, timeout: timeout.clone() },
|
|
@@ -268,7 +268,7 @@ fn test_set_receive_library_timeout_success_with_send_and_receive_type() {
|
|
|
268
268
|
set_receive_library_timeout_with_auth(&context, &oapp, &oapp, src_eid, &timeout);
|
|
269
269
|
|
|
270
270
|
// Verify event emission.
|
|
271
|
-
|
|
271
|
+
assert_eq_event(
|
|
272
272
|
env,
|
|
273
273
|
&endpoint_client.address,
|
|
274
274
|
ReceiveLibraryTimeoutSet { receiver: oapp.clone(), eid: src_eid, timeout: timeout.clone() },
|
|
@@ -305,7 +305,7 @@ fn test_set_receive_library_timeout_allows_delegate() {
|
|
|
305
305
|
set_receive_library_timeout_with_auth(&context, &delegate, &oapp, src_eid, &timeout);
|
|
306
306
|
|
|
307
307
|
// Verify event emission.
|
|
308
|
-
|
|
308
|
+
assert_eq_event(
|
|
309
309
|
env,
|
|
310
310
|
&endpoint_client.address,
|
|
311
311
|
ReceiveLibraryTimeoutSet { receiver: oapp.clone(), eid: src_eid, timeout: timeout.clone() },
|
|
@@ -377,7 +377,7 @@ fn test_set_receive_library_timeout_success_with_none() {
|
|
|
377
377
|
set_receive_library_timeout_with_auth(&context, &oapp, &oapp, src_eid, &None);
|
|
378
378
|
|
|
379
379
|
// Verify event emission.
|
|
380
|
-
|
|
380
|
+
assert_eq_event(
|
|
381
381
|
env,
|
|
382
382
|
&endpoint_client.address,
|
|
383
383
|
ReceiveLibraryTimeoutSet { receiver: oapp.clone(), eid: src_eid, timeout: None },
|
|
@@ -408,7 +408,7 @@ fn test_set_receive_library_timeout_clears_existing_timeout() {
|
|
|
408
408
|
// First set a timeout.
|
|
409
409
|
let timeout = Some(Timeout { lib: receive_lib.clone(), expiry: current_timestamp + 1000 });
|
|
410
410
|
set_receive_library_timeout_with_auth(&context, &oapp, &oapp, src_eid, &timeout);
|
|
411
|
-
|
|
411
|
+
assert_eq_event(
|
|
412
412
|
env,
|
|
413
413
|
&endpoint_client.address,
|
|
414
414
|
ReceiveLibraryTimeoutSet { receiver: oapp.clone(), eid: src_eid, timeout: timeout.clone() },
|
|
@@ -417,7 +417,7 @@ fn test_set_receive_library_timeout_clears_existing_timeout() {
|
|
|
417
417
|
|
|
418
418
|
// Then clear it.
|
|
419
419
|
set_receive_library_timeout_with_auth(&context, &oapp, &oapp, src_eid, &None);
|
|
420
|
-
|
|
420
|
+
assert_eq_event(
|
|
421
421
|
env,
|
|
422
422
|
&endpoint_client.address,
|
|
423
423
|
ReceiveLibraryTimeoutSet { receiver: oapp.clone(), eid: src_eid, timeout: None },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
use soroban_sdk::{testutils::Address as _, vec, Address};
|
|
2
|
-
use utils::testing_utils::
|
|
2
|
+
use utils::testing_utils::assert_eq_event;
|
|
3
3
|
|
|
4
4
|
use crate::{
|
|
5
5
|
errors::EndpointError, events::SendLibrarySet, storage, tests::endpoint_setup::setup,
|
|
@@ -65,7 +65,7 @@ fn test_set_send_library_allows_delegate() {
|
|
|
65
65
|
context.set_send_library_with_auth(&delegate, &oapp, context.eid, &Some(send_lib.clone()));
|
|
66
66
|
|
|
67
67
|
// Verify event emission.
|
|
68
|
-
|
|
68
|
+
assert_eq_event(
|
|
69
69
|
env,
|
|
70
70
|
&endpoint_client.address,
|
|
71
71
|
SendLibrarySet { sender: oapp.clone(), dst_eid: context.eid, new_lib: Some(send_lib.clone()) },
|
|
@@ -148,7 +148,7 @@ fn test_set_send_library_success() {
|
|
|
148
148
|
context.set_send_library_with_auth(&oapp, &oapp, context.eid, &Some(send_lib.clone()));
|
|
149
149
|
|
|
150
150
|
// Verify event emission.
|
|
151
|
-
|
|
151
|
+
assert_eq_event(
|
|
152
152
|
env,
|
|
153
153
|
&endpoint_client.address,
|
|
154
154
|
SendLibrarySet { sender: oapp.clone(), dst_eid: context.eid, new_lib: Some(send_lib.clone()) },
|
|
@@ -177,7 +177,7 @@ fn test_set_send_library_success_with_send_and_receive_type() {
|
|
|
177
177
|
context.set_send_library_with_auth(&oapp, &oapp, context.eid, &Some(send_and_receive_lib.clone()));
|
|
178
178
|
|
|
179
179
|
// Verify event emission.
|
|
180
|
-
|
|
180
|
+
assert_eq_event(
|
|
181
181
|
env,
|
|
182
182
|
&endpoint_client.address,
|
|
183
183
|
SendLibrarySet { sender: oapp.clone(), dst_eid: context.eid, new_lib: Some(send_and_receive_lib.clone()) },
|
|
@@ -206,7 +206,7 @@ fn test_set_send_library_can_change_library() {
|
|
|
206
206
|
|
|
207
207
|
// Set A first.
|
|
208
208
|
context.set_send_library_with_auth(&oapp, &oapp, context.eid, &Some(send_lib_a.clone()));
|
|
209
|
-
|
|
209
|
+
assert_eq_event(
|
|
210
210
|
env,
|
|
211
211
|
&endpoint_client.address,
|
|
212
212
|
SendLibrarySet { sender: oapp.clone(), dst_eid: context.eid, new_lib: Some(send_lib_a.clone()) },
|
|
@@ -218,7 +218,7 @@ fn test_set_send_library_can_change_library() {
|
|
|
218
218
|
|
|
219
219
|
// Then change to B.
|
|
220
220
|
context.set_send_library_with_auth(&oapp, &oapp, context.eid, &Some(send_lib_b.clone()));
|
|
221
|
-
|
|
221
|
+
assert_eq_event(
|
|
222
222
|
env,
|
|
223
223
|
&endpoint_client.address,
|
|
224
224
|
SendLibrarySet { sender: oapp.clone(), dst_eid: context.eid, new_lib: Some(send_lib_b.clone()) },
|
|
@@ -277,7 +277,7 @@ fn test_set_send_library_clear_to_none_falls_back_to_default() {
|
|
|
277
277
|
|
|
278
278
|
// Set a custom library.
|
|
279
279
|
context.set_send_library_with_auth(&oapp, &oapp, context.eid, &Some(custom_send_lib.clone()));
|
|
280
|
-
|
|
280
|
+
assert_eq_event(
|
|
281
281
|
env,
|
|
282
282
|
&endpoint_client.address,
|
|
283
283
|
SendLibrarySet { sender: oapp.clone(), dst_eid: context.eid, new_lib: Some(custom_send_lib.clone()) },
|
|
@@ -289,7 +289,7 @@ fn test_set_send_library_clear_to_none_falls_back_to_default() {
|
|
|
289
289
|
|
|
290
290
|
// Then clear to None (should fall back to default).
|
|
291
291
|
context.set_send_library_with_auth(&oapp, &oapp, context.eid, &None);
|
|
292
|
-
|
|
292
|
+
assert_eq_event(
|
|
293
293
|
env,
|
|
294
294
|
&endpoint_client.address,
|
|
295
295
|
SendLibrarySet { sender: oapp.clone(), dst_eid: context.eid, new_lib: None },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
use soroban_sdk::{testutils::Address as _, Address, BytesN};
|
|
2
|
-
use utils::testing_utils::
|
|
2
|
+
use utils::testing_utils::assert_eq_event;
|
|
3
3
|
|
|
4
4
|
use crate::{
|
|
5
5
|
errors::EndpointError,
|
|
@@ -95,7 +95,7 @@ fn test_burn_success_with_stored_payload() {
|
|
|
95
95
|
burn_with_auth(&context, &receiver, &receiver, src_eid, &sender, nonce, &payload_hash);
|
|
96
96
|
|
|
97
97
|
// Verify PacketBurnt event was emitted.
|
|
98
|
-
|
|
98
|
+
assert_eq_event(
|
|
99
99
|
env,
|
|
100
100
|
&endpoint_client.address,
|
|
101
101
|
PacketBurnt {
|
|
@@ -138,7 +138,7 @@ fn test_burn_with_delegate() {
|
|
|
138
138
|
burn_with_auth(&context, &delegate, &receiver, src_eid, &sender, nonce, &payload_hash);
|
|
139
139
|
|
|
140
140
|
// Verify PacketBurnt event was emitted.
|
|
141
|
-
|
|
141
|
+
assert_eq_event(
|
|
142
142
|
env,
|
|
143
143
|
&endpoint_client.address,
|
|
144
144
|
PacketBurnt {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
use soroban_sdk::{testutils::Address as _, Address, BytesN};
|
|
2
|
-
use utils::testing_utils::
|
|
2
|
+
use utils::testing_utils::assert_eq_event;
|
|
3
3
|
|
|
4
4
|
use crate::{
|
|
5
5
|
endpoint_v2::EndpointV2, errors::EndpointError, events::PacketNilified, storage, tests::endpoint_setup::setup,
|
|
@@ -98,7 +98,7 @@ fn test_nilify_success_with_stored_payload() {
|
|
|
98
98
|
nilify_with_auth(&context, &receiver, &receiver, src_eid, &sender, nonce, &payload_hash_opt);
|
|
99
99
|
|
|
100
100
|
// Verify PacketNilified event was emitted.
|
|
101
|
-
|
|
101
|
+
assert_eq_event(
|
|
102
102
|
env,
|
|
103
103
|
&endpoint_client.address,
|
|
104
104
|
PacketNilified {
|
|
@@ -137,7 +137,7 @@ fn test_nilify_success_with_empty_payload() {
|
|
|
137
137
|
nilify_with_auth(&context, &receiver, &receiver, src_eid, &sender, nonce, &None);
|
|
138
138
|
|
|
139
139
|
// Verify PacketNilified event was emitted.
|
|
140
|
-
|
|
140
|
+
assert_eq_event(
|
|
141
141
|
env,
|
|
142
142
|
&endpoint_client.address,
|
|
143
143
|
PacketNilified { src_eid, sender: sender.clone(), receiver: receiver.clone(), nonce, payload_hash: None },
|
|
@@ -255,7 +255,7 @@ fn test_nilify_with_delegate() {
|
|
|
255
255
|
nilify_with_auth(&context, &delegate, &receiver, src_eid, &sender, nonce, &payload_hash_opt);
|
|
256
256
|
|
|
257
257
|
// Verify PacketNilified event was emitted.
|
|
258
|
-
|
|
258
|
+
assert_eq_event(
|
|
259
259
|
env,
|
|
260
260
|
&endpoint_client.address,
|
|
261
261
|
PacketNilified {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
use soroban_sdk::{testutils::Address as _, Address, BytesN};
|
|
2
|
-
use utils::testing_utils::
|
|
2
|
+
use utils::testing_utils::assert_eq_event;
|
|
3
3
|
|
|
4
4
|
use crate::{
|
|
5
5
|
errors::EndpointError, events::InboundNonceSkipped, storage, tests::endpoint_setup::setup,
|
|
@@ -77,7 +77,7 @@ fn test_skip_success() {
|
|
|
77
77
|
skip_with_auth(&context, &receiver, &receiver, src_eid, &sender, nonce);
|
|
78
78
|
|
|
79
79
|
// Verify InboundNonceSkipped event was emitted.
|
|
80
|
-
|
|
80
|
+
assert_eq_event(
|
|
81
81
|
env,
|
|
82
82
|
&endpoint_client.address,
|
|
83
83
|
InboundNonceSkipped { src_eid, sender: sender.clone(), receiver: receiver.clone(), nonce },
|
|
@@ -140,7 +140,7 @@ fn test_skip_with_delegate() {
|
|
|
140
140
|
skip_with_auth(&context, &delegate, &receiver, src_eid, &sender, nonce);
|
|
141
141
|
|
|
142
142
|
// Verify InboundNonceSkipped event was emitted.
|
|
143
|
-
|
|
143
|
+
assert_eq_event(
|
|
144
144
|
env,
|
|
145
145
|
&endpoint_client.address,
|
|
146
146
|
InboundNonceSkipped { src_eid, sender: sender.clone(), receiver: receiver.clone(), nonce },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
use soroban_sdk::{testutils::Address as _, Address, Bytes, BytesN};
|
|
2
|
-
use utils::testing_utils::
|
|
2
|
+
use utils::testing_utils::assert_eq_event;
|
|
3
3
|
|
|
4
4
|
use crate::{
|
|
5
5
|
constants::{MAX_COMPOSE_INDEX, RECEIVED_MESSAGE_HASH_BYTES},
|
|
@@ -90,7 +90,7 @@ fn test_clear_compose_success() {
|
|
|
90
90
|
assert_eq!(endpoint_client.compose_queue(&from, &composer, &guid, &index), Some(keccak256(env, &message)));
|
|
91
91
|
|
|
92
92
|
clear_compose_with_auth(&context, &composer, &from, &guid, index, &message);
|
|
93
|
-
|
|
93
|
+
assert_eq_event(
|
|
94
94
|
env,
|
|
95
95
|
&endpoint_client.address,
|
|
96
96
|
ComposeDelivered { from: from.clone(), to: composer.clone(), guid: guid.clone(), index },
|