Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dmkozh committed Jun 26, 2024
1 parent c10675f commit 24831e2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
12 changes: 9 additions & 3 deletions src/herder/TxSetFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -868,12 +868,18 @@ TxSetXDRFrame::makeEmpty(LedgerHeaderHistoryEntry const& lclHeader)
if (protocolVersionStartsFrom(lclHeader.header.ledgerVersion,
SOROBAN_PROTOCOL_VERSION))
{
// Create only non-parallel phases for now. Later we'll need to add an
// empty Soroban parallel stage starting from the respective protocol
// version.
std::vector<TxSetPhaseFrame> emptyPhases(
static_cast<size_t>(TxSetPhase::PHASE_COUNT),
TxSetPhaseFrame::makeEmpty(false));
#ifdef ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION
if (protocolVersionStartsFrom(lclHeader.header.ledgerVersion,
PARALLEL_SOROBAN_PHASE_PROTOCOL_VERSION))
{
emptyPhases[static_cast<size_t>(TxSetPhase::SOROBAN)] =
TxSetPhaseFrame::makeEmpty(true);
}
#endif

GeneralizedTransactionSet txSet;
transactionsToGeneralizedTransactionSetXDR(emptyPhases, lclHeader.hash,
txSet);
Expand Down
4 changes: 2 additions & 2 deletions src/herder/TxSetFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ makeTxSetFromTransactions(
#ifdef BUILD_TESTS
// Skips the tx set validation and preserves the pointers
// to the passed-in transactions - use in conjunction with
// `orderOverride` argument in test-only overrides.
// `enforceTxsApplyOrder` argument in test-only overrides.
,
bool skipValidation = false
#endif
Expand All @@ -69,7 +69,7 @@ makeTxSetFromTransactions(
#ifdef BUILD_TESTS
// Skips the tx set validation and preserves the pointers
// to the passed-in transactions - use in conjunction with
// `orderOverride` argument in test-only overrides.
// `enforceTxsApplyOrder` argument in test-only overrides.
,
bool skipValidation = false
#endif
Expand Down
6 changes: 6 additions & 0 deletions src/herder/test/TestTxSetUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ makeGeneralizedTxSetXDR(std::vector<ComponentPhases> const& phases,
releaseAssert(i < static_cast<size_t>(TxSetPhase::PHASE_COUNT));
auto const& phase = phases[i];
bool isParallelSorobanPhase = false;
#ifdef ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION
if (useParallelSorobanPhase &&
i == static_cast<size_t>(TxSetPhase::SOROBAN))
{
releaseAssert(phase.size() <= 1);
isParallelSorobanPhase = true;
}
#endif

auto normalizedTxsPerBaseFee = phase;
std::sort(normalizedTxsPerBaseFee.begin(),
Expand All @@ -66,6 +68,7 @@ makeGeneralizedTxSetXDR(std::vector<ComponentPhases> const& phases,
{
if (isParallelSorobanPhase)
{
#ifdef ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION
auto& component = xdrPhase.parallelTxsComponent();
if (baseFee)
{
Expand All @@ -81,6 +84,9 @@ makeGeneralizedTxSetXDR(std::vector<ComponentPhases> const& phases,
cluster.emplace_back(tx->getEnvelope());
}
}
#else
releaseAssert(false);
#endif
}
else
{
Expand Down

0 comments on commit 24831e2

Please sign in to comment.