Skip to content

hevm.prank does not reduce balance of the actor #398

Open
@boo-0x

Description

@boo-0x

Hi. I am using version 0.1.3 and seems that there is a bug when hevm.prank is used, as after transferring ETH from the account pranked, its balance does not change. The following test succeeds with Echidna and Foundry, but fails with Medusa.

event LogBalanceChange(uint256 balanceChange);

contract Tester {
    function sendETH() public payable {
        uint256 balanceBefore = msg.sender.balance;
        assert(balanceBefore > 10000);

        address payable recipient = msg.sender == address(0x30000) 
            ? payable(address(0x10000)) : payable(address(0x30000));
        hevm.prank(msg.sender);
        recipient.transfer(1000);

        uint256 balanceChange = balanceBefore - msg.sender.balance;
        emit LogBalanceChange(balanceChange);

        assert(balanceChange > 0);
    }
}

Logs:

     => [event] LogBalanceChange(0)
     => [panic: assertion failed]

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