Cant understand the problem here!! #2949
-
//FUNCTION CALL
} //OUTPUT Suite result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 9.15ms (681.80µs CPU time) Ran 1 test suite in 15.07s (9.15ms CPU time): 0 tests passed, 1 failed, 0 skipped (1 total tests) Failing tests: Encountered a total of 1 failing tests, 0 tests succeeded |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
The below is the stack trace of my test that passed, and the difference between my stack trace is that my Traces:
[68629] LotteryTest::testLotteryProperlyEmitEventWhenAPlayerEnters()
├─ [0] VM::expectEmit(true, false, false, false, Lottery: [0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0])
│ └─ ← [Return]
├─ emit enteredLottery(player: player: [0x44E97aF4418b7a17AABD8090bEA0A471a366305C])
├─ [0] VM::prank(player: [0x44E97aF4418b7a17AABD8090bEA0A471a366305C])
│ └─ ← [Return]
├─ [47805] Lottery::enter{value: 10000000000000000}()
│ ├─ emit enteredLottery(player: player: [0x44E97aF4418b7a17AABD8090bEA0A471a366305C])
│ └─ ← [Stop]
└─ ← [Stop] |
Beta Was this translation helpful? Give feedback.
-
Events in Solidity have signatures. The signature of an event is derived from its name and the types of its parameters. This signature allows events to be uniquely identified in the Ethereum Virtual Machine (EVM). Looking at your code, the event used in Raffle.sol is Placing the same event name Traces:
[73092] RafflesTest::testEmitsEventOnEntrance()
├─ [0] VM::prank(player: [0x44E97aF4418b7a17AABD8090bEA0A471a366305C])
│ └─ ← [Return]
├─ [0] VM::recordLogs()
│ └─ ← [Return]
├─ [0] console::log("PLAYER Address: ", player: [0x44E97aF4418b7a17AABD8090bEA0A471a366305C]) [staticcall]
│ └─ ← [Stop]
├─ [0] console::log("Entrance Fee: ", 10000000000000000 [1e16]) [staticcall]
│ └─ ← [Stop]
├─ [0] VM::expectEmit(true, false, false, false, Raffle: [0x90193C961A926261B756D1E5bb255e67ff9498A1])
│ └─ ← [Return]
├─ emit IndexedMembers(player: player: [0x44E97aF4418b7a17AABD8090bEA0A471a366305C])
├─ [47765] Raffle::enterRaffle{value: 10000000000000000}()
│ ├─ emit IndexedMembers(player: player: [0x44E97aF4418b7a17AABD8090bEA0A471a366305C])
│ └─ ← [Stop]
└─ ← [Stop] |
Beta Was this translation helpful? Give feedback.
Events in Solidity have signatures. The signature of an event is derived from its name and the types of its parameters. This signature allows events to be uniquely identified in the Ethereum Virtual Machine (EVM).
Looking at your code, the event used in Raffle.sol is
IndexedMembers
, whereas in the tests it isEnteredRaffle
which is a different signatures just from the name.Placing the same event name
IndexedMembers
makes the test pass.