Skip to content

Commit

Permalink
refactor: use fully-qualifier derive_more, for disambiguation
Browse files Browse the repository at this point in the history
  • Loading branch information
elintul committed Oct 15, 2024
1 parent 9434fe2 commit 8674071
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 26 deletions.
3 changes: 1 addition & 2 deletions crates/batcher_types/src/batcher_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::fmt::Debug;

use blockifier::blockifier::block::BlockNumberHashPair;
use chrono::prelude::*;
use derive_more::Display;
use serde::{Deserialize, Serialize};
use starknet_api::block::BlockNumber;
use starknet_api::core::StateDiffCommitment;
Expand All @@ -22,7 +21,7 @@ use crate::errors::BatcherError;
PartialOrd,
Ord,
Default,
Display,
derive_more::Display,
Hash,
)]
pub struct ProposalId(pub u64);
Expand Down
3 changes: 1 addition & 2 deletions crates/blockifier/src/state/cached_state.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::cell::RefCell;
use std::collections::{HashMap, HashSet};

use derive_more::IntoIterator;
use indexmap::IndexMap;
use starknet_api::core::{ClassHash, CompiledClassHash, ContractAddress, Nonce};
use starknet_api::state::StorageKey;
Expand Down Expand Up @@ -294,7 +293,7 @@ impl Default for CachedState<crate::test_utils::dict_state_reader::DictStateRead

pub type StorageEntry = (ContractAddress, StorageKey);

#[derive(Debug, Default, IntoIterator)]
#[derive(Debug, Default, derive_more::IntoIterator)]
pub struct StorageView(pub HashMap<StorageEntry, Felt>);

/// Converts a `CachedState`'s storage mapping into a `StateDiff`'s storage mapping.
Expand Down
5 changes: 2 additions & 3 deletions crates/papyrus_network/src/sqmr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@ mod flow_test;
use std::time::Duration;

pub use behaviour::{Behaviour, ToOtherBehaviourEvent};
use derive_more::Display;
use libp2p::{PeerId, StreamProtocol};

pub type Bytes = Vec<u8>;

#[derive(Clone, Copy, Debug, Default, Display, Eq, Hash, PartialEq)]
#[derive(Clone, Copy, Debug, Default, derive_more::Display, Eq, Hash, PartialEq)]
pub struct OutboundSessionId {
pub value: usize,
}

#[derive(Clone, Copy, Debug, Default, Display, Eq, Hash, PartialEq)]
#[derive(Clone, Copy, Debug, Default, derive_more::Display, Eq, Hash, PartialEq)]
pub struct InboundSessionId {
pub value: usize,
}
Expand Down
3 changes: 1 addition & 2 deletions crates/papyrus_rpc/src/test_utils.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::path::Path;
use std::sync::Arc;

use derive_more::Display;
use jsonrpsee::core::RpcResult;
use jsonrpsee::server::RpcModule;
use jsonrpsee::types::ErrorObjectOwned;
Expand Down Expand Up @@ -137,7 +136,7 @@ pub fn validate_schema(schema: &JSONSchema, result: &Value) -> bool {
result != &Value::Null && schema.is_valid(result)
}

#[derive(Clone, Copy, Display, EnumIter)]
#[derive(Clone, Copy, derive_more::Display, EnumIter)]
pub enum SpecFile {
#[display(fmt = "starknet_api_openrpc.json")]
StarknetApiOpenrpc,
Expand Down
5 changes: 2 additions & 3 deletions crates/starknet_api/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ mod block_test;

use std::fmt::Display;

use derive_more::Display;
use itertools::Itertools;
use serde::{Deserialize, Serialize};
use starknet_types_core::felt::Felt;
Expand Down Expand Up @@ -239,7 +238,7 @@ pub enum BlockStatus {
Serialize,
PartialOrd,
Ord,
Display,
derive_more::Display,
)]
pub struct BlockHash(pub StarkHash);

Expand All @@ -248,7 +247,7 @@ pub struct BlockHash(pub StarkHash);
Debug,
Default,
Copy,
Display,
derive_more::Display,
Clone,
Eq,
PartialEq,
Expand Down
17 changes: 8 additions & 9 deletions crates/starknet_api/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use core::fmt::Display;
use std::fmt::Debug;
use std::sync::LazyLock;

