Skip to content

Commit b73e60f

Browse files
committed
changes for next
1 parent 93f68eb commit b73e60f

5 files changed

Lines changed: 36 additions & 13 deletions

File tree

.github/copilot-instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ $ NUM_PARTITIONS=$(nproc) STELLAR_CORE_TEST_PARAMS='--ll fatal -r simple --abort
5050

5151
When you make a protocol change
5252
(including `#ifdef`-gated vnext code) and add tests for that change, you MUST regenerate the captured
53-
`LedgerCloseMeta` golden data and commit the resulting `test-lcm/` changes.
53+
`LedgerCloseMeta` golden data and commit the resulting `test-lcm-current/` or `test-lcm-next/` changes.
5454
For vnext tests, configure with
5555
`--enable-next-protocol-version-unsafe-for-production` and rebuild first.
5656

5757
```sh
58-
# regenerate captured LedgerCloseMeta golden data, then commit test-lcm/
58+
# regenerate captured LedgerCloseMeta golden data for the current build's tier, then commit it
5959
$ ./src/stellar-core test --ll fatal -r simple --abort --disable-dots --rng-seed 12345 --capture-lcm "[tx]"
6060
```
6161

docs/software/commands.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,12 @@ Command options can only by placed after command.
204204
* `--capture-lcm` : capture `LedgerCloseMeta` XDR from every
205205
`closeLedger`/`closeLedgerOn` call during tests. Files are written
206206
automatically at leaf-section boundaries (or test-case boundaries for
207-
tests without sections) to `test-lcm/<TestFileBaseName>/`. Each file
207+
tests without sections) to a protocol-tiered directory:
208+
`test-lcm-next/<TestFileBaseName>/` when the binary was built with
209+
`--enable-next-protocol-version-unsafe-for-production`, otherwise
210+
`test-lcm-current/<TestFileBaseName>/`. The two tiers are kept separate
211+
so a current build never reads back meta containing feature-gated XDR
212+
it cannot decode. Each file
208213
is named with a truncated SHA-256 hash of the test/section path
209214
(e.g. `a1b2c3d4e5f67890.xdr`), and an `index.json` in each
210215
directory maps hashes back to human-readable names. Each file contains
@@ -218,7 +223,10 @@ Command options can only by placed after command.
218223
* For example this will run just the tests tagged with `[tx]` using protocol
219224
versions 9 and 10 and stop after the first failure:
220225
`stellar-core test -a --version 9 --version 10 "[tx]"`
221-
* The checked-in files under `test-lcm/` were generated with:
226+
* The checked-in files under `test-lcm-current/` and `test-lcm-next/` are
227+
generated by running the capture under each build configuration (the
228+
`next` tier requires a binary built with
229+
`--enable-next-protocol-version-unsafe-for-production`):
222230
`stellar-core test --rng-seed 12345 '[tx]' --capture-lcm`
223231
* **upgrade-db**: Upgrades local database to current schema version. This is
224232
usually done automatically during stellar-core run or other command.

src/herder/test/HerderTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8513,7 +8513,7 @@ TEST_CASE_VERSIONS("Herder properly validates when tx set is missing",
85138513
#ifdef CAP_0083
85148514
// This tests that the network externalizes an empty-tx-set value when a
85158515
// voted-for value is not available on the network.
8516-
TEST_CASE("network externalizes empty-tx-set on missing value", "[herder]")
8516+
TEST_CASE("network externalizes empty-tx-set on missing value", "[herder][tx]")
85178517
{
85188518
auto networkID = sha256(getTestConfig().NETWORK_PASSPHRASE);
85198519
auto simulation = Topologies::core(

src/test/test.cpp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,19 @@ std::string
148148
buildLcmOutputDir(Catch::TestCaseInfo const& tc)
149149
{
150150
std::filesystem::path file(tc.lineInfo.file);
151-
return "test-lcm/" + file.filename().stem().string();
151+
// Partition golden data by protocol tier so that a build only ever reads,
152+
// writes, and diffs files it can deserialize. A "current" (released) build
153+
// must not touch meta captured by a "next" build, which can contain
154+
// feature-gated XDR (e.g. cap83) whose discriminants the current build does
155+
// not understand. This mirrors the test-tx-meta-baseline-{current,next}
156+
// convention. The tier is fixed per binary by the compile-time define.
157+
#ifdef ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION
158+
char const* tier = "next";
159+
#else
160+
char const* tier = "current";
161+
#endif
162+
return std::string("test-lcm-") + tier + "/" +
163+
file.filename().stem().string();
152164
}
153165

154166
int32_t
@@ -715,8 +727,9 @@ runTest(CommandLineArgs const& args)
715727
parser |= Catch::clara::Opt(
716728
Catch::SimpleTestReporter::gDisableDots)["--disable-dots"];
717729
parser |= Catch::clara::Opt(gLcmCaptureEnabled)["--capture-lcm"](
718-
"automatically capture LedgerCloseMeta to binary XDR files "
719-
"in test-lcm/ at leaf section boundaries");
730+
"automatically capture LedgerCloseMeta to binary XDR files in "
731+
"test-lcm-current/ (or test-lcm-next/ for vnext builds) at leaf "
732+
"section boundaries");
720733

721734
session.cli(parser);
722735

src/test/test.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ extern bool force_sqlite;
3737

3838
// Returns true if --capture-lcm was passed to the test command.
3939
// When enabled, LedgerCloseMeta from closeLedger/closeLedgerOn is
40-
// automatically written to binary XDR files in test-lcm/<TestFile>/
41-
// at leaf section boundaries (or test case end for tests without
42-
// sections). File names are SHA-256 hashes of the human-readable test
43-
// name; each directory also contains an index.json mapping hashes to
44-
// test names.
40+
// automatically written to binary XDR files under a protocol-tiered
41+
// directory: test-lcm-next/<TestFile>/ when the binary is built with
42+
// --enable-next-protocol-version-unsafe-for-production, otherwise
43+
// test-lcm-current/<TestFile>/. Files are written at leaf section
44+
// boundaries (or test case end for tests without sections). File names
45+
// are SHA-256 hashes of the human-readable test name; each directory
46+
// also contains an index.json mapping hashes to test names.
4547
bool isLcmCaptureEnabled();
4648

4749
void test_versions_wrapper(std::function<void(void)> f);

0 commit comments

Comments
 (0)