Skip to content

expectRevert bug with internal call #11559

@MathisGD

Description

@MathisGD

Component

Forge

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

  • Foundry
  • Foundryup

What version of Foundry are you on?

1.3.2-stable

What version of Foundryup are you on?

No response

What command(s) is the bug in?

forge t

Operating System

macOS (Apple Silicon)

Describe the bug

Both

/// forge-config: default.allow_internal_expect_revert = true
function testA() {
    IERC20(address(0)).totalSupply();
}

and

/// forge-config: default.allow_internal_expect_revert = true
function testB() {
    vm.expectRevert();
    IERC20(address(0)).totalSupply();
}

fail (the first one for "revert" and the second one for "call didn't revert as expected"). I guess that this is not the expected behavior (the second one should pass, considering this call really fails as address zero has no code).

edit: note that also both

function testC() public {
    IERC20(address(0)).totalSupply();
}

function testD() public {
    vm.expectRevert();
    IERC20(address(0)).totalSupply();
}

fail but that's expected

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Completed

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions