xrpld
Loading...
Searching...
No Matches
xrpl::proposal Namespace Reference

Functions

std::uint32_t proposalOwnerCount (STObject const &proposedTx)
 Owner-reserve increments held by a proposal of the given transaction.
bool isValidProposalTxnType (STObject const &proposedTx)
 Whether the proposed transaction is independently submittable through the ordinary multi-sign path: not a proposal transaction itself, not a pseudo-transaction, not itself flagged as someone else's inner batch transaction, and — if it is a Batch — every one of its own inner transactions carries a TransactionType and is neither a proposal, a pseudo-transaction, nor a nested Batch.
bool hasSignatureField (STObject const &proposedTx)
 Whether the proposed transaction carries any signature field.
bool hasEmptySigningPubKey (STObject const &proposedTx)
 Whether the proposed transaction's SigningPubKey is present and empty, as unsigned canonical form requires.
bool isTerminal (ReadView const &view, std::optional< std::uint32_t > expiration, STObject const &proposedTx)
 Whether the proposal is terminal (On-Chain Cosigner spec §4.5).
TER deleteProposal (ApplyView &view, SLE::pointer const &sleProposal, beast::Journal j)
 Delete a TransactionProposal ledger entry.
bool payloadMatches (STObject const &proposedTx, STObject const &tx)
 Whether tx carries the same payload as a proposal's stored ProposedTransaction (On-Chain Cosigner spec §4.2.1).
bool canConsumeTicket (ReadView const &view, STTx const &tx)
 Whether tx may consume its Ticket.

Variables

constexpr std::uint32_t kProposalOwnerCount = 5
 Owner-reserve increments held by a proposal of an ordinary transaction.
constexpr std::uint32_t kBatchProposalOwnerCount = 10
 Owner-reserve increments held by a proposal of a Batch transaction.

Function Documentation

◆ proposalOwnerCount()

std::uint32_t xrpl::proposal::proposalOwnerCount ( STObject const & proposedTx)

Owner-reserve increments held by a proposal of the given transaction.

Definition at line 34 of file ProposalHelpers.h.

◆ isValidProposalTxnType()

bool xrpl::proposal::isValidProposalTxnType ( STObject const & proposedTx)

Whether the proposed transaction is independently submittable through the ordinary multi-sign path: not a proposal transaction itself, not a pseudo-transaction, not itself flagged as someone else's inner batch transaction, and — if it is a Batch — every one of its own inner transactions carries a TransactionType and is neither a proposal, a pseudo-transaction, nor a nested Batch.

A Batch inner transaction cannot lack a TransactionType, be pseudo, or be a nested Batch (STTx construction rejects a typeless inner and an inner Batch, and preflight0 rejects the pseudo/tfInnerBatchTxn combination), but those guards live outside this feature, so they are checked again here rather than relied upon.

TODO: cover ttTRANSACTION_PROPOSAL_SIGN once that transaction exists.

Definition at line 44 of file libxrpl/ledger/helpers/ProposalHelpers.cpp.

◆ hasSignatureField()

bool xrpl::proposal::hasSignatureField ( STObject const & proposedTx)

Whether the proposed transaction carries any signature field.

A proposal is stored in unsigned canonical form; signatures may only ever arrive through TransactionProposalSign. Shared by the create-time check and the invariant that guards the stored entry, so the two cannot drift apart.

Definition at line 65 of file ProposalHelpers.h.

◆ hasEmptySigningPubKey()

bool xrpl::proposal::hasEmptySigningPubKey ( STObject const & proposedTx)

Whether the proposed transaction's SigningPubKey is present and empty, as unsigned canonical form requires.

An absent field is not the same as an empty one, and a populated one means the payload was already signed.

Definition at line 79 of file ProposalHelpers.h.

◆ isTerminal()

bool xrpl::proposal::isTerminal ( ReadView const & view,
std::optional< std::uint32_t > expiration,
STObject const & proposedTx )

Whether the proposal is terminal (On-Chain Cosigner spec §4.5).

A terminal proposal stops accepting signatures and anyone may delete it. An already signed payload can still execute after Expiration, because the Ticket reservation compares payloads only; a passed LastLedgerSequence does stop it.

