Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/history/test/HistoryTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,7 @@ dbModeName(Config::TestDbMode mode)
}
}

TEST_CASE("History catchup", "[history][catchup][acceptance]")
TEST_CASE_VERSIONS("History catchup", "[history][catchup][acceptance]")
{
auto runTest = [](bool skipKnownResults) {
// needs REAL_TIME here, as resolve-snapshot works will fail for one of
Expand Down
60 changes: 52 additions & 8 deletions src/transactions/test/InvokeHostFunctionTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@ TEST_CASE("version test", "[tx][soroban]")
}
}

TEST_CASE("Soroban footprint validation", "[tx][soroban]")
TEST_CASE_VERSIONS("Soroban footprint validation", "[tx][soroban]")
{
auto appCfg = getTestConfig();
if (protocolVersionIsBefore(appCfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION,
Expand Down Expand Up @@ -1381,7 +1381,10 @@ TEST_CASE("Soroban footprint validation", "[tx][soroban]")
resources.footprint.readWrite.emplace_back(persistentKey);
resources.footprint.readWrite.emplace_back(persistentKey2);
resources.footprint.readWrite.emplace_back(persistentKey3);
testValidInvoke(true, std::vector<uint32_t>{0, 2});
testValidInvoke(protocolVersionStartsFrom(
appCfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION,
AUTO_RESTORE_PROTOCOL_VERSION),
std::vector<uint32_t>{0, 2});
}

SECTION("entry in readOnly footprint")
Expand Down Expand Up @@ -2486,9 +2489,14 @@ TEST_CASE("contract errors cause transaction to fail", "[tx][soroban]")
}
}

TEST_CASE("settings upgrade", "[tx][soroban][upgrades]")
TEST_CASE_VERSIONS("settings upgrade", "[tx][soroban][upgrades]")
{
auto cfg = getTestConfig();
if (protocolVersionIsBefore(cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION,
SOROBAN_PROTOCOL_VERSION))
{
return;
}
cfg.ENABLE_SOROBAN_DIAGNOSTIC_EVENTS = true;
SorobanTest test(cfg, /* useTestLimits*/ false);
auto runTest = [&]() {
Expand Down Expand Up @@ -2547,6 +2555,10 @@ TEST_CASE("settings upgrade", "[tx][soroban][upgrades]")

LedgerTxn ltx(test.getApp().getLedgerTxnRoot());
auto costEntry = ltx.load(configSettingKey(type));
if (!costEntry)
{
continue;
}
updatedEntries.emplace_back(
costEntry.current().data.configSetting());
}
Expand Down Expand Up @@ -5253,9 +5265,14 @@ TEST_CASE("persistent entry archival", "[tx][soroban][archival]")
}
}

TEST_CASE("autorestore contract instance", "[tx][soroban][archival]")
TEST_CASE_VERSIONS("autorestore contract instance", "[tx][soroban][archival]")
{
auto cfg = getTestConfig();
if (protocolVersionIsBefore(cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION,
AUTO_RESTORE_PROTOCOL_VERSION))
{
return;
}
cfg.ENABLE_SOROBAN_DIAGNOSTIC_EVENTS = true;
SorobanTest test(cfg, true, [](SorobanNetworkConfig& cfg) {
cfg.mStateArchivalSettings.minPersistentTTL =
Expand Down Expand Up @@ -5454,9 +5471,14 @@ TEST_CASE("autorestore contract instance", "[tx][soroban][archival]")
}
}

TEST_CASE("autorestore with storage resize", "[tx][soroban][archival]")
TEST_CASE_VERSIONS("autorestore with storage resize", "[tx][soroban][archival]")
{
auto cfg = getTestConfig();
if (protocolVersionIsBefore(cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION,
AUTO_RESTORE_PROTOCOL_VERSION))
{
return;
}
cfg.ENABLE_SOROBAN_DIAGNOSTIC_EVENTS = true;
SorobanTest test(cfg, true, [](SorobanNetworkConfig& cfg) {
cfg.mStateArchivalSettings.minPersistentTTL =
Expand Down Expand Up @@ -5623,10 +5645,16 @@ TEST_CASE("autorestore with storage resize", "[tx][soroban][archival]")
get-settings-upgrade-txs command to make sure the transactions have the
proper resources set.
*/
TEST_CASE("settings upgrade command line utils", "[tx][soroban][upgrades]")
TEST_CASE_VERSIONS("settings upgrade command line utils",
"[tx][soroban][upgrades]")
{
VirtualClock clock;
auto cfg = getTestConfig(0, Config::TESTDB_IN_MEMORY);
if (protocolVersionIsBefore(cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION,
SOROBAN_PROTOCOL_VERSION))
{
return;
}
cfg.ENABLE_SOROBAN_DIAGNOSTIC_EVENTS = true;
auto app = createTestApplication(clock, cfg);
auto root = app->getRoot();
Expand Down Expand Up @@ -5683,6 +5711,12 @@ TEST_CASE("settings upgrade command line utils", "[tx][soroban][upgrades]")

LedgerTxn ltx(app->getLedgerTxnRoot());
auto entry = ltx.load(configSettingKey(type));
// Config setting IDs introduced by later protocols do not have ledger
// entries yet.
if (!entry)
{
continue;
}

// Store the initial entries before we modify the cost types below
initialEntries.emplace_back(entry.current().data.configSetting());
Expand Down Expand Up @@ -5940,7 +5974,7 @@ TEST_CASE("settings upgrade command line utils", "[tx][soroban][upgrades]")
REQUIRE(ret == "");

auto checkSettings = [&](xdr::xvector<ConfigSettingEntry> const& entries) {
auto expectedIndex = 0;
size_t expectedIndex = 0;
for (auto t : xdr::xdr_traits<ConfigSettingID>::enum_values())
{
auto type = static_cast<ConfigSettingID>(t);
Expand All @@ -5959,11 +5993,16 @@ TEST_CASE("settings upgrade command line utils", "[tx][soroban][upgrades]")

LedgerTxn ltx(app->getLedgerTxnRoot());
auto entry = ltx.load(configSettingKey(type));
if (!entry)
{
continue;
}

REQUIRE(entry.current().data.configSetting() ==
entries.at(expectedIndex));
++expectedIndex;
}
REQUIRE(expectedIndex == entries.size());
};

SECTION("success")
Expand Down Expand Up @@ -10438,9 +10477,14 @@ TEST_CASE_VERSIONS("validate return values", "[tx][soroban][parallelapply]")

// Test that autorestore works when keys aren't explicitly written and
// belong to another uncalled contractID.
TEST_CASE("autorestore from another contract", "[tx][soroban][archival]")
TEST_CASE_VERSIONS("autorestore from another contract", "[tx][soroban][archival]")
{
auto cfg = getTestConfig();
if (protocolVersionIsBefore(cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION,
AUTO_RESTORE_PROTOCOL_VERSION))
{
return;
}
cfg.ENABLE_SOROBAN_DIAGNOSTIC_EVENTS = true;
SorobanTest test(cfg, true, [](SorobanNetworkConfig& sorobanCfg) {
sorobanCfg.mStateArchivalSettings.minPersistentTTL =
Expand Down