Skip to content

Built-in contracts like vm and the create2 factory should be excluded senders in invariants #4163

@haydenshively

Description

@haydenshively

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (e7ef3c2 2023-01-24T00:14:27.601697Z)

What command(s) is the bug in?

forge test

Operating System

macOS (Apple Silicon)

Describe the bug

When running invariant tests with fail_on_revert = true, one must call excludeSender for all addresses with code. Otherwise you get the following nondescript error:

  [0] 0x0000000000000000000000000000000000000000::fallback() 
    └─ ← ()

Ideally forge would automatically exclude contracts from its randomized sender generation. Barring that, users should be told to exclude the following built-in contracts, since they may be unaware of them:

  • 0x7109709ECfa91a80626fF3989D68f67F5b1DD12D (vm)
  • 0x4e59b44847b379578588920cA78FbF26c0B4956C (create2 factory, not documented in foundrybook afaict)

Arguably this is a feature request, but as far as I'm concerned it's unexpected/unexplained behavior so I'm submitting as a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions