Skip to content

Commit

Permalink
perf(decompile): harden llm postprocessing, will not hard error
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon-Becker committed Dec 9, 2024
1 parent e946141 commit 001f5f6
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions crates/decompile/src/core/out/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,16 @@ pub async fn build_source(
debug!("llm postprocessing 0x{} source", f.selector);

let postprocessed_source =
annotate_function(&function_source.join("\n"), &openai_api_key).await?;
annotate_function(&function_source.join("\n"), &openai_api_key)
.await
.map_err(|e| {
debug!(
"llm postprocessing 0x{} source failed: {:?}",
f.selector, e
);
e
})
.ok();

debug!(
"llm postprocessing 0x{} source took {:?}",
Expand All @@ -131,8 +140,10 @@ pub async fn build_source(
);

// replace the function source with the postprocessed source
function_source =
postprocessed_source.split('\n').map(|x| x.to_string()).collect();
if let Some(postprocessed_source) = postprocessed_source {
function_source =
postprocessed_source.split('\n').map(|x| x.to_string()).collect();
}
}

Ok::<Vec<String>, eyre::Report>(function_source)
Expand Down

0 comments on commit 001f5f6

Please sign in to comment.