Skip to content

bug: decompilation freezes on certain contracts #560

@fala13

Description

@fala13

Component

Heimdall (Core)

Have you ensured that you are up to date?

  • Bifrost
  • Heimdall

What version of Heimdall are you on?

tested on 0.8.5 and latest available 8c833b1

Operating System

Linux

Describe the bug

Some bad contracts still cause heimdall to hang up on them. Evmole fails and debaub produces weird output ( https://app.dedaub.com/binance/address/0xdf56697bc72911c9212df51c9d342f4fd36b838d/decompiled ).

Lack of output is fine, but freezing is problematic when using heimdall as a library.

> heimdall decompile 0xdf56697bc72911c9212df51c9d342f4fd36b838d -r https://rpc.ankr.com/bsc -vvvv
2025-02-11T12:20:39.018155Z TRACE heimdall_common::utils::http: GET https://api.github.com/repos/Jon-Becker/heimdall-rs/releases/latest
2025-02-11T12:20:39.200964Z TRACE heimdall_common::utils::http: GET https://api.github.com/repos/Jon-Becker/heimdall-rs/releases/latest: Response { url: "https://api.github.com/repos/Jon-Becker/heimdall-rs/releases/latest", status: 200, headers: {"date": "Tue, 11 Feb 2025 12:20:39 GMT" (..) } }
2025-02-11T12:20:39.201305Z DEBUG heimdall_cache: cache hit for key: 'chain_id.https-rpc-ankr-combsc'
2025-02-11T12:20:39.201466Z DEBUG heimdall_cache: cache hit for key: 'contract.56.0xDf56697Bc72911C9212df51c9d342F4fD36b838d'
2025-02-11T12:20:39.201472Z DEBUG heimdall_decompiler::core: fetching target bytecode took 199.369µs
2025-02-11T12:20:39.201557Z DEBUG heimdall_common::ether::compiler: detected compiler unknown unknown.
2025-02-11T12:20:39.201564Z  WARN heimdall_common::ether::compiler: unknown is not fully supported by heimdall
2025-02-11T12:20:39.202032Z DEBUG heimdall_disassembler::core: fetching target bytecode took 88.617µs
2025-02-11T12:20:39.202602Z DEBUG heimdall_disassembler::core: disassembly took 564.243µs
2025-02-11T12:20:39.202606Z  INFO heimdall_disassembler::core: disassembled 11035 bytes successfully
2025-02-11T12:20:39.202610Z DEBUG heimdall_disassembler::core: disassembly took 667.403µs
2025-02-11T12:20:39.202790Z TRACE heimdall_vm::ext::selectors: optimistically assuming instruction 00002d PUSH4 f47d33b5 is a function selector

.. and it hangs here until we run out of RAM. Quick profiling shows it's cloning and dropping vectors.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions