20 #include <ripple/app/tx/impl/SetAccount.h>
21 #include <ripple/basics/Log.h>
22 #include <ripple/core/Config.h>
23 #include <ripple/protocol/Feature.h>
24 #include <ripple/protocol/Indexes.h>
25 #include <ripple/protocol/PublicKey.h>
26 #include <ripple/protocol/Quality.h>
27 #include <ripple/protocol/st.h>
28 #include <ripple/ledger/View.h>
65 JLOG(j.trace()) <<
"Malformed transaction: Invalid flags set.";
72 if ((uSetFlag != 0) && (uSetFlag == uClearFlag))
74 JLOG(j.trace()) <<
"Malformed transaction: Set and clear same flag.";
84 if (bSetRequireAuth && bClearRequireAuth)
86 JLOG(j.trace()) <<
"Malformed transaction: Contradictory flags set.";
96 if (bSetRequireDest && bClearRequireDest)
98 JLOG(j.trace()) <<
"Malformed transaction: Contradictory flags set.";
108 if (bSetDisallowXRP && bClearDisallowXRP)
110 JLOG(j.trace()) <<
"Malformed transaction: Contradictory flags set.";
119 if (uRate && (uRate < QUALITY_ONE))
121 JLOG(j.trace()) <<
"Malformed transaction: Transfer rate too small.";
125 if (uRate > 2 * QUALITY_ONE)
127 JLOG(j.trace()) <<
"Malformed transaction: Transfer rate too large.";
137 ((uTickSize < Quality::minTickSize) ||
138 (uTickSize > Quality::maxTickSize)))
140 JLOG(j.trace()) <<
"Malformed transaction: Bad tick size.";
147 if (mk->size() && !
publicKeyType ({mk->data(), mk->size()}))
149 JLOG(j.trace()) <<
"Invalid message key specified.";
157 JLOG(j.trace()) <<
"domain too long";
190 JLOG(ctx.
j.
trace()) <<
"Retry: Owner directory not empty.";
221 bool const sigWithMaster {[&tx, &acct =
account_] ()
223 auto const spk = tx.getSigningPubKey();
240 JLOG(
j_.
trace()) <<
"Set RequireAuth.";
246 JLOG(
j_.
trace()) <<
"Clear RequireAuth.";
255 JLOG(
j_.
trace()) <<
"Set lsfRequireDestTag.";
261 JLOG(
j_.
trace()) <<
"Clear lsfRequireDestTag.";
270 JLOG(
j_.
trace()) <<
"Set lsfDisallowXRP.";
276 JLOG(
j_.
trace()) <<
"Clear lsfDisallowXRP.";
287 JLOG(
j_.
trace()) <<
"Must use master key to disable master key.";
298 JLOG(
j_.
trace()) <<
"Set lsfDisableMaster.";
304 JLOG(
j_.
trace()) <<
"Clear lsfDisableMaster.";
313 JLOG(
j_.
trace()) <<
"Set lsfDefaultRipple.";
318 JLOG(
j_.
trace()) <<
"Clear lsfDefaultRipple.";
329 JLOG(
j_.
trace()) <<
"Must use master key to set NoFreeze.";
333 JLOG(
j_.
trace()) <<
"Set NoFreeze flag";
340 JLOG(
j_.
trace()) <<
"Set GlobalFreeze flag";
350 JLOG(
j_.
trace()) <<
"Clear GlobalFreeze flag";
359 JLOG(
j_.
trace()) <<
"Set AccountTxnID.";
365 JLOG(
j_.
trace()) <<
"Clear AccountTxnID.";
376 JLOG(
j_.
trace()) <<
"Set lsfDepositAuth.";
381 JLOG(
j_.
trace()) <<
"Clear lsfDepositAuth.";
395 JLOG(
j_.
trace()) <<
"unset email hash";
400 JLOG(
j_.
trace()) <<
"set email hash";
414 JLOG(
j_.
trace()) <<
"unset wallet locator";
419 JLOG(
j_.
trace()) <<
"set wallet locator";
431 if (messageKey.
empty ())
433 JLOG(
j_.
debug()) <<
"set message key";
438 JLOG(
j_.
debug()) <<
"set message key";
452 JLOG(
j_.
trace()) <<
"unset domain";
457 JLOG(
j_.
trace()) <<
"set domain";
469 if (uRate == 0 || uRate == QUALITY_ONE)
471 JLOG(
j_.
trace()) <<
"unset transfer rate";
476 JLOG(
j_.
trace()) <<
"set transfer rate";
487 if ((uTickSize == 0) || (uTickSize == Quality::maxTickSize))
489 JLOG(
j_.
trace()) <<
"unset tick size";
494 JLOG(
j_.
trace()) <<
"set tick size";
499 if (uFlagsIn != uFlagsOut)
500 sle->setFieldU32 (
sfFlags, uFlagsOut);
const SF_Account sfRegularKey(access, STI_ACCOUNT, 8, "RegularKey")
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)
static const signers_t signers
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 std::uint32_t asfGlobalFreeze
const SF_Blob sfMessageKey(access, STI_VL, 2, "MessageKey")
const std::uint32_t asfDefaultRipple
const SF_Account sfAccount(access, STI_ACCOUNT, 1, "Account")
const SF_U32 sfFlags(access, STI_UINT32, 2, "Flags")
const uint256 featureDepositAuth
const SF_U256 sfWalletLocator(access, STI_HASH256, 7, "WalletLocator")
const std::uint32_t asfDepositAuth
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.
const SF_U256 sfAccountTxnID(access, STI_HASH256, 9, "AccountTxnID")
const std::uint32_t tfDisallowXRP
const std::uint32_t tfAllowXRP
const std::uint32_t asfRequireAuth
static const account_t account
AccountID calcAccountID(PublicKey const &pk)
Keylet ownerDir(AccountID const &id)
The root page of an account's directory.
std::uint32_t getFlags() const
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
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
static NotTEC preflight(PreflightContext const &ctx)
const SF_U32 sfClearFlag(access, STI_UINT32, 34, "ClearFlag")
const std::uint32_t tfAccountSetMask
const SF_U32 sfTransferRate(access, STI_UINT32, 11, "TransferRate")
std::uint32_t getFieldU32(SField const &field) const
State information when preflighting a tx.
const SF_U128 sfEmailHash(access, STI_HASH128, 1, "EmailHash")
const SF_U32 sfSetFlag(access, STI_UINT32, 33, "SetFlag")
const SF_U8 sfTickSize(access, STI_UINT8, 16, "TickSize")
static bool affectsSubsequentTransactionAuth(STTx const &tx)
static TER preclaim(PreclaimContext const &ctx)
const SF_Blob sfDomain(access, STI_VL, 7, "Domain")