@layerzerolabs/protocol-stellar-v2 0.2.29 → 0.2.30
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 +371 -321
- package/.turbo/turbo-lint.log +211 -202
- package/.turbo/turbo-test.log +1766 -1673
- package/Cargo.lock +11 -1
- package/contracts/common-macros/src/lib.rs +0 -2
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__upgradeable__snapshot_generated_upgradeable_code.snap +1 -0
- package/contracts/endpoint-v2/src/messaging_channel.rs +32 -3
- package/contracts/endpoint-v2/src/tests/endpoint_setup.rs +1 -1
- package/contracts/endpoint-v2/src/tests/messaging_channel/clear_payload.rs +1 -1
- package/contracts/endpoint-v2/src/tests/messaging_channel/inbound.rs +6 -6
- package/contracts/endpoint-v2/src/tests/messaging_channel/inbound_payload_hash.rs +1 -1
- package/contracts/endpoint-v2/src/tests/messaging_channel/outbound.rs +16 -10
- package/contracts/macro-integration-tests/tests/runtime/oapp/options_type3.rs +10 -10
- package/contracts/macro-integration-tests/tests/runtime/oapp/receiver.rs +3 -3
- package/contracts/macro-integration-tests/tests/runtime/oapp/sender.rs +4 -3
- package/contracts/macro-integration-tests/tests/runtime/upgradeable/migrate_guard_and_state.rs +1 -57
- package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/upgradeable_missing_internal.stderr +0 -30
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/custom_wrong_value.stderr +5 -3
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/non_struct_input.stderr +6 -4
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/unknown_custom_option.stderr +5 -3
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/wrong_key.stderr +5 -3
- package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/missing_auth_trait.stderr +0 -30
- package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/missing_upgradeable_internal.stderr +0 -30
- package/contracts/macro-integration-tests/tests/ui/upgradeable/pass/basic.rs +0 -2
- package/contracts/macro-integration-tests/tests/ui/upgradeable/pass/multisig_contract.rs +0 -2
- package/contracts/macro-integration-tests/tests/ui/upgradeable/pass/no_migration.rs +0 -2
- package/contracts/macro-integration-tests/tests/ui/upgradeable/pass/no_user_contractimpl.rs +1 -3
- package/contracts/message-libs/message-lib-common/src/packet_codec_v1.rs +3 -6
- package/contracts/message-libs/message-lib-common/src/tests/worker_options/extract_type_3_options.rs +10 -0
- package/contracts/message-libs/message-lib-common/src/worker_options.rs +6 -2
- package/contracts/message-libs/treasury/src/interfaces/zro_fee_lib.rs +3 -3
- package/contracts/message-libs/treasury/src/lib.rs +2 -1
- package/contracts/message-libs/treasury/src/tests/setup.rs +1 -1
- package/contracts/message-libs/treasury/src/treasury.rs +5 -2
- package/contracts/message-libs/uln-302/src/errors.rs +2 -0
- package/contracts/message-libs/uln-302/src/events.rs +3 -3
- package/contracts/message-libs/uln-302/src/interfaces/receive_uln.rs +8 -0
- package/contracts/message-libs/uln-302/src/lib.rs +2 -1
- package/contracts/message-libs/uln-302/src/receive_uln.rs +16 -13
- package/contracts/message-libs/uln-302/src/send_uln.rs +51 -24
- package/contracts/message-libs/uln-302/src/storage.rs +2 -2
- package/contracts/message-libs/uln-302/src/tests/receive_uln302/effective_receive_uln_config.rs +45 -1
- package/contracts/message-libs/uln-302/src/tests/receive_uln302/verifiable.rs +63 -0
- package/contracts/message-libs/uln-302/src/tests/send_uln302/effective_executor_config.rs +47 -2
- package/contracts/message-libs/uln-302/src/tests/send_uln302/effective_send_uln_config.rs +50 -1
- package/contracts/message-libs/uln-302/src/uln302.rs +0 -8
- package/contracts/oapps/counter/Cargo.toml +4 -4
- package/contracts/oapps/counter/integration_tests/setup_uln.rs +22 -2
- package/contracts/oapps/counter/src/counter.rs +8 -8
- package/contracts/oapps/oapp/src/interfaces/oapp_msg_inspector.rs +33 -10
- package/contracts/oapps/oapp/src/lib.rs +6 -2
- package/contracts/oapps/oapp/src/oapp_core.rs +49 -24
- package/contracts/oapps/oapp/src/oapp_options_type3.rs +21 -14
- package/contracts/oapps/oapp/src/oapp_receiver.rs +17 -16
- package/contracts/oapps/oapp/src/oapp_sender.rs +66 -15
- package/contracts/oapps/oapp/src/tests/oapp_core.rs +5 -5
- package/contracts/oapps/oapp/src/tests/oapp_options_type3.rs +18 -18
- package/contracts/oapps/oapp/src/tests/oapp_receiver.rs +4 -4
- package/contracts/oapps/oapp/src/tests/oapp_sender.rs +3 -3
- package/contracts/oapps/oapp-macros/Cargo.toml +0 -1
- package/contracts/oapps/oapp-macros/src/generators.rs +87 -46
- package/contracts/oapps/oapp-macros/src/lib.rs +3 -61
- package/contracts/oapps/oapp-macros/src/tests/oapp.rs +9 -23
- package/contracts/oapps/oapp-macros/src/tests/parse_custom_impls.rs +15 -11
- package/contracts/oapps/oft/Cargo.toml +1 -1
- package/contracts/oapps/oft/integration-tests/extensions/test_oft_fee.rs +3 -3
- package/contracts/oapps/oft/integration-tests/extensions/test_pausable.rs +4 -4
- package/contracts/oapps/oft/integration-tests/extensions/test_rate_limiter.rs +144 -8
- package/contracts/oapps/oft/integration-tests/setup.rs +4 -2
- package/contracts/oapps/oft/integration-tests/utils.rs +25 -11
- package/contracts/oapps/oft/src/extensions/oft_fee.rs +65 -63
- package/contracts/oapps/oft/src/extensions/pausable.rs +2 -3
- package/contracts/oapps/oft/src/extensions/rate_limiter.rs +22 -5
- package/contracts/oapps/oft/src/interfaces/mint_burnable.rs +18 -0
- package/contracts/oapps/oft/src/interfaces/mod.rs +3 -0
- package/contracts/oapps/oft/src/lib.rs +4 -2
- package/contracts/oapps/oft/src/oft.rs +35 -36
- package/contracts/oapps/oft/src/oft_types/lock_unlock.rs +13 -9
- package/contracts/oapps/oft/src/oft_types/mint_burn.rs +14 -9
- package/contracts/oapps/oft/src/oft_types/mod.rs +14 -12
- package/contracts/oapps/oft/src/tests/extensions/oft_fee.rs +28 -20
- package/contracts/oapps/oft/src/tests/extensions/rate_limiter.rs +136 -2
- package/contracts/oapps/oft/src/tests/oft_types/lock_unlock.rs +12 -8
- package/contracts/oapps/oft-core/integration-tests/setup.rs +8 -9
- package/contracts/oapps/oft-core/integration-tests/test_with_sml.rs +7 -6
- package/contracts/oapps/oft-core/integration-tests/utils.rs +5 -4
- package/contracts/oapps/oft-core/src/codec/oft_compose_msg_codec.rs +2 -2
- package/contracts/oapps/oft-core/src/codec/oft_msg_codec.rs +33 -37
- package/contracts/oapps/oft-core/src/errors.rs +2 -1
- package/contracts/oapps/oft-core/src/events.rs +6 -0
- package/contracts/oapps/oft-core/src/lib.rs +8 -4
- package/contracts/oapps/oft-core/src/oft_core.rs +205 -148
- package/contracts/oapps/oft-core/src/storage.rs +4 -2
- package/contracts/oapps/oft-core/src/tests/test_decimals.rs +2 -2
- package/contracts/oapps/oft-core/src/tests/test_lz_receive.rs +6 -6
- package/contracts/oapps/oft-core/src/tests/test_msg_inspector.rs +7 -6
- package/contracts/oapps/oft-core/src/tests/test_oft_msg_codec.rs +11 -82
- package/contracts/oapps/oft-core/src/tests/test_quote_oft.rs +13 -13
- package/contracts/oapps/oft-core/src/tests/test_quote_send.rs +1 -1
- package/contracts/oapps/oft-core/src/tests/test_resolve_address.rs +2 -2
- package/contracts/oapps/oft-core/src/tests/test_send.rs +22 -22
- package/contracts/oapps/oft-core/src/tests/test_utils.rs +20 -22
- package/contracts/oapps/oft-core/src/utils.rs +12 -8
- package/contracts/sac-manager/Cargo.toml +25 -0
- package/contracts/sac-manager/src/errors.rs +18 -0
- package/contracts/sac-manager/src/extensions/mod.rs +6 -0
- package/contracts/sac-manager/src/extensions/redistribution.rs +109 -0
- package/contracts/sac-manager/src/extensions/supply_control/mod.rs +488 -0
- package/contracts/sac-manager/src/extensions/supply_control/rate_limit.rs +126 -0
- package/contracts/sac-manager/src/interfaces/mod.rs +3 -0
- package/contracts/sac-manager/src/interfaces/sac_manager.rs +52 -0
- package/contracts/sac-manager/src/lib.rs +23 -0
- package/contracts/sac-manager/src/sac_manager.rs +193 -0
- package/contracts/sac-manager/src/storage.rs +20 -0
- package/contracts/sac-manager/src/tests/mod.rs +14 -0
- package/contracts/sac-manager/src/tests/redistribution/mod.rs +1 -0
- package/contracts/sac-manager/src/tests/redistribution/redistribute_funds.rs +82 -0
- package/contracts/sac-manager/src/tests/sac_manager/admin_mint.rs +206 -0
- package/contracts/sac-manager/src/tests/sac_manager/burn.rs +215 -0
- package/contracts/sac-manager/src/tests/sac_manager/clawback.rs +209 -0
- package/contracts/sac-manager/src/tests/sac_manager/mint.rs +252 -0
- package/contracts/sac-manager/src/tests/sac_manager/mod.rs +9 -0
- package/contracts/sac-manager/src/tests/sac_manager/set_admin.rs +36 -0
- package/contracts/sac-manager/src/tests/sac_manager/set_authorized.rs +43 -0
- package/contracts/sac-manager/src/tests/sac_manager/set_oft_address.rs +47 -0
- package/contracts/sac-manager/src/tests/sac_manager/test_helper.rs +75 -0
- package/contracts/sac-manager/src/tests/sac_manager/view_functions.rs +60 -0
- package/contracts/sac-manager/src/tests/supply_control/enumerable_set.rs +256 -0
- package/contracts/sac-manager/src/tests/supply_control/mod.rs +8 -0
- package/contracts/sac-manager/src/tests/supply_control/refill.rs +90 -0
- package/contracts/sac-manager/src/tests/supply_control/set_mint_whitelist.rs +245 -0
- package/contracts/sac-manager/src/tests/supply_control/set_supply_controller.rs +267 -0
- package/contracts/sac-manager/src/tests/supply_control/set_supply_controller_manager.rs +122 -0
- package/contracts/sac-manager/src/tests/supply_control/test_helper.rs +38 -0
- package/contracts/sac-manager/src/tests/supply_control/update_allow_any_mint_burn.rs +114 -0
- package/contracts/sac-manager/src/tests/supply_control/update_limit_config.rs +257 -0
- package/contracts/sac-manager/src/tests/test_helper.rs +190 -0
- package/contracts/upgrader/src/lib.rs +2 -1
- package/contracts/utils/src/errors.rs +0 -1
- package/contracts/utils/src/tests/upgradeable.rs +0 -66
- package/contracts/utils/src/upgradeable.rs +0 -18
- package/contracts/workers/dvn/src/dvn.rs +2 -2
- package/contracts/workers/dvn/src/interfaces/dvn.rs +2 -2
- package/contracts/workers/dvn/src/lib.rs +2 -1
- package/contracts/workers/dvn-fee-lib/src/lib.rs +3 -1
- package/contracts/workers/executor/src/auth.rs +42 -26
- package/contracts/workers/executor/src/executor.rs +28 -3
- package/contracts/workers/executor/src/lib.rs +4 -2
- package/contracts/workers/executor/src/storage.rs +21 -1
- package/contracts/workers/executor/src/tests/auth.rs +64 -20
- package/contracts/workers/executor/src/tests/executor.rs +1 -1
- package/contracts/workers/executor/src/tests/setup.rs +18 -0
- package/contracts/workers/executor-fee-lib/src/lib.rs +4 -1
- package/contracts/workers/executor-helper/src/executor_helper.rs +24 -10
- package/contracts/workers/executor-helper/src/tests/setup.rs +147 -34
- package/contracts/workers/price-feed/src/lib.rs +3 -1
- package/contracts/workers/worker/src/lib.rs +2 -1
- package/contracts/workers/worker/src/worker.rs +31 -17
- package/docs/oapp-guide.md +17 -8
- package/docs/oft-guide.md +3 -3
- package/package.json +3 -3
- package/sdk/.turbo/turbo-test.log +512 -351
- package/sdk/dist/generated/bml.d.ts +3 -9
- package/sdk/dist/generated/bml.js +6 -7
- package/sdk/dist/generated/counter.d.ts +22 -28
- package/sdk/dist/generated/counter.js +11 -12
- package/sdk/dist/generated/dvn.d.ts +36 -54
- package/sdk/dist/generated/dvn.js +10 -15
- package/sdk/dist/generated/dvn_fee_lib.d.ts +3 -21
- package/sdk/dist/generated/dvn_fee_lib.js +6 -11
- package/sdk/dist/generated/endpoint.d.ts +3 -9
- package/sdk/dist/generated/endpoint.js +6 -7
- package/sdk/dist/generated/executor.d.ts +80 -54
- package/sdk/dist/generated/executor.js +16 -16
- package/sdk/dist/generated/executor_fee_lib.d.ts +3 -21
- package/sdk/dist/generated/executor_fee_lib.js +6 -11
- package/sdk/dist/generated/executor_helper.d.ts +36 -42
- package/sdk/dist/generated/executor_helper.js +9 -10
- package/sdk/dist/generated/layerzero_view.d.ts +20 -32
- package/sdk/dist/generated/layerzero_view.js +25 -26
- package/sdk/dist/generated/oft.d.ts +147 -79
- package/sdk/dist/generated/oft.js +47 -54
- package/sdk/dist/generated/price_feed.d.ts +20 -38
- package/sdk/dist/generated/price_feed.js +15 -20
- package/sdk/dist/generated/sac_manager.d.ts +1309 -0
- package/sdk/dist/generated/sac_manager.js +484 -0
- package/sdk/dist/generated/sml.d.ts +3 -9
- package/sdk/dist/generated/sml.js +6 -7
- package/sdk/dist/generated/treasury.d.ts +3 -9
- package/sdk/dist/generated/treasury.js +8 -9
- package/sdk/dist/generated/uln302.d.ts +20 -20
- package/sdk/dist/generated/uln302.js +25 -22
- package/sdk/dist/generated/upgrader.d.ts +3 -9
- package/sdk/dist/generated/upgrader.js +6 -7
- package/sdk/dist/index.d.ts +1 -0
- package/sdk/dist/index.js +1 -0
- package/sdk/package.json +1 -1
- package/sdk/src/index.ts +1 -0
- package/sdk/test/oft-sml.test.ts +7 -5
- package/sdk/test/sac-manager-redistribution.test.ts +578 -0
- package/sdk/test/suites/globalSetup.ts +11 -6
- package/sdk/test/test_data/test_upgradeable_dvn.wasm +0 -0
- package/sdk/test/upgrader.test.ts +75 -202
- package/sdk/test/utils.ts +40 -0
- package/tools/ts-bindings-gen/src/main.rs +1 -0
package/Cargo.lock
CHANGED
|
@@ -1211,7 +1211,6 @@ dependencies = [
|
|
|
1211
1211
|
name = "oapp-macros"
|
|
1212
1212
|
version = "0.0.1"
|
|
1213
1213
|
dependencies = [
|
|
1214
|
-
"heck 0.5.0",
|
|
1215
1214
|
"insta",
|
|
1216
1215
|
"prettyplease",
|
|
1217
1216
|
"proc-macro2",
|
|
@@ -1437,6 +1436,17 @@ version = "1.0.20"
|
|
|
1437
1436
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1438
1437
|
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
|
|
1439
1438
|
|
|
1439
|
+
[[package]]
|
|
1440
|
+
name = "sac-manager"
|
|
1441
|
+
version = "0.0.1"
|
|
1442
|
+
dependencies = [
|
|
1443
|
+
"cfg-if",
|
|
1444
|
+
"common-macros",
|
|
1445
|
+
"oft",
|
|
1446
|
+
"soroban-sdk",
|
|
1447
|
+
"utils",
|
|
1448
|
+
]
|
|
1449
|
+
|
|
1440
1450
|
[[package]]
|
|
1441
1451
|
name = "schemars"
|
|
1442
1452
|
version = "0.8.22"
|
|
@@ -426,8 +426,6 @@ pub fn contract_trait(attr: TokenStream, item: TokenStream) -> TokenStream {
|
|
|
426
426
|
/// Generated code includes:
|
|
427
427
|
/// - `upgrade(env, new_wasm_hash)` - Upgrades the contract WASM (auth required)
|
|
428
428
|
/// - `migrate(env, migration_data)` - Runs migration after upgrade (auth required, XDR-decodes `Bytes` to `MigrationData`)
|
|
429
|
-
/// - `freeze(env)` - Permanently freezes the contract, preventing any future upgrades (auth required, irreversible)
|
|
430
|
-
/// - `is_frozen(env)` - Returns whether the contract is frozen (upgrades disabled)
|
|
431
429
|
/// - `contractmeta!` with `binver` set to the Cargo package version (if not 0.0.0)
|
|
432
430
|
#[proc_macro_attribute]
|
|
433
431
|
pub fn upgradeable(attr: TokenStream, item: TokenStream) -> TokenStream {
|
|
@@ -154,7 +154,7 @@ impl EndpointV2 {
|
|
|
154
154
|
///
|
|
155
155
|
/// # Returns
|
|
156
156
|
/// * `nonce` - The next nonce for the path
|
|
157
|
-
pub(
|
|
157
|
+
pub(super) fn outbound(env: &Env, sender: &Address, dst_eid: u32, receiver: &BytesN<32>) -> u64 {
|
|
158
158
|
let nonce = Self::outbound_nonce(env, sender, dst_eid, receiver) + 1;
|
|
159
159
|
EndpointStorage::set_outbound_nonce(env, sender, dst_eid, receiver, &nonce);
|
|
160
160
|
nonce
|
|
@@ -172,7 +172,7 @@ impl EndpointV2 {
|
|
|
172
172
|
/// * `sender` - The sender OApp address on the source chain
|
|
173
173
|
/// * `nonce` - The nonce of the message
|
|
174
174
|
/// * `payload_hash` - The payload hash of the message (must not be empty payload hash)
|
|
175
|
-
pub(
|
|
175
|
+
pub(super) fn inbound(
|
|
176
176
|
env: &Env,
|
|
177
177
|
receiver: &Address,
|
|
178
178
|
src_eid: u32,
|
|
@@ -204,7 +204,7 @@ impl EndpointV2 {
|
|
|
204
204
|
/// * `sender` - The sender OApp address on the source chain
|
|
205
205
|
/// * `nonce` - The nonce of the message
|
|
206
206
|
/// * `payload` - The payload of the message
|
|
207
|
-
pub(
|
|
207
|
+
pub(super) fn clear_payload(
|
|
208
208
|
env: &Env,
|
|
209
209
|
receiver: &Address,
|
|
210
210
|
src_eid: u32,
|
|
@@ -260,5 +260,34 @@ mod test {
|
|
|
260
260
|
pub fn nil_payload_hash_for_test(env: &Env) -> BytesN<32> {
|
|
261
261
|
Self::nil_payload_hash(env)
|
|
262
262
|
}
|
|
263
|
+
|
|
264
|
+
/// Test-only wrapper for outbound.
|
|
265
|
+
pub fn outbound_for_test(env: &Env, sender: &Address, dst_eid: u32, receiver: &BytesN<32>) -> u64 {
|
|
266
|
+
Self::outbound(env, sender, dst_eid, receiver)
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/// Test-only wrapper for inbound.
|
|
270
|
+
pub fn inbound_for_test(
|
|
271
|
+
env: &Env,
|
|
272
|
+
receiver: &Address,
|
|
273
|
+
src_eid: u32,
|
|
274
|
+
sender: &BytesN<32>,
|
|
275
|
+
nonce: u64,
|
|
276
|
+
payload_hash: &BytesN<32>,
|
|
277
|
+
) {
|
|
278
|
+
Self::inbound(env, receiver, src_eid, sender, nonce, payload_hash)
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/// Test-only wrapper for clear_payload.
|
|
282
|
+
pub fn clear_payload_for_test(
|
|
283
|
+
env: &Env,
|
|
284
|
+
receiver: &Address,
|
|
285
|
+
src_eid: u32,
|
|
286
|
+
sender: &BytesN<32>,
|
|
287
|
+
nonce: u64,
|
|
288
|
+
payload: &Bytes,
|
|
289
|
+
) {
|
|
290
|
+
Self::clear_payload(env, receiver, src_eid, sender, nonce, payload)
|
|
291
|
+
}
|
|
263
292
|
}
|
|
264
293
|
}
|
|
@@ -292,7 +292,7 @@ impl<'a> TestSetup<'a> {
|
|
|
292
292
|
let env = &self.env;
|
|
293
293
|
let endpoint_client = &self.endpoint_client;
|
|
294
294
|
env.as_contract(&endpoint_client.address, || {
|
|
295
|
-
EndpointV2::
|
|
295
|
+
EndpointV2::inbound_for_test(env, receiver, src_eid, sender, nonce, payload_hash)
|
|
296
296
|
});
|
|
297
297
|
}
|
|
298
298
|
}
|
|
@@ -32,7 +32,7 @@ fn clear_payload(
|
|
|
32
32
|
let env = &context.env;
|
|
33
33
|
let endpoint_client = &context.endpoint_client;
|
|
34
34
|
env.as_contract(&endpoint_client.address, || {
|
|
35
|
-
EndpointV2::
|
|
35
|
+
EndpointV2::clear_payload_for_test(env, receiver, src_eid, sender, nonce, payload)
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -16,7 +16,7 @@ fn test_inbound_success_stores_payload_hash() {
|
|
|
16
16
|
let payload_hash = BytesN::from_array(env, &[0xabu8; 32]); // Valid non-empty payload hash
|
|
17
17
|
|
|
18
18
|
env.as_contract(&endpoint_client.address, || {
|
|
19
|
-
EndpointV2::
|
|
19
|
+
EndpointV2::inbound_for_test(env, &receiver, src_eid, &sender, nonce, &payload_hash)
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
let stored_hash = endpoint_client.inbound_payload_hash(&receiver, &src_eid, &sender, &nonce);
|
|
@@ -26,7 +26,7 @@ fn test_inbound_success_stores_payload_hash() {
|
|
|
26
26
|
let nonce2 = 2;
|
|
27
27
|
let payload_hash2 = BytesN::from_array(env, &[0xcdu8; 32]);
|
|
28
28
|
env.as_contract(&endpoint_client.address, || {
|
|
29
|
-
EndpointV2::
|
|
29
|
+
EndpointV2::inbound_for_test(env, &receiver, src_eid, &sender, nonce2, &payload_hash2)
|
|
30
30
|
});
|
|
31
31
|
assert_eq!(
|
|
32
32
|
endpoint_client.inbound_payload_hash(&receiver, &src_eid, &sender, &nonce2),
|
|
@@ -37,7 +37,7 @@ fn test_inbound_success_stores_payload_hash() {
|
|
|
37
37
|
let different_receiver = Address::generate(env);
|
|
38
38
|
let payload_hash3 = BytesN::from_array(env, &[0xefu8; 32]);
|
|
39
39
|
env.as_contract(&endpoint_client.address, || {
|
|
40
|
-
EndpointV2::
|
|
40
|
+
EndpointV2::inbound_for_test(env, &different_receiver, src_eid, &sender, nonce, &payload_hash3)
|
|
41
41
|
});
|
|
42
42
|
assert_eq!(
|
|
43
43
|
endpoint_client.inbound_payload_hash(&different_receiver, &src_eid, &sender, &nonce),
|
|
@@ -61,7 +61,7 @@ fn test_inbound_overwrites_same_nonce() {
|
|
|
61
61
|
let payload_hash_b = BytesN::from_array(env, &[0xcdu8; 32]);
|
|
62
62
|
|
|
63
63
|
env.as_contract(&endpoint_client.address, || {
|
|
64
|
-
EndpointV2::
|
|
64
|
+
EndpointV2::inbound_for_test(env, &receiver, src_eid, &sender, nonce, &payload_hash_a)
|
|
65
65
|
});
|
|
66
66
|
assert_eq!(
|
|
67
67
|
endpoint_client.inbound_payload_hash(&receiver, &src_eid, &sender, &nonce),
|
|
@@ -70,7 +70,7 @@ fn test_inbound_overwrites_same_nonce() {
|
|
|
70
70
|
|
|
71
71
|
// Overwrite the same nonce with a different payload hash.
|
|
72
72
|
env.as_contract(&endpoint_client.address, || {
|
|
73
|
-
EndpointV2::
|
|
73
|
+
EndpointV2::inbound_for_test(env, &receiver, src_eid, &sender, nonce, &payload_hash_b)
|
|
74
74
|
});
|
|
75
75
|
assert_eq!(endpoint_client.inbound_payload_hash(&receiver, &src_eid, &sender, &nonce), Some(payload_hash_b));
|
|
76
76
|
}
|
|
@@ -89,6 +89,6 @@ fn test_inbound_rejects_empty_payload_hash() {
|
|
|
89
89
|
let empty_hash = BytesN::from_array(env, &[0u8; 32]); // empty payload hash is invalid for inbound()
|
|
90
90
|
|
|
91
91
|
env.as_contract(&endpoint_client.address, || {
|
|
92
|
-
EndpointV2::
|
|
92
|
+
EndpointV2::inbound_for_test(env, &receiver, src_eid, &sender, nonce, &empty_hash)
|
|
93
93
|
});
|
|
94
94
|
}
|
|
@@ -32,7 +32,7 @@ fn test_inbound_payload_hash_after_setting() {
|
|
|
32
32
|
|
|
33
33
|
// Set payload hash using inbound function
|
|
34
34
|
env.as_contract(&endpoint_client.address, || {
|
|
35
|
-
EndpointV2::
|
|
35
|
+
EndpointV2::inbound_for_test(env, &receiver, src_eid, &sender, nonce, &expected_hash)
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
// Verify payload hash is retrieved correctly
|
|
@@ -14,33 +14,39 @@ fn test_outbound_increments_and_is_path_scoped() {
|
|
|
14
14
|
let receiver = BytesN::from_array(env, &[1u8; 32]);
|
|
15
15
|
|
|
16
16
|
// First call should return nonce 1
|
|
17
|
-
let nonce1 =
|
|
17
|
+
let nonce1 =
|
|
18
|
+
env.as_contract(&endpoint_client.address, || EndpointV2::outbound_for_test(env, &sender, dst_eid, &receiver));
|
|
18
19
|
assert_eq!(nonce1, 1);
|
|
19
20
|
|
|
20
21
|
// Second call should return nonce 2
|
|
21
|
-
let nonce2 =
|
|
22
|
+
let nonce2 =
|
|
23
|
+
env.as_contract(&endpoint_client.address, || EndpointV2::outbound_for_test(env, &sender, dst_eid, &receiver));
|
|
22
24
|
assert_eq!(nonce2, 2);
|
|
23
25
|
|
|
24
26
|
// Third call should return nonce 3
|
|
25
|
-
let nonce3 =
|
|
27
|
+
let nonce3 =
|
|
28
|
+
env.as_contract(&endpoint_client.address, || EndpointV2::outbound_for_test(env, &sender, dst_eid, &receiver));
|
|
26
29
|
assert_eq!(nonce3, 3);
|
|
27
30
|
|
|
28
31
|
// Different sender should have independent nonce counter (starts at 1)
|
|
29
32
|
let different_sender = Address::generate(env);
|
|
30
|
-
let nonce_diff_sender =
|
|
31
|
-
|
|
33
|
+
let nonce_diff_sender = env.as_contract(&endpoint_client.address, || {
|
|
34
|
+
EndpointV2::outbound_for_test(env, &different_sender, dst_eid, &receiver)
|
|
35
|
+
});
|
|
32
36
|
assert_eq!(nonce_diff_sender, 1);
|
|
33
37
|
|
|
34
38
|
// Different dst_eid should have independent nonce counter (starts at 1)
|
|
35
39
|
let different_dst_eid = 3;
|
|
36
|
-
let nonce_diff_dst =
|
|
37
|
-
|
|
40
|
+
let nonce_diff_dst = env.as_contract(&endpoint_client.address, || {
|
|
41
|
+
EndpointV2::outbound_for_test(env, &sender, different_dst_eid, &receiver)
|
|
42
|
+
});
|
|
38
43
|
assert_eq!(nonce_diff_dst, 1);
|
|
39
44
|
|
|
40
45
|
// Different receiver should have independent nonce counter (starts at 1)
|
|
41
46
|
let different_receiver = BytesN::from_array(env, &[2u8; 32]);
|
|
42
|
-
let nonce_diff_receiver =
|
|
43
|
-
|
|
47
|
+
let nonce_diff_receiver = env.as_contract(&endpoint_client.address, || {
|
|
48
|
+
EndpointV2::outbound_for_test(env, &sender, dst_eid, &different_receiver)
|
|
49
|
+
});
|
|
44
50
|
assert_eq!(nonce_diff_receiver, 1);
|
|
45
51
|
|
|
46
52
|
// Verify state was updated correctly for original path.
|
|
@@ -64,5 +70,5 @@ fn test_outbound_panics_on_u64_overflow() {
|
|
|
64
70
|
storage::EndpointStorage::set_outbound_nonce(env, &sender, dst_eid, &receiver, &u64::MAX)
|
|
65
71
|
});
|
|
66
72
|
|
|
67
|
-
env.as_contract(&endpoint_client.address, || EndpointV2::
|
|
73
|
+
env.as_contract(&endpoint_client.address, || EndpointV2::outbound_for_test(env, &sender, dst_eid, &receiver));
|
|
68
74
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Runtime tests: OAppOptionsType3 defaults generated by `#[oapp]`.
|
|
2
2
|
|
|
3
3
|
use super::{TestOApp, TestOAppClient};
|
|
4
|
-
use oapp::errors::OAppError;
|
|
5
4
|
use oapp::oapp_options_type3::{EnforcedOptionParam, EnforcedOptionSet};
|
|
5
|
+
use oapp::OAppError;
|
|
6
6
|
use soroban_sdk::{
|
|
7
7
|
testutils::{Address as _, MockAuth, MockAuthInvoke},
|
|
8
8
|
vec, Address, Bytes, Env, IntoVal,
|
|
@@ -29,15 +29,15 @@ fn enforced_options_lifecycle_and_auth() {
|
|
|
29
29
|
let owner = Address::generate(&env);
|
|
30
30
|
client.init(&owner, &Address::generate(&env));
|
|
31
31
|
|
|
32
|
-
// Unset returns
|
|
33
|
-
assert_eq!(client.enforced_options(&999, &999),
|
|
32
|
+
// Unset returns None (storage default).
|
|
33
|
+
assert_eq!(client.enforced_options(&999, &999), None);
|
|
34
34
|
|
|
35
35
|
let enforced_1 = create_valid_options(&env, &[1, 2, 3, 4]);
|
|
36
36
|
let enforced_2 = create_valid_options(&env, &[5, 6, 7, 8]);
|
|
37
37
|
let params = vec![
|
|
38
38
|
&env,
|
|
39
|
-
EnforcedOptionParam { eid: REMOTE_EID_1, msg_type: MSG_TYPE_SEND, options: enforced_1.clone() },
|
|
40
|
-
EnforcedOptionParam { eid: REMOTE_EID_1, msg_type: MSG_TYPE_RECEIVE, options: enforced_2.clone() },
|
|
39
|
+
EnforcedOptionParam { eid: REMOTE_EID_1, msg_type: MSG_TYPE_SEND, options: Some(enforced_1.clone()) },
|
|
40
|
+
EnforcedOptionParam { eid: REMOTE_EID_1, msg_type: MSG_TYPE_RECEIVE, options: Some(enforced_2.clone()) },
|
|
41
41
|
];
|
|
42
42
|
|
|
43
43
|
// Unauthorized set should fail (only_auth).
|
|
@@ -68,10 +68,10 @@ fn enforced_options_lifecycle_and_auth() {
|
|
|
68
68
|
}]);
|
|
69
69
|
client.set_enforced_options(¶ms);
|
|
70
70
|
|
|
71
|
-
assert_contains_event(&env, &contract_id, EnforcedOptionSet {
|
|
71
|
+
assert_contains_event(&env, &contract_id, EnforcedOptionSet { enforced_options: params.clone() });
|
|
72
72
|
|
|
73
|
-
assert_eq!(client.enforced_options(&REMOTE_EID_1, &MSG_TYPE_SEND), enforced_1);
|
|
74
|
-
assert_eq!(client.enforced_options(&REMOTE_EID_1, &MSG_TYPE_RECEIVE), enforced_2);
|
|
73
|
+
assert_eq!(client.enforced_options(&REMOTE_EID_1, &MSG_TYPE_SEND), Some(enforced_1));
|
|
74
|
+
assert_eq!(client.enforced_options(&REMOTE_EID_1, &MSG_TYPE_RECEIVE), Some(enforced_2));
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
#[test]
|
|
@@ -87,7 +87,7 @@ fn set_enforced_options_rejects_invalid_option_type() {
|
|
|
87
87
|
let mut invalid = Bytes::from_array(&env, &(4u16).to_be_bytes());
|
|
88
88
|
invalid.extend_from_slice(&[1, 2, 3]);
|
|
89
89
|
|
|
90
|
-
let params = vec![&env, EnforcedOptionParam { eid: REMOTE_EID_1, msg_type: MSG_TYPE_SEND, options: invalid }];
|
|
90
|
+
let params = vec![&env, EnforcedOptionParam { eid: REMOTE_EID_1, msg_type: MSG_TYPE_SEND, options: Some(invalid) }];
|
|
91
91
|
|
|
92
92
|
env.mock_auths(&[MockAuth {
|
|
93
93
|
address: &owner,
|
|
@@ -120,7 +120,7 @@ fn combine_options_behavior_and_validation() {
|
|
|
120
120
|
// Set enforced for (eid, msg_type).
|
|
121
121
|
let enforced = create_valid_options(&env, &[1, 2, 3, 4]);
|
|
122
122
|
let params =
|
|
123
|
-
vec![&env, EnforcedOptionParam { eid: REMOTE_EID_1, msg_type: MSG_TYPE_SEND, options: enforced.clone() }];
|
|
123
|
+
vec![&env, EnforcedOptionParam { eid: REMOTE_EID_1, msg_type: MSG_TYPE_SEND, options: Some(enforced.clone()) }];
|
|
124
124
|
env.mock_auths(&[MockAuth {
|
|
125
125
|
address: &owner,
|
|
126
126
|
invoke: &MockAuthInvoke {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
use super::{TestOApp, TestOAppClient};
|
|
4
4
|
use endpoint_v2::Origin;
|
|
5
|
-
use oapp::
|
|
5
|
+
use oapp::OAppError;
|
|
6
6
|
use soroban_sdk::{
|
|
7
7
|
contract, contractimpl, symbol_short,
|
|
8
8
|
testutils::{Address as _, MockAuth, MockAuthInvoke},
|
|
@@ -264,7 +264,7 @@ fn lz_receive_wrong_peer_returns_only_peer() {
|
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
#[test]
|
|
267
|
-
fn
|
|
267
|
+
fn lz_receive_no_peer_returns_no_peer() {
|
|
268
268
|
let env = Env::default();
|
|
269
269
|
|
|
270
270
|
let owner = Address::generate(&env);
|
|
@@ -295,7 +295,7 @@ fn lz_receive_no_peer_returns_only_peer() {
|
|
|
295
295
|
}]);
|
|
296
296
|
|
|
297
297
|
let result = oapp_client.try_lz_receive(&executor, &origin, &guid, &message, &extra_data, &value);
|
|
298
|
-
assert_eq!(result.err().unwrap().ok().unwrap(), OAppError::
|
|
298
|
+
assert_eq!(result.err().unwrap().ok().unwrap(), OAppError::NoPeer.into());
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
#[test]
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// Runtime tests: OAppSenderInternal defaults generated by `#[oapp]`.
|
|
2
2
|
|
|
3
3
|
use endpoint_v2::{MessagingFee, MessagingParams, MessagingReceipt, Origin};
|
|
4
|
-
use oapp::errors::OAppError;
|
|
5
4
|
use oapp::oapp_receiver::LzReceiveInternal;
|
|
5
|
+
use oapp::oapp_sender::FeePayer;
|
|
6
|
+
use oapp::OAppError;
|
|
6
7
|
use oapp_macros::oapp;
|
|
7
8
|
use soroban_sdk::{
|
|
8
9
|
contract, contractimpl, symbol_short,
|
|
@@ -93,7 +94,7 @@ impl LzReceiveInternal for TestOAppSender {
|
|
|
93
94
|
#[contractimpl]
|
|
94
95
|
impl TestOAppSender {
|
|
95
96
|
pub fn init(env: Env, owner: Address, endpoint: Address) {
|
|
96
|
-
oapp::oapp_core::initialize_oapp::<Self>(&env, &owner, &endpoint, &
|
|
97
|
+
oapp::oapp_core::initialize_oapp::<Self>(&env, &owner, &endpoint, &owner);
|
|
97
98
|
}
|
|
98
99
|
|
|
99
100
|
pub fn quote(env: &Env, dst_eid: u32, message: &Bytes, options: &Bytes, pay_in_zro: bool) -> MessagingFee {
|
|
@@ -110,7 +111,7 @@ impl TestOAppSender {
|
|
|
110
111
|
refund_address: &Address,
|
|
111
112
|
) -> MessagingReceipt {
|
|
112
113
|
sender.require_auth();
|
|
113
|
-
Self::__lz_send(env, dst_eid, message, options, sender, fee, refund_address)
|
|
114
|
+
Self::__lz_send(env, dst_eid, message, options, &FeePayer::Verified(sender.clone()), fee, refund_address)
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
117
|
|
package/contracts/macro-integration-tests/tests/runtime/upgradeable/migrate_guard_and_state.rs
CHANGED
|
@@ -187,60 +187,7 @@ fn migrate_is_guarded_and_obeys_migrating_flag() {
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
#[test]
|
|
190
|
-
fn
|
|
191
|
-
let env = Env::default();
|
|
192
|
-
let contract_id = env.register(TestContract, ());
|
|
193
|
-
let client = TestContractClient::new(&env, &contract_id);
|
|
194
|
-
|
|
195
|
-
let owner = Address::generate(&env);
|
|
196
|
-
client.init(&owner);
|
|
197
|
-
|
|
198
|
-
// Unauthorized freeze should fail.
|
|
199
|
-
let unauthorized = client.try_freeze();
|
|
200
|
-
assert_eq!(
|
|
201
|
-
unauthorized.unwrap_err().unwrap(),
|
|
202
|
-
Error::from_type_and_code(ScErrorType::Context, ScErrorCode::InvalidAction)
|
|
203
|
-
);
|
|
204
|
-
|
|
205
|
-
// Authorized freeze should succeed.
|
|
206
|
-
client
|
|
207
|
-
.mock_auths(&[MockAuth {
|
|
208
|
-
address: &owner,
|
|
209
|
-
invoke: &MockAuthInvoke {
|
|
210
|
-
contract: &contract_id,
|
|
211
|
-
fn_name: "freeze",
|
|
212
|
-
args: ().into_val(&env),
|
|
213
|
-
sub_invokes: &[],
|
|
214
|
-
},
|
|
215
|
-
}])
|
|
216
|
-
.freeze();
|
|
217
|
-
|
|
218
|
-
env.as_contract(&contract_id, || {
|
|
219
|
-
assert_eq!(UpgradeableStorage::frozen(&env), true);
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
// After freeze, upgrade should fail with UpgradesFrozen (even with auth).
|
|
223
|
-
let hash = BytesN::<32>::from_array(&env, &[7u8; 32]);
|
|
224
|
-
let frozen_upgrade = client
|
|
225
|
-
.mock_auths(&[MockAuth {
|
|
226
|
-
address: &owner,
|
|
227
|
-
invoke: &MockAuthInvoke {
|
|
228
|
-
contract: &contract_id,
|
|
229
|
-
fn_name: "upgrade",
|
|
230
|
-
args: (&hash,).into_val(&env),
|
|
231
|
-
sub_invokes: &[],
|
|
232
|
-
},
|
|
233
|
-
}])
|
|
234
|
-
.try_upgrade(&hash);
|
|
235
|
-
|
|
236
|
-
assert_eq!(
|
|
237
|
-
frozen_upgrade.err().unwrap().ok().unwrap(),
|
|
238
|
-
utils::errors::UpgradeableError::UpgradesFrozen.into()
|
|
239
|
-
);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
#[test]
|
|
243
|
-
fn upgrade_freeze_and_migrate_fail_before_owner_init() {
|
|
190
|
+
fn upgrade_and_migrate_fail_before_owner_init() {
|
|
244
191
|
let env = Env::default();
|
|
245
192
|
let contract_id = env.register(TestContract, ());
|
|
246
193
|
let client = TestContractClient::new(&env, &contract_id);
|
|
@@ -250,9 +197,6 @@ fn upgrade_freeze_and_migrate_fail_before_owner_init() {
|
|
|
250
197
|
let hash = BytesN::<32>::from_array(&env, &[7u8; 32]);
|
|
251
198
|
assert_eq!(client.try_upgrade(&hash).unwrap_err().unwrap(), OwnableError::OwnerNotSet.into());
|
|
252
199
|
|
|
253
|
-
// freeze() should also fail the same way.
|
|
254
|
-
assert_eq!(client.try_freeze().unwrap_err().unwrap(), OwnableError::OwnerNotSet.into());
|
|
255
|
-
|
|
256
200
|
// Even if migrating is set, migrate() still fails before init because auth can't resolve authorizer.
|
|
257
201
|
env.as_contract(&contract_id, || {
|
|
258
202
|
UpgradeableStorage::set_migrating(&env, &true);
|
|
@@ -40,36 +40,6 @@ note: required by a bound in `migrate`
|
|
|
40
40
|
| fn migrate(env: &soroban_sdk::Env, migration_data: &soroban_sdk::Bytes) {
|
|
41
41
|
| ------- required by a bound in this associated function
|
|
42
42
|
|
|
43
|
-
error[E0277]: the trait bound `MyContract: UpgradeableInternal` is not satisfied
|
|
44
|
-
--> tests/ui/lz_contract/fail/upgradeable_missing_internal.rs:12:12
|
|
45
|
-
|
|
|
46
|
-
12 | pub struct MyContract;
|
|
47
|
-
| ^^^^^^^^^^ the trait `UpgradeableInternal` is not implemented for `MyContract`
|
|
48
|
-
|
|
|
49
|
-
note: required by a bound in `freeze`
|
|
50
|
-
--> $WORKSPACE/contracts/utils/src/upgradeable.rs
|
|
51
|
-
|
|
|
52
|
-
| pub trait Upgradeable: UpgradeableInternal + Auth {
|
|
53
|
-
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `Upgradeable::freeze`
|
|
54
|
-
...
|
|
55
|
-
| fn freeze(env: &soroban_sdk::Env) {
|
|
56
|
-
| ------ required by a bound in this associated function
|
|
57
|
-
|
|
58
|
-
error[E0277]: the trait bound `MyContract: UpgradeableInternal` is not satisfied
|
|
59
|
-
--> tests/ui/lz_contract/fail/upgradeable_missing_internal.rs:12:12
|
|
60
|
-
|
|
|
61
|
-
12 | pub struct MyContract;
|
|
62
|
-
| ^^^^^^^^^^ the trait `UpgradeableInternal` is not implemented for `MyContract`
|
|
63
|
-
|
|
|
64
|
-
note: required by a bound in `is_frozen`
|
|
65
|
-
--> $WORKSPACE/contracts/utils/src/upgradeable.rs
|
|
66
|
-
|
|
|
67
|
-
| pub trait Upgradeable: UpgradeableInternal + Auth {
|
|
68
|
-
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `Upgradeable::is_frozen`
|
|
69
|
-
...
|
|
70
|
-
| fn is_frozen(env: &soroban_sdk::Env) -> bool {
|
|
71
|
-
| --------- required by a bound in this associated function
|
|
72
|
-
|
|
73
43
|
error[E0277]: the trait bound `MyContract: UpgradeableInternal` is not satisfied
|
|
74
44
|
--> tests/ui/lz_contract/fail/upgradeable_missing_internal.rs:17:5
|
|
75
45
|
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
error:
|
|
2
|
-
--> tests/ui/oapp/fail/custom_wrong_value.rs:5:
|
|
1
|
+
error: custom attribute panicked
|
|
2
|
+
--> tests/ui/oapp/fail/custom_wrong_value.rs:5:1
|
|
3
3
|
|
|
|
4
4
|
5 | #[oapp(custom = core)]
|
|
5
|
-
|
|
|
5
|
+
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
6
|
+
|
|
|
7
|
+
= help: message: failed to parse oapp attributes: expected square brackets
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
error:
|
|
2
|
-
--> tests/ui/oapp/fail/non_struct_input.rs:
|
|
1
|
+
error: custom attribute panicked
|
|
2
|
+
--> tests/ui/oapp/fail/non_struct_input.rs:5:1
|
|
3
3
|
|
|
|
4
|
-
|
|
5
|
-
|
|
|
4
|
+
5 | #[oapp]
|
|
5
|
+
| ^^^^^^^
|
|
6
|
+
|
|
|
7
|
+
= help: message: failed to parse struct: expected `struct`
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
error:
|
|
2
|
-
--> tests/ui/oapp/fail/unknown_custom_option.rs:5:
|
|
1
|
+
error: custom attribute panicked
|
|
2
|
+
--> tests/ui/oapp/fail/unknown_custom_option.rs:5:1
|
|
3
3
|
|
|
|
4
4
|
5 | #[oapp(custom = [core, not_a_real_option])]
|
|
5
|
-
|
|
|
5
|
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
6
|
+
|
|
|
7
|
+
= help: message: failed to parse oapp attributes: expected one of `core`, `sender`, `receiver`, `options_type3`
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
error:
|
|
2
|
-
--> tests/ui/oapp/fail/wrong_key.rs:5:
|
|
1
|
+
error: custom attribute panicked
|
|
2
|
+
--> tests/ui/oapp/fail/wrong_key.rs:5:1
|
|
3
3
|
|
|
|
4
4
|
5 | #[oapp(nope = [core])]
|
|
5
|
-
|
|
|
5
|
+
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
6
|
+
|
|
|
7
|
+
= help: message: failed to parse oapp attributes: expected `custom`
|
package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/missing_auth_trait.stderr
CHANGED
|
@@ -39,33 +39,3 @@ note: required by a bound in `migrate`
|
|
|
39
39
|
...
|
|
40
40
|
| fn migrate(env: &soroban_sdk::Env, migration_data: &soroban_sdk::Bytes) {
|
|
41
41
|
| ------- required by a bound in this associated function
|
|
42
|
-
|
|
43
|
-
error[E0277]: the trait bound `MyContract: utils::auth::Auth` is not satisfied
|
|
44
|
-
--> tests/ui/upgradeable/fail/missing_auth_trait.rs:12:12
|
|
45
|
-
|
|
|
46
|
-
12 | pub struct MyContract;
|
|
47
|
-
| ^^^^^^^^^^ the trait `utils::auth::Auth` is not implemented for `MyContract`
|
|
48
|
-
|
|
|
49
|
-
note: required by a bound in `freeze`
|
|
50
|
-
--> $WORKSPACE/contracts/utils/src/upgradeable.rs
|
|
51
|
-
|
|
|
52
|
-
| pub trait Upgradeable: UpgradeableInternal + Auth {
|
|
53
|
-
| ^^^^ required by this bound in `Upgradeable::freeze`
|
|
54
|
-
...
|
|
55
|
-
| fn freeze(env: &soroban_sdk::Env) {
|
|
56
|
-
| ------ required by a bound in this associated function
|
|
57
|
-
|
|
58
|
-
error[E0277]: the trait bound `MyContract: utils::auth::Auth` is not satisfied
|
|
59
|
-
--> tests/ui/upgradeable/fail/missing_auth_trait.rs:12:12
|
|
60
|
-
|
|
|
61
|
-
12 | pub struct MyContract;
|
|
62
|
-
| ^^^^^^^^^^ the trait `utils::auth::Auth` is not implemented for `MyContract`
|
|
63
|
-
|
|
|
64
|
-
note: required by a bound in `is_frozen`
|
|
65
|
-
--> $WORKSPACE/contracts/utils/src/upgradeable.rs
|
|
66
|
-
|
|
|
67
|
-
| pub trait Upgradeable: UpgradeableInternal + Auth {
|
|
68
|
-
| ^^^^ required by this bound in `Upgradeable::is_frozen`
|
|
69
|
-
...
|
|
70
|
-
| fn is_frozen(env: &soroban_sdk::Env) -> bool {
|
|
71
|
-
| --------- required by a bound in this associated function
|
|
@@ -47,33 +47,3 @@ note: required by a bound in `migrate`
|
|
|
47
47
|
...
|
|
48
48
|
| fn migrate(env: &soroban_sdk::Env, migration_data: &soroban_sdk::Bytes) {
|
|
49
49
|
| ------- required by a bound in this associated function
|
|
50
|
-
|
|
51
|
-
error[E0277]: the trait bound `MyContract: UpgradeableInternal` is not satisfied
|
|
52
|
-
--> tests/ui/upgradeable/fail/missing_upgradeable_internal.rs:8:12
|
|
53
|
-
|
|
|
54
|
-
8 | pub struct MyContract;
|
|
55
|
-
| ^^^^^^^^^^ the trait `UpgradeableInternal` is not implemented for `MyContract`
|
|
56
|
-
|
|
|
57
|
-
note: required by a bound in `freeze`
|
|
58
|
-
--> $WORKSPACE/contracts/utils/src/upgradeable.rs
|
|
59
|
-
|
|
|
60
|
-
| pub trait Upgradeable: UpgradeableInternal + Auth {
|
|
61
|
-
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `Upgradeable::freeze`
|
|
62
|
-
...
|
|
63
|
-
| fn freeze(env: &soroban_sdk::Env) {
|
|
64
|
-
| ------ required by a bound in this associated function
|
|
65
|
-
|
|
66
|
-
error[E0277]: the trait bound `MyContract: UpgradeableInternal` is not satisfied
|
|
67
|
-
--> tests/ui/upgradeable/fail/missing_upgradeable_internal.rs:8:12
|
|
68
|
-
|
|
|
69
|
-
8 | pub struct MyContract;
|
|
70
|
-
| ^^^^^^^^^^ the trait `UpgradeableInternal` is not implemented for `MyContract`
|
|
71
|
-
|
|
|
72
|
-
note: required by a bound in `is_frozen`
|
|
73
|
-
--> $WORKSPACE/contracts/utils/src/upgradeable.rs
|
|
74
|
-
|
|
|
75
|
-
| pub trait Upgradeable: UpgradeableInternal + Auth {
|
|
76
|
-
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `Upgradeable::is_frozen`
|
|
77
|
-
...
|
|
78
|
-
| fn is_frozen(env: &soroban_sdk::Env) -> bool {
|
|
79
|
-
| --------- required by a bound in this associated function
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
//
|
|
3
3
|
// Purpose:
|
|
4
4
|
// - Ensures the macro-generated `impl utils::upgradeable::Upgradeable for Contract` is enough to
|
|
5
|
-
// provide the upgrade/migrate
|
|
5
|
+
// provide the upgrade/migrate entrypoints.
|
|
6
6
|
// - Covers the common pattern where the contract does not define any custom entrypoints.
|
|
7
7
|
|
|
8
8
|
use soroban_sdk::{contract, Address, Bytes, BytesN, Env};
|
|
@@ -22,8 +22,6 @@ fn typecheck(env: &Env, owner: &Address) {
|
|
|
22
22
|
let migration_data = Bytes::new(env);
|
|
23
23
|
MyContract::upgrade(env, &hash);
|
|
24
24
|
MyContract::migrate(env, &migration_data);
|
|
25
|
-
MyContract::freeze(env);
|
|
26
|
-
let _frozen: bool = MyContract::is_frozen(env);
|
|
27
25
|
}
|
|
28
26
|
|
|
29
27
|
fn main() {}
|