A proposal is terminal when either:

  • its Expiration has passed (the parent ledger closed at or after it), or
  • the proposed transaction carries a LastLedgerSequence and the current ledger sequence is strictly greater than it. This mirrors the ordinary transactor's tefMAX_LEDGER rule: at view.seq() == LastLedgerSequence the payload can still be submitted in the current ledger, so the proposal is still live.
Parameters
viewThe ledger the deciding transaction is being applied to.
expirationThe proposal's Expiration field.
proposedTxThe proposal's ProposedTransaction field.

Definition at line 87 of file libxrpl/ledger/helpers/ProposalHelpers.cpp.

◆ deleteProposal()

TER xrpl::proposal::deleteProposal ( ApplyView & view,
SLE::pointer const & sleProposal,
beast::Journal j )

Delete a TransactionProposal ledger entry.

Removes the entry from its Owner's directory, releases the reserve the proposal holds against the Owner, and erases the entry. Shared by every deletion path the spec defines (On-Chain Cosigner spec §4.5): automatic cleanup when the proposed transaction's TicketSequence is consumed, and the TransactionProposalCancel / TransactionProposalSign cleanup paths once those transactions exist.

The release goes through decreaseOwnerCountForObject, so it follows the sfSponsor an entry created with reserve sponsorship carries: the reserve is returned to whoever was holding it, the Owner or that sponsor.

Parameters
viewThe apply view for making changes
sleProposalThe TransactionProposal ledger entry to delete
jJournal for logging
Returns
tesSUCCESS, tecINTERNAL for an invalid entry, or tefBAD_LEDGER if the ledger contradicts the entry

Definition at line 103 of file libxrpl/ledger/helpers/ProposalHelpers.cpp.

◆ payloadMatches()

bool xrpl::proposal::payloadMatches ( STObject const & proposedTx,
STObject const & tx )

Whether tx carries the same payload as a proposal's stored ProposedTransaction (On-Chain Cosigner spec §4.2.1).

The payload is the signing payload: the fields the collected signatures commit to. Compared is every field except those flagged kNotSigning (TxnSignature, Signers, BatchSigners, CounterpartySignature, SponsorSignature, Signature, MasterSignature) and SigningPubKey, which is stored empty and filled only if the target signs with its own key. So the completed transaction matches no matter which mix of collected or off-ledger signatures it carries, and any change to a non-signature field results in a false-return value.

Signature (PaymentChannelClaim) is deliberately not compared: it is outside the account's own TxnSignature even for an ordinary submission, so a proposal cannot bind it more tightly than the signatures it collects do, and that transactor still validates a substituted value exactly as it would for an ordinary submission. MasterSignature appears in no transaction format.

Parameters
proposedTxThe proposal's ProposedTransaction field.
txThe transaction to compare, typically an STTx.

Definition at line 148 of file libxrpl/ledger/helpers/ProposalHelpers.cpp.

◆ canConsumeTicket()

bool xrpl::proposal::canConsumeTicket ( ReadView const & view,
STTx const & tx )

Whether tx may consume its Ticket.

While a proposal keyed to the Ticket exists, the target's Ticket is reserved: only the proposal's own proposed transaction may spend it (On-Chain Cosigner spec §4.2.1), so that unrelated target-account activity cannot invalidate the proposal while signatures are being collected. TransactionProposalCancel is not allowed through: it deletes the reservation without consuming the ticket.

Parameters
viewThe ledger containing the Ticket and any reservation.
txThe transaction attempting to consume that ticket.

Definition at line 174 of file libxrpl/ledger/helpers/ProposalHelpers.cpp.

Variable Documentation

◆ kProposalOwnerCount

std::uint32_t xrpl::proposal::kProposalOwnerCount = 5
constexpr

Owner-reserve increments held by a proposal of an ordinary transaction.

Definition at line 21 of file ProposalHelpers.h.

◆ kBatchProposalOwnerCount

std::uint32_t xrpl::proposal::kBatchProposalOwnerCount = 10
constexpr

Owner-reserve increments held by a proposal of a Batch transaction.

A proposed Batch stores up to eight inner transactions plus multi-account signatures, so it reserves more than an ordinary proposed transaction.

Definition at line 28 of file ProposalHelpers.h.