Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
maciejka committed May 20, 2024
1 parent f5bedfd commit 2e410b9
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/block_hash/block_hash_calculator.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use starknet_types_core::felt::Felt;

use crate::data_availability::L1DataAvailabilityMode;

#[cfg(test)]
Expand Down
6 changes: 4 additions & 2 deletions src/block_hash/block_hash_calculator_test.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
use starknet_types_core::felt::Felt;

use super::concat_counts;
use crate::data_availability::L1DataAvailabilityMode;

#[test]
fn concat_counts_test() {
let concated = concat_counts(4, 3, 2, L1DataAvailabilityMode::Blob);
let expected_felt =
Felt::from_hex_unchecked("0x0000000000000004000000000000000300000000000000028000000000000000");
let expected_felt = Felt::from_hex_unchecked(
"0x0000000000000004000000000000000300000000000000028000000000000000",
);
assert_eq!(concated, expected_felt)
}
4 changes: 2 additions & 2 deletions src/block_hash/event_commitment.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use starknet_types_core::felt::Felt;
use starknet_types_core::hash::StarkHash;

use crate::core::EventCommitment;
use crate::crypto::patricia_hash::calculate_root;
use crate::crypto::utils::HashChain;
Expand Down Expand Up @@ -30,8 +31,7 @@ pub fn calculate_events_commitment<H: StarkHash>(
// num_contents, content0, content1, ...
// ).
fn calculate_event_hash(event_leaf_element: &EventLeafElement) -> Felt {
let keys =
&event_leaf_element.event.content.keys.iter().map(|k| k.0).collect::<Vec<Felt>>();
let keys = &event_leaf_element.event.content.keys.iter().map(|k| k.0).collect::<Vec<Felt>>();
let data = &event_leaf_element.event.content.data.0;
HashChain::new()
.chain(event_leaf_element.event.from_address.0.key())
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,9 +1,10 @@
use starknet_types_core::felt::Felt;
use starknet_types_core::hash::Poseidon;

use super::calculate_event_hash;
use crate::block_hash::event_commitment::{calculate_events_commitment, EventLeafElement};
use crate::core::{ContractAddress, EventCommitment, PatriciaKey};
use crate::hash::{StarkHash};
use crate::hash::StarkHash;
use crate::transaction::{Event, EventContent, EventData, EventKey, TransactionHash};
use crate::{contract_address, patricia_key, stark_felt};

Expand Down
2 changes: 1 addition & 1 deletion src/block_hash/receipt_commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::block::{GasPrice, GasPricePerToken};
use crate::core::ReceiptCommitment;
use crate::crypto::patricia_hash::calculate_root;
use crate::crypto::utils::HashChain;
use crate::hash::{starknet_keccak_hash};
use crate::hash::starknet_keccak_hash;
use crate::transaction::{
ExecutionResources, Fee, MessageToL1, TransactionExecutionStatus, TransactionReceipt,
TransactionVersion,
Expand Down
6 changes: 3 additions & 3 deletions src/block_hash/receipt_commitment_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ fn test_receipt_hash_regression() {
expected_hash
);

let expected_root = ReceiptCommitment(
stark_felt!("0x03a0af1272fc3b0b83894fd7b6b70d89acb07772bc28efc9091e3cc1c2c72493")
);
let expected_root = ReceiptCommitment(stark_felt!(
"0x03a0af1272fc3b0b83894fd7b6b70d89acb07772bc28efc9091e3cc1c2c72493"
));
assert_eq!(
calculate_receipt_commitment::<Poseidon>(
&[transaction_receipt],
Expand Down
2 changes: 1 addition & 1 deletion src/block_hash/state_diff_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use starknet_types_core::felt::Felt;

use crate::core::{ClassHash, CompiledClassHash, ContractAddress, Nonce, StateDiffCommitment};
use crate::crypto::utils::HashChain;
use crate::hash::{PoseidonHash};
use crate::hash::PoseidonHash;
use crate::state::{StorageKey, ThinStateDiff};
use crate::transaction_hash::ascii_as_felt;

Expand Down
8 changes: 4 additions & 4 deletions src/block_hash/state_diff_hash_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::block_hash::state_diff_hash::{
};
use crate::core::{ClassHash, CompiledClassHash, Nonce, StateDiffCommitment};
use crate::crypto::utils::HashChain;
use crate::hash::{PoseidonHash};
use crate::hash::PoseidonHash;
use crate::state::ThinStateDiff;

#[test]
Expand Down Expand Up @@ -39,9 +39,9 @@ fn test_state_diff_hash_regression() {
},
};

let expected_hash = StateDiffCommitment(PoseidonHash(
Felt::from_hex_unchecked("0x05b8241020c186585f4273cf991d35ad703e808bd9b40242cec584e7f2d86495")
));
let expected_hash = StateDiffCommitment(PoseidonHash(Felt::from_hex_unchecked(
"0x05b8241020c186585f4273cf991d35ad703e808bd9b40242cec584e7f2d86495",
)));

assert_eq!(expected_hash, calculate_state_diff_hash(&state_diff));
}
Expand Down
2 changes: 1 addition & 1 deletion src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use std::fmt::Debug;
use derive_more::Display;
use once_cell::sync::Lazy;
use primitive_types::H160;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use starknet_types_core::felt::{Felt, NonZeroFelt};
use starknet_types_core::hash::{Pedersen, StarkHash as CoreStarkHash};
use serde::{Deserialize, Deserializer, Serialize, Serializer};

use crate::crypto::utils::PublicKey;
use crate::hash::{PoseidonHash, StarkHash};
Expand Down

0 comments on commit 2e410b9

Please sign in to comment.