Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
maciejka committed May 27, 2024
1 parent 29bd64e commit 245b2cf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
9 changes: 4 additions & 5 deletions src/block_hash/block_hash_calculator.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand Down Expand Up @@ -55,8 +55,7 @@ pub fn calculate_block_commitments(
})
})
.collect();
let events_commitment =
calculate_events_commitment::<Poseidon>(&event_leaf_elements);
let events_commitment = calculate_events_commitment::<Poseidon>(&event_leaf_elements);

let receipt_elements: Vec<ReceiptElement> =
transactions_data.iter().map(ReceiptElement::from).collect();
Expand Down
3 changes: 2 additions & 1 deletion src/block_hash/event_commitment_test.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
8 changes: 4 additions & 4 deletions src/block_hash/receipt_commitment_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions src/block_hash/transaction_commitment_test.rs
Original file line number Diff line number Diff line change
@@ -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,
};
Expand All @@ -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));
}
Expand Down

0 comments on commit 245b2cf

Please sign in to comment.