Skip to content

Commit 74e572b

Browse files
committed
chore: make clippy happy
1 parent 4ba17e3 commit 74e572b

File tree

15 files changed

+29
-97
lines changed

15 files changed

+29
-97
lines changed

crates/cfg/src/core/mod.rs

+3-13
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
11
pub(crate) mod graph;
22

3-
43
use ethers::types::H160;
54
use eyre::eyre;
65
use heimdall_common::{
7-
ether::{
8-
bytecode::get_bytecode_from_target,
9-
compiler::{detect_compiler},
10-
evm::core::vm::VM,
11-
},
12-
utils::{
13-
strings::{StringExt},
14-
threading::run_with_timeout,
15-
},
6+
ether::{bytecode::get_bytecode_from_target, compiler::detect_compiler, evm::core::vm::VM},
7+
utils::{strings::StringExt, threading::run_with_timeout},
168
};
179

1810
use petgraph::{dot::Dot, Graph};
19-
use std::{
20-
time::{Duration, Instant},
21-
};
11+
use std::time::{Duration, Instant};
2212

2313
use super::CFGArgs;
2414

crates/cfg/src/interfaces/function.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
use std::{collections::HashMap};
2-
1+
use std::collections::HashMap;
32

43
use ethers::types::U256;
54
use heimdall_common::ether::{
6-
evm::{
7-
core::{log::Log, opcodes::WrappedOpcode},
8-
},
5+
evm::core::{log::Log, opcodes::WrappedOpcode},
96
signatures::{ResolvedError, ResolvedFunction, ResolvedLog},
107
};
118

12-
139
/// The [`AnalyzedFunction`] struct represents a function that has been analyzed by the decompiler.
1410
#[derive(Clone, Debug)]
1511
pub struct AnalyzedFunction {

crates/cfg/src/interfaces/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ mod function;
33

44
// re-export the public interface
55
pub use args::{CFGArgs, CFGArgsBuilder};
6-

crates/common/src/ether/calldata.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
2-
3-
use super::rpc::{get_transaction};
1+
use super::rpc::get_transaction;
42
use crate::{
53
constants::{CALLDATA_REGEX, TRANSACTION_HASH_REGEX},
64
utils::strings::decode_hex,

crates/decode/src/core/mod.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use std::{collections::HashSet, time::Instant};
22

3-
use ethers::{
4-
abi::{decode as decode_abi, ParamType},
5-
};
3+
use ethers::abi::{decode as decode_abi, ParamType};
64
use eyre::eyre;
75
use heimdall_common::{
86
ether::{
@@ -12,10 +10,7 @@ use heimdall_common::{
1210
},
1311
signatures::{score_signature, ResolveSelector, ResolvedFunction},
1412
},
15-
utils::{
16-
io::{logging::TraceFactory},
17-
strings::{encode_hex},
18-
},
13+
utils::{io::logging::TraceFactory, strings::encode_hex},
1914
};
2015
use tracing::{debug, info, trace, warn};
2116

crates/decode/src/utils/mod.rs

-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
mod abi;
22

3-
4-
5-
6-
7-
83
// re-export
94
pub use abi::{try_decode, try_decode_dynamic_parameter};

crates/decompile/src/core/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use eyre::eyre;
88
use heimdall_common::{
99
ether::{
1010
bytecode::get_bytecode_from_target,
11-
compiler::{detect_compiler},
11+
compiler::detect_compiler,
1212
evm::core::vm::VM,
1313
selectors::{find_function_selectors, resolve_selectors},
1414
signatures::{score_signature, ResolvedError, ResolvedFunction, ResolvedLog},

crates/decompile/src/core/out/abi.rs

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
1-
use std::{
2-
collections::HashMap,
3-
time::{Instant},
4-
};
1+
use std::{collections::HashMap, time::Instant};
52

63
use alloy_json_abi::{Error, Event, EventParam, Function, JsonAbi, Param, StateMutability};
74

8-
9-
use eyre::{Result};
5+
use eyre::Result;
106
use heimdall_common::{
117
ether::signatures::{ResolvedError, ResolvedLog},
12-
utils::{
13-
strings::encode_hex_reduced,
14-
},
8+
utils::strings::encode_hex_reduced,
159
};
1610

1711
use tracing::debug;
1812

19-
use crate::{interfaces::AnalyzedFunction};
13+
use crate::interfaces::AnalyzedFunction;
2014

2115
pub fn build_abi(
2216
functions: Vec<AnalyzedFunction>,

crates/decompile/src/core/resolve.rs

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
2-
3-
use crate::{interfaces::AnalyzedFunction};
4-
use heimdall_common::{
5-
ether::{
6-
signatures::{ResolvedFunction},
7-
},
8-
};
9-
use tracing::{trace};
1+
use crate::interfaces::AnalyzedFunction;
2+
use heimdall_common::ether::signatures::ResolvedFunction;
3+
use tracing::trace;
104

115
/// Given a list of potential [`ResolvedFunction`]s and a [`Snapshot`], return a list of
126
/// [`ResolvedFunction`]s (that is, resolved signatures that were found on a 4byte directory) that

crates/decompile/src/interfaces/function.rs

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
use std::{
2-
collections::{HashMap, HashSet},
3-
};
4-
1+
use std::collections::{HashMap, HashSet};
52

63
use ethers::types::U256;
74
use heimdall_common::ether::{
8-
evm::{
9-
core::{opcodes::WrappedOpcode, types::byte_size_to_type},
10-
},
11-
signatures::{ResolvedFunction},
5+
evm::core::{opcodes::WrappedOpcode, types::byte_size_to_type},
6+
signatures::ResolvedFunction,
127
};
138

14-
159
/// The [`AnalyzedFunction`] struct represents a function that has been analyzed by the decompiler.
1610
#[derive(Clone, Debug)]
1711
pub struct AnalyzedFunction {

crates/decompile/src/utils/heuristics/arguments.rs

+5-8
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ use std::collections::HashSet;
22

33
use ethers::types::U256;
44

5-
use heimdall_common::ether::evm::core::{
6-
types::convert_bitmask,
7-
vm::State,
8-
};
5+
use heimdall_common::ether::evm::core::{types::convert_bitmask, vm::State};
96
use tracing::{debug, trace};
107

118
use crate::{
@@ -36,10 +33,10 @@ pub fn argument_heuristic(
3633
arg_index, state.last_instruction.inputs[0]
3734
);
3835
CalldataFrame {
39-
arg_op: state.last_instruction.input_operations[0].to_string(),
40-
mask_size: 32, // init to 32 because all CALLDATALOADs are 32 bytes
41-
heuristics: HashSet::new(),
42-
}
36+
arg_op: state.last_instruction.input_operations[0].to_string(),
37+
mask_size: 32, // init to 32 because all CALLDATALOADs are 32 bytes
38+
heuristics: HashSet::new(),
39+
}
4340
});
4441
}
4542

crates/decompile/src/utils/heuristics/events.rs

+3-12
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1-
2-
31
use ethers::{abi::AbiEncode, types::U256};
4-
use eyre::{OptionExt};
5-
use heimdall_common::ether::evm::core::{
6-
vm::State,
7-
};
8-
2+
use eyre::OptionExt;
3+
use heimdall_common::ether::evm::core::vm::State;
94

10-
use crate::{
11-
core::analyze::AnalyzerState,
12-
interfaces::{AnalyzedFunction},
13-
Error,
14-
};
5+
use crate::{core::analyze::AnalyzerState, interfaces::AnalyzedFunction, Error};
156

167
pub fn event_heuristic(
178
function: &mut AnalyzedFunction,

crates/decompile/src/utils/heuristics/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
use heimdall_common::ether::evm::core::vm::State;
42

53
use crate::{core::analyze::AnalyzerState, interfaces::AnalyzedFunction, Error};

crates/decompile/src/utils/heuristics/solidity.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
1-
2-
31
use ethers::{
42
abi::{decode, AbiEncode, ParamType},
53
types::U256,
64
};
75
use eyre::eyre;
86
use heimdall_common::{
9-
ether::evm::core::{
10-
opcodes::{WrappedOpcode},
11-
types::{byte_size_to_type},
12-
vm::State,
13-
},
7+
ether::evm::core::{opcodes::WrappedOpcode, types::byte_size_to_type, vm::State},
148
utils::strings::{decode_hex, encode_hex_reduced},
159
};
1610

17-
1811
use crate::{
1912
core::analyze::AnalyzerState,
2013
interfaces::{AnalyzedFunction, StorageFrame},

crates/decompile/src/utils/heuristics/yul.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
use eyre::eyre;
2-
use heimdall_common::ether::evm::core::{
3-
vm::State,
4-
};
2+
use heimdall_common::ether::evm::core::vm::State;
53

64
use crate::{core::analyze::AnalyzerState, interfaces::AnalyzedFunction, Error};
75

0 commit comments

Comments
 (0)