Skip to content

Commit

Permalink
feat(decompile): default openai_api_key to configured value if empty (
Browse files Browse the repository at this point in the history
#531)

* feat(decompile): default `openai_api_key` to configured value if empty

* wip

* wip
  • Loading branch information
Jon-Becker authored Dec 9, 2024
1 parent 7d052de commit e946141
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 5 additions & 0 deletions crates/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ async fn main() -> Result<()> {
cmd.rpc_url = configuration.rpc_url;
}

// if the user has not specified a openai api key, use the default
if cmd.openai_api_key.as_str() == "" {
cmd.openai_api_key = configuration.openai_api_key;
}

// if the user has passed an output filename, override the default filename
let mut abi_filename: String = "abi.json".to_string();
let mut decompiled_output_filename: String = "decompiled".to_string();
Expand Down
2 changes: 0 additions & 2 deletions crates/decompile/src/utils/heuristics/arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ pub fn argument_heuristic<'a>(
0x02 | 0x04 | 0x05 | 0x06 | 0x07 | 0x08 | 0x09 | 0x0b | 0x10 | 0x11 | 0x12 | 0x13 => {
// check if this instruction is operating on a known argument.
// if it is, add 'integer' to the list of heuristics
// TODO: we probably want to use an enum for heuristics
if let Some((arg_index, frame)) =
function.arguments.iter_mut().find(|(_, frame)| {
state
Expand All @@ -241,7 +240,6 @@ pub fn argument_heuristic<'a>(
0x18 | 0x1a | 0x1b | 0x1c | 0x1d | 0x20 => {
// check if this instruction is operating on a known argument.
// if it is, add 'bytes' to the list of heuristics
// TODO: we probably want to use an enum for heuristics
if let Some((arg_index, frame)) =
function.arguments.iter_mut().find(|(_, frame)| {
state
Expand Down

0 comments on commit e946141

Please sign in to comment.