Component
Forge
Have you ensured that all of these are up to date?
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.
Component
Forge
Have you ensured that all of these are up to date?
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:
For some reason, this causes
assertEqto fail. This is very unexpected as the call actually does succeed (simply comment out thevm.expectEmitline and the test passes).By looking at the trace, it seems that
log0is called both intestLog()and again in0xaaaa. So it's unclear why this test does not pass.