Skip to content

Add option to generate LCM from tests#5178

Open
sisuresh wants to merge 4 commits intostellar:masterfrom
sisuresh:lcm-gen-tests
Open

Add option to generate LCM from tests#5178
sisuresh wants to merge 4 commits intostellar:masterfrom
sisuresh:lcm-gen-tests

Conversation

@sisuresh
Copy link
Contributor

Description

Resolves #5125

Checklist

  • Reviewed the contributing document
  • Rebased on top of master (no merge commits)
  • Ran clang-format v8.0.0 (via make format or the Visual Studio extension)
  • Compiles
  • Ran all tests
  • If change impacts performance, include supporting evidence per the performance document

@sisuresh sisuresh marked this pull request as ready for review March 12, 2026 20:32
Copilot AI review requested due to automatic review settings March 12, 2026 20:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an opt-in test runner mode to automatically capture and persist LedgerCloseMeta (LCM) emitted during ledger closes, primarily to support downstream meta consumers and deterministic fixtures.

Changes:

  • Introduces --capture-lcm in the test runner, accumulating LCM during closeLedger/closeLedgerOn and writing stream-framed XDR files per leaf Catch2 section/test-case.
  • Updates LedgerManagerImpl (tests-only) to retain the most-recent LedgerCloseMeta (with ledger header) for inspection/capture.
  • Tags a curated set of tests with [gen-lcm] and fixes several test ledger-close loops to advance from LCL+1 (to align with stricter assertions).

Reviewed changes

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

Show a summary per file
File Description
src/transactions/test/SorobanTxTestUtils.cpp Adds logging include and fixes namespace comment.
src/transactions/test/InvokeHostFunctionTests.cpp Adds [gen-lcm] tags; fixes several loops to close ledgers starting at LCL+1.
src/transactions/test/FrozenLedgerKeysTests.cpp Adds [gen-lcm] tags to selected tests.
src/test/TxTests.h Declares global accumulated-LCM helpers for tests.
src/test/TxTests.cpp Implements accumulated-LCM storage; captures LCM during ledger closes; adds stricter ledger sequence assertion.
src/test/TestUtils.cpp Appends LCM after Soroban network config upgrades when capture is enabled.
src/test/test.h Declares isLcmCaptureEnabled() for test helpers to query capture mode.
src/test/test.cpp Implements --capture-lcm, per-section capture bookkeeping, and file output under test-lcm/.
src/ledger/LedgerManagerImpl.cpp Moves/stabilizes tests-only mLastLedgerCloseMeta capture and ensures it includes the final ledger header.
docs/software/commands.md Documents --capture-lcm, expected output layout, and [gen-lcm] usage.

You can also share your feedback on Copilot code review. Take the survey.

sisuresh and others added 3 commits March 12, 2026 15:19
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

Generate complete LedgerCloseMetas in our test cases

2 participants