nonce code shifting

This commit is contained in:
jonesmarvin8 2025-12-11 08:59:28 -05:00
parent abb1fc5e45
commit 2d8722b7d0
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(())
}