From f83cf9b30035c339e136afb0ee15affe1f131a6d Mon Sep 17 00:00:00 2001 From: Artem Gureev Date: Mon, 17 Aug 2026 13:27:43 +0000 Subject: [PATCH] perf(lee): extend the caller set for the child authorization scope --- .../src/execution_state.rs | 8 +++----- .../src/validated_state_diff/mod.rs | 19 ++++++++----------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/lee/privacy_preserving_circuit/src/execution_state.rs b/lee/privacy_preserving_circuit/src/execution_state.rs index 781f0cdac..67089dd11 100644 --- a/lee/privacy_preserving_circuit/src/execution_state.rs +++ b/lee/privacy_preserving_circuit/src/execution_state.rs @@ -492,11 +492,9 @@ impl ExecutionState { post_states_entry.insert_entry(post.into_account()); } - caller - .authorized_accounts - .into_iter() - .chain(authorized_output_accounts) - .collect() + let mut authorized_accounts = caller.authorized_accounts; + authorized_accounts.extend(authorized_output_accounts); + authorized_accounts } /// Consume self and yield the validity windows, the per-position PDA seed/program map diff --git a/lee/state_machine/src/validated_state_diff/mod.rs b/lee/state_machine/src/validated_state_diff/mod.rs index 3598b16ba..7afb99b1f 100644 --- a/lee/state_machine/src/validated_state_diff/mod.rs +++ b/lee/state_machine/src/validated_state_diff/mod.rs @@ -264,17 +264,14 @@ impl ValidatedStateDiff { // Union with the caller's authorized set so that authorization is monotonically // growing: once an account is authorized at any point in the chain it remains // authorized for all subsequent calls. - let authorized_accounts: HashSet<_> = caller_data - .authorized_accounts - .into_iter() - .chain( - program_output - .pre_states - .iter() - .filter(|pre| pre.is_authorized) - .map(|pre| pre.account_id), - ) - .collect(); + let mut authorized_accounts = caller_data.authorized_accounts; + authorized_accounts.extend( + program_output + .pre_states + .iter() + .filter(|pre| pre.is_authorized) + .map(|pre| pre.account_id), + ); for new_call in program_output.chained_calls.into_iter().rev() { chained_calls.push_front(( new_call,