use derive_more::Display;
use primitive_types::H160;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use starknet_types_core::felt::{Felt, NonZeroFelt};
Expand Down Expand Up @@ -97,7 +96,7 @@ pub const BLOCK_HASH_TABLE_ADDRESS: ContractAddress = ContractAddress(PatriciaKe
Default,
Copy,
Clone,
Display,
derive_more::Display,
Eq,
PartialEq,
Hash,
Expand Down Expand Up @@ -177,7 +176,7 @@ pub fn calculate_contract_address(
Serialize,
PartialOrd,
Ord,
Display,
derive_more::Display,
derive_more::Deref,
)]
pub struct ClassHash(pub StarkHash);
Expand All @@ -195,7 +194,7 @@ pub struct ClassHash(pub StarkHash);
Serialize,
PartialOrd,
Ord,
Display,
derive_more::Display,
)]
pub struct CompiledClassHash(pub StarkHash);

Expand Down Expand Up @@ -255,7 +254,7 @@ pub struct EntryPointSelector(pub StarkHash);
Serialize,
PartialOrd,
Ord,
Display,
derive_more::Display,
)]
pub struct GlobalRoot(pub StarkHash);

Expand All @@ -272,7 +271,7 @@ pub struct GlobalRoot(pub StarkHash);
Serialize,
PartialOrd,
Ord,
Display,
derive_more::Display,
)]
pub struct TransactionCommitment(pub StarkHash);

Expand All @@ -289,7 +288,7 @@ pub struct TransactionCommitment(pub StarkHash);
Serialize,
PartialOrd,
Ord,
Display,
derive_more::Display,
)]
pub struct EventCommitment(pub StarkHash);

Expand All @@ -306,7 +305,7 @@ pub struct EventCommitment(pub StarkHash);
Serialize,
PartialOrd,
Ord,
Display,
derive_more::Display,
)]
pub struct ReceiptCommitment(pub StarkHash);

Expand All @@ -320,7 +319,7 @@ pub struct StateDiffCommitment(pub PoseidonHash);
#[derive(
Copy,
Clone,
Display,
derive_more::Display,
Eq,
PartialEq,
Default,
Expand Down
13 changes: 8 additions & 5 deletions crates/starknet_api/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::collections::BTreeMap;
use std::fmt::Display;
use std::sync::Arc;

use derive_more::{Display, From};
use num_bigint::BigUint;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use starknet_types_core::felt::Felt;
Expand Down Expand Up @@ -394,7 +393,9 @@ impl TransactionHasher for DeployAccountTransactionV3 {
}
}

#[derive(Debug, Clone, Eq, PartialEq, Hash, Deserialize, Serialize, PartialOrd, Ord, From)]
#[derive(
Debug, Clone, Eq, PartialEq, Hash, Deserialize, Serialize, PartialOrd, Ord, derive_more::From,
)]
pub enum DeployAccountTransaction {
V1(DeployAccountTransactionV1),
V3(DeployAccountTransactionV3),
Expand Down Expand Up @@ -539,7 +540,9 @@ impl TransactionHasher for InvokeTransactionV3 {
}
}

#[derive(Debug, Clone, Eq, PartialEq, Hash, Deserialize, Serialize, PartialOrd, Ord, From)]
#[derive(
Debug, Clone, Eq, PartialEq, Hash, Deserialize, Serialize, PartialOrd, Ord, derive_more::From,
)]
pub enum InvokeTransaction {
V0(InvokeTransactionV0),
V1(InvokeTransactionV1),
Expand Down Expand Up @@ -729,7 +732,7 @@ pub struct RevertedTransactionExecutionStatus {
Copy,
Clone,
Default,
Display,
derive_more::Display,
Eq,
PartialEq,
Hash,
Expand Down Expand Up @@ -997,7 +1000,7 @@ impl From<Tip> for Felt {
Copy,
Debug,
Deserialize,
Display,
derive_more::Display,
EnumIter,
Eq,
Hash,
Expand Down

0 comments on commit 8674071

Please sign in to comment.