Skip to content

Commit

Permalink
make format
Browse files Browse the repository at this point in the history
  • Loading branch information
sisuresh committed Jun 20, 2023
1 parent e0f5bfd commit 8e7ab4a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
30 changes: 18 additions & 12 deletions src/transactions/BumpFootprintExpirationOpFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,22 @@ struct BumpFootprintExpirationMetrics

size_t mLedgerWriteByte{0};

BumpFootprintExpirationMetrics(medida::MetricsRegistry& metrics) : mMetrics(metrics)
BumpFootprintExpirationMetrics(medida::MetricsRegistry& metrics)
: mMetrics(metrics)
{
}

~BumpFootprintExpirationMetrics()
{
mMetrics
.NewMeter({"soroban", "bump-fprint-exp-op", "write-ledger-byte"}, "byte")
.NewMeter({"soroban", "bump-fprint-exp-op", "write-ledger-byte"},
"byte")
.Mark(mLedgerWriteByte);
}
};

BumpFootprintExpirationOpFrame::BumpFootprintExpirationOpFrame(Operation const& op,
OperationResult& res,
TransactionFrame& parentTx)
BumpFootprintExpirationOpFrame::BumpFootprintExpirationOpFrame(
Operation const& op, OperationResult& res, TransactionFrame& parentTx)
: OperationFrame(op, res, parentTx)
, mBumpFootprintExpirationOp(mOperation.body.bumpFootprintExpirationOp())
{
Expand All @@ -43,12 +44,14 @@ BumpFootprintExpirationOpFrame::isOpSupported(LedgerHeader const& header) const
bool
BumpFootprintExpirationOpFrame::doApply(AbstractLedgerTxn& ltx)
{
throw std::runtime_error("BumpFootprintExpirationOpFrame::doApply needs Config");
throw std::runtime_error(
"BumpFootprintExpirationOpFrame::doApply needs Config");
}

bool
BumpFootprintExpirationOpFrame::doApply(Application& app, AbstractLedgerTxn& ltx,
Hash const& sorobanBasePrngSeed)
BumpFootprintExpirationOpFrame::doApply(Application& app,
AbstractLedgerTxn& ltx,
Hash const& sorobanBasePrngSeed)
{
BumpFootprintExpirationMetrics metrics(app.getMetrics());

Expand Down Expand Up @@ -76,7 +79,8 @@ BumpFootprintExpirationOpFrame::doApply(Application& app, AbstractLedgerTxn& ltx
resources.readBytes < metrics.mLedgerWriteByte ||
resources.writeBytes < metrics.mLedgerWriteByte)
{
innerResult().code(BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED);
innerResult().code(
BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED);
return false;
}

Expand All @@ -85,9 +89,11 @@ BumpFootprintExpirationOpFrame::doApply(Application& app, AbstractLedgerTxn& ltx

auto ledgerSeq = ltx.loadHeader().current().ledgerSeq;
uint32_t bumpTo = UINT32_MAX;
if (UINT32_MAX - ledgerSeq > mBumpFootprintExpirationOp.ledgersToExpire())
if (UINT32_MAX - ledgerSeq >
mBumpFootprintExpirationOp.ledgersToExpire())
{
bumpTo = ledgerSeq + mBumpFootprintExpirationOp.ledgersToExpire();
bumpTo =
ledgerSeq + mBumpFootprintExpirationOp.ledgersToExpire();
}

if (getExpirationLedger(ltxe.current()) < bumpTo)
Expand All @@ -105,7 +111,7 @@ BumpFootprintExpirationOpFrame::doApply(Application& app, AbstractLedgerTxn& ltx

bool
BumpFootprintExpirationOpFrame::doCheckValid(SorobanNetworkConfig const& config,
uint32_t ledgerVersion)
uint32_t ledgerVersion)
{
auto const& footprint = mParentTx.sorobanResources().footprint;
if (!footprint.readWrite.empty())
Expand Down
2 changes: 1 addition & 1 deletion src/transactions/BumpFootprintExpirationOpFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class BumpFootprintExpirationOpFrame : public OperationFrame

public:
BumpFootprintExpirationOpFrame(Operation const& op, OperationResult& res,
TransactionFrame& parentTx);
TransactionFrame& parentTx);

bool isOpSupported(LedgerHeader const& header) const override;

Expand Down
4 changes: 2 additions & 2 deletions src/transactions/TransactionFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1689,8 +1689,8 @@ TransactionFrame::applyExpirationBumps(Application& app, AbstractLedgerTxn& ltx)
}
}

bool isBumpOp =
mOperations.front()->getOperation().body.type() == BUMP_FOOTPRINT_EXPIRATION;
bool isBumpOp = mOperations.front()->getOperation().body.type() ==
BUMP_FOOTPRINT_EXPIRATION;
// TODO: Write expiration extension entries instead of witing whole entry
for (auto const& key : resources.footprint.readOnly)
{
Expand Down

0 comments on commit 8e7ab4a

Please sign in to comment.