Skip to content

Add --check-lcm mode to verify captured LedgerCloseMeta golden data in CI - #5435

Merged
sisuresh merged 17 commits into
stellar:masterfrom
sisuresh:check-lcm
Sep 25, 2026
Merged

sisuresh merged 17 commits into
stellar:masterfrom
sisuresh:check-lcm

Conversation

@sisuresh

Copy link
Copy Markdown
Contributor

Adds a --check-lcm DIRNAME test mode mirroring --check-test-tx-meta: each index.json under test-lcm-{current,next}/ is stamped with the protocol version / rng seed that produced it (validated up front, so a protocol bump without regeneration fails fast), and the LCM captured at each leaf section is compared against the checked-in golden file. Wired into ci-build.sh as an extra make check pass reusing the already-built binary.

The first CI run on this PR is expected to fail the new check — the existing golden data predates the header stamp. A follow-up commit regenerates it under both build configurations.

Copilot AI balanced review requested due to automatic review settings August 28, 2026 19:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds CI verification for captured LedgerCloseMeta golden data.

Changes:

  • Adds --check-lcm with header validation and semantic comparison.
  • Stamps captured indexes with protocol and RNG configuration.
  • Adds CI integration and documentation.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/test/test.cpp Implements LCM checking and header validation.
src/test/test.h Updates LCM tracking documentation.
ci-build.sh Adds the CI golden-data check.
docs/software/commands.md Documents --check-lcm.
.github/copilot-instructions.md Documents CI enforcement.
Suppressed comments (1)

ci-build.sh:226

  • The repository's required test invocation flags include --abort, but this newly added CI pass omits it. Add the flag so an ordinary Catch failure stops the pass immediately rather than spending the remainder of this expensive [tx] run after the outcome is known.
export STELLAR_CORE_TEST_PARAMS="--ll fatal -r simple --disable-dots --rng-seed 12345 --check-lcm ${SRC_DIR}"

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread ci-build.sh Resolved
Comment thread src/test/test.cpp Resolved
Copilot AI review requested due to automatic review settings August 28, 2026 19:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 1636 changed files in this pull request and generated no new comments.

Suppressed comments (1)

src/test/test.cpp:394

  • If a leaf previously produced a golden LCM but now produces none, this return treats it as success and leaves the existing golden file unchecked. That allows loss of LCM capture to pass CI; record a failure when the expected file exists.

Copilot AI review requested due to automatic review settings August 28, 2026 21:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 1638 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

src/test/test.cpp:394

  • --check-lcm silently succeeds when a leaf that has a checked-in golden file stops producing any LCM. This early return skips both the existence check and comparison, so a regression that removes a closeLedger/capture call is not detected. If the golden path exists, record a mismatch before returning; leaves that have never had golden data can still be ignored.

Comment thread docs/software/commands.md Resolved
Copilot AI review requested due to automatic review settings August 28, 2026 22:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 1637 changed files in this pull request and generated 2 comments.

Suppressed comments (1)

docs/software/commands.md:238

  • This still states that meta is normalized before writing, but writeLcmToFile explicitly preserves original ordering and only normalizes copies for semantic comparison. Update the description so users do not expect the checked-in XDR stream itself to be sorted.

Comment thread src/test/test.h Resolved
Comment thread src/test/test.cpp Resolved
Copilot AI review requested due to automatic review settings August 28, 2026 22:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 1637 changed files in this pull request and generated no new comments.

Suppressed comments (1)

src/test/test.cpp:1519

  • This only reports mismatches for leaves that executed. loadLcmHeaders discards every hash entry, so deleting a captured section/test (or removing its [tx] tag) leaves the old index/XDR entry unconsumed and CI still succeeds. Track expected hashes and fail on leftovers; since make check partitions tests, either aggregate consumption across partitions or run this check unpartitioned.

Copilot AI review requested due to automatic review settings August 28, 2026 23:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 1636 changed files in this pull request and generated 1 comment.

Comment thread ci-build.sh Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 1637 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings September 2, 2026 21:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 1978 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

src/test/test.cpp:1594

  • When --prune-stale-lcm is not set, this still replaces index.json with only the entries observed in the current run. A filtered capture that touches one test file therefore drops mappings for all unrun leaves in that file and leaves their retained .xdr files orphaned, contrary to the documented non-pruning behavior. Merge existing non-header mappings when pruning is disabled, and rebuild from scratch only when gLcmMayPrune is true.

Comment thread src/bucket/test/BucketTestUtils.h Resolved
Copilot AI review requested due to automatic review settings September 2, 2026 21:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 1978 changed files in this pull request and generated 3 comments.

Suppressed comments (1)

src/bucket/test/BucketTestUtils.h:92

  • This only taints the live-bucket setter. setNextArchiveBatchForBucketTesting also injects archive/restored entries directly (BucketTestUtils.cpp:247-248), and the addLiveBatchAndUpdateSnapshot / addHotArchiveBatchAndUpdateSnapshot helpers directly modify bucket state as well. Those paths can still produce golden LCM that omits how its starting state was created, despite the documented automatic exclusion; apply the taint hook to every direct-injection path.

