Closed ChapuKosi closed 2 months ago
@ChapuKosi This occurs for Starknet Foundry 0.27.0
as this version brought some changes to the Event Cheat. The current workshop works for 0.25.0
.
I will upgrade the workshop this month to the latests versions.
Workshop has been updated to 0.27.0
and this error doesn't occur anymore. Closing this issue.
Description:
When running the tests in the project, I encountered multiple compilation errors related to missing or deprecated functions and traits from the snforge_std library. This prevents the test code from compiling and running successfully.
Problematic Code:
The test code below fails to compile due to several missing identifiers and ambiguous method calls.
Errors Encountered:
error: Wrong number of arguments. Expected 0, found: 1 --> /home/bhanu/cairo/counter-workshop/tests/test_step.cairo:11:19 let mut spy = spy_events(SpyOn::One(contract_address)); ^**^
error: Method
fetch_events
not found on type<missing>
. Did you import the correct trait and impl? --> /home/bhanu/cairo/counter-workshop/tests/test_step.cairo:14:9 spy.fetch_events(); ^**^error: Ambiguous method call. More than one applicable trait function with a suitable self type was found: ArrayTrait::len and SpanTrait::len. Consider adding type annotations or explicitly refer to the impl function. --> /home/bhanu/cairo/counter-workshop/tests/test_step.cairo:15:24 assert!(spy.events.len() == 1, "here should be one event"); ^*^
error: Ambiguous method call. More than one applicable trait function with a suitable self type was found: ArrayTrait::at and SpanTrait::at. Consider adding type annotations or explicitly refer to the impl function. --> /home/bhanu/cairo/counter-workshop/tests/test_step.cairo:17:36 let (from, event) = spy.events.at(0); ^^