Improve applyCheck and TestAccount test utilites. - #5439
Open
dmkozh wants to merge 2 commits into
Open
Conversation
Contributor
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.
dmkozh
force-pushed
the
test_apply_check_upd
branch
from
September 3, 2026 00:29
ccb328a to
8a1da89
Compare
dmkozh
force-pushed
the
test_apply_check_upd
branch
from
September 3, 2026 00:30
8a1da89 to
462fe25
Compare
Contributor
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.”
Contributor
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.
`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.
dmkozh
force-pushed
the
test_apply_check_upd
branch
from
September 3, 2026 02:30
462fe25 to
e270465
Compare
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)