xrpld
Loading...
Searching...
No Matches
xrpl::ValidConfidentialMPToken Class Reference

Invariants: Confidential MPToken consistency. More...

#include <MPTInvariant.h>

Collaboration diagram for xrpl::ValidConfidentialMPToken:

Classes

struct  Changes

Public Member Functions

void visitEntry (bool isDelete, std::shared_ptr< SLE const > const &before, std::shared_ptr< SLE const > const &after)
 Track confidential MPT balance, issuance, and version changes.
bool finalize (STTx const &tx, TER const result, XRPAmount const fee, ReadView const &view, beast::Journal const &j)
 Verify confidential MPT accounting and encrypted-field invariants.

Private Attributes

std::map< uint192, Changeschanges_

Detailed Description

Invariants: Confidential MPToken consistency.

  • Convert/ConvertBack symmetry: Regular MPToken balance change (±X) == COA (Confidential Outstanding Amount) change (∓X)
  • Cannot delete MPToken with non-zero confidential state: Cannot delete if sfIssuerEncryptedBalance exists Cannot delete if sfConfidentialBalanceInbox and sfConfidentialBalanceSpending exist
  • Privacy flag consistency: MPToken confidential balance fields can only be created or changed if lsfMPTCanHoldConfidentialBalance is set on the issuance.
  • Encrypted field existence consistency: If sfConfidentialBalanceSpending/sfConfidentialBalanceInbox exists, then sfIssuerEncryptedBalance must also exist (and vice versa). If sfAuditorEncryptedBalance exists, then those core encrypted balance fields must also exist.
  • COA <= OutstandingAmount: Confidential outstanding balance cannot exceed total outstanding.
  • Verifies sfConfidentialBalanceVersion is changed whenever sfConfidentialBalanceSpending is modified on an MPToken.

Definition at line 142 of file MPTInvariant.h.

Member Function Documentation

◆ visitEntry()

void xrpl::ValidConfidentialMPToken::visitEntry ( bool isDelete,
std::shared_ptr< SLE const > const & before,
std::shared_ptr< SLE const > const & after )

Track confidential MPT balance, issuance, and version changes.

Parameters
isDeleteWhether the ledger entry is being deleted.
beforeThe ledger entry before transaction application.
afterThe ledger entry after transaction application.

Definition at line 519 of file MPTInvariant.cpp.

◆ finalize()

bool xrpl::ValidConfidentialMPToken::finalize ( STTx const & tx,
TER const result,
XRPAmount const fee,
ReadView const & view,
beast::Journal const & j )

Verify confidential MPT accounting and encrypted-field invariants.

Parameters
txThe transaction being checked.
resultThe transaction result code.
feeThe fee charged by the transaction.
viewThe ledger view after transaction application.
jJournal used for diagnostics.
Returns
true if the invariant checks pass, otherwise false.

Definition at line 647 of file MPTInvariant.cpp.

Member Data Documentation

◆ changes_

std::map<uint192, Changes> xrpl::ValidConfidentialMPToken::changes_
private

Definition at line 156 of file MPTInvariant.h.