Skip to content

Commit

Permalink
chore: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
dutterbutter committed Dec 3, 2024
1 parent 1da8976 commit 088bb3d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
15 changes: 3 additions & 12 deletions src/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,6 @@ impl Formatter {
);
}
/// Prints the call stack of either the system or user calls in a structured log.
// Refactored print_call method
#[allow(clippy::too_many_arguments)]
pub fn print_call(
&mut self,
Expand Down Expand Up @@ -526,7 +525,6 @@ impl Formatter {
}
}
}

/// Prints the storage logs of the system in a structured log.
pub fn print_storage_logs(
&mut self,
Expand Down Expand Up @@ -606,9 +604,8 @@ impl Formatter {
}
});
}

/// Prints structured error message with insights.
#[allow(clippy::too_many_arguments)]
/// Prints structured error message.
/// TODO: we can incorporate suggested actions here (e.g. insights).
#[allow(clippy::too_many_arguments)]
pub fn print_structured_error(
&mut self,
Expand All @@ -617,7 +614,7 @@ impl Formatter {
call: &Call,
is_last_sibling: bool,
error_flag: &ErrorFlags,
_tx_result: &VmExecutionStatistics,
_tx_result: &VmExecutionStatistics, // TODO: we can use this to provide more insights
output: &ExecutionOutput,
tx: &Transaction,
) {
Expand All @@ -640,7 +637,6 @@ impl Formatter {
}
}
}

// Builds the branched prefix for the structured logs.
fn build_prefix(sibling_stack: &[bool], is_last_sibling: bool) -> String {
let mut prefix = String::new();
Expand All @@ -664,7 +660,6 @@ fn build_prefix(sibling_stack: &[bool], is_last_sibling: bool) -> String {
/// Finds the last call containing an error or revert reason in the call stack.
fn find_last_error_call(call: &Call) -> Option<&Call> {
let mut last_error_call = None;
// If the current call contains an error or revert reason, mark it as the last seen
if call.revert_reason.is_some() || call.error.is_some() {
last_error_call = Some(call);
}
Expand Down Expand Up @@ -783,7 +778,6 @@ fn format_data(value: &[u8]) -> String {
}
}

// Helper function to format call information
fn format_call_info(
initiator: Address,
contract_address: Option<H160>,
Expand Down Expand Up @@ -839,7 +833,6 @@ fn format_call_info(
(line, function_signature, contract_type)
}

// Helper function to handle error formatting
fn format_call_errors(
call_section: &mut Formatter,
call: &Call,
Expand Down Expand Up @@ -1005,7 +998,6 @@ fn get_error_function_name(func_selector_hex: String, contract_type: ContractTyp
}
// Helper function to extract function selector from the reason string
fn extract_function_selector_from_reason(reason: &str) -> Option<String> {
// The reason string contains something like "Error function_selector = 0x03eb8b54, data = 0x..."
let pattern = "Error function_selector = 0x";
if let Some(start) = reason.find(pattern) {
let selector_start = start + pattern.len();
Expand All @@ -1016,7 +1008,6 @@ fn extract_function_selector_from_reason(reason: &str) -> Option<String> {
.unwrap_or(reason.len());
if selector_end > selector_start {
let func_selector_hex = &reason[selector_start..selector_end];
// Validate that the extracted string is valid hex and of correct length
if func_selector_hex.len() == 8
&& func_selector_hex.chars().all(|c| c.is_ascii_hexdigit())
{
Expand Down
4 changes: 2 additions & 2 deletions src/node/in_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ impl<S: std::fmt::Debug + ForkSource> InMemoryNodeInner<S> {

let message = reason.to_string();
let pretty_message = format!(
"execution reverted!! {}{}",
"execution reverted{}{}",
if message.is_empty() { "" } else { ": " },
message
);
Expand Down Expand Up @@ -798,7 +798,7 @@ impl<S: std::fmt::Debug + ForkSource> InMemoryNodeInner<S> {
}
.into_tracer_pointer(),
];
// Ask if vm.inspect is the same as vm.execute
// TODO: Ask if vm.inspect is the same as vm.execute
let tx_result = vm.inspect(&mut tracers.into(), InspectExecutionMode::OneTx);

let call_traces = Arc::try_unwrap(call_tracer_result)
Expand Down

0 comments on commit 088bb3d

Please sign in to comment.