Comment thread src/test/test.cpp Resolved
Comment thread src/test/test.cpp Resolved
Comment thread src/test/test.cpp Resolved
Copilot AI review requested due to automatic review settings September 2, 2026 22:16
The TxMeta baselines have a section explaining how to re-record them; the
golden LCM data had nothing outside the command reference, which is part of
why it went stale at protocol 27 for a month without anyone noticing.
Both tiers were captured before the protocol 28 bump, so test-lcm-current
held protocol 27 meta and test-lcm-next held protocol 28. Re-captured at 28
and 29 respectively, with the index.json header stamps the check validates.

The regeneration also drops what had accumulated: leaves left behind by
regens at protocol 26 and 27, leaves orphaned by the section renames, and
the CAP-85 vector, whose test injects the executable-reference entry
directly into the bucket list so the meta never showed the entry being
created. Each tier goes from 1131 files to 844.
Rename taintLcmCapture to disableLcmCapture and drop the capture-time reason
log (the reason is still reported when --check-lcm finds stale golden data).
Record raw test/section names joined with '|' in index.json, matching the
TxMeta baselines, and use std::filesystem::path throughout the LCM code.

Claude-Session: https://claude.ai/code/session_01Rq9SZEScpZhaDqJpqjXu6b
Hashes are computed from the index name, so switching index.json to raw
test/section names joined with '|' renames every .xdr file. Content is
unchanged: both tiers are pure renames (844 files each) plus rewritten
index.json files.

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
…string

Remove --prune-stale-lcm and the merge-mode index writer: capture now always
rewrites each visited test file's index.json and deletes golden files the run
did not write, matching --record-test-tx-meta. With regeneration the single
answer to every stale-golden case, disableLcmCapture no longer needs a reason.

Claude-Session: https://claude.ai/code/session_01Rq9SZEScpZhaDqJpqjXu6b
Catch runs the test body once per leaf but calls testCaseStarting only once,
so a leaf that disabled capture also disabled every later sibling. Reset the
flag when the implicit root section starts instead.

Claude-Session: https://claude.ai/code/session_01Rq9SZEScpZhaDqJpqjXu6b
Copilot AI review requested due to automatic review settings September 22, 2026 19:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Three unresolved moderate issues affect capture coverage, failure handling, and stale-output detection.

Review effort: Balanced
Findings: 1 High severity · 2 Medium severity

Open (3)

stellar#5439 changed the applyCheck and TestAccount test helpers, which changes the
meta of 7 TxResultsTests leaves and 1 InvokeHostFunctionTests leaf per tier.

Claude-Session: https://claude.ai/code/session_01Rq9SZEScpZhaDqJpqjXu6b
Copilot AI review requested due to automatic review settings September 22, 2026 20:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

One critical and two moderate LCM correctness issues remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 2 High severity · 2 Medium severity

Open (4)

Comment thread src/test/test.cpp Resolved
Defer each leaf until the implicit root section ends and skip it if any
assertion in that run failed, so a failing capture cannot overwrite a golden.
Also treat ledgerSeq as unsigned.

Claude-Session: https://claude.ai/code/session_01Rq9SZEScpZhaDqJpqjXu6b
Copilot AI review requested due to automatic review settings September 23, 2026 00:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

One or more issues must be addressed before approval.

Review effort: Balanced
Findings: 1 High severity · 2 Medium severity

Open (3)
Resolved since last review (1)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Reset LCM capture disable state for sectionless tests

src/​test/​test.cpp:568

gLcmCaptureDisabled is reset only when the implicit root section starts (line 606), so it remains true across sectionless test cases. A sectionless test can call disableLcmCapture() (for example the multi-node [herder][tx] test), after which every later sectionless test silently skips its LCM check/capture in recordOrCheckLcm. Reset this flag in testCaseStarting as well, before handling tests with no sections.

@sisuresh
sisuresh requested a review from graydon September 23, 2026 17:20

@graydon graydon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was surprised to learn we already had the capture machinery (mostly) wired up and this was "just" adding checking; but it looks good to me. Thanks for all of this.

Comment thread src/test/test.h Resolved
@sisuresh
sisuresh enabled auto-merge September 25, 2026 18:17
@sisuresh
sisuresh added this pull request to the merge queue Sep 25, 2026
Merged via the queue into stellar:master with commit 1b9d421 Sep 25, 2026
56 of 57 checks passed
@sisuresh
sisuresh deleted the check-lcm branch September 25, 2026 19:20
sisuresh added a commit to sisuresh/stellar-core that referenced this pull request Sep 26, 2026
…basing onto master

Both tiers re-captured with master's --capture-lcm (stellar#5435) at protocol 29
(current) and 30 (next); --check-lcm passes on both builds.
sisuresh added a commit to sisuresh/stellar-core that referenced this pull request Sep 28, 2026
Re-recorded for protocols 29 (current) and 30 (next) with --capture-lcm
(stellar#5435), plus the protocol-30 ledger-close-meta reference files.
SirTyson added a commit to SirTyson/stellar-core that referenced this pull request Nov 9, 2026
Brings overlay-v2-shared up to date with master. The previous master
merge (b90d48e, stellar#5428) was recorded with master's tip 100cc38 missing
from its parents, so this merge used 100cc38 as its base (temporary
graft of b90d48e, removed afterwards).

Notable master changes brought in:
- Protocol 30: CURRENT_LEDGER_PROTOCOL_VERSION follows
  MAX_SUPPORTED_PROTOCOL_VERSION; CAP-0084 and CAP-0087 ungated, p29 and
  p30 Soroban hosts (stellar#5472, stellar#5478, stellar#5484, stellar#5483).
- Millisecond-resolution close times at protocol 30 (stellar#5423):
  ConsensusTime/ApplyTime types, STELLAR_VALUE_SIGNED_MS and
  STELLAR_VALUE_EMPTY_TX_SET_MS.
- Tx set validity hardening (stellar#5481), lower max message size in protocol
  29 (stellar#733), sub-second ledger edge-case fixes.
- Simplified ledger view hierarchy (stellar#5461); the overlay-only-mode
  sequence number skip now lives in TransactionFrame::checkValid.
- Banned accounts deprecated (CAP-0077 is active).
- Apply-path performance work (stellar#5402, stellar#5411, stellar#5414, stellar#5415, stellar#5418, stellar#5421,
  stellar#5436, stellar#5286), apply-load tx set construction mode (stellar#5448), --check-lcm
  (stellar#5435), v29.0.0 release merge.

Conflict resolution:
- Files overlay-v2-shared deleted and master modified (the C++ overlay,
  TransactionQueue, TransactionQueueTests, UpgradesTests, private/Horizon/RPC
  workflows): kept deleted. Master's changes to them are C++ overlay
  peer/flow-control logic, tx queue admission and tests for those.
- Herder: kept the Rust-overlay submission path (recvTransaction returns
  TxSubmitStatus) and dropped the deprecated `force` parameter as master did.
  triggerNextLedger keeps the prepared/built tx set path from the Rust
  mempool, now with ConsensusTime close times and master's apply-time
  close-time offset. The early tx set preparation path (prepareTxSet,
  buildTxSet, setupTriggerNextLedger) takes ConsensusTime. Kept master's
  mNominatedTxSetOverride test hook (applied before the tx set is cached in
  the Rust overlay) and the herder.txset.build timer (now timing
  buildTxSet). Dropped the banned-accounts setup and tx queue maintenance.
- AppConnector: dropped both ov2's maybeUpdateImmutableLedgerView and
  master's C++-overlay getOverlayThreadSnapshot.
- LoadGenerator: master's CachedTestAccountPtr with ov2's TxSubmitStatus.
- Tests: kept ov2's removal of tests that need the C++ overlay, standalone
  mode or the tx queue (standalone, manualclose, flooding, tx queue limits,
  far-future slot cleanup, herderExternalizesValuesWithProtocol, MAX_SAC_TPS,
  custom token, soroswap and noisy binary search apply-load tests). Added
  master's ms close time HerderTests and the non-canonical empty tx set test
  on ov2's Rust-overlay topologies. The tx set size test checks against
  overlay-v2's own tx set allowance. The sub-second
  getUpperBoundCloseTimeOffset test checks the offset directly, since there
  is no C++ tx queue admission. Tests that used CheckValidLedgerViewWrapper
  now use getLCLView().
- Cargo.lock: master's lockfile plus the overlay crate's packages,
  regenerated by cargo; semver-compatible duplicates take the newer
  version.
- Build: Makefile.am keeps the Rust overlay rules and adds tracy
  import-chrome; ci-build.sh keeps ASAN off and takes master's -g1.
- Needed to compile: PendingEnvelopes.cpp includes LedgerManager.h
  (master got it through the C++ OverlayManager.h); ov2's early-nomination
  and checkpoint-slot tests use ConsensusTime/ApplyTimeOffset; OverlayIPC
  tests take ledger views from the LedgerManager.
SirTyson added a commit to SirTyson/stellar-core that referenced this pull request Nov 9, 2026
Master's --capture-lcm/--check-lcm mode (stellar#5435, run by ci-build.sh over
[tx]) makes getTestConfig() enable ENABLE_SOROBAN_DIAGNOSTIC_EVENTS, and
Application rejects that on networked validators. Master's loopback
simulations stay RUN_STANDALONE, but overlay v2's Simulation::addNode
always clears RUN_STANDALONE (its nodes talk through Rust overlay
processes). So every simulation-based [tx] test threw at startup under
--check-lcm, e.g. "network externalizes empty-tx-set on missing value".

Simulations never capture LedgerCloseMeta (the constructor calls
disableLcmCapture()), so their nodes don't need diagnostic events.
Turn them off in addNode. Runs without LCM tracking are unaffected,
since getTestConfig() only enables the events while tracking LCM.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants