style: apply cargo fmt

This commit is contained in:
moudyellaz 2026-03-24 11:49:15 +01:00 committed by Moudy
parent 5c592312f9
commit c4567d163d
5 changed files with 38 additions and 23 deletions

View File

@ -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,
)?;
}
}

View File

@ -303,7 +303,12 @@ pub struct Nullifier(
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]
pub struct ValidityWindow(
pub (Option<BlockId>, Option<BlockId>, Option<TimeStamp>, Option<TimeStamp>),
pub (
Option<BlockId>,
Option<BlockId>,
Option<TimeStamp>,
Option<TimeStamp>,
),
);
impl Display for ValidityWindow {

View File

@ -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::<Timestamp>, None::<Timestamp>);
let message = public_transaction::Message::try_new(
program_id,
account_ids,
nonces,
instruction,
)
.unwrap();
let instruction = (
validity_window.0,
validity_window.1,
None::<Timestamp>,
None::<Timestamp>,
);
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::<Timestamp>, None::<Timestamp>);
let instruction = (
validity_window.0,
validity_window.1,
None::<Timestamp>,
None::<Timestamp>,
);
let (output, proof) = circuit::execute_and_prove(
vec![pre],
Program::serialize_instruction(instruction).unwrap(),

View File

@ -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(),

View File

@ -163,8 +163,7 @@ impl<BC: BlockSettlementClientTrait, IC: IndexerClientTrait> SequencerCore<BC, I
}
fn next_block_timestamp_ms(&self) -> 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<BC: BlockSettlementClientTrait, IC: IndexerClientTrait> SequencerCore<BC, I
let block_id = self.next_block_id();
let timestamp_ms = self.next_block_timestamp_ms();
match &tx {
NSSATransaction::Public(tx) => 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),