-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
meta: major crates refactor / rewrite #372
Conversation
|
||
/// The [`AnalyzedFunction`] struct represents a function that has been analyzed by the decompiler. | ||
#[derive(Clone, Debug)] | ||
pub struct AnalyzedFunction { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: struct `AnalyzedFunction` is never constructed
--> crates/cfg/src/interfaces/function.rs:11:12
|
11 | pub struct AnalyzedFunction {
| ^^^^^^^^^^^^^^^^
|
= note: `AnalyzedFunction` has derived impls for the traits `Debug` and `Clone`, but these are intentionally ignored during dead code analysis
= note: `#[warn(dead_code)]` on by default
} | ||
|
||
#[derive(Clone, Debug)] | ||
pub struct StorageFrame { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: struct `StorageFrame` is never constructed
--> crates/cfg/src/interfaces/function.rs:59:12
|
59 | pub struct StorageFrame {
| ^^^^^^^^^^^^
|
= note: `StorageFrame` has derived impls for the traits `Debug` and `Clone`, but these are intentionally ignored during dead code analysis
} | ||
|
||
#[derive(Clone, Debug)] | ||
pub struct CalldataFrame { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: struct `CalldataFrame` is never constructed
--> crates/cfg/src/interfaces/function.rs:65:12
|
65 | pub struct CalldataFrame {
| ^^^^^^^^^^^^^
|
= note: `CalldataFrame` has derived impls for the traits `Debug` and `Clone`, but these are intentionally ignored during dead code analysis
H160::default(), | ||
H160::default(), | ||
0, | ||
u128::max_value(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: usage of a legacy numeric method
--> crates/cfg/src/core/mod.rs:76:15
|
76 | u128::max_value(),
| ^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants
= note: `#[warn(clippy::legacy_numeric_constants)]` on by default
help: use the associated constant instead
|
76 | u128::MAX,
| ~~~
|
||
/// The [`AnalyzedFunction`] struct represents a function that has been analyzed by the decompiler. | ||
#[derive(Clone, Debug)] | ||
pub struct AnalyzedFunction { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: field `entry_point` is never read
--> crates/decompile/src/interfaces/function.rs:19:9
|
13 | pub struct AnalyzedFunction {
| ---------------- field in this struct
...
19 | pub entry_point: u128,
| ^^^^^^^^^^^
|
= note: `AnalyzedFunction` has derived impls for the traits `Debug` and `Clone`, but these are intentionally ignored during dead code analysis
= note: `#[warn(dead_code)]` on by default
.join(", "); | ||
|
||
// add the event emission to the function's logic | ||
match analyzer_state.analyzer_type { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: you seem to be trying to use `match` for an equality check. Consider using `if`
--> crates/decompile/src/utils/heuristics/events.rs:35:9
|
35 | / match analyzer_state.analyzer_type {
36 | | AnalyzerType::Solidity => {
37 | | function.logic.push(format!(
38 | | "emit Event_{}({}{});{}",
... |
72 | | _ => {}
73 | | }
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
= note: `#[warn(clippy::single_match)]` on by default
help: try
|
35 ~ if analyzer_state.analyzer_type == AnalyzerType::Solidity {
36 + function.logic.push(format!(
37 + "emit Event_{}({}{});{}",
38 + &event
39 + .topics
40 + .first()
41 + .unwrap_or(&U256::from(0))
42 + .encode_hex()
43 + .replacen("0x", "", 1)[0..8],
44 + event
45 + .topics
46 + .get(1..)
47 + .map(|topics| {
48 + if !event.data.is_empty() && !topics.is_empty() {
49 + let mut solidified_topics: Vec = Vec::new();
50 + for (i, _) in topics.iter().enumerate() {
51 + solidified_topics.push(
52 + state.last_instruction.input_operations[i + 3].solidify(),
53 + );
54 + }
55 + format!("{}, ", solidified_topics.join(", "))
56 + } else {
57 + let mut solidified_topics: Vec = Vec::new();
58 + for (i, _) in topics.iter().enumerate() {
59 + solidified_topics.push(
60 + state.last_instruction.input_operations[i + 3].solidify(),
61 + );
62 + }
63 + solidified_topics.join(", ")
64 + }
65 + })
66 + .unwrap_or("".to_string()),
67 + data_mem_ops_solidified,
68 + if anonymous { " // anonymous event" } else { "" }
69 + ));
70 + }
|
@@ -1,9 +1,13 @@ | |||
#[derive(Debug, thiserror::Error)] | |||
pub enum Error { | |||
#[error("Error: {0}")] | |||
#[error("{0}")] | |||
Generic(String), | |||
#[error("IO error: {0}")] | |||
IOError(#[from] std::io::Error), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variant name ends with the enum's name
--> crates/cli/src/error.rs:6:5
|
6 | IOError(#[from] std::io::Error),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names
= note: `#[warn(clippy::enum_variant_names)]` on by default
@@ -1,9 +1,13 @@ | |||
#[derive(Debug, thiserror::Error)] | |||
pub enum Error { | |||
#[error("Error: {0}")] | |||
#[error("{0}")] | |||
Generic(String), | |||
#[error("IO error: {0}")] | |||
IOError(#[from] std::io::Error), | |||
#[error("Serde error: {0}")] | |||
SerdeError(#[from] serde_json::Error), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variant name ends with the enum's name
--> crates/cli/src/error.rs:8:5
|
8 | SerdeError(#[from] serde_json::Error),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names
Generic(String), | ||
#[error("IO error: {0}")] | ||
IOError(#[from] std::io::Error), | ||
#[error("Serde error: {0}")] | ||
SerdeError(#[from] serde_json::Error), | ||
#[error("Decompile error: {0}")] | ||
DecompileError(#[from] heimdall_core::heimdall_decompiler::Error), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variant name ends with the enum's name
--> crates/cli/src/error.rs:10:5
|
10 | DecompileError(#[from] heimdall_core::heimdall_decompiler::Error),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names
#[error("Decompile error: {0}")] | ||
DecompileError(#[from] heimdall_core::heimdall_decompiler::Error), | ||
#[error("Disassemble error: {0}")] | ||
DisassembleError(#[from] heimdall_core::heimdall_disassembler::Error), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variant name ends with the enum's name
--> crates/cli/src/error.rs:12:5
|
12 | DisassembleError(#[from] heimdall_core::heimdall_disassembler::Error),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names
No description provided.