diff --git a/Cargo.lock b/Cargo.lock index 33f810e0..aa87d011 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9006,7 +9006,6 @@ dependencies = [ "nssa", "nssa_core", "optfield", - "rand 0.8.5", "serde", "serde_json", "sha2", diff --git a/artifacts/program_methods/amm.bin b/artifacts/program_methods/amm.bin index 359d062a..3c5bed08 100644 Binary files a/artifacts/program_methods/amm.bin and b/artifacts/program_methods/amm.bin differ diff --git a/artifacts/program_methods/authenticated_transfer.bin b/artifacts/program_methods/authenticated_transfer.bin index 5ff56cf5..a0342563 100644 Binary files a/artifacts/program_methods/authenticated_transfer.bin and b/artifacts/program_methods/authenticated_transfer.bin differ diff --git a/artifacts/program_methods/pinata.bin b/artifacts/program_methods/pinata.bin index aef1a70c..9a438c7d 100644 Binary files a/artifacts/program_methods/pinata.bin and b/artifacts/program_methods/pinata.bin differ diff --git a/artifacts/program_methods/pinata_token.bin b/artifacts/program_methods/pinata_token.bin index 47ada3c2..52647ce0 100644 Binary files a/artifacts/program_methods/pinata_token.bin and b/artifacts/program_methods/pinata_token.bin differ diff --git a/artifacts/program_methods/privacy_preserving_circuit.bin b/artifacts/program_methods/privacy_preserving_circuit.bin index 3a0330e6..fb82e27c 100644 Binary files a/artifacts/program_methods/privacy_preserving_circuit.bin and b/artifacts/program_methods/privacy_preserving_circuit.bin differ diff --git a/artifacts/program_methods/token.bin b/artifacts/program_methods/token.bin index dbbf3c07..3478532b 100644 Binary files a/artifacts/program_methods/token.bin and b/artifacts/program_methods/token.bin differ diff --git a/artifacts/test_program_methods/burner.bin b/artifacts/test_program_methods/burner.bin index a3a2839e..58a78b69 100644 Binary files a/artifacts/test_program_methods/burner.bin and b/artifacts/test_program_methods/burner.bin differ diff --git a/artifacts/test_program_methods/chain_caller.bin b/artifacts/test_program_methods/chain_caller.bin index b920b0e2..9953ab81 100644 Binary files a/artifacts/test_program_methods/chain_caller.bin and b/artifacts/test_program_methods/chain_caller.bin differ diff --git a/artifacts/test_program_methods/changer_claimer.bin b/artifacts/test_program_methods/changer_claimer.bin index 019b2df0..f0f8db9d 100644 Binary files a/artifacts/test_program_methods/changer_claimer.bin and b/artifacts/test_program_methods/changer_claimer.bin differ diff --git a/artifacts/test_program_methods/claimer.bin b/artifacts/test_program_methods/claimer.bin index 6aaa6bba..c676e85d 100644 Binary files a/artifacts/test_program_methods/claimer.bin and b/artifacts/test_program_methods/claimer.bin differ diff --git a/artifacts/test_program_methods/data_changer.bin b/artifacts/test_program_methods/data_changer.bin index 5712c28e..7cf47d48 100644 Binary files a/artifacts/test_program_methods/data_changer.bin and b/artifacts/test_program_methods/data_changer.bin differ diff --git a/artifacts/test_program_methods/extra_output.bin b/artifacts/test_program_methods/extra_output.bin index 20e0e12a..1808559c 100644 Binary files a/artifacts/test_program_methods/extra_output.bin and b/artifacts/test_program_methods/extra_output.bin differ diff --git a/artifacts/test_program_methods/malicious_authorization_changer.bin b/artifacts/test_program_methods/malicious_authorization_changer.bin index 8c434e84..21b4ddaf 100644 Binary files a/artifacts/test_program_methods/malicious_authorization_changer.bin and b/artifacts/test_program_methods/malicious_authorization_changer.bin differ diff --git a/artifacts/test_program_methods/minter.bin b/artifacts/test_program_methods/minter.bin index 648c9e2a..7e1fb62a 100644 Binary files a/artifacts/test_program_methods/minter.bin and b/artifacts/test_program_methods/minter.bin differ diff --git a/artifacts/test_program_methods/missing_output.bin b/artifacts/test_program_methods/missing_output.bin index dcaf8cd0..a341e905 100644 Binary files a/artifacts/test_program_methods/missing_output.bin and b/artifacts/test_program_methods/missing_output.bin differ diff --git a/artifacts/test_program_methods/modified_transfer.bin b/artifacts/test_program_methods/modified_transfer.bin index b06bcdd4..0cea4b5c 100644 Binary files a/artifacts/test_program_methods/modified_transfer.bin and b/artifacts/test_program_methods/modified_transfer.bin differ diff --git a/artifacts/test_program_methods/nonce_changer.bin b/artifacts/test_program_methods/nonce_changer.bin index c9434606..5ba74c5f 100644 Binary files a/artifacts/test_program_methods/nonce_changer.bin and b/artifacts/test_program_methods/nonce_changer.bin differ diff --git a/artifacts/test_program_methods/noop.bin b/artifacts/test_program_methods/noop.bin index 42cddfab..56cfc5c6 100644 Binary files a/artifacts/test_program_methods/noop.bin and b/artifacts/test_program_methods/noop.bin differ diff --git a/artifacts/test_program_methods/program_owner_changer.bin b/artifacts/test_program_methods/program_owner_changer.bin index 66474082..20954780 100644 Binary files a/artifacts/test_program_methods/program_owner_changer.bin and b/artifacts/test_program_methods/program_owner_changer.bin differ diff --git a/artifacts/test_program_methods/simple_balance_transfer.bin b/artifacts/test_program_methods/simple_balance_transfer.bin index f2383856..b883f10b 100644 Binary files a/artifacts/test_program_methods/simple_balance_transfer.bin and b/artifacts/test_program_methods/simple_balance_transfer.bin differ diff --git a/common/src/test_utils.rs b/common/src/test_utils.rs index 432bdc40..ebe3bcb4 100644 --- a/common/src/test_utils.rs +++ b/common/src/test_utils.rs @@ -1,5 +1,4 @@ use nssa::AccountId; -use nssa_core::account::Nonce; use crate::{ HashType, @@ -65,7 +64,7 @@ pub fn create_transaction_native_token_transfer( signing_key: nssa::PrivateKey, ) -> NSSATransaction { let account_ids = vec![from, to]; - let nonces = vec![Nonce(nonce)]; + let nonces = vec![nonce.into()]; let program_id = nssa::program::Program::authenticated_transfer_program().id(); let message = nssa::public_transaction::Message::try_new( program_id, diff --git a/integration_tests/src/config.rs b/integration_tests/src/config.rs index 1c37e07e..8e50d129 100644 --- a/integration_tests/src/config.rs +++ b/integration_tests/src/config.rs @@ -168,7 +168,7 @@ impl InitialData { balance: 10_000, data: Data::default(), program_owner: DEFAULT_PROGRAM_ID, - nonce: Nonce(0), + nonce: 0u128.into(), }, ), ( @@ -177,7 +177,7 @@ impl InitialData { balance: 20_000, data: Data::default(), program_owner: DEFAULT_PROGRAM_ID, - nonce: Nonce(0), + nonce: 0u128.into(), }, ), ], diff --git a/integration_tests/tests/tps.rs b/integration_tests/tests/tps.rs index 35114762..e98812b1 100644 --- a/integration_tests/tests/tps.rs +++ b/integration_tests/tests/tps.rs @@ -136,7 +136,7 @@ impl TpsTestManager { let message = putx::Message::try_new( program.id(), [pair[0].1, pair[1].1].to_vec(), - [Nonce(0u128)].to_vec(), + [0u128.into()].to_vec(), amount, ) .unwrap(); diff --git a/integration_tests/tests/wallet_ffi.rs b/integration_tests/tests/wallet_ffi.rs index fbf12a87..ea79cd7f 100644 --- a/integration_tests/tests/wallet_ffi.rs +++ b/integration_tests/tests/wallet_ffi.rs @@ -10,7 +10,7 @@ use anyhow::Result; use integration_tests::{BlockingTestContext, TIME_TO_WAIT_FOR_BLOCK_SECONDS}; use log::info; use nssa::{Account, AccountId, PrivateKey, PublicKey, program::Program}; -use nssa_core::{account::Nonce, program::DEFAULT_PROGRAM_ID}; +use nssa_core::program::DEFAULT_PROGRAM_ID; use tempfile::tempdir; use wallet::WalletCore; use wallet_ffi::{ @@ -523,7 +523,7 @@ fn test_wallet_ffi_get_account_private() -> Result<()> { ); assert_eq!(account.balance, 10000); assert!(account.data.is_empty()); - assert_eq!(account.nonce, Nonce(0)); + assert_eq!(account.nonce, 0u128.into()); unsafe { wallet_ffi_free_account_data((&mut out_account) as *mut FfiAccount); diff --git a/nssa/core/src/account.rs b/nssa/core/src/account.rs index e50de749..76c0aff1 100644 --- a/nssa/core/src/account.rs +++ b/nssa/core/src/account.rs @@ -11,18 +11,7 @@ use crate::{NullifierPublicKey, NullifierSecretKey, program::ProgramId}; pub mod data; -#[derive( - Copy, - Debug, - Default, - Clone, - Eq, - PartialEq, - Serialize, - Deserialize, - BorshDeserialize, - BorshSerialize, -)] +#[derive(Copy, Debug, Default, Clone, Eq, PartialEq)] pub struct Nonce(pub u128); impl Nonce { @@ -50,6 +39,48 @@ impl Nonce { } } +impl From for Nonce { + fn from(value: u128) -> Self { + Self(value) + } +} + +impl From for u128 { + fn from(value: Nonce) -> Self { + value.0 + } +} + +impl Serialize for Nonce { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + Serialize::serialize(&self.0, serializer) + } +} + +impl<'de> Deserialize<'de> for Nonce { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + Ok(::deserialize(deserializer)?.into()) + } +} + +impl BorshSerialize for Nonce { + fn serialize(&self, writer: &mut W) -> std::io::Result<()> { + BorshSerialize::serialize(&self.0, writer) + } +} + +impl BorshDeserialize for Nonce { + fn deserialize_reader(reader: &mut R) -> std::io::Result { + Ok(::deserialize_reader(reader)?.into()) + } +} + /// Account to be used both in public and private contexts #[derive( Debug, Default, Clone, Eq, PartialEq, Serialize, Deserialize, BorshSerialize, BorshDeserialize, @@ -252,4 +283,26 @@ mod tests { let expected_nonce = Nonce(327300903218789900388409116014290259894); assert_eq!(nonce, expected_nonce); } + + #[test] + fn test_serde_roundtrip_for_nonce() { + let nonce: Nonce = 7u128.into(); + + let serde_serialized_nonce = serde_json::to_vec(&nonce).unwrap(); + + let nonce_restored = serde_json::from_slice(&serde_serialized_nonce).unwrap(); + + assert_eq!(nonce, nonce_restored); + } + + #[test] + fn test_borsh_roundtrip_for_nonce() { + let nonce: Nonce = 7u128.into(); + + let borsh_serialized_nonce = borsh::to_vec(&nonce).unwrap(); + + let nonce_restored = borsh::from_slice(&borsh_serialized_nonce).unwrap(); + + assert_eq!(nonce, nonce_restored); + } } diff --git a/nssa/core/src/encoding.rs b/nssa/core/src/encoding.rs index cb80a9a9..dd4875cb 100644 --- a/nssa/core/src/encoding.rs +++ b/nssa/core/src/encoding.rs @@ -161,14 +161,13 @@ impl AccountId { #[cfg(test)] mod tests { use super::*; - use crate::account::Nonce; #[test] fn test_enconding() { let account = Account { program_owner: [1, 2, 3, 4, 5, 6, 7, 8], balance: 123456789012345678901234567890123456, - nonce: Nonce(42), + nonce: 42u128.into(), data: b"hola mundo".to_vec().try_into().unwrap(), }; @@ -226,12 +225,10 @@ mod tests { #[cfg(feature = "host")] #[test] fn test_account_to_bytes_roundtrip() { - use crate::account::Nonce; - let account = Account { program_owner: [1, 2, 3, 4, 5, 6, 7, 8], balance: 123456789012345678901234567890123456, - nonce: Nonce(42), + nonce: 42u128.into(), data: b"hola mundo".to_vec().try_into().unwrap(), }; let bytes = account.to_bytes(); diff --git a/nssa/core/src/program.rs b/nssa/core/src/program.rs index 5b907d6e..2567c8d6 100644 --- a/nssa/core/src/program.rs +++ b/nssa/core/src/program.rs @@ -328,7 +328,6 @@ impl WrappedBalanceSum { #[cfg(test)] mod tests { use super::*; - use crate::account::Nonce; #[test] fn test_post_state_new_with_claim_constructor() { @@ -336,7 +335,7 @@ mod tests { program_owner: [1, 2, 3, 4, 5, 6, 7, 8], balance: 1337, data: vec![0xde, 0xad, 0xbe, 0xef].try_into().unwrap(), - nonce: Nonce(10), + nonce: 10u128.into(), }; let account_post_state = AccountPostState::new_claimed(account.clone()); @@ -351,7 +350,7 @@ mod tests { program_owner: [1, 2, 3, 4, 5, 6, 7, 8], balance: 1337, data: vec![0xde, 0xad, 0xbe, 0xef].try_into().unwrap(), - nonce: Nonce(10), + nonce: 10u128.into(), }; let account_post_state = AccountPostState::new(account.clone()); @@ -366,7 +365,7 @@ mod tests { program_owner: [1, 2, 3, 4, 5, 6, 7, 8], balance: 1337, data: vec![0xde, 0xad, 0xbe, 0xef].try_into().unwrap(), - nonce: Nonce(10), + nonce: 10u128.into(), }; let mut account_post_state = AccountPostState::new(account.clone()); diff --git a/nssa/src/privacy_preserving_transaction/circuit.rs b/nssa/src/privacy_preserving_transaction/circuit.rs index e80e1143..232730ea 100644 --- a/nssa/src/privacy_preserving_transaction/circuit.rs +++ b/nssa/src/privacy_preserving_transaction/circuit.rs @@ -208,7 +208,7 @@ mod tests { let expected_sender_post = Account { program_owner: program.id(), balance: 100 - balance_to_move, - nonce: Nonce(0), + nonce: 0u128.into(), data: Data::default(), }; diff --git a/nssa/src/privacy_preserving_transaction/message.rs b/nssa/src/privacy_preserving_transaction/message.rs index b323f452..02796855 100644 --- a/nssa/src/privacy_preserving_transaction/message.rs +++ b/nssa/src/privacy_preserving_transaction/message.rs @@ -89,7 +89,7 @@ impl Message { pub mod tests { use nssa_core::{ Commitment, EncryptionScheme, Nullifier, NullifierPublicKey, SharedSecretKey, - account::{Account, Nonce}, + account::Account, encryption::{EphemeralPublicKey, ViewingPublicKey}, }; use sha2::{Digest, Sha256}; @@ -111,7 +111,7 @@ pub mod tests { let public_account_ids = vec![AccountId::new([1; 32])]; - let nonces = vec![Nonce(1), Nonce(2), Nonce(3)]; + let nonces = vec![1u128.into(), 2u128.into(), 3u128.into()]; let public_post_states = vec![Account::default()]; diff --git a/nssa/src/public_transaction/transaction.rs b/nssa/src/public_transaction/transaction.rs index cca395dc..60048938 100644 --- a/nssa/src/public_transaction/transaction.rs +++ b/nssa/src/public_transaction/transaction.rs @@ -232,7 +232,6 @@ impl PublicTransaction { #[cfg(test)] pub mod tests { - use nssa_core::account::Nonce; use sha2::{Digest, digest::FixedOutput}; use crate::{ @@ -258,7 +257,7 @@ pub mod tests { fn transaction_for_tests() -> PublicTransaction { let (key1, key2, addr1, addr2) = keys_for_tests(); - let nonces = vec![Nonce(0), Nonce(0)]; + let nonces = vec![0u128.into(), 0u128.into()]; let instruction = 1337; let message = Message::try_new( Program::authenticated_transfer_program().id(), @@ -336,7 +335,7 @@ pub mod tests { fn test_account_id_list_cant_have_duplicates() { let (key1, _, addr1, _) = keys_for_tests(); let state = state_for_tests(); - let nonces = vec![Nonce(0), Nonce(0)]; + let nonces = vec![0u128.into(), 0u128.into()]; let instruction = 1337; let message = Message::try_new( Program::authenticated_transfer_program().id(), @@ -356,7 +355,7 @@ pub mod tests { fn test_number_of_nonces_must_match_number_of_signatures() { let (key1, key2, addr1, addr2) = keys_for_tests(); let state = state_for_tests(); - let nonces = vec![Nonce(0)]; + let nonces = vec![0u128.into()]; let instruction = 1337; let message = Message::try_new( Program::authenticated_transfer_program().id(), @@ -376,7 +375,7 @@ pub mod tests { fn test_all_signatures_must_be_valid() { let (key1, key2, addr1, addr2) = keys_for_tests(); let state = state_for_tests(); - let nonces = vec![Nonce(0), Nonce(0)]; + let nonces = vec![0u128.into(), 0u128.into()]; let instruction = 1337; let message = Message::try_new( Program::authenticated_transfer_program().id(), @@ -397,7 +396,7 @@ pub mod tests { fn test_nonces_must_match_the_state_current_nonces() { let (key1, key2, addr1, addr2) = keys_for_tests(); let state = state_for_tests(); - let nonces = vec![Nonce(0), Nonce(1)]; + let nonces = vec![0u128.into(), 1u128.into()]; let instruction = 1337; let message = Message::try_new( Program::authenticated_transfer_program().id(), @@ -417,7 +416,7 @@ pub mod tests { fn test_program_id_must_belong_to_bulitin_program_ids() { let (key1, key2, addr1, addr2) = keys_for_tests(); let state = state_for_tests(); - let nonces = vec![Nonce(0), Nonce(0)]; + let nonces = vec![0u128.into(), 0u128.into()]; let instruction = 1337; let unknown_program_id = [0xdeadbeef; 8]; let message = diff --git a/nssa/src/public_transaction/witness_set.rs b/nssa/src/public_transaction/witness_set.rs index 9d72dca8..ede9bed5 100644 --- a/nssa/src/public_transaction/witness_set.rs +++ b/nssa/src/public_transaction/witness_set.rs @@ -51,8 +51,6 @@ impl WitnessSet { #[cfg(test)] mod tests { - use nssa_core::account::Nonce; - use super::*; use crate::AccountId; @@ -64,7 +62,7 @@ mod tests { let pubkey2 = PublicKey::new_from_private_key(&key2); let addr1 = AccountId::from(&pubkey1); let addr2 = AccountId::from(&pubkey2); - let nonces = vec![Nonce(1), Nonce(2)]; + let nonces = vec![1u128.into(), 2u128.into()]; let instruction = vec![1, 2, 3, 4]; let message = Message::try_new([0; 8], vec![addr1, addr2], nonces, instruction).unwrap(); diff --git a/nssa/src/state.rs b/nssa/src/state.rs index 3da6afd5..aa2852b5 100644 --- a/nssa/src/state.rs +++ b/nssa/src/state.rs @@ -3,7 +3,7 @@ use std::collections::{BTreeSet, HashMap, HashSet}; use borsh::{BorshDeserialize, BorshSerialize}; use nssa_core::{ Commitment, CommitmentSetDigest, DUMMY_COMMITMENT, MembershipProof, Nullifier, - account::{Account, AccountId, Nonce}, + account::{Account, AccountId}, program::ProgramId, }; @@ -167,7 +167,7 @@ impl V02State { for account_id in tx.signer_account_ids() { let current_account = self.get_account_by_id_mut(account_id); - current_account.nonce.0 += 1; + current_account.nonce.public_account_nonce_increment(); } Ok(()) @@ -203,7 +203,7 @@ impl V02State { // 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.0 += 1; + current_account.nonce.public_account_nonce_increment(); } Ok(()) @@ -287,7 +287,7 @@ impl V02State { balance: 1500, // Difficulty: 3 data: vec![3; 33].try_into().expect("should fit"), - nonce: Nonce(0), + nonce: 0u128.into(), }, ); } @@ -345,7 +345,7 @@ pub mod tests { balance: u128, ) -> PublicTransaction { let account_ids = vec![from, to]; - let nonces = vec![Nonce(nonce)]; + let nonces = vec![nonce.into()]; let program_id = Program::authenticated_transfer_program().id(); let message = public_transaction::Message::try_new(program_id, account_ids, nonces, balance).unwrap(); @@ -561,7 +561,7 @@ pub mod tests { ..Account::default() }; let account_with_default_values_except_nonce = Account { - nonce: Nonce(37), + nonce: 37u128.into(), ..Account::default() }; let account_with_default_values_except_data = Account { @@ -1052,7 +1052,7 @@ pub mod tests { let expected_sender_post = { let mut this = state.get_account_by_id(sender_keys.account_id()); this.balance -= balance_to_move; - this.nonce.0 += 1; + this.nonce.public_account_nonce_increment(); this }; @@ -2206,7 +2206,7 @@ pub mod tests { let message = public_transaction::Message::try_new( program.id(), vec![from, to], - vec![Nonce(0)], + vec![0u128.into()], amount, ) .unwrap(); @@ -2249,7 +2249,7 @@ pub mod tests { program.id(), vec![to, from], // The chain_caller program permutes the account order in the chain // call - vec![Nonce(0)], + vec![0u128.into()], instruction, ) .unwrap(); @@ -2288,7 +2288,7 @@ pub mod tests { program.id(), vec![to, from], // The chain_caller program permutes the account order in the chain // call - vec![Nonce(0)], + vec![0u128.into()], instruction, ) .unwrap(); @@ -2556,7 +2556,7 @@ pub mod tests { definition_id: IdForTests::token_a_definition_id(), balance: BalanceForTests::user_token_a_holding_init(), }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2568,7 +2568,7 @@ pub mod tests { definition_id: IdForTests::token_b_definition_id(), balance: BalanceForTests::user_token_b_holding_init(), }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2588,7 +2588,7 @@ pub mod tests { fees: 0u128, active: true, }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2601,7 +2601,7 @@ pub mod tests { total_supply: BalanceForTests::token_a_supply(), metadata_id: None, }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2614,7 +2614,7 @@ pub mod tests { total_supply: BalanceForTests::token_b_supply(), metadata_id: None, }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2627,7 +2627,7 @@ pub mod tests { total_supply: BalanceForTests::token_lp_supply(), metadata_id: None, }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2639,7 +2639,7 @@ pub mod tests { definition_id: IdForTests::token_a_definition_id(), balance: BalanceForTests::vault_a_balance_init(), }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2651,7 +2651,7 @@ pub mod tests { definition_id: IdForTests::token_b_definition_id(), balance: BalanceForTests::vault_b_balance_init(), }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2663,7 +2663,7 @@ pub mod tests { definition_id: IdForTests::token_lp_definition_id(), balance: BalanceForTests::user_token_lp_holding_init(), }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2675,7 +2675,7 @@ pub mod tests { definition_id: IdForTests::token_a_definition_id(), balance: BalanceForTests::vault_a_balance_swap_1(), }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2687,7 +2687,7 @@ pub mod tests { definition_id: IdForTests::token_b_definition_id(), balance: BalanceForTests::vault_b_balance_swap_1(), }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2707,7 +2707,7 @@ pub mod tests { fees: 0u128, active: true, }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2719,7 +2719,7 @@ pub mod tests { definition_id: IdForTests::token_a_definition_id(), balance: BalanceForTests::user_token_a_holding_swap_1(), }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2731,7 +2731,7 @@ pub mod tests { definition_id: IdForTests::token_b_definition_id(), balance: BalanceForTests::user_token_b_holding_swap_1(), }), - nonce: Nonce(1), + nonce: 1u128.into(), } } @@ -2743,7 +2743,7 @@ pub mod tests { definition_id: IdForTests::token_a_definition_id(), balance: BalanceForTests::vault_a_balance_swap_2(), }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2755,7 +2755,7 @@ pub mod tests { definition_id: IdForTests::token_b_definition_id(), balance: BalanceForTests::vault_b_balance_swap_2(), }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2775,7 +2775,7 @@ pub mod tests { fees: 0u128, active: true, }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2787,7 +2787,7 @@ pub mod tests { definition_id: IdForTests::token_a_definition_id(), balance: BalanceForTests::user_token_a_holding_swap_2(), }), - nonce: Nonce(1), + nonce: 1u128.into(), } } @@ -2799,7 +2799,7 @@ pub mod tests { definition_id: IdForTests::token_b_definition_id(), balance: BalanceForTests::user_token_b_holding_swap_2(), }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2811,7 +2811,7 @@ pub mod tests { definition_id: IdForTests::token_a_definition_id(), balance: BalanceForTests::vault_a_balance_add(), }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2823,7 +2823,7 @@ pub mod tests { definition_id: IdForTests::token_b_definition_id(), balance: BalanceForTests::vault_b_balance_add(), }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2843,7 +2843,7 @@ pub mod tests { fees: 0u128, active: true, }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2855,7 +2855,7 @@ pub mod tests { definition_id: IdForTests::token_a_definition_id(), balance: BalanceForTests::user_token_a_holding_add(), }), - nonce: Nonce(1), + nonce: 1u128.into(), } } @@ -2867,7 +2867,7 @@ pub mod tests { definition_id: IdForTests::token_b_definition_id(), balance: BalanceForTests::user_token_b_holding_add(), }), - nonce: Nonce(1), + nonce: 1u128.into(), } } @@ -2879,7 +2879,7 @@ pub mod tests { definition_id: IdForTests::token_lp_definition_id(), balance: BalanceForTests::user_token_lp_holding_add(), }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2892,7 +2892,7 @@ pub mod tests { total_supply: BalanceForTests::token_lp_supply_add(), metadata_id: None, }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2904,7 +2904,7 @@ pub mod tests { definition_id: IdForTests::token_a_definition_id(), balance: BalanceForTests::vault_a_balance_remove(), }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2916,7 +2916,7 @@ pub mod tests { definition_id: IdForTests::token_b_definition_id(), balance: BalanceForTests::vault_b_balance_remove(), }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2936,7 +2936,7 @@ pub mod tests { fees: 0u128, active: true, }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2948,7 +2948,7 @@ pub mod tests { definition_id: IdForTests::token_a_definition_id(), balance: BalanceForTests::user_token_a_holding_remove(), }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2960,7 +2960,7 @@ pub mod tests { definition_id: IdForTests::token_b_definition_id(), balance: BalanceForTests::user_token_b_holding_remove(), }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2972,7 +2972,7 @@ pub mod tests { definition_id: IdForTests::token_lp_definition_id(), balance: BalanceForTests::user_token_lp_holding_remove(), }), - nonce: Nonce(1), + nonce: 1u128.into(), } } @@ -2985,7 +2985,7 @@ pub mod tests { total_supply: BalanceForTests::token_lp_supply_remove(), metadata_id: None, }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -2998,7 +2998,7 @@ pub mod tests { total_supply: 0, metadata_id: None, }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -3010,7 +3010,7 @@ pub mod tests { definition_id: IdForTests::token_a_definition_id(), balance: 0, }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -3022,7 +3022,7 @@ pub mod tests { definition_id: IdForTests::token_b_definition_id(), balance: 0, }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -3042,7 +3042,7 @@ pub mod tests { fees: 0u128, active: false, }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -3054,7 +3054,7 @@ pub mod tests { definition_id: IdForTests::token_a_definition_id(), balance: BalanceForTests::user_token_a_holding_new_definition(), }), - nonce: Nonce(1), + nonce: 1u128.into(), } } @@ -3066,7 +3066,7 @@ pub mod tests { definition_id: IdForTests::token_b_definition_id(), balance: BalanceForTests::user_token_b_holding_new_definition(), }), - nonce: Nonce(1), + nonce: 1u128.into(), } } @@ -3078,7 +3078,7 @@ pub mod tests { definition_id: IdForTests::token_lp_definition_id(), balance: BalanceForTests::lp_supply_init(), }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -3091,7 +3091,7 @@ pub mod tests { total_supply: BalanceForTests::lp_supply_init(), metadata_id: None, }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -3111,7 +3111,7 @@ pub mod tests { fees: 0u128, active: true, }), - nonce: Nonce(0), + nonce: 0u128.into(), } } @@ -3123,7 +3123,7 @@ pub mod tests { definition_id: IdForTests::token_lp_definition_id(), balance: 0, }), - nonce: Nonce(0), + nonce: 0u128.into(), } } } @@ -3210,7 +3210,7 @@ pub mod tests { IdForTests::user_token_b_id(), IdForTests::user_token_lp_id(), ], - vec![Nonce(0)], + vec![0u128.into()], instruction, ) .unwrap(); @@ -3287,7 +3287,7 @@ pub mod tests { IdForTests::user_token_b_id(), IdForTests::user_token_lp_id(), ], - vec![Nonce(0), Nonce(0)], + vec![0u128.into(), 0u128.into()], instruction, ) .unwrap(); @@ -3371,7 +3371,7 @@ pub mod tests { IdForTests::user_token_b_id(), IdForTests::user_token_lp_id(), ], - vec![Nonce(0), Nonce(0)], + vec![0u128.into(), 0u128.into()], instruction, ) .unwrap(); @@ -3443,7 +3443,7 @@ pub mod tests { IdForTests::user_token_b_id(), IdForTests::user_token_lp_id(), ], - vec![Nonce(0), Nonce(0)], + vec![0u128.into(), 0u128.into()], instruction, ) .unwrap(); @@ -3506,7 +3506,7 @@ pub mod tests { IdForTests::user_token_b_id(), IdForTests::user_token_lp_id(), ], - vec![Nonce(0), Nonce(0)], + vec![0u128.into(), 0u128.into()], instruction, ) .unwrap(); @@ -3566,7 +3566,7 @@ pub mod tests { IdForTests::user_token_a_id(), IdForTests::user_token_b_id(), ], - vec![Nonce(0)], + vec![0u128.into()], instruction, ) .unwrap(); @@ -3616,7 +3616,7 @@ pub mod tests { IdForTests::user_token_a_id(), IdForTests::user_token_b_id(), ], - vec![Nonce(0)], + vec![0u128.into()], instruction, ) .unwrap(); @@ -3731,7 +3731,7 @@ pub mod tests { chain_caller.id(), vec![to, from], // The chain_caller program permutes the account order in the chain // call - vec![Nonce(0)], + vec![0u128.into()], instruction, ) .unwrap(); @@ -4018,14 +4018,14 @@ pub mod tests { let expected_sender_post = { let mut this = state.get_account_by_id(sender_id); this.balance = sender_init_balance; - this.nonce = Nonce(0); + this.nonce = 0u128.into(); this }; let expected_recipient_post = { let mut this = state.get_account_by_id(sender_id); this.balance = recipient_init_balance; - this.nonce = Nonce(0); + this.nonce = 0u128.into(); this }; diff --git a/programs/amm/src/tests.rs b/programs/amm/src/tests.rs index 0c895252..dfec34cc 100644 --- a/programs/amm/src/tests.rs +++ b/programs/amm/src/tests.rs @@ -7,7 +7,7 @@ use amm_core::{ compute_pool_pda, compute_vault_pda, compute_vault_pda_seed, }; use nssa_core::{ - account::{Account, AccountId, AccountWithMetadata, Data, Nonce}, + account::{Account, AccountId, AccountWithMetadata, Data}, program::{ChainedCall, ProgramId}, }; use token_core::{TokenDefinition, TokenHolding}; @@ -415,7 +415,7 @@ impl AccountForTests { definition_id: IdForTests::token_a_definition_id(), balance: BalanceForTests::user_token_a_balance(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::user_token_a_id(), @@ -431,7 +431,7 @@ impl AccountForTests { definition_id: IdForTests::token_b_definition_id(), balance: BalanceForTests::user_token_b_balance(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::user_token_b_id(), @@ -447,7 +447,7 @@ impl AccountForTests { definition_id: IdForTests::token_a_definition_id(), balance: BalanceForTests::vault_a_reserve_init(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::vault_a_id(), @@ -463,7 +463,7 @@ impl AccountForTests { definition_id: IdForTests::token_b_definition_id(), balance: BalanceForTests::vault_b_reserve_init(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::vault_b_id(), @@ -479,7 +479,7 @@ impl AccountForTests { definition_id: IdForTests::token_a_definition_id(), balance: BalanceForTests::vault_a_reserve_high(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::vault_a_id(), @@ -495,7 +495,7 @@ impl AccountForTests { definition_id: IdForTests::token_b_definition_id(), balance: BalanceForTests::vault_b_reserve_high(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::vault_b_id(), @@ -511,7 +511,7 @@ impl AccountForTests { definition_id: IdForTests::token_a_definition_id(), balance: BalanceForTests::vault_a_reserve_low(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::vault_a_id(), @@ -527,7 +527,7 @@ impl AccountForTests { definition_id: IdForTests::token_b_definition_id(), balance: BalanceForTests::vault_b_reserve_low(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::vault_b_id(), @@ -543,7 +543,7 @@ impl AccountForTests { definition_id: IdForTests::token_a_definition_id(), balance: 0, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::vault_a_id(), @@ -559,7 +559,7 @@ impl AccountForTests { definition_id: IdForTests::token_b_definition_id(), balance: 0, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::vault_b_id(), @@ -576,7 +576,7 @@ impl AccountForTests { total_supply: BalanceForTests::lp_supply_init(), metadata_id: None, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::token_lp_definition_id(), @@ -593,7 +593,7 @@ impl AccountForTests { total_supply: BalanceForTests::lp_supply_init(), metadata_id: None, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::vault_a_id(), @@ -609,7 +609,7 @@ impl AccountForTests { definition_id: IdForTests::token_lp_definition_id(), balance: 0, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::user_token_lp_id(), @@ -625,7 +625,7 @@ impl AccountForTests { definition_id: IdForTests::token_lp_definition_id(), balance: BalanceForTests::user_token_lp_balance(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::user_token_lp_id(), @@ -649,7 +649,7 @@ impl AccountForTests { fees: 0u128, active: true, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::pool_definition_id(), @@ -673,7 +673,7 @@ impl AccountForTests { fees: 0u128, active: true, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::pool_definition_id(), @@ -697,7 +697,7 @@ impl AccountForTests { fees: 0u128, active: true, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::pool_definition_id(), @@ -721,7 +721,7 @@ impl AccountForTests { fees: 0u128, active: true, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::pool_definition_id(), @@ -745,7 +745,7 @@ impl AccountForTests { fees: 0u128, active: true, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::pool_definition_id(), @@ -769,7 +769,7 @@ impl AccountForTests { fees: 0u128, active: true, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::pool_definition_id(), @@ -793,7 +793,7 @@ impl AccountForTests { fees: 0u128, active: true, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::pool_definition_id(), @@ -817,7 +817,7 @@ impl AccountForTests { fees: 0u128, active: true, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::pool_definition_id(), @@ -841,7 +841,7 @@ impl AccountForTests { fees: 0u128, active: true, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::pool_definition_id(), @@ -865,7 +865,7 @@ impl AccountForTests { fees: 0u128, active: true, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::pool_definition_id(), @@ -889,7 +889,7 @@ impl AccountForTests { fees: 0u128, active: false, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::pool_definition_id(), @@ -913,7 +913,7 @@ impl AccountForTests { fees: 0u128, active: false, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: AccountId::new([4; 32]), @@ -929,7 +929,7 @@ impl AccountForTests { definition_id: IdForTests::token_a_definition_id(), balance: BalanceForTests::vault_a_reserve_init(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: AccountId::new([4; 32]), @@ -945,7 +945,7 @@ impl AccountForTests { definition_id: IdForTests::token_b_definition_id(), balance: BalanceForTests::vault_b_reserve_init(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: AccountId::new([4; 32]), @@ -969,7 +969,7 @@ impl AccountForTests { fees: 0u128, active: true, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::pool_definition_id(), diff --git a/programs/token/src/tests.rs b/programs/token/src/tests.rs index 00380cbb..7245c816 100644 --- a/programs/token/src/tests.rs +++ b/programs/token/src/tests.rs @@ -1,6 +1,6 @@ #![cfg(test)] -use nssa_core::account::{Account, AccountId, AccountWithMetadata, Data, Nonce}; +use nssa_core::account::{Account, AccountId, AccountWithMetadata, Data}; use token_core::{ MetadataStandard, NewTokenDefinition, NewTokenMetadata, TokenDefinition, TokenHolding, }; @@ -32,7 +32,7 @@ impl AccountForTests { total_supply: BalanceForTests::init_supply(), metadata_id: None, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::pool_definition_id(), @@ -49,7 +49,7 @@ impl AccountForTests { total_supply: BalanceForTests::init_supply(), metadata_id: None, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: false, account_id: IdForTests::pool_definition_id(), @@ -65,7 +65,7 @@ impl AccountForTests { definition_id: IdForTests::pool_definition_id_diff(), balance: BalanceForTests::holding_balance(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::holding_id(), @@ -81,7 +81,7 @@ impl AccountForTests { definition_id: IdForTests::pool_definition_id(), balance: BalanceForTests::holding_balance(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::holding_id(), @@ -97,7 +97,7 @@ impl AccountForTests { definition_id: IdForTests::pool_definition_id(), balance: BalanceForTests::holding_balance(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: false, account_id: IdForTests::holding_id(), @@ -113,7 +113,7 @@ impl AccountForTests { definition_id: IdForTests::pool_definition_id(), balance: BalanceForTests::init_supply(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: false, account_id: IdForTests::holding_id(), @@ -130,7 +130,7 @@ impl AccountForTests { total_supply: BalanceForTests::init_supply_burned(), metadata_id: None, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::pool_definition_id(), @@ -146,7 +146,7 @@ impl AccountForTests { definition_id: IdForTests::pool_definition_id(), balance: BalanceForTests::holding_balance_burned(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: false, account_id: IdForTests::holding_id(), @@ -170,7 +170,7 @@ impl AccountForTests { definition_id: IdForTests::pool_definition_id(), balance: BalanceForTests::mint_success(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: false, account_id: IdForTests::holding_id(), @@ -186,7 +186,7 @@ impl AccountForTests { definition_id: IdForTests::pool_definition_id(), balance: BalanceForTests::holding_balance_mint(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::pool_definition_id(), @@ -203,7 +203,7 @@ impl AccountForTests { total_supply: BalanceForTests::init_supply_mint(), metadata_id: None, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::pool_definition_id(), @@ -219,7 +219,7 @@ impl AccountForTests { definition_id: IdForTests::pool_definition_id(), balance: BalanceForTests::mint_overflow(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::pool_definition_id(), @@ -236,7 +236,7 @@ impl AccountForTests { printable_supply: BalanceForTests::printable_copies(), metadata_id: AccountId::new([0; 32]), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::pool_definition_id(), @@ -260,7 +260,7 @@ impl AccountForTests { definition_id: IdForTests::pool_definition_id(), balance: BalanceForTests::init_supply(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::holding_id(), @@ -277,7 +277,7 @@ impl AccountForTests { total_supply: BalanceForTests::init_supply(), metadata_id: None, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::pool_definition_id(), @@ -293,7 +293,7 @@ impl AccountForTests { definition_id: IdForTests::pool_definition_id(), balance: BalanceForTests::init_supply(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::holding_id(), @@ -309,7 +309,7 @@ impl AccountForTests { definition_id: IdForTests::pool_definition_id(), balance: BalanceForTests::init_supply(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::holding_id_2(), @@ -325,7 +325,7 @@ impl AccountForTests { definition_id: IdForTests::pool_definition_id(), balance: BalanceForTests::recipient_post_transfer(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::holding_id_2(), @@ -341,7 +341,7 @@ impl AccountForTests { definition_id: IdForTests::pool_definition_id(), balance: BalanceForTests::sender_post_transfer(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::holding_id(), @@ -357,7 +357,7 @@ impl AccountForTests { definition_id: IdForTests::pool_definition_id(), print_balance: BalanceForTests::printable_copies(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::holding_id(), @@ -373,7 +373,7 @@ impl AccountForTests { definition_id: IdForTests::pool_definition_id(), print_balance: 1, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::holding_id(), @@ -389,7 +389,7 @@ impl AccountForTests { definition_id: IdForTests::pool_definition_id(), print_balance: BalanceForTests::printable_copies() - 1, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::holding_id(), @@ -405,7 +405,7 @@ impl AccountForTests { definition_id: IdForTests::pool_definition_id(), owned: true, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: false, account_id: IdForTests::holding_id(), @@ -421,7 +421,7 @@ impl AccountForTests { definition_id: IdForTests::pool_definition_id(), print_balance: BalanceForTests::printable_copies(), }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::holding_id_2(), @@ -437,7 +437,7 @@ impl AccountForTests { definition_id: IdForTests::pool_definition_id(), print_balance: 0, }), - nonce: Nonce(0), + nonce: 0u128.into(), }, is_authorized: true, account_id: IdForTests::holding_id(), diff --git a/test_program_methods/guest/src/bin/nonce_changer.rs b/test_program_methods/guest/src/bin/nonce_changer.rs index 06c6fb6b..07539550 100644 --- a/test_program_methods/guest/src/bin/nonce_changer.rs +++ b/test_program_methods/guest/src/bin/nonce_changer.rs @@ -11,8 +11,8 @@ fn main() { }; let account_pre = &pre.account; - let mut account_post = account_pre.clone(); - account_post.nonce.0 += 1; + let account_post = account_pre.clone(); + account_post.nonce.public_account_nonce_increment(); write_nssa_outputs( instruction_words,