Skip to content

Commit 4ea77f4

Browse files
committed
Switch to using AppConnector in apply
1 parent cb7ce6c commit 4ea77f4

5 files changed

+17
-22
lines changed

src/transactions/InvokeHostFunctionOpFrame.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,9 @@ InvokeHostFunctionOpFrame::doApply(
330330
ZoneNamedN(applyZone, "InvokeHostFunctionOpFrame apply", true);
331331

332332
Config const& appConfig = app.getConfig();
333-
HostFunctionMetrics metrics(app.getLedgerManager().getSorobanMetrics());
333+
HostFunctionMetrics metrics(app.getSorobanMetrics());
334334
auto timeScope = metrics.getExecTimer();
335-
auto const& sorobanConfig =
336-
app.getLedgerManager().getSorobanNetworkConfig();
335+
auto sorobanConfig = app.getSorobanNetworkConfig();
337336

338337
// Get the entries for the footprint
339338
rust::Vec<CxxBuf> ledgerEntryCxxBufs;

src/transactions/RestoreFootprintOpFrame.cpp

+4-8
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,13 @@ RestoreFootprintOpFrame::doApply(
5757
{
5858
ZoneNamedN(applyZone, "RestoreFootprintOpFrame apply", true);
5959

60-
RestoreFootprintMetrics metrics(app.getLedgerManager().getSorobanMetrics());
60+
RestoreFootprintMetrics metrics(app.getSorobanMetrics());
6161
auto timeScope = metrics.getExecTimer();
6262

6363
auto const& resources = mParentTx.sorobanResources();
6464
auto const& footprint = resources.footprint;
6565
auto ledgerSeq = ltx.loadHeader().current().ledgerSeq;
66-
auto const& sorobanConfig =
67-
app.getLedgerManager().getSorobanNetworkConfig();
66+
auto sorobanConfig = app.getSorobanNetworkConfig();
6867
auto const& appConfig = app.getConfig();
6968

7069
auto const& archivalSettings = sorobanConfig.stateArchivalSettings();
@@ -148,14 +147,11 @@ RestoreFootprintOpFrame::doApply(
148147
int64_t rentFee = rust_bridge::compute_rent_fee(
149148
app.getConfig().CURRENT_LEDGER_PROTOCOL_VERSION, ledgerVersion,
150149
rustEntryRentChanges,
151-
app.getLedgerManager()
152-
.getSorobanNetworkConfig()
153-
.rustBridgeRentFeeConfiguration(),
150+
app.getSorobanNetworkConfig().rustBridgeRentFeeConfiguration(),
154151
ledgerSeq);
155152
if (!sorobanData->consumeRefundableSorobanResources(
156153
0, rentFee, ltx.loadHeader().current().ledgerVersion,
157-
app.getLedgerManager().getSorobanNetworkConfig(), app.getConfig(),
158-
mParentTx))
154+
app.getSorobanNetworkConfig(), app.getConfig(), mParentTx))
159155
{
160156
innerResult(res).code(RESTORE_FOOTPRINT_INSUFFICIENT_REFUNDABLE_FEE);
161157
return false;

src/transactions/TransactionFrame.cpp

+4-7
Original file line numberDiff line numberDiff line change
@@ -1445,7 +1445,7 @@ TransactionFrame::checkValidWithOptionallyChargedFee(
14451445
{
14461446
sorobanResourceFee = computePreApplySorobanResourceFee(
14471447
ls.getLedgerHeader().current().ledgerVersion,
1448-
app.getLedgerManager().getSorobanNetworkConfig(), app.getConfig());
1448+
app.getSorobanNetworkConfig(), app.getConfig());
14491449
}
14501450
bool res = commonValid(app, signatureChecker, ls, current, false, chargeFee,
14511451
lowerBoundCloseTimeOffset, upperBoundCloseTimeOffset,
@@ -1504,8 +1504,7 @@ TransactionFrame::checkSorobanResourceAndSetError(
15041504
AppConnector& app, uint32_t ledgerVersion,
15051505
MutableTxResultPtr txResult) const
15061506
{
1507-
auto const& sorobanConfig =
1508-
app.getLedgerManager().getSorobanNetworkConfig();
1507+
auto sorobanConfig = app.getSorobanNetworkConfig();
15091508
if (!validateSorobanResources(sorobanConfig, app.getConfig(), ledgerVersion,
15101509
*txResult->getSorobanData()))
15111510
{
@@ -1712,8 +1711,7 @@ TransactionFrame::applyOperations(SignatureChecker& signatureChecker,
17121711
// If transaction fails, we don't charge for any
17131712
// refundable resources.
17141713
auto preApplyFee = computePreApplySorobanResourceFee(
1715-
ledgerVersion,
1716-
app.getLedgerManager().getSorobanNetworkConfig(),
1714+
ledgerVersion, app.getSorobanNetworkConfig(),
17171715
app.getConfig());
17181716

17191717
txResult.getSorobanData()->setSorobanFeeRefund(
@@ -1831,8 +1829,7 @@ TransactionFrame::apply(AppConnector& app, AbstractLedgerTxn& ltx,
18311829
isSoroban())
18321830
{
18331831
sorobanResourceFee = computePreApplySorobanResourceFee(
1834-
ledgerVersion, app.getLedgerManager().getSorobanNetworkConfig(),
1835-
app.getConfig());
1832+
ledgerVersion, app.getSorobanNetworkConfig(), app.getConfig());
18361833

18371834
auto& sorobanData = *txResult->getSorobanData();
18381835
sorobanData.setSorobanConsumedNonRefundableFee(

src/transactions/TransactionSQL.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -348,20 +348,23 @@ void
348348
dropSupportTransactionFeeHistory(Database& db)
349349
{
350350
ZoneScoped;
351-
db.getSession() << "DROP TABLE IF EXISTS txfeehistory";
351+
releaseAssert(threadIsMain());
352+
db.getRawSession() << "DROP TABLE IF EXISTS txfeehistory";
352353
}
353354

354355
void
355356
dropSupportTxSetHistory(Database& db)
356357
{
357358
ZoneScoped;
358-
db.getSession() << "DROP TABLE IF EXISTS txsethistory";
359+
releaseAssert(threadIsMain());
360+
db.getRawSession() << "DROP TABLE IF EXISTS txsethistory";
359361
}
360362

361363
void
362364
dropSupportTxHistory(Database& db)
363365
{
364366
ZoneScoped;
365-
db.getSession() << "DROP TABLE IF EXISTS txhistory";
367+
releaseAssert(threadIsMain());
368+
db.getRawSession() << "DROP TABLE IF EXISTS txhistory";
366369
}
367370
}

src/transactions/TransactionUtils.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1985,7 +1985,7 @@ isTransactionXDRValidForCurrentProtocol(AppConnector& app,
19851985
{
19861986
uint32_t maxProtocol = app.getConfig().CURRENT_LEDGER_PROTOCOL_VERSION;
19871987
uint32_t currProtocol =
1988-
app.getLedgerManager().getLastClosedLedgerHeader().header.ledgerVersion;
1988+
app.getLastClosedLedgerHeader().header.ledgerVersion;
19891989
// If we could parse the XDR when ledger is using the maximum supported
19901990
// protocol version, then XDR has to be valid.
19911991
// This check also is pointless before protocol 21 as Soroban environment

0 commit comments

Comments
 (0)