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 feffcc2e..6186d187 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, + ), ); #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] diff --git a/nssa/src/state.rs b/nssa/src/state.rs index 58c09c92..a0812801 100644 --- a/nssa/src/state.rs +++ b/nssa/src/state.rs @@ -187,7 +187,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(); @@ -3026,14 +3027,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) }; @@ -3077,7 +3079,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 a674b5b0..b3e4b129 100644 --- a/program_methods/guest/src/bin/privacy_preserving_circuit.rs +++ b/program_methods/guest/src/bin/privacy_preserving_circuit.rs @@ -43,12 +43,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 90535adc..1ed15c79 100644 --- a/sequencer/core/src/lib.rs +++ b/sequencer/core/src/lib.rs @@ -143,8 +143,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( @@ -154,9 +153,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), diff --git a/storage/src/indexer.rs b/storage/src/indexer.rs index a954cd29..94ab6d38 100644 --- a/storage/src/indexer.rs +++ b/storage/src/indexer.rs @@ -677,7 +677,11 @@ impl RocksDBIO { "transaction pre check failed with err {err:?}" )) })? - .execute_check_on_state(&mut breakpoint, block.header.block_id, block.header.timestamp) + .execute_check_on_state( + &mut breakpoint, + block.header.block_id, + block.header.timestamp, + ) .map_err(|err| { DbError::db_interaction_error(format!( "transaction execution failed with err {err:?}"