rippled
STTx.cpp
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012, 2013 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #include <ripple/basics/Log.h>
21 #include <ripple/basics/StringUtilities.h>
22 #include <ripple/basics/contract.h>
23 #include <ripple/basics/safe_cast.h>
24 #include <ripple/json/to_string.h>
25 #include <ripple/protocol/Feature.h>
26 #include <ripple/protocol/HashPrefix.h>
27 #include <ripple/protocol/Protocol.h>
28 #include <ripple/protocol/PublicKey.h>
29 #include <ripple/protocol/STAccount.h>
30 #include <ripple/protocol/STArray.h>
31 #include <ripple/protocol/STTx.h>
32 #include <ripple/protocol/Sign.h>
33 #include <ripple/protocol/TxFlags.h>
34 #include <ripple/protocol/UintTypes.h>
35 #include <ripple/protocol/jss.h>
36 #include <boost/format.hpp>
37 
38 #include <array>
39 #include <memory>
40 #include <type_traits>
41 #include <utility>
42 
43 namespace ripple {
44 
45 static auto
47 {
48  auto format = TxFormats::getInstance().findByType(type);
49 
50  if (format == nullptr)
51  {
52  Throw<std::runtime_error>(
53  "Invalid transaction type " +
55  }
56 
57  return format;
58 }
59 
60 STTx::STTx(STObject&& object) : STObject(std::move(object))
61 {
62  tx_type_ = safe_cast<TxType>(getFieldU16(sfTransactionType));
63  applyTemplate(getTxFormat(tx_type_)->getSOTemplate()); // may throw
65 }
66 
68 {
69  int length = sit.getBytesLeft();
70 
71  if ((length < txMinSizeBytes) || (length > txMaxSizeBytes))
72  Throw<std::runtime_error>("Transaction length invalid");
73 
74  if (set(sit))
75  Throw<std::runtime_error>("Transaction contains an object terminator");
76 
77  tx_type_ = safe_cast<TxType>(getFieldU16(sfTransactionType));
78 
79  applyTemplate(getTxFormat(tx_type_)->getSOTemplate()); // May throw
81 }
82 
83 STTx::STTx(TxType type, std::function<void(STObject&)> assembler)
85 {
86  auto format = getTxFormat(type);
87 
88  set(format->getSOTemplate());
89  setFieldU16(sfTransactionType, format->getType());
90 
91  assembler(*this);
92 
93  tx_type_ = safe_cast<TxType>(getFieldU16(sfTransactionType));
94 
95  if (tx_type_ != type)
96  LogicError("Transaction type was mutated during assembly");
97 
99 }
100 
101 STBase*
102 STTx::copy(std::size_t n, void* buf) const
103 {
104  return emplace(n, buf, *this);
105 }
106 
107 STBase*
108 STTx::move(std::size_t n, void* buf)
109 {
110  return emplace(n, buf, std::move(*this));
111 }
112 
113 // STObject functions.
116 {
117  return STI_TRANSACTION;
118 }
119 
122 {
123  std::string ret = "\"";
124  ret += to_string(getTransactionID());
125  ret += "\" = {";
126  ret += STObject::getFullText();
127  ret += "}";
128  return ret;
129 }
130 
131 boost::container::flat_set<AccountID>
133 {
134  boost::container::flat_set<AccountID> list;
135 
136  for (auto const& it : *this)
137  {
138  if (auto sacc = dynamic_cast<STAccount const*>(&it))
139  {
140  assert(!sacc->isDefault());
141  if (!sacc->isDefault())
142  list.insert(sacc->value());
143  }
144  else if (auto samt = dynamic_cast<STAmount const*>(&it))
145  {
146  auto const& issuer = samt->getIssuer();
147  if (!isXRP(issuer))
148  list.insert(issuer);
149  }
150  }
151 
152  return list;
153 }
154 
155 static Blob
156 getSigningData(STTx const& that)
157 {
158  Serializer s;
160  that.addWithoutSigningFields(s);
161  return s.getData();
162 }
163 
164 uint256
166 {
168 }
169 
170 Blob
172 {
173  try
174  {
175  return getFieldVL(sfTxnSignature);
176  }
177  catch (std::exception const&)
178  {
179  return Blob();
180  }
181 }
182 
183 SeqProxy
185 {
187  if (seq != 0)
188  return SeqProxy::sequence(seq);
189 
191  if (!ticketSeq)
192  // No TicketSequence specified. Return the Sequence, whatever it is.
193  return SeqProxy::sequence(seq);
194 
195  return SeqProxy{SeqProxy::ticket, *ticketSeq};
196 }
197 
198 void
199 STTx::sign(PublicKey const& publicKey, SecretKey const& secretKey)
200 {
201  auto const data = getSigningData(*this);
202 
203  auto const sig = ripple::sign(publicKey, secretKey, makeSlice(data));
204 
207 }
208 
211  RequireFullyCanonicalSig requireCanonicalSig,
212  Rules const& rules) const
213 {
214  try
215  {
216  // Determine whether we're single- or multi-signing by looking
217  // at the SigningPubKey. If it's empty we must be
218  // multi-signing. Otherwise we're single-signing.
219  Blob const& signingPubKey = getFieldVL(sfSigningPubKey);
220  return signingPubKey.empty()
221  ? checkMultiSign(requireCanonicalSig, rules)
222  : checkSingleSign(requireCanonicalSig);
223  }
224  catch (std::exception const&)
225  {
226  }
227  return Unexpected("Internal signature check failure.");
228 }
229 
232 {
234  if (!(options & JsonOptions::disable_API_prior_V2))
235  ret[jss::hash] = to_string(getTransactionID());
236  return ret;
237 }
238 
240 STTx::getJson(JsonOptions options, bool binary) const
241 {
242  bool const V1 = !(options & JsonOptions::disable_API_prior_V2);
243 
244  if (binary)
245  {
247  std::string const dataBin = strHex(s.peekData());
248 
249  if (V1)
250  {
252  ret[jss::tx] = dataBin;
253  ret[jss::hash] = to_string(getTransactionID());
254  return ret;
255  }
256  else
257  return Json::Value{dataBin};
258  }
259 
261  if (V1)
262  ret[jss::hash] = to_string(getTransactionID());
263 
264  return ret;
265 }
266 
267 std::string const&
269 {
270  static std::string const sql =
271  "INSERT OR REPLACE INTO Transactions "
272  "(TransID, TransType, FromAcct, FromSeq, LedgerSeq, Status, RawTxn, "
273  "TxnMeta)"
274  " VALUES ";
275 
276  return sql;
277 }
278 
280 STTx::getMetaSQL(std::uint32_t inLedger, std::string const& escapedMetaData)
281  const
282 {
283  Serializer s;
284  add(s);
285  return getMetaSQL(s, inLedger, txnSqlValidated, escapedMetaData);
286 }
287 
288 // VFALCO This could be a free function elsewhere
291  Serializer rawTxn,
292  std::uint32_t inLedger,
293  char status,
294  std::string const& escapedMetaData) const
295 {
296  static boost::format bfTrans(
297  "('%s', '%s', '%s', '%d', '%d', '%c', %s, %s)");
298  std::string rTxn = sqlBlobLiteral(rawTxn.peekData());
299 
300  auto format = TxFormats::getInstance().findByType(tx_type_);
301  assert(format != nullptr);
302 
303  return str(
304  boost::format(bfTrans) % to_string(getTransactionID()) %
305  format->getName() % toBase58(getAccountID(sfAccount)) %
306  getFieldU32(sfSequence) % inLedger % status % rTxn % escapedMetaData);
307 }
308 
311 {
312  // We don't allow both a non-empty sfSigningPubKey and an sfSigners.
313  // That would allow the transaction to be signed two ways. So if both
314  // fields are present the signature is invalid.
316  return Unexpected("Cannot both single- and multi-sign.");
317 
318  bool validSig = false;
319  try
320  {
321  bool const fullyCanonical = (getFlags() & tfFullyCanonicalSig) ||
322  (requireCanonicalSig == RequireFullyCanonicalSig::yes);
323 
324  auto const spk = getFieldVL(sfSigningPubKey);
325 
326  if (publicKeyType(makeSlice(spk)))
327  {
328  Blob const signature = getFieldVL(sfTxnSignature);
329  Blob const data = getSigningData(*this);
330 
331  validSig = verify(
332  PublicKey(makeSlice(spk)),
333  makeSlice(data),
334  makeSlice(signature),
336  }
337  }
338  catch (std::exception const&)
339  {
340  // Assume it was a signature failure.
341  validSig = false;
342  }
343  if (validSig == false)
344  return Unexpected("Invalid signature.");
345  // Signature was verified.
346  return {};
347 }
348 
351  RequireFullyCanonicalSig requireCanonicalSig,
352  Rules const& rules) const
353 {
354  // Make sure the MultiSigners are present. Otherwise they are not
355  // attempting multi-signing and we just have a bad SigningPubKey.
357  return Unexpected("Empty SigningPubKey.");
358 
359  // We don't allow both an sfSigners and an sfTxnSignature. Both fields
360  // being present would indicate that the transaction is signed both ways.
362  return Unexpected("Cannot both single- and multi-sign.");
363 
364  STArray const& signers{getFieldArray(sfSigners)};
365 
366  // There are well known bounds that the number of signers must be within.
367  if (signers.size() < minMultiSigners ||
368  signers.size() > maxMultiSigners(&rules))
369  return Unexpected("Invalid Signers array size.");
370 
371  // We can ease the computational load inside the loop a bit by
372  // pre-constructing part of the data that we hash. Fill a Serializer
373  // with the stuff that stays constant from signature to signature.
374  Serializer const dataStart{startMultiSigningData(*this)};
375 
376  // We also use the sfAccount field inside the loop. Get it once.
377  auto const txnAccountID = getAccountID(sfAccount);
378 
379  // Determine whether signatures must be full canonical.
380  bool const fullyCanonical = (getFlags() & tfFullyCanonicalSig) ||
381  (requireCanonicalSig == RequireFullyCanonicalSig::yes);
382 
383  // Signers must be in sorted order by AccountID.
384  AccountID lastAccountID(beast::zero);
385 
386  for (auto const& signer : signers)
387  {
388  auto const accountID = signer.getAccountID(sfAccount);
389 
390  // The account owner may not multisign for themselves.
391  if (accountID == txnAccountID)
392  return Unexpected("Invalid multisigner.");
393 
394  // No duplicate signers allowed.
395  if (lastAccountID == accountID)
396  return Unexpected("Duplicate Signers not allowed.");
397 
398  // Accounts must be in order by account ID. No duplicates allowed.
399  if (lastAccountID > accountID)
400  return Unexpected("Unsorted Signers array.");
401 
402  // The next signature must be greater than this one.
403  lastAccountID = accountID;
404 
405  // Verify the signature.
406  bool validSig = false;
407  try
408  {
409  Serializer s = dataStart;
410  finishMultiSigningData(accountID, s);
411 
412  auto spk = signer.getFieldVL(sfSigningPubKey);
413 
414  if (publicKeyType(makeSlice(spk)))
415  {
416  Blob const signature = signer.getFieldVL(sfTxnSignature);
417 
418  validSig = verify(
419  PublicKey(makeSlice(spk)),
420  s.slice(),
421  makeSlice(signature),
423  }
424  }
425  catch (std::exception const&)
426  {
427  // We assume any problem lies with the signature.
428  validSig = false;
429  }
430  if (!validSig)
431  return Unexpected(
432  std::string("Invalid signature on account ") +
433  toBase58(accountID) + ".");
434  }
435  // All signatures verified.
436  return {};
437 }
438 
439 //------------------------------------------------------------------------------
440 
441 static bool
442 isMemoOkay(STObject const& st, std::string& reason)
443 {
444  if (!st.isFieldPresent(sfMemos))
445  return true;
446 
447  auto const& memos = st.getFieldArray(sfMemos);
448 
449  // The number 2048 is a preallocation hint, not a hard limit
450  // to avoid allocate/copy/free's
451  Serializer s(2048);
452  memos.add(s);
453 
454  // FIXME move the memo limit into a config tunable
455  if (s.getDataLength() > 1024)
456  {
457  reason = "The memo exceeds the maximum allowed size.";
458  return false;
459  }
460 
461  for (auto const& memo : memos)
462  {
463  auto memoObj = dynamic_cast<STObject const*>(&memo);
464 
465  if (!memoObj || (memoObj->getFName() != sfMemo))
466  {
467  reason = "A memo array may contain only Memo objects.";
468  return false;
469  }
470 
471  for (auto const& memoElement : *memoObj)
472  {
473  auto const& name = memoElement.getFName();
474 
475  if (name != sfMemoType && name != sfMemoData &&
476  name != sfMemoFormat)
477  {
478  reason =
479  "A memo may contain only MemoType, MemoData or "
480  "MemoFormat fields.";
481  return false;
482  }
483 
484  // The raw data is stored as hex-octets, which we want to decode.
485  auto optData = strUnHex(memoElement.getText());
486 
487  if (!optData)
488  {
489  reason =
490  "The MemoType, MemoData and MemoFormat fields may "
491  "only contain hex-encoded data.";
492  return false;
493  }
494 
495  if (name == sfMemoData)
496  continue;
497 
498  // The only allowed characters for MemoType and MemoFormat are the
499  // characters allowed in URLs per RFC 3986: alphanumerics and the
500  // following symbols: -._~:/?#[]@!$&'()*+,;=%
501  static constexpr std::array<char, 256> const allowedSymbols = []() {
503 
504  std::string_view symbols(
505  "0123456789"
506  "-._~:/?#[]@!$&'()*+,;=%"
507  "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
508  "abcdefghijklmnopqrstuvwxyz");
509 
510  for (char c : symbols)
511  a[c] = 1;
512  return a;
513  }();
514 
515  for (auto c : *optData)
516  {
517  if (!allowedSymbols[c])
518  {
519  reason =
520  "The MemoType and MemoFormat fields may only "
521  "contain characters that are allowed in URLs "
522  "under RFC 3986.";
523  return false;
524  }
525  }
526  }
527  }
528 
529  return true;
530 }
531 
532 // Ensure all account fields are 160-bits
533 static bool
535 {
536  for (int i = 0; i < st.getCount(); ++i)
537  {
538  auto t = dynamic_cast<STAccount const*>(st.peekAtPIndex(i));
539  if (t && t->isDefault())
540  return false;
541  }
542 
543  return true;
544 }
545 
546 bool
548 {
549  if (!isMemoOkay(st, reason))
550  return false;
551 
552  if (!isAccountFieldOkay(st))
553  {
554  reason = "An account field is invalid.";
555  return false;
556  }
557 
558  if (isPseudoTx(st))
559  {
560  reason = "Cannot submit pseudo transactions.";
561  return false;
562  }
563  return true;
564 }
565 
567 sterilize(STTx const& stx)
568 {
569  Serializer s;
570  stx.add(s);
571  SerialIter sit(s.slice());
572  return std::make_shared<STTx const>(std::ref(sit));
573 }
574 
575 bool
577 {
578  auto t = tx[~sfTransactionType];
579  if (!t)
580  return false;
581  auto tt = safe_cast<TxType>(*t);
582  return tt == ttAMENDMENT || tt == ttFEE || tt == ttUNL_MODIFY;
583 }
584 
585 } // namespace ripple
ripple::getTxFormat
static auto getTxFormat(TxType type)
Definition: STTx.cpp:46
ripple::JsonOptions::disable_API_prior_V2
@ disable_API_prior_V2
Definition: STBase.h:44
ripple::isAccountFieldOkay
static bool isAccountFieldOkay(STObject const &st)
Definition: STTx.cpp:534
ripple::STObject::getFieldArray
const STArray & getFieldArray(SField const &field) const
Definition: STObject.cpp:624
ripple::STObject::applyTemplate
void applyTemplate(const SOTemplate &type)
Definition: STObject.cpp:116
ripple::Blob
std::vector< unsigned char > Blob
Storage for linear binary data.
Definition: Blob.h:30
ripple::STTx::getMetaSQL
std::string getMetaSQL(std::uint32_t inLedger, std::string const &escapedMetaData) const
Definition: STTx.cpp:280
ripple::makeSlice
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)
Definition: Slice.h:241
std::string
STL class.
std::shared_ptr
STL class.
ripple::sfSigners
const SField sfSigners
utility
ripple::SeqProxy::ticket
@ ticket
Definition: SeqProxy.h:58
std::exception
STL class.
ripple::STObject::setFieldU16
void setFieldU16(SField const &field, std::uint16_t)
Definition: STObject.cpp:653
std::string_view
STL class.
ripple::STObject::peekAtPIndex
const STBase * peekAtPIndex(int offset) const
Definition: STObject.h:936
ripple::sfSequence
const SF_UINT32 sfSequence
ripple::txMinSizeBytes
constexpr std::size_t txMinSizeBytes
Protocol specific constants.
Definition: Protocol.h:40
ripple::verify
bool verify(PublicKey const &publicKey, Slice const &m, Slice const &sig, bool mustBeFullyCanonical) noexcept
Verify a signature on a message.
Definition: PublicKey.cpp:272
std::vector< unsigned char >
ripple::sfSigningPubKey
const SF_VL sfSigningPubKey
ripple::SerializedTypeID
SerializedTypeID
Definition: SField.h:104
ripple::Unexpected
Unexpected(E(&)[N]) -> Unexpected< E const * >
ripple::ttFEE
@ ttFEE
This system-generated transaction type is used to update the network's fee settings.
Definition: TxFormats.h:204
ripple::toBase58
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
Definition: AccountID.cpp:104
ripple::tfFullyCanonicalSig
constexpr std::uint32_t tfFullyCanonicalSig
Transaction flags.
Definition: TxFlags.h:58
ripple::STObject::getSerializer
Serializer getSerializer() const
Definition: STObject.h:902
ripple::SeqProxy::sequence
static constexpr SeqProxy sequence(std::uint32_t v)
Factory function to return a sequence-based SeqProxy.
Definition: SeqProxy.h:76
ripple::TxType
TxType
Transaction type identifiers.
Definition: TxFormats.h:56
ripple::STTx::getSigningHash
uint256 getSigningHash() const
Definition: STTx.cpp:165
ripple::STTx::getSeqProxy
SeqProxy getSeqProxy() const
Definition: STTx.cpp:184
ripple::sfTicketSequence
const SF_UINT32 sfTicketSequence
ripple::STTx::getMetaSQLInsertReplaceHeader
static std::string const & getMetaSQLInsertReplaceHeader()
Definition: STTx.cpp:268
std::function
ripple::STObject::setFieldVL
void setFieldVL(SField const &field, Blob const &)
Definition: STObject.cpp:695
ripple::STObject::getFieldVL
Blob getFieldVL(SField const &field) const
Definition: STObject.cpp:595
ripple::ttAMENDMENT
@ ttAMENDMENT
This system-generated transaction type is used to update the status of the various amendments.
Definition: TxFormats.h:198
ripple::ECDSACanonicality::fullyCanonical
@ fullyCanonical
ripple::finishMultiSigningData
void finishMultiSigningData(AccountID const &signingID, Serializer &s)
Definition: Sign.h:85
ripple::STObject::getFullText
std::string getFullText() const override
Definition: STObject.cpp:254
ripple::uint256
base_uint< 256 > uint256
Definition: base_uint.h:550
std::underlying_type_t
ripple::publicKeyType
std::optional< KeyType > publicKeyType(Slice const &slice)
Returns the type of public key.
Definition: PublicKey.cpp:207
ripple::Serializer::getDataLength
int getDataLength() const
Definition: Serializer.h:185
ripple::base_uint< 160, detail::AccountIDTag >
ripple::sfTransactionType
const SF_UINT16 sfTransactionType
ripple::isPseudoTx
bool isPseudoTx(STObject const &tx)
Check whether a transaction is a pseudo-transaction.
Definition: STTx.cpp:576
ripple::getSigningData
static Blob getSigningData(STTx const &that)
Definition: STTx.cpp:156
ripple::ttUNL_MODIFY
@ ttUNL_MODIFY
This system-generated transaction type is used to update the network's negative UNL.
Definition: TxFormats.h:210
ripple::Expected
Definition: Expected.h:132
ripple::sfMemos
const SField sfMemos
Json::objectValue
@ objectValue
object value (collection of name/value pairs).
Definition: json_value.h:43
ripple::passesLocalChecks
bool passesLocalChecks(STObject const &st, std::string &reason)
Definition: STTx.cpp:547
ripple::STBase::emplace
static STBase * emplace(std::size_t n, void *buf, T &&val)
Definition: STBase.h:220
ripple::TxFormats::getInstance
static TxFormats const & getInstance()
Definition: TxFormats.cpp:489
ripple::PublicKey
A public key.
Definition: PublicKey.h:61
ripple::STObject::getAccountID
AccountID getAccountID(SField const &field) const
Definition: STObject.cpp:589
ripple::STTx::getFullText
std::string getFullText() const override
Definition: STTx.cpp:121
ripple::safe_cast
constexpr std::enable_if_t< std::is_same_v< typename Dest::unit_type, typename Src::unit_type > &&std::is_integral_v< typename Dest::value_type > &&std::is_integral_v< typename Src::value_type >, Dest > safe_cast(Src s) noexcept
Definition: FeeUnits.h:536
ripple::startMultiSigningData
Serializer startMultiSigningData(STObject const &obj)
Break the multi-signing hash computation into 2 parts for optimization.
Definition: Sign.cpp:95
ripple::STArray
Definition: STArray.h:28
std::to_string
T to_string(T... args)
ripple::isMemoOkay
static bool isMemoOkay(STObject const &st, std::string &reason)
Definition: STTx.cpp:442
array
ripple::STAmount
Definition: STAmount.h:46
ripple::Serializer::slice
Slice slice() const noexcept
Definition: Serializer.h:64
ripple::txnSqlValidated
@ txnSqlValidated
Definition: STTx.h:41
ripple::STObject::getFlags
std::uint32_t getFlags() const
Definition: STObject.cpp:481
ripple::STTx
Definition: STTx.h:46
ripple::isXRP
bool isXRP(AccountID const &c)
Definition: AccountID.h:91
ripple::SerialIter
Definition: Serializer.h:311
ripple::HashPrefix::transactionID
@ transactionID
transaction plus signature to give transaction ID
ripple::STTx::maxMultiSigners
static std::size_t maxMultiSigners(Rules const *rules=0)
Definition: STTx.h:56
std::uint32_t
ripple::SecretKey
A secret key.
Definition: SecretKey.h:36
ripple::STObject::addWithoutSigningFields
void addWithoutSigningFields(Serializer &s) const
Definition: STObject.h:893
ripple::txMaxSizeBytes
constexpr std::size_t txMaxSizeBytes
Largest legal byte size of a transaction.
Definition: Protocol.h:43
ripple::STTx::sign
void sign(PublicKey const &publicKey, SecretKey const &secretKey)
Definition: STTx.cpp:199
ripple::STObject::getFieldU16
std::uint16_t getFieldU16(SField const &field) const
Definition: STObject.cpp:553
ripple::STTx::getJson
Json::Value getJson(JsonOptions options) const override
Definition: STTx.cpp:231
memory
ripple::STTx::getTransactionID
uint256 getTransactionID() const
Definition: STTx.h:193
ripple::Serializer
Definition: Serializer.h:40
ripple::STAccount
Definition: STAccount.h:31
ripple::sfMemoData
const SF_VL sfMemoData
ripple::STObject::add
void add(Serializer &s) const override
Definition: STObject.cpp:85
ripple::sfTxnSignature
const SF_VL sfTxnSignature
ripple::STObject
Definition: STObject.h:53
ripple::STTx::checkSingleSign
Expected< void, std::string > checkSingleSign(RequireFullyCanonicalSig requireCanonicalSig) const
Definition: STTx.cpp:310
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::sterilize
std::shared_ptr< STTx const > sterilize(STTx const &stx)
Sterilize a transaction.
Definition: STTx.cpp:567
ripple::JsonOptions
Note, should be treated as flags that can be | and &.
Definition: STBase.h:35
ripple::JsonOptions::none
@ none
Definition: STBase.h:42
ripple::STObject::getSigningHash
uint256 getSigningHash(HashPrefix prefix) const
Definition: STObject.cpp:348
ripple::STTx::RequireFullyCanonicalSig::yes
@ yes
ripple::SerialIter::getBytesLeft
int getBytesLeft() const noexcept
Definition: Serializer.h:342
ripple::STTx::STTx
STTx()=delete
ripple::STTx::checkSign
Expected< void, std::string > checkSign(RequireFullyCanonicalSig requireCanonicalSig, Rules const &rules) const
Definition: STTx.cpp:210
ripple::sign
Buffer sign(PublicKey const &pk, SecretKey const &sk, Slice const &m)
Generate a signature for a message.
Definition: SecretKey.cpp:238
ripple::STBase
A type which can be exported to a well known binary format.
Definition: STBase.h:121
ripple::STTx::getSignature
Blob getSignature() const
Definition: STTx.cpp:171
std
STL namespace.
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:48
ripple::STObject::isFieldPresent
bool isFieldPresent(SField const &field) const
Definition: STObject.cpp:428
ripple::STTx::tid_
uint256 tid_
Definition: STTx.h:48
ripple::Serializer::peekData
Blob const & peekData() const
Definition: Serializer.h:169
ripple::STTx::getMentionedAccounts
boost::container::flat_set< AccountID > getMentionedAccounts() const
Definition: STTx.cpp:132
ripple::SeqProxy
A type that represents either a sequence value or a ticket value.
Definition: SeqProxy.h:55
std::vector::empty
T empty(T... args)
ripple::Rules
Rules controlling protocol behavior.
Definition: Rules.h:33
ripple::STTx::minMultiSigners
static const std::size_t minMultiSigners
Definition: STTx.h:52
std::optional< std::uint32_t >
ripple::STObject::getCount
int getCount() const
Definition: STObject.h:918
ripple::STTx::copy
STBase * copy(std::size_t n, void *buf) const override
Definition: STTx.cpp:102
std::size_t
ripple::to_string
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
Definition: app/misc/impl/Manifest.cpp:41
ripple::sfMemo
const SField sfMemo
ripple::sfAccount
const SF_ACCOUNT sfAccount
ripple::Serializer::add32
int add32(std::uint32_t i)
Definition: Serializer.cpp:38
ripple::strHex
std::string strHex(FwdIt begin, FwdIt end)
Definition: strHex.h:30
ripple::Serializer::getData
Blob getData() const
Definition: Serializer.h:174
ripple::HashPrefix::txSign
@ txSign
inner transaction to sign
ripple::STObject::operator[]
T::value_type operator[](TypedField< T > const &f) const
Get the value of a field.
Definition: STObject.h:949
ripple::STObject::getFieldU32
std::uint32_t getFieldU32(SField const &field) const
Definition: STObject.cpp:559
ripple::STObject::getJson
Json::Value getJson(JsonOptions options) const override
Definition: STObject.cpp:731
ripple::strUnHex
std::optional< Blob > strUnHex(std::size_t strSize, Iterator begin, Iterator end)
Definition: StringUtilities.h:52
ripple::STTx::checkMultiSign
Expected< void, std::string > checkMultiSign(RequireFullyCanonicalSig requireCanonicalSig, Rules const &rules) const
Definition: STTx.cpp:350
ripple::STObject::set
void set(const SOTemplate &)
Definition: STObject.cpp:100
ripple::STTx::move
STBase * move(std::size_t n, void *buf) override
Definition: STTx.cpp:108
ripple::STTx::RequireFullyCanonicalSig
RequireFullyCanonicalSig
Check the signature.
Definition: STTx.h:122
type_traits
ripple::KnownFormats::findByType
Item const * findByType(KeyType type) const
Retrieve a format based on its type.
Definition: KnownFormats.h:127
ripple::sfTransaction
const SField sfTransaction
ripple::sqlBlobLiteral
std::string sqlBlobLiteral(Blob const &blob)
Format arbitrary binary data as an SQLite "blob literal".
Definition: StringUtilities.cpp:33
ripple::STTx::getSType
SerializedTypeID getSType() const override
Definition: STTx.cpp:115
std::ref
T ref(T... args)
Json::Value
Represents a JSON value.
Definition: json_value.h:145
ripple::STTx::tx_type_
TxType tx_type_
Definition: STTx.h:49
ripple::STObject::getHash
uint256 getHash(HashPrefix prefix) const
Definition: STObject.cpp:339
ripple::sfMemoFormat
const SF_VL sfMemoFormat
ripple::sfMemoType
const SF_VL sfMemoType