refactor: warn on private-padding saturation and rename to execute_and_prove_with_padded_inputs

This commit is contained in:
Artem Gureev 2026-07-24 17:00:36 +00:00
parent 2ed620097b
commit 2e8a01ac95
3 changed files with 10 additions and 3 deletions

View File

@ -71,7 +71,7 @@ pub fn execute_and_prove(
account_identities: Vec<InputAccountIdentity>, account_identities: Vec<InputAccountIdentity>,
program_with_dependencies: &ProgramWithDependencies, program_with_dependencies: &ProgramWithDependencies,
) -> Result<(PrivacyPreservingCircuitOutput, Proof), LeeError> { ) -> Result<(PrivacyPreservingCircuitOutput, Proof), LeeError> {
execute_and_prove_with_dummy_inputs( execute_and_prove_with_padded_inputs(
pre_states, pre_states,
instruction_data, instruction_data,
account_identities, 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<AccountWithMetadata>, pre_states: Vec<AccountWithMetadata>,
instruction_data: InstructionData, instruction_data: InstructionData,
account_identities: Vec<InputAccountIdentity>, account_identities: Vec<InputAccountIdentity>,

View File

@ -420,6 +420,13 @@ impl AccountManager {
.iter() .iter()
.filter(|state| matches!(state, State::Private(_))) .filter(|state| matches!(state, State::Private(_)))
.count(); .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)) self.dummy_inputs(Self::MAX_PRIVATE_ACCOUNTS.saturating_sub(private_count))
} }

View File

@ -775,7 +775,7 @@ impl WalletCore {
let private_account_keys = acc_manager.private_account_keys(); let private_account_keys = acc_manager.private_account_keys();
let (output, proof) = 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, pre_states,
instruction_data, instruction_data,
acc_manager.account_identities(), acc_manager.account_identities(),