update nonce mechanism

This commit is contained in:
jonesmarvin8
2026-02-12 19:22:03 -05:00
parent cb6fb881ac
commit 77f2fb6994
54 changed files with 276 additions and 280 deletions
+3 -3
View File
@@ -4,7 +4,7 @@ use anyhow::{Context, Result};
use indexer_service::{BackoffConfig, BedrockClientConfig, ChannelId, IndexerConfig};
use key_protocol::key_management::KeyChain;
use nssa::{Account, AccountId, PrivateKey, PublicKey};
use nssa_core::{account::Data, program::DEFAULT_PROGRAM_ID};
use nssa_core::{account::{Data, Nonce}, program::DEFAULT_PROGRAM_ID};
use sequencer_core::config::{
AccountInitialData, BedrockConfig, CommitmentsInitialData, SequencerConfig,
};
@@ -156,7 +156,7 @@ impl InitialData {
balance: 10_000,
data: Data::default(),
program_owner: DEFAULT_PROGRAM_ID,
nonce: 0,
nonce: Nonce(0),
},
),
(
@@ -165,7 +165,7 @@ impl InitialData {
balance: 20_000,
data: Data::default(),
program_owner: DEFAULT_PROGRAM_ID,
nonce: 0,
nonce: Nonce(0),
},
),
],
+1 -1
View File
@@ -20,7 +20,7 @@ async fn get_existing_account() -> Result<()> {
);
assert_eq!(account.balance, 10000);
assert!(account.data.is_empty());
assert_eq!(account.nonce, 0);
assert_eq!(account.nonce.0, 0);
info!("Successfully retrieved account with correct details");
@@ -235,7 +235,7 @@ async fn initialize_public_account() -> Result<()> {
Program::authenticated_transfer_program().id()
);
assert_eq!(account.balance, 0);
assert_eq!(account.nonce, 1);
assert_eq!(account.nonce.0, 1);
assert!(account.data.is_empty());
info!("Successfully initialized public account");
@@ -58,7 +58,7 @@ async fn deploy_and_execute_program() -> Result<()> {
assert_eq!(post_state_account.program_owner, data_changer.id());
assert_eq!(post_state_account.balance, 0);
assert_eq!(post_state_account.data.as_ref(), &[0]);
assert_eq!(post_state_account.nonce, 0);
assert_eq!(post_state_account.nonce.0, 0);
info!("Successfully deployed and executed program");
+4 -5
View File
@@ -15,7 +15,7 @@ use nssa::{
};
use nssa_core::{
MembershipProof, NullifierPublicKey,
account::{AccountWithMetadata, data::Data},
account::{AccountWithMetadata, data::Data, Nonce},
encryption::IncomingViewingPublicKey,
};
use tokio::test;
@@ -135,7 +135,7 @@ impl TpsTestManager {
let message = putx::Message::try_new(
program.id(),
[pair[0].1, pair[1].1].to_vec(),
[0u128].to_vec(),
[Nonce(0u128)].to_vec(),
amount,
)
.unwrap();
@@ -164,7 +164,7 @@ impl TpsTestManager {
let key_chain = KeyChain::new_os_random();
let account = Account {
balance: 100,
nonce: 0xdeadbeef,
nonce: Nonce(0xdeadbeef),
program_owner: Program::authenticated_transfer_program().id(),
data: Data::default(),
};
@@ -198,7 +198,7 @@ fn build_privacy_transaction() -> PrivacyPreservingTransaction {
let sender_pre = AccountWithMetadata::new(
Account {
balance: 100,
nonce: 0xdeadbeef,
nonce: Nonce(0xdeadbeef),
program_owner: program.id(),
data: Data::default(),
},
@@ -232,7 +232,6 @@ fn build_privacy_transaction() -> PrivacyPreservingTransaction {
vec![sender_pre, recipient_pre],
Program::serialize_instruction(balance_to_move).unwrap(),
vec![1, 2],
vec![0xdeadbeef1, 0xdeadbeef2],
vec![
(sender_npk.clone(), sender_ss),
(recipient_npk.clone(), recipient_ss),
+1 -1
View File
@@ -373,7 +373,7 @@ fn test_wallet_ffi_get_account_public() -> Result<()> {
);
assert_eq!(account.balance, 10000);
assert!(account.data.is_empty());
assert_eq!(account.nonce, 0);
assert_eq!(account.nonce.0, 0);
unsafe {
wallet_ffi_free_account_data((&mut out_account) as *mut FfiAccount);