From c4567d163d34ecb7dee5d601864509ab71ca6765 Mon Sep 17 00:00:00 2001 From: moudyellaz Date: Tue, 24 Mar 2026 11:49:15 +0100 Subject: [PATCH] style: apply cargo fmt --- indexer/core/src/block_store.rs | 6 ++++- indexer/service/protocol/src/lib.rs | 7 ++++- nssa/src/state.rs | 27 ++++++++++++------- .../src/bin/privacy_preserving_circuit.rs | 11 ++++---- sequencer/core/src/lib.rs | 10 +++---- 5 files changed, 38 insertions(+), 23 deletions(-) diff --git a/indexer/core/src/block_store.rs b/indexer/core/src/block_store.rs index 60ae7fe8..ac48ebd0 100644 --- a/indexer/core/src/block_store.rs +++ b/indexer/core/src/block_store.rs @@ -125,7 +125,11 @@ impl IndexerStore { transaction .clone() .transaction_stateless_check()? - .execute_check_on_state(&mut state_guard, block.header.block_id, block.header.timestamp)?; + .execute_check_on_state( + &mut state_guard, + block.header.block_id, + block.header.timestamp, + )?; } } diff --git a/indexer/service/protocol/src/lib.rs b/indexer/service/protocol/src/lib.rs index 2360b24b..356cb49e 100644 --- a/indexer/service/protocol/src/lib.rs +++ b/indexer/service/protocol/src/lib.rs @@ -303,7 +303,12 @@ pub struct Nullifier( #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] pub struct ValidityWindow( - pub (Option, Option, Option, Option), + pub ( + Option, + Option, + Option, + Option, + ), ); impl Display for ValidityWindow { diff --git a/nssa/src/state.rs b/nssa/src/state.rs index deef5c44..de18b072 100644 --- a/nssa/src/state.rs +++ b/nssa/src/state.rs @@ -188,7 +188,8 @@ impl V03State { timestamp_ms: Timestamp, ) -> Result<(), NssaError> { // 1. Verify the transaction satisfies acceptance criteria - let public_state_diff = tx.validate_and_produce_public_state_diff(self, block_id, timestamp_ms)?; + let public_state_diff = + tx.validate_and_produce_public_state_diff(self, block_id, timestamp_ms)?; let message = tx.message(); @@ -3235,14 +3236,15 @@ pub mod tests { let account_ids = vec![pre.account_id]; let nonces = vec![]; let program_id = validity_window_program.id(); - let instruction = (validity_window.0, validity_window.1, None::, None::); - let message = public_transaction::Message::try_new( - program_id, - account_ids, - nonces, - instruction, - ) - .unwrap(); + let instruction = ( + validity_window.0, + validity_window.1, + None::, + None::, + ); + let message = + public_transaction::Message::try_new(program_id, account_ids, nonces, instruction) + .unwrap(); let witness_set = public_transaction::WitnessSet::for_message(&message, &[]); PublicTransaction::new(message, witness_set) }; @@ -3287,7 +3289,12 @@ pub mod tests { let shared_secret = SharedSecretKey::new(&esk, &account_keys.vpk()); let epk = EphemeralPublicKey::from_scalar(esk); - let instruction = (validity_window.0, validity_window.1, None::, None::); + let instruction = ( + validity_window.0, + validity_window.1, + None::, + None::, + ); let (output, proof) = circuit::execute_and_prove( vec![pre], Program::serialize_instruction(instruction).unwrap(), diff --git a/program_methods/guest/src/bin/privacy_preserving_circuit.rs b/program_methods/guest/src/bin/privacy_preserving_circuit.rs index fc866cf5..49e5a41c 100644 --- a/program_methods/guest/src/bin/privacy_preserving_circuit.rs +++ b/program_methods/guest/src/bin/privacy_preserving_circuit.rs @@ -47,12 +47,11 @@ impl ExecutionState { .filter_map(|output| output.validity_window.to_timestamp()) .min(); - let validity_window = - (valid_from_id, valid_until_id, valid_from_ts, valid_until_ts) - .try_into() - .expect( - "There should be non empty intersection in the program output validity windows", - ); + let validity_window = (valid_from_id, valid_until_id, valid_from_ts, valid_until_ts) + .try_into() + .expect( + "There should be non empty intersection in the program output validity windows", + ); let mut execution_state = Self { pre_states: Vec::new(), diff --git a/sequencer/core/src/lib.rs b/sequencer/core/src/lib.rs index 1155754b..17f3eca4 100644 --- a/sequencer/core/src/lib.rs +++ b/sequencer/core/src/lib.rs @@ -163,8 +163,7 @@ impl SequencerCore nssa_core::program::Timestamp { - u64::try_from(chrono::Utc::now().timestamp_millis()) - .expect("Timestamp must be positive") + u64::try_from(chrono::Utc::now().timestamp_millis()).expect("Timestamp must be positive") } fn execute_check_transaction_on_state( @@ -174,9 +173,10 @@ impl SequencerCore self - .state - .transition_from_public_transaction(tx, block_id, timestamp_ms), + NSSATransaction::Public(tx) => { + self.state + .transition_from_public_transaction(tx, block_id, timestamp_ms) + } NSSATransaction::PrivacyPreserving(tx) => self .state .transition_from_privacy_preserving_transaction(tx, block_id, timestamp_ms),