Skip to content
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

perf(decompile): harden llm postprocessing, will not hard error #532

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading