Skip to content

Commit f8b9c6e

Browse files
authored
Add --enable-fastdev-unsafe-for-production, subsuming unified buid (#5298)
This is a proposal for how to address #5267 in the short term. Longer term we might need some more involved fixes, but this should make life much nicer day-to-day for stellar-core devs. It adds a new mode `--enable-fastdev-unsafe-for-production` which: - Is still an optimized mode, but not _quite_ as optimized (it turns off LTO and turns on multiple CGUs) - Still has debuginfo, but not _quite_ as much (just line tables; enough for profiling and backtraces) - Turns off all soroban hosts except curr and next - Turns on the "unified build" (it actually subsumes/replaces that flag, since it was mainly useful for this sort of scenario anyways, along with asan and tsan, both of which are mainly useful for testing curr and next) - Also turns on next, because .. it's simpler to implement / fewer features if it's a superset. Also it doesn't cost much more and next is a very common development configuration anyways. Results: Before: ``` $ time make -j 20 (with warm ccache) real 6m6.625s user 12m13.915s sys 0m57.854s $ ls -lah src/stellar-core -rwxr-xr-x 1 dev dev 993M May 28 04:37 src/stellar-core ``` After: ``` $ time make -j 20 (with warm ccache) real 0m42.597s user 3m35.143s sys 0m27.528s $ ls -lah src/stellar-core -rwxr-xr-x 1 dev dev 277M May 28 04:48 src/stellar-core ```
2 parents 8612ca3 + afd75c0 commit f8b9c6e

22 files changed

Lines changed: 1091 additions & 149 deletions

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@
4949
[submodule "src/rust/soroban/p27"]
5050
path = src/rust/soroban/p27
5151
url = https://github.com/stellar/rs-soroban-env.git
52+
[submodule "src/rust/soroban/p28"]
53+
path = src/rust/soroban/p28
54+
url = https://github.com/stellar/rs-soroban-env.git
5255
[submodule "lib/gperftools"]
5356
path = lib/gperftools
5457
url = https://github.com/gperftools/gperftools.git

CONTRIBUTING.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ See https://clang.llvm.org/docs/AddressSanitizer.html for more information.
116116

117117
*Note*: ASan will ignore any memory errors in Rust code unless you build with
118118
Rust's ASan support. And building with Rust's ASan support requires configuring
119-
with `--enable-unified-rust-unsafe-for-production`. See below on "unified Rust
119+
with `--enable-fastdev-unsafe-for-production`. See below on "fastdev Rust
120120
builds".
121121

122122
*Note*: Rust's ASan support also requires a nightly compiler and the rust-src
@@ -156,7 +156,7 @@ See https://clang.llvm.org/docs/ThreadSanitizer.html for more information.
156156
*Note*: Since Rust code is run on multiple threads and those threads are
157157
launched _from C++_ TSan will report races in Rust code unless you build with
158158
Rust's TSan support. And building with Rust's TSan support requires configuring
159-
with `--enable-unified-rust-unsafe-for-production`.
159+
with `--enable-fastdev-unsafe-for-production`.
160160

161161
*Note*: Rust's ASan support also requires a nightly compiler and the rust-src
162162
component. Install these with:
@@ -294,7 +294,7 @@ files. You should then inspect to see that only the transactions you expected to
294294
see change did so. If so, commit the changes as a new set of baselines for
295295
future tests.
296296

297-
## Unified and non-unified Rust builds
297+
## Fastdev and non-unified Rust builds
298298

299299
As of protocol 20, some components of stellar-core are written in Rust (notably
300300
soroban).
@@ -331,23 +331,29 @@ and it _usually_ works. But there are two cases you might not want it.
331331
the stdlib and producing some sort of link-time dependency on crates that
332332
are only used as procedural macros).
333333

334-
For both of these cases, we've added the ability to (optionally) switch back to
335-
the normal way Rust expects you to build a crate that links multiple versions of
336-
a dependency: with a single "unified" cargo invocation, at the top level. There
337-
are two different ways to enable this:
334+
For both of these cases, we've added a fastdev mode that switches back to the
335+
normal way Rust expects you to build a crate, with a single cargo invocation at
336+
the top level and only the current and next Soroban hosts compiled in. There are
337+
two different ways to enable this:
338338

339-
- By configuring with `--enable-unified-rust-unsafe-for-production`, if one
340-
wants to _build_ a stellar-core with unified rust.
339+
- By configuring with `--enable-fastdev-unsafe-for-production`, if one wants
340+
to _build_ a stellar-core with fastdev rust.
341341

342-
- By toggling the "unified" feature flag in the IDE (eg. using the "Rust
342+
- By toggling the "fastdev" feature flag in the IDE (eg. using the "Rust
343343
Feature Toggler" editor extension in VS code) if one merely wants to _edit_
344-
a stellar-core with unified rust.
344+
a stellar-core with fastdev rust.
345345

346346
The configure flag has got such a long and unwieldy name because _it will build
347-
soroban with slightly different versions of transitive dependencies_, a
348-
configuration we do _not_ want to ship in production builds.
347+
soroban with fewer host versions and slightly different versions of transitive
348+
dependencies_, a configuration we do _not_ want to ship in production builds.
349349

350350
It is fine for debugging though. In practice those different versions of
351351
transitive dependencies are rarely "all that different". You will _probably_ not
352352
be able to observe any differences. We just don't want to chance it in
353353
production.
354+
355+
To reduce the set of possible configurations and flags, fastdev also acts as
356+
a superset of `--enable-next-protocol-version-unsafe-for-production` (i.e. it
357+
also turns on the `next` feature and links in whatever the next-protocol soroban
358+
host is).
359+

0 commit comments

Comments
 (0)