You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Edit the fuzz_target_1 to use the contract, by referencing the contract's crate.
Run the fuzzer
cargo +nightly fuzz run fuzz_target_1
What did you expect to see?
The fuzz test run.
What did you see instead?
Errors saying that the contract crate doesn't exist and isn't imported as a dependency. The crate is listed as a dependency, but fails to import because the crate-type is fixed to cdylib only.
Suggested fix
The crate-type should default to ["lib", "cdylib"] so that the crate can be released as a wasm file, as well as be imported into fuzzing tests.
There's some history to why the lib wasn't included. Having multiple crate-type's causes builds for wasms to skip link-time optimizations (LTO), resulting in larger wasm files. We used to avoid that issue by defaulting to, and telling folks, not to use lib in their crate-type. But that was impractical advice, because you need lib in the crate-type to do fuzzing and some other things. Today we recommend using stellar contract build that runs the build with some flags that result in LTO being activated for the wasm build.
The text was updated successfully, but these errors were encountered:
What version are you using?
22.0.1
What did you do?
What did you expect to see?
The fuzz test run.
What did you see instead?
Errors saying that the contract crate doesn't exist and isn't imported as a dependency. The crate is listed as a dependency, but fails to import because the crate-type is fixed to
cdylib
only.Suggested fix
The crate-type should default to
["lib", "cdylib"]
so that the crate can be released as a wasm file, as well as be imported into fuzzing tests.There's some history to why the lib wasn't included. Having multiple crate-type's causes builds for wasms to skip link-time optimizations (LTO), resulting in larger wasm files. We used to avoid that issue by defaulting to, and telling folks, not to use lib in their crate-type. But that was impractical advice, because you need lib in the crate-type to do fuzzing and some other things. Today we recommend using
stellar contract build
that runs the build with some flags that result in LTO being activated for the wasm build.The text was updated successfully, but these errors were encountered: