From 66faee0c82cbb13fe15034a37cb7017007add086 Mon Sep 17 00:00:00 2001 From: Yash Atreya <44857776+yash-atreya@users.noreply.github.com> Date: Tue, 17 Dec 2024 16:50:56 +0200 Subject: [PATCH 1/2] feat: count assertions for expectEmit --- src/Vm.sol | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Vm.sol b/src/Vm.sol index ce3f3564..cb3a9db5 100644 --- a/src/Vm.sol +++ b/src/Vm.sol @@ -2158,6 +2158,25 @@ interface Vm is VmSafe { /// Same as the previous method, but also checks supplied address against emitting contract. function expectEmit(address emitter) external; + /// Expect a given number of logs with the provided topics. + function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData, uint64 count) external; + + /// Expect a given number of logs from a specific emitter with the provided topics. + function expectEmit( + bool checkTopic1, + bool checkTopic2, + bool checkTopic3, + bool checkData, + address emitter, + uint64 count + ) external; + + /// Expect a given number of logs with all topic and data checks enabled. + function expectEmit(uint64 count) external; + + /// Expect a given number of logs from a specific emitter with all topic and data checks enabled. + function expectEmit(address emitter, uint64 count) external; + /// Expects an error on next call that starts with the revert data. function expectPartialRevert(bytes4 revertData) external; From bb1fea3644fe58505cbce713654100623604ab78 Mon Sep 17 00:00:00 2001 From: Yash Atreya <44857776+yash-atreya@users.noreply.github.com> Date: Tue, 17 Dec 2024 16:53:37 +0200 Subject: [PATCH 2/2] fix --- test/Vm.t.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Vm.t.sol b/test/Vm.t.sol index 7958a6d3..56d5fbed 100644 --- a/test/Vm.t.sol +++ b/test/Vm.t.sol @@ -9,7 +9,7 @@ import {Vm, VmSafe} from "../src/Vm.sol"; // added to or removed from Vm or VmSafe. contract VmTest is Test { function test_VmInterfaceId() public pure { - assertEq(type(Vm).interfaceId, bytes4(0xbe425eb2), "Vm"); + assertEq(type(Vm).interfaceId, bytes4(0xdb28dd7b), "Vm"); } function test_VmSafeInterfaceId() public pure {