diff --git a/artifacts/program_methods/amm.bin b/artifacts/program_methods/amm.bin index 236aa672..066fd679 100644 Binary files a/artifacts/program_methods/amm.bin and b/artifacts/program_methods/amm.bin differ diff --git a/artifacts/program_methods/associated_token_account.bin b/artifacts/program_methods/associated_token_account.bin index 76de72b6..6aa04d0b 100644 Binary files a/artifacts/program_methods/associated_token_account.bin and b/artifacts/program_methods/associated_token_account.bin differ diff --git a/artifacts/program_methods/authenticated_transfer.bin b/artifacts/program_methods/authenticated_transfer.bin index 3f82dbde..c22c8658 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 fd99cd5d..69bc146d 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 5706f65c..891a6dfe 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 25b2e362..17e6cc02 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 69338df6..3387f0c9 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 d0b4320b..ffffd04d 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 cb53a166..e57b9e5f 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 1a142294..3f0b371f 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 2520b1f5..d08d41e9 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 0a56be9e..23530a45 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 6826a455..65584d71 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 a5d0deae..64a823be 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 cf5bf701..7062c8f3 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 eb97d568..dc9f8b3e 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 970e0535..1363a5cf 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 7cd4a7f5..d3b63870 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 c3ddd2b2..5eff41fe 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 bc1aa3a6..ef4fd06b 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 c504074a..5525992c 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/artifacts/test_program_methods/validity_window.bin b/artifacts/test_program_methods/validity_window.bin index 1a01c568..161ae6b6 100644 Binary files a/artifacts/test_program_methods/validity_window.bin and b/artifacts/test_program_methods/validity_window.bin differ diff --git a/artifacts/test_program_methods/validity_window_chain_caller.bin b/artifacts/test_program_methods/validity_window_chain_caller.bin index e6f06294..a0525f93 100644 Binary files a/artifacts/test_program_methods/validity_window_chain_caller.bin and b/artifacts/test_program_methods/validity_window_chain_caller.bin differ diff --git a/indexer/core/src/lib.rs b/indexer/core/src/lib.rs index bcd99ad7..c437beae 100644 --- a/indexer/core/src/lib.rs +++ b/indexer/core/src/lib.rs @@ -11,7 +11,7 @@ use logos_blockchain_core::mantle::{ Op, SignedMantleTx, ops::channel::{ChannelId, inscribe::InscriptionOp}, }; -use nssa::V03State; +use nssa::{AccountId, V03State}; use testnet_initial_state::initial_state_testnet; use crate::{block_store::IndexerStore, config::IndexerConfig}; @@ -71,7 +71,10 @@ impl IndexerCore { acc.program_owner = nssa::program::Program::authenticated_transfer_program().id(); - nssa_core::Commitment::new(npk, &acc) + nssa_core::Commitment::new( + &AccountId::account_id_without_identifier(npk), + &acc, + ) }) .collect() }); diff --git a/nssa/core/src/account.rs b/nssa/core/src/account.rs index 69c16a3b..b8ac4c5b 100644 --- a/nssa/core/src/account.rs +++ b/nssa/core/src/account.rs @@ -130,11 +130,12 @@ pub struct AccountWithMetadata { #[cfg(feature = "host")] impl AccountWithMetadata { - pub fn new(account: Account, is_authorized: bool, account_id: AccountId) -> Self { + #[must_use] + pub const fn new(account: Account, is_authorized: bool, account_id: AccountId) -> Self { Self { account, is_authorized, - account_id: account_id, + account_id, } } } @@ -188,7 +189,7 @@ impl AccountId { bytes.extend_from_slice(&value.0); match identifier { - None => {}, + None => {} Some(identifier) => bytes.extend_from_slice(&identifier.to_le_bytes()), } @@ -209,7 +210,6 @@ impl AccountId { pub fn account_id_without_identifier(value: &NullifierPublicKey) -> Self { Self::generate_account_id(value, None) } - } impl AsRef<[u8]> for AccountId { @@ -385,7 +385,6 @@ mod tests { assert_eq!(nonce, nonce_restored); } - #[test] fn account_id_from_nullifier_public_key() { let nsk = [ diff --git a/nssa/core/src/circuit_io.rs b/nssa/core/src/circuit_io.rs index b5416a50..bd758f1e 100644 --- a/nssa/core/src/circuit_io.rs +++ b/nssa/core/src/circuit_io.rs @@ -48,7 +48,6 @@ impl PrivacyPreservingCircuitOutput { } } - #[cfg(feature = "host")] #[cfg(test)] mod tests { @@ -93,12 +92,17 @@ mod tests { }], ciphertexts: vec![Ciphertext(vec![255, 255, 1, 1, 2, 2])], new_commitments: vec![Commitment::new( - &AccountId::account_id_without_identifier(&NullifierPublicKey::from(&[1_u8;32])), + &AccountId::account_id_without_identifier(&NullifierPublicKey::from(&[1_u8; 32])), &Account::default(), )], new_nullifiers: vec![( Nullifier::for_account_update( - &Commitment::new(&AccountId::account_id_without_identifier(&NullifierPublicKey::from(&[2_u8;32])), &Account::default()), + &Commitment::new( + &AccountId::account_id_without_identifier(&NullifierPublicKey::from( + &[2_u8; 32], + )), + &Account::default(), + ), &[1; 32], ), [0xab; 32], @@ -110,4 +114,3 @@ mod tests { assert_eq!(output, output_from_slice); } } -*/ \ No newline at end of file diff --git a/nssa/core/src/commitment.rs b/nssa/core/src/commitment.rs index efd6fa35..7a87491b 100644 --- a/nssa/core/src/commitment.rs +++ b/nssa/core/src/commitment.rs @@ -2,7 +2,7 @@ use borsh::{BorshDeserialize, BorshSerialize}; use risc0_zkvm::sha::{Impl, Sha256 as _}; use serde::{Deserialize, Serialize}; -use crate::{account::{Account, AccountId}}; +use crate::account::{Account, AccountId}; /// A commitment to all zero data. /// ```python @@ -50,7 +50,7 @@ impl std::fmt::Debug for Commitment { impl Commitment { /// Generates the commitment to a private account owned by user for npk: - /// SHA256( `Comm_DS` || account_id || `program_owner` || balance || nonce || SHA256(data)). + /// SHA256( `Comm_DS` || `account_id` || `program_owner` || balance || nonce || SHA256(data)). #[must_use] pub fn new(account_id: &AccountId, account: &Account) -> Self { const COMMITMENT_PREFIX: &[u8; 32] = @@ -115,7 +115,8 @@ mod tests { use risc0_zkvm::sha::{Impl, Sha256 as _}; use crate::{ - Commitment, DUMMY_COMMITMENT, DUMMY_COMMITMENT_HASH, account::{Account, AccountId}, + Commitment, DUMMY_COMMITMENT, DUMMY_COMMITMENT_HASH, + account::{Account, AccountId}, }; #[test] diff --git a/nssa/src/privacy_preserving_transaction/circuit.rs b/nssa/src/privacy_preserving_transaction/circuit.rs index 78d0af81..a1ba35d9 100644 --- a/nssa/src/privacy_preserving_transaction/circuit.rs +++ b/nssa/src/privacy_preserving_transaction/circuit.rs @@ -372,7 +372,7 @@ mod tests { let pre = AccountWithMetadata::new( Account::default(), false, - AccountId::from(&account_keys.npk()), + AccountId::account_id_without_identifier(&account_keys.npk()), ); let validity_window_chain_caller = Program::validity_window_chain_caller();