-
Notifications
You must be signed in to change notification settings - Fork 2.5k
expectEmit does not detect log, disrupts execution #8416
Copy link
Copy link
Closed
Labels
T-bugType: bugType: bug
Description
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 (72e44fb 2024-07-11T00:19:12.644905000Z)
What command(s) is the bug in?
forge test
Operating System
macOS (Apple Silicon)
Describe the bug
I'm testing an assembly contract with an event. I've distilled the issue into the following reproduction:
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;
import {Test} from "forge-std/Test.sol";
address constant addr = 0x000000000000000000000000000000000000aaaa;
contract LogTest is Test {
function setUp() public {
vm.etch(addr, hex"5f5fa000");
}
function testLog() public {
vm.expectEmit(addr);
assembly {
log0(0, 0)
}
(bool ret,) = addr.call("");
assertEq(ret, true);
}
}For some reason, this causes assertEq to fail. This is very unexpected as the call actually does succeed (simply comment out the vm.expectEmit line and the test passes).
By looking at the trace, it seems that log0 is called both in testLog() and again in 0xaaaa. So it's unclear why this test does not pass.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
T-bugType: bugType: bug