From a702a09aadbbf1b5469dfdec3eefee4b734768e9 Mon Sep 17 00:00:00 2001 From: Jon-Becker Date: Sat, 7 Dec 2024 14:10:35 -0500 Subject: [PATCH] wip --- crates/decompile/src/core/out/source.rs | 8 ++++---- crates/decompile/src/core/postprocess.rs | 4 ++-- crates/decompile/src/utils/heuristics/extcall.rs | 2 -- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/crates/decompile/src/core/out/source.rs b/crates/decompile/src/core/out/source.rs index 44162aa9..573a3134 100644 --- a/crates/decompile/src/core/out/source.rs +++ b/crates/decompile/src/core/out/source.rs @@ -67,9 +67,9 @@ pub fn build_source( functions .iter() .filter(|f| { - !f.fallback - && (analyzer_type == AnalyzerType::Yul - || (f.maybe_getter_for.is_none() && !f.is_constant())) + !f.fallback && + (analyzer_type == AnalyzerType::Yul || + (f.maybe_getter_for.is_none() && !f.is_constant())) }) .for_each(|f| { let mut function_source = Vec::new(); @@ -195,7 +195,7 @@ fn get_function_header(f: &AnalyzedFunction) -> Vec { .map(|(i, (_, arg))| { format!( "{} arg{i}", - arg.potential_types().first().unwrap_or(&"bytes32".to_string()).to_string() + arg.potential_types().first().unwrap_or(&"bytes32".to_string()) ) }) .collect::>() diff --git a/crates/decompile/src/core/postprocess.rs b/crates/decompile/src/core/postprocess.rs index fff35e49..6219dd26 100644 --- a/crates/decompile/src/core/postprocess.rs +++ b/crates/decompile/src/core/postprocess.rs @@ -130,8 +130,8 @@ impl PostprocessOrchestrator { // Note: this can't be done with a postprocessor because it needs all lines if !function.payable && (function.pure || function.view) && function.arguments.is_empty() { // check for RLP encoding. very naive check, but it works for now - if function.logic.iter().any(|line| line.contains("0x0100 *")) - && function.logic.iter().any(|line| line.contains("0x01) &")) + if function.logic.iter().any(|line| line.contains("0x0100 *")) && + function.logic.iter().any(|line| line.contains("0x01) &")) { // find any storage accesses let joined = function.logic.join(" "); diff --git a/crates/decompile/src/utils/heuristics/extcall.rs b/crates/decompile/src/utils/heuristics/extcall.rs index f4961519..b4c51305 100644 --- a/crates/decompile/src/utils/heuristics/extcall.rs +++ b/crates/decompile/src/utils/heuristics/extcall.rs @@ -1,5 +1,3 @@ -use std::fmt::format; - use alloy::primitives::U256; use futures::future::BoxFuture; use heimdall_common::utils::{hex::ToLowerHex, strings::encode_hex_reduced};