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 &&
72 JLOG(j.trace()) <<
"Malformed transaction: Invalid flags set.";
79 if ((uSetFlag != 0) && (uSetFlag == uClearFlag))
81 JLOG(j.trace()) <<
"Malformed transaction: Set and clear same flag.";
88 bool bSetRequireAuth =
90 bool bClearRequireAuth =
93 if (bSetRequireAuth && bClearRequireAuth)
95 JLOG(j.trace()) <<
"Malformed transaction: Contradictory flags set.";
102 bool bSetRequireDest =
104 bool bClearRequireDest =
107 if (bSetRequireDest && bClearRequireDest)
109 JLOG(j.trace()) <<
"Malformed transaction: Contradictory flags set.";
116 bool bSetDisallowXRP =
118 bool bClearDisallowXRP =
121 if (bSetDisallowXRP && bClearDisallowXRP)
123 JLOG(j.trace()) <<
"Malformed transaction: Contradictory flags set.";
132 if (uRate && (uRate < QUALITY_ONE))
135 <<
"Malformed transaction: Transfer rate too small.";
139 if (uRate > 2 * QUALITY_ONE)
142 <<
"Malformed transaction: Transfer rate too large.";
152 ((uTickSize < Quality::minTickSize) ||
153 (uTickSize > Quality::maxTickSize)))
155 JLOG(j.trace()) <<
"Malformed transaction: Bad tick size.";
164 JLOG(j.trace()) <<
"Invalid message key specified.";
172 JLOG(j.trace()) <<
"domain too long";
195 bool bSetRequireAuth =
205 JLOG(ctx.
j.
trace()) <<
"Retry: Owner directory not empty.";
229 bool const bSetRequireDest{
231 bool const bClearRequireDest{
233 bool const bSetRequireAuth{
235 bool const bClearRequireAuth{
237 bool const bSetDisallowXRP{
239 bool const bClearDisallowXRP{
242 bool const sigWithMaster{[&tx, &acct =
account_]() {
243 auto const spk = tx.getSigningPubKey();
260 JLOG(
j_.
trace()) <<
"Set RequireAuth.";
266 JLOG(
j_.
trace()) <<
"Clear RequireAuth.";
275 JLOG(
j_.
trace()) <<
"Set lsfRequireDestTag.";
281 JLOG(
j_.
trace()) <<
"Clear lsfRequireDestTag.";
290 JLOG(
j_.
trace()) <<
"Set lsfDisallowXRP.";
296 JLOG(
j_.
trace()) <<
"Clear lsfDisallowXRP.";
307 JLOG(
j_.
trace()) <<
"Must use master key to disable master key.";
318 JLOG(
j_.
trace()) <<
"Set lsfDisableMaster.";
324 JLOG(
j_.
trace()) <<
"Clear lsfDisableMaster.";
333 JLOG(
j_.
trace()) <<
"Set lsfDefaultRipple.";
338 JLOG(
j_.
trace()) <<
"Clear lsfDefaultRipple.";
349 JLOG(
j_.
trace()) <<
"Must use master key to set NoFreeze.";
353 JLOG(
j_.
trace()) <<
"Set NoFreeze flag";
360 JLOG(
j_.
trace()) <<
"Set GlobalFreeze flag";
370 JLOG(
j_.
trace()) <<
"Clear GlobalFreeze flag";
379 JLOG(
j_.
trace()) <<
"Set AccountTxnID.";
385 JLOG(
j_.
trace()) <<
"Clear AccountTxnID.";
396 JLOG(
j_.
trace()) <<
"Set lsfDepositAuth.";
401 JLOG(
j_.
trace()) <<
"Clear lsfDepositAuth.";
415 JLOG(
j_.
trace()) <<
"unset email hash";
420 JLOG(
j_.
trace()) <<
"set email hash";
434 JLOG(
j_.
trace()) <<
"unset wallet locator";
439 JLOG(
j_.
trace()) <<
"set wallet locator";
451 if (messageKey.
empty())
453 JLOG(
j_.
debug()) <<
"set message key";
458 JLOG(
j_.
debug()) <<
"set message key";
472 JLOG(
j_.
trace()) <<
"unset domain";
477 JLOG(
j_.
trace()) <<
"set domain";
489 if (uRate == 0 || uRate == QUALITY_ONE)
491 JLOG(
j_.
trace()) <<
"unset transfer rate";
496 JLOG(
j_.
trace()) <<
"set transfer rate";
507 if ((uTickSize == 0) || (uTickSize == Quality::maxTickSize))
509 JLOG(
j_.
trace()) <<
"unset tick size";
514 JLOG(
j_.
trace()) <<
"set tick size";
519 if (uFlagsIn != uFlagsOut)
520 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.
const std::uint32_t tfRequireAuth
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)
Stream trace() const
Severity stream access functions.
boost::optional< KeyType > publicKeyType(Slice const &slice)
Returns the type of public key.
virtual std::shared_ptr< SLE > peek(Keylet const &k)=0
Prepare to modify the SLE associated with key.
const SF_ACCOUNT sfRegularKey
const std::uint32_t asfGlobalFreeze
const SF_HASH256 sfWalletLocator
const std::uint32_t asfDefaultRipple
const uint256 featureDepositAuth
const SF_UINT32 sfSetFlag
const std::uint32_t asfDepositAuth
const SF_HASH128 sfEmailHash
const std::uint32_t asfDisallowXRP
const std::uint32_t tfOptionalDestTag
static const std::size_t DOMAIN_BYTES_MAX
static const std::uint32_t requireDestTag
const std::uint32_t asfAccountTxnID
NotTEC preflight1(PreflightContext const &ctx)
Performs early sanity checks on the account and fee fields.
Integers of any length that is a multiple of 32-bits.
const std::uint32_t tfDisallowXRP
const std::uint32_t tfAllowXRP
const std::uint32_t asfRequireAuth
Keylet account(AccountID const &id) noexcept
AccountID root.
@ blocker
Affects the ability of subsequent transactions to claim a fee.
AccountID calcAccountID(PublicKey const &pk)
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.
const std::uint32_t asfRequireDest
static TxConsequences makeTxConsequences(PreflightContext const &ctx)
State information when determining if a tx is likely to claim a fee.
const std::uint32_t asfDisableMaster
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 std::uint32_t asfNoFreeze
const std::uint32_t tfOptionalAuth
const SF_HASH256 sfAccountTxnID
static NotTEC preflight(PreflightContext const &ctx)
const std::uint32_t tfAccountSetMask
const SF_ACCOUNT sfAccount
@ normal
Moves currency around, creates offers, etc.
std::uint32_t getFieldU32(SField const &field) const
State information when preflighting a tx.
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...
static TER preclaim(PreclaimContext const &ctx)