Skip to content

Commit 0007f4e

Browse files
authored
Implement CAP-77 - ability to freeze ledger keys via network configuration (#5162)
# Description Implement [CAP-77](https://github.com/stellar/stellar-protocol/blob/master/core/cap-0077.md) - ability to freeze ledger keys via network configuration. This implements all of the CAP features: - Add configuration setting and upgrade mechanism for freezing/unfreezing the keys - Add configuration setting and upgrade mechanism for allowing transactions to bypass the freezing mechanism - Reject transactions for which we know that they access a frozen key at validation time (but only if they're not in the bypass transaction list) - Reject transactions for which we can only tell that they access a frozen key at apply time - Remove DEX offers that would result in a frozen entry modification This is a big change, but the bulk of it is tests (as we have a lot of operations to cover) and updates to the interface of every operation. The actual freeze logic is quite straightforward and short, so I'm not sure if it's worth to break this down. # Checklist - [ ] Reviewed the [contributing](https://github.com/stellar/stellar-core/blob/master/CONTRIBUTING.md#submitting-changes) document - [ ] Rebased on top of master (no merge commits) - [ ] Ran `clang-format` v8.0.0 (via `make format` or the Visual Studio extension) - [ ] Compiles - [ ] Ran all tests - [ ] If change impacts performance, include supporting evidence per the [performance document](https://github.com/stellar/stellar-core/blob/master/performance-eval/performance-eval.md)
2 parents b873416 + 87e2161 commit 0007f4e

82 files changed

Lines changed: 5926 additions & 648 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Builds/VisualStudio/stellar-core.vcxproj

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
<WarningLevel>Level4</WarningLevel>
125125
<Optimization>Disabled</Optimization>
126126
<SDLCheck>true</SDLCheck>
127-
<PreprocessorDefinitions>CEREAL_THREAD_SAFE;USE_POSTGRES;ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION=1;USE_SPDLOG;FMT_HEADER_ONLY=1;BUILD_TESTS;WIN32_LEAN_AND_MEAN;NOMINMAX;ASIO_STANDALONE;_WINSOCK_DEPRECATED_NO_WARNINGS;SODIUM_STATIC;ASIO_SEPARATE_COMPILATION;ASIO_ERROR_CATEGORY_NOEXCEPT=noexcept;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0601;WIN32;_MBCS;_CRT_NONSTDC_NO_DEPRECATE;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
127+
<PreprocessorDefinitions>CEREAL_THREAD_SAFE;_SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING;USE_POSTGRES;ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION=1;USE_SPDLOG;FMT_HEADER_ONLY=1;BUILD_TESTS;WIN32_LEAN_AND_MEAN;NOMINMAX;ASIO_STANDALONE;_WINSOCK_DEPRECATED_NO_WARNINGS;SODIUM_STATIC;ASIO_SEPARATE_COMPILATION;ASIO_ERROR_CATEGORY_NOEXCEPT=noexcept;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0601;WIN32;_MBCS;_CRT_NONSTDC_NO_DEPRECATE;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
128128
<AdditionalIncludeDirectories>src;../../src;../../lib;../../lib/tracy/public/tracy;../../lib/spdlog/include;../../lib/libmedida/src;../../lib/soci/src/core;../../lib/autocheck/include;../../lib/cereal/include;../../lib/asio/asio/include;../../lib/xdrpp;../../lib/libsodium/src/libsodium/include;../../lib/fmt/include;../../lib/util;../..;src/$(Configuration)/generated;src/generated;../../lib/sqlite;c:\Program Files\PostgreSQL\15\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
129129
<MultiProcessorCompilation>true</MultiProcessorCompilation>
130130
<MinimalRebuild>false</MinimalRebuild>
@@ -187,7 +187,7 @@ exit /b 0
187187
<WarningLevel>Level4</WarningLevel>
188188
<Optimization>Disabled</Optimization>
189189
<SDLCheck>true</SDLCheck>
190-
<PreprocessorDefinitions>CEREAL_THREAD_SAFE;USE_POSTGRES;USE_SPDLOG;FMT_HEADER_ONLY=1;BUILD_TESTS;WIN32_LEAN_AND_MEAN;NOMINMAX;ASIO_STANDALONE;_WINSOCK_DEPRECATED_NO_WARNINGS;SODIUM_STATIC;ASIO_SEPARATE_COMPILATION;ASIO_ERROR_CATEGORY_NOEXCEPT=noexcept;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0601;WIN32;_MBCS;_CRT_NONSTDC_NO_DEPRECATE;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
190+
<PreprocessorDefinitions>CEREAL_THREAD_SAFE;_SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING;USE_POSTGRES;USE_SPDLOG;FMT_HEADER_ONLY=1;BUILD_TESTS;WIN32_LEAN_AND_MEAN;NOMINMAX;ASIO_STANDALONE;_WINSOCK_DEPRECATED_NO_WARNINGS;SODIUM_STATIC;ASIO_SEPARATE_COMPILATION;ASIO_ERROR_CATEGORY_NOEXCEPT=noexcept;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0601;WIN32;_MBCS;_CRT_NONSTDC_NO_DEPRECATE;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
191191
<AdditionalIncludeDirectories>src;../../src;../../lib;../../lib/tracy/public/tracy;../../lib/spdlog/include;../../lib/libmedida/src;../../lib/soci/src/core;../../lib/autocheck/include;../../lib/cereal/include;../../lib/asio/asio/include;../../lib/xdrpp;../../lib/libsodium/src/libsodium/include;../../lib/fmt/include;../../lib/util;../..;src/$(Configuration)/generated;src/generated;../../lib/sqlite;c:\Program Files\PostgreSQL\15\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
192192
<MultiProcessorCompilation>true</MultiProcessorCompilation>
193193
<MinimalRebuild>false</MinimalRebuild>
@@ -251,7 +251,7 @@ exit /b 0
251251
<WarningLevel>Level4</WarningLevel>
252252
<Optimization>Disabled</Optimization>
253253
<SDLCheck>true</SDLCheck>
254-
<PreprocessorDefinitions>CEREAL_THREAD_SAFE;ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION=1;USE_SPDLOG;FMT_HEADER_ONLY=1;BUILD_TESTS;WIN32_LEAN_AND_MEAN;NOMINMAX;ASIO_STANDALONE;_WINSOCK_DEPRECATED_NO_WARNINGS;SODIUM_STATIC;ASIO_SEPARATE_COMPILATION;ASIO_ERROR_CATEGORY_NOEXCEPT=noexcept;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0601;WIN32;_MBCS;_CRT_NONSTDC_NO_DEPRECATE;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
254+
<PreprocessorDefinitions>CEREAL_THREAD_SAFE;_SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING;ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION=1;USE_SPDLOG;FMT_HEADER_ONLY=1;BUILD_TESTS;WIN32_LEAN_AND_MEAN;NOMINMAX;ASIO_STANDALONE;_WINSOCK_DEPRECATED_NO_WARNINGS;SODIUM_STATIC;ASIO_SEPARATE_COMPILATION;ASIO_ERROR_CATEGORY_NOEXCEPT=noexcept;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0601;WIN32;_MBCS;_CRT_NONSTDC_NO_DEPRECATE;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
255255
<AdditionalIncludeDirectories>src;../../src;../../lib;../../lib/tracy/public/tracy;../../lib/spdlog/include;../../lib/libmedida/src;../../lib/soci/src/core;../../lib/autocheck/include;../../lib/cereal/include;../../lib/asio/asio/include;../../lib/xdrpp;../../lib/libsodium/src/libsodium/include;../../lib/fmt/include;../../lib/util;../..;src/$(Configuration)/generated;src/generated;../../lib/sqlite;c:\Program Files\PostgreSQL\15\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
256256
<MultiProcessorCompilation>true</MultiProcessorCompilation>
257257
<MinimalRebuild>false</MinimalRebuild>
@@ -319,7 +319,7 @@ exit /b 0
319319
<FunctionLevelLinking>true</FunctionLevelLinking>
320320
<IntrinsicFunctions>true</IntrinsicFunctions>
321321
<SDLCheck>true</SDLCheck>
322-
<PreprocessorDefinitions>CEREAL_THREAD_SAFE;USE_POSTGRES;ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION=1;USE_SPDLOG;FMT_HEADER_ONLY=1;BUILD_TESTS;WIN32_LEAN_AND_MEAN;NOMINMAX;ASIO_STANDALONE;_WINSOCK_DEPRECATED_NO_WARNINGS;SODIUM_STATIC;ASIO_SEPARATE_COMPILATION;ASIO_ERROR_CATEGORY_NOEXCEPT=noexcept;TRACY_ENABLE;TRACY_ON_DEMAND;TRACY_NO_BROADCAST;TRACY_ONLY_LOCALHOST;TRACY_DELAYED_INIT;USE_TRACY;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0601;WIN32;_MBCS;_CRT_NONSTDC_NO_DEPRECATE;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
322+
<PreprocessorDefinitions>CEREAL_THREAD_SAFE;_SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING;USE_POSTGRES;ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION=1;USE_SPDLOG;FMT_HEADER_ONLY=1;BUILD_TESTS;WIN32_LEAN_AND_MEAN;NOMINMAX;ASIO_STANDALONE;_WINSOCK_DEPRECATED_NO_WARNINGS;SODIUM_STATIC;ASIO_SEPARATE_COMPILATION;ASIO_ERROR_CATEGORY_NOEXCEPT=noexcept;TRACY_ENABLE;TRACY_ON_DEMAND;TRACY_NO_BROADCAST;TRACY_ONLY_LOCALHOST;TRACY_DELAYED_INIT;USE_TRACY;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0601;WIN32;_MBCS;_CRT_NONSTDC_NO_DEPRECATE;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
323323
<AdditionalIncludeDirectories>src;../../src;../../lib;../../lib/tracy/public/tracy;../../lib/spdlog/include;../../lib/libmedida/src;../../lib/soci/src/core;../../lib/autocheck/include;../../lib/cereal/include;../../lib/asio/asio/include;../../lib/xdrpp;../../lib/libsodium/src/libsodium/include;../../lib/fmt/include;../../lib/util;../..;src/$(Configuration)/generated;src/generated;../../lib/sqlite;c:\Program Files\PostgreSQL\15\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
324324
<BrowseInformation>false</BrowseInformation>
325325
<MultiProcessorCompilation>true</MultiProcessorCompilation>
@@ -382,7 +382,7 @@ exit /b 0
382382
<FunctionLevelLinking>true</FunctionLevelLinking>
383383
<IntrinsicFunctions>true</IntrinsicFunctions>
384384
<SDLCheck>true</SDLCheck>
385-
<PreprocessorDefinitions>CEREAL_THREAD_SAFE;USE_POSTGRES;USE_SPDLOG;FMT_HEADER_ONLY=1;BUILD_TESTS;WIN32_LEAN_AND_MEAN;NOMINMAX;ASIO_STANDALONE;_WINSOCK_DEPRECATED_NO_WARNINGS;SODIUM_STATIC;ASIO_SEPARATE_COMPILATION;ASIO_ERROR_CATEGORY_NOEXCEPT=noexcept;TRACY_ENABLE;TRACY_ON_DEMAND;TRACY_NO_BROADCAST;TRACY_ONLY_LOCALHOST;TRACY_DELAYED_INIT;USE_TRACY;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0601;WIN32;_MBCS;_CRT_NONSTDC_NO_DEPRECATE;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
385+
<PreprocessorDefinitions>CEREAL_THREAD_SAFE;_SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING;USE_POSTGRES;USE_SPDLOG;FMT_HEADER_ONLY=1;BUILD_TESTS;WIN32_LEAN_AND_MEAN;NOMINMAX;ASIO_STANDALONE;_WINSOCK_DEPRECATED_NO_WARNINGS;SODIUM_STATIC;ASIO_SEPARATE_COMPILATION;ASIO_ERROR_CATEGORY_NOEXCEPT=noexcept;TRACY_ENABLE;TRACY_ON_DEMAND;TRACY_NO_BROADCAST;TRACY_ONLY_LOCALHOST;TRACY_DELAYED_INIT;USE_TRACY;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0601;WIN32;_MBCS;_CRT_NONSTDC_NO_DEPRECATE;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
386386
<AdditionalIncludeDirectories>src;../../src;../../lib;../../lib/tracy/public/tracy;../../lib/spdlog/include;../../lib/libmedida/src;../../lib/soci/src/core;../../lib/autocheck/include;../../lib/cereal/include;../../lib/asio/asio/include;../../lib/xdrpp;../../lib/libsodium/src/libsodium/include;../../lib/fmt/include;../../lib/util;../..;src/$(Configuration)/generated;src/generated;../../lib/sqlite;c:\Program Files\PostgreSQL\15\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
387387
<BrowseInformation>false</BrowseInformation>
388388
<MultiProcessorCompilation>true</MultiProcessorCompilation>
@@ -723,6 +723,7 @@ exit /b 0
723723
<ClCompile Include="..\..\src\transactions\test\EventTests.cpp" />
724724
<ClCompile Include="..\..\src\transactions\test\ExchangeTests.cpp" />
725725
<ClCompile Include="..\..\src\transactions\test\FeeBumpTransactionTests.cpp" />
726+
<ClCompile Include="..\..\src\transactions\test\FrozenLedgerKeysTests.cpp" />
726727
<ClCompile Include="..\..\src\transactions\test\InflationTests.cpp" />
727728
<ClCompile Include="..\..\src\transactions\test\InvokeHostFunctionTests.cpp" />
728729
<ClCompile Include="..\..\src\transactions\test\LiquidityPoolDepositTests.cpp" />
@@ -853,7 +854,6 @@ exit /b 0
853854
<ClCompile Include="..\..\src\main\Config.cpp" />
854855
<ClCompile Include="..\..\src\main\dumpxdr.cpp" />
855856
<ClCompile Include="..\..\src\main\main.cpp" />
856-
<ClCompile Include="..\..\src\main\Maintainer.cpp" />
857857
<ClCompile Include="..\..\src\main\PersistentState.cpp" />
858858
<ClCompile Include="..\..\src\main\StellarCoreVersion.cpp" />
859859
<ClCompile Include="..\..\src\util\test\BitSetTests.cpp" />
@@ -1200,7 +1200,6 @@ exit /b 0
12001200
<ClInclude Include="..\..\src\main\Config.h" />
12011201
<ClInclude Include="..\..\src\main\dumpxdr.h" />
12021202
<ClInclude Include="..\..\src\main\ErrorMessages.h" />
1203-
<ClInclude Include="..\..\src\main\Maintainer.h" />
12041203
<ClInclude Include="..\..\src\main\PersistentState.h" />
12051204
<ClInclude Include="..\..\src\main\StellarCoreVersion.h" />
12061205
<ClInclude Include="..\..\lib\http\connection.hpp" />

Builds/VisualStudio/stellar-core.vcxproj.filters

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,6 @@
408408
<ClCompile Include="..\..\src\main\main.cpp">
409409
<Filter>main</Filter>
410410
</ClCompile>
411-
<ClCompile Include="..\..\src\main\Maintainer.cpp">
412-
<Filter>main</Filter>
413-
</ClCompile>
414411
<ClCompile Include="..\..\src\main\PersistentState.cpp">
415412
<Filter>main</Filter>
416413
</ClCompile>
@@ -1437,6 +1434,7 @@
14371434
<ClCompile Include="..\..\lib\tracy\public\TracyClient.cpp">
14381435
<Filter>lib\tracy</Filter>
14391436
</ClCompile>
1437+
<ClCompile Include="..\..\src\transactions\test\FrozenLedgerKeysTests.cpp" />
14401438
</ItemGroup>
14411439
<ItemGroup>
14421440
<ClInclude Include="..\..\lib\util\cpptoml.h">
@@ -1679,9 +1677,6 @@
16791677
<ClInclude Include="..\..\src\main\ErrorMessages.h">
16801678
<Filter>main</Filter>
16811679
</ClInclude>
1682-
<ClInclude Include="..\..\src\main\Maintainer.h">
1683-
<Filter>main</Filter>
1684-
</ClInclude>
16851680
<ClInclude Include="..\..\src\main\PersistentState.h">
16861681
<Filter>main</Filter>
16871682
</ClInclude>

src/database/test/DatabaseTests.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -589,12 +589,13 @@ TEST_CASE("Database splitting migration works correctly", "[db]")
589589

590590
TEST_CASE("ledgerheaders migration works correctly", "[db]")
591591
{
592-
Config::TestDbMode mode = GENERATE(Config::TESTDB_BUCKET_DB_PERSISTENT
593592
#ifdef USE_POSTGRES
594-
,
595-
Config::TESTDB_POSTGRESQL
593+
Config::TestDbMode mode = GENERATE(Config::TESTDB_BUCKET_DB_PERSISTENT,
594+
Config::TESTDB_POSTGRESQL);
595+
#else
596+
Config::TestDbMode mode = GENERATE(Config::TESTDB_BUCKET_DB_PERSISTENT);
596597
#endif
597-
);
598+
598599
#ifdef USE_POSTGRES
599600
INFO("Testing mode: " << (mode == Config::TESTDB_POSTGRESQL
600601
? "PostgreSQL"

src/herder/Upgrades.cpp

Lines changed: 92 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,13 +1246,10 @@ Upgrades::applyVersionUpgrade(Application& app, AbstractLedgerTxn& ltx,
12461246
PubKeyUtils::enableRustDalekVerify();
12471247
SorobanNetworkConfig::createCostTypesForV25(ltx, app);
12481248
}
1249-
// Starting from protocol 23 we need to fully override the Soroban in-memory
1250-
// state size on upgrade, as before protocol 23 bucket list size has bene
1251-
// used.
1252-
if (protocolVersionStartsFrom(newVersion, ProtocolVersion::V_23))
1249+
if (needUpgradeToVersion(ProtocolVersion::V_26, prevVersion, newVersion))
12531250
{
1254-
app.getLedgerManager().handleUpgradeAffectingSorobanInMemoryStateSize(
1255-
ltx);
1251+
SorobanNetworkConfig::updateCostTypesForV26(ltx, app);
1252+
SorobanNetworkConfig::createLedgerEntriesForV26(ltx, app);
12561253
}
12571254

12581255
if (protocolVersionEquals(prevVersion, ProtocolVersion::V_23) &&
@@ -1264,9 +1261,16 @@ Upgrades::applyVersionUpgrade(Application& app, AbstractLedgerTxn& ltx,
12641261
header.current().feePool += 31879035;
12651262
}
12661263

1267-
if (needUpgradeToVersion(ProtocolVersion::V_26, prevVersion, newVersion))
1264+
// Starting from protocol 23 we need to fully override the Soroban in-memory
1265+
// state size on upgrade, as before protocol 23 bucket list size has been
1266+
// used.
1267+
// NB: this has to be the last step in this function, as it reloads the
1268+
// network config from the ledger and expects it to already have all the
1269+
// expected entries.
1270+
if (protocolVersionStartsFrom(newVersion, ProtocolVersion::V_23))
12681271
{
1269-
SorobanNetworkConfig::updateCostTypesForV26(ltx, app);
1272+
app.getLedgerManager().handleUpgradeAffectingSorobanInMemoryStateSize(
1273+
ltx);
12701274
}
12711275
}
12721276

@@ -1419,6 +1423,18 @@ ConfigUpgradeSetFrame::upgradeNeeded(LedgerSnapshot const& ls) const
14191423
}
14201424
for (auto const& updatedEntry : mConfigUpgradeSet.updatedEntry)
14211425
{
1426+
// The delta entry has no stored counterpart — it always needs
1427+
// to be applied (it modifies CONFIG_SETTING_FROZEN_LEDGER_KEYS).
1428+
#ifdef ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION
1429+
if (updatedEntry.configSettingID() ==
1430+
ConfigSettingID::CONFIG_SETTING_FROZEN_LEDGER_KEYS_DELTA ||
1431+
updatedEntry.configSettingID() ==
1432+
ConfigSettingID::CONFIG_SETTING_FREEZE_BYPASS_TXS_DELTA)
1433+
{
1434+
return true;
1435+
}
1436+
#endif
1437+
14221438
LedgerKey key(LedgerEntryType::CONFIG_SETTING);
14231439
key.configSetting().configSettingID = updatedEntry.configSettingID();
14241440
bool isSame =
@@ -1438,10 +1454,76 @@ ConfigUpgradeSetFrame::applyTo(AbstractLedgerTxn& ltx, Application& app) const
14381454
bool hasMemorySettingsUpgrade = false;
14391455
for (auto const& updatedEntry : mConfigUpgradeSet.updatedEntry)
14401456
{
1441-
LedgerKey key(LedgerEntryType::CONFIG_SETTING);
14421457
auto const id = updatedEntry.configSettingID();
1458+
#ifdef ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION
1459+
// Delta entries are not stored config entries. They modify the
1460+
// corresponding base entries instead.
1461+
if (id == ConfigSettingID::CONFIG_SETTING_FROZEN_LEDGER_KEYS_DELTA)
1462+
{
1463+
LedgerKey frozenKeysLk(LedgerEntryType::CONFIG_SETTING);
1464+
frozenKeysLk.configSetting().configSettingID =
1465+
CONFIG_SETTING_FROZEN_LEDGER_KEYS;
1466+
auto frozenKeysLtxe = ltx.load(frozenKeysLk);
1467+
auto& frozenKeysVec = frozenKeysLtxe.current()
1468+
.data.configSetting()
1469+
.frozenLedgerKeys()
1470+
.keys;
1471+
std::set<xdr::opaque_vec<>> existing;
1472+
for (auto const& k : frozenKeysVec)
1473+
{
1474+
existing.insert(k);
1475+
}
1476+
1477+
auto const& delta = updatedEntry.frozenLedgerKeysDelta();
1478+
for (auto const& k : delta.keysToFreeze)
1479+
{
1480+
existing.insert(k);
1481+
}
1482+
for (auto const& k : delta.keysToUnfreeze)
1483+
{
1484+
existing.erase(k);
1485+
}
1486+
1487+
frozenKeysVec.assign(existing.begin(), existing.end());
1488+
continue;
1489+
}
1490+
1491+
if (id == ConfigSettingID::CONFIG_SETTING_FREEZE_BYPASS_TXS_DELTA)
1492+
{
1493+
LedgerKey bypassTxsLk(LedgerEntryType::CONFIG_SETTING);
1494+
bypassTxsLk.configSetting().configSettingID =
1495+
CONFIG_SETTING_FREEZE_BYPASS_TXS;
1496+
auto bypassTxsLtxe = ltx.load(bypassTxsLk);
1497+
auto& bypassTxsVec = bypassTxsLtxe.current()
1498+
.data.configSetting()
1499+
.freezeBypassTxs()
1500+
.txHashes;
1501+
1502+
std::set<Hash> existing;
1503+
for (auto const& h : bypassTxsVec)
1504+
{
1505+
existing.insert(h);
1506+
}
1507+
1508+
auto const& delta = updatedEntry.freezeBypassTxsDelta();
1509+
for (auto const& h : delta.addTxs)
1510+
{
1511+
existing.insert(h);
1512+
}
1513+
for (auto const& h : delta.removeTxs)
1514+
{
1515+
existing.erase(h);
1516+
}
1517+
1518+
bypassTxsVec.assign(existing.begin(), existing.end());
1519+
continue;
1520+
}
1521+
#endif
1522+
1523+
LedgerKey key(LedgerEntryType::CONFIG_SETTING);
14431524
key.configSetting().configSettingID = id;
1444-
auto& currentEntry = ltx.load(key).current().data.configSetting();
1525+
auto ltxe = ltx.load(key);
1526+
auto& currentEntry = ltxe.current().data.configSetting();
14451527
if (id == ConfigSettingID::CONFIG_SETTING_STATE_ARCHIVAL &&
14461528
currentEntry.stateArchivalSettings()
14471529
.liveSorobanStateSizeWindowSampleSize !=

src/history/test/HistoryTests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,6 +1582,7 @@ TEST_CASE_VERSIONS(
15821582
Config cfg(getTestConfig(0));
15831583
cfg.MANUAL_CLOSE = false;
15841584
cfg.MAX_CONCURRENT_SUBPROCESSES = 0;
1585+
cfg.PARALLEL_LEDGER_APPLY = false;
15851586
TmpDirHistoryConfigurator tcfg;
15861587
cfg = tcfg.configure(cfg, true);
15871588
VirtualClock clock;

0 commit comments

Comments
 (0)