Skip to content

Commit

Permalink
Use re-calibrated costs for loadgen. (#4601)
Browse files Browse the repository at this point in the history
# Description

Use re-calibrated costs for loadgen.

Also update the `generate soroban load` test to not use the config for
genesis and go through the protocol upgrade instead, so that it
resembles the supercluster missions closer.

# 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)
  • Loading branch information
marta-lokhova authored Dec 24, 2024
2 parents c8dda05 + 3f8a1ce commit d14e7b6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
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

0 comments on commit d14e7b6

Please sign in to comment.