Skip to content

Convert protocol-dependent tests to TEST_CASE_VERSIONS to catch bugs across all protocol versions#5343

Open
Functionhx wants to merge 3 commits into
stellar:masterfrom
Functionhx:fix/4783-protocol-version-tests
Open

Convert protocol-dependent tests to TEST_CASE_VERSIONS to catch bugs across all protocol versions#5343
Functionhx wants to merge 3 commits into
stellar:masterfrom
Functionhx:fix/4783-protocol-version-tests

Conversation

@Functionhx

Copy link
Copy Markdown

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:

  • History catchup, Soroban footprint validation, settings upgrade command line utils,
    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

  • Reviewed the contributing document
  • Rebased on top of master (no merge commits)
  • Ran clang-format v8.0.0 (via make format)
  • Compiles
  • Ran all tests

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>
Copilot AI review requested due to automatic review settings July 11, 2026 16:16

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

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.cpp from TEST_CASE to TEST_CASE_VERSIONS, adding protocol guards to skip pre-feature protocols.
  • Added null-entry guards when iterating ConfigSettingID values so tests don’t dereference missing ledger entries for settings introduced in later protocol versions.
  • Updated the History catchup acceptance test to TEST_CASE_VERSIONS so 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).

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.

Some test cases are only running for the latest protocol, missing bugs made to the previous protocol

2 participants