1#include <xrpl/tx/invariants/PermissionedDomainInvariant.h>
3#include <xrpl/basics/Log.h>
4#include <xrpl/beast/utility/Journal.h>
5#include <xrpl/ledger/ReadView.h>
6#include <xrpl/ledger/helpers/CredentialHelpers.h>
7#include <xrpl/protocol/Feature.h>
8#include <xrpl/protocol/LedgerFormats.h>
9#include <xrpl/protocol/Protocol.h>
10#include <xrpl/protocol/SField.h>
11#include <xrpl/protocol/STArray.h>
12#include <xrpl/protocol/STLedgerEntry.h>
13#include <xrpl/protocol/STTx.h>
14#include <xrpl/protocol/TER.h>
15#include <xrpl/protocol/TxFormats.h>
16#include <xrpl/protocol/XRPAmount.h>
25 if (before && before->getType() != ltPERMISSIONED_DOMAIN)
27 if (
after &&
after->getType() != ltPERMISSIONED_DOMAIN)
31 auto const&
credentials = sle->getFieldArray(sfAcceptedCredentials);
37 .isUnique = !sorted.empty(),
44 for (
auto const& cred : sorted)
48 (cred.first == credTx[sfIssuer]) && (cred.second == credTx[sfCredentialType]);
71 JLOG(j.
fatal()) <<
"Invariant failed: permissioned domain with "
78 JLOG(j.
fatal()) <<
"Invariant failed: permissioned domain bad "
86 JLOG(j.
fatal()) <<
"Invariant failed: permissioned domain credentials "
93 JLOG(j.
fatal()) <<
"Invariant failed: permissioned domain credentials "
112 JLOG(j.
fatal()) <<
"Invariant failed: transaction affected more "
113 "than 1 permissioned domain entry.";
119 case ttPERMISSIONED_DOMAIN_SET: {
122 JLOG(j.
fatal()) <<
"Invariant failed: no domain objects affected by "
123 "PermissionedDomainSet";
130 JLOG(j.
fatal()) <<
"Invariant failed: domain object "
131 "deleted by PermissionedDomainSet";
134 return check(sleStatus, j);
136 case ttPERMISSIONED_DOMAIN_DELETE: {
139 JLOG(j.
fatal()) <<
"Invariant failed: no domain objects affected by "
140 "PermissionedDomainDelete";
146 JLOG(j.
fatal()) <<
"Invariant failed: domain object "
147 "modified, but not deleted by "
148 "PermissionedDomainDelete";
157 <<
" domain object(s) affected by an "
158 "unauthorized transaction. "
A generic endpoint for log messages.
virtual Rules const & rules() const =0
Returns the tx processing rules.
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
std::shared_ptr< STLedgerEntry const > const & const_ref
TxType getTxnType() const
std::vector< SleStatus > sleStatus_
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
void visitEntry(bool, SLE::const_ref, SLE::const_ref)
T emplace_back(T... args)
std::set< std::pair< AccountID, Slice > > makeSorted(STArray const &credentials)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
bool isTesSuccess(TER x) noexcept
TERSubset< CanCvtToTER > TER
constexpr std::size_t kMaxPermissionedDomainCredentialsArraySize
The maximum number of credentials can be passed in array for permissioned domain.
std::size_t credentialsSize