Skip to content

Source not found when showing a trace of a contract with source code #895

@gustavo-grieco

Description

@gustavo-grieco

It seems that the traces fail to show the source code information in some cases. To reproduce:

  1. Create a new foundry project.
  2. Open test/Counter.t.sol and add the following code:
contract T is Test {
function prove_t() public {
O o = new O();
o.o();
assert(true);
}
}

contract O {
function o() public {
assert(false);
}
}
  1. Run hevm: forge clean ; forge build --ast ; hevm test --debug --trace --verb 2.

The result is:

Repro running function: LitAddr 0x000000000000000000000000000000000000ACAb with caller: LitAddr 0x00000000000000000000000000000000DeaDBeef, gas: 281474976710655, and calldata: "d87cd68a"
Cex reproduction runs' results are: [Right True]
   [FAIL] prove_t
   Counterexample:   [validated]
     calldata: prove_t()
     result:   Revert: 0x4e487b710000000000000000000000000000000000000000000000000000000000000001
     test/Counter.t.sol:T
      ├╴constructor
      └╴prove_t
         ├╴create 0xD95322745865822719164b1fC167930754c248DE (test/Counter.t.sol:9)
         │  └╴← 162 bytes of code
         └╴call 0xD95322745865822719164b1fC167930754c248DE::o() (test/Counter.t.sol:10)
            └╴error Revert Panic(0x4e487b710000000000000000000000000000000000000000000000000000000000000001) <source not found>
   
   [WARNING] prove_t all branches reverted

The trace includes a warning that the source code was not found despite we have it.

Originally found by @0xalpharush

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions