Merge pull request #238 from logos-blockchain/marvin/privacy_nonce_rearrangement

Rearrange nonce increment for privacy transactions
This commit is contained in:
jonesmarvin8 2025-12-12 15:53:58 -05:00 committed by GitHub
commit 30b4c8036e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 4 deletions

View File

@ -141,9 +141,7 @@ fn main() {
public_pre_states.push(pre_states[i].clone());
let mut post = state_diff.get(&pre_states[i].account_id).unwrap().clone();
if pre_states[i].is_authorized {
post.nonce += 1;
}
if post.program_owner == DEFAULT_PROGRAM_ID {
// Claim account
post.program_owner = program_id;

View File

@ -195,7 +195,7 @@ mod tests {
let expected_sender_post = Account {
program_owner: program.id(),
balance: 100 - balance_to_move,
nonce: 1,
nonce: 0,
data: Data::default(),
};

View File

@ -154,6 +154,12 @@ impl V02State {
*current_account = post;
}
// 5. Increment nonces for public signers
for account_id in tx.signer_account_ids() {
let current_account = self.get_account_by_id_mut(account_id);
current_account.nonce += 1;
}
Ok(())
}