Skip to content

Commit d84ab4c

Browse files
committed
Automatically group imports
1 parent e317090 commit d84ab4c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+125
-176
lines changed

crates/edr/src/config.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ impl TryFrom<AccountConfig> for ServerAccountConfig {
132132

133133
#[cfg(test)]
134134
mod tests {
135-
use super::*;
136-
137135
use toml;
138136

137+
use super::*;
138+
139139
#[test]
140140
fn test_config_file_serde() {
141141
let config_file = ConfigFile::default();

crates/edr/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ use std::{
77

88
use anyhow::anyhow;
99
use clap::{Args, Parser, Subcommand};
10-
use tracing::{event, Level};
11-
1210
use edr_eth::Address;
11+
use tracing::{event, Level};
1312

1413
pub mod config;
1514

crates/edr/tests/cli.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ use assert_cmd::{
44
assert::Assert,
55
cargo::CommandCargoExt, // for process::Command::cargo_bin
66
};
7-
use predicates::str::contains;
8-
97
use edr_eth::{
108
remote::{
119
client::Request as RpcRequest,
@@ -17,6 +15,7 @@ use edr_eth::{
1715
Bytes, U256, U64,
1816
};
1917
use edr_rpc_server::{HardhatMethodInvocation, MethodInvocation};
18+
use predicates::str::contains;
2019

2120
#[tokio::test]
2221
async fn node() -> Result<(), Box<dyn std::error::Error>> {

crates/edr_eth/src/account.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66

77
//! Ethereum account types
88
9+
pub use revm_primitives::KECCAK_EMPTY;
910
use revm_primitives::{ruint, AccountInfo};
1011

1112
use crate::{trie::KECCAK_NULL_RLP, B256, U256};
1213

13-
pub use revm_primitives::KECCAK_EMPTY;
14-
1514
/// Basic account type.
1615
#[derive(Debug, Clone, PartialEq, Eq)]
1716
#[cfg_attr(

crates/edr_eth/src/block.rs

+7-9
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@ use revm_primitives::{
1717
};
1818
use rlp::Decodable;
1919

20-
use crate::{
21-
transaction::SignedTransaction,
22-
trie::{self, KECCAK_NULL_RLP},
23-
withdrawal::Withdrawal,
24-
Address, Bloom, Bytes, B256, B64, U256,
25-
};
26-
2720
use self::difficulty::calculate_ethash_canonical_difficulty;
2821
pub use self::{
2922
options::BlockOptions,
@@ -32,6 +25,12 @@ pub use self::{
3225
IsSafeBlockNumberArgs, LargestSafeBlockNumberArgs,
3326
},
3427
};
28+
use crate::{
29+
transaction::SignedTransaction,
30+
trie::{self, KECCAK_NULL_RLP},
31+
withdrawal::Withdrawal,
32+
Address, Bloom, Bytes, B256, B64, U256,
33+
};
3534

3635
/// Ethereum block
3736
#[derive(Clone, Debug, Eq)]
@@ -494,9 +493,8 @@ mod tests {
494493

495494
use revm_primitives::ruint::aliases::U64;
496495

497-
use crate::trie::KECCAK_RLP_EMPTY_ARRAY;
498-
499496
use super::*;
497+
use crate::trie::KECCAK_RLP_EMPTY_ARRAY;
500498

501499
#[test]
502500
fn header_rlp_roundtrip() {

crates/edr_eth/src/log/block.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,8 @@ mod tests {
6565

6666
use revm_primitives::{Address, Bytes};
6767

68-
use crate::log::Log;
69-
7068
use super::*;
69+
use crate::log::Log;
7170

7271
#[test]
7372
fn test_block_log_full_serde() {

crates/edr_eth/src/log/filter.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ mod tests {
2727

2828
use revm_primitives::{Address, Bytes, B256};
2929

30-
use crate::log::{FullBlockLog, Log, ReceiptLog};
31-
3230
use super::*;
31+
use crate::log::{FullBlockLog, Log, ReceiptLog};
3332

3433
#[test]
3534
fn test_filter_log_serde() {

crates/edr_eth/src/log/receipt.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ mod tests {
3636

3737
use revm_primitives::{Address, Bytes};
3838

39-
use crate::log::Log;
40-
4139
use super::*;
40+
use crate::log::Log;
4241

4342
#[test]
4443
fn test_receipt_log_serde() {

crates/edr_eth/src/receipt.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,8 @@ where
352352
mod tests {
353353
use revm_primitives::{Address, Bytes};
354354

355-
use crate::log::Log;
356-
357355
use super::*;
356+
use crate::log::Log;
358357

359358
fn dummy_receipts() -> Vec<TypedReceipt<Log>> {
360359
[

crates/edr_eth/src/receipt/block.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ use std::ops::Deref;
22

33
use revm_primitives::B256;
44

5-
use crate::log::FullBlockLog;
6-
75
use super::TransactionReceipt;
6+
use crate::log::FullBlockLog;
87

98
/// Type for a receipt that's included in a block.
109
#[derive(Clone, Debug, PartialEq, Eq)]
@@ -40,9 +39,8 @@ mod test {
4039
use ethbloom::Bloom;
4140
use revm_primitives::{Address, U256};
4241

43-
use crate::receipt::{TypedReceipt, TypedReceiptData};
44-
4542
use super::*;
43+
use crate::receipt::{TypedReceipt, TypedReceiptData};
4644

4745
#[test]
4846
fn test_block_receipt_serde() {

crates/edr_eth/src/receipt/transaction.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,8 @@ where
8484

8585
#[cfg(test)]
8686
mod test {
87-
use crate::receipt::TypedReceiptData;
88-
8987
use super::*;
88+
use crate::receipt::TypedReceiptData;
9089

9190
#[test]
9291
fn test_transaction_receipt_serde() {

crates/edr_eth/src/remote.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ pub mod methods;
2020

2121
mod cacheable_method_invocation;
2222

23-
use crate::B256;
24-
2523
pub use client::{RpcClient, RpcClientError};
2624

25+
use crate::B256;
26+
2727
/// for representing block specifications per EIP-1898
2828
#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
2929
#[serde(untagged)]

crates/edr_eth/src/remote/cacheable_method_invocation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use crate::block::{is_safe_block_number, IsSafeBlockNumberArgs};
21
use revm_primitives::{Address, B256};
32
use sha3::{digest::FixedOutput, Digest, Sha3_256};
43

54
use crate::{
5+
block::{is_safe_block_number, IsSafeBlockNumberArgs},
66
remote::{
77
methods::{GetLogsInput, MethodInvocation},
88
BlockSpec, BlockTag, Eip1898BlockSpec,

crates/edr_eth/src/remote/client.rs

+8-11
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ use sha3::{digest::FixedOutput, Digest, Sha3_256};
2020
use tokio::sync::{OnceCell, RwLock};
2121
use uuid::Uuid;
2222

23+
use super::{
24+
eth, jsonrpc,
25+
methods::{GetLogsInput, MethodInvocation},
26+
BlockSpec,
27+
};
2328
use crate::{
2429
block::{block_time, is_safe_block_number, IsSafeBlockNumberArgs},
2530
log::FilterLog,
@@ -34,12 +39,6 @@ use crate::{
3439
serde::ZeroXPrefixedBytes,
3540
};
3641

37-
use super::{
38-
eth, jsonrpc,
39-
methods::{GetLogsInput, MethodInvocation},
40-
BlockSpec,
41-
};
42-
4342
const RPC_CACHE_DIR: &str = "rpc_cache";
4443
const TMP_DIR: &str = "tmp";
4544
// Retry parameters for rate limited requests.
@@ -1065,16 +1064,14 @@ mod tests {
10651064

10661065
#[cfg(feature = "test-remote")]
10671066
mod alchemy {
1068-
use futures::future::join_all;
10691067
use std::fs::File;
10701068

1071-
use crate::Bytes;
1072-
10731069
use edr_test_utils::env::{get_alchemy_url, get_infura_url};
1070+
use futures::future::join_all;
1071+
use walkdir::WalkDir;
10741072

10751073
use super::*;
1076-
1077-
use walkdir::WalkDir;
1074+
use crate::Bytes;
10781075

10791076
// The maximum block number that Alchemy allows
10801077
const MAX_BLOCK_NUMBER: u64 = u64::MAX >> 1;

crates/edr_eth/src/serde.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,10 @@ pub mod u8 {
249249

250250
#[cfg(test)]
251251
mod tests {
252-
use super::*;
253252
use serde_json::json;
254253

254+
use super::*;
255+
255256
#[derive(Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
256257
struct TestStructSerde {
257258
#[serde(with = "u8")]

crates/edr_eth/src/signature.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,10 @@ impl From<B256> for RecoveryMessage {
371371

372372
#[cfg(test)]
373373
mod tests {
374-
use super::*;
375374
use std::str::FromStr;
376375

376+
use super::*;
377+
377378
#[test]
378379
fn recover_web3_signature() {
379380
// test vector taken from:

crates/edr_eth/src/state.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ where
3434
mod tests {
3535
use std::str::FromStr;
3636

37-
use crate::trie::KECCAK_NULL_RLP;
38-
3937
use super::*;
38+
use crate::trie::KECCAK_NULL_RLP;
4039

4140
#[test]
4241
fn empty_state_root() {

crates/edr_eth/src/transaction.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ mod kind;
99
mod request;
1010
mod signed;
1111

12-
use crate::{access_list::AccessListItem, Address, Bytes, U256};
13-
1412
pub use self::{detailed::DetailedTransaction, kind::TransactionKind, request::*, signed::*};
13+
use crate::{access_list::AccessListItem, Address, Bytes, U256};
1514

1615
/// Represents _all_ transaction requests received from RPC
1716
#[derive(Clone, Debug, PartialEq, Eq, Default)]

crates/edr_eth/src/transaction/signed.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,17 @@ mod legacy;
66

77
use revm_primitives::{Address, Bytes, B256, U256};
88

9-
use crate::{
10-
access_list::AccessList,
11-
signature::{Signature, SignatureError},
12-
utils::enveloped,
13-
};
14-
15-
use super::kind::TransactionKind;
16-
179
pub use self::{
1810
eip155::EIP155SignedTransaction, eip1559::Eip1559SignedTransaction,
1911
eip2930::Eip2930SignedTransaction, eip4844::Eip4844SignedTransaction,
2012
legacy::LegacySignedTransaction,
2113
};
14+
use super::kind::TransactionKind;
15+
use crate::{
16+
access_list::AccessList,
17+
signature::{Signature, SignatureError},
18+
utils::enveloped,
19+
};
2220

2321
#[derive(Clone, Debug, PartialEq, Eq)]
2422
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]

crates/edr_eth/src/transaction/signed/eip1559.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,12 @@ mod tests {
125125
use k256::SecretKey;
126126
use revm_primitives::Address;
127127

128+
use super::*;
128129
use crate::{
129130
access_list::AccessListItem,
130131
signature::{secret_key_from_str, secret_key_to_address},
131132
};
132133

133-
use super::*;
134-
135134
const DUMMY_SECRET_KEY: &str =
136135
"e331b6d69882b4cb4ea581d88e0b604039a3de5967688d3dcffdd2270c0fd109";
137136

crates/edr_eth/src/transaction/signed/eip2930.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,8 @@ mod tests {
121121
use k256::SecretKey;
122122
use revm_primitives::Address;
123123

124-
use crate::{access_list::AccessListItem, signature::secret_key_from_str};
125-
126124
use super::*;
125+
use crate::{access_list::AccessListItem, signature::secret_key_from_str};
127126

128127
fn dummy_request() -> EIP2930TransactionRequest {
129128
let to = Address::from_str("0xc014ba5ec014ba5ec014ba5ec014ba5ec014ba5e").unwrap();

crates/edr_eth/src/transaction/signed/legacy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ impl rlp::Decodable for LegacySignedTransaction {
9393

9494
#[cfg(test)]
9595
mod tests {
96-
use k256::SecretKey;
9796
use std::str::FromStr;
9897

98+
use k256::SecretKey;
9999
use revm_primitives::Address;
100100

101101
use super::*;

crates/edr_eth/src/utils.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
// - https://github.com/gakonst/ethers-rs/blob/cba6f071aedafb766e82e4c2f469ed5e4638337d/LICENSE-MIT
1111
// For the original context see: https://github.com/gakonst/ethers-rs/blob/cba6f071aedafb766e82e4c2f469ed5e4638337d/ethers-core/src/utils/hash.rs
1212

13-
use crate::B256;
1413
use revm_primitives::keccak256;
1514
use rlp::Encodable;
1615

16+
use crate::B256;
17+
1718
/// RLP-encodes the provided value, prepends it with the provided ID, and
1819
/// appends it to the provided [`rlp::RlpStream`].
1920
pub fn enveloped<T: Encodable>(id: u8, v: &T, s: &mut rlp::RlpStream) {

crates/edr_evm/benches/state/database_commit.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
use criterion::{criterion_group, criterion_main, Criterion};
2+
use edr_eth::{Address, Bytes, U256};
23
use edr_evm::{AccountStatus, HashMap};
34
use revm::primitives::Bytecode;
45

5-
use edr_eth::{Address, Bytes, U256};
6-
76
mod util;
87
use util::{bench_sync_state_method, state_prep_no_op};
98

109
fn bench_database_commit(c: &mut Criterion) {
11-
use revm::primitives::KECCAK_EMPTY;
12-
1310
use edr_evm::{Account, AccountInfo, StorageSlot};
11+
use revm::primitives::KECCAK_EMPTY;
1412

1513
#[derive(Debug, serde::Deserialize)]
1614
#[serde(rename_all = "camelCase")]

crates/edr_evm/benches/state/state_debug.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
use criterion::{criterion_group, criterion_main, Criterion};
2+
use edr_eth::{Address, Bytes, U256};
3+
use edr_evm::state::AccountModifierFn;
24
use revm::{
35
db::StateRef,
46
primitives::{AccountInfo, Bytecode},
57
};
68

7-
use edr_eth::{Address, Bytes, U256};
8-
use edr_evm::state::AccountModifierFn;
9-
109
mod util;
1110
use util::{account_has_code, bench_sync_state_method, permutations, state_prep_no_op};
1211

0 commit comments

Comments
 (0)