File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
crates/evm/traces/src/identifier Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 1
1
use super :: { AddressIdentity , TraceIdentifier } ;
2
+ use alloy_dyn_abi:: JsonAbiExt ;
2
3
use alloy_json_abi:: JsonAbi ;
3
4
use alloy_primitives:: Address ;
4
5
use foundry_common:: contracts:: { bytecode_diff_score, ContractsByArtifact } ;
@@ -53,6 +54,19 @@ impl<'a> LocalTraceIdentifier<'a> {
53
54
} ;
54
55
55
56
if let Some ( bytecode) = contract_bytecode {
57
+ let mut current_bytecode = current_bytecode;
58
+ if is_creation && current_bytecode. len ( ) > bytecode. len ( ) {
59
+ // Try to decode ctor args with contract abi.
60
+ if let Some ( constructor) = contract. abi . constructor ( ) {
61
+ let constructor_args = & current_bytecode[ bytecode. len ( ) ..] ;
62
+ if constructor. abi_decode_input ( constructor_args, false ) . is_ok ( ) {
63
+ // If we can decode args with current abi then remove args from
64
+ // code to compare.
65
+ current_bytecode = & current_bytecode[ ..bytecode. len ( ) ]
66
+ }
67
+ }
68
+ }
69
+
56
70
let score = bytecode_diff_score ( bytecode, current_bytecode) ;
57
71
if score == 0.0 {
58
72
trace ! ( target: "evm::traces" , "found exact match" ) ;
You can’t perform that action at this time.
0 commit comments