diff --git a/src/ledger/NetworkConfig.cpp b/src/ledger/NetworkConfig.cpp index a842be46ea..25d924aaae 100644 --- a/src/ledger/NetworkConfig.cpp +++ b/src/ledger/NetworkConfig.cpp @@ -1156,6 +1156,9 @@ SorobanNetworkConfig::initializeGenesisLedgerForTesting( ltx.loadHeader().current().ledgerVersion = static_cast(SOROBAN_PROTOCOL_VERSION); SorobanNetworkConfig::createLedgerEntriesForV20(ltx, app); + // Protocol 20 released with somewhat incorrect costs and has been + // re-calibrated short after the release. We catch up here to the more + // correct costs that exist on the network. updateRecalibratedCostTypesForV20(ltx); ltx.loadHeader().current().ledgerVersion = genesisLedgerProtocol; } diff --git a/src/ledger/NetworkConfig.h b/src/ledger/NetworkConfig.h index c3d36e04e9..ddaab0204a 100644 --- a/src/ledger/NetworkConfig.h +++ b/src/ledger/NetworkConfig.h @@ -335,7 +335,14 @@ class SorobanNetworkConfig #ifdef BUILD_TESTS StateArchivalSettings& stateArchivalSettings(); EvictionIterator& evictionIterator(); - + // Update the protocol 20 cost types to match the real network + // configuration. + // Protocol 20 cost types were imprecise and were re-calibrated shortly + // after the release. This should be called when initializing the test with + // protocol 20+. + // Future recalibrations should be accounted for in a similar way in order + // to have more accurage modelled CPU and memory costs in tests and + // especially the benchmarks. static void updateRecalibratedCostTypesForV20(AbstractLedgerTxn& ltx); #endif bool operator==(SorobanNetworkConfig const& other) const;