From d648505d8977c394799ad722703a0f264f0b6f45 Mon Sep 17 00:00:00 2001 From: Sergio Chouhy Date: Fri, 8 May 2026 22:15:57 -0300 Subject: [PATCH] fmt, clippy --- integration_tests/src/config.rs | 12 ++++++++---- key_protocol/src/key_management/key_tree/mod.rs | 5 ++++- nssa/core/src/circuit_io.rs | 4 ++-- nssa/core/src/program.rs | 15 +++++++++++++-- programs/associated_token_account/core/src/lib.rs | 2 +- testnet_initial_state/src/lib.rs | 5 ++++- 6 files changed, 32 insertions(+), 11 deletions(-) diff --git a/integration_tests/src/config.rs b/integration_tests/src/config.rs index 9174163a..5c381e0e 100644 --- a/integration_tests/src/config.rs +++ b/integration_tests/src/config.rs @@ -59,12 +59,16 @@ impl InitialData { } let mut private_charlie_key_chain = KeyChain::new_os_random(); - let mut private_charlie_account_id = - AccountId::for_regular_private_account(&private_charlie_key_chain.nullifier_public_key, 0); + let mut private_charlie_account_id = AccountId::for_regular_private_account( + &private_charlie_key_chain.nullifier_public_key, + 0, + ); let mut private_david_key_chain = KeyChain::new_os_random(); - let mut private_david_account_id = - AccountId::for_regular_private_account(&private_david_key_chain.nullifier_public_key, 0); + let mut private_david_account_id = AccountId::for_regular_private_account( + &private_david_key_chain.nullifier_public_key, + 0, + ); // Ensure consistent ordering if private_charlie_account_id > private_david_account_id { diff --git a/key_protocol/src/key_management/key_tree/mod.rs b/key_protocol/src/key_management/key_tree/mod.rs index f1d1c8fd..edf9dadd 100644 --- a/key_protocol/src/key_management/key_tree/mod.rs +++ b/key_protocol/src/key_management/key_tree/mod.rs @@ -274,7 +274,10 @@ impl KeyTree { identifier: Identifier, ) -> Option { let node = self.key_map.get(cci)?; - let account_id = nssa::AccountId::for_regular_private_account(&node.value.0.nullifier_public_key, identifier); + let account_id = nssa::AccountId::for_regular_private_account( + &node.value.0.nullifier_public_key, + identifier, + ); if self.account_id_map.contains_key(&account_id) { return None; } diff --git a/nssa/core/src/circuit_io.rs b/nssa/core/src/circuit_io.rs index cf1052cf..63c188ef 100644 --- a/nssa/core/src/circuit_io.rs +++ b/nssa/core/src/circuit_io.rs @@ -30,8 +30,8 @@ pub enum InputAccountIdentity { Public, /// Init of an authorized standalone private account: no membership proof. The `pre_state` /// must be `Account::default()`. The `account_id` is derived as - /// `AccountId::for_regular_private_account(&NullifierPublicKey::from(nsk), identifier)` and matched against - /// `pre_state.account_id`. + /// `AccountId::for_regular_private_account(&NullifierPublicKey::from(nsk), identifier)` and + /// matched against `pre_state.account_id`. PrivateAuthorizedInit { ssk: SharedSecretKey, nsk: NullifierSecretKey, diff --git a/nssa/core/src/program.rs b/nssa/core/src/program.rs index af37bc7d..275b40a6 100644 --- a/nssa/core/src/program.rs +++ b/nssa/core/src/program.rs @@ -26,7 +26,18 @@ pub struct ProgramInput { /// Each program can derive up to `2^256` unique account IDs by choosing different /// seeds. PDAs allow programs to control namespaced account identifiers without /// collisions between programs. -#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Serialize, Deserialize, BorshSerialize, BorshDeserialize)] +#[derive( + Debug, + Clone, + Copy, + Eq, + PartialEq, + Hash, + Serialize, + Deserialize, + BorshSerialize, + BorshDeserialize, +)] pub struct PdaSeed([u8; 32]); impl PdaSeed { @@ -83,7 +94,7 @@ impl PrivateAccountKind { #[must_use] pub fn to_header_bytes(&self) -> [u8; Self::HEADER_LEN] { - let mut bytes = [0u8; Self::HEADER_LEN]; + let mut bytes = [0_u8; Self::HEADER_LEN]; let serialized = borsh::to_vec(self).expect("borsh serialization is infallible"); bytes[..serialized.len()].copy_from_slice(&serialized); bytes diff --git a/programs/associated_token_account/core/src/lib.rs b/programs/associated_token_account/core/src/lib.rs index 8fe6e267..77900a2c 100644 --- a/programs/associated_token_account/core/src/lib.rs +++ b/programs/associated_token_account/core/src/lib.rs @@ -49,7 +49,7 @@ pub enum Instruction { pub fn compute_ata_seed(owner_id: AccountId, definition_id: AccountId) -> PdaSeed { use risc0_zkvm::sha::{Impl, Sha256}; - let mut bytes = [0u8; 64]; + let mut bytes = [0_u8; 64]; bytes[0..32].copy_from_slice(&owner_id.to_bytes()); bytes[32..64].copy_from_slice(&definition_id.to_bytes()); PdaSeed::new( diff --git a/testnet_initial_state/src/lib.rs b/testnet_initial_state/src/lib.rs index 2c0ceaba..b5c91d4d 100644 --- a/testnet_initial_state/src/lib.rs +++ b/testnet_initial_state/src/lib.rs @@ -103,7 +103,10 @@ pub struct PrivateAccountPrivateInitialData { impl PrivateAccountPrivateInitialData { #[must_use] pub fn account_id(&self) -> nssa::AccountId { - nssa::AccountId::for_regular_private_account(&self.key_chain.nullifier_public_key, self.identifier) + nssa::AccountId::for_regular_private_account( + &self.key_chain.nullifier_public_key, + self.identifier, + ) } }