Skip to content

Commit

Permalink
Merge eac04d7 into 9193870
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon-Becker authored Sep 2, 2024
2 parents 9193870 + eac04d7 commit 391313c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
22 changes: 22 additions & 0 deletions crates/core/tests/test_decompile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,28 @@ mod integration_tests {
}
}

#[tokio::test]
async fn test_decompile_abi_arr() {
let rpc_url = std::env::var("RPC_URL").unwrap_or_else(|_| {
println!("RPC_URL not set, skipping test");
std::process::exit(0);
});

let result = decompile(DecompilerArgs {
target: String::from("0x4018693062eeaa805ac1b1948271abdd9125984f"),
rpc_url,
default: true,
skip_resolving: true,
include_solidity: true,
include_yul: false,
output: String::from(""),
name: String::from(""),
timeout: 10000,
})
.await
.expect("failed to decompile");
}

#[tokio::test]
#[ignore]
async fn heavy_integration_test() {
Expand Down
9 changes: 7 additions & 2 deletions crates/decompile/src/core/out/abi.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloy_dyn_abi::DynSolType;
use hashbrown::HashMap;
use std::time::Instant;

Expand Down Expand Up @@ -55,15 +56,19 @@ pub fn build_abi(
name: format!("arg{i}"),
internal_type: None,
ty: match f.resolved_function {
Some(ref sig) => to_abi_string(&sig.inputs()[i]),
Some(ref sig) => {
to_abi_string(sig.inputs().get(i).unwrap_or(&DynSolType::Bytes))
}
None => arg
.potential_types()
.first()
.unwrap_or(&"bytes32".to_string())
.to_string(),
},
components: match f.resolved_function {
Some(ref sig) => to_components(&sig.inputs()[i]),
Some(ref sig) => {
to_components(sig.inputs().get(i).unwrap_or(&DynSolType::Bytes))
}
None => vec![],
},
})
Expand Down

0 comments on commit 391313c

Please sign in to comment.