Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
SirTyson committed Jan 14, 2025
1 parent 6df429b commit 34d92e2
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 16 deletions.
3 changes: 1 addition & 2 deletions src/bucket/test/BucketTestUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ LedgerManagerForBucketTests::transferLedgerEntriesToBucketList(
ltxEvictions, lh.ledgerSeq, keys, initialLedgerVers,
mApp.getLedgerManager()
.getSorobanNetworkConfigForApply());
#ifdef ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION
if (protocolVersionStartsFrom(
initialLedgerVers,
BucketBase::
Expand All @@ -256,7 +255,7 @@ LedgerManagerForBucketTests::transferLedgerEntriesToBucketList(
mApp, lh, evictedState.archivedEntries, restoredKeys,
{});
}
#endif

if (ledgerCloseMeta)
{
ledgerCloseMeta->populateEvictedEntries(evictedState);
Expand Down
2 changes: 0 additions & 2 deletions src/ledger/LedgerManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1788,7 +1788,6 @@ LedgerManagerImpl::transferLedgerEntriesToBucketList(
ltxEvictions, lh.ledgerSeq, keys, initialLedgerVers,
*mSorobanNetworkConfigForApply);

#ifdef ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION
if (protocolVersionStartsFrom(
initialLedgerVers,
BucketBase::FIRST_PROTOCOL_SUPPORTING_PERSISTENT_EVICTION))
Expand All @@ -1807,7 +1806,6 @@ LedgerManagerImpl::transferLedgerEntriesToBucketList(
mApp.getBucketManager().addHotArchiveBatch(
mApp, lh, evictedState.archivedEntries, restoredKeys, {});
}
#endif

if (ledgerCloseMeta)
{
Expand Down
8 changes: 2 additions & 6 deletions src/transactions/InvokeHostFunctionOpFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,6 @@ InvokeHostFunctionOpFrame::doApply(
}
}
// If ttlLtxe doesn't exist, this is a new Soroban entry
#ifdef ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION
// Starting in protocol 23, we must check the Hot Archive for
// new keys. If a new key is actually archived, fail the op.
if (isPersistentEntry(lk) &&
Expand All @@ -422,17 +421,15 @@ InvokeHostFunctionOpFrame::doApply(
{
sorobanData->pushApplyTimeDiagnosticError(
appConfig, SCE_VALUE, SCEC_INVALID_INPUT,
"trying to access an archived contract "
"code "
"trying to access an archived contract code "
"entry",
{makeBytesSCVal(lk.contractCode().hash)});
}
else if (lk.type() == CONTRACT_DATA)
{
sorobanData->pushApplyTimeDiagnosticError(
appConfig, SCE_VALUE, SCEC_INVALID_INPUT,
"trying to access an archived contract "
"data "
"trying to access an archived contract data "
"entry",
{makeAddressSCVal(lk.contractData().contract),
lk.contractData().key});
Expand All @@ -443,7 +440,6 @@ InvokeHostFunctionOpFrame::doApply(
return false;
}
}
#endif
}

if (!isSorobanEntry(lk) || sorobanEntryLive)
Expand Down
6 changes: 0 additions & 6 deletions src/transactions/RestoreFootprintOpFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ RestoreFootprintOpFrame::doApply(
auto constTTLLtxe = ltx.loadWithoutRecord(ttlKey);
if (!constTTLLtxe)
{
#ifdef ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION
// Next check the hot archive if protocol >= 23
if (protocolVersionStartsFrom(
ltx.getHeader().ledgerVersion,
Expand All @@ -100,7 +99,6 @@ RestoreFootprintOpFrame::doApply(
}
}
else
#endif
{
// Entry doesn't exist, skip
continue;
Expand All @@ -116,14 +114,12 @@ RestoreFootprintOpFrame::doApply(
// We must load the ContractCode/ContractData entry for fee purposes, as
// restore is considered a write
uint32_t entrySize = 0;
#ifdef ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION
if (hotArchiveEntry)
{
entrySize = static_cast<uint32>(
xdr::xdr_size(hotArchiveEntry->archivedEntry()));
}
else
#endif
{
auto constEntryLtxe = ltx.loadWithoutRecord(lk);

Expand Down Expand Up @@ -177,14 +173,12 @@ RestoreFootprintOpFrame::doApply(
rustChange.new_size_bytes = entrySize;
rustChange.new_live_until_ledger = restoredLiveUntilLedger;

#ifdef ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION
if (hotArchiveEntry)
{
ltx.restoreFromHotArchive(hotArchiveEntry->archivedEntry(),
restoredLiveUntilLedger);
}
else
#endif
{
// Entry exists in the live BucketList if we get this this point due
// to the constTTLLtxe loadWithoutRecord logic above.
Expand Down

0 comments on commit 34d92e2

Please sign in to comment.