Skip to content

Use re-calibrated costs for loadgen. #4601

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 24, 2024
Merged
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
10 changes: 10 additions & 0 deletions src/herder/Upgrades.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1199,6 +1199,16 @@ Upgrades::applyVersionUpgrade(Application& app, AbstractLedgerTxn& ltx,
if (needUpgradeToVersion(SOROBAN_PROTOCOL_VERSION, prevVersion, newVersion))
{
SorobanNetworkConfig::createLedgerEntriesForV20(ltx, app);
#ifdef BUILD_TESTS
// Update the costs in case if we're in loadgen mode, so that the costs
// reflect the most recent calibration on p20. This would break
// if we tried to replay the ledger, but we shouldn't be combining load
// generation with the ledger replay.
if (app.getConfig().ARTIFICIALLY_GENERATE_LOAD_FOR_TESTING)
{
SorobanNetworkConfig::updateRecalibratedCostTypesForV20(ltx);
}
#endif
}
if (needUpgradeToVersion(ProtocolVersion::V_21, prevVersion, newVersion))
{
Expand Down
19 changes: 17 additions & 2 deletions src/simulation/test/LoadGeneratorTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,9 @@ TEST_CASE("generate soroban load", "[loadgen][soroban]")
Simulation::pointer simulation =
Topologies::pair(Simulation::OVER_LOOPBACK, networkID, [&](int i) {
auto cfg = getTestConfig(i);
cfg.TESTING_UPGRADE_MAX_TX_SET_SIZE = 5000;
// Use tight bounds to we can verify storage works properly
cfg.USE_CONFIG_FOR_GENESIS = false;
cfg.ARTIFICIALLY_GENERATE_LOAD_FOR_TESTING = true;
// Use tight bounds to we can verify storage works properly
cfg.LOADGEN_NUM_DATA_ENTRIES_FOR_TESTING = {numDataEntries};
cfg.LOADGEN_NUM_DATA_ENTRIES_DISTRIBUTION_FOR_TESTING = {1};
cfg.LOADGEN_IO_KILOBYTES_FOR_TESTING = {ioKiloBytes};
Expand All @@ -220,6 +221,20 @@ TEST_CASE("generate soroban load", "[loadgen][soroban]")
auto nodes = simulation->getNodes();

auto& app = *nodes[0]; // pick a node to generate load
Upgrades::UpgradeParameters scheduledUpgrades;
auto lclCloseTime =
VirtualClock::from_time_t(app.getLedgerManager()
.getLastClosedLedgerHeader()
.header.scpValue.closeTime);
scheduledUpgrades.mUpgradeTime = lclCloseTime;
scheduledUpgrades.mProtocolVersion =
Config::CURRENT_LEDGER_PROTOCOL_VERSION;
for (auto const& node : nodes)
{
node->getHerder().setUpgrades(scheduledUpgrades);
}
simulation->crankForAtLeast(std::chrono::seconds(20), false);

auto& loadGen = app.getLoadGenerator();
auto getSuccessfulTxCount = [&]() {
return nodes[0]
Expand Down