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
{{ message }}
Repository navigation
contract init should generate a contract that's compatible with fuzzing #1800
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.
This issue is stale because it has been assigned for 30 days with no activity. It will be closed in 90 days unless the stale label is removed, and the assignee is removed or updated.
Activity
contract init should generate a contract that's compatible with fuzzing
github-actions commentedon Jan 19, 2025
This issue is stale because it has been assigned for 30 days with no activity. It will be closed in 90 days unless the stale label is removed, and the assignee is removed or updated.