Skip to content
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

test #8

Closed
wants to merge 9 commits into from
Closed
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
46 changes: 37 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 13 additions & 4 deletions src/herder/Upgrades.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,12 @@ Upgrades::applyVersionUpgrade(Application& app, AbstractLedgerTxn& ltx,
{
SorobanNetworkConfig::createLedgerEntriesForV20(ltx, app);
}
#ifdef ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION
if (needUpgradeToVersion(ProtocolVersion::V_21, prevVersion, newVersion))
{
SorobanNetworkConfig::createCostTypesForV21(ltx, app);
}
#endif
}

void
Expand Down Expand Up @@ -1332,15 +1338,17 @@ ConfigUpgradeSetFrame::makeFromKey(AbstractLedgerTxn& ltx,
return nullptr;
}

return std::shared_ptr<ConfigUpgradeSetFrame>(
new ConfigUpgradeSetFrame(upgradeSet, key));
return std::shared_ptr<ConfigUpgradeSetFrame>(new ConfigUpgradeSetFrame(
upgradeSet, key, ltx.getHeader().ledgerVersion));
}

ConfigUpgradeSetFrame::ConfigUpgradeSetFrame(
ConfigUpgradeSet const& upgradeSetXDR, ConfigUpgradeSetKey const& key)
ConfigUpgradeSet const& upgradeSetXDR, ConfigUpgradeSetKey const& key,
uint32_t ledgerVersion)
: mConfigUpgradeSet(upgradeSetXDR)
, mKey(key)
, mValidXDR(isValidXDR(upgradeSetXDR, key))
, mLedgerVersion(ledgerVersion)
{
}

Expand Down Expand Up @@ -1475,7 +1483,8 @@ ConfigUpgradeSetFrame::isValidForApply() const
}
for (auto const& cfg : mConfigUpgradeSet.updatedEntry)
{
if (!SorobanNetworkConfig::isValidConfigSettingEntry(cfg) ||
if (!SorobanNetworkConfig::isValidConfigSettingEntry(cfg,
mLedgerVersion) ||
SorobanNetworkConfig::isNonUpgradeableConfigSettingEntry(cfg))
{
return Upgrades::UpgradeValidity::INVALID;
Expand Down
4 changes: 3 additions & 1 deletion src/herder/Upgrades.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ class ConfigUpgradeSetFrame

private:
ConfigUpgradeSetFrame(ConfigUpgradeSet const& upgradeSetXDR,
ConfigUpgradeSetKey const& key);
ConfigUpgradeSetKey const& key,
uint32_t ledgerVersion);

static LedgerKey getLedgerKey(ConfigUpgradeSetKey const& upgradeKey);

Expand All @@ -189,5 +190,6 @@ class ConfigUpgradeSetFrame
ConfigUpgradeSet mConfigUpgradeSet;
ConfigUpgradeSetKey mKey;
bool mValidXDR;
uint32_t const mLedgerVersion;
};
}
Loading
Loading