From 2f0b4ef95365292a8061042ecc7e4fc8c478f655 Mon Sep 17 00:00:00 2001 From: Dmytro Kozhevin Date: Wed, 11 Dec 2024 19:46:48 -0500 Subject: [PATCH] Preserve the recording auth settings when temporarily switching to recording auth. Previously this didn't matter as we've only switched for the contract instantiation, but now the contract instantiation may run custom logic due to constructors, so we need to preserve the settings (currently only dissallowing non-root auth). --- soroban-sdk/src/env.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/soroban-sdk/src/env.rs b/soroban-sdk/src/env.rs index 8fd002ba4..8903134af 100644 --- a/soroban-sdk/src/env.rs +++ b/soroban-sdk/src/env.rs @@ -965,7 +965,9 @@ impl Env { .unwrap(); let prev_auth_manager = self.env_impl.snapshot_auth_manager().unwrap(); - self.env_impl.switch_to_recording_auth(true).unwrap(); + self.env_impl + .switch_to_recording_auth_inherited_from_snapshot(&prev_auth_manager) + .unwrap(); self.invoke_contract::<()>( &token_id, &soroban_sdk_macros::internal_symbol_short!("set_admin"), @@ -1014,7 +1016,9 @@ impl Env { constructor_args: Vec, ) -> Address { let prev_auth_manager = self.env_impl.snapshot_auth_manager().unwrap(); - self.env_impl.switch_to_recording_auth(true).unwrap(); + self.env_impl + .switch_to_recording_auth_inherited_from_snapshot(&prev_auth_manager) + .unwrap(); let args_vec: std::vec::Vec = constructor_args.iter().map(|v| v.into_val(self)).collect(); let contract_id: Address = self