Skip to content

VM failed for unhandled reason #157

@0xharold

Description

@0xharold

Hi,
I have tried to follow the exercise 7 of the Echidna Tutorial. As I have not been able to make Echidna find the bug by following the tutorial, I started digging where I went wrong. What I did is the following:

  1. Deploying the SideEntranceLenderPool contract following the deploy script failed with insufficient funds for intrinsic transaction cost error; I needed to either decrease ETHER_IN_POOL or “donate” some funds from another account to the deployer. (I guess this step is not relevant to the bug though).

  2. As the proposed solution here did not find the bug so I tried to debug. During debugging I found out that if I deployed the contract by the deploy script, only the ContractCreated event was generated by Etheno in the init.json. So, I modified the deploy script to have also FunctionCall event included in the init.json file by adding the following lines to the deploying script:

const depositTx = await pool.deposit({ value: ETHER_IN_POOL }); 
await depositTx.wait(1);

I did that because I assumed that the initial deposit to the contract might not be included in the init.json and thus the Echidna cannot break the invariant assert(address(pool).balance >= initialPoolBalance) as the pool balance is already zero.

Then I tried to run Echidna again by:

# start docker
sudo docker run -it --rm -v $PWD:/src trailofbits/eth-security-toolbox

# select compiler
solc-select use 0.8.7

# either run echidna on tutorial case:
npx hardhat clean && npx hardhat compile --force && echidna-test /src --contract E2E --config /src/contracts/side-entrance/echidna-etheno/config-tutorial.yaml

# or run echidna on my solution:
npx hardhat clean && npx hardhat compile --force && echidna-test /src --contract EchidnaEthenoSideEntranceLenderPool --config /src/contracts/side-entrance/echidna-etheno/config.yaml

Both last two commands returns:

echidna-test: VM failed for unhandled reason, Query <EVM.Query: fetch contract 0x000000000000000000636F6e736F6c652e6c6f67>. This shouldn't happen. Please file a ticket with this error message and steps to reproduce!

I tried to describe full details into a readme in my repo (see here).

Environment:

WIN11
WSL2
echidna is run in docker
etheno as binary
hardhat

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions