From 245b2cf2e96c955c7f7d0a138ba3d4f5bf38c1a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kami=C5=84ski?= Date: Mon, 27 May 2024 12:53:51 +0200 Subject: [PATCH] fmt --- src/block_hash/block_hash_calculator.rs | 9 ++++----- src/block_hash/event_commitment_test.rs | 3 ++- src/block_hash/receipt_commitment_test.rs | 8 ++++---- src/block_hash/transaction_commitment_test.rs | 5 ++--- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/block_hash/block_hash_calculator.rs b/src/block_hash/block_hash_calculator.rs index 56be508..e4d9e6d 100644 --- a/src/block_hash/block_hash_calculator.rs +++ b/src/block_hash/block_hash_calculator.rs @@ -1,12 +1,12 @@ +use starknet_types_core::felt::Felt; +use starknet_types_core::hash::Poseidon; + use super::event_commitment::{calculate_events_commitment, EventLeafElement}; use super::receipt_commitment::{calculate_receipt_commitment, ReceiptElement}; use super::state_diff_hash::calculate_state_diff_hash; use super::transaction_commitment::{calculate_transactions_commitment, TransactionLeafElement}; use crate::block::GasPricePerToken; use crate::core::{EventCommitment, ReceiptCommitment, StateDiffCommitment, TransactionCommitment}; -use starknet_types_core::felt::Felt; -use starknet_types_core::hash::Poseidon; - use crate::data_availability::L1DataAvailabilityMode; use crate::state::ThinStateDiff; use crate::transaction::{ @@ -55,8 +55,7 @@ pub fn calculate_block_commitments( }) }) .collect(); - let events_commitment = - calculate_events_commitment::(&event_leaf_elements); + let events_commitment = calculate_events_commitment::(&event_leaf_elements); let receipt_elements: Vec = transactions_data.iter().map(ReceiptElement::from).collect(); diff --git a/src/block_hash/event_commitment_test.rs b/src/block_hash/event_commitment_test.rs index 5801a7b..777d2b7 100644 --- a/src/block_hash/event_commitment_test.rs +++ b/src/block_hash/event_commitment_test.rs @@ -1,6 +1,7 @@ use starknet_types_core::felt::Felt; use starknet_types_core::hash::Poseidon; -use super::{calculate_events_commitment, calculate_event_hash, EventLeafElement}; + +use super::{calculate_event_hash, calculate_events_commitment, EventLeafElement}; use crate::core::{ContractAddress, EventCommitment, PatriciaKey}; use crate::hash::{FeltConverter, TryIntoFelt}; use crate::transaction::{Event, EventContent, EventData, EventKey, TransactionHash}; diff --git a/src/block_hash/receipt_commitment_test.rs b/src/block_hash/receipt_commitment_test.rs index e172f80..fb34219 100644 --- a/src/block_hash/receipt_commitment_test.rs +++ b/src/block_hash/receipt_commitment_test.rs @@ -6,10 +6,10 @@ use crate::block::{GasPrice, GasPricePerToken}; use crate::block_hash::receipt_commitment::{ calculate_receipt_commitment, calculate_receipt_hash, get_revert_reason_hash, ReceiptElement, }; +use crate::block_hash::test_utils::{generate_message_to_l1, get_transaction_output}; use crate::core::ReceiptCommitment; use crate::felt; use crate::hash::{FeltConverter, TryIntoFelt}; -use crate::block_hash::test_utils::{generate_message_to_l1, get_transaction_output}; use crate::transaction::{ RevertedTransactionExecutionStatus, TransactionExecutionStatus, TransactionHash, TransactionVersion, @@ -33,9 +33,9 @@ fn test_receipt_hash_regression() { expected_hash ); - let expected_root = ReceiptCommitment( - felt!("0x03a0af1272fc3b0b83894fd7b6b70d89acb07772bc28efc9091e3cc1c2c72493") - ); + let expected_root = ReceiptCommitment(felt!( + "0x03a0af1272fc3b0b83894fd7b6b70d89acb07772bc28efc9091e3cc1c2c72493" + )); // Test for a V3 transactions. transaction_receipt.transaction_version = TransactionVersion::THREE; diff --git a/src/block_hash/transaction_commitment_test.rs b/src/block_hash/transaction_commitment_test.rs index 3bba49e..0d4a330 100644 --- a/src/block_hash/transaction_commitment_test.rs +++ b/src/block_hash/transaction_commitment_test.rs @@ -1,7 +1,7 @@ -use super::TransactionLeafElement; use starknet_types_core::felt::Felt; use starknet_types_core::hash::Poseidon; +use super::TransactionLeafElement; use crate::block_hash::transaction_commitment::{ calculate_transaction_leaf, calculate_transactions_commitment, }; @@ -24,8 +24,7 @@ fn test_transaction_leaf_without_signature_regression() { transaction_hash: TransactionHash(Felt::ONE), transaction_signature: None, }; - let expected_leaf = - felt!("0x00a93bf5e58b9378d093aa86ddc2f61a3295a1d1e665bd0ef3384dd07b30e033"); + let expected_leaf = felt!("0x00a93bf5e58b9378d093aa86ddc2f61a3295a1d1e665bd0ef3384dd07b30e033"); assert_eq!(expected_leaf, calculate_transaction_leaf(&transaction_leaf_elements)); }