Repository navigation
Fix fastdev divergence bug - #5420
Conversation
There was a problem hiding this comment.
Pull request overview
Separates Soroban fuzz targets from Rust test utilities to prevent fastdev builds from enabling production-host recording behavior.
Changes:
- Adds a dedicated
fuzz_targetsCargo feature. - Disables fuzz targets in fastdev builds.
- Retains fuzz smoke tests in normal test builds.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/rust/src/soroban_fuzz.rs |
Gates fuzz implementations on fuzz_targets. |
src/rust/Cargo.toml |
Defines the separate fuzz-target feature. |
src/Makefile.am |
Enables fuzz targets only for non-fastdev test builds. |
Suppressed comments (1)
src/rust/src/soroban_fuzz.rs:30
- The preceding comment is stale after splitting the features: these implementations are enabled by
fuzz_targets, nottestutils. Please update the comment accordingly.
#[cfg(feature = "fuzz_targets")]
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@graydon two things -
|
Oh, interesting! Hmm. This further complicates matters. That flag doesn't exist but re: point 2, we actually need to replace it, to pass fastdev -- for the build to be a unified build -- because fuzz instrumentation (or at least asan instrumentation, which the fuzzers usually want to have turned on) doesn't like separate .a files, it winds up with multiple asan runtimes linked in. Unfortunately if I do that, with this patch, the soroban fuzzers are disabled. Which is not what we want. Like the fuzz target binaries get built but they all just say "warning: target disabled" over and over while they loop. So .. sigh .. need to think more about this. |
3712444 to
75009ea
Compare
|
@sisuresh Ok I think I have decided on a solution here: to turn the fuzz target back on in an |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
src/Makefile.am:354
- Correct the typo “fuzzz” to “fuzz.”
# mode (it just exits with a message to turn it off). The other fuzzz engines,
c817732 to
a7f9f85
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
Suppressed comments (3)
src/Makefile.am:78
CARGO_FEATURE_FUZZ_TARGETSbecomes empty whenever tests are disabled, even whenENABLE_FUZZis set. Since these configure options are independent and--enable-fuzzpromises to build the fuzz targets,--disable-tests --enable-fuzzcurrently builds the Soroban harness against the disabled stub in both fastdev and regular modes. Enable this Cargo feature when either tests or fuzzing are enabled.
CARGO_FEATURE_FUZZ_TARGETS = --features fuzz_targets
src/Makefile.am:362
- Correct the typo in “fuzzz engines.”
# mode (it just exits with a message to turn it off). The other fuzzz engines,
src/rust/Cargo.toml:246
- Introducing
fuzz_targetsas the actual gate leaves related guidance pointing at obsolete gates:src/test/fuzz/FuzzRegressionTests.cpp:86-87saystestutils, whilesrc/rust/src/bridge.rs:458,src/test/fuzz/targets/SorobanFuzzTargets.h:22-23, andsrc/Makefile.am:646say--features fuzz. These references now misdirect anyone enabling or debugging Soroban targets; update them tofuzz_targets.
fuzz_targets = ["dep:soroban-fuzz-targets"]
a7f9f85 to
e5cac0b
Compare
e5cac0b to
7916a01
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Suppressed comments (2)
src/Makefile.am:372
- The safety-critical non-fuzz fastdev branch is not exercised by the current CI: the only fastdev build is
build-fuzz.sh, which passes--enable-fuzzand takes the opposite branch. Add a non-fuzz fastdev regression build that verifies Soroban fuzz targets reportFUZZ_DISABLEDand that the production host remains free of recording/testutils, so feature changes cannot silently reintroduce mainnet divergence.
else
FASTDEV_CARGO_FEATURE_FUZZ_TARGETS=
RUSTFLAGS_FUZZ :=
src/Makefile.am:78
--enable-fuzzis independent ofBUILD_TESTS, and the fuzz rules compile their own test support even under--disable-tests. Gating this feature only onBUILD_TESTStherefore makes every--enable-fuzz --disable-testsSoroban target returnFUZZ_DISABLED; enablefuzz_targetswhen either tests or fuzzing are enabled.
CARGO_FEATURE_FUZZ_TARGETS = --features fuzz_targets
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Suppressed comments (3)
.github/workflows/build.yml:233
- The sanitizer path selects
cargo +nightly -Zbuild-std, which requiresrust-src, but installing the nightly toolchain does not include that component by default. Installrust-srcfor nightly here so this fuzz job can build the standard library.
run: rustup toolchain add nightly
src/Makefile.am:362
- Correct the typo “fuzzz” to “fuzz”.
# mode (it just exits with a message to turn it off). The other fuzzz engines,
src/Makefile.am:371
- The fastdev-without-fuzz branch that implements the divergence fix is not exercised by CI: the fuzz job configures
--enable-fuzzand takes the opposite branch, while the ordinary build jobs do not enable fastdev. Add a tests-enabled fastdev/no-fuzz CI case with an assertion thatfuzz_targets(and the production host's unifiedtestutils) remain disabled, so this safety-critical behavior cannot silently regress.
FASTDEV_CARGO_FEATURE_FUZZ_TARGETS=
7916a01 to
c797c10
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (3)
src/Makefile.am:357
CARGO_FEATURE_FUZZ_TARGETSis empty whenBUILD_TESTSis disabled, so--enable-fastdev-unsafe-for-production --enable-fuzz --disable-testsstill builds the Soroban fuzz executables but backs them with theFUZZ_DISABLEDstub.ENABLE_FUZZshould force this feature independently of the test-suite setting.
FASTDEV_CARGO_FEATURE_FUZZ_TARGETS=$(CARGO_FEATURE_FUZZ_TARGETS)
src/Makefile.am:151
- This TSan probe also matches the unconditional
-pthreadadded toCXXFLAGSinconfigure.ac:55. Consequently, the new fuzz configuration (-fsanitize=fuzzer-no-link,address) sets both-Zsanitizer=addressand-Zsanitizer=thread, even though Rust sanitizers are mutually exclusive, so the fuzz build fails. Matchthreadonly inside a-fsanitize=value.
RUSTFLAGS_TSAN := $(if $(if $(findstring -fsanitize,$(CXXFLAGS)),$(findstring thread,$(CXXFLAGS))),-Zsanitizer=thread,)
src/rust/Cargo.toml:246
- The feature split leaves user-facing references to the old gate:
src/rust/src/bridge.rs:458andsrc/test/fuzz/targets/SorobanFuzzTargets.h:22-23say--features fuzz, whilesrc/test/fuzz/FuzzRegressionTests.cpp:86-87saystestutils;src/Makefile.am:646also names the nonexistentfuzzfeature. Update these references tofuzz_targetsso the documented build instructions and disabled-target explanation remain accurate.
fuzz_targets = ["dep:soroban-fuzz-targets"]
c797c10 to
c17475e
Compare
Master added six [tx] tests that close ledgers (stellar#5420) and fixed the test footprint deduplication helper (stellar#5402), which had been placing read-only keys in the read-write footprint. Both tiers gain 6 leaves and 138 rewritten InvokeHostFunctionTests vectors whose transactions now carry the corrected footprints and fees. Claude-Session: https://claude.ai/code/session_01Rq9SZEScpZhaDqJpqjXu6b
Master added six [tx] tests that close ledgers (stellar#5420) and fixed the test footprint deduplication helper (stellar#5402), which had been placing read-only keys in the read-write footprint. Both tiers gain 6 leaves and 138 rewritten InvokeHostFunctionTests vectors whose transactions now carry the corrected footprints and fees. Claude-Session: https://claude.ai/code/session_01Rq9SZEScpZhaDqJpqjXu6b
Fastdev mode had unanticipated consequences:
soroban-fuzz-targetsdependency inrust_stellar_coreactually pulls in its own specific copy ofsoroban-env-host, which is the one it fuzzes. We can debate whether this is ideal (it's probably not, since it can fall behind the production host in master, but .. it's what it does currently).soroban-env-host/testutils, specifically to use recording mode and set up transactions that have a chance of making it somewhat deep into the auth system. This is also probably not ideal -- it would be nice to fuzz with recording turned off -- but at the moment this is sort of hard to change.soroban-fuzz-targetsturned on basically "by default": currently (on master) when you do a tests-enabled build of core, it enablesrust_stellar_core/testutilswhich turns onsoroban-fuzz-targets. This is intentional and I want to keep doing that! It's to make sure we notice if we break the fuzz targets. The fuzz targets get smoke-tested as part of normal core unit testing.fastdevmode makes a mess of this: since it's a unified build driven by cargo (not just linking separately-compiled crates), whatever version ofsoroban-env-hostthesoroban-fuzz-targetsdependency pulls in gets feature unified with the corresponding version ofsoroban-env-hostwe're using for production transaction-processing. So like if the fuzz target is pulling in p27, the production p27 getssoroban-env-host/testutilsturned on!fastdevfairly useless for development! And also scary. Nobody likes seeing divergence while working on a change.So the fix in this patch is a slight degradation in the above arrangement: we split out
rust_stellar_core/fuzz_targetsas a separate feature fromrust_stellar_core/testutils, and only turn it on when not infastdev. This way we still get smoketest coverage of the fuzz targets in the non-fastdevbuilds. We just get a warning that the fuzz target is disabled in afastdevbuild.