Convert protocol-dependent tests to TEST_CASE_VERSIONS to catch bugs across all protocol versions#5343
Open
Functionhx wants to merge 3 commits into
Open
Conversation
These cases previously ran only at the current ledger protocol, leaving previous-protocol behavior uncovered. Keep Soroban-only settings and auto-restore expectations aligned with the protocol that introduced them. Signed-off-by: Functionhx <2994114386@qq.com>
Missed in initial audit: settings upgrade sibling test and autorestore contract instance/storage resize/from another contract all test protocol-dependent Soroban behavior and need cross-version coverage with protocolVersionIsBefore guards. Signed-off-by: Functionhx <2994114386@qq.com>
…settings upgrade test ConfigSettingIDs 14/15/16 (introduced at V23) have no ledger entries at protocols V20-V22, causing null-pointer dereference when the test iterates across all protocol versions. Added if (!costEntry) continue guard matching the pattern in settings upgrade command line utils. Signed-off-by: Functionhx <2994114386@qq.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates a set of protocol-dependent tests to use TEST_CASE_VERSIONS, enabling them to execute under --all-versions / --version runs and thereby detect protocol-regression bugs that would be missed when running only at the latest protocol.
Changes:
- Converted several Soroban-related tests in
InvokeHostFunctionTests.cppfromTEST_CASEtoTEST_CASE_VERSIONS, adding protocol guards to skip pre-feature protocols. - Added null-entry guards when iterating
ConfigSettingIDvalues so tests don’t dereference missing ledger entries for settings introduced in later protocol versions. - Updated the History catchup acceptance test to
TEST_CASE_VERSIONSso it can be exercised across protocol versions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/transactions/test/InvokeHostFunctionTests.cpp |
Runs key Soroban footprint / settings-upgrade / autorestore tests across protocol versions, with guards and null-entry handling for older protocols. |
src/history/test/HistoryTests.cpp |
Enables the History catchup acceptance test to run under protocol-version iteration (TEST_CASE_VERSIONS). |
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
Resolves #4783.
Converted 7 tests from TEST_CASE (latest protocol only) to TEST_CASE_VERSIONS
(all protocol versions), plus added protocol-version guards and null-entry checks
so the tests run safely across the full protocol range:
settings upgrade, autorestore contract instance, autorestore with storage resize,
autorestore from another contract.
Added null entry guard for ConfigSettingIDs introduced at V23 that have no ledger
entries at protocols V20-V22, preventing null-pointer dereference in settings upgrade.
Checklist