mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-03-25 19:53:07 +00:00
style: apply cargo fmt
This commit is contained in:
parent
0043f29dc2
commit
a838a45a2c
@ -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,
|
||||
)?;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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>,
|
||||
),
|
||||
);
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]
|
||||
|
||||
@ -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::<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)
|
||||
};
|
||||
@ -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::<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(),
|
||||
|
||||
@ -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(),
|
||||
|
||||
@ -143,8 +143,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(
|
||||
@ -154,9 +153,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),
|
||||
|
||||
@ -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:?}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user