1#include <xrpl/tx/invariants/PermissionedDomainInvariant.h>
3#include <xrpl/beast/utility/instrumentation.h>
4#include <xrpl/ledger/helpers/CredentialHelpers.h>
5#include <xrpl/protocol/Feature.h>
6#include <xrpl/protocol/STArray.h>
7#include <xrpl/protocol/TxFormats.h>
17 if (before && before->getType() != ltPERMISSIONED_DOMAIN)
19 if (
after &&
after->getType() != ltPERMISSIONED_DOMAIN)
23 auto const& credentials = sle->getFieldArray(sfAcceptedCredentials);
26 SleStatus ss{credentials.size(),
false, !sorted.empty(), isDel};
32 for (
auto const& cred : sorted)
34 auto const& credTx = credentials[i++];
36 (cred.first == credTx[sfIssuer]) && (cred.second == credTx[sfCredentialType]);
59 JLOG(j.
fatal()) <<
"Invariant failed: permissioned domain with "
66 JLOG(j.
fatal()) <<
"Invariant failed: permissioned domain bad "
74 JLOG(j.
fatal()) <<
"Invariant failed: permissioned domain credentials "
81 JLOG(j.
fatal()) <<
"Invariant failed: permissioned domain credentials "
89 if (view.
rules().
enabled(fixPermissionedDomainInvariant))
100 JLOG(j.
fatal()) <<
"Invariant failed: transaction affected more "
101 "than 1 permissioned domain entry.";
107 case ttPERMISSIONED_DOMAIN_SET: {
110 JLOG(j.
fatal()) <<
"Invariant failed: no domain objects affected by "
111 "PermissionedDomainSet";
118 JLOG(j.
fatal()) <<
"Invariant failed: domain object "
119 "deleted by PermissionedDomainSet";
122 return check(sleStatus, j);
124 case ttPERMISSIONED_DOMAIN_DELETE: {
127 JLOG(j.
fatal()) <<
"Invariant failed: no domain objects affected by "
128 "PermissionedDomainDelete";
134 JLOG(j.
fatal()) <<
"Invariant failed: domain object "
135 "modified, but not deleted by "
136 "PermissionedDomainDelete";
145 <<
" domain object(s) affected by an "
146 "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.
TxType getTxnType() const
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
std::vector< SleStatus > sleStatus_
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
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?
std::size_t constexpr maxPermissionedDomainCredentialsArraySize
The maximum number of credentials can be passed in array for permissioned domain.
bool isTesSuccess(TER x) noexcept
std::size_t credentialsSize_