diff --git a/.clang-format b/.clang-format index 77d9fe93f8..0821d52229 100644 --- a/.clang-format +++ b/.clang-format @@ -107,4 +107,5 @@ SpacesInSquareBrackets: false Standard: Cpp11 TabWidth: 8 UseTab: Never +UseCRLF: false ... diff --git a/Builds/VisualStudio/stellar-core.vcxproj b/Builds/VisualStudio/stellar-core.vcxproj index adf5effae0..636d3e59b4 100644 --- a/Builds/VisualStudio/stellar-core.vcxproj +++ b/Builds/VisualStudio/stellar-core.vcxproj @@ -1187,6 +1187,39 @@ exit /b 0 + + false + Document + false + false + false + false + sh ../../hash-xdrs.sh ../../src/protocol-curr > src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp + running hash-xdrs.sh + src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp + src/$(Configuration)/generated/xdr/Stellar-overlay.h;src/$(Configuration)/generated/xdr/Stellar-transaction.h;src/$(Configuration)/generated/xdr/Stellar-ledger.h;src/$(Configuration)/generated/xdr/Stellar-ledger-entries.h;src/$(Configuration)/generated/xdr/Stellar-SCP.h;src/$(Configuration)/generated/xdr/Stellar-types.h + None + sh ../../hash-xdrs.sh ../../src/protocol-next > src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp + running hash-xdrs.sh + src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp + src/$(Configuration)/generated/xdr/Stellar-overlay.h;src/$(Configuration)/generated/xdr/Stellar-transaction.h;src/$(Configuration)/generated/xdr/Stellar-ledger.h;src/$(Configuration)/generated/xdr/Stellar-ledger-entries.h;src/$(Configuration)/generated/xdr/Stellar-SCP.h;src/$(Configuration)/generated/xdr/Stellar-types.h + None + sh ../../hash-xdrs.sh ../../src/protocol-curr > src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp + running hash-xdrs.sh + src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp + src/$(Configuration)/generated/xdr/Stellar-overlay.h;src/$(Configuration)/generated/xdr/Stellar-transaction.h;src/$(Configuration)/generated/xdr/Stellar-ledger.h;src/$(Configuration)/generated/xdr/Stellar-ledger-entries.h;src/$(Configuration)/generated/xdr/Stellar-SCP.h;src/$(Configuration)/generated/xdr/Stellar-types.h + None + sh ../../hash-xdrs.sh ../../src/protocol-next > src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp + running hash-xdrs.sh + src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp + src/$(Configuration)/generated/xdr/Stellar-overlay.h;src/$(Configuration)/generated/xdr/Stellar-transaction.h;src/$(Configuration)/generated/xdr/Stellar-ledger.h;src/$(Configuration)/generated/xdr/Stellar-ledger-entries.h;src/$(Configuration)/generated/xdr/Stellar-SCP.h;src/$(Configuration)/generated/xdr/Stellar-types.h + None + sh ../../hash-xdrs.sh ../../src/protocol-next > src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp + running hash-xdrs.sh + src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp + src/$(Configuration)/generated/xdr/Stellar-overlay.h;src/$(Configuration)/generated/xdr/Stellar-transaction.h;src/$(Configuration)/generated/xdr/Stellar-ledger.h;src/$(Configuration)/generated/xdr/Stellar-ledger-entries.h;src/$(Configuration)/generated/xdr/Stellar-SCP.h;src/$(Configuration)/generated/xdr/Stellar-types.h + None + @@ -1422,19 +1455,6 @@ exit /b 0 src/$(Configuration)/generated/xdr/Stellar-types.h ClInclude - - Document - sh ../../hash-xdrs.sh ../../src/protocol-next > src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp - sh ../../hash-xdrs.sh ../../src/protocol-next > src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp - sh ../../hash-xdrs.sh ../../src/protocol-next > src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp - sh ../../hash-xdrs.sh ../../src/protocol-curr > src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp - sh ../../hash-xdrs.sh ../../src/protocol-curr > src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp - running hash-xdrs.sh - src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp - src/$(Configuration)/generated/xdr/Stellar-overlay.h;src/$(Configuration)/generated/xdr/Stellar-transaction.h;src/$(Configuration)/generated/xdr/Stellar-ledger.h;src/$(Configuration)/generated/xdr/Stellar-ledger-entries.h;src/$(Configuration)/generated/xdr/Stellar-SCP.h;src/$(Configuration)/generated/xdr/Stellar-types.h - ClCompile - - Document sed.exe -e "s/%%%%VERSION%%%%/msvc custom/" < %(FullPath) > %(RelativeDir)\StellarCoreVersion.cpp diff --git a/Builds/VisualStudio/stellar-core.vcxproj.filters b/Builds/VisualStudio/stellar-core.vcxproj.filters index 8656412692..e601a5beee 100644 --- a/Builds/VisualStudio/stellar-core.vcxproj.filters +++ b/Builds/VisualStudio/stellar-core.vcxproj.filters @@ -1287,6 +1287,7 @@ overlay\tests + @@ -2222,9 +2223,6 @@ xdr\generated - - xdr\generated - util\xdrquery @@ -2449,6 +2447,7 @@ util\xdrquery + diff --git a/INSTALL-Windows.md b/INSTALL-Windows.md index de715af92d..ec3f61a495 100644 --- a/INSTALL-Windows.md +++ b/INSTALL-Windows.md @@ -12,6 +12,22 @@ * Windows 10 SDK * C++/CLI Support +# Configure Git + +Some functionality depends on Linux file endings, as such you need to configure git with: +``` +[core] + eol = lf + autocrlf = input +``` +NB: if you change this setting in an existing working folder, you need to reset it to have the proper line ending. +This can be done with the following sequence: +``` +git checkout-index --force --all +git rm --cached -r . +git reset --hard +``` + ## Download and install rust Easiest is to use rustup, found on [rust-lang.org](https://www.rust-lang.org/tools/install). @@ -78,8 +94,8 @@ If you do not have cURL installed ## clang-format For making changes to the code, you should install the clang-format tool and Visual Studio extension, you can find both at http://llvm.org/builds/ -* note that the version of clang-format used currently is 8.0 (other versions may not format the same way). -* we recommend downloading 8.0 from http://releases.llvm.org/download.html +* note that the version of clang-format used currently is 10.0 (other versions may not format the same way). +* we recommend downloading 10.0 from http://releases.llvm.org/download.html # Build on Windows using the Windows Subsystem for Linux To setup the subsystem, go to https://msdn.microsoft.com/en-us/commandline/wsl/install_guide diff --git a/ci-build.sh b/ci-build.sh index c754a7eeee..b6fc5cfa3a 100755 --- a/ci-build.sh +++ b/ci-build.sh @@ -151,6 +151,14 @@ then exit 1 fi +crlf=$(find . ! \( -type d -o -path './.git/*' -o -path './Builds/*' -o -path './lib/*' \) -print0 | xargs -0 -n1 -P9 file "{}" | grep CRLF || true) +if [ -n "$crlf" ] +then + echo "Found some files with Windows line endings:" + echo "$crlf" + exit 1 +fi + date time make -j$(($NPROCS + 1)) diff --git a/src/herder/TransactionQueue.cpp b/src/herder/TransactionQueue.cpp index 0e29f28d9b..874867d8a0 100644 --- a/src/herder/TransactionQueue.cpp +++ b/src/herder/TransactionQueue.cpp @@ -936,7 +936,7 @@ TransactionQueue::getMaxOpsToFloodThisPeriod() const Rounding::ROUND_UP); releaseAssertOrThrow(opsToFlood >= 0 && opsToFlood <= std::numeric_limits::max()); - return opsToFlood; + return static_cast(opsToFlood); } TransactionQueue::BroadcastStatus diff --git a/src/herder/TxSetFrame.cpp b/src/herder/TxSetFrame.cpp index c2b25fb9f1..396e3eff8c 100644 --- a/src/herder/TxSetFrame.cpp +++ b/src/herder/TxSetFrame.cpp @@ -795,7 +795,8 @@ TxSetFrame::applySurgePricing(Application& app) return; } - size_t maxOps = app.getLedgerManager().getLastMaxTxSetSizeOps(); + uint32_t maxOps = + static_cast(app.getLedgerManager().getLastMaxTxSetSizeOps()); auto const& lclHeader = app.getLedgerManager().getLastClosedLedgerHeader().header; diff --git a/src/herder/test/HerderTests.cpp b/src/herder/test/HerderTests.cpp index 99179f462e..6f162f09ec 100644 --- a/src/herder/test/HerderTests.cpp +++ b/src/herder/test/HerderTests.cpp @@ -2213,10 +2213,12 @@ TEST_CASE("SCP State", "[herder][acceptance]") { configure(Config::TestDbMode::TESTDB_ON_DISK_SQLITE); } +#ifdef USE_POSTGRES SECTION("postgres") { configure(Config::TestDbMode::TESTDB_POSTGRESQL); } +#endif // add node0 and node1, in lockstep { SCPQuorumSet qSet; diff --git a/src/herder/test/TransactionQueueTests.cpp b/src/herder/test/TransactionQueueTests.cpp index 2882e992a1..5d30920cd0 100644 --- a/src/herder/test/TransactionQueueTests.cpp +++ b/src/herder/test/TransactionQueueTests.cpp @@ -1423,7 +1423,7 @@ TEST_CASE("TransactionQueue limits", "[herder][transactionqueue]") // the limiter, but with `minFee + 1` can be added. Use for checking // that fee threshold is applied even when there is enough space in // the limiter, but some transactions were evicted before. - auto checkMinFeeToFitWithNoEvict = [&](int64_t minFee) { + auto checkMinFeeToFitWithNoEvict = [&](uint32_t minFee) { std::vector txsToEvict; // 0 fee is a special case as transaction shouldn't have 0 fee. // Hence we only check that fee of 1 allows transaction to be added. diff --git a/src/test/TxTests.cpp b/src/test/TxTests.cpp index 62edab092a..3b2d205df2 100644 --- a/src/test/TxTests.cpp +++ b/src/test/TxTests.cpp @@ -602,7 +602,7 @@ getAccountSigners(PublicKey const& k, Application& app) TransactionFramePtr transactionFromOperationsV0(Application& app, SecretKey const& from, SequenceNumber seq, - const std::vector& ops, int fee) + const std::vector& ops, uint32_t fee) { TransactionEnvelope e(ENVELOPE_TYPE_TX_V0); e.v0().tx.sourceAccountEd25519 = from.getPublicKey().ed25519(); @@ -624,7 +624,7 @@ transactionFromOperationsV0(Application& app, SecretKey const& from, TransactionFramePtr transactionFromOperationsV1(Application& app, SecretKey const& from, SequenceNumber seq, - const std::vector& ops, int fee, + const std::vector& ops, uint32_t fee, std::optional cond) { TransactionEnvelope e(ENVELOPE_TYPE_TX); @@ -653,7 +653,7 @@ transactionFromOperationsV1(Application& app, SecretKey const& from, TransactionFramePtr transactionFromOperations(Application& app, SecretKey const& from, SequenceNumber seq, const std::vector& ops, - int fee) + uint32_t fee) { uint32_t ledgerVersion; { diff --git a/src/test/TxTests.h b/src/test/TxTests.h index 03a131c38a..3506e08e75 100644 --- a/src/test/TxTests.h +++ b/src/test/TxTests.h @@ -122,20 +122,19 @@ bool doesAccountExist(Application& app, PublicKey const& k); xdr::xvector getAccountSigners(PublicKey const& k, Application& app); -TransactionFramePtr -transactionFromOperationsV0(Application& app, SecretKey const& from, - SequenceNumber seq, - std::vector const& ops, int fee = 0); +TransactionFramePtr transactionFromOperationsV0( + Application& app, SecretKey const& from, SequenceNumber seq, + std::vector const& ops, uint32_t fee = 0); TransactionFramePtr transactionFromOperationsV1(Application& app, SecretKey const& from, SequenceNumber seq, - std::vector const& ops, int fee, + std::vector const& ops, uint32_t fee, std::optional cond = std::nullopt); TransactionFramePtr transactionFromOperations(Application& app, SecretKey const& from, SequenceNumber seq, std::vector const& ops, - int fee = 0); + uint32_t fee = 0); TransactionFramePtr transactionWithV2Precondition(Application& app, TestAccount& account, int64_t sequenceDelta, diff --git a/src/transactions/InvokeHostFunctionOpFrame.cpp b/src/transactions/InvokeHostFunctionOpFrame.cpp index 3129c94724..61ec32060d 100644 --- a/src/transactions/InvokeHostFunctionOpFrame.cpp +++ b/src/transactions/InvokeHostFunctionOpFrame.cpp @@ -92,7 +92,7 @@ InvokeHostFunctionOpFrame::doApply(AbstractLedgerTxn& ltx) toXDRBuf(mInvokeHostFunction.parameters), toXDRBuf(mInvokeHostFunction.footprint), ledgerEntryXdrBufs); } - catch (std::exception& e) + catch (std::exception&) { innerResult().code(INVOKE_HOST_FUNCTION_TRAPPED); return false; diff --git a/src/transactions/TrustFlagsOpFrameBase.cpp b/src/transactions/TrustFlagsOpFrameBase.cpp index cde7249818..ba3a64dd1e 100644 --- a/src/transactions/TrustFlagsOpFrameBase.cpp +++ b/src/transactions/TrustFlagsOpFrameBase.cpp @@ -1,136 +1,136 @@ -// Copyright 2022 Stellar Development Foundation and contributors. Licensed -// under the Apache License, Version 2.0. See the COPYING file at the root -// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 - -#include "transactions/TrustFlagsOpFrameBase.h" -#include "ledger/LedgerTxn.h" -#include "transactions/TransactionUtils.h" -#include "util/ProtocolVersion.h" -#include - -namespace stellar -{ - -TrustFlagsOpFrameBase::TrustFlagsOpFrameBase(Operation const& op, - OperationResult& res, - TransactionFrame& parentTx) - : OperationFrame(op, res, parentTx) -{ -} - -ThresholdLevel -TrustFlagsOpFrameBase::getThresholdLevel() const -{ - return ThresholdLevel::LOW; -} - -bool -TrustFlagsOpFrameBase::removeOffers(AbstractLedgerTxn& ltx) -{ - // Delete all offers owned by the trustor that are either buying or - // selling the asset which had authorization revoked. Also redeem pool - // share trustlines owned by the trustor that use this asset - auto res = removeOffersAndPoolShareTrustLines( - ltx, getOpTrustor(), getOpAsset(), mParentTx.getSourceID(), - mParentTx.getSeqNum(), getOpIndex()); - - switch (res) - { - case RemoveResult::SUCCESS: - break; - case RemoveResult::LOW_RESERVE: - setResultLowReserve(); - return false; - case RemoveResult::TOO_MANY_SPONSORING: - mResult.code(opTOO_MANY_SPONSORING); - return false; - default: - throw std::runtime_error("Unexpected RemoveResult"); - } - return true; -} - -bool -TrustFlagsOpFrameBase::doApply(AbstractLedgerTxn& ltx) -{ - ZoneNamedN(applyZone, "TrustFlagsOpFrameBase apply", true); - - auto ledgerVersion = ltx.loadHeader().current().ledgerVersion; - if (protocolVersionStartsFrom(ledgerVersion, ProtocolVersion::V_3)) - { - // Only relevant for AllowTrust, since version 3 it is not allowed - // to use AllowTrust on self. - // In SetTrustLineFlags (exists since version 17), trust-to-self is - // explicitly disallowed in doCheckValid. - if (getOpTrustor() == getSourceID()) - { - setResultSelfNotAllowed(); - return false; - } - } - - bool authRevocable = true; - if (!isAuthRevocationValid(ltx, authRevocable)) - { - return false; - } - - if (getOpTrustor() == getSourceID()) - { - // Only relevant for AllowTrust, possible for version <= 2. - // In SetTrustLineFlags, trust-to-self is explicitly disallowed - // in doCheckValid. - setResultSuccess(); - return true; - } - - auto key = trustlineKey(getOpTrustor(), getOpAsset()); - bool shouldRemoveOffers = false; - uint32_t expectedFlagValue = 0; - { - // trustline is loaded in this inner scope because it can be loaded - // again in removeOffers - auto const trust = ltx.load(key); - if (!trust) - { - setResultNoTrustLine(); - return false; - } - - // Calc expected flag value of this trustline. - if (!calcExpectedFlagValue(trust, expectedFlagValue)) - { - return false; - } - - // Check the auth revoc valid for the 2nd time, only needed for - // AllowTrust - if (!isRevocationToMaintainLiabilitiesValid(authRevocable, trust, - expectedFlagValue)) - { - return false; - } - - // Check if need to remove offer - shouldRemoveOffers = - isAuthorizedToMaintainLiabilities(trust) && - !isAuthorizedToMaintainLiabilitiesUnsafe(expectedFlagValue); - } - - // Remove offers, the ledgerVersion check is only relevant for AllowTrust - if (protocolVersionStartsFrom(ledgerVersion, ProtocolVersion::V_10) && - shouldRemoveOffers) - { - if (!removeOffers(ltx)) - { - return false; - } - } - - // Set value - setFlagValue(ltx, key, expectedFlagValue); - setResultSuccess(); - return true; -} - -} +// Copyright 2022 Stellar Development Foundation and contributors. Licensed +// under the Apache License, Version 2.0. See the COPYING file at the root +// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 + +#include "transactions/TrustFlagsOpFrameBase.h" +#include "ledger/LedgerTxn.h" +#include "transactions/TransactionUtils.h" +#include "util/ProtocolVersion.h" +#include + +namespace stellar +{ + +TrustFlagsOpFrameBase::TrustFlagsOpFrameBase(Operation const& op, + OperationResult& res, + TransactionFrame& parentTx) + : OperationFrame(op, res, parentTx) +{ +} + +ThresholdLevel +TrustFlagsOpFrameBase::getThresholdLevel() const +{ + return ThresholdLevel::LOW; +} + +bool +TrustFlagsOpFrameBase::removeOffers(AbstractLedgerTxn& ltx) +{ + // Delete all offers owned by the trustor that are either buying or + // selling the asset which had authorization revoked. Also redeem pool + // share trustlines owned by the trustor that use this asset + auto res = removeOffersAndPoolShareTrustLines( + ltx, getOpTrustor(), getOpAsset(), mParentTx.getSourceID(), + mParentTx.getSeqNum(), getOpIndex()); + + switch (res) + { + case RemoveResult::SUCCESS: + break; + case RemoveResult::LOW_RESERVE: + setResultLowReserve(); + return false; + case RemoveResult::TOO_MANY_SPONSORING: + mResult.code(opTOO_MANY_SPONSORING); + return false; + default: + throw std::runtime_error("Unexpected RemoveResult"); + } + return true; +} + +bool +TrustFlagsOpFrameBase::doApply(AbstractLedgerTxn& ltx) +{ + ZoneNamedN(applyZone, "TrustFlagsOpFrameBase apply", true); + + auto ledgerVersion = ltx.loadHeader().current().ledgerVersion; + if (protocolVersionStartsFrom(ledgerVersion, ProtocolVersion::V_3)) + { + // Only relevant for AllowTrust, since version 3 it is not allowed + // to use AllowTrust on self. + // In SetTrustLineFlags (exists since version 17), trust-to-self is + // explicitly disallowed in doCheckValid. + if (getOpTrustor() == getSourceID()) + { + setResultSelfNotAllowed(); + return false; + } + } + + bool authRevocable = true; + if (!isAuthRevocationValid(ltx, authRevocable)) + { + return false; + } + + if (getOpTrustor() == getSourceID()) + { + // Only relevant for AllowTrust, possible for version <= 2. + // In SetTrustLineFlags, trust-to-self is explicitly disallowed + // in doCheckValid. + setResultSuccess(); + return true; + } + + auto key = trustlineKey(getOpTrustor(), getOpAsset()); + bool shouldRemoveOffers = false; + uint32_t expectedFlagValue = 0; + { + // trustline is loaded in this inner scope because it can be loaded + // again in removeOffers + auto const trust = ltx.load(key); + if (!trust) + { + setResultNoTrustLine(); + return false; + } + + // Calc expected flag value of this trustline. + if (!calcExpectedFlagValue(trust, expectedFlagValue)) + { + return false; + } + + // Check the auth revoc valid for the 2nd time, only needed for + // AllowTrust + if (!isRevocationToMaintainLiabilitiesValid(authRevocable, trust, + expectedFlagValue)) + { + return false; + } + + // Check if need to remove offer + shouldRemoveOffers = + isAuthorizedToMaintainLiabilities(trust) && + !isAuthorizedToMaintainLiabilitiesUnsafe(expectedFlagValue); + } + + // Remove offers, the ledgerVersion check is only relevant for AllowTrust + if (protocolVersionStartsFrom(ledgerVersion, ProtocolVersion::V_10) && + shouldRemoveOffers) + { + if (!removeOffers(ltx)) + { + return false; + } + } + + // Set value + setFlagValue(ltx, key, expectedFlagValue); + setResultSuccess(); + return true; +} + +} diff --git a/src/transactions/TrustFlagsOpFrameBase.h b/src/transactions/TrustFlagsOpFrameBase.h index 70c9317b4a..94b3148cf9 100644 --- a/src/transactions/TrustFlagsOpFrameBase.h +++ b/src/transactions/TrustFlagsOpFrameBase.h @@ -1,42 +1,42 @@ -#pragma once - -// Copyright 2022 Stellar Development Foundation and contributors. Licensed -// under the Apache License, Version 2.0. See the COPYING file at the root -// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 - -#include "transactions/OperationFrame.h" - -namespace stellar -{ -class TrustFlagsOpFrameBase : public OperationFrame -{ - private: - virtual void setResultSelfNotAllowed() = 0; - virtual void setResultNoTrustLine() = 0; - virtual void setResultLowReserve() = 0; - virtual void setResultSuccess() = 0; - virtual bool isAuthRevocationValid(AbstractLedgerTxn& ltx, - bool& authRevocable) = 0; - virtual bool isRevocationToMaintainLiabilitiesValid( - bool authRevocable, LedgerTxnEntry const& trust, uint32_t flags) = 0; - - virtual AccountID const& getOpTrustor() const = 0; - virtual Asset const& getOpAsset() const = 0; - virtual uint32_t getOpIndex() const = 0; - - virtual bool calcExpectedFlagValue(LedgerTxnEntry const& trust, - uint32_t& expectedVal) = 0; - virtual void setFlagValue(AbstractLedgerTxn& ltx, LedgerKey const& key, - uint32_t flagVal) = 0; - - bool removeOffers(AbstractLedgerTxn& ltx); - ThresholdLevel getThresholdLevel() const override; - - public: - TrustFlagsOpFrameBase(Operation const& op, OperationResult& res, - TransactionFrame& parentTx); - - bool doApply(AbstractLedgerTxn& ltx) override; -}; - +#pragma once + +// Copyright 2022 Stellar Development Foundation and contributors. Licensed +// under the Apache License, Version 2.0. See the COPYING file at the root +// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 + +#include "transactions/OperationFrame.h" + +namespace stellar +{ +class TrustFlagsOpFrameBase : public OperationFrame +{ + private: + virtual void setResultSelfNotAllowed() = 0; + virtual void setResultNoTrustLine() = 0; + virtual void setResultLowReserve() = 0; + virtual void setResultSuccess() = 0; + virtual bool isAuthRevocationValid(AbstractLedgerTxn& ltx, + bool& authRevocable) = 0; + virtual bool isRevocationToMaintainLiabilitiesValid( + bool authRevocable, LedgerTxnEntry const& trust, uint32_t flags) = 0; + + virtual AccountID const& getOpTrustor() const = 0; + virtual Asset const& getOpAsset() const = 0; + virtual uint32_t getOpIndex() const = 0; + + virtual bool calcExpectedFlagValue(LedgerTxnEntry const& trust, + uint32_t& expectedVal) = 0; + virtual void setFlagValue(AbstractLedgerTxn& ltx, LedgerKey const& key, + uint32_t flagVal) = 0; + + bool removeOffers(AbstractLedgerTxn& ltx); + ThresholdLevel getThresholdLevel() const override; + + public: + TrustFlagsOpFrameBase(Operation const& op, OperationResult& res, + TransactionFrame& parentTx); + + bool doApply(AbstractLedgerTxn& ltx) override; +}; + } \ No newline at end of file