crytic / echidna

Ethereum smart contract fuzzer
https://secure-contracts.com/program-analysis/echidna/index.html
GNU Affero General Public License v3.0
2.72k stars 362 forks source link

[Bug-Candidate]: Contract is "unknown contract" but should be able to be identified #1259

Open 0xalpharush opened 4 months ago

0xalpharush commented 4 months ago

Describe the issue:

Running echidna allContract.sol --test-mode assertion --contract T fails to identify the other contract despite the source being available.

As an aside, I think it is confusing that running echidna allContract.sol --test-mode assertion does not tell you which contract is selected as the target. It's a source of ambiguity/error that could be clarified (it seems to always pick O)

Code example to reproduce the issue:

contract T {
function t() public {
O o = new O();
o.o();
assert(true);
}
}

contract O {
function o() public {
assert(false);
}
}

Version:

2.2.3

Relevant log output:

[2024-05-17 12:18:14.47] Compiling allContract.sol... Done! (0.443455s)
Analyzing contract: /Users/alpharush/allContract.sol:T
[2024-05-17 12:18:14.92] Running slither on allContract.sol... Done! (0.471598s)
t(): failed!💥  
  Call sequence:
    T.t()

Traces: 
create <unknown contract>@0xb4c79daB8f259C7Aee6E5b2Aa729821864227e84 (/Users/alpharush/allContract.sol:3)
 └╴← 161 bytes of code
call 0xb4c79daB8f259C7Aee6E5b2Aa729821864227e84::o() (/Users/alpharush/allContract.sol:4)
 └╴error Revert Panic(1) (/Users/alpharush/allContract.sol:11)

AssertionFailed(..): passing

Unique instructions: 157
Unique codehashes: 2
Corpus size: 2
Seed: 4473559282936699324
ggrieco-tob commented 4 months ago

The unknown contract is an issue in hevm traces, can you open an issue in their tracker?

ggrieco-tob commented 4 months ago

Actually, it says:

Analyzing contract: /Users/alpharush/allContract.sol:T

but the language is confusing, it should be "Targeting contract". It also specifies which is the target in the call sequence (e.g. T.t()) as well as the relevant source lines in the trace. What is failing is the identification of the naming of the contract in the create of the trace.