Compare commits

...

28 Commits

Author SHA1 Message Date
Ed Hennis
b9a8f88e01 Fix changed field detection, track owner and ticket count changes
- Exclude more fields from the changed field check, which are expected
  even on a failed tx.
2026-08-22 15:21:43 -04:00
Ed Hennis
9a77c56b97 clang-tidy: includes 2026-08-22 14:15:15 -04:00
Ed Hennis
48e1b16430 clang-tidy: headers and function params 2026-08-21 19:36:12 -04:00
Ed Hennis
5175fd134e Merge remote-tracking branch 'XRPLF/develop' into ximinez/failure-invariant
* XRPLF/develop: (40 commits)
  perf: Speed up addition time for drastically different exponents (7825)
  refactor: Collapse transactions.macro settings into a TxSettings struct (8001)
  fix: Enforce MPT balance invariants under the latest cleanup amendment (7889)
  fix: Prevent AMM auction slots from being acquired at zero cost when trading fee is zero (7430)
  docs: Fix yum installation baseurl (8066)
  fix: Return specific and consistent errors from vault_info (8015)
  ci: Save cargo cache only from develop by default (8063)
  fix: Check credential for LoanBrokerCoverWithdraw and VaultWithdraw (7107)
  build: Suppress MSVC linker warning LNK4099 (8049)
  chore: [DEPENDABOT] Bump cxx from 1.0.198 to 1.0.199 in /crates in the rust-dependencies group across 1 directory (8050)
  build: Use debian `any` distribution & signed (hosted) rpm repo (8053)
  ci: Do not cache cargo binaries (8062)
  build: Compress the RPM payload with zstd (8047)
  chore: Rust-C++ cmake and CI integration (7034)
  refactor: Extract invariant invocation into free checkInvariants runner (7404)
  docs: Rewrite the install guide (8048)
  build: Sign RPM packages (8046)
  fix: Exempt loan default from asset freeze (7932)
  fix: Reject VaultWithdraw fixed-share amounts that round to zero (7950)
  build: Use AlmaLinux for the RHEL packaging image (8045)
  ...
2026-08-20 22:48:15 -04:00
Ed Hennis
d27beef500 perf: Speed up addition time for drastically different exponents (#7825) 2026-08-20 19:40:42 +00:00
Mayukha Vadari
85512541ad refactor: Collapse transactions.macro settings into a TxSettings struct (#8001)
Co-authored-by: Timur Yalymov <36795566+tyalymov@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
2026-08-20 19:25:27 +00:00
Gregory Tsipenyuk
3ab5288ef2 fix: Enforce MPT balance invariants under the latest cleanup amendment (#7889) 2026-08-20 19:05:28 +00:00
Kassaking7
d0dbf9163c fix: Prevent AMM auction slots from being acquired at zero cost when trading fee is zero (#7430) 2026-08-20 19:04:04 +00:00
Ed Hennis
99b2935f9f test: Add unit tests for the FailedTransaction invariant
Add a new InvariantsFailedTransaction test suite covering every
reachable failure case of the FailedTransaction invariant: each string
appended to errors_ in visitEntry, and each place finalize() sets its
result to false.

The suite follows the doInvariantCheck-based structure from
Invariants_test.cpp, adapted to seed the first checker pass with a tec
code (the invariant only inspects failed transactions) and to always
enable featureTecInvariant.

Three visitEntry error sites are documented as unreachable through the
full invariant suite: the "not comparable" balance check (shadowed by an
exception from XRPNotCreated), the UNREACHABLE/LCOV_EXCL format==nullptr
branch, and the dead "field modified" loop.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-20 14:35:00 -04:00
Ayaz Salikhov
a1478fac39 docs: Fix yum installation baseurl (#8066) 2026-08-20 16:28:43 +00:00
Timur Yalymov
cc76708563 fix: Return specific and consistent errors from vault_info (#8015)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-20 16:05:18 +00:00
Sergey Kuznetsov
422e5245e4 ci: Save cargo cache only from develop by default (#8063) 2026-08-20 16:02:26 +00:00
Shawn Xie
e3ba569187 fix: Check credential for LoanBrokerCoverWithdraw and VaultWithdraw (#7107)
Co-authored-by: Peter Chen <ychen@ripple.com>
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
2026-08-20 15:33:46 +00:00
Ed Hennis
76c2064098 Fix some newly merged in tests for the tec invariant 2026-08-12 18:59:25 -04:00
Ed Hennis
24ee731ab4 Rename fixTecInvariant to featureTecInvariant 2026-08-12 18:47:41 -04:00
Ed Hennis
cc192b21d0 Merge branch 'develop' into ximinez/failure-invariant 2026-08-12 14:41:42 -04:00
Ed Hennis
d634cd0e65 Revert "refactor: Rewrite Transactor::operator() to early return"
This reverts commit 7db060a6c2.
2026-08-12 14:39:58 -04:00
Ed Hennis
d7226aaf0e Revert "Return a lambda call "logger" so that the log message is correct"
This reverts commit 00aa62b68a.
2026-08-12 14:39:54 -04:00
Ed Hennis
340d5a87df Merge branch 'ximinez/txrefactor' into ximinez/failure-invariant 2026-08-11 11:08:56 -04:00
Ed Hennis
00aa62b68a Return a lambda call "logger" so that the log message is correct 2026-08-11 11:04:43 -04:00
Ed Hennis
ccf21b1abf Merge branch 'ximinez/txrefactor' into ximinez/failure-invariant 2026-08-11 10:52:54 -04:00
Ed Hennis
447a86d96c Merge branch 'develop' into ximinez/txrefactor 2026-08-11 10:52:24 -04:00
Ed Hennis
5b076dabaf clang-tidy: order of operations 2026-08-10 20:34:44 -04:00
Ed Hennis
6981cfd146 Fix some errors: clang-tidy, deprecation warnings 2026-08-10 14:38:56 -04:00
Ed Hennis
378d9e7600 Create new amendment, handle Sponsorships, fix broken invariant tests
- Generalize the XRP balance change code tests originally for Account Roots
  to allow testing Sponsorships, too.
- Fixing tests still in progress
2026-08-08 16:24:26 -04:00
Ed Hennis
8549988476 Merge branch 'develop' into ximinez/failure-invariant 2026-08-07 22:52:27 -04:00
Ed Hennis
75ece33e09 feat: Add an invariant to enforce failed transaction restrictions
(In progress)
2026-08-07 22:51:11 -04:00
Ed Hennis
7db060a6c2 refactor: Rewrite Transactor::operator() to early return
- Rename "applied" to "canApply" to make it clearer that the transaction
  hasn't applied yet.
- After each step where the result can change, return if it's
  a non-claiming failure.
- Preserve logging.
2026-08-07 20:32:05 -04:00
124 changed files with 3071 additions and 731 deletions

View File

@@ -20,9 +20,10 @@ inputs:
required: false
default: ""
save-if:
description: "Condition for saving the cache after the job."
description: >
Condition for saving the cache after the job. Defaults to save only from develop branch
required: false
default: "true"
default: ${{ github.ref == 'refs/heads/develop' }}
runs:
using: composite

View File

@@ -167,7 +167,6 @@ jobs:
with:
cache-directories: ${{ env.BUILD_DIR }}/corrosion
key: ${{ inputs.config_name }}
save-if: ${{ github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/release') }}
# two workspaces here because build artifacts are located in 2 places:
# - crates/target when cargo is called directly
# - build/cargo when cargo is called by cmake

View File

@@ -63,7 +63,6 @@ jobs:
uses: ./.github/actions/cargo-cache
with:
cache-directories: ${{ env.BUILD_DIR }}/corrosion
save-if: ${{ github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/release') }}
workspaces: crates -> ../${{ env.BUILD_DIR }}/cargo
- name: Setup Conan

View File

@@ -54,6 +54,9 @@ This section contains changes targeting a future version.
- `submit`: The `fail_hard` field now returns an error if the value is not a boolean. [#6529](https://github.com/XRPLF/rippled/pull/6529)
- `subscribe`: The `taker` field in the `books` array now returns `actMalformed` instead of `badIssuer` if the value is not a valid account. [#6529](https://github.com/XRPLF/rippled/pull/6529)
- Fixed a bug in `Forwarded` HTTP header parsing where the extracted IP address could be incorrect when no comma or semicolon delimiter follows the address. This could cause the server to misidentify a client's IP address when operating behind a reverse proxy. [#6529](https://github.com/XRPLF/rippled/pull/6529)
- `vault_info`: Errors now identify what the request got wrong instead of reporting every failure as the unregistered token `malformedRequest`, and the `error`, `error_code` and `error_message` fields now agree with each other. An invalid `vault_id` or `seq` returns `invalidParams`, an invalid `owner` returns `actMalformed`, and a request that mixes `vault_id` with `owner`/`seq` or supplies neither returns `invalidParams` with a message naming the accepted combinations. [#8015](https://github.com/XRPLF/rippled/pull/8015)
- `vault_info`: A well-formed all-zero `vault_id` now returns `entryNotFound` instead of being rejected as malformed, and `entryNotFound` responses now include `error_code` and `error_message`. Clients that request `ripplerpc` 3.0 or above therefore receive HTTP 400 with that error rather than HTTP 200. [#8015](https://github.com/XRPLF/rippled/pull/8015)
- `vault_info`: `vault_id` and `owner` must now be strings, matching how `ledger_entry` reads the same fields. An object or an array in either field previously produced an internal error, and a number was silently converted to its decimal text; `vault_id` now returns `invalidParams` and `owner` returns `actMalformed`. [#8015](https://github.com/XRPLF/rippled/pull/8015)
- `gateway_balances`: The `account` and `ident` fields now return an `invalidParams` error if the value is not a string, instead of an `internal` error. [#7655](https://github.com/XRPLF/rippled/pull/7655)
- `account_lines`: The `peer` field now returns an error if the value is not a string. [#7728](https://github.com/XRPLF/rippled/pull/7728)

View File

@@ -8,6 +8,7 @@ Uses pcpp to preprocess the macro file and pyparsing to parse the DSL.
import io
import argparse
import re
from pathlib import Path
import pyparsing as pp
@@ -53,28 +54,89 @@ def create_transaction_parser():
return macro_parser
# Defaults for xrpl::TxSettings members, mirroring
# include/xrpl/protocol/TxSettings.h. A transaction's settings blob only names
# the members that differ from these.
SETTING_DEFAULTS = {
"delegable": "Delegation::NotDelegable",
"amendment": "uint256{}",
"privileges": "Privilege::NoPriv",
}
def parse_settings(settings_str):
"""Parse a TxSettings blob into a dict, filling in defaults.
Args:
settings_str: A string like '({.delegable = Delegation::NotDelegable,
.privileges = Privilege::CreateAcct})', or '({})'.
Returns:
A dict with a value for every key in SETTING_DEFAULTS.
"""
body = settings_str.strip()
if not (body.startswith("(") and body.endswith(")")):
raise ValueError(
f"Malformed settings blob, expected '({{...}})': {settings_str!r}"
)
body = body[1:-1].strip()
if not (body.startswith("{") and body.endswith("}")):
raise ValueError(
f"Malformed settings blob, expected '({{...}})': {settings_str!r}"
)
body = body[1:-1]
# Strip comments, which may be interleaved with the designated initializers.
body = re.sub(r"//[^\n]*", "", body)
settings = dict(SETTING_DEFAULTS)
seen = set()
# Each entry runs from '.key =' up to the next '.key =' or the end.
for key, value in re.findall(
r"\.(\w+)\s*=\s*(.*?)(?=,\s*\.\w+\s*=|,?\s*$)", body, re.S
):
if key not in SETTING_DEFAULTS:
raise ValueError(f"Unknown TxSettings member '.{key}' in {settings_str!r}")
settings[key] = " ".join(value.split()).rstrip(",")
seen.add(key)
# Catch a typo'd or unparsed initializer rather than silently defaulting it.
# Every '.member' in the blob must have been consumed above.
if len(re.findall(r"\.\w+", body)) != len(seen):
raise ValueError(f"Could not parse every setting in {settings_str!r}")
# A blob with content but no designated initializer is positional, which
# would otherwise be read as "all defaults" and silently generate the
# wrong output.
if body.strip() and not seen:
raise ValueError(
"TxSettings requires designated initializers (.member = value), "
f"got {settings_str!r}"
)
return settings
def parse_transaction_args(args_list):
"""Parse the arguments of a TRANSACTION macro call.
Args:
args_list: A list of parsed arguments from pyparsing, e.g.,
['ttPAYMENT', '0', 'Payment', 'Delegation::delegable',
'uint256{}', 'createAcct', '({...})']
['ttPAYMENT', '0', 'Payment',
'({.privileges = Privilege::CreateAcct})', '({...})']
Returns:
A dict with parsed transaction information.
"""
if len(args_list) < 7:
if len(args_list) < 5:
raise ValueError(
f"Expected at least 7 parts in TRANSACTION, got {len(args_list)}: {args_list}"
f"Expected at least 5 parts in TRANSACTION, got {len(args_list)}: {args_list}"
)
tag = args_list[0]
value = args_list[1]
name = args_list[2]
delegable = args_list[3]
amendments = args_list[4]
privileges = args_list[5]
settings = parse_settings(args_list[3])
fields_str = args_list[-1]
# Parse fields: ({field1, field2, ...})
@@ -84,9 +146,9 @@ def parse_transaction_args(args_list):
"tag": tag,
"value": value,
"name": name,
"delegable": delegable,
"amendments": amendments,
"privileges": privileges,
"delegable": settings["delegable"],
"amendments": settings["amendment"],
"privileges": settings["privileges"],
"fields": fields,
}

View File

@@ -92,11 +92,11 @@ wherever it appears in the repository configuration.
2. Add the repository, using the channel you picked in [Release channels](#release-channels):
```bash
cat << REPOFILE | sudo tee /etc/yum.repos.d/xrplf.repo
cat << 'REPOFILE' | sudo tee /etc/yum.repos.d/xrplf.repo
[xrplf-stable]
name=XRP Ledger Packages
enabled=1
baseurl=https://packages.xrplf.org/repository/rpm-stable/
baseurl=https://packages.xrplf.org/repository/rpm-stable/$basearch/
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.xrplf.org/xrplf.asc

View File

@@ -24,6 +24,7 @@
#include <optional>
#include <set>
#include <utility>
#include <vector>
namespace xrpl {
@@ -198,7 +199,10 @@ dirLink(
* if withdrawing to self.
* - If withdrawing to self, succeed.
* - If not, checks if the receiver requires deposit authorization, and if
* the sender has it.
* the sender has it (account-based or credential-based).
* - Expects any credentials passed in to already exist in the ledger, and
* returns an internal error otherwise. Validate them beforehand with
* credentials::valid().
* - Checks that the receiver will not exceed the limit (IOU trustline limit
* or MPT MaximumAmount).
*/
@@ -209,7 +213,8 @@ canWithdraw(
AccountID const& to,
SLE::const_ref toSle,
STAmount const& amount,
bool hasDestinationTag);
bool hasDestinationTag,
std::optional<std::vector<uint256>> const& credentialIDs = std::nullopt);
/**
* Checks that can withdraw funds from an object to itself or a destination.
@@ -222,7 +227,10 @@ canWithdraw(
* if withdrawing to self.
* - If withdrawing to self, succeed.
* - If not, checks if the receiver requires deposit authorization, and if
* the sender has it.
* the sender has it (account-based or credential-based).
* - Expects any credentials passed in to already exist in the ledger, and
* returns an internal error otherwise. Validate them beforehand with
* credentials::valid().
* - Checks that the receiver will not exceed the limit (IOU trustline limit
* or MPT MaximumAmount).
*/
@@ -232,20 +240,25 @@ canWithdraw(
AccountID const& from,
AccountID const& to,
STAmount const& amount,
bool hasDestinationTag);
bool hasDestinationTag,
std::optional<std::vector<uint256>> const& credentialIDs = std::nullopt);
/**
* Checks that can withdraw funds from an object to itself or a destination.
*
* The receiver may be either the submitting account (sfAccount) or a different
* destination account (sfDestination).
* destination account (sfDestination). Credentials, if any, are taken from the
* transaction's sfCredentialIDs field.
*
* - Checks that the receiver account exists.
* - If the receiver requires a destination tag, check that one exists, even
* if withdrawing to self.
* - If withdrawing to self, succeed.
* - If not, checks if the receiver requires deposit authorization, and if
* the sender has it.
* the sender has it (account-based or credential-based).
* - Expects any credentials in sfCredentialIDs to already exist in the
* ledger, and returns an internal error otherwise. Validate them
* beforehand with credentials::valid().
* - Checks that the receiver will not exceed the limit (IOU trustline limit
* or MPT MaximumAmount).
*/

View File

@@ -91,6 +91,17 @@ getFee(std::uint16_t tfee)
return Number{tfee} / kAuctionSlotFeeScaleFactor;
}
/**
* Minimum auction slot price: LPTokens * TradingFee / kAuctionSlotMinFeeFraction
* @param lptAMMBalance AMM LP token balance
* @param tradingFee trading fee in {0, 1000}
*/
inline Number
ammAuctionMinSlotPrice(Number const& lptAMMBalance, std::uint16_t tradingFee)
{
return lptAMMBalance * getFee(tradingFee) / kAuctionSlotMinFeeFraction;
}
/**
* Get fee multiplier (1 - tfee)
* @tfee trading fee in basis points

View File

@@ -4,6 +4,7 @@
#include <xrpl/protocol/Rules.h>
#include <xrpl/protocol/SOTemplate.h>
#include <xrpl/protocol/TxFormats.h>
#include <xrpl/protocol/TxSettings.h>
#include <cstdint>
#include <functional>
@@ -38,11 +39,6 @@ enum GranularPermissionType : std::uint32_t {
#pragma pop_macro("GRANULAR_PERMISSION")
};
// Injected bare enumerators (xrpl::delegable / xrpl::notDelegable) are required by preprocessor
// tricks in tests and macro-generated code; enum class would break that.
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
enum Delegation { Delegable, NotDelegable };
class Permission
{
private:
@@ -65,7 +61,7 @@ private:
struct TxDelegationEntry
{
uint256 amendment;
Delegation delegable{NotDelegable};
Delegation delegable{Delegation::NotDelegable};
};
std::unordered_set<TxType> granularTxTypes_;

View File

@@ -0,0 +1,96 @@
#pragma once
#include <xrpl/basics/base_uint.h>
#include <xrpl/basics/safe_cast.h>
#include <cstdint>
#include <type_traits>
namespace xrpl {
enum class Delegation { Delegable, NotDelegable };
/**
* Operations a transaction is permitted to perform, as a bitfield.
*
* These are declared per-transaction in transactions.macro (via
* TxSettings::privileges) and enforced in InvariantCheck.cpp.
*/
enum class Privilege : std::uint16_t {
NoPriv = 0x0000, // The transaction can not do any of the enumerated operations
CreateAcct = 0x0001, // The transaction can create a new ACCOUNT_ROOT object.
CreatePseudoAcct = 0x0002, // The transaction can create a pseudo account,
// which implies createAcct
MustDeleteAcct = 0x0004, // The transaction must delete an ACCOUNT_ROOT object
MayDeleteAcct = 0x0008, // The transaction may delete an ACCOUNT_ROOT
// object, but does not have to
OverrideFreeze = 0x0010, // The transaction can override some freeze rules
ChangeNftCounts = 0x0020, // The transaction can mint or burn an NFT
CreateMptIssuance = 0x0040, // The transaction can create a new MPT issuance
DestroyMptIssuance = 0x0080, // The transaction can destroy an MPT issuance
MustAuthorizeMpt = 0x0100, // The transaction MUST create or delete an MPT
// object (except by issuer)
MayAuthorizeMpt = 0x0200, // The transaction MAY create or delete an MPT
// object (except by issuer)
MayDeleteMpt = 0x0400, // The transaction MAY delete an MPT object. May not create.
MustModifyVault = 0x0800, // The transaction must modify, delete or create, a vault
MayModifyVault = 0x1000, // The transaction MAY modify, delete or create, a vault
MayCreateMpt = 0x2000, // The transaction MAY create an MPT object, except for issuer.
};
// The inner static_cast is not redundant: the underlying type is narrower than
// `int`, so the operands integer-promote and the result has to be narrowed back.
// safeCast rejects that narrowing, but every input bit is a Privilege bit by
// construction, so the result is always representable.
constexpr Privilege
operator|(Privilege lhs, Privilege rhs)
{
using Underlying = std::underlying_type_t<Privilege>;
return static_cast<Privilege>(
static_cast<Underlying>(safeCast<Underlying>(lhs) | safeCast<Underlying>(rhs)));
}
constexpr Privilege
operator&(Privilege lhs, Privilege rhs)
{
using Underlying = std::underlying_type_t<Privilege>;
return static_cast<Privilege>(
static_cast<Underlying>(safeCast<Underlying>(lhs) & safeCast<Underlying>(rhs)));
}
/**
* Per-transaction metadata declared in transactions.macro.
*
* Every member has a default, so a transaction only needs to name the settings
* that differ from the common case. See the documentation at the top of
* transactions.macro for the authoring syntax.
*
* This is deliberately not a constexpr-friendly type: amendment identifiers are
* runtime-initialized `extern uint256 const` globals (see Feature.h), so a
* TxSettings can only be built at runtime.
*/
struct TxSettings
{
/**
* Whether an account may delegate this transaction to another account.
*/
Delegation delegable{Delegation::NotDelegable};
/**
* The amendment gating this transaction, or uint256{} if always available.
*/
// The `{}` looks redundant, because BaseUInt's default constructor already
// zeroes the value. It is not: without a default member initializer here,
// every partial designated initializer in transactions.macro trips the
// missing-designated-field-initializers warning, which the build treats as
// an error.
// NOLINTNEXTLINE(readability-redundant-member-init)
uint256 amendment{};
/**
* Operations this transaction is permitted to perform.
*/
Privilege privileges{Privilege::NoPriv};
};
} // namespace xrpl

View File

@@ -15,6 +15,7 @@
// Add new amendments to the top of this list.
// Keep it sorted in reverse chronological order.
XRPL_FEATURE(TecInvariant, Supported::Yes, VoteBehavior::DefaultNo)
XRPL_FIX (Cleanup3_4_0, Supported::Yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(Sponsor, Supported::Yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(BatchV1_1, Supported::Yes, VoteBehavior::DefaultNo)

File diff suppressed because it is too large Load Diff

View File

@@ -21,7 +21,7 @@ class AMMBidBuilder;
* Type: ttAMM_BID (39)
* Delegable: Delegation::Delegable
* Amendment: featureAMM
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use AMMBidBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class AMMClawbackBuilder;
* Type: ttAMM_CLAWBACK (31)
* Delegable: Delegation::Delegable
* Amendment: featureAMMClawback
* Privileges: MayDeleteAcct | OverrideFreeze | MayAuthorizeMpt
* Privileges: Privilege::MayDeleteAcct | Privilege::OverrideFreeze | Privilege::MayAuthorizeMpt
*
* Immutable wrapper around STTx providing type-safe field access.
* Use AMMClawbackBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class AMMCreateBuilder;
* Type: ttAMM_CREATE (35)
* Delegable: Delegation::Delegable
* Amendment: featureAMM
* Privileges: CreatePseudoAcct | MayCreateMpt
* Privileges: Privilege::CreatePseudoAcct | Privilege::MayCreateMpt
*
* Immutable wrapper around STTx providing type-safe field access.
* Use AMMCreateBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class AMMDeleteBuilder;
* Type: ttAMM_DELETE (40)
* Delegable: Delegation::Delegable
* Amendment: featureAMM
* Privileges: MustDeleteAcct | MayDeleteMpt
* Privileges: Privilege::MustDeleteAcct | Privilege::MayDeleteMpt
*
* Immutable wrapper around STTx providing type-safe field access.
* Use AMMDeleteBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class AMMDepositBuilder;
* Type: ttAMM_DEPOSIT (36)
* Delegable: Delegation::Delegable
* Amendment: featureAMM
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use AMMDepositBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class AMMVoteBuilder;
* Type: ttAMM_VOTE (38)
* Delegable: Delegation::Delegable
* Amendment: featureAMM
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use AMMVoteBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class AMMWithdrawBuilder;
* Type: ttAMM_WITHDRAW (37)
* Delegable: Delegation::Delegable
* Amendment: featureAMM
* Privileges: MayDeleteAcct | MayAuthorizeMpt
* Privileges: Privilege::MayDeleteAcct | Privilege::MayAuthorizeMpt
*
* Immutable wrapper around STTx providing type-safe field access.
* Use AMMWithdrawBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class AccountDeleteBuilder;
* Type: ttACCOUNT_DELETE (21)
* Delegable: Delegation::NotDelegable
* Amendment: uint256{}
* Privileges: MustDeleteAcct
* Privileges: Privilege::MustDeleteAcct
*
* Immutable wrapper around STTx providing type-safe field access.
* Use AccountDeleteBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class AccountSetBuilder;
* Type: ttACCOUNT_SET (3)
* Delegable: Delegation::NotDelegable
* Amendment: uint256{}
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use AccountSetBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class BatchBuilder;
* Type: ttBATCH (71)
* Delegable: Delegation::NotDelegable
* Amendment: featureBatchV1_1
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use BatchBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class CheckCancelBuilder;
* Type: ttCHECK_CANCEL (18)
* Delegable: Delegation::Delegable
* Amendment: uint256{}
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use CheckCancelBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class CheckCashBuilder;
* Type: ttCHECK_CASH (17)
* Delegable: Delegation::Delegable
* Amendment: uint256{}
* Privileges: MayCreateMpt
* Privileges: Privilege::MayCreateMpt
*
* Immutable wrapper around STTx providing type-safe field access.
* Use CheckCashBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class CheckCreateBuilder;
* Type: ttCHECK_CREATE (16)
* Delegable: Delegation::Delegable
* Amendment: uint256{}
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use CheckCreateBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class ClawbackBuilder;
* Type: ttCLAWBACK (30)
* Delegable: Delegation::Delegable
* Amendment: uint256{}
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use ClawbackBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class ConfidentialMPTClawbackBuilder;
* Type: ttCONFIDENTIAL_MPT_CLAWBACK (89)
* Delegable: Delegation::Delegable
* Amendment: featureConfidentialTransfer
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use ConfidentialMPTClawbackBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class ConfidentialMPTConvertBuilder;
* Type: ttCONFIDENTIAL_MPT_CONVERT (85)
* Delegable: Delegation::NotDelegable
* Amendment: featureConfidentialTransfer
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use ConfidentialMPTConvertBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class ConfidentialMPTConvertBackBuilder;
* Type: ttCONFIDENTIAL_MPT_CONVERT_BACK (87)
* Delegable: Delegation::Delegable
* Amendment: featureConfidentialTransfer
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use ConfidentialMPTConvertBackBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class ConfidentialMPTMergeInboxBuilder;
* Type: ttCONFIDENTIAL_MPT_MERGE_INBOX (86)
* Delegable: Delegation::Delegable
* Amendment: featureConfidentialTransfer
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use ConfidentialMPTMergeInboxBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class ConfidentialMPTSendBuilder;
* Type: ttCONFIDENTIAL_MPT_SEND (88)
* Delegable: Delegation::Delegable
* Amendment: featureConfidentialTransfer
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use ConfidentialMPTSendBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class CredentialAcceptBuilder;
* Type: ttCREDENTIAL_ACCEPT (59)
* Delegable: Delegation::Delegable
* Amendment: featureCredentials
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use CredentialAcceptBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class CredentialCreateBuilder;
* Type: ttCREDENTIAL_CREATE (58)
* Delegable: Delegation::Delegable
* Amendment: featureCredentials
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use CredentialCreateBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class CredentialDeleteBuilder;
* Type: ttCREDENTIAL_DELETE (60)
* Delegable: Delegation::Delegable
* Amendment: featureCredentials
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use CredentialDeleteBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class DIDDeleteBuilder;
* Type: ttDID_DELETE (50)
* Delegable: Delegation::Delegable
* Amendment: featureDID
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use DIDDeleteBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class DIDSetBuilder;
* Type: ttDID_SET (49)
* Delegable: Delegation::Delegable
* Amendment: featureDID
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use DIDSetBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class DelegateSetBuilder;
* Type: ttDELEGATE_SET (64)
* Delegable: Delegation::NotDelegable
* Amendment: featurePermissionDelegationV1_1
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use DelegateSetBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class DepositPreauthBuilder;
* Type: ttDEPOSIT_PREAUTH (19)
* Delegable: Delegation::Delegable
* Amendment: uint256{}
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use DepositPreauthBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class EnableAmendmentBuilder;
* Type: ttAMENDMENT (100)
* Delegable: Delegation::NotDelegable
* Amendment: uint256{}
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use EnableAmendmentBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class EscrowCancelBuilder;
* Type: ttESCROW_CANCEL (4)
* Delegable: Delegation::Delegable
* Amendment: uint256{}
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use EscrowCancelBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class EscrowCreateBuilder;
* Type: ttESCROW_CREATE (1)
* Delegable: Delegation::Delegable
* Amendment: uint256{}
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use EscrowCreateBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class EscrowFinishBuilder;
* Type: ttESCROW_FINISH (2)
* Delegable: Delegation::Delegable
* Amendment: uint256{}
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use EscrowFinishBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class LedgerStateFixBuilder;
* Type: ttLEDGER_STATE_FIX (53)
* Delegable: Delegation::Delegable
* Amendment: fixNFTokenPageLinks
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use LedgerStateFixBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class LoanBrokerCoverClawbackBuilder;
* Type: ttLOAN_BROKER_COVER_CLAWBACK (78)
* Delegable: Delegation::NotDelegable
* Amendment: featureLendingProtocol
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use LoanBrokerCoverClawbackBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class LoanBrokerCoverDepositBuilder;
* Type: ttLOAN_BROKER_COVER_DEPOSIT (76)
* Delegable: Delegation::NotDelegable
* Amendment: featureLendingProtocol
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use LoanBrokerCoverDepositBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class LoanBrokerCoverWithdrawBuilder;
* Type: ttLOAN_BROKER_COVER_WITHDRAW (77)
* Delegable: Delegation::NotDelegable
* Amendment: featureLendingProtocol
* Privileges: MayAuthorizeMpt
* Privileges: Privilege::MayAuthorizeMpt
*
* Immutable wrapper around STTx providing type-safe field access.
* Use LoanBrokerCoverWithdrawBuilder to construct new transactions.
@@ -121,6 +121,32 @@ public:
{
return this->tx_->isFieldPresent(sfDestinationTag);
}
/**
* @brief Get sfCredentialIDs (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_VECTOR256::type::value_type>
getCredentialIDs() const
{
if (hasCredentialIDs())
{
return this->tx_->at(sfCredentialIDs);
}
return std::nullopt;
}
/**
* @brief Check if sfCredentialIDs is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasCredentialIDs() const
{
return this->tx_->isFieldPresent(sfCredentialIDs);
}
};
/**
@@ -214,6 +240,17 @@ public:
return *this;
}
/**
* @brief Set sfCredentialIDs (SoeOptional)
* @return Reference to this builder for method chaining.
*/
LoanBrokerCoverWithdrawBuilder&
setCredentialIDs(std::decay_t<typename SF_VECTOR256::type::value_type> const& value)
{
object_[sfCredentialIDs] = value;
return *this;
}
/**
* @brief Build and return the LoanBrokerCoverWithdraw wrapper.
* @param publicKey The public key for signing.

View File

@@ -21,7 +21,7 @@ class LoanBrokerDeleteBuilder;
* Type: ttLOAN_BROKER_DELETE (75)
* Delegable: Delegation::NotDelegable
* Amendment: featureLendingProtocol
* Privileges: MustDeleteAcct | MayAuthorizeMpt
* Privileges: Privilege::MustDeleteAcct | Privilege::MayAuthorizeMpt
*
* Immutable wrapper around STTx providing type-safe field access.
* Use LoanBrokerDeleteBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class LoanBrokerSetBuilder;
* Type: ttLOAN_BROKER_SET (74)
* Delegable: Delegation::NotDelegable
* Amendment: featureLendingProtocol
* Privileges: CreatePseudoAcct | MayAuthorizeMpt
* Privileges: Privilege::CreatePseudoAcct | Privilege::MayAuthorizeMpt
*
* Immutable wrapper around STTx providing type-safe field access.
* Use LoanBrokerSetBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class LoanDeleteBuilder;
* Type: ttLOAN_DELETE (81)
* Delegable: Delegation::NotDelegable
* Amendment: featureLendingProtocol
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use LoanDeleteBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class LoanManageBuilder;
* Type: ttLOAN_MANAGE (82)
* Delegable: Delegation::NotDelegable
* Amendment: featureLendingProtocol
* Privileges: MayModifyVault
* Privileges: Privilege::MayModifyVault
*
* Immutable wrapper around STTx providing type-safe field access.
* Use LoanManageBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class LoanPayBuilder;
* Type: ttLOAN_PAY (84)
* Delegable: Delegation::NotDelegable
* Amendment: featureLendingProtocol
* Privileges: MayAuthorizeMpt | MustModifyVault
* Privileges: Privilege::MayAuthorizeMpt | Privilege::MustModifyVault
*
* Immutable wrapper around STTx providing type-safe field access.
* Use LoanPayBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class LoanSetBuilder;
* Type: ttLOAN_SET (80)
* Delegable: Delegation::NotDelegable
* Amendment: featureLendingProtocol
* Privileges: MayAuthorizeMpt | MustModifyVault
* Privileges: Privilege::MayAuthorizeMpt | Privilege::MustModifyVault
*
* Immutable wrapper around STTx providing type-safe field access.
* Use LoanSetBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class MPTokenAuthorizeBuilder;
* Type: ttMPTOKEN_AUTHORIZE (57)
* Delegable: Delegation::Delegable
* Amendment: featureMPTokensV1
* Privileges: MustAuthorizeMpt
* Privileges: Privilege::MustAuthorizeMpt
*
* Immutable wrapper around STTx providing type-safe field access.
* Use MPTokenAuthorizeBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class MPTokenIssuanceCreateBuilder;
* Type: ttMPTOKEN_ISSUANCE_CREATE (54)
* Delegable: Delegation::Delegable
* Amendment: featureMPTokensV1
* Privileges: CreateMptIssuance
* Privileges: Privilege::CreateMptIssuance
*
* Immutable wrapper around STTx providing type-safe field access.
* Use MPTokenIssuanceCreateBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class MPTokenIssuanceDestroyBuilder;
* Type: ttMPTOKEN_ISSUANCE_DESTROY (55)
* Delegable: Delegation::Delegable
* Amendment: featureMPTokensV1
* Privileges: DestroyMptIssuance
* Privileges: Privilege::DestroyMptIssuance
*
* Immutable wrapper around STTx providing type-safe field access.
* Use MPTokenIssuanceDestroyBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class MPTokenIssuanceSetBuilder;
* Type: ttMPTOKEN_ISSUANCE_SET (56)
* Delegable: Delegation::Delegable
* Amendment: featureMPTokensV1
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use MPTokenIssuanceSetBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class NFTokenAcceptOfferBuilder;
* Type: ttNFTOKEN_ACCEPT_OFFER (29)
* Delegable: Delegation::Delegable
* Amendment: uint256{}
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use NFTokenAcceptOfferBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class NFTokenBurnBuilder;
* Type: ttNFTOKEN_BURN (26)
* Delegable: Delegation::Delegable
* Amendment: uint256{}
* Privileges: ChangeNftCounts
* Privileges: Privilege::ChangeNftCounts
*
* Immutable wrapper around STTx providing type-safe field access.
* Use NFTokenBurnBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class NFTokenCancelOfferBuilder;
* Type: ttNFTOKEN_CANCEL_OFFER (28)
* Delegable: Delegation::Delegable
* Amendment: uint256{}
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use NFTokenCancelOfferBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class NFTokenCreateOfferBuilder;
* Type: ttNFTOKEN_CREATE_OFFER (27)
* Delegable: Delegation::Delegable
* Amendment: uint256{}
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use NFTokenCreateOfferBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class NFTokenMintBuilder;
* Type: ttNFTOKEN_MINT (25)
* Delegable: Delegation::Delegable
* Amendment: uint256{}
* Privileges: ChangeNftCounts
* Privileges: Privilege::ChangeNftCounts
*
* Immutable wrapper around STTx providing type-safe field access.
* Use NFTokenMintBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class NFTokenModifyBuilder;
* Type: ttNFTOKEN_MODIFY (61)
* Delegable: Delegation::Delegable
* Amendment: featureDynamicNFT
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use NFTokenModifyBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class OfferCancelBuilder;
* Type: ttOFFER_CANCEL (8)
* Delegable: Delegation::Delegable
* Amendment: uint256{}
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use OfferCancelBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class OfferCreateBuilder;
* Type: ttOFFER_CREATE (7)
* Delegable: Delegation::Delegable
* Amendment: uint256{}
* Privileges: MayCreateMpt
* Privileges: Privilege::MayCreateMpt
*
* Immutable wrapper around STTx providing type-safe field access.
* Use OfferCreateBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class OracleDeleteBuilder;
* Type: ttORACLE_DELETE (52)
* Delegable: Delegation::Delegable
* Amendment: featurePriceOracle
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use OracleDeleteBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class OracleSetBuilder;
* Type: ttORACLE_SET (51)
* Delegable: Delegation::Delegable
* Amendment: featurePriceOracle
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use OracleSetBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class PaymentBuilder;
* Type: ttPAYMENT (0)
* Delegable: Delegation::Delegable
* Amendment: uint256{}
* Privileges: CreateAcct | MayCreateMpt
* Privileges: Privilege::CreateAcct | Privilege::MayCreateMpt
*
* Immutable wrapper around STTx providing type-safe field access.
* Use PaymentBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class PaymentChannelClaimBuilder;
* Type: ttPAYCHAN_CLAIM (15)
* Delegable: Delegation::Delegable
* Amendment: uint256{}
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use PaymentChannelClaimBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class PaymentChannelCreateBuilder;
* Type: ttPAYCHAN_CREATE (13)
* Delegable: Delegation::Delegable
* Amendment: uint256{}
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use PaymentChannelCreateBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class PaymentChannelFundBuilder;
* Type: ttPAYCHAN_FUND (14)
* Delegable: Delegation::Delegable
* Amendment: uint256{}
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use PaymentChannelFundBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class PermissionedDomainDeleteBuilder;
* Type: ttPERMISSIONED_DOMAIN_DELETE (63)
* Delegable: Delegation::Delegable
* Amendment: featurePermissionedDomains
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use PermissionedDomainDeleteBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class PermissionedDomainSetBuilder;
* Type: ttPERMISSIONED_DOMAIN_SET (62)
* Delegable: Delegation::Delegable
* Amendment: featurePermissionedDomains
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use PermissionedDomainSetBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class SetFeeBuilder;
* Type: ttFEE (101)
* Delegable: Delegation::NotDelegable
* Amendment: uint256{}
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use SetFeeBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class SetRegularKeyBuilder;
* Type: ttREGULAR_KEY_SET (5)
* Delegable: Delegation::NotDelegable
* Amendment: uint256{}
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use SetRegularKeyBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class SignerListSetBuilder;
* Type: ttSIGNER_LIST_SET (12)
* Delegable: Delegation::NotDelegable
* Amendment: uint256{}
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use SignerListSetBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class SponsorshipSetBuilder;
* Type: ttSPONSORSHIP_SET (91)
* Delegable: Delegation::Delegable
* Amendment: featureSponsor
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use SponsorshipSetBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class SponsorshipTransferBuilder;
* Type: ttSPONSORSHIP_TRANSFER (90)
* Delegable: Delegation::NotDelegable
* Amendment: featureSponsor
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use SponsorshipTransferBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class TicketCreateBuilder;
* Type: ttTICKET_CREATE (10)
* Delegable: Delegation::Delegable
* Amendment: uint256{}
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use TicketCreateBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class TrustSetBuilder;
* Type: ttTRUST_SET (20)
* Delegable: Delegation::Delegable
* Amendment: uint256{}
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use TrustSetBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class UNLModifyBuilder;
* Type: ttUNL_MODIFY (102)
* Delegable: Delegation::NotDelegable
* Amendment: uint256{}
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use UNLModifyBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class VaultClawbackBuilder;
* Type: ttVAULT_CLAWBACK (70)
* Delegable: Delegation::NotDelegable
* Amendment: featureSingleAssetVault
* Privileges: MayDeleteMpt | MustModifyVault
* Privileges: Privilege::MayDeleteMpt | Privilege::MustModifyVault
*
* Immutable wrapper around STTx providing type-safe field access.
* Use VaultClawbackBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class VaultCreateBuilder;
* Type: ttVAULT_CREATE (65)
* Delegable: Delegation::NotDelegable
* Amendment: featureSingleAssetVault
* Privileges: CreatePseudoAcct | CreateMptIssuance | MustModifyVault
* Privileges: Privilege::CreatePseudoAcct | Privilege::CreateMptIssuance | Privilege::MustModifyVault
*
* Immutable wrapper around STTx providing type-safe field access.
* Use VaultCreateBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class VaultDeleteBuilder;
* Type: ttVAULT_DELETE (67)
* Delegable: Delegation::NotDelegable
* Amendment: featureSingleAssetVault
* Privileges: MustDeleteAcct | DestroyMptIssuance | MustModifyVault
* Privileges: Privilege::MustDeleteAcct | Privilege::DestroyMptIssuance | Privilege::MustModifyVault
*
* Immutable wrapper around STTx providing type-safe field access.
* Use VaultDeleteBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class VaultDepositBuilder;
* Type: ttVAULT_DEPOSIT (68)
* Delegable: Delegation::NotDelegable
* Amendment: featureSingleAssetVault
* Privileges: MayAuthorizeMpt | MustModifyVault
* Privileges: Privilege::MayAuthorizeMpt | Privilege::MustModifyVault
*
* Immutable wrapper around STTx providing type-safe field access.
* Use VaultDepositBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class VaultSetBuilder;
* Type: ttVAULT_SET (66)
* Delegable: Delegation::NotDelegable
* Amendment: featureSingleAssetVault
* Privileges: MustModifyVault
* Privileges: Privilege::MustModifyVault
*
* Immutable wrapper around STTx providing type-safe field access.
* Use VaultSetBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class VaultWithdrawBuilder;
* Type: ttVAULT_WITHDRAW (69)
* Delegable: Delegation::NotDelegable
* Amendment: featureSingleAssetVault
* Privileges: MayDeleteMpt | MayAuthorizeMpt | MustModifyVault
* Privileges: Privilege::MayDeleteMpt | Privilege::MayAuthorizeMpt | Privilege::MustModifyVault
*
* Immutable wrapper around STTx providing type-safe field access.
* Use VaultWithdrawBuilder to construct new transactions.
@@ -121,6 +121,32 @@ public:
{
return this->tx_->isFieldPresent(sfDestinationTag);
}
/**
* @brief Get sfCredentialIDs (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_VECTOR256::type::value_type>
getCredentialIDs() const
{
if (hasCredentialIDs())
{
return this->tx_->at(sfCredentialIDs);
}
return std::nullopt;
}
/**
* @brief Check if sfCredentialIDs is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasCredentialIDs() const
{
return this->tx_->isFieldPresent(sfCredentialIDs);
}
};
/**
@@ -214,6 +240,17 @@ public:
return *this;
}
/**
* @brief Set sfCredentialIDs (SoeOptional)
* @return Reference to this builder for method chaining.
*/
VaultWithdrawBuilder&
setCredentialIDs(std::decay_t<typename SF_VECTOR256::type::value_type> const& value)
{
object_[sfCredentialIDs] = value;
return *this;
}
/**
* @brief Build and return the VaultWithdraw wrapper.
* @param publicKey The public key for signing.

View File

@@ -21,7 +21,7 @@ class XChainAccountCreateCommitBuilder;
* Type: ttXCHAIN_ACCOUNT_CREATE_COMMIT (44)
* Delegable: Delegation::Delegable
* Amendment: featureXChainBridge
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use XChainAccountCreateCommitBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class XChainAddAccountCreateAttestationBuilder;
* Type: ttXCHAIN_ADD_ACCOUNT_CREATE_ATTESTATION (46)
* Delegable: Delegation::Delegable
* Amendment: featureXChainBridge
* Privileges: CreateAcct
* Privileges: Privilege::CreateAcct
*
* Immutable wrapper around STTx providing type-safe field access.
* Use XChainAddAccountCreateAttestationBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class XChainAddClaimAttestationBuilder;
* Type: ttXCHAIN_ADD_CLAIM_ATTESTATION (45)
* Delegable: Delegation::Delegable
* Amendment: featureXChainBridge
* Privileges: CreateAcct
* Privileges: Privilege::CreateAcct
*
* Immutable wrapper around STTx providing type-safe field access.
* Use XChainAddClaimAttestationBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class XChainClaimBuilder;
* Type: ttXCHAIN_CLAIM (43)
* Delegable: Delegation::Delegable
* Amendment: featureXChainBridge
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use XChainClaimBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class XChainCommitBuilder;
* Type: ttXCHAIN_COMMIT (42)
* Delegable: Delegation::Delegable
* Amendment: featureXChainBridge
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use XChainCommitBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class XChainCreateBridgeBuilder;
* Type: ttXCHAIN_CREATE_BRIDGE (48)
* Delegable: Delegation::Delegable
* Amendment: featureXChainBridge
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use XChainCreateBridgeBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class XChainCreateClaimIDBuilder;
* Type: ttXCHAIN_CREATE_CLAIM_ID (41)
* Delegable: Delegation::Delegable
* Amendment: featureXChainBridge
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use XChainCreateClaimIDBuilder to construct new transactions.

View File

@@ -21,7 +21,7 @@ class XChainModifyBridgeBuilder;
* Type: ttXCHAIN_MODIFY_BRIDGE (47)
* Delegable: Delegation::Delegable
* Amendment: featureXChainBridge
* Privileges: NoPriv
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use XChainModifyBridgeBuilder to construct new transactions.

View File

@@ -11,6 +11,7 @@
#include <xrpl/protocol/AccountID.h>
#include <xrpl/protocol/Fees.h>
#include <xrpl/protocol/Keylet.h>
#include <xrpl/protocol/LedgerFormats.h>
#include <xrpl/protocol/Permissions.h>
#include <xrpl/protocol/Rules.h>
#include <xrpl/protocol/SField.h>
@@ -367,6 +368,10 @@ public:
uint256 const& ticketIndex,
beast::Journal j);
// Interface used by processPersistentChanges and Invariants
static std::unordered_set<LedgerEntryType>
typesForResult(TER const ter);
protected:
TER
apply();

View File

@@ -113,6 +113,59 @@ public:
};
#endif
/**
* @brief An unsuccessful transaction claiming a fee can only make a very small set of changes.
*
* 1. Reduce at most one AccountRoot or Sponsorship's XRP balance (pay a fee). (A transaction may
* pay 0.)
* 2. Increment one AccountRoot's sequence or delete a Ticket, not both.
* 3. Delete expired objects, depending on the failure code.
* For tecOVERSIZE and tecKILLED, ltOFFER
* For tecINCOMPLETE, ltRIPPLE_STATE
* For tecEXPIRED, ltNFTOKEN_OFFER or ltCREDENTIAL
* 4. AccountRoot owner counts may be decreased. The net change must equal to the number of deleted
* objects.
* 5. Ticket counts may be decreased. The net change must equal to the number of deleted tickets
* (which should be at most 1).
* 6. Modify or delete Directory Nodes, only if expired objects were deleted.
*
* Anything outside of that is bad.
*
* Collect change data for the known allowed types, and collect the info in errors_ for anything
* else.
*
* Note that finalize() will always return true on a `tesSUCCESS`, even if there are messages
* collected in errors_. The errors_ only apply if the transaction was NOT successful. It will also
* do additional checks based on the transaction data.
*/
class FailedTransaction
{
struct DeletedEntry
{
SLE::const_pointer before;
SLE::const_pointer after;
};
// accountPaidFee and accountIncreasedSequence are usually the same account, but they don't have
// to be.
SLE::const_pointer accountPaidFee_;
SLE::const_pointer sponsorPaidFee_;
SLE::const_pointer accountIncreasedSequence_;
SLE::const_pointer deletedTicket_;
int netOwnerCountChange_ = 0;
int netTicketCountChange_ = 0;
std::vector<DeletedEntry> deletedObjects_;
std::vector<SLE::const_pointer> directorySideEffects_;
std::vector<std::string> errors_;
public:
void
visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after);
[[nodiscard]] bool
finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&);
};
/**
* @brief Invariant: We should never charge a transaction a negative fee or a
* fee that is larger than what the transaction itself specifies.
@@ -432,6 +485,7 @@ private:
// additional invariant checks can be declared above and then added to this
// tuple
using InvariantChecks = std::tuple<
FailedTransaction,
TransactionFeeCheck,
AccountRootsNotDeleted,
AccountRootsDeletedClean,

View File

@@ -1,9 +1,7 @@
#pragma once
#include <xrpl/basics/safe_cast.h>
#include <xrpl/protocol/STTx.h>
#include <type_traits>
#include <xrpl/protocol/TxSettings.h> // IWYU pragma: export
namespace xrpl {
@@ -26,37 +24,8 @@ not have the relevant amendments enabled_. It's intentionally a pain in the neck
so that bad code gets caught and fixed as early as possible.
*/
// Bitwise flags, 86 files, used in macros files
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
enum Privilege {
NoPriv = 0x0000, // The transaction can not do any of the enumerated operations
CreateAcct = 0x0001, // The transaction can create a new ACCOUNT_ROOT object.
CreatePseudoAcct = 0x0002, // The transaction can create a pseudo account,
// which implies createAcct
MustDeleteAcct = 0x0004, // The transaction must delete an ACCOUNT_ROOT object
MayDeleteAcct = 0x0008, // The transaction may delete an ACCOUNT_ROOT
// object, but does not have to
OverrideFreeze = 0x0010, // The transaction can override some freeze rules
ChangeNftCounts = 0x0020, // The transaction can mint or burn an NFT
CreateMptIssuance = 0x0040, // The transaction can create a new MPT issuance
DestroyMptIssuance = 0x0080, // The transaction can destroy an MPT issuance
MustAuthorizeMpt = 0x0100, // The transaction MUST create or delete an MPT
// object (except by issuer)
MayAuthorizeMpt = 0x0200, // The transaction MAY create or delete an MPT
// object (except by issuer)
MayDeleteMpt = 0x0400, // The transaction MAY delete an MPT object. May not create.
MustModifyVault = 0x0800, // The transaction must modify, delete or create, a vault
MayModifyVault = 0x1000, // The transaction MAY modify, delete or create, a vault
MayCreateMpt = 0x2000, // The transaction MAY create an MPT object, except for issuer.
};
constexpr Privilege
operator|(Privilege lhs, Privilege rhs)
{
return safeCast<Privilege>(
safeCast<std::underlying_type_t<Privilege>>(lhs) |
safeCast<std::underlying_type_t<Privilege>>(rhs));
}
// `enum Privilege` and its `operator|` live in <xrpl/protocol/TxSettings.h>,
// alongside the TxSettings struct that carries them out of transactions.macro.
bool
hasPrivilege(STTx const& tx, Privilege priv);

View File

@@ -20,6 +20,9 @@ public:
{
}
static bool
checkExtraFeatures(PreflightContext const& ctx);
static NotTEC
preflight(PreflightContext const& ctx);

View File

@@ -260,6 +260,11 @@ public:
unsigned
pop() noexcept;
// if true, there are no recoverable digits in the guard, though there may be dropped digits
// (xbit_)
[[nodiscard]] bool
unrecoverable() const noexcept;
// if true, there are no digits in the guard, including dropped digits (xbit_)
[[nodiscard]] bool
empty() const noexcept;
@@ -277,6 +282,17 @@ public:
void
doDropDigit(T& mantissa, int& exponent) noexcept;
/**
* Drop a digit from the mantissa, and increment the exponent, storing the dropped digit in
* this Guard.
*
* If a drop will not do anything meaningful (there are no recoverable digits in the guard, and
* the mantissa is 0), and if targetExponent > exponent, simply set exponent to targetExponent.
*/
template <class T>
void
doDropDigitWithTarget(T& mantissa, int& exponent, int const targetExponent) noexcept;
// Modify the result to the correctly rounded value
template <UnsignedMantissa T>
void
@@ -374,10 +390,16 @@ Number::Guard::pop() noexcept
return d;
}
inline bool
Number::Guard::unrecoverable() const noexcept
{
return digits_ == 0;
}
inline bool
Number::Guard::empty() const noexcept
{
return digits_ == 0 && !xbit_;
return unrecoverable() && !xbit_;
}
template <class T>
@@ -401,6 +423,25 @@ Number::Guard::doDropDigit<uint128_t>(uint128_t& mantissa, int& exponent) noexce
++exponent;
}
template <class T>
void
Number::Guard::doDropDigitWithTarget(T& mantissa, int& exponent, int const targetExponent) noexcept
{
XRPL_ASSERT(
exponent < targetExponent, "xrpl::Number::Guard::doDropDigitWithTarget : something to do");
while (exponent < targetExponent)
{
if (mantissa == 0 && unrecoverable())
{
// No number of dropped digits is going to change anything except the exponent at this
// point, so just jump to the result
exponent = targetExponent;
return;
}
doDropDigit(mantissa, exponent);
}
}
template <UnsignedMantissa T>
void
Number::Guard::pushOverflow(T mantissa)
@@ -928,6 +969,7 @@ Number::operator+=(Number const& y)
// to match, if necessary.
auto const adjust = [&g, &upperLimit](
uint128_t& expandM, int& expandE, uint128_t& shrinkM, int& shrinkE) {
XRPL_ASSERT(shrinkE < expandE, "xrpl::Number::operator+= : exponents ordered correctly");
// Adjust up and down until the exponents match
if (g.cuspRoundingFix == MantissaRange::CuspRoundingFix::Enabled330)
{
@@ -935,6 +977,8 @@ Number::operator+=(Number const& y)
// 1. First, shrink the mantissa of shrinkM/shrinkE while shrinkM ends in 0.
while (shrinkE < expandE && shrinkM % 10 == 0)
{
// Don't use doDropDigitWithTarget here, because the loop will stop before the
// mantissa gets to 0.
g.doDropDigit(shrinkM, shrinkE);
}
@@ -950,10 +994,11 @@ Number::operator+=(Number const& y)
// 3. Finally, shrink the mantissa of shrinkM/shrinkE until the exponents match. Any removed
// digits will be put into the Guard. This is the only step for non-Enabled330 modes.
while (shrinkE < expandE)
if (shrinkE < expandE)
{
g.doDropDigit(shrinkM, shrinkE);
g.doDropDigitWithTarget(shrinkM, shrinkE, expandE);
}
XRPL_ASSERT(shrinkE == expandE, "xrpl::Number::operator+= : exponents are equal");
};
// Shrink the mantissa and raise the exponent of the value with the lower exponent. Store any
@@ -996,7 +1041,7 @@ Number::operator+=(Number const& y)
// round.
XRPL_ASSERT(
xm > maxMantissa || g.empty(),
"xrpl::Number::operator+ : rounding state expected after add");
"xrpl::Number::operator+= : rounding state expected after add");
}
else
{
@@ -1038,7 +1083,7 @@ Number::operator+=(Number const& y)
}
XRPL_ASSERT(
xm > maxMantissa || g.empty(),
"xrpl::Number::operator+ : rounding state expected after subtract");
"xrpl::Number::operator+= : rounding state expected after subtract");
}
else
{
@@ -1330,9 +1375,10 @@ operator rep() const
g.setNegative();
drops = -drops;
}
while (offset < 0)
if (offset < 0)
{
g.doDropDigit(drops, offset);
g.doDropDigitWithTarget(drops, offset, 0);
XRPL_ASSERT(offset == 0, "xrpl::Number::operator rep() : exponents are equal");
}
for (; offset > 0; --offset)
{

View File

@@ -35,6 +35,7 @@
#include <cstdint>
#include <optional>
#include <set>
#include <vector>
namespace xrpl {
@@ -467,7 +468,8 @@ canWithdraw(
AccountID const& to,
SLE::const_ref toSle,
STAmount const& amount,
bool hasDestinationTag)
bool hasDestinationTag,
std::optional<std::vector<uint256>> const& credentialIDs)
{
if (auto const ret = checkDestinationAndTag(toSle, hasDestinationTag))
return ret;
@@ -478,7 +480,28 @@ canWithdraw(
if (toSle->isFlag(lsfDepositAuth))
{
if (!view.exists(keylet::depositPreauth(to, from)))
return tecNO_PERMISSION;
{
if (credentialIDs.has_value())
{
STVector256 const credIDs{*credentialIDs};
// Callers must have validated these in preclaim, so a missing
// credential here is an invariant violation.
for (auto const& h : credIDs)
{
if (!view.exists(keylet::credential(h)))
return tecINTERNAL; // LCOV_EXCL_LINE
}
if (auto const ret = credentials::authorizedDepositPreauth(view, credIDs, to);
!isTesSuccess(ret))
return ret;
}
else
{
return tecNO_PERMISSION;
}
}
}
return withdrawToDestExceedsLimit(view, from, to, amount);
@@ -490,11 +513,12 @@ canWithdraw(
AccountID const& from,
AccountID const& to,
STAmount const& amount,
bool hasDestinationTag)
bool hasDestinationTag,
std::optional<std::vector<uint256>> const& credentialIDs)
{
auto const toSle = view.read(keylet::account(to));
return canWithdraw(view, from, to, toSle, amount, hasDestinationTag);
return canWithdraw(view, from, to, toSle, amount, hasDestinationTag, credentialIDs);
}
[[nodiscard]] TER
@@ -503,7 +527,8 @@ canWithdraw(ReadView const& view, STTx const& tx)
auto const from = tx[sfAccount];
auto const to = tx[~sfDestination].value_or(from);
return canWithdraw(view, from, to, tx[sfAmount], tx.isFieldPresent(sfDestinationTag));
return canWithdraw(
view, from, to, tx[sfAmount], tx.isFieldPresent(sfDestinationTag), tx[~sfCredentialIDs]);
}
TER

Some files were not shown because too many files have changed in this diff Show More