diff --git a/.gitmodules b/.gitmodules index 140d3658f..4d0319357 100644 --- a/.gitmodules +++ b/.gitmodules @@ -49,6 +49,9 @@ [submodule "src/rust/soroban/p27"] path = src/rust/soroban/p27 url = https://github.com/stellar/rs-soroban-env.git +[submodule "src/rust/soroban/p28"] + path = src/rust/soroban/p28 + url = https://github.com/stellar/rs-soroban-env.git [submodule "lib/gperftools"] path = lib/gperftools url = https://github.com/gperftools/gperftools.git diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6cd924cd2..010955454 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -116,7 +116,7 @@ See https://clang.llvm.org/docs/AddressSanitizer.html for more information. *Note*: ASan will ignore any memory errors in Rust code unless you build with Rust's ASan support. And building with Rust's ASan support requires configuring -with `--enable-unified-rust-unsafe-for-production`. See below on "unified Rust +with `--enable-fastdev-unsafe-for-production`. See below on "fastdev Rust builds". *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. *Note*: Since Rust code is run on multiple threads and those threads are launched _from C++_ TSan will report races in Rust code unless you build with Rust's TSan support. And building with Rust's TSan support requires configuring -with `--enable-unified-rust-unsafe-for-production`. +with `--enable-fastdev-unsafe-for-production`. *Note*: Rust's ASan support also requires a nightly compiler and the rust-src component. Install these with: @@ -294,7 +294,7 @@ files. You should then inspect to see that only the transactions you expected to see change did so. If so, commit the changes as a new set of baselines for future tests. -## Unified and non-unified Rust builds +## Fastdev and non-unified Rust builds As of protocol 20, some components of stellar-core are written in Rust (notably soroban). @@ -331,23 +331,29 @@ and it _usually_ works. But there are two cases you might not want it. the stdlib and producing some sort of link-time dependency on crates that are only used as procedural macros). -For both of these cases, we've added the ability to (optionally) switch back to -the normal way Rust expects you to build a crate that links multiple versions of -a dependency: with a single "unified" cargo invocation, at the top level. There -are two different ways to enable this: +For both of these cases, we've added a fastdev mode that switches back to the +normal way Rust expects you to build a crate, with a single cargo invocation at +the top level and only the current and next Soroban hosts compiled in. There are +two different ways to enable this: - - By configuring with `--enable-unified-rust-unsafe-for-production`, if one - wants to _build_ a stellar-core with unified rust. + - By configuring with `--enable-fastdev-unsafe-for-production`, if one wants + to _build_ a stellar-core with fastdev rust. - - By toggling the "unified" feature flag in the IDE (eg. using the "Rust + - By toggling the "fastdev" feature flag in the IDE (eg. using the "Rust Feature Toggler" editor extension in VS code) if one merely wants to _edit_ - a stellar-core with unified rust. + a stellar-core with fastdev rust. The configure flag has got such a long and unwieldy name because _it will build -soroban with slightly different versions of transitive dependencies_, a -configuration we do _not_ want to ship in production builds. +soroban with fewer host versions and slightly different versions of transitive +dependencies_, a configuration we do _not_ want to ship in production builds. It is fine for debugging though. In practice those different versions of transitive dependencies are rarely "all that different". You will _probably_ not be able to observe any differences. We just don't want to chance it in production. + +To reduce the set of possible configurations and flags, fastdev also acts as +a superset of `--enable-next-protocol-version-unsafe-for-production` (i.e. it +also turns on the `next` feature and links in whatever the next-protocol soroban +host is). + diff --git a/Cargo.lock b/Cargo.lock index 45ecdbd1a..e4245019a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -464,6 +464,17 @@ dependencies = [ "serde_json", ] +[[package]] +name = "crate-git-revision" +version = "0.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54851b5b3f24621804b1cded2820975623c205e3055d2d44031cdb1237339ac8" +dependencies = [ + "serde", + "serde_derive", + "serde_json", +] + [[package]] name = "crypto-bigint" version = "0.5.5" @@ -1440,8 +1451,19 @@ dependencies = [ [[package]] name = "soroban-builtin-sdk-macros" -version = "26.1.2" -source = "git+https://github.com/stellar/rs-soroban-env?rev=c0e58f94ff2983a09440cef6a54253349fd3c4db#c0e58f94ff2983a09440cef6a54253349fd3c4db" +version = "27.0.0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=883fd56374fc619afaa4c4c7489563555b7173f2#883fd56374fc619afaa4c4c7489563555b7173f2" +dependencies = [ + "itertools 0.13.0", + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "soroban-builtin-sdk-macros" +version = "27.0.0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=b03d2563f3a08d51095a19bdbb6d90364b8ce04a#b03d2563f3a08d51095a19bdbb6d90364b8ce04a" dependencies = [ "itertools 0.13.0", "proc-macro2", @@ -1454,7 +1476,7 @@ name = "soroban-env-common" version = "21.2.2" source = "git+https://github.com/stellar/rs-soroban-env?rev=7eeddd897cfb0f700f938b0c8d6f0541150d1fcb#7eeddd897cfb0f700f938b0c8d6f0541150d1fcb" dependencies = [ - "crate-git-revision", + "crate-git-revision 0.0.6", "ethnum", "num-derive", "num-traits", @@ -1470,7 +1492,7 @@ name = "soroban-env-common" version = "22.0.0" source = "git+https://github.com/stellar/rs-soroban-env?rev=1cd8b8dca9aeeca9ce45b129cd923992b32dc258#1cd8b8dca9aeeca9ce45b129cd923992b32dc258" dependencies = [ - "crate-git-revision", + "crate-git-revision 0.0.6", "ethnum", "num-derive", "num-traits", @@ -1486,7 +1508,7 @@ name = "soroban-env-common" version = "23.0.0" source = "git+https://github.com/stellar/rs-soroban-env?rev=688bc34e6cd15c71742139e625268c7f30f55a92#688bc34e6cd15c71742139e625268c7f30f55a92" dependencies = [ - "crate-git-revision", + "crate-git-revision 0.0.6", "ethnum", "num-derive", "num-traits", @@ -1502,7 +1524,7 @@ name = "soroban-env-common" version = "24.0.0" source = "git+https://github.com/stellar/rs-soroban-env?rev=a37eeda815e626f416eff13f2eacb32a8b0c3729#a37eeda815e626f416eff13f2eacb32a8b0c3729" dependencies = [ - "crate-git-revision", + "crate-git-revision 0.0.6", "ethnum", "num-derive", "num-traits", @@ -1518,7 +1540,7 @@ name = "soroban-env-common" version = "25.0.0" source = "git+https://github.com/stellar/rs-soroban-env?rev=0a0c2df704edeb3cdafabfcc759eddccd6775337#0a0c2df704edeb3cdafabfcc759eddccd6775337" dependencies = [ - "crate-git-revision", + "crate-git-revision 0.0.6", "ethnum", "num-derive", "num-traits", @@ -1534,8 +1556,7 @@ name = "soroban-env-common" version = "26.0.0" source = "git+https://github.com/stellar/rs-soroban-env?rev=b351f88a468d3b9e1d6de53d5b0ca585f6b7dadb#b351f88a468d3b9e1d6de53d5b0ca585f6b7dadb" dependencies = [ - "arbitrary", - "crate-git-revision", + "crate-git-revision 0.0.6", "ethnum", "num-derive", "num-traits", @@ -1548,17 +1569,34 @@ dependencies = [ [[package]] name = "soroban-env-common" -version = "26.1.2" -source = "git+https://github.com/stellar/rs-soroban-env?rev=c0e58f94ff2983a09440cef6a54253349fd3c4db#c0e58f94ff2983a09440cef6a54253349fd3c4db" +version = "27.0.0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=883fd56374fc619afaa4c4c7489563555b7173f2#883fd56374fc619afaa4c4c7489563555b7173f2" dependencies = [ - "crate-git-revision", + "crate-git-revision 0.0.9", "ethnum", "num-derive", "num-traits", - "soroban-env-macros 26.1.2", + "soroban-env-macros 27.0.0 (git+https://github.com/stellar/rs-soroban-env?rev=883fd56374fc619afaa4c4c7489563555b7173f2)", "soroban-wasmi", "static_assertions", - "stellar-xdr 26.0.0", + "stellar-xdr 27.0.0", + "wasmparser", +] + +[[package]] +name = "soroban-env-common" +version = "27.0.0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=b03d2563f3a08d51095a19bdbb6d90364b8ce04a#b03d2563f3a08d51095a19bdbb6d90364b8ce04a" +dependencies = [ + "arbitrary", + "crate-git-revision 0.0.6", + "ethnum", + "num-derive", + "num-traits", + "soroban-env-macros 27.0.0 (git+https://github.com/stellar/rs-soroban-env?rev=b03d2563f3a08d51095a19bdbb6d90364b8ce04a)", + "soroban-wasmi", + "static_assertions", + "stellar-xdr 27.0.0", "wasmparser", ] @@ -1772,8 +1810,44 @@ dependencies = [ [[package]] name = "soroban-env-host" -version = "26.1.2" -source = "git+https://github.com/stellar/rs-soroban-env?rev=c0e58f94ff2983a09440cef6a54253349fd3c4db#c0e58f94ff2983a09440cef6a54253349fd3c4db" +version = "27.0.0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=883fd56374fc619afaa4c4c7489563555b7173f2#883fd56374fc619afaa4c4c7489563555b7173f2" +dependencies = [ + "ark-bls12-381 0.5.0", + "ark-bn254 0.5.0", + "ark-ec 0.5.0", + "ark-ff 0.5.0", + "ark-serialize 0.5.0", + "curve25519-dalek", + "ecdsa", + "ed25519-dalek", + "elliptic-curve", + "generic-array", + "getrandom", + "hex-literal", + "hmac", + "k256", + "num-derive", + "num-integer", + "num-traits", + "p256", + "rand", + "rand_chacha", + "sec1", + "sha2", + "sha3", + "soroban-builtin-sdk-macros 27.0.0 (git+https://github.com/stellar/rs-soroban-env?rev=883fd56374fc619afaa4c4c7489563555b7173f2)", + "soroban-env-common 27.0.0 (git+https://github.com/stellar/rs-soroban-env?rev=883fd56374fc619afaa4c4c7489563555b7173f2)", + "soroban-wasmi", + "static_assertions", + "stellar-strkey 0.0.13", + "wasmparser", +] + +[[package]] +name = "soroban-env-host" +version = "27.0.0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=b03d2563f3a08d51095a19bdbb6d90364b8ce04a#b03d2563f3a08d51095a19bdbb6d90364b8ce04a" dependencies = [ "ark-bls12-381 0.5.0", "ark-bn254 0.5.0", @@ -1798,8 +1872,8 @@ dependencies = [ "sec1", "sha2", "sha3", - "soroban-builtin-sdk-macros 26.1.2", - "soroban-env-common 26.1.2", + "soroban-builtin-sdk-macros 27.0.0 (git+https://github.com/stellar/rs-soroban-env?rev=b03d2563f3a08d51095a19bdbb6d90364b8ce04a)", + "soroban-env-common 27.0.0 (git+https://github.com/stellar/rs-soroban-env?rev=b03d2563f3a08d51095a19bdbb6d90364b8ce04a)", "soroban-wasmi", "static_assertions", "stellar-strkey 0.0.13", @@ -1892,25 +1966,39 @@ dependencies = [ [[package]] name = "soroban-env-macros" -version = "26.1.2" -source = "git+https://github.com/stellar/rs-soroban-env?rev=c0e58f94ff2983a09440cef6a54253349fd3c4db#c0e58f94ff2983a09440cef6a54253349fd3c4db" +version = "27.0.0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=883fd56374fc619afaa4c4c7489563555b7173f2#883fd56374fc619afaa4c4c7489563555b7173f2" dependencies = [ "itertools 0.13.0", "proc-macro2", "quote", "serde", "serde_json", - "stellar-xdr 26.0.0", + "stellar-xdr 27.0.0", + "syn 2.0.39", +] + +[[package]] +name = "soroban-env-macros" +version = "27.0.0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=b03d2563f3a08d51095a19bdbb6d90364b8ce04a#b03d2563f3a08d51095a19bdbb6d90364b8ce04a" +dependencies = [ + "itertools 0.13.0", + "proc-macro2", + "quote", + "serde", + "serde_json", + "stellar-xdr 27.0.0", "syn 2.0.39", ] [[package]] name = "soroban-fuzz-targets" -version = "26.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=b351f88a468d3b9e1d6de53d5b0ca585f6b7dadb#b351f88a468d3b9e1d6de53d5b0ca585f6b7dadb" +version = "27.0.0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=b03d2563f3a08d51095a19bdbb6d90364b8ce04a#b03d2563f3a08d51095a19bdbb6d90364b8ce04a" dependencies = [ "arbitrary", - "soroban-env-host 26.0.0", + "soroban-env-host 27.0.0 (git+https://github.com/stellar/rs-soroban-env?rev=b03d2563f3a08d51095a19bdbb6d90364b8ce04a)", "soroban-synth-wasm", "soroban-wasmi", "wasm-smith", @@ -1918,21 +2006,21 @@ dependencies = [ [[package]] name = "soroban-synth-wasm" -version = "26.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=b351f88a468d3b9e1d6de53d5b0ca585f6b7dadb#b351f88a468d3b9e1d6de53d5b0ca585f6b7dadb" +version = "27.0.0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=b03d2563f3a08d51095a19bdbb6d90364b8ce04a#b03d2563f3a08d51095a19bdbb6d90364b8ce04a" dependencies = [ "arbitrary", - "soroban-env-common 26.0.0", - "soroban-env-macros 26.0.0", - "stellar-xdr 26.0.0", + "soroban-env-common 27.0.0 (git+https://github.com/stellar/rs-soroban-env?rev=b03d2563f3a08d51095a19bdbb6d90364b8ce04a)", + "soroban-env-macros 27.0.0 (git+https://github.com/stellar/rs-soroban-env?rev=b03d2563f3a08d51095a19bdbb6d90364b8ce04a)", + "stellar-xdr 27.0.0", "wasm-encoder", "wasmparser", ] [[package]] name = "soroban-test-wasms" -version = "26.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=b351f88a468d3b9e1d6de53d5b0ca585f6b7dadb#b351f88a468d3b9e1d6de53d5b0ca585f6b7dadb" +version = "27.0.0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=b03d2563f3a08d51095a19bdbb6d90364b8ce04a#b03d2563f3a08d51095a19bdbb6d90364b8ce04a" [[package]] name = "soroban-wasmi" @@ -1987,7 +2075,8 @@ dependencies = [ "soroban-env-host 24.0.0", "soroban-env-host 25.0.0", "soroban-env-host 26.0.0", - "soroban-env-host 26.1.2", + "soroban-env-host 27.0.0 (git+https://github.com/stellar/rs-soroban-env?rev=883fd56374fc619afaa4c4c7489563555b7173f2)", + "soroban-env-host 27.0.0 (git+https://github.com/stellar/rs-soroban-env?rev=b03d2563f3a08d51095a19bdbb6d90364b8ce04a)", "soroban-fuzz-targets", "soroban-synth-wasm", "soroban-test-wasms", @@ -2015,7 +2104,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12d2bf45e114117ea91d820a846fd1afbe3ba7d717988fee094ce8227a3bf8bd" dependencies = [ "base32", - "crate-git-revision", + "crate-git-revision 0.0.6", "thiserror", ] @@ -2025,7 +2114,7 @@ version = "0.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e3aa3ed00e70082cb43febc1c2afa5056b9bb3e348bbb43d0cd0aa88a611144" dependencies = [ - "crate-git-revision", + "crate-git-revision 0.0.6", "data-encoding", "thiserror", ] @@ -2036,7 +2125,7 @@ version = "0.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee1832fb50c651ad10f734aaf5d31ca5acdfb197a6ecda64d93fcdb8885af913" dependencies = [ - "crate-git-revision", + "crate-git-revision 0.0.6", "data-encoding", ] @@ -2047,7 +2136,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2675a71212ed39a806e415b0dbf4702879ff288ec7f5ee996dda42a135512b50" dependencies = [ "base64 0.13.1", - "crate-git-revision", + "crate-git-revision 0.0.6", "escape-bytes", "hex", "stellar-strkey 0.0.8", @@ -2060,7 +2149,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20c2130275cc730d042b3082f51145f0486f5a543d6d72fced02ed9048b82b57" dependencies = [ "base64 0.13.1", - "crate-git-revision", + "crate-git-revision 0.0.6", "escape-bytes", "hex", "stellar-strkey 0.0.9", @@ -2074,7 +2163,7 @@ checksum = "89d2848e1694b0c8db81fd812bfab5ea71ee28073e09ccc45620ef3cf7a75a9b" dependencies = [ "base64 0.22.1", "cfg_eval", - "crate-git-revision", + "crate-git-revision 0.0.6", "escape-bytes", "ethnum", "hex", @@ -2090,7 +2179,7 @@ checksum = "4ceec163a64a9ed03359dab3b73ca556251020edc0103bae7073a38eb1708ab5" dependencies = [ "base64 0.22.1", "cfg_eval", - "crate-git-revision", + "crate-git-revision 0.0.6", "escape-bytes", "ethnum", "hex", @@ -2105,7 +2194,7 @@ source = "git+https://github.com/stellar/rs-stellar-xdr?rev=89cc1cbadf1b9a168438 dependencies = [ "base64 0.22.1", "cfg_eval", - "crate-git-revision", + "crate-git-revision 0.0.6", "escape-bytes", "ethnum", "hex", @@ -2119,10 +2208,9 @@ version = "26.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fea3195594b044ea3a5b05906f81d945480825f00db4e3ae7d77526bf546ff3a" dependencies = [ - "arbitrary", "base64 0.22.1", "cfg_eval", - "crate-git-revision", + "crate-git-revision 0.0.6", "escape-bytes", "ethnum", "hex", @@ -2136,7 +2224,9 @@ version = "27.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05ff843326969bdf1ef673dcdba94c08f4a3c8f1e58d6e6ef39b1bd4f749179a" dependencies = [ - "crate-git-revision", + "arbitrary", + "base64 0.22.1", + "crate-git-revision 0.0.6", "escape-bytes", "ethnum", "hex", diff --git a/Cargo.toml b/Cargo.toml index b4017c618..d1e263949 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,3 +12,10 @@ lto = true # (or you can build with `make RUST_PROFILE=dev` to get them built with # debug-and-no-opt). debug = true + +[profile.fastdev] +inherits = "release" +lto = false +debug = "line-tables-only" +codegen-units = 16 +split-debuginfo = "unpacked" diff --git a/configure.ac b/configure.ac index 76cc59523..01ed39746 100644 --- a/configure.ac +++ b/configure.ac @@ -97,10 +97,24 @@ AX_APPEND_COMPILE_FLAGS($WFLAGS) AX_APPEND_COMPILE_FLAGS([-pthread]) AC_LANG_POP(C) -AC_ARG_ENABLE(unified-rust-unsafe-for-production, - AS_HELP_STRING([--enable-unified-rust-unsafe-for-production], - [Build rust crates as a single cargo library, risking version drift])) -AM_CONDITIONAL(UNIFIED_RUST, [test "x$enable_unified_rust_unsafe_for_production" = "xyes"]) +AC_ARG_ENABLE(fastdev-unsafe-for-production, + AS_HELP_STRING([--enable-fastdev-unsafe-for-production], + [Build in fast development mode UNSAFE FOR PRODUCTION])) +AS_IF([test "x$enable_fastdev_unsafe_for_production" = "xyes"], [ + AC_MSG_NOTICE([enabling fastdev build profile UNSAFE FOR PRODUCTION]) + fastdev_cxx_version=`$CXX --version 2>/dev/null` + case "$fastdev_cxx_version" in + *clang*) + CXXFLAGS="$CXXFLAGS -gline-tables-only" + AC_MSG_NOTICE([added -gline-tables-only to CXXFLAGS]) + ;; + *) + AC_MSG_ERROR([fastdev build requires clang compiler]) + ;; + esac +]) +AM_CONDITIONAL(ENABLE_FASTDEV_UNSAFE_FOR_PRODUCTION, + [test "x$enable_fastdev_unsafe_for_production" = "xyes"]) unset sanitizeopts @@ -110,8 +124,8 @@ AC_ARG_ENABLE([asan], AS_IF([test "x$enable_asan" = "xyes"], [ AC_MSG_NOTICE([ Enabling asan, see https://clang.llvm.org/docs/AddressSanitizer.html ]) - AS_IF([test "xyes" != "x$enable_unified_rust_unsafe_for_production"], [ - AC_MSG_WARN(Asan will not instrument rust without --enable-unified-rust-unsafe-for-production) + AS_IF([test "xyes" != "x$enable_fastdev_unsafe_for_production"], [ + AC_MSG_WARN(Asan will not instrument rust without --enable-fastdev-unsafe-for-production) ]) sanitizeopts="address" @@ -134,8 +148,8 @@ AC_ARG_ENABLE([threadsanitizer], AS_IF([test "x$enable_threadsanitizer" = "xyes"], [ AC_MSG_NOTICE([ enabling thread-sanitizer, see https://clang.llvm.org/docs/ThreadSanitizer.html ]) - AS_IF([test "xyes" != "x$enable_unified_rust_unsafe_for_production"], [ - AC_MSG_ERROR(Enabling tsan requires --enable-unified-rust-unsafe-for-production) + AS_IF([test "xyes" != "x$enable_fastdev_unsafe_for_production"], [ + AC_MSG_ERROR(Enabling tsan requires --enable-fastdev-unsafe-for-production) ]) AS_IF([test x != "x$sanitizeopts"], [ AC_MSG_ERROR(Cannot enable multiple sanitizers at once) @@ -558,6 +572,12 @@ AM_CONDITIONAL(USE_SPDLOG, [test x$enable_spdlog != xno]) AC_ARG_ENABLE(next-protocol-version-unsafe-for-production, AS_HELP_STRING([--enable-next-protocol-version-unsafe-for-production], [Enable next protocol version UNSAFE FOR PRODUCTION])) +AS_IF([test "x$enable_fastdev_unsafe_for_production" = "xyes"], [ + AS_IF([test "x$enable_next_protocol_version_unsafe_for_production" != "xyes"], [ + AC_MSG_NOTICE([enabling next protocol version due to fastdev build profile]) + ]) + enable_next_protocol_version_unsafe_for_production=yes +]) AM_CONDITIONAL(ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION, [test x$enable_next_protocol_version_unsafe_for_production = xyes]) diff --git a/src/Makefile.am b/src/Makefile.am index e33128a57..180ff8052 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -77,6 +77,12 @@ else CARGO_FEATURE_NEXT = endif +if ENABLE_FASTDEV_UNSAFE_FOR_PRODUCTION +CARGO_FEATURE_FASTDEV = --features fastdev +else +CARGO_FEATURE_FASTDEV = +endif + main/XDRFilesSha256.cpp: $(SRC_X_FILES) Makefile $(top_srcdir)/hash-xdrs.sh $(top_srcdir)/hash-xdrs.sh $(top_srcdir)/src/protocol-curr >$@ @@ -131,11 +137,12 @@ stellar_core_SOURCES += $(GENERATED_XDRQUERY_SOURCES) util/xdrquery/XDRQueryPars BUILT_SOURCES += rust/RustBridge.h $(GENERATED_RUST_SOURCES) stellar_core_SOURCES += rust/RustBridge.h $(GENERATED_RUST_SOURCES) -if UNIFIED_RUST -RUST_TOOLCHAIN_CHANNEL=nightly -else RUST_TOOLCHAIN_FILE=$(top_srcdir)/rust-toolchain.toml -RUST_TOOLCHAIN_CHANNEL=$(shell sed -n 's/channel *= *"\([^"]*\)"/\1/p' $(RUST_TOOLCHAIN_FILE)) +RUST_TOOLCHAIN_FILE_CHANNEL=$(shell sed -n 's/channel *= *"\([^"]*\)"/\1/p' $(RUST_TOOLCHAIN_FILE)) +if ENABLE_FASTDEV_UNSAFE_FOR_PRODUCTION +RUST_TOOLCHAIN_CHANNEL=$(if $(findstring -fsanitize=,$(CXXFLAGS)),nightly,$(RUST_TOOLCHAIN_FILE_CHANNEL)) +else +RUST_TOOLCHAIN_CHANNEL=$(RUST_TOOLCHAIN_FILE_CHANNEL) endif CARGO=cargo +$(RUST_TOOLCHAIN_CHANNEL) RUSTC_WRAPPER=@RUSTC_WRAPPER@ @@ -151,22 +158,27 @@ RUST_BUILD_DIR=$(top_builddir)/src/rust RUST_BIN_DIR=$(RUST_BUILD_DIR)/bin RUST_TARGET_DIR=$(top_builddir)/target RUST_CXXBRIDGE=$(RUST_BIN_DIR)/cxxbridge + +if ENABLE_FASTDEV_UNSAFE_FOR_PRODUCTION +RUST_PROFILE=fastdev +else RUST_PROFILE=release +endif check-rust-profile: Makefile @case "$(RUST_PROFILE)" in \ - release|dev) ;; \ - *) echo "Error: RUST_PROFILE must be 'release' or 'dev', got '$(RUST_PROFILE)'" >&2; exit 1;; \ + release|dev|fastdev) ;; \ + *) echo "Error: RUST_PROFILE must be 'release', 'dev', or 'fastdev', got '$(RUST_PROFILE)'" >&2; exit 1;; \ esac # Of course, RUST_PROFILE can't be used as an argument directly because cargo # doesn't let you pass --debug, that's the default! you can only pass --release. # So we have to derive a new variable here. -RUST_PROFILE_ARG := $(if $(findstring release,$(RUST_PROFILE)),--release,) +RUST_PROFILE_ARG := $(if $(findstring fastdev,$(RUST_PROFILE)),--profile fastdev,$(if $(findstring release,$(RUST_PROFILE)),--release,)) # Also for even more nonsense reasons the debug profile name is actually `dev` # but only in the command line, the target subdirectory gets called `debug`. -RUST_PROFILE_DIR := $(if $(findstring release,$(RUST_PROFILE)),release,debug) +RUST_PROFILE_DIR := $(if $(findstring fastdev,$(RUST_PROFILE)),fastdev,$(if $(findstring release,$(RUST_PROFILE)),release,debug)) RUST_DEP_TREE_STAMP=$(RUST_BUILD_DIR)/src/dep-trees/equal-trees.stamp SOROBAN_LIBS_STAMP=$(RUST_BUILD_DIR)/soroban/soroban-libs.stamp @@ -201,7 +213,11 @@ SOROBAN_BUILD_DIR=$(abspath $(RUST_BUILD_DIR))/soroban # variable empty (and include or exclude submodules from the list of # ALL_SOROBAN_PROTOCOLS as you see fit). -ALL_SOROBAN_PROTOCOLS=p21 p22 p23 p24 p25 p26 p27 +if ENABLE_FASTDEV_UNSAFE_FOR_PRODUCTION +ALL_SOROBAN_PROTOCOLS=p27 p28 +else +ALL_SOROBAN_PROTOCOLS=p21 p22 p23 p24 p25 p26 p27 p28 +endif WIP_SOROBAN_PROTOCOL= CARGO_XDR_FEATURE_FLAGS = @@ -287,23 +303,23 @@ $(SOROBAN_BUILD_DIR)/%/target/git-state.txt: $(top_srcdir)/.git/modules/src/rust printf '%s\n' "$$state" > $@.tmp; \ if cmp -s $@.tmp $@; then rm -f $@.tmp; else mv -f $@.tmp $@; fi -# The "unified" rust build is a special non-production mode that builds all of +# The fastdev rust build is a special non-production mode that builds all of # the rust dependencies of librust_stellar_core.a through a single cargo # invocation, which is actually the "normal" way cargo operates, but which also # has the negative side effect of resolving (merging) different point releases # and pre-release minor versions across transitive dependencies, which means we # can't control the _exact_ transitive dependencies as well as we'd like. # -# So we only use the unified rust build for certain special cases such as +# So we only use the fastdev rust build for certain special cases such as # testing with asan/tsan (they seem to only work well when built this way) and # use the non-unified build (with separate .a files for each separate soroban # version) for production builds. -if UNIFIED_RUST +if ENABLE_FASTDEV_UNSAFE_FOR_PRODUCTION -# In the unified build, we have to pass the --target flag. This actually breaks +# In the fastdev build, we have to pass the --target flag. This actually breaks # the non-unified build, so we wind up setting LIBRUST_STELLAR_CORE separately -# in unified and non-unified builds. +# in fastdev and non-unified builds. RUST_TARGET=$(shell rustc -vV | sed -n 's/host: //p') LIBRUST_STELLAR_CORE=$(RUST_TARGET_DIR)/$(RUST_TARGET)/$(RUST_PROFILE_DIR)/librust_stellar_core.a @@ -323,14 +339,13 @@ $(LIBRUST_STELLAR_CORE): $(RUST_HOST_DEPFILES) $(SRC_RUST_FILES) Makefile $(RUST $(CARGOFLAGS_BUILDSTD) \ --package stellar-core \ --target $(RUST_TARGET) \ - --features unified \ $(RUST_PROFILE_ARG) \ --locked \ --target-dir $(abspath $(RUST_TARGET_DIR)) \ - $(CARGO_FEATURE_TRACY) $(CARGO_FEATURE_NEXT) $(CARGO_FEATURE_TESTUTILS) + $(CARGO_FEATURE_FASTDEV) $(CARGO_FEATURE_TRACY) $(CARGO_FEATURE_NEXT) $(CARGO_FEATURE_TESTUTILS) ranlib $@ -else # !UNIFIED_RUST +else # !ENABLE_FASTDEV_UNSAFE_FOR_PRODUCTION # This next build command looks a little weird but it's necessary. We have to # provide an auxiliary metadata string (using RUSTFLAGS=-Cmetadata=$*) @@ -444,7 +459,7 @@ $(LIBRUST_STELLAR_CORE): $(RUST_HOST_DEPFILES) $(SRC_RUST_FILES) $(ALL_SOROBAN_L $(ALL_SOROBAN_DEPEND_ARGS) ranlib $@ -endif # UNIFIED_RUST +endif # ENABLE_FASTDEV_UNSAFE_FOR_PRODUCTION stellar_core_LDADD += $(LIBRUST_STELLAR_CORE) -ldl diff --git a/src/herder/test/HerderTests.cpp b/src/herder/test/HerderTests.cpp index 15d3282d4..885ff6f14 100644 --- a/src/herder/test/HerderTests.cpp +++ b/src/herder/test/HerderTests.cpp @@ -1042,7 +1042,15 @@ TEST_CASE("txset", "[herder][txset]") { SECTION("generalized tx set protocol") { - testTxSet(static_cast(SOROBAN_PROTOCOL_VERSION)); + uint32_t generalizedTxSetProtocolVersion = + static_cast(SOROBAN_PROTOCOL_VERSION); +#ifdef ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION + // Fastdev only links recent Soroban hosts, and this test just needs a + // generalized-txset-capable protocol. + generalizedTxSetProtocolVersion = + Config::CURRENT_LEDGER_PROTOCOL_VERSION - 1; +#endif + testTxSet(generalizedTxSetProtocolVersion); } SECTION("protocol current") { @@ -1450,6 +1458,12 @@ TEST_CASE("txset base fee", "[herder][txset]") uint32_t expNotChargedAccounts = 0) { cfg.LEDGER_PROTOCOL_VERSION = protocolVersion; cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = protocolVersion; + if (!testutil::isTestApplicationProtocolVersionSupported(cfg)) + { + SUCCEED("Skipping historical Soroban protocol test: requested " + "protocol is not linked in this build"); + return; + } VirtualClock clock; Application::pointer app = createTestApplication(clock, cfg); @@ -1671,7 +1685,7 @@ TEST_CASE("tx set hits overlay byte limit during construction", { Config cfg(getTestConfig()); cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = - static_cast(SOROBAN_PROTOCOL_VERSION); + Config::CURRENT_LEDGER_PROTOCOL_VERSION; auto max = std::numeric_limits::max(); cfg.TESTING_UPGRADE_MAX_TX_SET_SIZE = max; // Pre-create enough genesis accounts for the test diff --git a/src/herder/test/TransactionQueueTests.cpp b/src/herder/test/TransactionQueueTests.cpp index ec2b84a06..4ed79984d 100644 --- a/src/herder/test/TransactionQueueTests.cpp +++ b/src/herder/test/TransactionQueueTests.cpp @@ -1430,6 +1430,15 @@ TEST_CASE("TransactionQueue Key Filtering", "[soroban][transactionqueue]") } SECTION("protocol version 24") { + auto cfg = getTestConfig(); + cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = 24; + if (!testutil::isTestApplicationProtocolVersionSupported(cfg)) + { + SUCCEED("Skipping historical Soroban protocol test: requested " + "protocol is not linked in this build"); + return; + } + SECTION("should filter") { for (auto const& keyToFilter : keysToFilterP24) diff --git a/src/herder/test/TxSetTests.cpp b/src/herder/test/TxSetTests.cpp index 87216f3ce..bcf61ed69 100644 --- a/src/herder/test/TxSetTests.cpp +++ b/src/herder/test/TxSetTests.cpp @@ -482,6 +482,12 @@ testGeneralizedTxSetXDRConversion(ProtocolVersion protocolVersion) cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = static_cast(protocolVersion); cfg.GENESIS_TEST_ACCOUNT_COUNT = 10000; + if (!testutil::isTestApplicationProtocolVersionSupported(cfg)) + { + SUCCEED("Skipping historical Soroban protocol test: requested " + "protocol is not linked in this build"); + return; + } bool isParallelSoroban = protocolVersionStartsFrom( cfg.LEDGER_PROTOCOL_VERSION, PARALLEL_SOROBAN_PHASE_PROTOCOL_VERSION); @@ -1064,6 +1070,16 @@ TEST_CASE("generalized tx set XDR conversion", "[txset]") TEST_CASE("applicable txset validation - Soroban phase version is correct", "[txset][soroban]") { + auto historicalCfg = getTestConfig(); + historicalCfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = + static_cast(PARALLEL_SOROBAN_PHASE_PROTOCOL_VERSION) - 1; + if (!testutil::isTestApplicationProtocolVersionSupported(historicalCfg)) + { + SUCCEED("Skipping historical Soroban protocol test: requested " + "protocol is not linked in this build"); + return; + } + auto runTest = [](uint32_t protocolVersion, bool useParallelSorobanPhase) -> TxSetValidationResult { VirtualClock clock; @@ -2497,10 +2513,15 @@ runParallelTxSetBuildingTest(bool variableStageCount) VirtualClock clock; auto cfg = getTestConfig(); - cfg.LEDGER_PROTOCOL_VERSION = - static_cast(PARALLEL_SOROBAN_PHASE_PROTOCOL_VERSION); - cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = + uint32_t testLedgerProtocolVersion = static_cast(PARALLEL_SOROBAN_PHASE_PROTOCOL_VERSION); +#ifdef ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION + // Fastdev only links recent Soroban hosts, so avoid forcing this test + // through the first historical parallel-Soroban protocol in next builds. + testLedgerProtocolVersion = Config::CURRENT_LEDGER_PROTOCOL_VERSION - 1; +#endif + cfg.LEDGER_PROTOCOL_VERSION = testLedgerProtocolVersion; + cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = testLedgerProtocolVersion; cfg.SOROBAN_PHASE_MIN_STAGE_COUNT = variableStageCount ? 1 : STAGE_COUNT; cfg.SOROBAN_PHASE_MAX_STAGE_COUNT = STAGE_COUNT; // Temporary set the limits override very high in order for the upgrades diff --git a/src/herder/test/UpgradesTests.cpp b/src/herder/test/UpgradesTests.cpp index 4894af432..18bb5d6c9 100644 --- a/src/herder/test/UpgradesTests.cpp +++ b/src/herder/test/UpgradesTests.cpp @@ -1047,6 +1047,12 @@ TEST_CASE("upgrades affect in-memory Soroban state state size", auto cfg = getTestConfig(); cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = 22; cfg.USE_CONFIG_FOR_GENESIS = true; + if (!testutil::isTestApplicationProtocolVersionSupported(cfg)) + { + SUCCEED("Skipping historical Soroban protocol test: requested " + "protocol is not linked in this build"); + return; + } uint32_t const windowSize = 15; uint32_t const samplePeriod = 4; @@ -3892,6 +3898,12 @@ TEST_CASE("protocol 23 upgrade sets default SCP timing values", "[upgrades]") VirtualClock clock; auto cfg = getTestConfig(0, Config::TESTDB_IN_MEMORY); cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = 22; + if (!testutil::isTestApplicationProtocolVersionSupported(cfg)) + { + SUCCEED("Skipping historical Soroban protocol test: requested " + "protocol is not linked in this build"); + return; + } auto app = createTestApplication(clock, cfg); auto& lm = app->getLedgerManager(); @@ -4043,6 +4055,12 @@ TEST_CASE("p24 upgrade fixes corrupted hot archive entries", Config cfg(getTestConfig()); cfg.USE_CONFIG_FOR_GENESIS = true; cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = corruptedProtocolVersion; + if (!testutil::isTestApplicationProtocolVersionSupported(cfg)) + { + SUCCEED("Skipping historical Soroban protocol test: requested " + "protocol is not linked in this build"); + return; + } auto app = createTestApplication(clock, cfg); gIsProductionNetwork = true; overrideSorobanNetworkConfigForTest(*app); diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml index b67966797..be8e16cb1 100644 --- a/src/rust/Cargo.toml +++ b/src/rust/Cargo.toml @@ -98,27 +98,35 @@ tracy-client = { version = "=0.17.0", features = [ # makes it difficult to use an IDE to work on this crate since the IDE will not # be able to resolve the hosts to anything at all. So we keep some _optional_ # copies of the host dependencies here, and allow enabling them with the -# `unified` feature here. +# `fastdev` feature here. # # To reiterate: the soroban-env-host-p{21,22,23}... dependency blocks listed # here are NOT part of the default build. The default build relies on the # versions pinned as git submodules. # -# However, you can _manually_ switch the default build by enabling the `unified` +# However, you can _manually_ switch the default build by enabling the `fastdev` # feature using a feature-toggle in an IDE (eg. using the VS Code "Rust Feature # Toggler" extension), and the build system (src/Makefile.am) can be configured -# to use the `unified` feature if you configure with -# --enable-unified-rust-unsafe-for-production. +# to use the `fastdev` feature if you configure with +# --enable-fastdev-unsafe-for-production. # -# If you do a unified build, be careful to reset any changes the IDE makes to +# If you do a fastdev build, be careful to reset any changes the IDE makes to # Cargo.lock! The unified build will re-resolve transitive dependencies and # unify them, perturbing the contents of the lockfile. +[dependencies.soroban-env-host-p28] +version = "=27.0.0" +git = "https://github.com/stellar/rs-soroban-env" +package = "soroban-env-host" +rev = "883fd56374fc619afaa4c4c7489563555b7173f2" +optional = true +features = ["next"] + [dependencies.soroban-env-host-p27] -version = "=26.1.2" +version = "=27.0.0" git = "https://github.com/stellar/rs-soroban-env" package = "soroban-env-host" -rev = "c0e58f94ff2983a09440cef6a54253349fd3c4db" +rev = "b03d2563f3a08d51095a19bdbb6d90364b8ce04a" optional = true [dependencies.soroban-env-host-p26] @@ -167,14 +175,14 @@ optional = true # supported host, since test material usually just grows over time. [dependencies.soroban-test-wasms] -version = "=26.0.0" +version = "=27.0.0" git = "https://github.com/stellar/rs-soroban-env" -rev = "b351f88a468d3b9e1d6de53d5b0ca585f6b7dadb" +rev = "b03d2563f3a08d51095a19bdbb6d90364b8ce04a" [dependencies.soroban-synth-wasm] -version = "=26.0.0" +version = "=27.0.0" git = "https://github.com/stellar/rs-soroban-env" -rev = "b351f88a468d3b9e1d6de53d5b0ca585f6b7dadb" +rev = "b03d2563f3a08d51095a19bdbb6d90364b8ce04a" # The soroban-fuzz-targets crate will actually pull in _its own copy_ of the # soroban host (or at least unify with one of the versions above if you're doing @@ -182,9 +190,9 @@ rev = "b351f88a468d3b9e1d6de53d5b0ca585f6b7dadb" # soroban is updated -- it should track the highest protocol available (or # at least whichever one you want to fuzz). [dependencies.soroban-fuzz-targets] -version = "=26.0.0" +version = "=27.0.0" git = "https://github.com/stellar/rs-soroban-env" -rev = "b351f88a468d3b9e1d6de53d5b0ca585f6b7dadb" +rev = "b03d2563f3a08d51095a19bdbb6d90364b8ce04a" optional = true [dependencies.stellar-quorum-analyzer] @@ -194,15 +202,11 @@ rev = "f67e9e2f080c2cc1a332d894c42277c64845e257" [features] -# Turn on the optional unified build. This is typically only useful in an IDE or when +# Turn on the optional fastdev build. This is typically only useful in an IDE or when # orchestrated by the build system. See note above and in docs/CONTRIBUTING.md. -unified = ["dep:soroban-env-host-p21", - "dep:soroban-env-host-p22", - "dep:soroban-env-host-p23", - "dep:soroban-env-host-p24", - "dep:soroban-env-host-p25", - "dep:soroban-env-host-p26", - "dep:soroban-env-host-p27"] +fastdev = ["dep:soroban-env-host-p27", + "dep:soroban-env-host-p28", + "next"] tracy = ["dep:tracy-client"] diff --git a/src/rust/soroban/p28 b/src/rust/soroban/p28 new file mode 160000 index 000000000..883fd5637 --- /dev/null +++ b/src/rust/soroban/p28 @@ -0,0 +1 @@ +Subproject commit 883fd56374fc619afaa4c4c7489563555b7173f2 diff --git a/src/rust/src/dep-trees/p28-expect.txt b/src/rust/src/dep-trees/p28-expect.txt new file mode 100644 index 000000000..2ccc9a9ba --- /dev/null +++ b/src/rust/src/dep-trees/p28-expect.txt @@ -0,0 +1,311 @@ +soroban-env-host v27.0.0 (src/rust/soroban/p28/soroban-env-host) +├── ark-bls12-381 v0.5.0 +│ ├── ark-ec v0.5.0 +│ │ ├── ahash v0.8.11 +│ │ │ ├── cfg-if v1.0.0 +│ │ │ ├── once_cell v1.19.0 +│ │ │ └── zerocopy v0.7.35 +│ │ │ └── zerocopy-derive v0.7.35 (proc-macro) +│ │ │ ├── proc-macro2 v1.0.69 +│ │ │ │ └── unicode-ident v1.0.9 +│ │ │ ├── quote v1.0.33 +│ │ │ │ └── proc-macro2 v1.0.69 (*) +│ │ │ └── syn v2.0.39 +│ │ │ ├── proc-macro2 v1.0.69 (*) +│ │ │ ├── quote v1.0.33 (*) +│ │ │ └── unicode-ident v1.0.9 +│ │ │ [build-dependencies] +│ │ │ └── version_check v0.9.4 +│ │ ├── ark-ff v0.5.0 +│ │ │ ├── ark-ff-asm v0.5.0 (proc-macro) +│ │ │ │ ├── quote v1.0.33 (*) +│ │ │ │ └── syn v2.0.39 (*) +│ │ │ ├── ark-ff-macros v0.5.0 (proc-macro) +│ │ │ │ ├── num-bigint v0.4.4 +│ │ │ │ │ ├── num-integer v0.1.45 +│ │ │ │ │ │ └── num-traits v0.2.17 +│ │ │ │ │ │ [build-dependencies] +│ │ │ │ │ │ └── autocfg v1.1.0 +│ │ │ │ │ │ [build-dependencies] +│ │ │ │ │ │ └── autocfg v1.1.0 +│ │ │ │ │ └── num-traits v0.2.17 (*) +│ │ │ │ │ [build-dependencies] +│ │ │ │ │ └── autocfg v1.1.0 +│ │ │ │ ├── num-traits v0.2.17 (*) +│ │ │ │ ├── proc-macro2 v1.0.69 (*) +│ │ │ │ ├── quote v1.0.33 (*) +│ │ │ │ └── syn v2.0.39 (*) +│ │ │ ├── ark-serialize v0.5.0 +│ │ │ │ ├── ark-serialize-derive v0.5.0 (proc-macro) +│ │ │ │ │ ├── proc-macro2 v1.0.69 (*) +│ │ │ │ │ ├── quote v1.0.33 (*) +│ │ │ │ │ └── syn v2.0.39 (*) +│ │ │ │ ├── ark-std v0.5.0 +│ │ │ │ │ ├── num-traits v0.2.17 +│ │ │ │ │ │ [build-dependencies] +│ │ │ │ │ │ └── autocfg v1.1.0 +│ │ │ │ │ └── rand v0.8.5 +│ │ │ │ │ ├── libc v0.2.176 +│ │ │ │ │ ├── rand_chacha v0.3.1 +│ │ │ │ │ │ ├── ppv-lite86 v0.2.17 +│ │ │ │ │ │ └── rand_core v0.6.4 +│ │ │ │ │ │ └── getrandom v0.2.11 +│ │ │ │ │ │ ├── cfg-if v1.0.0 +│ │ │ │ │ │ ├── js-sys v0.3.64 +│ │ │ │ │ │ │ └── wasm-bindgen v0.2.100 +│ │ │ │ │ │ │ ├── cfg-if v1.0.0 +│ │ │ │ │ │ │ ├── once_cell v1.19.0 +│ │ │ │ │ │ │ ├── rustversion v1.0.14 (proc-macro) +│ │ │ │ │ │ │ └── wasm-bindgen-macro v0.2.100 (proc-macro) +│ │ │ │ │ │ │ ├── quote v1.0.33 (*) +│ │ │ │ │ │ │ └── wasm-bindgen-macro-support v0.2.100 +│ │ │ │ │ │ │ ├── proc-macro2 v1.0.69 (*) +│ │ │ │ │ │ │ ├── quote v1.0.33 (*) +│ │ │ │ │ │ │ ├── syn v2.0.39 (*) +│ │ │ │ │ │ │ ├── wasm-bindgen-backend v0.2.100 +│ │ │ │ │ │ │ │ ├── bumpalo v3.13.0 +│ │ │ │ │ │ │ │ ├── log v0.4.19 +│ │ │ │ │ │ │ │ ├── proc-macro2 v1.0.69 (*) +│ │ │ │ │ │ │ │ ├── quote v1.0.33 (*) +│ │ │ │ │ │ │ │ ├── syn v2.0.39 (*) +│ │ │ │ │ │ │ │ └── wasm-bindgen-shared v0.2.100 +│ │ │ │ │ │ │ │ └── unicode-ident v1.0.9 +│ │ │ │ │ │ │ └── wasm-bindgen-shared v0.2.100 (*) +│ │ │ │ │ │ ├── libc v0.2.176 +│ │ │ │ │ │ ├── wasi v0.11.0+wasi-snapshot-preview1 +│ │ │ │ │ │ └── wasm-bindgen v0.2.100 (*) +│ │ │ │ │ └── rand_core v0.6.4 (*) +│ │ │ │ ├── arrayvec v0.7.6 +│ │ │ │ ├── digest v0.10.7 +│ │ │ │ │ ├── block-buffer v0.10.4 +│ │ │ │ │ │ └── generic-array v0.14.7 +│ │ │ │ │ │ ├── typenum v1.16.0 +│ │ │ │ │ │ └── zeroize v1.8.1 +│ │ │ │ │ │ └── zeroize_derive v1.4.2 (proc-macro) +│ │ │ │ │ │ ├── proc-macro2 v1.0.69 (*) +│ │ │ │ │ │ ├── quote v1.0.33 (*) +│ │ │ │ │ │ └── syn v2.0.39 (*) +│ │ │ │ │ │ [build-dependencies] +│ │ │ │ │ │ └── version_check v0.9.4 +│ │ │ │ │ ├── const-oid v0.9.2 +│ │ │ │ │ ├── crypto-common v0.1.6 +│ │ │ │ │ │ ├── generic-array v0.14.7 (*) +│ │ │ │ │ │ └── typenum v1.16.0 +│ │ │ │ │ └── subtle v2.5.0 +│ │ │ │ └── num-bigint v0.4.4 (*) +│ │ │ ├── ark-std v0.5.0 (*) +│ │ │ ├── arrayvec v0.7.6 +│ │ │ ├── digest v0.10.7 (*) +│ │ │ ├── educe v0.6.0 (proc-macro) +│ │ │ │ ├── enum-ordinalize v4.3.2 +│ │ │ │ │ └── enum-ordinalize-derive v4.3.2 (proc-macro) +│ │ │ │ │ ├── proc-macro2 v1.0.69 (*) +│ │ │ │ │ ├── quote v1.0.33 (*) +│ │ │ │ │ └── syn v2.0.39 (*) +│ │ │ │ ├── proc-macro2 v1.0.69 (*) +│ │ │ │ ├── quote v1.0.33 (*) +│ │ │ │ └── syn v2.0.39 (*) +│ │ │ ├── itertools v0.13.0 +│ │ │ │ └── either v1.8.1 +│ │ │ ├── num-bigint v0.4.4 (*) +│ │ │ ├── num-traits v0.2.17 (*) +│ │ │ ├── paste v1.0.12 (proc-macro) +│ │ │ └── zeroize v1.8.1 (*) +│ │ ├── ark-poly v0.5.0 +│ │ │ ├── ahash v0.8.11 (*) +│ │ │ ├── ark-ff v0.5.0 (*) +│ │ │ ├── ark-serialize v0.5.0 (*) +│ │ │ ├── ark-std v0.5.0 (*) +│ │ │ ├── educe v0.6.0 (proc-macro) (*) +│ │ │ ├── fnv v1.0.7 +│ │ │ └── hashbrown v0.15.5 +│ │ │ └── allocator-api2 v0.2.21 +│ │ ├── ark-serialize v0.5.0 (*) +│ │ ├── ark-std v0.5.0 (*) +│ │ ├── educe v0.6.0 (proc-macro) (*) +│ │ ├── fnv v1.0.7 +│ │ ├── hashbrown v0.15.5 (*) +│ │ ├── itertools v0.13.0 (*) +│ │ ├── num-bigint v0.4.4 (*) +│ │ ├── num-integer v0.1.45 +│ │ │ └── num-traits v0.2.17 (*) +│ │ │ [build-dependencies] +│ │ │ └── autocfg v1.1.0 +│ │ ├── num-traits v0.2.17 (*) +│ │ └── zeroize v1.8.1 (*) +│ ├── ark-ff v0.5.0 (*) +│ ├── ark-serialize v0.5.0 (*) +│ └── ark-std v0.5.0 (*) +├── ark-bn254 v0.5.0 +│ ├── ark-ec v0.5.0 (*) +│ ├── ark-ff v0.5.0 (*) +│ └── ark-std v0.5.0 (*) +├── ark-ec v0.5.0 (*) +├── ark-ff v0.5.0 (*) +├── ark-serialize v0.5.0 (*) +├── curve25519-dalek v4.1.3 +│ ├── cfg-if v1.0.0 +│ ├── cpufeatures v0.2.8 +│ │ └── libc v0.2.176 +│ ├── curve25519-dalek-derive v0.1.0 (proc-macro) +│ │ ├── proc-macro2 v1.0.69 (*) +│ │ ├── quote v1.0.33 (*) +│ │ └── syn v2.0.39 (*) +│ ├── digest v0.10.7 (*) +│ ├── fiat-crypto v0.2.5 +│ ├── subtle v2.5.0 +│ └── zeroize v1.8.1 (*) +│ [build-dependencies] +│ └── rustc_version v0.4.0 +│ └── semver v1.0.17 +├── ecdsa v0.16.9 +│ ├── der v0.7.6 +│ │ ├── const-oid v0.9.2 +│ │ └── zeroize v1.8.1 (*) +│ ├── digest v0.10.7 (*) +│ ├── elliptic-curve v0.13.8 +│ │ ├── base16ct v0.2.0 +│ │ ├── crypto-bigint v0.5.2 +│ │ │ ├── generic-array v0.14.7 (*) +│ │ │ ├── rand_core v0.6.4 (*) +│ │ │ ├── subtle v2.5.0 +│ │ │ └── zeroize v1.8.1 (*) +│ │ ├── digest v0.10.7 (*) +│ │ ├── ff v0.13.0 +│ │ │ ├── rand_core v0.6.4 (*) +│ │ │ └── subtle v2.5.0 +│ │ ├── generic-array v0.14.7 (*) +│ │ ├── group v0.13.0 +│ │ │ ├── ff v0.13.0 (*) +│ │ │ ├── rand_core v0.6.4 (*) +│ │ │ └── subtle v2.5.0 +│ │ ├── rand_core v0.6.4 (*) +│ │ ├── sec1 v0.7.2 +│ │ │ ├── base16ct v0.2.0 +│ │ │ ├── der v0.7.6 (*) +│ │ │ ├── generic-array v0.14.7 (*) +│ │ │ ├── subtle v2.5.0 +│ │ │ └── zeroize v1.8.1 (*) +│ │ ├── subtle v2.5.0 +│ │ └── zeroize v1.8.1 (*) +│ ├── rfc6979 v0.4.0 +│ │ ├── hmac v0.12.1 +│ │ │ └── digest v0.10.7 (*) +│ │ └── subtle v2.5.0 +│ └── signature v2.1.0 +│ ├── digest v0.10.7 (*) +│ └── rand_core v0.6.4 (*) +├── ed25519-dalek v2.1.1 +│ ├── curve25519-dalek v4.1.3 (*) +│ ├── ed25519 v2.2.2 +│ │ └── signature v2.1.0 (*) +│ ├── rand_core v0.6.4 (*) +│ ├── sha2 v0.10.9 +│ │ ├── cfg-if v1.0.0 +│ │ ├── cpufeatures v0.2.8 (*) +│ │ └── digest v0.10.7 (*) +│ ├── subtle v2.5.0 +│ └── zeroize v1.8.1 (*) +├── elliptic-curve v0.13.8 (*) +├── generic-array v0.14.7 (*) +├── getrandom v0.2.11 (*) +├── hex-literal v0.4.1 +├── hmac v0.12.1 (*) +├── k256 v0.13.4 +│ ├── cfg-if v1.0.0 +│ ├── ecdsa v0.16.9 (*) +│ ├── elliptic-curve v0.13.8 (*) +│ └── sha2 v0.10.9 (*) +├── num-derive v0.4.1 (proc-macro) +│ ├── proc-macro2 v1.0.69 (*) +│ ├── quote v1.0.33 (*) +│ └── syn v2.0.39 (*) +├── num-integer v0.1.45 (*) +├── num-traits v0.2.17 (*) +├── p256 v0.13.2 +│ ├── ecdsa v0.16.9 (*) +│ ├── elliptic-curve v0.13.8 (*) +│ ├── primeorder v0.13.3 +│ │ └── elliptic-curve v0.13.8 (*) +│ └── sha2 v0.10.9 (*) +├── rand v0.8.5 (*) +├── rand_chacha v0.3.1 (*) +├── sec1 v0.7.2 (*) +├── sha2 v0.10.9 (*) +├── sha3 v0.10.8 +│ ├── digest v0.10.7 (*) +│ └── keccak v0.1.4 +│ └── cpufeatures v0.2.8 (*) +├── soroban-builtin-sdk-macros v27.0.0 (proc-macro) (src/rust/soroban/p28/soroban-builtin-sdk-macros) +│ ├── itertools v0.13.0 +│ │ └── either v1.8.1 +│ ├── proc-macro2 v1.0.69 (*) +│ ├── quote v1.0.33 (*) +│ └── syn v2.0.39 (*) +├── soroban-env-common v27.0.0 (src/rust/soroban/p28/soroban-env-common) +│ ├── ethnum v1.5.3 +│ ├── num-derive v0.4.1 (proc-macro) (*) +│ ├── num-traits v0.2.17 (*) +│ ├── soroban-env-macros v27.0.0 (proc-macro) (src/rust/soroban/p28/soroban-env-macros) +│ │ ├── itertools v0.13.0 (*) +│ │ ├── proc-macro2 v1.0.69 (*) +│ │ ├── quote v1.0.33 (*) +│ │ ├── serde v1.0.192 +│ │ │ └── serde_derive v1.0.192 (proc-macro) +│ │ │ ├── proc-macro2 v1.0.69 (*) +│ │ │ ├── quote v1.0.33 (*) +│ │ │ └── syn v2.0.39 (*) +│ │ ├── serde_json v1.0.108 +│ │ │ ├── itoa v1.0.6 +│ │ │ ├── ryu v1.0.13 +│ │ │ └── serde v1.0.192 (*) +│ │ ├── stellar-xdr v27.0.0 +│ │ │ ├── escape-bytes v0.1.1 +│ │ │ ├── ethnum v1.5.3 +│ │ │ ├── hex v0.4.3 +│ │ │ ├── sha2 v0.10.9 (*) +│ │ │ └── stellar-strkey v0.0.13 +│ │ │ └── data-encoding v2.6.0 +│ │ │ [build-dependencies] +│ │ │ └── crate-git-revision v0.0.6 +│ │ │ ├── serde v1.0.192 (*) +│ │ │ ├── serde_derive v1.0.192 (proc-macro) (*) +│ │ │ └── serde_json v1.0.108 (*) +│ │ │ [build-dependencies] +│ │ │ └── crate-git-revision v0.0.6 (*) +│ │ └── syn v2.0.39 (*) +│ ├── soroban-wasmi v0.31.1-soroban.20.0.1 (https://github.com/stellar/wasmi?rev=0ed3f3dee30dc41ebe21972399e0a73a41944aa0#0ed3f3de) +│ │ ├── smallvec v1.13.2 +│ │ ├── spin v0.9.8 +│ │ ├── wasmi_arena v0.4.0 (https://github.com/stellar/wasmi?rev=0ed3f3dee30dc41ebe21972399e0a73a41944aa0#0ed3f3de) +│ │ ├── wasmi_core v0.13.0 (https://github.com/stellar/wasmi?rev=0ed3f3dee30dc41ebe21972399e0a73a41944aa0#0ed3f3de) +│ │ │ ├── downcast-rs v1.2.0 +│ │ │ ├── libm v0.2.8 +│ │ │ ├── num-traits v0.2.17 (*) +│ │ │ └── paste v1.0.12 (proc-macro) +│ │ └── wasmparser-nostd v0.100.2 +│ │ └── indexmap-nostd v0.4.0 +│ ├── static_assertions v1.1.0 +│ ├── stellar-xdr v27.0.0 +│ │ ├── base64 v0.22.1 +│ │ ├── escape-bytes v0.1.1 +│ │ ├── ethnum v1.5.3 +│ │ ├── hex v0.4.3 +│ │ ├── sha2 v0.10.9 (*) +│ │ └── stellar-strkey v0.0.13 (*) +│ │ [build-dependencies] +│ │ └── crate-git-revision v0.0.6 (*) +│ └── wasmparser v0.116.1 +│ ├── indexmap v2.0.2 +│ │ ├── equivalent v1.0.1 +│ │ └── hashbrown v0.14.1 +│ └── semver v1.0.17 +│ [build-dependencies] +│ └── crate-git-revision v0.0.9 +│ ├── serde v1.0.192 (*) +│ ├── serde_derive v1.0.192 (proc-macro) (*) +│ └── serde_json v1.0.108 (*) +├── soroban-wasmi v0.31.1-soroban.20.0.1 (https://github.com/stellar/wasmi?rev=0ed3f3dee30dc41ebe21972399e0a73a41944aa0#0ed3f3de) (*) +├── static_assertions v1.1.0 +├── stellar-strkey v0.0.13 (*) +└── wasmparser v0.116.1 (*) diff --git a/src/rust/src/soroban_module_cache.rs b/src/rust/src/soroban_module_cache.rs index 9270b46c7..e8e0b221e 100644 --- a/src/rust/src/soroban_module_cache.rs +++ b/src/rust/src/soroban_module_cache.rs @@ -16,25 +16,43 @@ use crate::{ rust_bridge::CxxBuf, - soroban_proto_all::{get_host_module_for_protocol, p23, p24, p25, p26, p27, protocol_agnostic}, + soroban_proto_all::{get_host_module_for_protocol, p27, protocol_agnostic}, }; +#[cfg(not(feature = "fastdev"))] +use crate::soroban_proto_all::{p23, p24, p25, p26}; + +#[cfg(feature = "next")] +use crate::soroban_proto_all::p28; + pub(crate) struct SorobanModuleCache { + #[cfg(not(feature = "fastdev"))] pub(crate) p23_cache: p23::soroban_proto_any::ProtocolSpecificModuleCache, + #[cfg(not(feature = "fastdev"))] pub(crate) p24_cache: p24::soroban_proto_any::ProtocolSpecificModuleCache, + #[cfg(not(feature = "fastdev"))] pub(crate) p25_cache: p25::soroban_proto_any::ProtocolSpecificModuleCache, + #[cfg(not(feature = "fastdev"))] pub(crate) p26_cache: p26::soroban_proto_any::ProtocolSpecificModuleCache, pub(crate) p27_cache: p27::soroban_proto_any::ProtocolSpecificModuleCache, + #[cfg(feature = "next")] + pub(crate) p28_cache: p28::soroban_proto_any::ProtocolSpecificModuleCache, } impl SorobanModuleCache { fn new() -> Result> { Ok(Self { + #[cfg(not(feature = "fastdev"))] p23_cache: p23::soroban_proto_any::ProtocolSpecificModuleCache::new()?, + #[cfg(not(feature = "fastdev"))] p24_cache: p24::soroban_proto_any::ProtocolSpecificModuleCache::new()?, + #[cfg(not(feature = "fastdev"))] p25_cache: p25::soroban_proto_any::ProtocolSpecificModuleCache::new()?, + #[cfg(not(feature = "fastdev"))] p26_cache: p26::soroban_proto_any::ProtocolSpecificModuleCache::new()?, p27_cache: p27::soroban_proto_any::ProtocolSpecificModuleCache::new()?, + #[cfg(feature = "next")] + p28_cache: p28::soroban_proto_any::ProtocolSpecificModuleCache::new()?, }) } pub fn compile( @@ -42,25 +60,36 @@ impl SorobanModuleCache { ledger_protocol: u32, _wasm: &[u8], ) -> Result<(), Box> { - match ledger_protocol { + let hm = get_host_module_for_protocol(ledger_protocol, ledger_protocol)?; + match hm.max_proto { + #[cfg(not(feature = "fastdev"))] 23 => self.p23_cache.compile(_wasm), + #[cfg(not(feature = "fastdev"))] 24 => self.p24_cache.compile(_wasm), + #[cfg(not(feature = "fastdev"))] 25 => self.p25_cache.compile(_wasm), + #[cfg(not(feature = "fastdev"))] 26 => self.p26_cache.compile(_wasm), 27 => self.p27_cache.compile(_wasm), #[cfg(feature = "next")] - 28 => self.p27_cache.compile(_wasm), + 28 => self.p28_cache.compile(_wasm), // Add other protocols here as needed. _ => Err(protocol_agnostic::make_error("unsupported protocol")), } } pub fn shallow_clone(&self) -> Result, Box> { Ok(Box::new(Self { + #[cfg(not(feature = "fastdev"))] p23_cache: self.p23_cache.shallow_clone()?, + #[cfg(not(feature = "fastdev"))] p24_cache: self.p24_cache.shallow_clone()?, + #[cfg(not(feature = "fastdev"))] p25_cache: self.p25_cache.shallow_clone()?, + #[cfg(not(feature = "fastdev"))] p26_cache: self.p26_cache.shallow_clone()?, p27_cache: self.p27_cache.shallow_clone()?, + #[cfg(feature = "next")] + p28_cache: self.p28_cache.shallow_clone()?, })) } @@ -69,19 +98,31 @@ impl SorobanModuleCache { .as_ref() .try_into() .map_err(|_| "Invalid contract-code key length")?; + #[cfg(not(feature = "fastdev"))] self.p23_cache.evict(&_hash)?; + #[cfg(not(feature = "fastdev"))] self.p24_cache.evict(&_hash)?; + #[cfg(not(feature = "fastdev"))] self.p25_cache.evict(&_hash)?; + #[cfg(not(feature = "fastdev"))] self.p26_cache.evict(&_hash)?; self.p27_cache.evict(&_hash)?; + #[cfg(feature = "next")] + self.p28_cache.evict(&_hash)?; Ok(()) } pub fn clear(&self) -> Result<(), Box> { + #[cfg(not(feature = "fastdev"))] self.p23_cache.clear()?; + #[cfg(not(feature = "fastdev"))] self.p24_cache.clear()?; + #[cfg(not(feature = "fastdev"))] self.p25_cache.clear()?; + #[cfg(not(feature = "fastdev"))] self.p26_cache.clear()?; self.p27_cache.clear()?; + #[cfg(feature = "next")] + self.p28_cache.clear()?; Ok(()) } @@ -94,14 +135,19 @@ impl SorobanModuleCache { .as_ref() .try_into() .map_err(|_| "Invalid contract-code key length")?; - match protocol { + let hm = get_host_module_for_protocol(protocol, protocol)?; + match hm.max_proto { + #[cfg(not(feature = "fastdev"))] 23 => self.p23_cache.contains_module(&_hash), + #[cfg(not(feature = "fastdev"))] 24 => self.p24_cache.contains_module(&_hash), + #[cfg(not(feature = "fastdev"))] 25 => self.p25_cache.contains_module(&_hash), + #[cfg(not(feature = "fastdev"))] 26 => self.p26_cache.contains_module(&_hash), 27 => self.p27_cache.contains_module(&_hash), #[cfg(feature = "next")] - 28 => self.p27_cache.contains_module(&_hash), + 28 => self.p28_cache.contains_module(&_hash), _ => Err(protocol_agnostic::make_error("unsupported protocol")), } } @@ -109,16 +155,20 @@ impl SorobanModuleCache { &self, ledger_protocol: u32, ) -> Result> { - #[allow(unused_mut)] + let hm = get_host_module_for_protocol(ledger_protocol, ledger_protocol)?; let mut bytes = 0; - match ledger_protocol { + match hm.max_proto { + #[cfg(not(feature = "fastdev"))] 23 => bytes = bytes.max(self.p23_cache.get_wasm_bytes_input()?), + #[cfg(not(feature = "fastdev"))] 24 => bytes = bytes.max(self.p24_cache.get_wasm_bytes_input()?), + #[cfg(not(feature = "fastdev"))] 25 => bytes = bytes.max(self.p25_cache.get_wasm_bytes_input()?), + #[cfg(not(feature = "fastdev"))] 26 => bytes = bytes.max(self.p26_cache.get_wasm_bytes_input()?), 27 => bytes = bytes.max(self.p27_cache.get_wasm_bytes_input()?), #[cfg(feature = "next")] - 28 => bytes = bytes.max(self.p27_cache.get_wasm_bytes_input()?), + 28 => bytes = bytes.max(self.p28_cache.get_wasm_bytes_input()?), _ => return Err(protocol_agnostic::make_error("unsupported protocol")), } Ok(bytes) diff --git a/src/rust/src/soroban_proto_all.rs b/src/rust/src/soroban_proto_all.rs index ccdc46786..3cf22a6dd 100644 --- a/src/rust/src/soroban_proto_all.rs +++ b/src/rust/src/soroban_proto_all.rs @@ -32,10 +32,10 @@ use crate::RustBuf; // We also alias the latest soroban as soroban_curr to help reduce churn in code // that's just "always supposed to use the latest". -//#[cfg(not(feature = "next"))] +#[cfg(not(feature = "next"))] pub(crate) use p27 as soroban_curr; -//#[cfg(feature = "next")] -//pub(crate) use p28 as soroban_curr; +#[cfg(feature = "next")] +pub(crate) use p28 as soroban_curr; // We also pin some protocol _agnostic_ definitions that are technically // implemented by a specific version of soroban, but which is protocol-stable @@ -43,13 +43,182 @@ pub(crate) use p27 as soroban_curr; // only compatible with with, say, a rust Dyn interface like Box). pub(crate) mod protocol_agnostic { pub(crate) fn make_error(msg: &'static str) -> Box { - super::p24::soroban_proto_any::CoreHostError::General(msg.into()).into() + super::soroban_curr::soroban_proto_any::CoreHostError::General(msg.into()).into() } // The i128 functions are protocol-agnostic because they're too simple to // ever plausibly change. If they ever _do_ change we can switch this (and // the callers) to pass a protocol number but it seems unlikely. - pub(crate) use super::p24::soroban_env_host::xdr::int128_helpers; + pub(crate) use super::soroban_curr::soroban_env_host::xdr::int128_helpers; +} + +#[cfg(feature = "next")] +#[path = "."] +pub(crate) mod p28 { + pub(crate) extern crate soroban_env_host_p28; + use crate::{ + bridge::rust_bridge::CxxLedgerEntryRentChange, + rust_bridge::{ + CxxFeeConfiguration, CxxRentFeeConfiguration, CxxRentWriteFeeConfiguration, + CxxTransactionResources, + }, + SorobanModuleCache, + }; + use soroban_env_host::{ + budget::Budget, + e2e_invoke::{self, InvokeHostFunctionResult}, + fees::{ + compute_rent_write_fee_per_1kb, FeeConfiguration, LedgerEntryRentChange, + RentFeeConfiguration, RentWriteFeeConfiguration, TransactionResources, + }, + vm::wasm_module_memory_cost, + xdr::{ContractCodeEntry, DiagnosticEvent}, + HostError, LedgerInfo, TraceHook, + }; + pub(crate) use soroban_env_host_p28 as soroban_env_host; + + pub(crate) mod soroban_proto_any; + + pub(crate) use soroban_env_host::{CompilationContext, ErrorHandler, ModuleCache}; + + pub(crate) const fn get_version_pre_release(v: &soroban_env_host::Version) -> u32 { + v.interface.pre_release + } + + pub(crate) const fn get_version_protocol(v: &soroban_env_host::Version) -> u32 { + v.interface.protocol + } + + pub(crate) fn get_xdr_base_git_rev() -> String { + soroban_env_host::xdr::VERSION.xdr.to_string() + } + pub(crate) fn get_xdr_pkg_ver() -> String { + soroban_env_host::xdr::VERSION.pkg.to_string() + } + pub(crate) fn get_xdr_git_rev() -> String { + soroban_env_host::xdr::VERSION.rev.to_string() + } + pub(crate) fn get_xdr_features() -> Vec { + soroban_env_host::xdr::VERSION + .features + .iter() + .map(|s| s.to_string()) + .collect() + } + + pub fn invoke_host_function_with_trace_hook_and_module_cache< + T: AsRef<[u8]>, + I: ExactSizeIterator, + >( + budget: &Budget, + enable_diagnostics: bool, + encoded_host_fn: T, + encoded_resources: T, + restored_rw_entry_indices: &[u32], + encoded_source_account: T, + encoded_auth_entries: I, + ledger_info: LedgerInfo, + encoded_ledger_entries: I, + encoded_ttl_entries: I, + base_prng_seed: T, + diagnostic_events: &mut Vec, + trace_hook: Option, + module_cache: &SorobanModuleCache, + ) -> Result { + e2e_invoke::invoke_host_function( + budget, + enable_diagnostics, + encoded_host_fn, + encoded_resources, + restored_rw_entry_indices, + encoded_source_account, + encoded_auth_entries, + ledger_info, + encoded_ledger_entries, + encoded_ttl_entries, + base_prng_seed, + diagnostic_events, + trace_hook, + Some(module_cache.p28_cache.module_cache.clone()), + ) + } + + pub(crate) fn wasm_module_memory_cost_wrapper( + budget: &Budget, + contract_code_entry: &ContractCodeEntry, + ) -> Result { + wasm_module_memory_cost(budget, contract_code_entry) + } + + pub(crate) fn compute_rent_write_fee_per_1kb_wrapper( + bucket_list_size: i64, + fee_config: CxxRentWriteFeeConfiguration, + ) -> i64 { + compute_rent_write_fee_per_1kb(bucket_list_size, &fee_config.into()) + } + + pub(crate) fn convert_transaction_resources( + value: &CxxTransactionResources, + ) -> TransactionResources { + TransactionResources { + instructions: value.instructions, + disk_read_entries: value.disk_read_entries, + write_entries: value.write_entries, + disk_read_bytes: value.disk_read_bytes, + write_bytes: value.write_bytes, + contract_events_size_bytes: value.contract_events_size_bytes, + transaction_size_bytes: value.transaction_size_bytes, + } + } + + impl From for RentWriteFeeConfiguration { + fn from(value: CxxRentWriteFeeConfiguration) -> Self { + Self { + state_target_size_bytes: value.state_target_size_bytes, + rent_fee_1kb_state_size_low: value.rent_fee_1kb_state_size_low, + rent_fee_1kb_state_size_high: value.rent_fee_1kb_state_size_high, + state_size_rent_fee_growth_factor: value.state_size_rent_fee_growth_factor, + } + } + } + + pub(crate) fn convert_rent_fee_configuration( + value: &CxxRentFeeConfiguration, + ) -> RentFeeConfiguration { + RentFeeConfiguration { + fee_per_rent_1kb: value.fee_per_rent_1kb, + fee_per_write_1kb: value.fee_per_write_1kb, + fee_per_write_entry: value.fee_per_write_entry, + persistent_rent_rate_denominator: value.persistent_rent_rate_denominator, + temporary_rent_rate_denominator: value.temporary_rent_rate_denominator, + } + } + + pub(crate) fn convert_fee_configuration(value: CxxFeeConfiguration) -> FeeConfiguration { + FeeConfiguration { + fee_per_instruction_increment: value.fee_per_instruction_increment, + fee_per_disk_read_entry: value.fee_per_disk_read_entry, + fee_per_write_entry: value.fee_per_write_entry, + fee_per_disk_read_1kb: value.fee_per_disk_read_1kb, + fee_per_write_1kb: value.fee_per_write_1kb, + fee_per_historical_1kb: value.fee_per_historical_1kb, + fee_per_contract_event_1kb: value.fee_per_contract_event_1kb, + fee_per_transaction_size_1kb: value.fee_per_transaction_size_1kb, + } + } + + pub(crate) fn convert_ledger_entry_rent_change( + value: &CxxLedgerEntryRentChange, + ) -> LedgerEntryRentChange { + LedgerEntryRentChange { + is_persistent: value.is_persistent, + is_code_entry: value.is_code_entry, + old_size_bytes: value.old_size_bytes, + new_size_bytes: value.new_size_bytes, + old_live_until_ledger: value.old_live_until_ledger, + new_live_until_ledger: value.new_live_until_ledger, + } + } } #[path = "."] @@ -220,6 +389,7 @@ pub(crate) mod p27 { } } +#[cfg(not(feature = "fastdev"))] #[path = "."] pub(crate) mod p26 { pub(crate) extern crate soroban_env_host_p26; @@ -392,6 +562,7 @@ pub(crate) mod p26 { } } +#[cfg(not(feature = "fastdev"))] #[path = "."] pub(crate) mod p25 { pub(crate) extern crate soroban_env_host_p25; @@ -565,6 +736,7 @@ pub(crate) mod p25 { } } +#[cfg(not(feature = "fastdev"))] #[path = "."] pub(crate) mod p24 { pub(crate) extern crate soroban_env_host_p24; @@ -738,6 +910,7 @@ pub(crate) mod p24 { } } +#[cfg(not(feature = "fastdev"))] #[path = "."] pub(crate) mod p23 { pub(crate) extern crate soroban_env_host_p23; @@ -911,6 +1084,7 @@ pub(crate) mod p23 { } } +#[cfg(not(feature = "fastdev"))] #[path = "."] pub(crate) mod p22 { pub(crate) extern crate soroban_env_host_p22; @@ -1118,6 +1292,7 @@ pub(crate) mod p22 { } } +#[cfg(not(feature = "fastdev"))] #[path = "."] pub(crate) mod p21 { pub(crate) extern crate soroban_env_host_p21; @@ -1345,7 +1520,10 @@ pub fn check_sensible_soroban_config_for_protocol(core_max_proto: u32) { "host modules are not in ascending order" ); } - assert!(HOST_MODULES.last().unwrap().max_proto >= core_max_proto); + let max_host_module_proto = HOST_MODULES.last().unwrap().max_proto; + dbg!(max_host_module_proto); + dbg!(core_max_proto); + assert!(max_host_module_proto >= core_max_proto); } // The remainder of the file is implementations of functions @@ -1462,13 +1640,21 @@ macro_rules! proto_versioned_functions_for_module { // NB: this list should be in ascending order. Out of order will cause // an assert to fail in the by-protocol-number lookup function below. const HOST_MODULES: &'static [HostModule] = &[ + #[cfg(not(feature = "fastdev"))] proto_versioned_functions_for_module!(p21), + #[cfg(not(feature = "fastdev"))] proto_versioned_functions_for_module!(p22), + #[cfg(not(feature = "fastdev"))] proto_versioned_functions_for_module!(p23), + #[cfg(not(feature = "fastdev"))] proto_versioned_functions_for_module!(p24), + #[cfg(not(feature = "fastdev"))] proto_versioned_functions_for_module!(p25), + #[cfg(not(feature = "fastdev"))] proto_versioned_functions_for_module!(p26), proto_versioned_functions_for_module!(p27), + #[cfg(feature = "next")] + proto_versioned_functions_for_module!(p28), ]; pub(crate) fn get_host_module_for_protocol( @@ -1495,13 +1681,27 @@ pub(crate) fn get_host_module_for_protocol( #[test] fn protocol_dispatches_as_expected() { - assert_eq!(get_host_module_for_protocol(20, 20).unwrap().max_proto, 21); - assert_eq!(get_host_module_for_protocol(21, 21).unwrap().max_proto, 21); - assert_eq!(get_host_module_for_protocol(22, 22).unwrap().max_proto, 22); - assert_eq!(get_host_module_for_protocol(23, 23).unwrap().max_proto, 23); - assert_eq!(get_host_module_for_protocol(24, 24).unwrap().max_proto, 24); - assert_eq!(get_host_module_for_protocol(25, 25).unwrap().max_proto, 25); - assert_eq!(get_host_module_for_protocol(26, 26).unwrap().max_proto, 26); + #[cfg(not(feature = "fastdev"))] + { + assert_eq!(get_host_module_for_protocol(20, 20).unwrap().max_proto, 21); + assert_eq!(get_host_module_for_protocol(21, 21).unwrap().max_proto, 21); + assert_eq!(get_host_module_for_protocol(22, 22).unwrap().max_proto, 22); + assert_eq!(get_host_module_for_protocol(23, 23).unwrap().max_proto, 23); + assert_eq!(get_host_module_for_protocol(24, 24).unwrap().max_proto, 24); + assert_eq!(get_host_module_for_protocol(25, 25).unwrap().max_proto, 25); + assert_eq!(get_host_module_for_protocol(26, 26).unwrap().max_proto, 26); + } + + #[cfg(feature = "fastdev")] + { + assert_eq!(get_host_module_for_protocol(20, 20).unwrap().max_proto, 27); + assert_eq!(get_host_module_for_protocol(27, 27).unwrap().max_proto, 27); + } + + #[cfg(all(feature = "fastdev", feature = "next"))] + { + assert_eq!(get_host_module_for_protocol(28, 28).unwrap().max_proto, 28); + } // No protocols past the max known. let last_proto = HOST_MODULES.last().unwrap().max_proto; diff --git a/src/rust/src/soroban_proto_any.rs b/src/rust/src/soroban_proto_any.rs index da08c0749..52f5c64f9 100644 --- a/src/rust/src/soroban_proto_any.rs +++ b/src/rust/src/soroban_proto_any.rs @@ -10,7 +10,7 @@ use crate::{ InvokeHostFunctionOutput, RustBuf, SorobanVersionInfo, XDRFileHash, }, }; -use log::{debug, error, trace, warn}; +use log::{debug, error, trace}; use std::{fmt::Display, io::Cursor, panic, rc::Rc, time::Instant}; // This module (soroban_proto_any) is bound to _multiple locations_ in the diff --git a/src/rust/src/soroban_test_extra_protocol.rs b/src/rust/src/soroban_test_extra_protocol.rs index ec5e8c787..1b876252b 100644 --- a/src/rust/src/soroban_test_extra_protocol.rs +++ b/src/rust/src/soroban_test_extra_protocol.rs @@ -8,10 +8,13 @@ use std::str::FromStr; use crate::{ log::partition::TX, - soroban_proto_all::{get_host_module_for_protocol, p22, HostModule}, + soroban_proto_all::{get_host_module_for_protocol, HostModule}, CxxBuf, CxxLedgerInfo, CxxRentFeeConfiguration, InvokeHostFunctionOutput, RustBuf, SorobanModuleCache, }; + +#[cfg(not(feature = "fastdev"))] +use crate::soroban_proto_all::p22; use log::{info, warn}; pub(super) fn maybe_invoke_host_function_again_and_compare_outputs( @@ -80,12 +83,14 @@ pub(super) fn maybe_invoke_host_function_again_and_compare_outputs( } } +#[cfg_attr(feature = "fastdev", allow(unused_variables))] fn modify_resources_for_extra_test_execution( instruction_limit: &mut u32, resources_buf: &mut CxxBuf, new_protocol: u32, ) -> Result<(), Box> { match new_protocol { + #[cfg(not(feature = "fastdev"))] 22 => { use p22::soroban_proto_any::{ inplace_modify_cxxbuf_encoded_type, xdr::SorobanResources, diff --git a/src/test/TestUtils.cpp b/src/test/TestUtils.cpp index c588bf82e..0a5d48d8c 100644 --- a/src/test/TestUtils.cpp +++ b/src/test/TestUtils.cpp @@ -6,6 +6,7 @@ #include "herder/TxSetFrame.h" #include "ledger/ImmutableLedgerView.h" #include "ledger/test/LedgerTestUtils.h" +#include "rust/RustBridge.h" #include "simulation/LoadGenerator.h" #include "simulation/Simulation.h" #include "test/TxTests.h" @@ -16,12 +17,120 @@ #include "work/WorkScheduler.h" #include "xdrpp/marshal.h" +#include +#include + namespace stellar { namespace testutil { +bool isTestApplicationProtocolVersionSupported(Config const& cfg); + +namespace +{ +bool +isProtocolBackedByLinkedSorobanHost(uint32_t protocolVersion, + std::vector const& hostProtocols) +{ + if (protocolVersionIsBefore(protocolVersion, SOROBAN_PROTOCOL_VERSION)) + { + return true; + } + + auto selectedHost = std::find_if( + hostProtocols.begin(), hostProtocols.end(), + [&](uint32_t hostProtocol) { return protocolVersion <= hostProtocol; }); + if (selectedHost == hostProtocols.end()) + { + return false; + } + + // Protocol 20 is serviced by the p21 host. All later Soroban protocols + // should have their own linked host in non-fastdev builds. + return protocolVersion == static_cast(SOROBAN_PROTOCOL_VERSION) + ? *selectedHost == static_cast(ProtocolVersion::V_21) + : *selectedHost == protocolVersion; +} + +std::string +joinProtocolVersions(std::vector const& protocolVersions) +{ + std::ostringstream out; + for (size_t i = 0; i < protocolVersions.size(); ++i) + { + if (i != 0) + { + out << ", "; + } + out << protocolVersions[i]; + } + return out.str(); +} +} + +void +validateTestApplicationProtocolVersion(Config const& cfg) +{ + if (isTestApplicationProtocolVersionSupported(cfg)) + { + return; + } + + auto const protocolVersion = cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION; + std::vector hostProtocols; + auto rustVersions = rust_bridge::get_soroban_version_info( + Config::CURRENT_LEDGER_PROTOCOL_VERSION); + for (auto const& host : rustVersions) + { + hostProtocols.emplace_back(host.env_max_proto); + } + + std::ostringstream msg; + msg << "Test application requested genesis ledger protocol " + << protocolVersion + << ", but this binary does not have the matching Soroban host linked. " + << "Linked Soroban host protocols: [" + << joinProtocolVersions(hostProtocols) + << "]. This usually means the build is using fastdev/unified Rust " + << "mode, where historical Soroban protocols are collapsed to a newer " + << "host and can fail later with opaque Soroban invocation errors. " + << "Use a linked protocol for this test, or rebuild without fastdev " + << "when testing historical Soroban protocol behavior."; + throw std::runtime_error(msg.str()); +} + +bool +isTestApplicationProtocolVersionSupported(Config const& cfg) +{ + if (!cfg.USE_CONFIG_FOR_GENESIS) + { + return true; + } + + auto const protocolVersion = cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION; + if (protocolVersionIsBefore(protocolVersion, SOROBAN_PROTOCOL_VERSION)) + { + return true; + } + + std::vector hostProtocols; + auto rustVersions = rust_bridge::get_soroban_version_info( + Config::CURRENT_LEDGER_PROTOCOL_VERSION); + for (auto const& host : rustVersions) + { + hostProtocols.emplace_back(host.env_max_proto); + } + + if (isProtocolBackedByLinkedSorobanHost(protocolVersion, hostProtocols)) + { + return true; + } + + return false; +} + void crankSome(VirtualClock& clock) { diff --git a/src/test/TestUtils.h b/src/test/TestUtils.h index b8b8a24de..0a9e4a955 100644 --- a/src/test/TestUtils.h +++ b/src/test/TestUtils.h @@ -34,6 +34,9 @@ std::vector getInvalidAssets(SecretKey const& issuer); int32_t computeMultiplier(LedgerEntry const& le); +bool isTestApplicationProtocolVersionSupported(Config const& cfg); +void validateTestApplicationProtocolVersion(Config const& cfg); + template class BucketListDepthModifier { BUCKET_TYPE_ASSERT(BucketT); @@ -90,6 +93,7 @@ std::shared_ptr createTestApplication(VirtualClock& clock, Config const& cfg, Args&&... args, bool newDB = true, bool startApp = true) { + testutil::validateTestApplicationProtocolVersion(cfg); Config c2(cfg); c2.adjust(); auto app = Application::create( diff --git a/src/transactions/test/FrozenLedgerKeysTests.cpp b/src/transactions/test/FrozenLedgerKeysTests.cpp index 26f689967..c5d1166c2 100644 --- a/src/transactions/test/FrozenLedgerKeysTests.cpp +++ b/src/transactions/test/FrozenLedgerKeysTests.cpp @@ -150,6 +150,12 @@ TEST_CASE("frozen ledger keys config setting does not exist prior to p26", cfg.LEDGER_PROTOCOL_VERSION = static_cast(ProtocolVersion::V_25); cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = static_cast(ProtocolVersion::V_25); + if (!testutil::isTestApplicationProtocolVersionSupported(cfg)) + { + SUCCEED("Skipping historical Soroban protocol test: requested " + "protocol is not linked in this build"); + return; + } auto app = createTestApplication(clock, cfg); auto root = app->getRoot(); CheckValidLedgerViewWrapper ledgerView(*app); @@ -166,6 +172,12 @@ TEST_CASE("freeze bypass txs config setting does not exist prior to p26", cfg.LEDGER_PROTOCOL_VERSION = static_cast(ProtocolVersion::V_25); cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = static_cast(ProtocolVersion::V_25); + if (!testutil::isTestApplicationProtocolVersionSupported(cfg)) + { + SUCCEED("Skipping historical Soroban protocol test: requested " + "protocol is not linked in this build"); + return; + } auto app = createTestApplication(clock, cfg); auto root = app->getRoot(); CheckValidLedgerViewWrapper ledgerView(*app); diff --git a/src/transactions/test/InvokeHostFunctionTests.cpp b/src/transactions/test/InvokeHostFunctionTests.cpp index 13166c0c8..945c0b615 100644 --- a/src/transactions/test/InvokeHostFunctionTests.cpp +++ b/src/transactions/test/InvokeHostFunctionTests.cpp @@ -70,6 +70,30 @@ checkResults(TransactionResultSet& r, int expectedSuccess, int expectedFailed) REQUIRE(expectedFailed == expectedFailed); }; +uint32_t +getParallelSorobanTestProtocolVersion() +{ + uint32_t testLedgerProtocolVersion = + static_cast(PARALLEL_SOROBAN_PHASE_PROTOCOL_VERSION); +#ifdef ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION + // Fastdev only links recent Soroban hosts, so avoid forcing these tests + // through the first historical parallel-Soroban protocol in next builds. + testLedgerProtocolVersion = Config::CURRENT_LEDGER_PROTOCOL_VERSION - 1; +#endif + return testLedgerProtocolVersion; +} + +bool +isSorobanProtocolLinked(Config const& cfg, ProtocolVersion protocolVersion) +{ + auto sorobanProtocolCfg = cfg; + sorobanProtocolCfg.USE_CONFIG_FOR_GENESIS = true; + sorobanProtocolCfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = + static_cast(protocolVersion); + return testutil::isTestApplicationProtocolVersionSupported( + sorobanProtocolCfg); +} + void overrideNetworkSettingsToMin(Application& app) { @@ -7190,6 +7214,12 @@ TEST_CASE("Module cache", "[tx][soroban]") VirtualClock clock; auto cfg = getTestConfig(0); cfg.USE_CONFIG_FOR_GENESIS = false; + if (!isSorobanProtocolLinked(cfg, SOROBAN_PROTOCOL_VERSION)) + { + SUCCEED("Skipping historical Soroban protocol test: requested " + "protocol is not linked in this build"); + return; + } auto app = createTestApplication(clock, cfg); @@ -7245,6 +7275,12 @@ TEST_CASE("Vm instantiation tightening", "[tx][soroban]") VirtualClock clock; auto cfg = getTestConfig(0); cfg.USE_CONFIG_FOR_GENESIS = false; + if (!isSorobanProtocolLinked(cfg, SOROBAN_PROTOCOL_VERSION)) + { + SUCCEED("Skipping historical Soroban protocol test: requested " + "protocol is not linked in this build"); + return; + } auto app = createTestApplication(clock, cfg); @@ -7643,6 +7679,12 @@ TEST_CASE("Module cache across protocol versions", "[tx][soroban][modulecache]") // Start in p22 cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = static_cast(REUSABLE_SOROBAN_MODULE_CACHE_PROTOCOL_VERSION) - 1; + if (!testutil::isTestApplicationProtocolVersionSupported(cfg)) + { + SUCCEED("Skipping historical Soroban protocol test: requested " + "protocol is not linked in this build"); + return; + } auto app = createTestApplication(clock, cfg); // Deploy and invoke contract in protocol 22 @@ -8298,10 +8340,9 @@ TEST_CASE_VERSIONS("non-fee source account is recipient of payment in both " TEST_CASE("parallel txs", "[tx][soroban][parallelapply]") { auto cfg = getTestConfig(); - cfg.LEDGER_PROTOCOL_VERSION = - static_cast(PARALLEL_SOROBAN_PHASE_PROTOCOL_VERSION); - cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = - static_cast(PARALLEL_SOROBAN_PHASE_PROTOCOL_VERSION); + auto testLedgerProtocolVersion = getParallelSorobanTestProtocolVersion(); + cfg.LEDGER_PROTOCOL_VERSION = testLedgerProtocolVersion; + cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = testLedgerProtocolVersion; cfg.ENABLE_SOROBAN_DIAGNOSTIC_EVENTS = true; TmpDirManager tdm(std::string("metatest-soroban-") + @@ -8543,6 +8584,14 @@ TEST_CASE("parallel txs", "[tx][soroban][parallelapply]") } SECTION("internal error") { + if (testLedgerProtocolVersion != + static_cast(PARALLEL_SOROBAN_PHASE_PROTOCOL_VERSION)) + { + SUCCEED("Skipping p23 internal-error behavior: requested " + "protocol is not linked in this build"); + return; + } + auto i1Spec = client.writeKeySpec("key2", ContractDataDurability::TEMPORARY); auto i1 = client.getContract().prepareInvocation( @@ -8855,10 +8904,9 @@ TEST_CASE("Failed write still causes ttl observation", "[tx][soroban][parallelapply]") { auto cfg = getTestConfig(); - cfg.LEDGER_PROTOCOL_VERSION = - static_cast(PARALLEL_SOROBAN_PHASE_PROTOCOL_VERSION); - cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = - static_cast(PARALLEL_SOROBAN_PHASE_PROTOCOL_VERSION); + auto testLedgerProtocolVersion = getParallelSorobanTestProtocolVersion(); + cfg.LEDGER_PROTOCOL_VERSION = testLedgerProtocolVersion; + cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = testLedgerProtocolVersion; cfg.ENABLE_SOROBAN_DIAGNOSTIC_EVENTS = true; SorobanTest test(cfg); @@ -8948,10 +8996,9 @@ TEST_CASE("Failed write still causes ttl observation", TEST_CASE("parallel txs hit declared readBytes", "[tx][soroban][parallelapply]") { auto cfg = getTestConfig(); - cfg.LEDGER_PROTOCOL_VERSION = - static_cast(PARALLEL_SOROBAN_PHASE_PROTOCOL_VERSION); - cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = - static_cast(PARALLEL_SOROBAN_PHASE_PROTOCOL_VERSION); + auto testLedgerProtocolVersion = getParallelSorobanTestProtocolVersion(); + cfg.LEDGER_PROTOCOL_VERSION = testLedgerProtocolVersion; + cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = testLedgerProtocolVersion; cfg.ENABLE_SOROBAN_DIAGNOSTIC_EVENTS = true; SorobanTest test(cfg); @@ -9052,10 +9099,9 @@ TEST_CASE("delete non existent entry with parallel apply", "[tx][soroban][parallelapply]") { auto cfg = getTestConfig(); - cfg.LEDGER_PROTOCOL_VERSION = - static_cast(PARALLEL_SOROBAN_PHASE_PROTOCOL_VERSION); - cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = - static_cast(PARALLEL_SOROBAN_PHASE_PROTOCOL_VERSION); + auto testLedgerProtocolVersion = getParallelSorobanTestProtocolVersion(); + cfg.LEDGER_PROTOCOL_VERSION = testLedgerProtocolVersion; + cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = testLedgerProtocolVersion; SorobanTest test(cfg); ContractStorageTestClient client(test); @@ -9405,10 +9451,9 @@ TEST_CASE("apply generated parallel tx sets", "[soroban][parallelapply]") { uint32 const MAX_TRANSACTIONS_PER_LEDGER = 500; auto cfg = getTestConfig(); - cfg.LEDGER_PROTOCOL_VERSION = - static_cast(PARALLEL_SOROBAN_PHASE_PROTOCOL_VERSION); - cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = - static_cast(PARALLEL_SOROBAN_PHASE_PROTOCOL_VERSION); + auto testLedgerProtocolVersion = getParallelSorobanTestProtocolVersion(); + cfg.LEDGER_PROTOCOL_VERSION = testLedgerProtocolVersion; + cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = testLedgerProtocolVersion; cfg.ENABLE_SOROBAN_DIAGNOSTIC_EVENTS = true; // This is required because we're setting the min stage count above one, @@ -9528,10 +9573,9 @@ TEST_CASE("apply generated parallel tx sets", "[soroban][parallelapply]") TEST_CASE("parallel restore and extend op", "[tx][soroban][parallelapply]") { auto cfg = getTestConfig(); - cfg.LEDGER_PROTOCOL_VERSION = - static_cast(PARALLEL_SOROBAN_PHASE_PROTOCOL_VERSION); - cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = - static_cast(PARALLEL_SOROBAN_PHASE_PROTOCOL_VERSION); + auto testLedgerProtocolVersion = getParallelSorobanTestProtocolVersion(); + cfg.LEDGER_PROTOCOL_VERSION = testLedgerProtocolVersion; + cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = testLedgerProtocolVersion; SorobanTest test(cfg); ContractStorageTestClient client(test); @@ -9646,10 +9690,9 @@ TEST_CASE("read-only bumps across threads", "[tx][soroban][parallelapply]") TEST_CASE("parallel restore and update", "[tx][soroban][parallelapply]") { auto cfg = getTestConfig(); - cfg.LEDGER_PROTOCOL_VERSION = - static_cast(PARALLEL_SOROBAN_PHASE_PROTOCOL_VERSION); - cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = - static_cast(PARALLEL_SOROBAN_PHASE_PROTOCOL_VERSION); + auto testLedgerProtocolVersion = getParallelSorobanTestProtocolVersion(); + cfg.LEDGER_PROTOCOL_VERSION = testLedgerProtocolVersion; + cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = testLedgerProtocolVersion; SorobanTest test(cfg); ContractStorageTestClient client(test);