mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-09 11:46:49 +00:00
The invariant check system had grown into a single monolithic file pair containing 24 invariant checker classes. The large `InvariantCheck.cpp` file was a frequent source of merge conflicts and difficult to navigate. This refactoring improves maintainability and readability with zero behavioral changes. In particular, this change: - Splits `InvariantCheck.h` and `InvariantCheck.cpp` into 10 focused header/source pairs organized by domain under a new `invariants/` subdirectory. - Extracts the shared `Privilege` enum and `hasPrivilege()` function into a dedicated `InvariantCheckPrivilege.h` header, so domain-specific files can reference them independently.
42 lines
1014 B
C++
42 lines
1014 B
C++
#pragma once
|
|
|
|
#include <xrpl/beast/utility/Journal.h>
|
|
#include <xrpl/ledger/ReadView.h>
|
|
#include <xrpl/protocol/STTx.h>
|
|
#include <xrpl/protocol/TER.h>
|
|
|
|
#include <vector>
|
|
|
|
namespace xrpl {
|
|
|
|
/**
|
|
* @brief Invariants: Permissioned Domains must have some rules and
|
|
* AcceptedCredentials must have length between 1 and 10 inclusive.
|
|
*
|
|
* Since only permissions constitute rules, an empty credentials list
|
|
* means that there are no rules and the invariant is violated.
|
|
*
|
|
* Credentials must be sorted and no duplicates allowed
|
|
*
|
|
*/
|
|
class ValidPermissionedDomain
|
|
{
|
|
struct SleStatus
|
|
{
|
|
std::size_t credentialsSize_{0};
|
|
bool isSorted_ = false;
|
|
bool isUnique_ = false;
|
|
bool isDelete_ = false;
|
|
};
|
|
std::vector<SleStatus> sleStatus_;
|
|
|
|
public:
|
|
void
|
|
visitEntry(bool, std::shared_ptr<SLE const> const&, std::shared_ptr<SLE const> const&);
|
|
|
|
bool
|
|
finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&);
|
|
};
|
|
|
|
} // namespace xrpl
|