Open tarrencev opened 1 year ago
snforge
for sozo test
max_recursion_depth
is missing from our custom blockifier.sozo build
before forge::run()
?cairo-lang-*
version conflicts.corelib
db
directly to forge?predeployed_contracts
in forge::run
?forge::run
Guys, lemme know if this makes sense.
@shramee perhaps we should adopt a pattern similar to https://docs.swmansion.com/scarb/docs/testing#using-third-party-test-runners
that way we can avoid the dependency resolution challenges with so many different deps wanting different versions of cairo
Yeah, I was thinking sozo build
might be required for snforge
command, which builds all artifacts before tests. Which might require stepping into Rust to change some stuff?
Edited: I'll check if we can add Dojo plug-in to forge, but chances are slim with compiled binary.
Hi @tarrencev, Just to confirm, why are we switching to foundry? Like what do we expect to be able to do. And whether we should use 0.2.0 or wait for newer version with Cairo 2.1.0 which has signed ints.
WIP
sozo test
call forge::run
to run tests via forge to allow access cheats and other good stuff that comes with Starknet Foundry for better easier tests.sozo test
arguments include_ignored
and ignored
are ignored 🥲 I mean, they don't work.corelib
fetched from scarb.crates/cheatable-starknet/predeployed-contracts
copied over to ./crates/snforge-predeployed-contracts
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /Users/shramee/.cargo/git/checkouts/cairo-f086c7e6d4098a68/f9e7b41/crates/cairo-lang-semantic/src/corelib.rs:582:60
Probably some issue with core_lib
but looks really good to me, could also be DojoPlugin missing from test_collector
in Foundry.
forge::run
args from snforge
package_path: /Users/shramee/www/starknet/starknet_forge_template
lib_path: /Users/shramee/www/starknet/starknet_forge_template/src/lib.cairo
dependencies: [LinkedLibrary { name: "starknet_forge_template", path: "/Users/shramee/www/starknet/starknet_forge_template/src" }]
runner_config: RunnerConfig { test_name_filter: None, exact_match: false, exit_first: false }
corelib: /var/folders/hg/qktjzkwj6w78g7bryxs00ynw0000gn/T/.tmpV76qHb
contracts: HashMap<String, StarknetContractArtifacts>
predeployed_contracts: /var/folders/hg/qktjzkwj6w78g7bryxs00ynw0000gn/T/.tmp0avphg
forge::run
args from sozo test
package_path: /Users/shramee/www/starknet/dojo/crates/dojo-core
lib_path: /Users/shramee/www/starknet/dojo/crates/dojo-core/src/lib.cairo
dependencies: []
runner_config: RunnerConfig { test_name_filter: None, exact_match: false, exit_first: false }
corelib: /Users/shramee/Library/Caches/com.swmansion.scarb/registry/std/v2.0.1/core/src
contracts: HashMap<String, StarknetContractArtifacts>
predeployed_contracts: /var/folders/hg/qktjzkwj6w78g7bryxs00ynw0000gn/T/.tmpKco0if
The library was missing PanicDestruct
,
Upgraded cairo-lang*
to 2.0.2
and scarb to 0.5.2
But that wasn't enough.
Foundry is using a specific revision of cairo >2.0.2
. So added their core-lib to dojo.
Final piece of the puzzle involves copying across sn-foundry test-collector
with a patch to replace it in snforge
and adding DojoPlugin
. But this causes Cairo version conflicts which is hard to resolve with scarb depending on v2.0.2
.
What would we like to do?
Okay, I thought patching everything to use 2.0.2
could do it but snfoundry is actually using a cairo-lang-sierra-type-size
crate which isn't in v2.0.2
. We could try the other way round and patch everything to the newer sn-foundry
's cairo version. cairo-lang-sierra-type-size
Seems to have types for them signed ints everyones raving about 🤤
Ah interesting, thanks for digging in! I'm close to updating the repo to Cairo 2.1.0. Perhaps we should wait for that?
Yeah, sounds good! 👍
can we close this @tarrencev ?
After discussion with SWM team, starknet foundry is not yet ready to be integrated as a library due to the current work on new proc macros.
Currently we are using the cairo test runner. This task is to migrate tests to https://github.com/foundry-rs/starknet-foundry