20 #include <ripple/app/tx/impl/SetAccount.h>
21 #include <ripple/basics/Log.h>
22 #include <ripple/core/Config.h>
23 #include <ripple/ledger/View.h>
24 #include <ripple/protocol/Feature.h>
25 #include <ripple/protocol/Indexes.h>
26 #include <ripple/protocol/PublicKey.h>
27 #include <ripple/protocol/Quality.h>
28 #include <ripple/protocol/st.h>
37 auto getTxConsequencesCategory = [](
STTx const& tx) {
42 if (
auto const uSetFlag = tx[~
sfSetFlag]; uSetFlag &&
47 if (
auto const uClearFlag = tx[~
sfClearFlag]; uClearFlag &&
71 JLOG(j.trace()) <<
"Malformed transaction: Invalid flags set.";
78 if ((uSetFlag != 0) && (uSetFlag == uClearFlag))
80 JLOG(j.trace()) <<
"Malformed transaction: Set and clear same flag.";
87 bool bSetRequireAuth =
89 bool bClearRequireAuth =
92 if (bSetRequireAuth && bClearRequireAuth)
94 JLOG(j.trace()) <<
"Malformed transaction: Contradictory flags set.";
101 bool bSetRequireDest =
103 bool bClearRequireDest =
106 if (bSetRequireDest && bClearRequireDest)
108 JLOG(j.trace()) <<
"Malformed transaction: Contradictory flags set.";
115 bool bSetDisallowXRP =
117 bool bClearDisallowXRP =
120 if (bSetDisallowXRP && bClearDisallowXRP)
122 JLOG(j.trace()) <<
"Malformed transaction: Contradictory flags set.";
131 if (uRate && (uRate < QUALITY_ONE))
134 <<
"Malformed transaction: Transfer rate too small.";
138 if (uRate > 2 * QUALITY_ONE)
141 <<
"Malformed transaction: Transfer rate too large.";
151 ((uTickSize < Quality::minTickSize) ||
152 (uTickSize > Quality::maxTickSize)))
154 JLOG(j.trace()) <<
"Malformed transaction: Bad tick size.";
163 JLOG(j.trace()) <<
"Invalid message key specified.";
168 if (
auto const domain = tx[~
sfDomain];
171 JLOG(j.trace()) <<
"domain too long";
206 bool bSetRequireAuth =
216 JLOG(ctx.
j.
trace()) <<
"Retry: Owner directory not empty.";
240 bool const bSetRequireDest{
242 bool const bClearRequireDest{
244 bool const bSetRequireAuth{
246 bool const bClearRequireAuth{
248 bool const bSetDisallowXRP{
250 bool const bClearDisallowXRP{
253 bool const sigWithMaster{[&tx, &acct =
account_]() {
254 auto const spk = tx.getSigningPubKey();
271 JLOG(
j_.
trace()) <<
"Set RequireAuth.";
277 JLOG(
j_.
trace()) <<
"Clear RequireAuth.";
286 JLOG(
j_.
trace()) <<
"Set lsfRequireDestTag.";
292 JLOG(
j_.
trace()) <<
"Clear lsfRequireDestTag.";
301 JLOG(
j_.
trace()) <<
"Set lsfDisallowXRP.";
307 JLOG(
j_.
trace()) <<
"Clear lsfDisallowXRP.";
318 JLOG(
j_.
trace()) <<
"Must use master key to disable master key.";
329 JLOG(
j_.
trace()) <<
"Set lsfDisableMaster.";
335 JLOG(
j_.
trace()) <<
"Clear lsfDisableMaster.";
344 JLOG(
j_.
trace()) <<
"Set lsfDefaultRipple.";
349 JLOG(
j_.
trace()) <<
"Clear lsfDefaultRipple.";
360 JLOG(
j_.
trace()) <<
"Must use master key to set NoFreeze.";
364 JLOG(
j_.
trace()) <<
"Set NoFreeze flag";
371 JLOG(
j_.
trace()) <<
"Set GlobalFreeze flag";
381 JLOG(
j_.
trace()) <<
"Clear GlobalFreeze flag";
390 JLOG(
j_.
trace()) <<
"Set AccountTxnID.";
396 JLOG(
j_.
trace()) <<
"Clear AccountTxnID.";
407 JLOG(
j_.
trace()) <<
"Set lsfDepositAuth.";
412 JLOG(
j_.
trace()) <<
"Clear lsfDepositAuth.";
426 JLOG(
j_.
trace()) <<
"unset email hash";
431 JLOG(
j_.
trace()) <<
"set email hash";
445 JLOG(
j_.
trace()) <<
"unset wallet locator";
450 JLOG(
j_.
trace()) <<
"set wallet locator";
462 if (messageKey.
empty())
464 JLOG(
j_.
debug()) <<
"set message key";
469 JLOG(
j_.
debug()) <<
"set message key";
483 JLOG(
j_.
trace()) <<
"unset domain";
488 JLOG(
j_.
trace()) <<
"set domain";
500 if (uRate == 0 || uRate == QUALITY_ONE)
502 JLOG(
j_.
trace()) <<
"unset transfer rate";
507 JLOG(
j_.
trace()) <<
"set transfer rate";
518 if ((uTickSize == 0) || (uTickSize == Quality::maxTickSize))
520 JLOG(
j_.
trace()) <<
"unset tick size";
525 JLOG(
j_.
trace()) <<
"set tick size";
565 if (uFlagsIn != uFlagsOut)
566 sle->setFieldU32(
sfFlags, uFlagsOut);
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
NotTEC preflight2(PreflightContext const &ctx)
Checks whether the signature appears valid.
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)
constexpr std::uint32_t asfDisallowXRP
constexpr std::uint32_t asfDepositAuth
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
Stream trace() const
Severity stream access functions.
virtual std::shared_ptr< SLE > peek(Keylet const &k)=0
Prepare to modify the SLE associated with key.
constexpr std::uint32_t tfDisallowXRP
const SF_ACCOUNT sfRegularKey
constexpr std::uint32_t asfNoFreeze
const uint256 featureDepositAuth
constexpr std::uint32_t tfAllowXRP
const SF_UINT32 sfSetFlag
constexpr std::uint32_t asfDisallowIncomingPayChan
NotTEC preflight1(PreflightContext const &ctx)
Performs early sanity checks on the account and fee fields.
constexpr std::uint32_t asfDisallowIncomingTrustline
constexpr std::uint32_t tfAccountSetMask
constexpr std::uint32_t asfDisallowIncomingCheck
std::optional< KeyType > publicKeyType(Slice const &slice)
Returns the type of public key.
Integers of any length that is a multiple of 32-bits.
constexpr std::uint32_t asfDisableMaster
Keylet account(AccountID const &id) noexcept
AccountID root.
const uint256 featureDisallowIncoming
const SF_ACCOUNT sfNFTokenMinter
@ lsfDisallowIncomingPayChan
@ blocker
Affects the ability of subsequent transactions to claim a fee.
AccountID calcAccountID(PublicKey const &pk)
const SF_UINT256 sfAccountTxnID
std::uint32_t getFlags() const
const SF_UINT32 sfTransferRate
const SF_UINT8 sfTickSize
const SF_UINT32 sfClearFlag
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
constexpr std::uint32_t tfOptionalAuth
constexpr std::uint32_t tfRequireAuth
static TxConsequences makeTxConsequences(PreflightContext const &ctx)
State information when determining if a tx is likely to claim a fee.
const SF_UINT128 sfEmailHash
bool dirIsEmpty(ReadView const &view, Keylet const &k)
Returns true if the directory is empty.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
const uint256 featureNonFungibleTokensV1
const SF_UINT256 sfWalletLocator
@ lsfDisallowIncomingNFTokenOffer
virtual Rules const & rules() const =0
Returns the tx processing rules.
constexpr std::uint32_t asfRequireAuth
static NotTEC preflight(PreflightContext const &ctx)
constexpr std::uint32_t asfDefaultRipple
@ lsfDisallowIncomingTrustline
constexpr std::uint32_t asfRequireDest
@ lsfDisallowIncomingCheck
constexpr std::uint32_t asfGlobalFreeze
const SF_ACCOUNT sfAccount
@ normal
Moves currency around, creates offers, etc.
constexpr std::uint32_t tfRequireDestTag
std::uint32_t getFieldU32(SField const &field) const
State information when preflighting a tx.
constexpr std::uint32_t tfOptionalDestTag
static Keylet signers(AccountID const &account, std::uint32_t page) noexcept
Class describing the consequences to the account of applying a transaction if the transaction consume...
constexpr std::uint32_t asfAccountTxnID
constexpr std::uint32_t asfDisallowIncomingNFTokenOffer
constexpr std::size_t maxDomainLength
The maximum length of a domain.
static TER preclaim(PreclaimContext const &ctx)
constexpr std::uint32_t asfAuthorizedNFTokenMinter