Skip to content

Conversation

msooseth
Copy link
Collaborator

@msooseth msooseth commented Aug 5, 2025

Description

Note that NOT all addresses deployed are concrete addresses! e.g. origin is a symbolic deployed contract.

This code now works when passed --only-deployed:

// SPDX-License-Identifier: MIT
import {Test} from "forge-std/Test.sol";

contract Stuff {
  function myfun(uint a ) public pure returns (uint) {
    unchecked {
      return a * 2;
    }
  }
}

contract MyOnlyDeployed is Test {
  Stuff stuff;
  function setUp() public {
    stuff = new Stuff();
  }

  // cast keccak "myfun(uint256)"
  // 0xb2d71d6870ba4b4e58f932901330aa9aaf5e31a65a07d4c73632529167626820
  function prove_only_deployed(uint a, address addr) public {
    (, bytes memory ret) = addr.call(abi.encodeWithSelector(0xb2d71d68, a));
    uint x = abi.decode(ret, (uint));
    assert(x == a * 2);
  }
}

Without --only-deployed:

[RUNNING] prove_only_deployed(uint256,address)
   [FAIL] prove_only_deployed
   [WARNING] prove_only_deployed all branches reverted
   [WARNING] hevm was only able to partially explore the test prove_only_deployed due to:
      1x -> Unexpected symbolic arguments to opcode: CALL

With --only-deployed:

cabal run -f devel exe:hevm -- test --root tmp --match ".*only_deployed.*" --only-deployed
Checking 1 function(s) in contract src/contract-only-deployed-contracts.sol:MyOnlyDeployed
[RUNNING] prove_only_deployed(uint256,address)
   [PASS] prove_only_deployed

Needs much more love:

  • test cases
  • review
  • testing
  • changelog

Checklist

  • tested locally
  • added automated tests
  • updated the docs
  • updated the changelog

@msooseth msooseth force-pushed the only-deployed-contracts-v2 branch 4 times, most recently from f42b8e8 to 9e84878 Compare August 5, 2025 16:03
@msooseth msooseth changed the title Only resolve to deployed addresses when requested With --only-deployed, only resolve addresses to deployed addresses Aug 6, 2025
@msooseth msooseth changed the title With --only-deployed, only resolve addresses to deployed addresses With --only-deployed, only resolve addresses to deployed contracts Aug 6, 2025
@msooseth msooseth force-pushed the only-deployed-contracts-v2 branch 3 times, most recently from 3e2ee6d to a7f3d55 Compare August 6, 2025 11:09
Update

Update

Update

Update

Update

Working now

UPdate

Updazte

No more trace

No more trace

Update

Update

Update

Add changelog

Cleanup

Update

Update

Update

No redundancy

Update
@msooseth msooseth force-pushed the only-deployed-contracts-v2 branch from a7f3d55 to d9f2631 Compare August 6, 2025 11:28
@msooseth msooseth requested a review from blishko August 6, 2025 12:51
@msooseth msooseth marked this pull request as ready for review August 6, 2025 12:51
Copy link
Collaborator

@blishko blishko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!
Just a few minor questions.

@msooseth msooseth merged commit 7844996 into main Aug 11, 2025
8 checks passed
@msooseth msooseth deleted the only-deployed-contracts-v2 branch August 11, 2025 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants