Skip to content

Align expectRevert and prank behavior with Foundry #993

@palinatolmach

Description

@palinatolmach

At the moment, Kontrol has a strict requirement on the vm.prank and vm.expectRevert ordering and is not mirroring Foundry behavior. Kontrol reports the first test as failing but Foundry doesn't:

    function test_SetNumber_reverts() public {
        vm.expectRevert();
        vm.prank(address(0x11));
        counter.setNumberOwner(1);
    }

    function test_SetNumber_reverts_reordered() public {
        vm.prank(address(0x11));
        vm.expectRevert();
        counter.setNumberOwner(1);
    }

A client also mentioned that sometimes teams will put an external call inside the expect revert to get some state so having the prank afterward avoids pranking on the view call.

Metadata

Metadata

Assignees

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