From 743a2ed8b7a99c0d381a5143137b44cb53d6dc97 Mon Sep 17 00:00:00 2001 From: Dmytro Kozhevin Date: Fri, 20 Oct 2023 12:07:46 -0400 Subject: [PATCH] Remove ltx from network config getter. --- src/bucket/BucketList.cpp | 2 +- src/bucket/test/BucketListTests.cpp | 9 ++-- src/bucket/test/BucketTestUtils.cpp | 2 +- src/catchup/CatchupWork.cpp | 8 ++++ src/herder/HerderImpl.cpp | 4 +- src/herder/TransactionQueue.cpp | 22 ++++----- src/herder/TxQueueLimiter.cpp | 34 ++++++-------- src/herder/TxQueueLimiter.h | 15 +++--- src/herder/TxSetFrame.cpp | 7 +-- src/herder/test/HerderTests.cpp | 20 ++------ src/herder/test/TransactionQueueTests.cpp | 21 +++------ src/herder/test/UpgradesTests.cpp | 32 ++++--------- src/ledger/LedgerManager.h | 14 ++---- src/ledger/LedgerManagerImpl.cpp | 46 +++++++++---------- src/ledger/LedgerManagerImpl.h | 24 ++++------ src/ledger/NetworkConfig.h | 2 +- .../test/LedgerCloseMetaStreamTests.cpp | 2 +- src/overlay/OverlayManagerImpl.cpp | 2 +- src/simulation/LoadGenerator.cpp | 7 +-- src/test/TestUtils.cpp | 3 +- src/test/TxTests.cpp | 2 +- .../ExtendFootprintTTLOpFrame.cpp | 5 +- .../InvokeHostFunctionOpFrame.cpp | 2 +- src/transactions/OperationFrame.cpp | 2 +- src/transactions/RestoreFootprintOpFrame.cpp | 7 ++- src/transactions/TransactionFrame.cpp | 12 ++--- .../test/InvokeHostFunctionTests.cpp | 7 +-- src/transactions/test/SorobanTxTestUtils.cpp | 3 +- 28 files changed, 130 insertions(+), 186 deletions(-) diff --git a/src/bucket/BucketList.cpp b/src/bucket/BucketList.cpp index 4d66c8cd91..232967645d 100644 --- a/src/bucket/BucketList.cpp +++ b/src/bucket/BucketList.cpp @@ -842,7 +842,7 @@ BucketList::scanForEviction(Application& app, AbstractLedgerTxn& ltx, SOROBAN_PROTOCOL_VERSION)) { auto const& networkConfig = - app.getLedgerManager().getSorobanNetworkConfig(ltx); + app.getLedgerManager().getSorobanNetworkConfig(); auto const firstScanLevel = networkConfig.stateArchivalSettings().startingEvictionScanLevel; auto evictionIter = networkConfig.evictionIterator(); diff --git a/src/bucket/test/BucketListTests.cpp b/src/bucket/test/BucketListTests.cpp index 5829e64e63..e13de34dfd 100644 --- a/src/bucket/test/BucketListTests.cpp +++ b/src/bucket/test/BucketListTests.cpp @@ -673,10 +673,7 @@ TEST_CASE_VERSIONS("network config snapshots BucketList size", "[bucketlist]") for_versions_from(20, *app, [&] { LedgerManagerForBucketTests& lm = app->getLedgerManager(); - LedgerTxn ltx(app->getLedgerTxnRoot()); - auto& networkConfig = - app->getLedgerManager().getSorobanNetworkConfig(ltx); - ltx.~LedgerTxn(); + auto& networkConfig = app->getLedgerManager().getSorobanNetworkConfig(); uint32_t windowSize = networkConfig.stateArchivalSettings() .bucketListSizeWindowSampleSize; @@ -718,7 +715,7 @@ TEST_CASE_VERSIONS("network config snapshots BucketList size", "[bucketlist]") // Take snapshots more frequently for faster testing app->getLedgerManager() - .getMutableSorobanNetworkConfig(ltx) + .getMutableSorobanNetworkConfig() .setBucketListSnapshotPeriodForTesting(64); // Generate enough ledgers to fill sliding window @@ -770,7 +767,7 @@ TEST_CASE_VERSIONS("eviction scan", "[bucketlist]") auto& networkCfg = [&]() -> SorobanNetworkConfig& { LedgerTxn ltx(app->getLedgerTxnRoot()); - return app->getLedgerManager().getMutableSorobanNetworkConfig(ltx); + return app->getLedgerManager().getMutableSorobanNetworkConfig(); }(); auto& stateArchivalSettings = networkCfg.stateArchivalSettings(); diff --git a/src/bucket/test/BucketTestUtils.cpp b/src/bucket/test/BucketTestUtils.cpp index 542baaf72c..58e2573f69 100644 --- a/src/bucket/test/BucketTestUtils.cpp +++ b/src/bucket/test/BucketTestUtils.cpp @@ -129,7 +129,7 @@ LedgerManagerForBucketTests::transferLedgerEntriesToBucketList( ltxEvictions.commit(); } mApp.getLedgerManager() - .getMutableSorobanNetworkConfig(ltx) + .getMutableSorobanNetworkConfig() .maybeSnapshotBucketListSize(ledgerSeq, ltx, mApp); } diff --git a/src/catchup/CatchupWork.cpp b/src/catchup/CatchupWork.cpp index 760c15436c..732a42c6ce 100644 --- a/src/catchup/CatchupWork.cpp +++ b/src/catchup/CatchupWork.cpp @@ -463,6 +463,14 @@ CatchupWork::runCatchupStep() return res; } } + { + LedgerTxn ltx(mApp.getLedgerTxnRoot()); + if (protocolVersionStartsFrom(ltx.loadHeader().current().ledgerVersion, + SOROBAN_PROTOCOL_VERSION)) + { + mApp.getLedgerManager().updateNetworkConfig(ltx); + } + } // Step 4: Download, verify and apply ledgers, buckets and transactions diff --git a/src/herder/HerderImpl.cpp b/src/herder/HerderImpl.cpp index 736739e009..9b905c7765 100644 --- a/src/herder/HerderImpl.cpp +++ b/src/herder/HerderImpl.cpp @@ -2014,7 +2014,7 @@ HerderImpl::maybeHandleUpgrade() // no-op on any earlier protocol return; } - auto const& conf = mApp.getLedgerManager().getSorobanNetworkConfig(ltx); + auto const& conf = mApp.getLedgerManager().getSorobanNetworkConfig(); if (conf.txMaxSizeBytes() > mMaxTxSize) { @@ -2066,7 +2066,7 @@ HerderImpl::start() if (protocolVersionStartsFrom(version, SOROBAN_PROTOCOL_VERSION)) { auto const& conf = - mApp.getLedgerManager().getSorobanNetworkConfig(ltx); + mApp.getLedgerManager().getSorobanNetworkConfig(); mMaxTxSize = std::max(mMaxTxSize, conf.txMaxSizeBytes()); } diff --git a/src/herder/TransactionQueue.cpp b/src/herder/TransactionQueue.cpp index b1bd1a2df6..5f86901e84 100644 --- a/src/herder/TransactionQueue.cpp +++ b/src/herder/TransactionQueue.cpp @@ -342,10 +342,12 @@ TransactionQueue::canAdd(TransactionFrameBasePtr tx, LedgerTxn ltx(mApp.getLedgerTxnRoot(), /* shouldUpdateLastModified */ true, TransactionMode::READ_ONLY_WITHOUT_SQL_TXN); + uint32_t ledgerVersion = ltx.loadHeader().current().ledgerVersion; // Subtle: transactions are rejected based on the source account limit prior // to this point. This is safe because we can't evict transactions from the // same source account, so a newer transaction won't replace an old one. - auto canAddRes = mTxQueueLimiter->canAddTx(tx, oldTx, txsToEvict, ltx); + auto canAddRes = + mTxQueueLimiter->canAddTx(tx, oldTx, txsToEvict, ledgerVersion); if (!canAddRes.first) { ban({tx}); @@ -361,9 +363,7 @@ TransactionQueue::canAdd(TransactionFrameBasePtr tx, auto closeTime = mApp.getLedgerManager() .getLastClosedLedgerHeader() .header.scpValue.closeTime; - - if (protocolVersionStartsFrom(ltx.loadHeader().current().ledgerVersion, - ProtocolVersion::V_19)) + if (protocolVersionStartsFrom(ledgerVersion, ProtocolVersion::V_19)) { // This is done so minSeqLedgerGap is validated against the next // ledgerSeq, which is what will be used at apply time @@ -976,7 +976,7 @@ TransactionQueue::clearAll() LedgerTxn ltx(mApp.getLedgerTxnRoot(), /* shouldUpdateLastModified */ true, TransactionMode::READ_ONLY_WITHOUT_SQL_TXN); - mTxQueueLimiter->reset(ltx); + mTxQueueLimiter->reset(ltx.loadHeader().current().ledgerVersion); mKnownTxHashes.clear(); } @@ -1232,9 +1232,7 @@ SorobanTransactionQueue::getMaxResourcesToFloodThisPeriod() const auto const& cfg = mApp.getConfig(); double ratePerLedger = cfg.FLOOD_SOROBAN_RATE_PER_LEDGER; - LedgerTxn ltx(mApp.getLedgerTxnRoot(), /* shouldUpdateLastModified */ true, - TransactionMode::READ_ONLY_WITHOUT_SQL_TXN); - auto sorRes = mApp.getLedgerManager().maxLedgerResources(true, ltx); + auto sorRes = mApp.getLedgerManager().maxLedgerResources(true); auto totalFloodPerLedger = multiplyByDouble(sorRes, ratePerLedger); @@ -1301,10 +1299,8 @@ SorobanTransactionQueue::broadcastSome() std::make_shared(resToFlood), mBroadcastSeed); queue.visitTopTxs(trackersToBroadcast, visitor, mBroadcastOpCarryover); - LedgerTxn ltx(mApp.getLedgerTxnRoot(), true, - TransactionMode::READ_ONLY_WITHOUT_SQL_TXN); Resource maxPerTx = - mApp.getLedgerManager().maxSorobanTransactionResources(ltx); + mApp.getLedgerManager().maxSorobanTransactionResources(); for (auto& resLeft : mBroadcastOpCarryover) { // Limit carry-over to 1 maximum resource transaction @@ -1322,7 +1318,7 @@ SorobanTransactionQueue::getMaxQueueSizeOps() const if (protocolVersionStartsFrom(ltx.loadHeader().current().ledgerVersion, SOROBAN_PROTOCOL_VERSION)) { - auto res = mTxQueueLimiter->maxScaledLedgerResources(true, ltx); + auto res = mTxQueueLimiter->maxScaledLedgerResources(true); releaseAssert(res.size() == NUM_SOROBAN_TX_RESOURCES); return res.getVal(Resource::Type::OPERATIONS); } @@ -1532,7 +1528,7 @@ ClassicTransactionQueue::getMaxQueueSizeOps() const LedgerTxn ltx(mApp.getLedgerTxnRoot(), /* shouldUpdateLastModified */ true, TransactionMode::READ_ONLY_WITHOUT_SQL_TXN); - auto res = mTxQueueLimiter->maxScaledLedgerResources(false, ltx); + auto res = mTxQueueLimiter->maxScaledLedgerResources(false); releaseAssert(res.size() == NUM_CLASSIC_TX_RESOURCES); return res.getVal(Resource::Type::OPERATIONS); } diff --git a/src/herder/TxQueueLimiter.cpp b/src/herder/TxQueueLimiter.cpp index 2f769fb515..773251d7a7 100644 --- a/src/herder/TxQueueLimiter.cpp +++ b/src/herder/TxQueueLimiter.cpp @@ -61,12 +61,10 @@ TxQueueLimiter::size() const #endif Resource -TxQueueLimiter::maxScaledLedgerResources(bool isSoroban, - AbstractLedgerTxn& ltxOuter) const +TxQueueLimiter::maxScaledLedgerResources(bool isSoroban) const { - return multiplyByDouble( - mLedgerManager.maxLedgerResources(isSoroban, ltxOuter), - mPoolLedgerMultiplier); + return multiplyByDouble(mLedgerManager.maxLedgerResources(isSoroban), + mPoolLedgerMultiplier); } void @@ -116,6 +114,7 @@ TxQueueLimiter::removeTransaction(TransactionFrameBasePtr const& tx) } } +#ifdef BUILD_TESTS std::pair TxQueueLimiter::canAddTx(TransactionFrameBasePtr const& newTx, TransactionFrameBasePtr const& oldTx, @@ -124,14 +123,16 @@ TxQueueLimiter::canAddTx(TransactionFrameBasePtr const& newTx, LedgerTxn ltx(mApp.getLedgerTxnRoot(), /* shouldUpdateLastModified */ true, TransactionMode::READ_ONLY_WITHOUT_SQL_TXN); - return canAddTx(newTx, oldTx, txsToEvict, ltx); + return canAddTx(newTx, oldTx, txsToEvict, + ltx.loadHeader().current().ledgerVersion); } +#endif std::pair TxQueueLimiter::canAddTx(TransactionFrameBasePtr const& newTx, TransactionFrameBasePtr const& oldTx, std::vector>& txsToEvict, - AbstractLedgerTxn& ltxOuter) + uint32_t ledgerVersion) { releaseAssert(newTx); releaseAssert(newTx->isSoroban() == mIsSoroban); @@ -147,7 +148,7 @@ TxQueueLimiter::canAddTx(TransactionFrameBasePtr const& newTx, // Resetting both is fine here, as we always reset at the same time if (mTxs == nullptr) { - reset(ltxOuter); + reset(ledgerVersion); } // If some transactions were evicted from this or generic lane, make sure @@ -181,7 +182,7 @@ TxQueueLimiter::canAddTx(TransactionFrameBasePtr const& newTx, // Update the operation limit in case upgrade happened. This is cheap // enough to happen unconditionally without relying on upgrade triggers. mSurgePricingLaneConfig->updateGenericLaneLimit( - Resource(maxScaledLedgerResources(newTx->isSoroban(), ltxOuter))); + Resource(maxScaledLedgerResources(newTx->isSoroban()))); return mTxs->canFitWithEviction(*newTx, oldTxDiscount, txsToEvict); } @@ -196,10 +197,7 @@ TxQueueLimiter::evictTransactions( auto txToFitLane = mSurgePricingLaneConfig->getLane(txToFit); - LedgerTxn ltx(mApp.getLedgerTxnRoot(), /* shouldUpdateLastModified */ true, - TransactionMode::READ_ONLY_WITHOUT_SQL_TXN); - - auto maxLimits = maxScaledLedgerResources(txToFit.isSoroban(), ltx); + auto maxLimits = maxScaledLedgerResources(txToFit.isSoroban()); for (auto const& [evictedStack, evictedDueToLaneLimit] : txsToEvict) { @@ -242,17 +240,15 @@ TxQueueLimiter::evictTransactions( } void -TxQueueLimiter::reset(AbstractLedgerTxn& ltxOuter) +TxQueueLimiter::reset(uint32_t ledgerVersion) { if (mIsSoroban) { - if (protocolVersionStartsFrom( - ltxOuter.loadHeader().current().ledgerVersion, - SOROBAN_PROTOCOL_VERSION)) + if (protocolVersionStartsFrom(ledgerVersion, SOROBAN_PROTOCOL_VERSION)) { mSurgePricingLaneConfig = std::make_shared( - maxScaledLedgerResources(mIsSoroban, ltxOuter)); + maxScaledLedgerResources(mIsSoroban)); } else { @@ -262,7 +258,7 @@ TxQueueLimiter::reset(AbstractLedgerTxn& ltxOuter) else { mSurgePricingLaneConfig = std::make_shared( - maxScaledLedgerResources(mIsSoroban, ltxOuter), mMaxDexOperations); + maxScaledLedgerResources(mIsSoroban), mMaxDexOperations); // Ensure byte limits aren't counted in tx limiter releaseAssert(mSurgePricingLaneConfig->getLaneLimits()[0].size() == NUM_CLASSIC_TX_RESOURCES); diff --git a/src/herder/TxQueueLimiter.h b/src/herder/TxQueueLimiter.h index 9bfef54a74..78100425b6 100644 --- a/src/herder/TxQueueLimiter.h +++ b/src/herder/TxQueueLimiter.h @@ -88,9 +88,12 @@ class TxQueueLimiter void removeTransaction(TransactionFrameBasePtr const& tx); #ifdef BUILD_TESTS size_t size() const; + std::pair + canAddTx(TransactionFrameBasePtr const& tx, + TransactionFrameBasePtr const& oldTx, + std::vector>& txsToEvict); #endif - Resource maxScaledLedgerResources(bool isSoroban, - AbstractLedgerTxn& ltxOuter) const; + Resource maxScaledLedgerResources(bool isSoroban) const; // Evict `txsToEvict` from the limiter by calling `evict`. // `txsToEvict` should be provided by the `canAddTx` call. @@ -114,16 +117,12 @@ class TxQueueLimiter canAddTx(TransactionFrameBasePtr const& tx, TransactionFrameBasePtr const& oldTx, std::vector>& txsToEvict, - AbstractLedgerTxn& ltxOuter); - std::pair - canAddTx(TransactionFrameBasePtr const& tx, - TransactionFrameBasePtr const& oldTx, - std::vector>& txsToEvict); + uint32_t ledgerVersion); // Resets the state related to evictions (maximum evicted bid). void resetEvictionState(); // Resets the internal transaction container and the eviction state. - void reset(AbstractLedgerTxn& ltxOuter); + void reset(uint32_t ledgerVersion); }; } diff --git a/src/herder/TxSetFrame.cpp b/src/herder/TxSetFrame.cpp index 66c95853f3..524433463e 100644 --- a/src/herder/TxSetFrame.cpp +++ b/src/herder/TxSetFrame.cpp @@ -928,7 +928,7 @@ ApplicableTxSetFrame::checkValid(Application& app, { LedgerTxn ltx(app.getLedgerTxnRoot()); auto limits = app.getLedgerManager().maxLedgerResources( - /* isSoroban */ true, ltx); + /* isSoroban */ true); if (anyGreater(*totalTxSetRes, limits)) { CLOG_DEBUG(Herder, @@ -1435,11 +1435,8 @@ ApplicableTxSetFrame::applySurgePricing(Application& app) releaseAssert(isGeneralizedTxSet()); releaseAssert(phaseType == TxSetFrame::Phase::SOROBAN); - LedgerTxn ltx(app.getLedgerTxnRoot(), false, - TransactionMode::READ_ONLY_WITHOUT_SQL_TXN); - auto limits = app.getLedgerManager().maxLedgerResources( - /* isSoroban */ true, ltx); + /* isSoroban */ true); auto byteLimit = std::min(static_cast(MAX_SOROBAN_BYTE_ALLOWANCE), diff --git a/src/herder/test/HerderTests.cpp b/src/herder/test/HerderTests.cpp index f643329a29..b8aacbb7d8 100644 --- a/src/herder/test/HerderTests.cpp +++ b/src/herder/test/HerderTests.cpp @@ -1571,15 +1571,9 @@ TEST_CASE("tx set hits overlay byte limit during construction", cfg.mLedgerMaxInstructions = max; }); - SorobanNetworkConfig conf; + auto const& conf = app->getLedgerManager().getSorobanNetworkConfig(); uint32_t maxContractSize = 0; - { - LedgerTxn ltx(app->getLedgerTxnRoot()); - conf = app->getLedgerManager().getSorobanNetworkConfig(ltx); - maxContractSize = app->getLedgerManager() - .getSorobanNetworkConfig(ltx) - .maxContractSizeBytes(); - } + maxContractSize = conf.maxContractSizeBytes(); auto makeTx = [&](TestAccount& acc, TxSetFrame::Phase const& phase) { if (phase == TxSetFrame::Phase::SOROBAN) @@ -1739,11 +1733,8 @@ TEST_CASE("surge pricing", "[herder][txset][soroban]") // Valid classic auto tx = makeMultiPayment(acc1, root, 1, 100, 0, 1); - SorobanNetworkConfig conf; - { - LedgerTxn ltx(app->getLedgerTxnRoot()); - conf = app->getLedgerManager().getSorobanNetworkConfig(ltx); - } + SorobanNetworkConfig conf = + app->getLedgerManager().getSorobanNetworkConfig(); uint32_t const baseFee = 10'000'000; SorobanResources resources; @@ -3937,9 +3928,8 @@ TEST_CASE("soroban txs accepted by the network", simulation->crankForAtLeast(std::chrono::seconds(20), false); for (auto node : nodes) { - LedgerTxn ltx(node->getLedgerTxnRoot()); REQUIRE(node->getLedgerManager() - .getSorobanNetworkConfig(ltx) + .getSorobanNetworkConfig() .ledgerMaxTxCount() == ledgerWideLimit * 10); } diff --git a/src/herder/test/TransactionQueueTests.cpp b/src/herder/test/TransactionQueueTests.cpp index 9f27ad0f72..f4cfdaee41 100644 --- a/src/herder/test/TransactionQueueTests.cpp +++ b/src/herder/test/TransactionQueueTests.cpp @@ -1158,11 +1158,8 @@ TEST_CASE("Soroban TransactionQueue limits", auto account1 = root.create("a1", minBalance2); auto account2 = root.create("a2", minBalance2); - SorobanNetworkConfig conf; - { - LedgerTxn ltx(app->getLedgerTxnRoot()); - conf = app->getLedgerManager().getSorobanNetworkConfig(ltx); - } + SorobanNetworkConfig conf = + app->getLedgerManager().getSorobanNetworkConfig(); SorobanResources resources; resources.instructions = 2'000'000; @@ -1407,18 +1404,14 @@ TEST_CASE("Soroban TransactionQueue limits", } SECTION("limited lane eviction") { - std::shared_ptr limits = nullptr; - { - LedgerTxn ltx(app->getLedgerTxnRoot()); - limits = std::make_shared( - app->getLedgerManager().maxLedgerResources(true, ltx)); - } + Resource limits = app->getLedgerManager().maxLedgerResources(true); + // Setup limits: generic fits 1 ledger worth of resources, while limited // lane fits 1/4 ledger - auto limitedLane = std::optional( - bigDivideOrThrow(*limits, 1, 4, Rounding::ROUND_UP)); + Resource limitedLane( + bigDivideOrThrow(limits, 1, 4, Rounding::ROUND_UP)); auto config = std::make_shared( - *limits, limitedLane); + limits, limitedLane); auto queue = std::make_unique( /* isHighestPriority */ false, config, 1); diff --git a/src/herder/test/UpgradesTests.cpp b/src/herder/test/UpgradesTests.cpp index fefbe8aae2..30344d2f5a 100644 --- a/src/herder/test/UpgradesTests.cpp +++ b/src/herder/test/UpgradesTests.cpp @@ -252,7 +252,7 @@ makeBucketListSizeWindowSampleSizeTestUpgrade(Application& app, { // Modify window size auto sas = app.getLedgerManager() - .getSorobanNetworkConfig(ltx) + .getSorobanNetworkConfig() .stateArchivalSettings(); sas.bucketListSizeWindowSampleSize = newWindowSize; @@ -825,10 +825,8 @@ TEST_CASE("config upgrades applied to ledger", "[soroban][upgrades]") // entries initialized. executeUpgrade(*app, makeProtocolVersionUpgrade( static_cast(SOROBAN_PROTOCOL_VERSION))); - LedgerTxn ltx(app->getLedgerTxnRoot()); auto const& sorobanConfig = - app->getLedgerManager().getSorobanNetworkConfig(ltx); - ltx.commit(); + app->getLedgerManager().getSorobanNetworkConfig(); SECTION("unknown config upgrade set is ignored") { auto contractID = autocheck::generator()(5); @@ -870,8 +868,7 @@ TEST_CASE("config upgrades applied to ledger", "[soroban][upgrades]") { LedgerTxn ltx2(app->getLedgerTxnRoot()); auto& cfg = - app->getLedgerManager().getMutableSorobanNetworkConfig( - ltx2); + app->getLedgerManager().getMutableSorobanNetworkConfig(); // Populate sliding window with interesting values auto i = 0; @@ -896,9 +893,7 @@ TEST_CASE("config upgrades applied to ledger", "[soroban][upgrades]") { auto const newSize = 20; populateValuesAndUpgradeSize(newSize); - LedgerTxn ltx2(app->getLedgerTxnRoot()); - auto const& cfg = - app->getLedgerManager().getSorobanNetworkConfig(ltx2); + auto const& cfg = app->getLedgerManager().getSorobanNetworkConfig(); // Verify that we popped the 10 oldest values auto sum = 0; @@ -919,9 +914,7 @@ TEST_CASE("config upgrades applied to ledger", "[soroban][upgrades]") { auto const newSize = 40; populateValuesAndUpgradeSize(newSize); - LedgerTxn ltx2(app->getLedgerTxnRoot()); - auto const& cfg = - app->getLedgerManager().getSorobanNetworkConfig(ltx2); + auto const& cfg = app->getLedgerManager().getSorobanNetworkConfig(); // Verify that we backfill 10 copies of the oldest value auto sum = 0; @@ -951,7 +944,7 @@ TEST_CASE("config upgrades applied to ledger", "[soroban][upgrades]") LedgerTxn ltx2(app->getLedgerTxnRoot()); auto const& cfg = - app->getLedgerManager().getSorobanNetworkConfig(ltx2); + app->getLedgerManager().getSorobanNetworkConfig(); initialSize = cfg.mStateArchivalSettings.bucketListSizeWindowSampleSize; initialWindow = cfg.mBucketListSizeSnapshots; @@ -966,10 +959,7 @@ TEST_CASE("config upgrades applied to ledger", "[soroban][upgrades]") REQUIRE(configUpgradeSet); executeUpgrade(*app, makeConfigUpgrade(*configUpgradeSet)); - LedgerTxn ltx2(app->getLedgerTxnRoot()); - - auto const& cfg = - app->getLedgerManager().getSorobanNetworkConfig(ltx2); + auto const& cfg = app->getLedgerManager().getSorobanNetworkConfig(); REQUIRE(cfg.mStateArchivalSettings.bucketListSizeWindowSampleSize == initialSize); REQUIRE(cfg.mBucketListSizeSnapshots == initialWindow); @@ -1082,10 +1072,8 @@ TEST_CASE("Soroban max tx set size upgrade applied to ledger", executeUpgrade(*app, makeProtocolVersionUpgrade( static_cast(SOROBAN_PROTOCOL_VERSION))); - LedgerTxn ltx(app->getLedgerTxnRoot()); auto const& sorobanConfig = - app->getLedgerManager().getSorobanNetworkConfig(ltx); - ltx.commit(); + app->getLedgerManager().getSorobanNetworkConfig(); executeUpgrade(*app, makeMaxSorobanTxSizeUpgrade(123)); REQUIRE(sorobanConfig.ledgerMaxTxCount() == 123); @@ -2295,7 +2283,7 @@ TEST_CASE("configuration initialized in version upgrade", "[upgrades]") InitialSorobanNetworkConfig::MAX_CONTRACT_SIZE); // Check that BucketList size window initialized with current BL size - auto& networkConfig = app->getLedgerManager().getSorobanNetworkConfig(ltx); + auto& networkConfig = app->getLedgerManager().getSorobanNetworkConfig(); REQUIRE(networkConfig.getAverageBucketListSize() == blSize); // Check in memory window @@ -3343,8 +3331,6 @@ TEST_CASE("upgrade to generalized tx set in network", "[upgrades][overlay]") { for (auto const& node : simulation->getNodes()) { - LedgerTxn ltx(node->getLedgerTxnRoot(), false, - TransactionMode::READ_ONLY_WITHOUT_SQL_TXN); auto txSet = getLedgerTxSet(*node, ledger); REQUIRE(txSet); REQUIRE(txSet->sizeTxTotal() > 0); diff --git a/src/ledger/LedgerManager.h b/src/ledger/LedgerManager.h index 7f958fec8c..004e68d2ca 100644 --- a/src/ledger/LedgerManager.h +++ b/src/ledger/LedgerManager.h @@ -120,21 +120,17 @@ class LedgerManager // ledger expressed in number of operations virtual uint32_t getLastMaxTxSetSizeOps() const = 0; - virtual Resource maxLedgerResources(bool isSoroban, - AbstractLedgerTxn& ltxOuter) = 0; - virtual Resource - maxSorobanTransactionResources(AbstractLedgerTxn& ltxOuter) = 0; - + virtual Resource maxLedgerResources(bool isSoroban) = 0; + virtual Resource maxSorobanTransactionResources() = 0; + virtual void updateNetworkConfig(AbstractLedgerTxn& ltx) = 0; // Return the network config for Soroban. // The config is automatically refreshed on protocol upgrades. // Ledger txn here is needed for the sake of lazy load; it won't be // used most of the time. - virtual SorobanNetworkConfig const& - getSorobanNetworkConfig(AbstractLedgerTxn& ltx) = 0; + virtual SorobanNetworkConfig const& getSorobanNetworkConfig() = 0; #ifdef BUILD_TESTS - virtual SorobanNetworkConfig& - getMutableSorobanNetworkConfig(AbstractLedgerTxn& ltx) = 0; + virtual SorobanNetworkConfig& getMutableSorobanNetworkConfig() = 0; #endif // Return the (changing) number of seconds since the LCL closed. diff --git a/src/ledger/LedgerManagerImpl.cpp b/src/ledger/LedgerManagerImpl.cpp index 0c95e11ee0..e8f496b675 100644 --- a/src/ledger/LedgerManagerImpl.cpp +++ b/src/ledger/LedgerManagerImpl.cpp @@ -358,12 +358,13 @@ LedgerManagerImpl::loadLastKnownLedger(function handler) { LedgerTxn ltx(mApp.getLedgerTxnRoot()); auto header = ltx.loadHeader(); + uint32_t ledgerVersion = header.current().ledgerVersion; if (mApp.getConfig().MODE_ENABLES_BUCKETLIST) { auto assumeStateWork = mApp.getWorkScheduler() - .executeWork( - has, header.current().ledgerVersion); + .executeWork(has, + ledgerVersion); if (assumeStateWork->getState() == BasicWork::State::WORK_SUCCESS) { @@ -378,6 +379,11 @@ LedgerManagerImpl::loadLastKnownLedger(function handler) } } advanceLedgerPointers(header.current()); + if (protocolVersionStartsFrom(ledgerVersion, + SOROBAN_PROTOCOL_VERSION)) + { + updateNetworkConfig(ltx); + } } handler(); } @@ -386,6 +392,8 @@ LedgerManagerImpl::loadLastKnownLedger(function handler) { LedgerTxn ltx(mApp.getLedgerTxnRoot()); advanceLedgerPointers(ltx.loadHeader().current()); + // Ledger is not ready in this flow yet, so we can't update + // the network config. } } } @@ -437,12 +445,11 @@ LedgerManagerImpl::getLastMaxTxSetSizeOps() const } Resource -LedgerManagerImpl::maxLedgerResources(bool isSoroban, - AbstractLedgerTxn& ltxOuter) +LedgerManagerImpl::maxLedgerResources(bool isSoroban) { if (isSoroban) { - auto conf = getSorobanNetworkConfig(ltxOuter); + auto conf = getSorobanNetworkConfig(); std::vector limits = {conf.ledgerMaxTxCount(), conf.ledgerMaxInstructions(), conf.ledgerMaxTransactionSizesBytes(), @@ -460,10 +467,9 @@ LedgerManagerImpl::maxLedgerResources(bool isSoroban, } Resource -LedgerManagerImpl::maxSorobanTransactionResources(AbstractLedgerTxn& ltxOuter) +LedgerManagerImpl::maxSorobanTransactionResources() { - auto const& conf = - mApp.getLedgerManager().getSorobanNetworkConfig(ltxOuter); + auto const& conf = mApp.getLedgerManager().getSorobanNetworkConfig(); int64_t const opCount = 1; std::vector limits = {opCount, conf.txMaxInstructions(), @@ -520,28 +526,23 @@ LedgerManagerImpl::getLastClosedLedgerNum() const } SorobanNetworkConfig& -LedgerManagerImpl::getSorobanNetworkConfigInternal(AbstractLedgerTxn& ltx) +LedgerManagerImpl::getSorobanNetworkConfigInternal() { - // updateNetworkConfig will throw if protocol version is invalid - if (!mSorobanNetworkConfig) - { - updateNetworkConfig(ltx); - } - + releaseAssert(mSorobanNetworkConfig); return *mSorobanNetworkConfig; } SorobanNetworkConfig const& -LedgerManagerImpl::getSorobanNetworkConfig(AbstractLedgerTxn& ltx) +LedgerManagerImpl::getSorobanNetworkConfig() { - return getSorobanNetworkConfigInternal(ltx); + return getSorobanNetworkConfigInternal(); } #ifdef BUILD_TESTS SorobanNetworkConfig& -LedgerManagerImpl::getMutableSorobanNetworkConfig(AbstractLedgerTxn& ltx) +LedgerManagerImpl::getMutableSorobanNetworkConfig() { - return getSorobanNetworkConfigInternal(ltx); + return getSorobanNetworkConfigInternal(); } #endif @@ -883,9 +884,6 @@ LedgerManagerImpl::closeLedger(LedgerCloseData const& ledgerData) CLOG_ERROR(Ledger, "Unknown exception during upgrade"); } } - // Technically only a subset of upgrades affects network configuration, but - // it's simpler/safer to just refresh it for any upgrade (sometimes as a - // no-op). if (protocolVersionStartsFrom(ltx.loadHeader().current().ledgerVersion, SOROBAN_PROTOCOL_VERSION)) { @@ -1533,7 +1531,7 @@ LedgerManagerImpl::transferLedgerEntriesToBucketList( ltxEvictions.commit(); } - getSorobanNetworkConfigInternal(ltx).maybeSnapshotBucketListSize( + getSorobanNetworkConfigInternal().maybeSnapshotBucketListSize( ledgerSeq, ltx, mApp); } @@ -1582,7 +1580,7 @@ LedgerManagerImpl::ledgerClosed( if (ledgerCloseMeta && protocolVersionStartsFrom(initialLedgerVers, SOROBAN_PROTOCOL_VERSION)) { - auto blSize = getSorobanNetworkConfig(ltx).getAverageBucketListSize(); + auto blSize = getSorobanNetworkConfig().getAverageBucketListSize(); ledgerCloseMeta->setTotalByteSizeOfBucketList(blSize); } diff --git a/src/ledger/LedgerManagerImpl.h b/src/ledger/LedgerManagerImpl.h index f2ad4ac7f9..4e3736fc64 100644 --- a/src/ledger/LedgerManagerImpl.h +++ b/src/ledger/LedgerManagerImpl.h @@ -99,8 +99,7 @@ class LedgerManagerImpl : public LedgerManager void emitNextMeta(); - SorobanNetworkConfig& - getSorobanNetworkConfigInternal(AbstractLedgerTxn& ltx); + SorobanNetworkConfig& getSorobanNetworkConfigInternal(); protected: // initialLedgerVers must be the ledger version at the start of the ledger @@ -116,17 +115,16 @@ class LedgerManagerImpl : public LedgerManager void advanceLedgerPointers(LedgerHeader const& header, bool debugLog = true); - // Reloads the network configuration from the ledger. - // This needs to be called after the protocol upgrades or once - // during the catchups/test setup etc. - // This call is read-only and hence `ltx` can be read-only. - void updateNetworkConfig(AbstractLedgerTxn& ltx); void logTxApplyMetrics(AbstractLedgerTxn& ltx, size_t numTxs, size_t numOps); public: LedgerManagerImpl(Application& app); + // Reloads the network configuration from the ledger. + // This needs to be called every time a ledger is closed. + // This call is read-only and hence `ltx` can be read-only. + void updateNetworkConfig(AbstractLedgerTxn& ltx) override; void moveToSynced() override; State getState() const override; std::string getStateHuman() const override; @@ -135,20 +133,16 @@ class LedgerManagerImpl : public LedgerManager uint32_t getLastMaxTxSetSize() const override; uint32_t getLastMaxTxSetSizeOps() const override; - Resource maxLedgerResources(bool isSoroban, - AbstractLedgerTxn& ltxOuter) override; - Resource - maxSorobanTransactionResources(AbstractLedgerTxn& ltxOuter) override; + Resource maxLedgerResources(bool isSoroban) override; + Resource maxSorobanTransactionResources() override; int64_t getLastMinBalance(uint32_t ownerCount) const override; uint32_t getLastReserve() const override; uint32_t getLastTxFee() const override; uint32_t getLastClosedLedgerNum() const override; - SorobanNetworkConfig const& - getSorobanNetworkConfig(AbstractLedgerTxn& ltx) override; + SorobanNetworkConfig const& getSorobanNetworkConfig() override; #ifdef BUILD_TESTS - SorobanNetworkConfig& - getMutableSorobanNetworkConfig(AbstractLedgerTxn& ltx) override; + SorobanNetworkConfig& getMutableSorobanNetworkConfig() override; #endif uint64_t secondsSinceLastLedgerClose() const override; diff --git a/src/ledger/NetworkConfig.h b/src/ledger/NetworkConfig.h index 3cb55de470..57d54b5dee 100644 --- a/src/ledger/NetworkConfig.h +++ b/src/ledger/NetworkConfig.h @@ -350,7 +350,7 @@ class SorobanNetworkConfig // Expose all the fields for testing overrides in order to avoid using // special test-only field setters. // Access this via -// `app.getLedgerManager().getMutableSorobanNetworkConfig(ltx)`. +// `app.getLedgerManager().getMutableSorobanNetworkConfig()`. // Important: any manual updates to this will be overwritten in case of // **any** network upgrade - tests that perform updates should only update // settings via upgrades as well. diff --git a/src/ledger/test/LedgerCloseMetaStreamTests.cpp b/src/ledger/test/LedgerCloseMetaStreamTests.cpp index 3e7fd11783..60a7643b49 100644 --- a/src/ledger/test/LedgerCloseMetaStreamTests.cpp +++ b/src/ledger/test/LedgerCloseMetaStreamTests.cpp @@ -609,7 +609,7 @@ TEST_CASE_VERSIONS("meta stream contains reasonable meta", "[ledgerclosemeta]") { LedgerTxn ltx(app->getLedgerTxnRoot()); app->getLedgerManager() - .getMutableSorobanNetworkConfig(ltx) + .getMutableSorobanNetworkConfig() .setBucketListSnapshotPeriodForTesting(1); } diff --git a/src/overlay/OverlayManagerImpl.cpp b/src/overlay/OverlayManagerImpl.cpp index cca388cfbd..7a2abeab8a 100644 --- a/src/overlay/OverlayManagerImpl.cpp +++ b/src/overlay/OverlayManagerImpl.cpp @@ -1279,7 +1279,7 @@ OverlayManagerImpl::getMaxAdvertSize() const if (protocolVersionStartsFrom(ltx.loadHeader().current().ledgerVersion, SOROBAN_PROTOCOL_VERSION)) { - auto limits = mApp.getLedgerManager().getSorobanNetworkConfig(ltx); + auto limits = mApp.getLedgerManager().getSorobanNetworkConfig(); opsToFloodPerLedger += getOpsFloodLedger( limits.ledgerMaxTxCount(), cfg.FLOOD_SOROBAN_RATE_PER_LEDGER); } diff --git a/src/simulation/LoadGenerator.cpp b/src/simulation/LoadGenerator.cpp index 7e2c3eb95f..ddb5958f9d 100644 --- a/src/simulation/LoadGenerator.cpp +++ b/src/simulation/LoadGenerator.cpp @@ -472,18 +472,15 @@ LoadGenerator::generateLoad(GeneratedLoadConfig cfg) SorobanResources resources; uint32_t wasmSize{}; { - LedgerTxn ltx( - mApp.getLedgerTxnRoot(), true, - TransactionMode::READ_ONLY_WITHOUT_SQL_TXN); Resource maxPerTx = mApp.getLedgerManager() - .maxSorobanTransactionResources(ltx); + .maxSorobanTransactionResources(); resources.instructions = rand_uniform( 1, maxPerTx.getVal(Resource::Type::INSTRUCTIONS)); wasmSize = rand_uniform( 1, mApp.getLedgerManager() - .getSorobanNetworkConfig(ltx) + .getSorobanNetworkConfig() .maxContractSizeBytes()); resources.readBytes = rand_uniform( 1, maxPerTx.getVal(Resource::Type::READ_BYTES)); diff --git a/src/test/TestUtils.cpp b/src/test/TestUtils.cpp index bcf2d2a1be..e36d2a569a 100644 --- a/src/test/TestUtils.cpp +++ b/src/test/TestUtils.cpp @@ -199,7 +199,8 @@ modifySorobanNetworkConfig(Application& app, std::function modifyFn) { LedgerTxn ltx(app.getLedgerTxnRoot()); - auto& cfg = app.getLedgerManager().getMutableSorobanNetworkConfig(ltx); + app.getLedgerManager().updateNetworkConfig(ltx); + auto& cfg = app.getLedgerManager().getMutableSorobanNetworkConfig(); modifyFn(cfg); cfg.writeAllSettings(ltx); ltx.commit(); diff --git a/src/test/TxTests.cpp b/src/test/TxTests.cpp index 44aca143b2..308e8127fc 100644 --- a/src/test/TxTests.cpp +++ b/src/test/TxTests.cpp @@ -916,7 +916,7 @@ sorobanResourceFee(Application& app, SorobanResources const& resources, TransactionMode::READ_ONLY_WITHOUT_SQL_TXN); auto feePair = TransactionFrame::computeSorobanResourceFee( ltx.loadHeader().current().ledgerVersion, resources, txSize, eventsSize, - app.getLedgerManager().getSorobanNetworkConfig(ltx), app.getConfig()); + app.getLedgerManager().getSorobanNetworkConfig(), app.getConfig()); return feePair.non_refundable_fee + feePair.refundable_fee; } diff --git a/src/transactions/ExtendFootprintTTLOpFrame.cpp b/src/transactions/ExtendFootprintTTLOpFrame.cpp index 7507d916ed..16395a2f43 100644 --- a/src/transactions/ExtendFootprintTTLOpFrame.cpp +++ b/src/transactions/ExtendFootprintTTLOpFrame.cpp @@ -129,13 +129,12 @@ ExtendFootprintTTLOpFrame::doApply(Application& app, AbstractLedgerTxn& ltx, app.getConfig().CURRENT_LEDGER_PROTOCOL_VERSION, ledgerVersion, rustEntryRentChanges, app.getLedgerManager() - .getSorobanNetworkConfig(ltx) + .getSorobanNetworkConfig() .rustBridgeRentFeeConfiguration(), ledgerSeq); if (!mParentTx.consumeRefundableSorobanResources( 0, rentFee, ledgerVersion, - app.getLedgerManager().getSorobanNetworkConfig(ltx), - app.getConfig())) + app.getLedgerManager().getSorobanNetworkConfig(), app.getConfig())) { innerResult().code(EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE); return false; diff --git a/src/transactions/InvokeHostFunctionOpFrame.cpp b/src/transactions/InvokeHostFunctionOpFrame.cpp index 61891b0ad1..30f2b198ec 100644 --- a/src/transactions/InvokeHostFunctionOpFrame.cpp +++ b/src/transactions/InvokeHostFunctionOpFrame.cpp @@ -369,7 +369,7 @@ InvokeHostFunctionOpFrame::doApply(Application& app, AbstractLedgerTxn& ltx, Config const& cfg = app.getConfig(); HostFunctionMetrics metrics(app.getMetrics()); auto const& sorobanConfig = - app.getLedgerManager().getSorobanNetworkConfig(ltx); + app.getLedgerManager().getSorobanNetworkConfig(); // Get the entries for the footprint rust::Vec ledgerEntryCxxBufs; diff --git a/src/transactions/OperationFrame.cpp b/src/transactions/OperationFrame.cpp index a6a92e07fe..c8d80662a4 100644 --- a/src/transactions/OperationFrame.cpp +++ b/src/transactions/OperationFrame.cpp @@ -267,7 +267,7 @@ OperationFrame::checkValid(Application& app, SignatureChecker& signatureChecker, if (protocolVersionStartsFrom(ledgerVersion, SOROBAN_PROTOCOL_VERSION)) { auto const& sorobanConfig = - app.getLedgerManager().getSorobanNetworkConfig(ltx); + app.getLedgerManager().getSorobanNetworkConfig(); return doCheckValid(sorobanConfig, ledgerVersion); } diff --git a/src/transactions/RestoreFootprintOpFrame.cpp b/src/transactions/RestoreFootprintOpFrame.cpp index 4c3ae16645..8185e09942 100644 --- a/src/transactions/RestoreFootprintOpFrame.cpp +++ b/src/transactions/RestoreFootprintOpFrame.cpp @@ -64,7 +64,7 @@ RestoreFootprintOpFrame::doApply(Application& app, AbstractLedgerTxn& ltx, auto ledgerSeq = ltx.loadHeader().current().ledgerSeq; auto const& archivalSettings = app.getLedgerManager() - .getSorobanNetworkConfig(ltx) + .getSorobanNetworkConfig() .stateArchivalSettings(); rust::Vec rustEntryRentChanges; // Extend the TTL on the restored entry to minimum TTL, including @@ -140,13 +140,12 @@ RestoreFootprintOpFrame::doApply(Application& app, AbstractLedgerTxn& ltx, app.getConfig().CURRENT_LEDGER_PROTOCOL_VERSION, ledgerVersion, rustEntryRentChanges, app.getLedgerManager() - .getSorobanNetworkConfig(ltx) + .getSorobanNetworkConfig() .rustBridgeRentFeeConfiguration(), ledgerSeq); if (!mParentTx.consumeRefundableSorobanResources( 0, rentFee, ltx.loadHeader().current().ledgerVersion, - app.getLedgerManager().getSorobanNetworkConfig(ltx), - app.getConfig())) + app.getLedgerManager().getSorobanNetworkConfig(), app.getConfig())) { innerResult().code(RESTORE_FOOTPRINT_INSUFFICIENT_REFUNDABLE_FEE); return false; diff --git a/src/transactions/TransactionFrame.cpp b/src/transactions/TransactionFrame.cpp index 0ddb431236..a8ebece689 100644 --- a/src/transactions/TransactionFrame.cpp +++ b/src/transactions/TransactionFrame.cpp @@ -1016,7 +1016,7 @@ TransactionFrame::commonValidPreSeqNum( return false; } auto const& sorobanConfig = - app.getLedgerManager().getSorobanNetworkConfig(ltx); + app.getLedgerManager().getSorobanNetworkConfig(); if (!validateSorobanResources(sorobanConfig, ledgerVersion)) { getResult().result.code(txSOROBAN_INVALID); @@ -1442,8 +1442,7 @@ TransactionFrame::checkValidWithOptionallyChargedFee( { sorobanResourceFee = computePreApplySorobanResourceFee( ltx.loadHeader().current().ledgerVersion, - app.getLedgerManager().getSorobanNetworkConfig(ltx), - app.getConfig()); + app.getLedgerManager().getSorobanNetworkConfig(), app.getConfig()); } bool res = commonValid(app, signatureChecker, ltx, current, false, chargeFee, @@ -1649,7 +1648,7 @@ TransactionFrame::applyOperations(SignatureChecker& signatureChecker, // refundable resources. auto preApplyFee = computePreApplySorobanResourceFee( ledgerVersion, - app.getLedgerManager().getSorobanNetworkConfig(ltxTx), + app.getLedgerManager().getSorobanNetworkConfig(), app.getConfig()); mFeeRefund = declaredSorobanResourceFee() - preApplyFee.non_refundable_fee; @@ -1738,7 +1737,6 @@ TransactionFrame::apply(Application& app, AbstractLedgerTxn& ltx, SignatureChecker signatureChecker{ledgerVersion, getContentsHash(), getSignatures(mEnvelope)}; - LedgerTxn ltxTx(ltx); // when applying, a failure during tx validation means that // we'll skip trying to apply operations but we'll still // process the sequence number if needed @@ -1748,10 +1746,10 @@ TransactionFrame::apply(Application& app, AbstractLedgerTxn& ltx, isSoroban()) { sorobanResourceFee = computePreApplySorobanResourceFee( - ledgerVersion, - app.getLedgerManager().getSorobanNetworkConfig(ltxTx), + ledgerVersion, app.getLedgerManager().getSorobanNetworkConfig(), app.getConfig()); } + LedgerTxn ltxTx(ltx); auto cv = commonValid(app, signatureChecker, ltxTx, 0, true, chargeFee, 0, 0, sorobanResourceFee); if (cv >= ValidationType::kInvalidUpdateSeqNum) diff --git a/src/transactions/test/InvokeHostFunctionTests.cpp b/src/transactions/test/InvokeHostFunctionTests.cpp index 8a55413600..e2df0aa152 100644 --- a/src/transactions/test/InvokeHostFunctionTests.cpp +++ b/src/transactions/test/InvokeHostFunctionTests.cpp @@ -828,12 +828,13 @@ TEST_CASE("non-refundable resource metering", "[tx][soroban]") test.txCheckValid(rootTX); { auto& app = *test.getApp(); - LedgerTxn ltx(app.getLedgerTxnRoot()); auto actualFeePair = std::dynamic_pointer_cast(rootTX) ->computePreApplySorobanResourceFee( - ltx.loadHeader().current().ledgerVersion, - app.getLedgerManager().getSorobanNetworkConfig(ltx), + app.getLedgerManager() + .getLastClosedLedgerHeader() + .header.ledgerVersion, + app.getLedgerManager().getSorobanNetworkConfig(), app.getConfig()); REQUIRE(expectedNonRefundableFee == actualFeePair.non_refundable_fee); diff --git a/src/transactions/test/SorobanTxTestUtils.cpp b/src/transactions/test/SorobanTxTestUtils.cpp index c83fa534a9..bc3d7eb384 100644 --- a/src/transactions/test/SorobanTxTestUtils.cpp +++ b/src/transactions/test/SorobanTxTestUtils.cpp @@ -372,8 +372,7 @@ ContractInvocationTest::getRoot() SorobanNetworkConfig const& ContractInvocationTest::getNetworkCfg() { - LedgerTxn ltx(mApp->getLedgerTxnRoot()); - return mApp->getLedgerManager().getSorobanNetworkConfig(ltx); + return mApp->getLedgerManager().getSorobanNetworkConfig(); } uint32_t