From 52f1c337ec7ef1222d16fa23de0b973cd7d9c956 Mon Sep 17 00:00:00 2001 From: Sergio Chouhy Date: Tue, 31 Mar 2026 08:35:37 -0300 Subject: [PATCH] add test --- sequencer/core/src/lib.rs | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/sequencer/core/src/lib.rs b/sequencer/core/src/lib.rs index e51f1310..6f9bf7e1 100644 --- a/sequencer/core/src/lib.rs +++ b/sequencer/core/src/lib.rs @@ -1021,6 +1021,48 @@ mod tests { ); } + #[tokio::test] + async fn privacy_preserving_tx_touching_clock_account_is_dropped() { + let (mut sequencer, mempool_handle) = common_setup().await; + + // Craft a PP transaction that declares a modified post-state for a clock account. + let crafted_pp_tx = { + let message = nssa::privacy_preserving_transaction::Message { + public_account_ids: vec![nssa::CLOCK_01_PROGRAM_ACCOUNT_ID], + nonces: vec![], + public_post_states: vec![nssa::Account::default()], + encrypted_private_post_states: vec![], + new_commitments: vec![], + new_nullifiers: vec![], + }; + let witness_set = nssa::privacy_preserving_transaction::WitnessSet::from_raw_parts( + vec![], + nssa::privacy_preserving_transaction::circuit::Proof::from_inner(vec![]), + ); + NSSATransaction::PrivacyPreserving(nssa::PrivacyPreservingTransaction::new( + message, + witness_set, + )) + }; + + mempool_handle.push(crafted_pp_tx).await.unwrap(); + sequencer + .produce_new_block_with_mempool_transactions() + .unwrap(); + + let block = sequencer + .store + .get_block_at_id(sequencer.chain_height) + .unwrap() + .unwrap(); + + // The PP tx was dropped. Only the system-appended clock tx remains. + assert_eq!( + block.body.transactions, + vec![NSSATransaction::clock_invocation(block.header.timestamp)] + ); + } + #[tokio::test] async fn start_from_config_uses_db_height_not_config_genesis() { let mut config = setup_sequencer_config();