From 2e8a01ac95eab639ef4b0bf698f60aa8de35cacf Mon Sep 17 00:00:00 2001 From: Artem Gureev Date: Fri, 24 Jul 2026 17:00:36 +0000 Subject: [PATCH] refactor: warn on private-padding saturation and rename to execute_and_prove_with_padded_inputs --- .../src/privacy_preserving_transaction/circuit/mod.rs | 4 ++-- lez/wallet/src/account_manager.rs | 7 +++++++ lez/wallet/src/lib.rs | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lee/state_machine/src/privacy_preserving_transaction/circuit/mod.rs b/lee/state_machine/src/privacy_preserving_transaction/circuit/mod.rs index 5127531a..d907a1e8 100644 --- a/lee/state_machine/src/privacy_preserving_transaction/circuit/mod.rs +++ b/lee/state_machine/src/privacy_preserving_transaction/circuit/mod.rs @@ -71,7 +71,7 @@ pub fn execute_and_prove( account_identities: Vec, program_with_dependencies: &ProgramWithDependencies, ) -> Result<(PrivacyPreservingCircuitOutput, Proof), LeeError> { - execute_and_prove_with_dummy_inputs( + execute_and_prove_with_padded_inputs( pre_states, instruction_data, account_identities, @@ -80,7 +80,7 @@ pub fn execute_and_prove( ) } -pub fn execute_and_prove_with_dummy_inputs( +pub fn execute_and_prove_with_padded_inputs( pre_states: Vec, instruction_data: InstructionData, account_identities: Vec, diff --git a/lez/wallet/src/account_manager.rs b/lez/wallet/src/account_manager.rs index c05549ee..3f7c43e0 100644 --- a/lez/wallet/src/account_manager.rs +++ b/lez/wallet/src/account_manager.rs @@ -420,6 +420,13 @@ impl AccountManager { .iter() .filter(|state| matches!(state, State::Private(_))) .count(); + if private_count > Self::MAX_PRIVATE_ACCOUNTS { + log::warn!( + "private account count {private_count} exceeds MAX_PRIVATE_ACCOUNTS ({}); \ + padding saturates and the private-input count is not hidden", + Self::MAX_PRIVATE_ACCOUNTS + ); + } self.dummy_inputs(Self::MAX_PRIVATE_ACCOUNTS.saturating_sub(private_count)) } diff --git a/lez/wallet/src/lib.rs b/lez/wallet/src/lib.rs index 9bd81110..b53a1636 100644 --- a/lez/wallet/src/lib.rs +++ b/lez/wallet/src/lib.rs @@ -775,7 +775,7 @@ impl WalletCore { let private_account_keys = acc_manager.private_account_keys(); let (output, proof) = - lee::privacy_preserving_transaction::circuit::execute_and_prove_with_dummy_inputs( + lee::privacy_preserving_transaction::circuit::execute_and_prove_with_padded_inputs( pre_states, instruction_data, acc_manager.account_identities(),