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

Fixes to soroban-specific flooding #3809

Merged
merged 3 commits into from
Jul 5, 2023
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
7 changes: 5 additions & 2 deletions src/herder/HerderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2064,8 +2064,11 @@ HerderImpl::updateTransactionQueue(TxSetFrameConstPtr txSet)
updateQueue(mTransactionQueue,
txSet->getTxsForPhase(TxSetFrame::Phase::CLASSIC));
#ifdef ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION
updateQueue(mSorobanTransactionQueue,
txSet->getTxsForPhase(TxSetFrame::Phase::CLASSIC));
if (txSet->numPhases() > static_cast<size_t>(TxSetFrame::Phase::SOROBAN))
{
updateQueue(mSorobanTransactionQueue,
txSet->getTxsForPhase(TxSetFrame::Phase::SOROBAN));
}
#endif
}

Expand Down
12 changes: 10 additions & 2 deletions src/herder/TxSetFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ TxSetFrame::previousLedgerHash() const
TxSetFrame::Transactions const&
TxSetFrame::getTxsForPhase(Phase phase) const
{
releaseAssert(static_cast<size_t>(phase) < mTxPhases.size());
return mTxPhases.at(static_cast<size_t>(phase));
}

Expand Down Expand Up @@ -705,12 +706,19 @@ TxSetFrame::size(LedgerHeader const& lh, std::optional<Phase> phase) const
{
size_t sz = 0;
#ifdef ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION
if (!phase && phase == Phase::SOROBAN)
if (!phase)
{
if (numPhases() > static_cast<size_t>(Phase::SOROBAN))
{
sz += sizeOp(Phase::SOROBAN);
}
}
else if (phase.value() == Phase::SOROBAN)
{
sz += sizeOp(Phase::SOROBAN);
}
#endif
if (!phase || phase == Phase::CLASSIC)
if (!phase || phase.value() == Phase::CLASSIC)
{
sz += protocolVersionStartsFrom(lh.ledgerVersion, ProtocolVersion::V_11)
? sizeOp(Phase::CLASSIC)
Expand Down
2 changes: 1 addition & 1 deletion src/util/TxResource.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Resource
{
OPERATIONS = 0,
INSTRUCTIONS = 1,
BYTE_SIZE = 2,
TX_BYTE_SIZE = 2,
READ_BYTES = 3,
WRITE_BYTES = 4,
READ_LEDGER_ENTRIES = 5,
Expand Down