Fix fallback case on dedup sig function

This commit is contained in:
Willian Mitsuda 2021-10-28 17:41:56 -03:00
parent 3bfd38641b
commit 7b611f96e2
1 changed files with 7 additions and 2 deletions

View File

@ -5,7 +5,7 @@ import { getAddress } from "@ethersproject/address";
import { Contract } from "@ethersproject/contracts"; import { Contract } from "@ethersproject/contracts";
import { BigNumber } from "@ethersproject/bignumber"; import { BigNumber } from "@ethersproject/bignumber";
import { arrayify, hexDataSlice, isHexString } from "@ethersproject/bytes"; import { arrayify, hexDataSlice, isHexString } from "@ethersproject/bytes";
import { rawInputTo4Bytes } from "./use4Bytes"; import { extract4Bytes } from "./use4Bytes";
import { getInternalOperations } from "./nodeFunctions"; import { getInternalOperations } from "./nodeFunctions";
import { import {
TokenMetas, TokenMetas,
@ -414,6 +414,7 @@ export const useUniqueSignatures = (traces: TraceGroup[] | undefined) => {
while (nextTraces.length > 0) { while (nextTraces.length > 0) {
const traces = nextTraces; const traces = nextTraces;
nextTraces = []; nextTraces = [];
for (const t of traces) { for (const t of traces) {
if ( if (
t.type === "CALL" || t.type === "CALL" ||
@ -421,8 +422,12 @@ export const useUniqueSignatures = (traces: TraceGroup[] | undefined) => {
t.type === "STATICCALL" || t.type === "STATICCALL" ||
t.type === "CALLCODE" t.type === "CALLCODE"
) { ) {
sigs.add(rawInputTo4Bytes(t.input)); const fourBytes = extract4Bytes(t.input);
if (fourBytes) {
sigs.add(fourBytes);
}
} }
if (t.children) { if (t.children) {
nextTraces.push(...t.children); nextTraces.push(...t.children);
} }