Repository navigation
Improve applyCheck and TestAccount test utilites. - #5439
Conversation
There was a problem hiding this comment.
Pull request overview
Updates transaction test utilities to use realistic ledger-close behavior and ledger-backed sequence numbers.
Changes:
- Reworks
applyCheckand related transaction tests. - Updates
TestAccountand transaction generation sequence handling. - Adjusts sponsorship, fee-bump, path-payment, Herder, and Soroban tests.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/transactions/test/TxEnvelopeTests.cpp |
Models apply-time transaction invalidation. |
src/transactions/test/SponsorshipTestUtils.cpp |
Builds transactions immediately before closing ledgers. |
src/transactions/test/RevokeSponsorshipTests.cpp |
Removes manual sequence rollback. |
src/transactions/test/PathPaymentTests.cpp |
Validates malformed transactions without applying them. |
src/transactions/test/PathPaymentStrictSendTests.cpp |
Tests ordered, apply-time failures. |
src/transactions/test/ParallelApplyTest.cpp |
Guards unavailable historical protocols. |
src/transactions/test/InvokeHostFunctionTests.cpp |
Updates sequence and execution-cost expectations. |
src/transactions/test/FeeBumpTransactionTests.cpp |
Exercises fee bumps through ledger close. |
src/transactions/test/ClaimableBalanceTests.cpp |
Uses realistic application and fee accounting. |
src/transactions/test/BumpSequenceTests.cpp |
Captures current bad-sequence behavior. |
src/test/TxTests.h |
Makes applyCheck pointer input const. |
src/test/TxTests.cpp |
Reimplements application through ledger close. |
src/test/TestUtils.cpp |
Tracks sequences for generated transactions. |
src/test/TestExceptions.h |
Adds revoke-sponsorship exceptions. |
src/test/TestExceptions.cpp |
Maps revoke-sponsorship failures to exceptions. |
src/test/TestAccount.h |
Exposes cached sequence state. |
src/test/TestAccount.cpp |
Reloads sequence state from the ledger. |
src/simulation/TxGenerator.h |
Adds explicit sequence parameters. |
src/simulation/TxGenerator.cpp |
Supports caller-provided sequences. |
src/simulation/LoadGenerator.cpp |
Revises synchronization and retry bookkeeping. |
src/herder/test/TxSetTests.cpp |
Supplies explicit sequential transaction numbers. |
src/herder/test/HerderTests.cpp |
Updates sequence and surge-pricing scenarios. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
ccb328a to
8a1da89
Compare
8a1da89 to
462fe25
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 65 out of 83 changed files in this pull request and generated 5 comments.
Suppressed comments (2)
src/transactions/test/ClaimableBalanceTests.cpp:883
- This derives the ID from the account's current ledger sequence, but the balance created by the following transaction is keyed with that transaction's sequence (
current + 1; seeCreateClaimableBalanceOpFrame.cpp:316-318). The claim therefore targets a nonexistent balance and breaks the create-and-claim-in-one-transaction case. Keep the explicit next sequence when computing the ID.
src/herder/TxSetFrame.h:139 - Add the missing space between the identifier and “forces.”
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 65 out of 83 changed files in this pull request and generated 1 comment.
Suppressed comments (4)
src/transactions/test/BumpSequenceTests.cpp:164
- Fix the typo in this newly added explanation: “validaition” should be “validation.”
src/simulation/TxGenerator.h:116 - The phrase “per account it once” is ungrammatical; this should say “per account at once.”
src/herder/TxSetFrame.h:122 - Add the missing space after the inline code span so the generated documentation reads correctly.
src/herder/TxSetFrame.h:139 - Add the missing space after the inline code span so this overload's documentation reads correctly as well.
462fe25 to
e270465
Compare
SirTyson
left a comment
There was a problem hiding this comment.
Overall LGTM, thanks for cleaning up the tests! One issue, I think we may have dropped some recorded meta checks in tests that moved to using closeLedger.
e270465 to
f23ada1
Compare
There was a problem hiding this comment.
🟡 Changes recommended
applyCheck still validates protocol-19+ ledger preconditions against LCL instead of the ledger being closed.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 66/84 changed files
- Comments generated: 1
- Review effort level: Balanced
`applyCheck` now properly closes the ledgers. This both improves the test coverage and prepares us for the future changes that may alter the transaction processing flow. This also avoids testing unrealistic scenarios where invalid transactions were applied to ledgers: these scenarios created wrong expectations, that ultimately ended up hiding a change in protocol behavior (stellar#5431) `TestAccount` now always loads the sequence number from the ledger, because transactions that failed validation no longer cause a sequence number bump. Doing this by default is more convenient and straightforward, and also it's less error prone. There is only a handful of tests that create multiple transactions per source account (to ensure it fails validation, or for the legacy protocols) and these manage seq nums manually. Load generation machinery now uses its own `CachedTestAccount` that has the old caching logic, which is relevant for pre-generating transactions. Additionally, enforce transaction validation when `closeLedger` is done with `strictOrder`. Previously this skipped tx validation, which resulted in tests that would silently drop transactions. This hardens the new tests that need to apply transactions in the same ledger in strict order in order to realistically cover scenarios when transaction is invalidated at apply time by a different transaction.
f23ada1 to
a4a8a6a
Compare
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
It changes central transaction-test semantics across many protocol versions and regenerates extensive golden metadata, warranting final human validation.
Review effort: Balanced
Findings: 1
Open (1)
Resolved since last review (1)
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


Description
applyChecknow properly closes the ledgers. This both improves the test coverage and prepares us for the future changes that may alter the transaction processing flow. This also avoids testing unrealistic scenarios where invalid transactions were applied to ledgers: these scenarios created wrong expectations, that ultimately ended up hiding a change in protocol behavior (#5431)TestAccountnow always loads the sequence number from the ledger, because transactions that failed validation no longer cause a sequence number bump. Doing this by default is more convenient and straightforward, and also it's less error prone. There is only a handful of tests that create multiple transactions per source account (to ensure it fails validation, or for the legacy protocols) and these manage seq nums manually. Load generation machinery now uses its ownCachedTestAccountthat has the old caching logic, which is relevant for pre-generating transactions.Additionally, enforce transaction validation when
closeLedgeris done withstrictOrder. Previously this skipped tx validation, which resulted in tests that would silently drop transactions. This hardens the new tests that need to apply transactions in the same ledger in strict order in order to realistically cover scenarios when transaction is invalidated at apply time by a different transaction.Checklist
clang-formatv8.0.0 (viamake formator the Visual Studio extension)